Trying to make electric trains, but...

Place to get help with not working mods / modding interface.
Post Reply
Aeternus
Filter Inserter
Filter Inserter
Posts: 835
Joined: Wed Mar 29, 2017 2:10 am
Contact:

Trying to make electric trains, but...

Post by Aeternus »

I was tinkering a little earlier today, trying to see if I could get electric trains to work. It seemed a simple enough thing to do. Trains use a burner energy source and since we already have a mobile entity that can make use of electricity (construction/logistics bots) I thought it wouldn't be too hard. I thought wrong.
My general idea is to make locs work in areas with power, and give them a small battery to bridge gaps where needed. Optionally they could simply be given a good sized capacitor and be recharged on stations (IE replace the fuel tanks with accumulators). Optionally make electified railways with overhead powerlines or a third rail that supplies power (like on some tram systems).

To start off I wanted to see if I could change the loc over to electric, by removing the burner and adding an energy drain and capacitance. However, if I do that the game fails to load the mod and complains that the "burner" property of the locomotive isn't defined. Does this mean that the "locomotive" object type is hardcoded to require a burner energy source? I looked around where the "type=locomotive" itself gets defined, but could not find a definition in any of the "base" or "core" folders, so I'm not sure how one'd go about changing the definition of the locomotive as an object structure, rather then the instance of it. I used Notepad++ to search for the word "locomotive" across the entire Factorio folder to try and find the type definition. Got a lot of hits on the tutorial folders and various localizations, but no typecast...

Rseding91
Factorio Staff
Factorio Staff
Posts: 13209
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: Trying to make electric trains, but...

Post by Rseding91 »

Aeternus wrote:Does this mean that the "locomotive" object type is hardcoded to require a burner energy source?
Yes.
If you want to get ahold of me I'm almost always on Discord.

Aeternus
Filter Inserter
Filter Inserter
Posts: 835
Joined: Wed Mar 29, 2017 2:10 am
Contact:

Re: Trying to make electric trains, but...

Post by Aeternus »

Well... that puts the kybosh on my idea then :D
Thanks for the reply.

User avatar
bobingabout
Smart Inserter
Smart Inserter
Posts: 7352
Joined: Fri May 09, 2014 1:01 pm
Contact:

Re: Trying to make electric trains, but...

Post by bobingabout »

in previous versions of the game, the locomotive used "energy_source" instead of "burner" just like everything else, however this did have a few problems.

Firstly, the locomotive wouldn't connect to the electric grid, which meant there was no easy way to provide it with power.
secondly, if you opened the GUI to where the fuel slots usually are, the game would crash.
Though keep in mind the last time I tried was on version 0.12.

I guess the devs saw fit to hardcode to the intended burner power, rather than try and fix it to work in a configuration they never intend to use.


Electric locomotives would be pretty sweet though, I already have accumulators going down all my train lines in my game, so if there was a locomotive powered by electricity, it would just work. The reason they're there though is to provide power to my laser turrets, as well as transport power to my remote bases. All 1 big power grid here.
Creator of Bob's mods. Expanding your gameplay since version 0.9.8.
I also have a Patreon.

Post Reply

Return to “Modding help”