EarendelDevelopers / factorio-mods

This is a public repository for tracking issues with Earendel's factorio mods.
19 stars 3 forks source link

Offshore pump in space #238

Closed EarendelGames closed 1 year ago

EarendelGames commented 2 years ago

The Eternal Drifter:

"I was able to abuse the ghost placement an offshore pump to place it on spaceship floor. by building landfill under it followed by ghost placing ship flooring before using bots to place the offshore pump then ship flooring. in that order. allowing the placement of a pump on spaceship floor which causes no issues when launching a spaceship this allows the movement of an offshore pumps to orbit or to a waterless planet removing the need to transport water"

If this can't be fixed with collision masks then the last resort is to remove offshore pumps from the spaceship surface after launch.

BurninSun commented 2 years ago

Adding this to prototypes/phase-3/space-collision.lua makes the offshore pump vanish upon spaceship launch. I'm out of my league on making these kind of changes to data phase though or if there is any better way of handling it.

for _, prototype in pairs(data.raw["offshore-pump"]) do
  prototype.collision_mask = collision_mask_util_extended.get_mask(prototype)
  collision_mask_util_extended.add_layer(prototype.collision_mask, spaceship_collision_layer)
  data_util.collision_description(prototype)
end
Wiwiweb commented 1 year ago

@BurninSun's fix works because we specifically search for spaceship-colliding entities during clone. By default offshore pumps are only space-colliding.

https://github.com/EarendelDevelopers/space-exploration/blob/5e87f934ab8bf6600a536f345feee20f6a5b279b/scripts/spaceship-clone.lua#L560-L568

I think this exploit only works with offshore pumps because of their special property, where instead of deleting themselves when their tiles are changed, they turn into a "water well pump". I tried the same trick with an industrial furnace and it was deleted as soon as the spaceship floor was placed.

Because of this I think explicitly adding spaceship-collision to all offshore pumps like @BurninSun suggested makes sense, instead of also checking for space-colliding entities, which will never happen except for offshore pumps.

Though, remove data_util.collision_description(prototype) since the description is already correct and it doubles it up.

Wiwiweb commented 1 year ago

I went ahead and added that in bugfixes.