Making remnants permanent
Making remnants permanent
I discovered that the Naked Rails mod claims to make rail remnants permanent, but they are not. Suspecting that the wrong property was being used to set data.raw["rail-remnants"]["straight-rail-remnants"].time_to_live, I tried editing my local mod copy to set time_before_removed instead, but got an error that 0 is not an acceptable value. Setting it negative results in rail remnants that disappear instantly. The original behavior was that rail remnants faded out over time. (I haven't completely ruled out another mod interfering, but it seems more likely that the game simply doesn't use time_to_live for rail remnants.)
My question is this: How can a mod alter rail remnants so they never disappear and can be used for decorative purposes? Or any remnants, really; I'm just looking at rail remnants right now, to fix a bug in futileohm's existing mod.
My question is this: How can a mod alter rail remnants so they never disappear and can be used for decorative purposes? Or any remnants, really; I'm just looking at rail remnants right now, to fix a bug in futileohm's existing mod.
Re: Making remnants permanent
Well, If you don't want them to expire, I suppose you can set `time_before_removed` to max int_32, like 2^30 or somethingdgw wrote:I discovered that the Naked Rails mod claims to make rail remnants permanent, but they are not. Suspecting that the wrong property was being used to set data.raw["rail-remnants"]["straight-rail-remnants"].time_to_live, I tried editing my local mod copy to set time_before_removed instead, but got an error that 0 is not an acceptable value. Setting it negative results in rail remnants that disappear instantly. The original behavior was that rail remnants faded out over time. (I haven't completely ruled out another mod interfering, but it seems more likely that the game simply doesn't use time_to_live for rail remnants.)
My question is this: How can a mod alter rail remnants so they never disappear and can be used for decorative purposes? Or any remnants, really; I'm just looking at rail remnants right now, to fix a bug in futileohm's existing mod.
Re: Making remnants permanent
I guess 400-odd days (assuming I did my math right) ought to be quite long enough for any reasonable save file, haha.
Would it also be possible to do by, say, cloning the right properties of the built-in remnants (like sprites, dimensions, etc.) but making them instead a special kind of rail that trains can't use for pathfinding? I know entities can be disabled (and are when e.g. marked for deconstruction), so maybe that would be another approach?
Would it also be possible to do by, say, cloning the right properties of the built-in remnants (like sprites, dimensions, etc.) but making them instead a special kind of rail that trains can't use for pathfinding? I know entities can be disabled (and are when e.g. marked for deconstruction), so maybe that would be another approach?
Re: Making remnants permanent
Hi,
i updated Naked Rails to 016 and changed the remnant behaviour.
The api recommend .time_to_live = 4294967295 and itseems fine so far(15 minutes tested).
http://lua-api.factorio.com/0.16.16/Lua ... me_to_live
Whats the difference between time to live and time before removed?
Greetings, steinio.
i updated Naked Rails to 016 and changed the remnant behaviour.
The api recommend .time_to_live = 4294967295 and itseems fine so far(15 minutes tested).
http://lua-api.factorio.com/0.16.16/Lua ... me_to_live
Whats the difference between time to live and time before removed?
Greetings, steinio.
Re: Making remnants permanent
time_before_removed is the name of the property in the data phase for corpses/rail remants, time_to_live is the name of the property in the data phase for combat robots and flying-text and is how you access it in the the control phase for combat robot and entity ghosts. The rail-remnants/corpse prototype doesnt have the time_to_live property.steinio wrote:Whats the difference between time to live and time before removed?
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.
Re: Making remnants permanent
Thank you.Bilka wrote:time_before_removed is the name of the property in the data phase for corpses/rail remants, time_to_live is the name of the property in the data phase for combat robots and flying-text and is how you access it in the the control phase for combat robot and entity ghosts. The rail-remnants/corpse prototype doesnt have the time_to_live property.steinio wrote:Whats the difference between time to live and time before removed?
I get no error on missing attribute so far and t-b-r is not documented for LuaEntitiy: http://lua-api.factorio.com/0.16.16/LuaEntity.html
I'll try it out.
Edit:
time_to_live lasted nearly 1,5 hours
time_before_removed had no effect and the remnants got removed instantly with a value of 4294967295
Last edited by steinio on Wed Jan 17, 2018 8:03 pm, edited 1 time in total.
Re: Making remnants permanent
It's not erroring because it defaults to 60 * 120. That doc is for the control phase and not the data phase, so it doesnt really matter for you. https://wiki.factorio.com/Prototype/Corpse matters for you, which is why I just created it.steinio wrote: I get no error on missing attribute so far and t-b-r is not documented for LuaEntitiy: http://lua-api.factorio.com/0.16.16/LuaEntity.html
I'll try it out.
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.
Re: Making remnants permanent
That doesnt make any sense. Rail remnants use time_before_removed as seen in line 176 in base\prototypes\entity\demo-remnants.lua, and when I look at the source code, I can also see that time_to_live is not a valid property in the data phase. Are you perhaps talking about the control phase, unlike the originial post? (And ignoring that I specifed what was for the data and what for the control phase...)steinio wrote:time_to_live lasted nearly 1,5 hours
time_before_removed had no effect and the remnants got removed instantly with a value of 4294967295
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.
Re: Making remnants permanent
Well, just a little happy coincidence...Bilka wrote:That doesnt make any sense. Rail remnants use time_before_removed as seen in line 176 in base\prototypes\entity\demo-remnants.lua, and when I look at the source code, I can also see that time_to_live is not a valid property in the data phase. Are you perhaps talking about the control phase, unlike the originial post? (And ignoring that I specifed what was for the data and what for the control phase...)steinio wrote:time_to_live lasted nearly 1,5 hours
time_before_removed had no effect and the remnants got removed instantly with a value of 4294967295
data phase is correct
.time_to_live got ignored and the vanilla time get used (45 minutes)
.time_before_removed is an uint and i assigned the max value for an uint32 what probably did a bufferoverflow into a negative value what means instantly...
Now i asisgnend 2^30 instead and it seems fine for 3hours (time tools 64x).
Re: Making remnants permanent
It's imported as a float and cast to an int32, but otherwise you seem to be correct.steinio wrote: .time_before_removed is an uint and i assigned the max value for an uint32 what probably did a bufferoverflow into a negative value what means instantly...
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.
Re: Making remnants permanent
Source code would have probably made it unnecessary for me to open this topic in the first place, haha. The docs are pretty good, but not perfect.Bilka wrote:and when I look at the source code, I can also see that time_to_live is not a valid property in the data phase.
Re: Making remnants permanent
Yeah, the docs are still lacking so much :/ I'm trying to work on them, but the main wiki is simply more importantdgw wrote:Source code would have probably made it unnecessary for me to open this topic in the first place, haha. The docs are pretty good, but not perfect.Bilka wrote:and when I look at the source code, I can also see that time_to_live is not a valid property in the data phase.
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.