Make LuaTrain.kill_count and LuaTrain.killed_players writable

Place to ask discuss and request the modding support of Factorio. Don't request mods here.
BurninSun
Long Handed Inserter
Long Handed Inserter
Posts: 77
Joined: Fri Mar 16, 2018 4:54 am
Contact:

Make LuaTrain.kill_count and LuaTrain.killed_players writable

Post by BurninSun »

I'm requesting that LuaTrain.kill_count and LuaTrain.killed_players be writable.

When rolling stock is added or removed from a train, the old LuaTrain is invalidated and a new LuaTrain created with kill_count successfully being carried over to the new train. However, I am teleporting trains across surfaces which necessitates the complete destruction of the old train with no way of copying the kill count over. I would like to be able to maintain the trains kill count on the newly created train by writing to the new train's kill_count attribute.

Similarly with killed_players though that may be complicated by needing the player id to be verified when written to. Also, killed_players doesn't appear to work as referenced here viewtopic.php?t=132269
User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 4365
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

Re: Make LuaTrain.kill_count and LuaTrain.killed_players writable

Post by boskid »

This interface request as stated right now is a "wont implement" due to implementation details since kill_count and killed_players is not a real thing on a train, it is an aggregate: those values are stored on each rolling stock individually and what LuaTrain provides is sum of those values of all rolling stocks it consists of. Only solution acceptable would be to have LuaEntity read/write for RollingStock's individual kill_count and killed_players.
s6x
Inserter
Inserter
Posts: 45
Joined: Fri Nov 15, 2024 8:22 pm
Contact:

Re: Make LuaTrain.kill_count and LuaTrain.killed_players writable

Post by s6x »

This seems like an XY problem anyway. The real request here is to make trains teleportable across surfaces, isn't it? I'm not sure how doable that is, though.
BurninSun
Long Handed Inserter
Long Handed Inserter
Posts: 77
Joined: Fri Mar 16, 2018 4:54 am
Contact:

Re: Make LuaTrain.kill_count and LuaTrain.killed_players writable

Post by BurninSun »

s6x wrote: Sun Jan 04, 2026 5:36 pm This seems like an XY problem anyway. The real request here is to make trains teleportable across surfaces, isn't it? I'm not sure how doable that is, though.
Linked rails have been requested for years but the implementation is a nightmare (see viewtopic.php?p=527469#p527469). Even as a mod where certain amount of jank can be acceptable and performance isn't expected to be optimal, its still a nightmare.

As a revised request, it would be that LuaEntity.kills be modified to also include all rolling stock types, not just artillery wagons. Also that LuaEntity includes a killed_players r/w for all rolling stock types as well.
Post Reply

Return to “Modding interface requests”