Attempting to create an item-on-ground with LuaSurface.create_entity without providing the stack parameter results in an error.
https://lua-api.factorio.com/latest/cla ... ate_entity
The stack property works fine, however it is not documented that it is accepted by the function.
/c game.player.surface.create_entity{name = "item-on-ground", position = game.player.position}
Error: Key "stack" not found in property tree
/c game.player.surface.create_entity{name = "item-on-ground", position = game.player.position, stack = "blueprint"} works sucessfully. I assume it accepts a SimpleItemStack.
[1.1.107] LuaSurface.create_entity docs missing stack property
-
- Inserter
- Posts: 48
- Joined: Sun Jan 03, 2016 10:28 am
- Contact:
-
- Inserter
- Posts: 48
- Joined: Sun Jan 03, 2016 10:28 am
- Contact:
Re: [1.1.107] LuaSurface.create_entity docs missing stack property
I see now that this is supposed to go in viewforum.php?f=233 - sorry about that
Re: [1.1.107] LuaSurface.create_entity docs missing stack property
"item-on-ground" is an "item-entity" prototype. If you look closely, right below the table "Parameters", after the sentence "Other attributes may be specified depending on the type of entity:", you'll find this note about item-entities: So the info already is available, but it's easy to miss the optional, type-based parameters after the first table. For example, I recently had to search the forum because I couldn't figure out how to create a character-corpse with >0 item slots. I eventually found an answer to a question about exactly the same issue that pointed out the type-specific parameters (fun fact: I've also posted the original question some years ago).Danielv123 wrote: ↑Mon Apr 15, 2024 9:00 pm Attempting to create an item-on-ground with LuaSurface.create_entity without providing the stack parameter results in an error.
https://lua-api.factorio.com/latest/cla ... ate_entity
The stack property works fine, however it is not documented that it is accepted by the function.
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!
Re: [1.1.107] LuaSurface.create_entity docs missing stack property
As Pi-C notes, this already documented for the entity type, which is "item-entity", not "item-on-ground".
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.