Page 1 of 1

[0.15.9] Modding, no way to acces crafting_category

Posted: Sat May 06, 2017 5:37 pm
by kikker450
It's less of a bug and more of what seems to be an oversight. I tried to access the crafting_category of an entity_prototype only to find out that the call actually doesn't exist.

The test in my mod file: control.lua

Code: Select all

script.on_event(defines.events.on_gui_click, function(e)
    something = game.entity_prototypes["assembling-machine-1"].crafting_categories
end
returns:
Error while running event dinges::on_gui_click (ID 1)
LuaEntityPrototype doesn't contain key crafting_categories.
but things like this do work

Code: Select all

script.on_event(defines.events.on_gui_click, function(e)
    something = game.entity_prototypes["assembling-machine-1"].crafting_speed
end


It clearly is an attribute of the entity in (Factorio\data\base\prototypes\entity\demo-entities.lua)

Code: Select all

crafting_categories = {"crafting"},
crafting_speed = 0.5,
The call is simply not in the lua documentation (Factorio/doc-html/LuaEntityPrototype.html) nor a description of the value I expect to get (a table with strings in it). But obviously the game uses that value to generate recipes in the gui of an assembler so it seems an oversight.

If there is some way to get the value I'm obviously in the wrong ;P.

Re: [0.15.9] Modding, no way to acces crafting_category

Posted: Sat May 06, 2017 5:47 pm
by Rseding91
The Lua documentation is for the Lua interface - not every property that each prototype supports.

These kinds of requests go in the Mod Interface Rquests (viewforum.php?f=28) section.

I'll add the property to the Lua entity prototype interface.

Re: [0.15.9] Modding, no way to acces crafting_category

Posted: Sat May 06, 2017 5:52 pm
by kikker450
oops my bad and thank you.