Rivens Dynamic Train Weight


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

Tweaks
a month ago
1.1
84
Transportation Trains
Owner:
riven8192
Source:
N/A
Homepage:
N/A
License:
MIT
Created:
a month ago
Latest Version:
0.1.1 (a month ago)
Factorio version:
1.1
Downloaded by:
84 users

Goal

This mod varies the weight of train wagons, depending on their cargo.
The effect is that trains with cargo will take longer to accelerate and brake.

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 may be a bug in Factorio. This is why the mod will replace any connected pump, to reset its state, and allow it to continue pumping. The pump will have to reattach to the fluid wagon, so it will show this animation often, and it will incur some delays while pumping fluids. Additionally, there will be a minimal loss of fluids, typically less than 0.1%. If these pumps have any circuit-conditions and/or circuit-wires, these will get destroyed in the process (for now)
  • 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 is mutually exclusive to "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.