[0.17.74] Crash and bugs when removing some collision masks from rails

This subforum contains all the issues which we already resolved.
LeonSkills
Burner Inserter
Burner Inserter
Posts: 14
Joined: Mon Feb 11, 2019 12:37 pm
Contact:

[0.17.74] Crash and bugs when removing some collision masks from rails

Post by LeonSkills »

I am building a rail system where sometimes I want other entities to be able to be build on (parts of) rails. So I removed the collision masks

Code: Select all

data.raw["straight-rail"]["straight-rail"].collision_mask = {"not-colliding-with-itself"}
data.raw["curved-rail"]["curved-rail"].collision_mask = {"not-colliding-with-itself"}
Problem is that you can now place rails on the exact same tiles in the same direction.


Saving and reloading crashes the game if there are overlapping rail tracks. It didn't crash when they were contained; ([]) = no crash. ([)] = crash
factorio-current.log
(27.64 KiB) Downloaded 160 times
56.412 Error RailSegment.cpp:158: Error when creating segment 15, found rail (straight-rail on {-25.0000000000, -9.0000000000}) already connected to segment 9
A train is also unable to drive from one contained track to another.

So I added an additional layer to the rails

Code: Select all

data.raw["straight-rail"]["straight-rail"].collision_mask = {"layer-11", "not-colliding-with-itself"}
data.raw["curved-rail"]["curved-rail"].collision_mask = {"layer-11", "not-colliding-with-itself"}


Which fixed the above issue, except for ghosts

It still places ghost entities over already placed rails.
And it doesn't respect that (in this case) the furnace has different collision mask as the rail, although the player can place rails under the furnace. I can place ghost furnaces on the rails, not the other way around

I have had some cases where the save issue also happened in the last case with "layer-11", but can't seem to reproduce them right now. Might have been another error.
Also I think the "not-colliding-with-itself" mask doesn't change anything.

Use case?
Tiny trains
Image

Sucks to not be able to change the collision box and selection box of rails.
I kind of understand why for the collision box. Isn't it possible to separate the entity collision and selection box from the boxes that are used to check track collisions for signals and trains? Making the collision_box moddable.
I don't understand why the selection box can't be modified. They are also still defined in data.raw in base game for both straight and curved rails, although they are not used and changing them doesn't do anything.
Rseding91
Factorio Staff
Factorio Staff
Posts: 14247
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [0.17.74] Crash and bugs when removing some collision masks from rails

Post by Rseding91 »

Thanks for the report. I really only see this going one way: making it so mods can't change collision masks for rails. Because exactly what you've done happens and it breaks saves.

It's the same reason why the collision box/selection box can't be changed.
If you want to get ahold of me I'm almost always on Discord.
LeonSkills
Burner Inserter
Burner Inserter
Posts: 14
Joined: Mon Feb 11, 2019 12:37 pm
Contact:

Re: [0.17.74] Crash and bugs when removing some collision masks from rails

Post by LeonSkills »

Right, thanks. Kind of regret making the report now before doing some more testing.

The bug is only there when it doesn't have a "floor-layer" or a "water-tile" layer.
Maybe have a check that the collision_mask of a rail should contain at least one of those?

Right now adding (or rather, not removing) the "floor-layer" mask solves it for me.
Rseding91
Factorio Staff
Factorio Staff
Posts: 14247
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [0.17.74] Crash and bugs when removing some collision masks from rails

Post by Rseding91 »

I've changed it so the game won't allow rails to have zero collision masks and also won't allow different rail prototypes to not collide with each other. That prevents the crash but still allows mods to change the collision masks around (somewhat).

It's the same condition that rolling stock entities have.
If you want to get ahold of me I'm almost always on Discord.
Post Reply

Return to “Resolved Problems and Bugs”