Rivens Dynamic Train Weight


This mod makes train weight depend on cargo, realistically affects acceleration and braking.

Tweaks
6 months ago
1.1
344
Transportation Trains
Owner:
riven8192
Source:
N/A
Homepage:
N/A
License:
MIT
Created:
9 months ago
Latest Version:
0.1.3 (6 months ago)
Factorio version:
1.1
Downloaded by:
344 users

Goal: Trains will have more realistic acceleration and braking behavior.

This is done by varying the weight of train wagons, depending on the cargo they cary.

Weight determination of cargo

  • For each cargo wagon, the fill-ratio of each stack is calculated. A full stack weighs 200kg. (8000kg for a full cargo wagon)
  • For each fluid wagon, each liter weighs 0.3125 gram. (also 8000kg for a full fluid wagon)
  • The total weight of the entity (carriage + cargo) is rounded to the closest multiple of 500 kg.
  • The maximum total weight (for carriages with lots of cargo/fluid storage) is 50000kg, the minimum total weight is 500kg.

Increased weight of empty carriages

  • Each locomotive will have its weight multiplied by 4 (hence an typical locomotive will be 8000kg, instead of 2000kg)
  • Each cargo wagon will have its weight multiplied by 2 (hence an typical wagon will be 2000kg, instead of 1000kg)
  • Each fluid wagon will have its weight multiplied by 2 (hence an typical wagon will be 2000kg, instead of 1000kg)

How the weight of the wagons is changed

  • The Factorio API does not support altering the weight of any entity once the game is running. We can take an existing entity and create variants of it, by cloning it and changing the weight.
  • When the weight of a wagon changes significantly, it will swap the wagon with the appropriate variant.

Known issues

  • Pumps: when a fluid-wagon is swapped, any attached & working pumps, will have to get kickstarted again - this is a bug in Factorio 1.1 and is expected to be resolved in 2.0. This is why the mod will rotate any pump twice, to reset its state and allow it to continue pumping. I have to rotate the pump in 2 frames, so there will be a 1-frame flicker upon updating the weight of a fluid wagon.
  • Train IDs: swapping wagons (removing and adding), will modify the train ID. This may affect mods tracking this ID. Such mods are encouraged (in general) to track train ID changes through the event-handler: "on_train_created", with properties: train.id & old_train_id_[1,2]

Note

  • This mod must not be used in combination with "Rivens Realistic Train Acceleration (based on cargo)"
  • This mod will support as many modded trains as possible, but explicitly does not touch the Cargo-Ships mod, as balancing this mod is still on the TODO. The massive cargo-space would result in astronomical train-weights, slowing the ships to a halt.
  • The braking-force technology bonus-effect is reduced to zero, in the spirit of realism.