[0.15.9] Modding, no way to acces crafting_category

kikker450
Inserter
Inserter
Posts: 30
Joined: Fri May 05, 2017 9:07 am
Contact:

[0.15.9] Modding, no way to acces crafting_category

Post 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.
Rseding91
Factorio Staff
Factorio Staff
Posts: 14912
Joined: Wed Jun 11, 2014 5:23 am
Contact:

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

Post 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.
If you want to get ahold of me I'm almost always on Discord.
kikker450
Inserter
Inserter
Posts: 30
Joined: Fri May 05, 2017 9:07 am
Contact:

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

Post by kikker450 »

oops my bad and thank you.
Post Reply

Return to “Implemented mod requests”