Deadlock989 / IndustrialRevolution

Industrial Revolution 3 is an overhaul mod for Factorio.
51 stars 0 forks source link

Waterfill explosive erases spidertron from existence #288

Closed Nebisan closed 1 year ago

Nebisan commented 1 year ago

Describe the issue When a waterfill explosive detonates on a tile which is occupied by a spidertron's foot, the spidertron is instantly erased. Footage: https://youtu.be/FqlI0wh4aRk This happens regardless of if the spidertron is occupied or unoccupied.

Factorio version, IR version Factorio 1.1.87 IR 3.1.5

Other mods installed I have a lot of mods installed, but all of them are small QOL/GUI/retexture mods. These are the ones I suspect may have some interaction with this bug.

I can provide a full list if necessary.

Deadlock989 commented 1 year ago

That's interesting.

I can't reproduce this in IR3 standalone - waterfill explosives don't affect the spider when I set up a very similar situation to the one shown in your video.

I also tried adding Spidertron Enhancements and there was no change, so you can rule that out. You can also rule out Clean Tiles (if it is this mod) since that mod has no runtime scripting (you probably don't need it anyway, IR3 also enforces 100% decorative removal for vanilla placeable tiles).

That leaves Alien Biomes or one of your other mods. If you discover anything that might shed light on which, let me know, but my gut feeling is that this is not something I can "fix".

Nebisan commented 1 year ago

I've figured it out - it's alien biomes. Specifically, if I disable "include inland shallows" in the mod settings, then the spidertron bug occurs. It doesn't seem to matter whether the option is enabled during world generation, only if it's enabled at the moment of the waterfill going off.

Deadlock989 commented 1 year ago

Thanks for the update. Some context: IR3 uses the vanilla tile water-mud for the waterfill explosive - this tile isn't used in map generation but is set up by the base mod to be traversable by characters, vehicles and enemy units (maybe for scenarios or tutorials, I don't know). The tile's collision mask is set up such that the tile is considerably closer to behaving like a ground tile than a water tile, i.e. the aforementioned entities do not collide with it.

I peeked into AB and it's not clear to me what is happening or what the intention was. If the alien-biomes-include-inland-shallows setting is left on the default (lines 577-608 in prototypes/biomes/biomes.lua), then the water-mud tile ends up with a different and unusual collision mask compared to vanilla's, but one that still does not collide with vehicles, which is fine for IR3's purposes and there is no issue. If however the setting is disabled, then some other code elsewhere in AB results in the tile getting the following collision mask instead:

{ "water-tile", "item-layer", "resource-layer", "object-layer", "item-layer" }

This is actually the same set of collision layers as the vanilla default for water-mud that IR3 expects, except that item-layer is duplicated. I don't know if that's really the cause of this issue due to some weirdness in the game engine when collision layers are accidentally specified twice, or if this is just a red herring and there is something else going on with AB and spidertrons, but at any rate I can confirm that spidertrons are destroyed when a tile with this particular collision mask is spawned underneath them - if I recall correctly that is the normal behaviour for an entity when you create a colliding tile under it via scripts or the built-in editor.

In theory I could try to override the tile's collision mask at the last possible moment in order to try and make sure that it has the desired vanilla default. But AB isn't directly supported by IR3 and for all I know, doing this would break AB in some way I can't predict, or cause new issues for other third party mods. So this is something AB's author(s) would have to address if you really want to use the non-default setting.

tburrows13 commented 1 year ago

Hello, I can shed some more light on this one.

In summary, I don't think you really need to bother with 'fixing' this :)

(By the way, I think the waterfill explosive mechanic is awesome, so much cooler than just placing water tiles!)

- Xorimuth

Deadlock989 commented 1 year ago

Ah. Yeah, that would do it.