Schall Railway Controller


Assist train organizations and dispatches. Adds a GUI listing idling and stalled trains (or other customizable filters). Displays train status, for easy and quick schedule inspection and assignment. (Locale: English, Deutsch, 正體中文, 简体中文, Português Brasileiro)

Utilities
2 years ago
0.17 - 1.1
4.05K
Trains

b [Solved] mod semi-incompatibility: "Realistic Electric Trains" idle train shows "no fuel"

3 years ago

G'day. The electric locomotives from the "Realistic Electric Trains" mod show as having "no fuel" all the time. This is probably technically correct, though I believe there is some sort of "placeholder" internal fuel or something it uses.

It'd be wonderful if you could test this out, and resolve the issue so that they don't show the error when they have electricity supply via the network.

Reproducing it is trivial, for me: just have a segment of rail with RET power connected, drop an electric locomotive from that mod on the track, and it shows up with "no fuel".

3 years ago

I have never tried this mod before. How does it work actually?
Does it have any fuel slots in those electric locomotives?
Does it some dummy-fuel to power up the locomotives? (Must have some tricks applied, as the game does not allow electricity as energy source directly.)

Technically, I am using LuaEntity::get_fuel_inventory() and LuaInventory::is_empty() on the first locomotive of a train to check if there are any fuel items in fuel inventory, to determine whether a train has fuel or not.
Maybe you can suggest what could be a good (and simple enough) condition, which will works for both normal trains and RET trains.

3 years ago

I have made a temporary fix that works on my tests, see if it works for you too.

Decompress the mod, edit lib\RClib.lua. Go to line 176, then replace the WHOLE function locomotive_has_no_fuel(enty) with the following code:

local function locomotive_has_no_fuel(enty)
local fuelinv = enty.get_fuel_inventory()
if fuelinv then
if #fuelinv > 0 then
return fuelinv.is_empty()
else
return false -- Skipped when locomotive have fuel inventory of zero slots, e.g., script-hacked fuel
end
else
return false -- Skipped when locomotive does not have fuel inventory, e.g., void-power
end
end

I have other things to do with the code, so I will include this into the formal release on the coming week.

3 years ago
(updated 3 years ago)

I'll test that now, see if it works for me. I didn't see this until after your suggested solution, or I'd have done the technical digging if you needed. Thanks.

update: yes, that works. not it shows it sitting at a station for 11k seconds, which is true for a PAX train that I'm not constantly using. perfect.

3 years ago

The fix is officially included in recent release 0.17.1 / 0.18.1.
So no longer need to edit by your own now.

New response