Actual Craft Time

Display actual craft times for assemblers, furnaces and rocket silo
a month ago
0.16 - 0.17

b Still crashing with 0.3.6

- 2 months ago
- 2 months ago

Yep, same error with a Lab:

Error while running event Actual_Craft_Time::on_gui_opened (ID 83)
__Actual_Craft_Time__/control.lua:33: attempt to index global 'player' (a nil value)
stack traceback:
        __Actual_Craft_Time__/control.lua:33: in function 'getRecipe'
        __Actual_Craft_Time__/control.lua:388: in function <__Actual_Craft_Time__/control.lua:375>
- 2 months ago

It looks like the player variable is never defined, hence why it is nil in the control.lua file at:

local function getRecipe(entity)
local recipe
    if entity.type:find("lab") then
        recipe = player.force.current_research

It looks like on line 388 where this function is called via local recipe = getRecipe(entity), the line immediately above it on line 387 contains local player = game.players[playerIndex], and it looks like this player should actually be passed in to the getRecipe function as another argument.

- 2 months ago

In addition, the getRecipe function is also called on line 595, and there is also a local player variable in scope then too that should be passed in as well.

- 2 months ago

wow, how could I miss that. I swear I looked over it, I was sure I didn't need anything other than entity passed to getRecipe. fixed v0.3.7

- 2 months ago

I have crashes like those, maybe it has something to do with bob's machines and/or bob's modules, I have both