Jump to content

Spawning Factory using Entity Debugger Fails to Initialise Produced Goods


Shrooblord

Recommended Posts

Hey there,

 

I was just messing around with the Entity Debugger, and I found out its script for spawning factories is incomplete. When you spawn a factory in using the ED, it actually fails to properly initialise the factory, resulting in an empty trading window (no tabs, no products or ingredients to sell to it; nothing, except the title and a couple of horizontal dividers).

 

REPRO:

[*]Select the spacecraft you're currently piloting.

[*]Attach the Entity Debugger to it by bringing up chat and entering the following command: /run Entity():addScript("lib/entitydbg.lua")

[*]Go to the Spawn Factories tab.

[*]Spawn any Factory.

[*]Interact with it with F.

[*]Click Trade Goods.

[*]EXPECTED: You see a normal trading window.

[*]RESULT: You instead see a blank page with only a title and some horizontal dividers.

 

 

I also managed to fix the problem. By hijacking the same code used in stationfounder.lua to immediately invoke the initialisation of produced goods, the problem is resolved.

Change from:



--entitydbg.lua, around line 392
Entity():addScript("data/scripts/entity/merchants/factory.lua", production.results[1].name)

into



--entitydbg.lua, around line 392
Entity():addScript("data/scripts/entity/merchants/factory.lua", production.results[1].name)
Entity():invokeFunction("factory", "setProduction", production, 1)

 

Likewise, change from:



--entitydbg.lua, around line 402
station:addScript("data/scripts/entity/merchants/factory.lua", production.results[1].name)

into



--entitydbg.lua, around line 402
station:addScript("data/scripts/entity/merchants/factory.lua", production.results[1].name)
station:invokeFunction("factory", "setProduction", production, 1)

 

in order to fix the bug. ^^

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...