Electric Train 2.0 Fix

by Jtmzac

Updated for 2.0/2.1. Adds electric locomotives to the game.

Content
a month ago
2.0 - 2.1
5.01K
Trains

g Error

2 years 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?

2 years 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.

2 years 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>

2 years ago

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

2 years ago
(updated 2 years 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.

2 years ago

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

2 years 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"

2 years ago

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

New response