Page 1 of 1
[Rseding91][2.0.10] Bug about always_day duration
Posted: Fri Oct 25, 2024 8:05 pm
by aspd199
documents: always_day :: RW boolean When set to true, the sun will always shine.
Code: Select all
game.players[1].surface.always_day = true
game.surfaces[1].always_day = true
Either of the above two lines of code will only be in effect for a few seconds, after which it will expire and will not persist.
Everything was fine up to 1.1, after updating to 2.0 there was a problem.
Is there a conflict with "daytime"?
Re: [Rseding91][2.0.10] Bug about always_day duration
Posted: Sat Oct 26, 2024 1:32 pm
by Rseding91
Thanks for the report however I can not reproduce any issue. Can you please post a save file where it isn't working and steps to reproduce?
Re: [Rseding91][2.0.10] Bug about always_day duration
Posted: Sat Oct 26, 2024 8:26 pm
by aspd199
The “always_day” attribute can't be locked to “true”, so if any other mod operates on the “daytime” attribute, “always_day” will automatically change to “false” instead of always shine.
Re: [Rseding91][2.0.10] Bug about always_day duration
Posted: Sat Oct 26, 2024 8:28 pm
by Rseding91
I still can not reproduce any such issue. daytime is frozen if setting always_day to true and is un-frozen if setting it to false, or setting freeze_daytime to false.
Re: [Rseding91][2.0.10] Bug about always_day duration
Posted: Sun Oct 27, 2024 4:56 pm
by aspd199
simple test code:
function OnInit()
game.players[1].always_day = true
end
function OnTick(event)
if (game.tick % 600) == 0 then
game.players[1].surface.daytime = 0.5
end
game.players[1].print(game.players[1].always_day)
end
script.on_event(defines.events.on_tick, OnTick)
script.on_init(OnInit)
script.on_load(OnInit)
Re: [Rseding91][2.0.10] Bug about always_day duration
Posted: Sun Oct 27, 2024 4:59 pm
by Rseding91
Ok, I think I see the confusion. "always_day" is a combination utility method. It sets freeze_daytime = true and daytime = 0. It does not prevent you from then changing daytime manually or with the lua API.
Re: [Rseding91][2.0.10] Bug about always_day duration
Posted: Sun Oct 27, 2024 6:22 pm
by aspd199
I see, I thought that “always_day” is a switch to lock the daytime, as long as it is set to true, then “daytime” should be invalidated no matter how much it changes and keep the daytime state, only when “always_day” is false “daytime” should take effect!