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
6 months ago
2.0
3.47K
Trains

g Error

1 year, 1 month 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?

1 year, 1 month 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.

1 year, 1 month 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>

1 year, 1 month ago

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

1 year, 1 month ago
(updated 1 year, 1 month 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.

1 year, 1 month ago

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

1 year, 1 month 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"

1 year, 1 month ago

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

New response