Factory Inspector


Measures per-recipe consumption and production for all items. Want to know which recipe is consuming all your green circuits? This mod can tell you. Designed for complex modded games where each item has many producers and consumers.

Utilities
26 days ago
1.1
3.99K

b Nonrecoverable error 1.1.19

5 months ago

There was a nonrecoverable error 1.1.19 for Factory Inspector at the same time a nonrecoverable error occurred for Bio Industries mod (1.1.18). I have posted a message for that mod owner already. When I was attempting to place a Bio Industry item, "Terraformer," I received the following error:

Notice

The mod Bio Industries (1.1.18) caused a non-recoverable error.
Please report this error to the mod author.

Error while running event Bio_Industries::on_built_entity (ID 6)
The mod Factory Inspector (1.1.19) caused a non-recoverable error.
Please report this error to the mod author.
Error while running event factory-inspector::script_raised_built (ID 79)
factory-inspector/script/event-handlers.lua:7: attempt to index field
'created_entity' (a nil value)
stack traceback:
_factory-inspector__/script/event-handlers.lua:7: in function
<factory-inspector/script/event-handlers.lua:6>
stack traceback:
[C]: in function 'create_entity'
_Bio_Industries__/controllua:409: in function 'handler'
stdlib/stdlib/event/event.lua:342: in function 'pcall'
stdlib/stdlib/event/event.lua:362: in function 'dispatch_event'
_stdlib__/stdlib/event/event.lua:438: in function
_stdlib__/stdlib/event/event.lua:396>

5 months ago
(updated 5 months ago)

Hi, Aurensar! I'm collaborating on BI. The reported bug seems to be an errror on your end. I've added a bit more logging to your function onBuiltEntity and tried to place a terraformer. This is the output:

 321.494 Script @__Bio_Industries__/common.lua:212: End of function On_Built
 321.495 Script @__factory-inspector__/script/event-handlers.lua:7: Event data: {
   entity = {
     __self = "userdata"
   },
   name = 79,
   tick = 638
 }
  321.496 Error MainLoop.cpp:1391: Exception at tick 638: The mod Bio Industries (1.1.19) caused a non-recoverable error.
 Please report this error to the mod author.

 Error while running event Bio_Industries::on_built_entity (ID 6)
 The mod Factory Inspector (1.1.19) caused a non-recoverable error.
 Please report this error to the mod author.

 Error while running event factory-inspector::script_raised_built (ID 79)
 __factory-inspector__/script/event-handlers.lua:8: attempt to index field 'created_entity' (a nil value)

created_entity exists for defines.events.on_built_entity, but in this case you respond to defines.events.script_raised_built, which has entity instead of created_entity. You can fix the crash this way:

local function onBuiltEntity(event)
    local entity = event.created_entity or event.entity

    if entity and entity.valid then
      logger.log("Entity created: "..entity.unit_number)
      entity_tracker.enrolNewEntity(entity)
    end
end
5 months ago

Thanks, I'll try to get a fix out for this ASAP.

5 months ago
(updated 5 months ago)

Pi-C posted the instructions below in his thread for me, and I am wondering if either of you could tell me where I can find the folder to do the following. I clicked on the Steam's game's browse folder option but I couldn't find it from there.

"I've replied in the thread you've opened there and provided a simple fix that you can apply manually (unpack Factory Inspector and edit the function starting at line 6 in script/event-handlers.lua) until the mod is updated."

5 months ago
(updated 5 months ago)

[duplicate message - please delete]

5 months ago

I don't have Steam myself, but this wiki page should have the information you need. :-)

3 months ago
(updated 3 months ago)

So, the wiki helped, since I am using Steam but it wasn't as fully detailed as it could have been. Your coding worked, but I had to do the following to make the manual patch happen. I am providing this in case someone else would like to do this too.

Go to C:\Program Files\Factorio -> mods -> right-click on factory-inspector_1.1.19 and "extract all" - > open the extracted factory-inspector_1.1.19 folder -> open the folder within that is factory-inspector_1.1.19 -> open script folder -> open event-handlers document -> replace lines 6-9 with the new coding you provided above and then save the document.

Afterwards, go back to C:\Program Files\Factorio -> mods -> right-click on the uncompressed Factorio-inspector_1.1.19 and either "compress to ZIP file" or "send to" "compressed folder" and save over the original compressed folder (or you can move that folder somewhere else outside of the main Factorio folder) that has the same name as the original folder. When starting the game, it will offer you to "sync and load" the game. Go ahead and choose that option. It will not overwrite the patch that you made since Factorio realizes the compressed folder with the same name is still there. Then voila, everything works and you can play and drop the Terraformer without experiencing the same error.

Thank you so much for the coding for the patch and the link to the wiki page.

26 days ago

This should be fixed in the main mod now. Thanks to everyone who helped to track down the fix.

New response