I will attempt to explain as best I can. The relevant lua code for my mod can be found here: https://github.com/AtelierAmber/RSAD-Tr ... r.lua#L281 Linked to the line that I think is causing it.
Also attached is a save file to test it on. It is extremely easy to reproduce if timed correctly and will happen every time. I have included a small video to demonstrate it as well.
Steps to repro:
- Click the train and send it to the already scheduled station. This, similar to cybersyn, will register the train with the RSAD train system and send it to deliver the wagon.
- After the train has picked up the wagon, place another one at the back of the remaining wagon. This may not be necessary to crash it.
- Once the train is returning to the station, and after it has passed the crossing (such that it can path to the wagon pick up stop), delete the wagon at the drop off stop. This will trigger the linked code above to run and set a new schedule for the train.
Mod list:
- Base Mod
- Elevated Rails
- Debug Adapter for Factorio Mods (via vscode)
- Editor Extensions
- Factorio Library
- Pipe Visualizer 2.0 (Likely not required)
- RSAD Train Yards (My in-dev mod linked above)
Let me know if you require anything else.
Video
Log
Dump
Save
[Genhis][2.0.41] Crash setting train schedule of moving train (RollingStock::checkConsistency) (speed == 0 || closing)
Re: [2.0.41] Crash setting train schedule of moving train (RollingStock::checkConsistency) (speed == 0 || closing)
+1 [v2.0.45]
Working with Space Exploration's space elevators where the mod will split up a train upon reaching the elevator's train stop.
Code: Select all
Error RollingStock.cpp:1431: this->getSpeed() == 0.0 || this->closing was not true
- Attachments
-
- factorio-dump-current.dmp
- (899.8 KiB) Downloaded 9 times
-
- factorio-current.log
- (20.98 KiB) Downloaded 13 times
Re: [2.0.41] Crash setting train schedule of moving train (RollingStock::checkConsistency) (speed == 0 || closing)
I have also been experiencing this issue while testing with space exploration. The issue happened for me when a large train went into the space elevator entrance on Nauvis, but a workaround that seems to work for now, is to remove all the locomotives from the big train, keeping only one locomotive. With 3 locomotives it would crash when entering the space elevator, but with 1 locomotive I haven't had a crash yet.
Re: [2.0.41] Crash setting train schedule of moving train (RollingStock::checkConsistency) (speed == 0 || closing)
I found the crash can be avoided by setting the trains speed to 0 before setting the train to its intended speed, even if doing so is done in the line previous to setting its actual speed. eg.
This will crash in Space Exploration's code:
This will not crash:
This will crash in Space Exploration's code:
Code: Select all
...
train_a.speed = -1
...
Code: Select all
...
train_a.speed = 0
train_a.speed = -1
...
Re: [Genhis][2.0.41] Crash setting train schedule of moving train (RollingStock::checkConsistency) (speed == 0 || closin
Stripped down, simple save and reproduction in vanilla. Base mod only, no SA.
Load the attached save and run the following:
storage.FRONT is the front locomotive entity. storage.BACK is the back locomotive entity.
Result is immediate crash with
Also, adding in a speed = 0 before the speed = 1 avoids the crash.
Load the attached save and run the following:
Code: Select all
/c storage.FRONT.train.schedule = nil storage.FRONT.destroy() storage.BACK.train.speed = 1
Result is immediate crash with
Code: Select all
Error RollingStock.cpp:1431: this->getSpeed() == 0.0 || this->closing was not true
- Attachments
-
- test23.zip
- (821.97 KiB) Downloaded 14 times
Re: [Genhis][2.0.41] Crash setting train schedule of moving train (RollingStock::checkConsistency) (speed == 0 || closin
Thank you all for reproduction steps. The issue is fixed for 2.0.46.