Diesel Cargo Ships


Changes power source on cargo ships to barrels of liquid fuel

Tweaks
3 days ago
2.0 - 2.1
18.8K
Transportation Power

b [fixed] Diesel conversion is overwritten by cargo-ships' Krastorio2 compat (ships end up on kr-vehicle-fuel)

5 days ago

With Krastorio2 installed, Diesel Cargo Ships doesn't take effect -- the cargo
ship engine, boat engine and indep-boat still burn Krastorio2's kr-vehicle-fuel
instead of diesel-fuel.

Cause is a load-stage ordering conflict:

  • diesel_cargo_ships/data.lua sets, in the DATA stage:
    data.raw.locomotive["cargo_ship_engine"].energy_source.fuel_categories = { "diesel-fuel" }
    data.raw.locomotive["boat_engine"].energy_source.fuel_categories = { "diesel-fuel" }
    data.raw.car["indep-boat"].energy_source.fuel_categories = { "diesel-fuel" }

  • cargo-ships/data-final-fixes.lua then does, when Krastorio2 is present:
    if mods["Krastorio2"] then
    data.raw.locomotive["cargo_ship_engine"].energy_source.fuel_categories = { "chemical", "kr-vehicle-fuel" }
    data.raw.locomotive["boat_engine"].energy_source.fuel_categories = { "kr-vehicle-fuel" }
    data.raw.car["indep-boat"].energy_source.fuel_categories = { "kr-vehicle-fuel" }
    end

Because diesel_cargo_ships only has a data.lua and cargo-ships applies the K2
override in data-final-fixes (a later stage), the override runs last and the
diesel-fuel setting is wiped. talandar_cargo_ships_tweaks doesn't re-apply it in
a later stage, so nothing restores diesel.

Suggested fix: apply the diesel-fuel fuel_categories from a data-final-fixes.lua
in diesel_cargo_ships instead of (or in addition to) data.lua, so it runs after
cargo-ships' Krastorio2 block. (An explicit dependency on cargo-ships already
exists, which guarantees the ordering within the same stage.)

Workaround for now: a tiny local mod that, in data-final-fixes with an optional
dependency on cargo-ships, re-sets
data.raw.locomotive["cargo_ship_engine"].energy_source.fuel_categories = { "diesel-fuel" }
(and the same for boat_engine and indep-boat) restores the diesel behaviour.

Environment: Factorio 2.0.77 (Space Age), macOS; diesel_cargo_ships 0.3.0,
cargo-ships 1.0.33, talandar_cargo_ships_tweaks 0.7.0, diesel_engine 0.9.1,
Krastorio2 2.0.19.

Thanks for the mod!

5 days ago

Ah I see. I ll fix that one

3 days ago

it's fixed for factorio 2.1
diesel ships 0.4.0

New response