LuaEntity::create_entity documentation states that the modules property is an array of SimpleItemStack.
This is not true because the module format is { item = 'name', count = 42 } rather than { name = 'name', count = 42 }
I personally think that this should be replaced with a item_requests property with the same format as LuaEntity::item_requests for consistency (which could also be accepted for entity-ghost)
[0.15 API] item-request-proxy modules is not SimpleItemStack
[0.15 API] item-request-proxy modules is not SimpleItemStack
Factorio Mod Portal Notifier - https://fac-notify.ml/
Cut and paste tools - https://mods.factorio.com/mods/mickael9/cut-and-paste
Portable Chests - https://mods.factorio.com/mods/mickael9/portable-chests
Cut and paste tools - https://mods.factorio.com/mods/mickael9/cut-and-paste
Portable Chests - https://mods.factorio.com/mods/mickael9/portable-chests
Re: [0.15 API] item-request-proxy modules is not SimpleItemStack
Thanks for the report. I've changed the docs to match the LuaEntity version (since that's what it is).
The LuaEntity version already does work on ghosts by the way.
The LuaEntity version already does work on ghosts by the way.
If you want to get ahold of me I'm almost always on Discord.
Re: [0.15 API] item-request-proxy modules is not SimpleItemStack
I think there has been some misunderstanding because I just tested and Factorio 0.15.12 only accepts the old format and the docs are even more incorrect.
Let me sum it up. This is what the game accepts in both 0.15.11 and 0.15.12:
My proposal is to change what LuaSurface::create_entity accepts (and the docs) so that the awkward modules = { { item = "iron-plate", ... } } is replaced with item_requests = { ["iron-plate"] = ... } which makes sense since that's the format it's eventually converted to in LuaEntity::item_requests.
Since this would be a breaking change, I figured we might as well rename it to item_requests for consistency's sake (because it isn't only for modules) and also accept it in LuaSurface::create_entity for entity-ghost entities, again for consistency.
In 0.15.12, the docs say LuaSurface::create_entity accepts modules = { ["iron-plate"] = 10 } which is false (it stills requires the old format, which isn't an array of SimpleItemStack either)
Let me sum it up. This is what the game accepts in both 0.15.11 and 0.15.12:
- surface.create_entity{ name = "item-request-proxy", modules = { { item = "iron-plate", count = 10 } } }
Note this is NOT an array of SimpleItemStack which would be { { name = "iron-plate", count = 10 } } - entity.item_requests = { ["iron-plate"] = 10 }
Where entity is of either item-request-proxy or entity-ghost type
My proposal is to change what LuaSurface::create_entity accepts (and the docs) so that the awkward modules = { { item = "iron-plate", ... } } is replaced with item_requests = { ["iron-plate"] = ... } which makes sense since that's the format it's eventually converted to in LuaEntity::item_requests.
Since this would be a breaking change, I figured we might as well rename it to item_requests for consistency's sake (because it isn't only for modules) and also accept it in LuaSurface::create_entity for entity-ghost entities, again for consistency.
In 0.15.12, the docs say LuaSurface::create_entity accepts modules = { ["iron-plate"] = 10 } which is false (it stills requires the old format, which isn't an array of SimpleItemStack either)
Factorio Mod Portal Notifier - https://fac-notify.ml/
Cut and paste tools - https://mods.factorio.com/mods/mickael9/cut-and-paste
Portable Chests - https://mods.factorio.com/mods/mickael9/portable-chests
Cut and paste tools - https://mods.factorio.com/mods/mickael9/cut-and-paste
Portable Chests - https://mods.factorio.com/mods/mickael9/portable-chests
Re: [0.15 API] item-request-proxy modules is not SimpleItemStack
Ah yes... I miss-read what the code was doing (even though I wrote it)
I'll change it for the next version of 0.15 so they all work similar to the luaentity version + make the create_entity one support the old format as to not break backwards compatibility.
I'll change it for the next version of 0.15 so they all work similar to the luaentity version + make the create_entity one support the old format as to not break backwards compatibility.
If you want to get ahold of me I'm almost always on Discord.
Re: [0.15 API] item-request-proxy modules is not SimpleItemStack
The description should be updated as well, it's outdated now:
modules :: dictionary string → uint: The items to be delivered to target entity from logistic network. If empty, the item request proxy won't be created.
How about:modules :: dictionary string → uint: The stacks of items to be delivered to target entity from logistic network. Each stack must be table. If empty, the item request proxy won't be created.
modules :: dictionary string → uint: The items to be delivered to target entity from logistic network. If empty, the item request proxy won't be created.
Factorio Mod Portal Notifier - https://fac-notify.ml/
Cut and paste tools - https://mods.factorio.com/mods/mickael9/cut-and-paste
Portable Chests - https://mods.factorio.com/mods/mickael9/portable-chests
Cut and paste tools - https://mods.factorio.com/mods/mickael9/cut-and-paste
Portable Chests - https://mods.factorio.com/mods/mickael9/portable-chests