[0.15 API] item-request-proxy modules is not SimpleItemStack

This subforum contains all the issues which we already resolved.
Post Reply
User avatar
mickael9
Fast Inserter
Fast Inserter
Posts: 112
Joined: Mon Mar 14, 2016 4:04 am
Contact:

[0.15 API] item-request-proxy modules is not SimpleItemStack

Post by mickael9 »

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)

Rseding91
Factorio Staff
Factorio Staff
Posts: 13219
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [0.15 API] item-request-proxy modules is not SimpleItemStack

Post by Rseding91 »

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.
If you want to get ahold of me I'm almost always on Discord.

User avatar
mickael9
Fast Inserter
Fast Inserter
Posts: 112
Joined: Mon Mar 14, 2016 4:04 am
Contact:

Re: [0.15 API] item-request-proxy modules is not SimpleItemStack

Post by mickael9 »

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:
  • 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
The original problem with the docs was that it stated that LuaSurface::create_entity accepted an array of SimpleItemStack (which isn't true because of the item vs name key mismatch)

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)

Rseding91
Factorio Staff
Factorio Staff
Posts: 13219
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [0.15 API] item-request-proxy modules is not SimpleItemStack

Post by Rseding91 »

Ah yes... I miss-read what the code was doing (even though I wrote it) :D

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.

User avatar
mickael9
Fast Inserter
Fast Inserter
Posts: 112
Joined: Mon Mar 14, 2016 4:04 am
Contact:

Re: [0.15 API] item-request-proxy modules is not SimpleItemStack

Post by mickael9 »

The description should be updated as well, it's outdated now:
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.
How about:
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.

Post Reply

Return to “Resolved Problems and Bugs”