ID:144537
 
Code:
var
cyclestatus = "Day"
lastcyclehour = 0

proc/checkCycle()
var
/* These lists store the hours that the sun starts to rise or set.
* Only November is in the list right now because I don't have the
* information for the other months yet.
*/

list/daycycle = list("Nov" = 5)
list/nightcycle = list("Nov" = 16)
month = time2text(world.realtime, "MMM")
hour = text2num(time2text(world.realtime, "hh"))

if (hour >= 15 && hour <= 23 && cyclestatus == "Day")
for(var/f in nightcycle)
if(f == month)
if(hour >= text2num(nightcycle[f])) //Time to change to dusk
for(var/area/outside/o in world)
o.overlays += '25Black.dmi'
cyclestatus = "Dusk"
lastcyclehour = hour
break

else if (hour <= 10 && hour >= 5 && cyclestatus == "Night")
for(var/f in daycycle)
if(f == month)
if(hour >= text2num(daycycle[f])) //Time to change to dawn
for(var/area/outside/o in world)
o.overlays -= '50Black.dmi'
o.overlays += '25Black.dmi'
cyclestatus = "Dawn"
lastcyclehour = hour
break

else if (cyclestatus == "Dusk" && hour >= lastcyclehour + 2)
//Time to switch to night.
for(var/area/outside/o in world)
o.overlays -= '25Black.dmi'
o.overlays += '50Black.dmi'
cyclestatus = "Night"

else if (cyclestatus == "Dawn" && hour >= lastcyclehour + 2)
//Time to switch to day.
for(var/area/outside/o in world)
o.overlays -= '25Black.dmi'
cyclestatus = "Day"


Problem description:
Ok. This chunk of code checks the time for when to change from day to night or vice versa, and then change by first changing to dusk or dawn.
The problem with it is that when I change my system clock to the appropriate times to test it, day to night works fine, but going from night to day freezes processes in the game (no new processes will spawn, etc). I'm assuming it's some sort of issue with the clock changing, but I'm not sure.
Curious. Your code looks fine, so I wonder if this isn't a side effect of changing the clock itself, which can cause problems with keys and logins at least. I'd recommend finding a way to set up an artificial clock in your game that you can adjust for testing without having to rely on the system clock.

Lummox JR
In response to Lummox JR
Ok, I'll try that. Thanks