Page 1 of 1

[0.18.18] placeable_by allows robots to ignore max_payload

Posted: Sun Apr 19, 2020 4:14 pm
by moon69
I've got a Prototype/SimpleEntityWithForce that requires 20 of the item to build...

Code: Select all

placeable_by = { item = "placeable-test-item", count = 20 },
(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)...

Code: Select all

newEnt = player.surface.create_entity
{
	name = "entity-ghost",
	inner_name = "placeable-test-entity",
	position = pos,
	force = "player"
}
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).

Re: [0.18.18] placeable_by allows robots to ignore max_payload

Posted: Sun Apr 19, 2020 7:29 pm
by Rseding91
Thanks for the report. Construction robots being able to carry more than the inventory limit when building is (as far as I can tell) intended. If they didn't ignore the limit they wouldn't be able to build things like curved rails until you had researched some capacity increase.

Multiple robots going to build a single entity isn't going to happen. I've added a check for the next release to prevent any mod from defining a placeable-by with a count > stack size since that is literally impossible to build outside of the map editor or create-entity console commands.