I came up with this;
var
cycle = "day"
maxTimer = 10
minTimer = -10
timer = minTimer
timerRate = 1
timeDelay = 1
world
New()
..()
DayNight()
proc
DayNight()
if(cycle == "day")
timer += timerRate
else
timer -= timerRate
if(timer >= maxTimer)
timer = maxTimer
cycle = "night"
else if(timer <= minTimer)
timer = minTimer
cycle = "day"
for(var/atom/A in world)
if(istype(A,/mob) || istype(A,/obj) || istype(A,/turf/))
if(cycle == "day")
A.icon -= rgb(timer,timer,timer)
else
A.icon += rgb(timer,timer,timer)
spawn(timeDelay) DayNight()
It alters the rgb data of everything in the world, darkening or lightening it depending on the current cycle. It works fine except that every time the cycle repeats, the icon gets it's rgb values more and more "blandish", eventually making it blend into a compltely white or black icon. Which... sucks. Why does that happen, in my mind if you subtract 20 from an icon's red value, and then later on add 20 back, it should look like it looked before the red subtraction, right?
Also, am I right in assuming altering the rgb data of every tile in the world will bring with it a wave of lag? ATM it works fine with a small map but Im pretty sure when you get into the full blown rpg maps, itll have a slow effect.
- Conj'