Rivens Realistic Train Acceleration (based on cargo)


This mod makes train acceleration more realistic and depend on the amount of Cargo. (youtube demo included)

Tweaks
11 months ago
1.1
3.29K
Trains

b [solved] Space Elevator Crashes

1 year, 8 months ago
(updated 1 year, 8 months ago)

Hi, I love your mod. However with Space Exploration and space elevator your mod crashes every time when my train try to use space elevator. Every single time I see this note (below), the game crashes itself. Is there any chance to have a look into this, please ? I really enjoy your mod, but cannot run with Space Exploration.

Error while running event TrainSpeeds::on_tick (ID 0)
TrainSpeeds/control.lua:70:attempt to index a nil value stack traceback:
TrainSpeeds/control.lua:70: in function 'getTrainFuelStackUsage'
TrainSpeeds/control.lua:100: in function 'getTrainMass'
TrainSpeeds/control.lua:374: in function
<TrainSpeeds/control.lua:355>

I can send you a screenshot with the crash info if you send me an email or something where I could send a picture.

1 year, 8 months ago
(updated 1 year, 8 months ago)

On that line, this happens:
locomotive.get_fuel_inventory().get_contents()
so maybe that specific locomotive-type doesn't have a fuel-inventory?

I released v0.1.20 a few minutes ago to see whether changing that line prevents the crash.
Otherwise I'd have to install yet-another-mod :)

This support of arbitrary mods is like 95% the effort these days :)

1 year, 8 months ago

Wow, thank you for your quick respond. I have downloaded your latest version and tested, but unfortunately the same issue.

1) I have tested standard locomotive and MK2/MK3 locomotives with cargo and fluid vagon and without vagons at all. Fuel if always full.

2) When train get closer to the space elevator it needs to slow but if run too slow it will crash. When I run manually and with full speed, this crash does not happends every time. I gave got additional lines this time.

TrainSpeeds/control.lua:296: attempt to index field 'burner' (a nil value)
Stack traceback
TrainSpeeds/control.lua:296: in function 'getLocomotiveFuelForceMultiplier'
TrainSpeeds/control.lua:258: in function 'getTrainForceMultiplier'
TrainSpeeds/control.lua:328: in function 'getTrainPullingForce'
TrainSpeeds/control.lua:375: in function 'getTrainForce'
TrainSpeeds/control.lua:401: in function 'adjustTrainAcceleration'
TrainSpeeds/control.lua:521: in function
<TrainSpeeds/control.lua:487>

My email sie kalistenics@gmail.com if you need any more information or pic/video. Thank you very much for your help !!!

1 year, 8 months ago

Seems like I simply have to install the mod(s) as opposed to changing one line or another and asking to retry. Do you have a save game that reproduces the issue by any chance? You could DropBox/GoogleDrive it perhaps.

1 year, 8 months ago
(updated 1 year, 8 months ago)

Two save games you can find in the folder.

1.Space Exloration - location near space elevator. Lad is waiting in the train already. This save game is WITHOUT
Rivens Realistic Train Acceleration (based on cargo), so you can test it first without it and then with the mod. Hope this helps. Thanks !

https://drive.google.com/open?id=1ElquRdNWF-KKbJ5SzShqMZPnjkwvojWu&authuser=kalistenics%40gmail.com&usp=drive_fs

1 year, 8 months ago
(updated 1 year, 8 months ago)

I loaded your save and enabled my mod. Locally (in v0.1.21) I already had the [attempt to index field 'burner' (a nil value)] issue fixed, and I cannot reproduce the issue.

Rolling back to v0.1.20 I can only confirm the burner-related crash, nothing else, so I hope v0.1.21 fixes it for you. It's interesting how SE disassembles the locomotive, it's like it's clearing the locomotive out completely, 1 (or more) frames before deleting it. Very peculiar.

1 year, 8 months ago

Hi,

I have tested it yesterday and today. NO ISSUE !!! Thank you very much for fixing this. Now, I can focus on optimalisation routes for all these slow trains :D

Was was the problem with this bug and how have you fixed it ???

1 year, 8 months ago
(updated 1 year, 8 months ago)

The space elevator not only removes the fuel from the train, but also the fuel inventory (where you typically put your 3 stacks of, say, coal). Additionally, besides removing the fuel being currently burned, it removes the entire fuel-slot that allows any fuel to be burned (the burner).

Long story short:
-> locomotive.get_fuel_inventory() returned NIL
-> locomotive.burner returned NIL

Old code:
-> fuel_item = locomotive.burner.currently_burning
New code:
-> if locomotive.burner ~= nil then
fuel_item = locomotive.burner.currently_burning
end

New response