To reproduce:
1. Place two of the same entity in the same spot using a command (used a stone furnace in testing).
2. Fast replace the entity either manually or via command (used a steel furnace in testing).
3. Observe both entities getting replaced with a single new entity.
Expected behavior:
The number of entities didn't change. Either:
1. Only one of the two entities was replaced (preferable).
2. Both entities were replaced each with a new entity.
[Rseding] [1.1.41] Fast replace deconstructs any extra entities at the same position.
Re: [1.1.41] Fast replace deconstructs any extra entities at the same position.
You have expected behaviour of something that shouldn't be possible at all.
The step of 1. how to reproduce is the bug and not the step 2 or 3.
The step of 1. how to reproduce is the bug and not the step 2 or 3.
Re: [1.1.41] Fast replace deconstructs any extra entities at the same position.
Tell it to everyone. That is how create_entity works, and seemingly by design. I'm sure the devs won't be thrilled about the prospect of a major breaking change that you propose.
Re: [Rseding] [1.1.41] Fast replace deconstructs any extra entities at the same position.
I'm not sure if any behavior is "correct".
* Replace them all with 1 new entity
* Replace just 1 (why? which one? what if the new entity is invalid to both exist on the same place but 2 of the previous entity was fine?)
* Replace them all with multiple entities (which one gets the items? what if you don't have enough items to replace them all?)
None of the behaviors make any sense to me... I'd almost rather leave it as is and tell mod devs "don't put multiple entities in the same place and let them be fast-replaced".
* Replace them all with 1 new entity
* Replace just 1 (why? which one? what if the new entity is invalid to both exist on the same place but 2 of the previous entity was fine?)
* Replace them all with multiple entities (which one gets the items? what if you don't have enough items to replace them all?)
None of the behaviors make any sense to me... I'd almost rather leave it as is and tell mod devs "don't put multiple entities in the same place and let them be fast-replaced".
If you want to get ahold of me I'm almost always on Discord.
Re: [Rseding] [1.1.41] Fast replace deconstructs any extra entities at the same position.
* Replace all with 1 new entity: If I place a chemical plant over a bunch of trees all the trees get replaced with one chemical plant. So there is precedence for deconstructing everything in the way of the new entity.Rseding91 wrote: ↑Fri Oct 29, 2021 1:06 am I'm not sure if any behavior is "correct".
* Replace them all with 1 new entity
* Replace just 1 (why? which one? what if the new entity is invalid to both exist on the same place but 2 of the previous entity was fine?)
* Replace them all with multiple entities (which one gets the items? what if you don't have enough items to replace them all?)
None of the behaviors make any sense to me... I'd almost rather leave it as is and tell mod devs "don't put multiple entities in the same place and let them be fast-replaced".
* Replace just 1: That seems preferable. You only click at one entity at a time to replace it. Want to replace both then click twice. Which one? The one that gets highlighted. As for the new entity being invalid: Why should the game let you replace anything then? I can't put a belt on water either. If the result of the placement is invalid it simply isn't allowed.
* Replace them all: make that replace them each. Replacing 3 stone furnaces with 2 steel furnaces truly would make no sense. And which one gets the items? Each one gets the items of the entity it replaces. Not enough items? If I try to place a rail curve but only have 1 rail then the game won't let me, not enough rails. Same thing here. On the other hand I can replace 6 belts with 2 underground belts. The player gets the items then.
Seems to me all options have similar effects already in the game.
If you have multiple entities in a place doesn't that mean it's always placed by script? Some mod that needs hidden entities so the combined construct does what the mods wants? Like the miniloader having an inserter hidden under it. I can't think of any case where a player or construction bot could place 2 furnaces on top of each other.
So why isn't the mod catching the fast replace and handling it properly too? Only one of the furnaces should be selectable and fast replacable or something. Iirc you can fast replace the miniloader just fine and the mod will switch the hidden entities too.
So +1 one of shoving that over to the mod: Don't allow fast-replace or implement a sensible solution.
Re: [Rseding] [1.1.41] Fast replace deconstructs any extra entities at the same position.
As I see it, the user is asking for just one of them to be replaced, the third option does not reflect that (although it does solve the main issue: the number of entities changing, which is why I included it into the OP). And replace all with one doesn't make any sense in the context of fast replace, which is supposed to change one entity to another. So that leaves us with replacing only one:Rseding91 wrote: ↑Fri Oct 29, 2021 1:06 am I'm not sure if any behavior is "correct".
* Replace them all with 1 new entity
* Replace just 1 (why? which one? what if the new entity is invalid to both exist on the same place but 2 of the previous entity was fine?)
* Replace them all with multiple entities (which one gets the items? what if you don't have enough items to replace them all?)
None of the behaviors make any sense to me... I'd almost rather leave it as is and tell mod devs "don't put multiple entities in the same place and let them be fast-replaced".
Which one? Maybe there should be an argument to specify that. Maybe replace the first one you find that can be replaced.
What if the new placement is invalid? Seems like you are saying "invalid" in the sense of fundamentally impossible (e.g. two belts in one tile) rather than just not allowed to be placed there (which scripts ignore anyway). I'm not sure what can possibly cause this, given that fast replaceable entities must have the same type and size. But if it does happen, I'd say that the entity can't be replaced in that case.
This brings me to how I have found this bug to begin with, which I feel is now relevant: if you call create_entity with the fast replace flag and it doesn't find anything to fast replace, it just spawns a new entity. This seems illogical to me. The user is asking to fast replace specifically, it doesn't make sense to create a new entity. Although I can see it being a reuse of the player building logic.