Mod-Defined Train/Platform Conditions
Posted: Mon Aug 18, 2025 4:17 pm
Suggestion: Allow mods to define custom conditions for trains and platforms.
Reason: Allows mods to create niche stops that aren't in the base game, like "no filtered cargo slot is empty"
Possible API:
Adding conditions:
Where handler is a mod-defined function that computes stop completion/progress when called.
Handler:
Where train is the LuaEntity the condition is defined for, and current_stop is the stop the train is at (which the condition is defined for).
If the API ends up looking different, that's fine - I just wanted to show what it could look like.
Edit:
Ideally, you could also include item/circuit signal selectors, like the Item Count condition has. But even basic stops, similar to Full Cargo, would be helpful.
Reason: Allows mods to create niche stops that aren't in the base game, like "no filtered cargo slot is empty"
Possible API:
Adding conditions:
Code: Select all
script.add_train_stop(handler)
Handler:
Code: Select all
function handler(train, current_stop)
// Do stuff
return {
complete: boolean, -- Determines if the stop is satisfied; required.
progress: float [0, 1] -- For displaying progress bar on stop condition; optional, defaults to 0
}
end
If the API ends up looking different, that's fine - I just wanted to show what it could look like.
Edit:
Ideally, you could also include item/circuit signal selectors, like the Item Count condition has. But even basic stops, similar to Full Cargo, would be helpful.