raiguard / EditorExtensions

Extends the Factorio map editor with new features, testing tools, and other utilities to aid with sandbox play and scenario creation.
https://mods.factorio.com/mod/EditorExtensions
Other
26 stars 6 forks source link

After infinity wagon is removed, invisible infinity chest can be left #151

Closed USSX-Hares closed 8 months ago

USSX-Hares commented 10 months ago

Description

Sometimes, after you remove an infinity cargo wagon, its linked infinity chest can be left as an invisible entity which can't be removed without scrips. Inserters can pick items from this chest.

image

These "chests" are drawn on the map view: image

factorio-current.log

Reproduction

Updated 2023-10-16

  1. Create an empty Testing area (New Game -> Editor Extension)
  2. Import the blueprint book below
  3. Enter Editor Mode (Ctrl+Alt+E)
  4. Paste the 1st blueprint from the book
  5. Paste the 2nd blueprint from the book such that wagons are connected to the inserters
  6. Undo the last move (Ctrl+Z)
Click to show the blueprint Blueprint is aligned with the global grid for easier deployment. ``` 0eNrdWV2PozYU/SvIfYUI8xGSvHWrfajUh6rbqlI7q8gBT8aqYyNssjNa5b/XhmQn04yDL4U+9CUJxj7cc23OPbr5ina8pXXDhN7upPwLbb6+jii0+fPq0t5TgtSRltG+YZW9fkabZYhezOcpRGSnJG81jeysmok92uimpSFipRQ9mGJ7QbhdqV9qijaIaXpAIRLkYK8eidIRE4o2mjbIQDJRUfMMfAoH11JqVj4ywfRLVD5Rpa/WJ6fPIaJCM81oH0h38bIV7WFnnrTBjhBCVEtlVklxZhsv8o4vXuQGvmINLfu7mQ3xH6jJneCcyHGHfJm9VVRrk0plZzX0II9025p73ERHq61NgerTfHongNSXFobQyiC08Ay0cl9aCYTWEkIrmYFW4UsrhdBaQWilM9Ba+9LKILRwDOGVzcALe4tGDiIGUo18DmLeslGAiIF0o5iDmLdwrEDEQMqxmoOYt3SsQcRA2rGeg5i3eGBYZQapB56jNife8oFB1TkB6Qeeoz4n/r4DVKETmPOYo0Yn+RhPl08ZwXKM/Zo0ggJqK035fRdoBbXdLqD1GO82ZU7SeIzNmjQCDLWPjmSmCdReu4DSMRZt0pxkY7zUpBHkUJPoSuYSaqNdQMUYGzZpTlZQf+mish5jvKakksVjHNKkEWCo9XMkM0ug5tgFlI7yVpMmJRvlgSYNIQfbO1c+l2AP7EIqRvmnSdOyAlvDjsznsG/3ba76kSHiZEe5GcOL4MczkDLDR/PVASUrnBXrpCiKuEiW2WtDMLah/ZedTZNv1da0ibgs5UFqdqT/pr9Jmr2MvpC9ITmqy6kbwkSktKxvEx8VvSN/68dNMpQm/W/0PafPxDy0CT6ZBNIvhFfBT23JiJBoqA96k4bbALIugNQEIA26uDw2XhT53SansrT2TzoyX9xJLH1LLLnb4RyCzH0hc2/I1Bdy6Q2JfSGLweN26ybdm2VP5tEMycbMEC3nIdKkF46PFTPDH581FfZV7cZ6DelP7jkK1kgR1Zxoe0xK2dp3FcexqboHWdkJREeckk6+vr1L5i1w6tIj4coI090+6UA2vZO59kX03vGrpucApPe5vOpiem+5DeN/sedXvdaBfHpLB/aWo7U3pLccYe+zib31CDtO5/2KnCyC38+HZ7ga45tqfKeuHlmjW8JfC2M/I/phsJ66Vv76poZCVlby+l/GFLT2j6uVmX/l/lZBVbu7FGSHREUYDxmndBH8JirptUvvbnnU/Wv8Cvih3Qff4RyboYqqsmH12TJ80rRWgZbBL2ahrNqSbh6E8W0/c1LS4MMFzyx+EMk7w0mg2vIp0E9EB50sBUwFreCSVGTH6YM4UzEzaMCNOgRWDR5sckhpfcb2Yv3ucD39DbHNiLw= ```

Save file from the original report

  1. Load this save file: Test - City Block - 07.zip
  2. Go to top-right cell
  3. Some inserters on the unload stations can pick up items from the void
raiguard commented 10 months ago

I am unable to reproduce the issue. Have you found a consistent way to make it happen?

USSX-Hares commented 10 months ago

@raiguard I've done it! The root cause seems to be Ctrl+Z in the editor mode. The issue description is updated now.

P.S. It would be nice to have the migration script of the patched version to automatically remove these "floating" chests.

USSX-Hares commented 9 months ago

@raiguard could you remove the "needs more info" label?

USSX-Hares commented 8 months ago

For those who also struggle:

local prototype_name = 'ee-infinity-wagon-chest'

game.player.print(string.format("Searching for entities of prototype %q to remove on region from (%i, %i) to (%i, %i)...", prototype_name, area.left_top[1], area.left_top[2], area.right_bottom[1], area.right_bottom[2]))

local i = 0
for _, e in pairs(game.player.surface.find_entities_filtered { area=area, name=prototype_name })
do
    e.destroy { raise_destroy=true }
    i = i + 1
end

if (i > 0)
then game.player.print(string.format("A total of %i entities of prototype %q were removed.", i, prototype_name))
else game.player.print(string.format("No entities of prototype %q were removed.", prototype_name))
end

(Usage: Editor -> Areas & Positions -> Run Lua Snippets -> Select the area with the chests)

raiguard commented 8 months ago

The fix should clean up any existing proxies after the mod is updated, but let me know if it doesn't.