mickael9 / cut-and-paste

Quickly cut or copy an area and paste it where you want (single-use blueprints). External circuit connections are restored when possible.
MIT License
3 stars 2 forks source link

Simpler way to paste over source entities when cutting #7

Open StevilKnevil opened 7 years ago

StevilKnevil commented 7 years ago

If I select an area and want to move it 1m to the left, then usually I'll have an overlap of entities in the source and destination areas. I appreciate that you have tools in place to do it, but I wanted to point you to a solution I implemented (before I realised your mod existed!)

When you initially cut the entities, move them all to the neutral force (item.force = "neutral") and flag them for deconstruction. This will give them the red cross on the map, but the logistic robots won't come and remove them yet because they are no longer part of the players force. However because they are marked for deletion, it is possible to paste the blueprint down overlapping with the source location.

When the result is pasted (which can happen over the top of entities marked for deletion) simply switch the entities back to being on the players force and they'll get cleaned up. If the player cancels the paste (e.g. selects a different tool) then just cancel the deletion and put them back on the players force.

An added benefit to this is that you get to see which source items are currently 'on the clipboard'. (there's a couple of gifs for the result if you're interested: https://forums.factorio.com/viewtopic.php?f=97&t=49146

Hope this inspires you!

mickael9 commented 7 years ago

You can already replace overlapping entities with my mod, you just need to shift click to force the blueprint placement and all colliding entities will be deconstructed:

image

With that said, I agree that having the cut entities marked for deconstruction when placing the blueprint is more user friendly since you don't have to shift click it.

I'll consider adding this, thanks! (let's just hope no mods create logistic networks in the neutral force)

StevilKnevil commented 7 years ago

Yes - I also worried about interfering with the neutral force. In my code I ended up adding a secondary code path that I could switch on with a useCustomForce boolean than would create a new force just for the temporary cutting of items, but again that uses up one of the 64 forces, and another mod might be expecting to use all of those!

You can't win either way :)