Skip to content

Update ElectricTrains mod compatibility#6

Open
saismee wants to merge 6 commits into
RedRafe:mainfrom
saismee:main
Open

Update ElectricTrains mod compatibility#6
saismee wants to merge 6 commits into
RedRafe:mainfrom
saismee:main

Conversation

@saismee

@saismee saismee commented Jun 24, 2026

Copy link
Copy Markdown

Fixes ElectricTrains charging by adding the missing optional dependency (ElectricTrains would load after this mod, so the locomotives would not register properly).
Updates the electric locomotive's stack size to match this mod.
Adds new fuel types for mk3/mk4 locomotives so that they have more internal storage. Can be configured in the mod settings menu.

Only has en locale.

Comment thread settings.lua Outdated
Comment thread settings.lua
}) No newline at end of file

-- ElectricTrains mod compatibility settings
if mods['ElectricTrains'] then

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It turns out you can remove settings if a dependency does not exist.

@RedRafe

RedRafe commented Jun 24, 2026

Copy link
Copy Markdown
Owner

This PR will require my input so it'll be on hold for another 1 to 2 weeks until I'm back . Ty

@RedRafe

RedRafe commented Jul 7, 2026

Copy link
Copy Markdown
Owner

@saismee any reasons why new fuel was introduced? Isn't the better locomotive already enough of an upgrade?

@saismee

saismee commented Jul 7, 2026

Copy link
Copy Markdown
Author

The new fuel is needed for the custom energy buffers. It is how it is supposed to be implemented in the ElectricTrains documentation - each locomotive gets its own fuel.

@RedRafe

RedRafe commented Jul 7, 2026

Copy link
Copy Markdown
Owner

You can add an entity and/or can add a fuel. So why adding both when the entity already has all the buffs needed?

@saismee

saismee commented Jul 7, 2026

Copy link
Copy Markdown
Author

I don't think you understand the implementation. The fuel value is what determines the energy capacity of the locomotive, so each locomotive must have its own fuel type or else it uses the default fuel value. Any buffs given by the fuel are default to whatever the ElectricTrains fuel has.

Compatibility (For modders)

If you want to take advantage of the system in this mod for charging a locomotive, you can register one by doing a couple of things:

  • Define a locomotive entity with the properties you want in your mod, as usual.
  • Define a fuel item with the energy capacity you want the locomotive to inherently possess. (Technically optional, but if you don't then what's the point?)
  • In your control.lua script, register the locomotive and its internal storage fuel item via the on_init() and on_configuration_changed() methods using this call: remote.call("electrictrains","register","locomotive-entity-name","fuel-item-name")

Eg, for this mod the remote call used in both methods would be:
remote.call("electrictrains", "register", "deg-electric-locomotive", "deg-electric-locomotive-fuel-dummy")

My electric locomotives use the 'electrical' burner category, and should accept any fuel item (reusable or not) that matches, if you want to add one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants