Electric Train 2.0 Fix

by Jtmzac

Basic fix for 2.0 while magu5026 works on the original. I'll remove this once that's been updated. Adds electric locomotives to the game.

Content
3 months ago
2.0
2.96K
Trains

g Error

10 months ago

Hi, while im playing and trains do their jobs, i have error together exit from game "Error while running event ElectricTrainFix::on_nth_tick(2)"
Can you help?

10 months ago

I can't see anything obviously wrong and that error doesn't narrow down the problem very much.

Is there any other information in the error message? There is often more information specifically about what went wrong.

10 months ago

Error while running event ElectricTrainFix::on_nth_tick(2)
ElectricTrainFix/control.lua:174: attempt to index field 'currently_burning' (a nil value)
stack traceback:
ElectricTrainFix/control.lua:174: in function <ElectricTrainFix/control.lua:163>

10 months ago

I quess i have out of energy and i get this error

10 months ago
(updated 10 months ago)

Thanks for the extra information. That's much easier to debug.

I've just released an update with an extra check that should probably fix it.

If it doesn't work, then let me know as I can do some other things to try and fix it.

10 months ago

tyvm, i now try fix too, but im weak in lua scripts and factorio modding, i hope for you

10 months ago

oh, i fix, add line "loc.entity.burner.currently_burning = prototypes.item['et-electric-locomotive-fuel']"
before line "needPower = loc.entity.burner.currently_burning.name.fuel_value - loc.entity.burner.remaining_burning_fuel"

10 months ago

Glad you fixed it. That's almost identical to the fix I did as well.

New response