[0.18.18] placeable_by allows robots to ignore max_payload
Posted: Sun Apr 19, 2020 4:14 pm
I've got a Prototype/SimpleEntityWithForce that requires 20 of the item to build...
(see Prototype/Entity.placeable_by)
Problem 1:
If I create a ghost for a "placeable-test-entity", the single construction bot will happily take 20 x placeable-test-item from my inventory in one go and build it in one trip - even though the bots maximum capacity is 5 (1 + 4 bonus)...
Problem 2:
If the placeable_by.count is greater than the stack_size of "placeable-test-item", then the construction bot will take a whole stack and buzz around my (character's) head until I cancel the ghost.
Desired behaviour:
At a minimum in the above circumstances I think the bot should stay put in my inventory until it has enough carrying capacity - similar behaviour as when there are not enough items. This would also require a new alert to inform the player.
Ideally though, multiple bots would carry the required items and/or the single bot would make multiple trips until the required resources are assembled. I appreciate though this is new and possibly computationally intensive functionality. Could be cool though having bots build things on-site rather than just plonk them down?
I've attached a small test mod that exhibits the above behaviour... just start a new game with it and use the standard deconstruction planner to select any area (just using the deconstruct area event to trigger the ghost).
Code: Select all
placeable_by = { item = "placeable-test-item", count = 20 },
Problem 1:
If I create a ghost for a "placeable-test-entity", the single construction bot will happily take 20 x placeable-test-item from my inventory in one go and build it in one trip - even though the bots maximum capacity is 5 (1 + 4 bonus)...
Code: Select all
newEnt = player.surface.create_entity
{
name = "entity-ghost",
inner_name = "placeable-test-entity",
position = pos,
force = "player"
}
If the placeable_by.count is greater than the stack_size of "placeable-test-item", then the construction bot will take a whole stack and buzz around my (character's) head until I cancel the ghost.
Desired behaviour:
At a minimum in the above circumstances I think the bot should stay put in my inventory until it has enough carrying capacity - similar behaviour as when there are not enough items. This would also require a new alert to inform the player.
Ideally though, multiple bots would carry the required items and/or the single bot would make multiple trips until the required resources are assembled. I appreciate though this is new and possibly computationally intensive functionality. Could be cool though having bots build things on-site rather than just plonk them down?
I've attached a small test mod that exhibits the above behaviour... just start a new game with it and use the standard deconstruction planner to select any area (just using the deconstruct area event to trigger the ghost).