ID:146720
 
Hello, I'm working on a Harvest Moon style Game with seasons and such
and i'm having a problem where when it is displayed on the hud, it tends
to get the wrong Sun/Moon Display.

Here is the Clock Code I coded myself.

*I Feel somewhat proud, lol and the clock with seasons and such works fine*
client
var/hr=5
var/min1=0
var/min2=0
var/ampm="AM"
var/season="Spring"
var/date=1

client/proc/CalUpdate()
if(season=="Spring")
if(date==30)
date=1
season="Summer"
if(season=="Summer")
if(date==30)
date=1
season="Fall"
if(season=="Fall")
if(date==30)
date=1
season="Winter"
if(season=="Winter")
if(date==30)
date=1
season="Spring"

client/proc/ClockUpdate()

//note its sleep(5) just for testing purposes,
//if it was the origional sleep(150) it would
//take longer to see if the code worked right

time
//5am to 6am
sleep(5);min1+=1
sleep(5);min1+=1
sleep(5);min1+=1
sleep(5);min1+=1
sleep(5);min1+=1
sleep(5);min1=0;hr+=1;SunMoonHudUpdate()

//6am to 7am
sleep(5);min1+=1
sleep(5);min1+=1
sleep(5);min1+=1
sleep(5);min1+=1
sleep(5);min1+=1
sleep(5);min1=0;hr+=1;SunMoonHudUpdate()

//7am to 8am
sleep(5);min1+=1
sleep(5);min1+=1
sleep(5);min1+=1
sleep(5);min1+=1
sleep(5);min1+=1
sleep(5);min1=0;hr+=1;SunMoonHudUpdate()

//8am to 9am
sleep(5);min1+=1
sleep(5);min1+=1
sleep(5);min1+=1
sleep(5);min1+=1
sleep(5);min1+=1
sleep(5);min1=0;hr+=1;SunMoonHudUpdate()

//9am to 10am
sleep(5);min1+=1
sleep(5);min1+=1
sleep(5);min1+=1
sleep(5);min1+=1
sleep(5);min1+=1
sleep(5);min1=0;hr+=1;SunMoonHudUpdate()

//10am to 11am
sleep(5);min1+=1
sleep(5);min1+=1
sleep(5);min1+=1
sleep(5);min1+=1
sleep(5);min1+=1
sleep(5);min1=0;hr+=1;SunMoonHudUpdate()

//11am to 12pm
sleep(5);min1+=1
sleep(5);min1+=1
sleep(5);min1+=1
sleep(5);min1+=1
sleep(5);min1+=1
sleep(5);min1=0;hr+=1;ampm="PM";SunMoonHudUpdate()

//12pm to 1pm
sleep(5);min1+=1
sleep(5);min1+=1
sleep(5);min1+=1
sleep(5);min1+=1
sleep(5);min1+=1
sleep(5);min1=0;hr=1;SunMoonHudUpdate()

//1pm to 2pm
sleep(5);min1+=1
sleep(5);min1+=1
sleep(5);min1+=1
sleep(5);min1+=1
sleep(5);min1+=1
sleep(5);min1=0;hr+=1;SunMoonHudUpdate()

//2pm to 3pm
sleep(5);min1+=1
sleep(5);min1+=1
sleep(5);min1+=1
sleep(5);min1+=1
sleep(5);min1+=1
sleep(5);min1=0;hr+=1;SunMoonHudUpdate()

//3pm to 4pm
sleep(5);min1+=1
sleep(5);min1+=1
sleep(5);min1+=1
sleep(5);min1+=1
sleep(5);min1+=1
sleep(5);min1=0;hr+=1;SunMoonHudUpdate()

//4pm to 5pm
sleep(5);min1+=1
sleep(5);min1+=1
sleep(5);min1+=1
sleep(5);min1+=1
sleep(5);min1+=1
sleep(5);min1=0;hr+=1;SunMoonHudUpdate()

//5pm to 6pm
sleep(5);min1+=1
sleep(5);min1+=1
sleep(5);min1+=1
sleep(5);min1+=1
sleep(5);min1+=1
sleep(5);min1=0;hr+=1;SunMoonHudUpdate()

//6pm to 7pm
sleep(5);min1+=1
sleep(5);min1+=1
sleep(5);min1+=1
sleep(5);min1+=1
sleep(5);min1+=1
sleep(5);min1=0;hr+=1;SunMoonHudUpdate()

//7pm to 8pm
sleep(5);min1+=1
sleep(5);min1+=1
sleep(5);min1+=1
sleep(5);min1+=1
sleep(5);min1+=1
sleep(5);min1=0;hr+=1;SunMoonHudUpdate()

//8pm to 9pm
sleep(5);min1+=1
sleep(5);min1+=1
sleep(5);min1+=1
sleep(5);min1+=1
sleep(5);min1+=1
sleep(5);min1=0;hr+=1;SunMoonHudUpdate()

//9pm to 10pm
sleep(5);min1+=1
sleep(5);min1+=1
sleep(5);min1+=1
sleep(5);min1+=1
sleep(5);min1+=1
sleep(5);min1=0;hr+=1;SunMoonHudUpdate()

//10pm to 11pm
sleep(5);min1+=1
sleep(5);min1+=1
sleep(5);min1+=1
sleep(5);min1+=1
sleep(5);min1+=1
sleep(5);min1=0;hr+=1;SunMoonHudUpdate()

//11pm to 12am
sleep(5);min1+=1
sleep(5);min1+=1
sleep(5);min1+=1
sleep(5);min1+=1
sleep(5);min1+=1
sleep(5);min1=0;hr+=1;ampm="AM";date+=1;CalUpdate();SunMoonHudUpdate()

//12am to 1am
sleep(5);min1+=1
sleep(5);min1+=1
sleep(5);min1+=1
sleep(5);min1+=1
sleep(5);min1+=1
sleep(5);min1=0;hr=1;SunMoonHudUpdate()

//1am to 2am
sleep(5);min1+=1
sleep(5);min1+=1
sleep(5);min1+=1
sleep(5);min1+=1
sleep(5);min1+=1
sleep(5);min1=0;hr+=1;SunMoonHudUpdate()

//2am to 3am
sleep(5);min1+=1
sleep(5);min1+=1
sleep(5);min1+=1
sleep(5);min1+=1
sleep(5);min1+=1
sleep(5);min1=0;hr+=1;SunMoonHudUpdate()

//3am to 4am
sleep(5);min1+=1
sleep(5);min1+=1
sleep(5);min1+=1
sleep(5);min1+=1
sleep(5);min1+=1
sleep(5);min1=0;hr+=1;SunMoonHudUpdate()

//4am to 5am
sleep(5);min1+=1
sleep(5);min1+=1
sleep(5);min1+=1
sleep(5);min1+=1
sleep(5);min1+=1
sleep(5);min1=0;hr+=1;SunMoonHudUpdate()
goto time


Here is the SunMoonHudUpdate Proc which is in problem
*They come up all right, its just the sun/moon states
get all jarbled up, especialy around the 12am/pm*
client/proc/SunMoonHudUpdate()
if(hr==1)
if(ampm=="AM")
new/obj/SunMoonHud/a(src)
if(ampm=="PM")
new/obj/SunMoonHud/d(src)
if(hr==2)
if(ampm=="AM")
new/obj/SunMoonHud/a(src)
if(ampm=="PM")
new/obj/SunMoonHud/d(src)
if(hr==3)
if(ampm=="AM")
new/obj/SunMoonHud/a(src)
if(ampm=="PM")
new/obj/SunMoonHud/d(src)
if(hr==4)
if(ampm=="AM")
new/obj/SunMoonHud/b(src)
if(ampm=="PM")
new/obj/SunMoonHud/e(src)
if(hr==5)
if(ampm=="AM")
new/obj/SunMoonHud/b(src)
if(ampm=="PM")
new/obj/SunMoonHud/e(src)
if(hr==6)
if(ampm=="AM")
new/obj/SunMoonHud/c(src)
if(ampm=="PM")
new/obj/SunMoonHud/f(src)
if(hr==7)
if(ampm=="AM")
new/obj/SunMoonHud/c(src)
if(ampm=="PM")
new/obj/SunMoonHud/f(src)
if(hr==8)
if(ampm=="AM")
new/obj/SunMoonHud/a(src)
if(ampm=="PM")
new/obj/SunMoonHud/d(src)
if(hr==9)
if(ampm=="AM")
new/obj/SunMoonHud/a(src)
if(ampm=="PM")
new/obj/SunMoonHud/d(src)
if(hr==10)
if(ampm=="AM")
new/obj/SunMoonHud/a(src)
if(ampm=="PM")
new/obj/SunMoonHud/d(src)
if(hr==11)
if(ampm=="AM")
new/obj/SunMoonHud/a(src)
if(ampm=="PM")
new/obj/SunMoonHud/d(src)
if(hr==12)
if(ampm=="AM")
new/obj/SunMoonHud/a(src)
if(ampm=="PM")
new/obj/SunMoonHud/d(src)
obj/SunMoonHud
icon='SunMoonHud.dmi';name="";layer=25
a
icon_state="1"
New(client/C)
C.screen+=src;screen_loc="1,1"
b
icon_state="2"
New(client/C)
C.screen+=src;screen_loc="1,1"
c
icon_state="3"
New(client/C)
C.screen+=src;screen_loc="1,1"
d
icon_state="4"
New(client/C)
C.screen+=src;screen_loc="1,1"
e
icon_state="5"
New(client/C)
C.screen+=src;screen_loc="1,1"
f
icon_state="6"
New(client/C)
C.screen+=src;screen_loc="1,1"


also I was wondering, since it is in Client *The time proc and stuff that it
* does that mean if it is like 6:40 on 1 computer, it will be the same on
another computer* If not Could some1 help me with that too.

Here is the icon file i'm using for the moon states so it will help if ne1 needs
it to help fix this code
SunMoonHud.dmi
I fixed the coding by combining them and it works. Use this code if
you want but give me some credit somewhere please.
or if you modify it to the point where it is shorter or somewhat e-mail me the code you used to [email protected]

client
var/hr=5
var/min1=0
var/min2=0
var/ampm="AM"
var/season="Spring"
var/date=1

client/proc/CalUpdate()
if(season=="Spring")
if(date==5)
date=1
season="Summer"
if(season=="Summer")
if(date==5)
date=1
season="Fall"
if(season=="Fall")
if(date==5)
date=1
season="Winter"
if(season=="Winter")
if(date==5)
date=1
season="Spring"

client/proc/ClockUpdate()

//note its sleep(5) just for testing purposes,
//if it was the origional sleep(50) it would
//take longer to see if the code worked right

time
//5am to 6am

new/obj/SunMoonHud/b(src)
sleep(50);min1+=1
sleep(50);min1+=1
sleep(50);min1+=1
sleep(50);min1+=1
sleep(50);min1+=1
sleep(50);min1=0;hr+=1
for(var/obj/SunMoonHud/o in usr.client.screen)del(o)
new/obj/SunMoonHud/c(src)

//6am to 7am
sleep(50);min1+=1
sleep(50);min1+=1
sleep(50);min1+=1
sleep(50);min1+=1
sleep(50);min1+=1
sleep(50);min1=0;hr+=1
for(var/obj/SunMoonHud/o in usr.client.screen)del(o)
new/obj/SunMoonHud/c(src)

//7am to 8am
sleep(50);min1+=1
sleep(50);min1+=1
sleep(50);min1+=1
sleep(50);min1+=1
sleep(50);min1+=1
sleep(50);min1=0;hr+=1
for(var/obj/SunMoonHud/o in usr.client.screen)del(o)
new/obj/SunMoonHud/c(src)

//8am to 9am
sleep(50);min1+=1
sleep(50);min1+=1
sleep(50);min1+=1
sleep(50);min1+=1
sleep(50);min1+=1
sleep(50);min1=0;hr+=1
for(var/obj/SunMoonHud/o in usr.client.screen)del(o)
new/obj/SunMoonHud/d(src)

//9am to 10am
sleep(50);min1+=1
sleep(50);min1+=1
sleep(50);min1+=1
sleep(50);min1+=1
sleep(50);min1+=1
sleep(50);min1=0;hr+=1
for(var/obj/SunMoonHud/o in usr.client.screen)del(o)
new/obj/SunMoonHud/d(src)

//10am to 11am
sleep(50);min1+=1
sleep(50);min1+=1
sleep(50);min1+=1
sleep(50);min1+=1
sleep(50);min1+=1
sleep(50);min1=0;hr+=1
for(var/obj/SunMoonHud/o in usr.client.screen)del(o)
new/obj/SunMoonHud/d(src)

//11am to 12pm
sleep(50);min1+=1
sleep(50);min1+=1
sleep(50);min1+=1
sleep(50);min1+=1
sleep(50);min1+=1
sleep(50);min1=0;hr+=1;ampm="PM"
for(var/obj/SunMoonHud/o in usr.client.screen)del(o)
new/obj/SunMoonHud/d(src)

//12pm to 1pm
sleep(50);min1+=1
sleep(50);min1+=1
sleep(50);min1+=1
sleep(50);min1+=1
sleep(50);min1+=1
sleep(50);min1=0;hr=1
for(var/obj/SunMoonHud/o in usr.client.screen)del(o)
new/obj/SunMoonHud/d(src)

//1pm to 2pm
sleep(50);min1+=1
sleep(50);min1+=1
sleep(50);min1+=1
sleep(50);min1+=1
sleep(50);min1+=1
sleep(50);min1=0;hr+=1
for(var/obj/SunMoonHud/o in usr.client.screen)del(o)
new/obj/SunMoonHud/d(src)

//2pm to 3pm
sleep(50);min1+=1
sleep(50);min1+=1
sleep(50);min1+=1
sleep(50);min1+=1
sleep(50);min1+=1
sleep(50);min1=0;hr+=1
for(var/obj/SunMoonHud/o in usr.client.screen)del(o)
new/obj/SunMoonHud/e(src)

//3pm to 4pm
sleep(50);min1+=1
sleep(50);min1+=1
sleep(50);min1+=1
sleep(50);min1+=1
sleep(50);min1+=1
sleep(50);min1=0;hr+=1
for(var/obj/SunMoonHud/o in usr.client.screen)del(o)
new/obj/SunMoonHud/e(src)

//4pm to 5pm
sleep(50);min1+=1
sleep(50);min1+=1
sleep(50);min1+=1
sleep(50);min1+=1
sleep(50);min1+=1
sleep(50);min1=0;hr+=1
for(var/obj/SunMoonHud/o in usr.client.screen)del(o)
new/obj/SunMoonHud/e(src)

//5pm to 6pm
sleep(50);min1+=1
sleep(50);min1+=1
sleep(50);min1+=1
sleep(50);min1+=1
sleep(50);min1+=1
sleep(50);min1=0;hr+=1
for(var/obj/SunMoonHud/o in usr.client.screen)del(o)
new/obj/SunMoonHud/f(src)

//6pm to 7pm
sleep(50);min1+=1
sleep(50);min1+=1
sleep(50);min1+=1
sleep(50);min1+=1
sleep(50);min1+=1
sleep(50);min1=0;hr+=1
for(var/obj/SunMoonHud/o in usr.client.screen)del(o)
new/obj/SunMoonHud/f(src)

//7pm to 8pm
sleep(50);min1+=1
sleep(50);min1+=1
sleep(50);min1+=1
sleep(50);min1+=1
sleep(50);min1+=1
sleep(50);min1=0;hr+=1
for(var/obj/SunMoonHud/o in usr.client.screen)del(o)
new/obj/SunMoonHud/f(src)

//8pm to 9pm
sleep(50);min1+=1
sleep(50);min1+=1
sleep(50);min1+=1
sleep(50);min1+=1
sleep(50);min1+=1
sleep(50);min1=0;hr+=1
for(var/obj/SunMoonHud/o in usr.client.screen)del(o)
new/obj/SunMoonHud/a(src)

//9pm to 10pm
sleep(50);min1+=1
sleep(50);min1+=1
sleep(50);min1+=1
sleep(50);min1+=1
sleep(50);min1+=1
sleep(50);min1=0;hr+=1
for(var/obj/SunMoonHud/o in usr.client.screen)del(o)
new/obj/SunMoonHud/a(src)

//10pm to 11pm
sleep(50);min1+=1
sleep(50);min1+=1
sleep(50);min1+=1
sleep(50);min1+=1
sleep(50);min1+=1
sleep(50);min1=0;hr+=1
for(var/obj/SunMoonHud/o in usr.client.screen)del(o)
new/obj/SunMoonHud/a(src)

//11pm to 12am
sleep(50);min1+=1
sleep(50);min1+=1
sleep(50);min1+=1
sleep(50);min1+=1
sleep(50);min1+=1
sleep(50);min1=0;hr+=1;ampm="AM";date+=1;CalUpdate()
for(var/obj/SunMoonHud/o in usr.client.screen)del(o)
new/obj/SunMoonHud/a(src)

//12am to 1am
sleep(50);min1+=1
sleep(50);min1+=1
sleep(50);min1+=1
sleep(50);min1+=1
sleep(50);min1+=1
sleep(50);min1=0;hr=1
for(var/obj/SunMoonHud/o in usr.client.screen)del(o)
new/obj/SunMoonHud/a(src)

//1am to 2am
sleep(50);min1+=1
sleep(50);min1+=1
sleep(50);min1+=1
sleep(50);min1+=1
sleep(50);min1+=1
sleep(50);min1=0;hr+=1
for(var/obj/SunMoonHud/o in usr.client.screen)del(o)
new/obj/SunMoonHud/a(src)

//2am to 3am
sleep(50);min1+=1
sleep(50);min1+=1
sleep(50);min1+=1
sleep(50);min1+=1
sleep(50);min1+=1
sleep(50);min1=0;hr+=1
for(var/obj/SunMoonHud/o in usr.client.screen)del(o)
new/obj/SunMoonHud/b(src)

//3am to 4am
sleep(50);min1+=1
sleep(50);min1+=1
sleep(50);min1+=1
sleep(50);min1+=1
sleep(50);min1+=1
sleep(50);min1=0;hr+=1
for(var/obj/SunMoonHud/o in usr.client.screen)del(o)
new/obj/SunMoonHud/b(src)

//4am to 5am
sleep(50);min1+=1
sleep(50);min1+=1
sleep(50);min1+=1
sleep(50);min1+=1
sleep(50);min1+=1
sleep(50);min1=0;hr+=1
new/obj/SunMoonHud/b(src)
goto time

obj/SunMoonHud
icon='SunMoonHud.dmi';name="";layer=25
a
icon_state="1"
New(client/C)
C.screen+=src;screen_loc="10,12"
b
icon_state="2"
New(client/C)
C.screen+=src;screen_loc="10,12"
c
icon_state="3"
New(client/C)
C.screen+=src;screen_loc="10,12"
d
icon_state="4"
New(client/C)
C.screen+=src;screen_loc="10,12"
e
icon_state="5"
New(client/C)
C.screen+=src;screen_loc="10,12"
f
icon_state="6"
New(client/C)
C.screen+=src;screen_loc="10,12"
In response to ElderKain
That code is sad, it needs a while() loop or something. For info *zomg, advertisement:* look at HR Gametime.
In response to ElderKain
That sure seems like a whole lot of redundant code. You could probably reduce it considerably by using another method. I have something similar in a game I am toying with. Take a gander, it might give you some ideas.

Sorry in advance for the length and complexity. If you have any questions, feel free to ask. The World_Loop() proc handles the tracking of the time, day, date, season, phases of the moon, etc...

/*
The Calendar, Cycles and Seasons:
---------------------------------
60 minutes in an hour
20 hours in a day
1200 minutes in a day
5 days in a week
100 hours in a week
6000 minutes in a week
4 weeks in a month
20-21 days in a month
~410 hours in a month
~24600 minutes in a month
10 months in a year
40 weeks in a year
205 days in a year
4100 hours in a year
246000 minutes in a year

One game minute = 6 real seconds
One game hour = 6 real minutes
One game day = 2 real hours
One game week = 10 real hours
One game month = 1 real day and 18 real hours
One game season = 4 real days and 6 real hours
One game year = 16 real days and 12 real hours

Names of the Days:

Nudai, Dodai, Tridai, Quaddai, Enddai

Names of the Months:
Uminaus, Dulnaus, Turnaus, Quinaus, Solnaus,
Colnaus, Ebunaus, Obonaus, Nornaus, Zornaus

The year begins on Uminaus 1st and ends on Zornaus 20th.

The Spring season is called Bloom and begins on Dulnaus 15th.
The Summer season is called Warmsun and begins on Solnaus 5th.
The Fall season is called Wither and begins on Ebunaus 15th.
The Winter Season is called Darksun and begins on Zornaus 5th.

The Spring Equinox is on Turnas 1st and is known as The Blooming Sun.
The Summer Soltice is on Colnaus 10th and is known as The Warm Sun.
The Fall Equinox is on Obonaus 1st and is known as The Withering Sun.
The Winter Solstice is on Uminaus 10th and is known as The Dark Sun.

The Lunar cycle lasts for 24 game days.

Every 4 years, meteorites bombard Raevea. This is known as The Starfall, and
it occurs durring the months of Zornaus and Uminaus durring the Darksun.
The meteorites have a unique metal that can be used to produce items of extreme
majical potential. Occasionally, these meteorites also conatin very rare crystals
known as starlite. These are the most mysterious and precious items in Raevea,
and are rumored to be of majical origins, due to their constant and slight
varied colored glow. The Dark Sun festivals durring The Starfall are often
accompanied by meteorite hunts through the land, which hinders the gathering
as most of the Starfall Hunters are very drunk on the last of the harvest wine.

Percipitation comes in the forms of rain, snow and hail. These can be either
light, moderate, steady, heavy, hard or torrential. The snowy season starts before
The Withering Sun Equinox and ends just after The Blooming Sun Equinox, with the
majority of snowfall accumulating around The Dark Sun Solstice. Temperatures can dip
down to the negative 20s in the darksun season, with average lows in the single digits.
Durring the warmsun season, temperatures round out at around 80, with highs near 100.
The wither and bloom seasons usually see temperatues around 40 with bias towards
the nearest season, Darksun or Warmsun.


*/



var
list
seasons = list("Darksun"=189,"Bloom"=35,"Warmsun"=87,"Wither"=138)
solequi = list("The Dark Sun"=10,"The Blooming Sun"=61,"The Warm Sun"=113,"The Withering Sun"=164)
phases = list("new"=1,"waxing "=5,"half full waxing"=1,"waxing"=5,"full"=1,"waning"=5,"half full waning"=1,"waning "=5)
months = list("Uminaus"=21,"Dulnaus"=20,"Turnaus"=21,"Quinaus"=20,"Solnaus"=21,"Colnaus"=20,"Ebunaus"=21,"Obonaus"=20,"Nornaus"=21,"Zornaus"=20)
days = list("Nudai","Dodai","Tridai","Quaddai","Enddai")

sunrise // The time the sun rises.
sunset // The time the sun sets.
starfall // 1|0, set durring the year of Starfall.
season // numerical 1=Darksun, 2=Bloom, etc...
solequin // numerical, upcoming or current Solstice or Equinox.
since_last // numerical, the number of days since the last Solstice or Equinox.
phase // numerical, current phase of the moon.
phase_day // numerical, current day of the current lunar phase.
year // numerical year starting at 0.
month // numerical 1=Unimaus, 2=Dulnaus, etc...
day // numerical 1=Nudai, 2=Dodai, etc...
date // number of the day of the month.
hour // 0-20
minute // 0-60
nightfall // 1|0, set when the sun sets, unset when it rises
temperature // -30 to 110 depending on season
cloud_cover // numerical, 0 to 100 percent, percip relates to this
percip // numerical, 0 = none, 1-6 = strength, type depends on temp and season

world

New()
..()
Load_Chronos()

// The game begins at 10:00 midnight on Nudai, Uminaus 01, 995
// durring the season of Darksun under a new moon. The tempurature
// is 0 with no cloud cover or percipitation.
/* sunrise = "6:39"
sunset = "13:20"
starfall = 0
season = 1
solequin = 1
since_last = 42
phase = 1
phase_day = 0
year = 995
month = 1
day = 1
date = 1
hour = 20
minute = -1
nightfall = 1
*/

spawn() World_Loop()

Del()
Save_Chronos()
..()


proc
Load_Chronos()
var/savefile/S=new("./saves/chronology.sav"),cipher
S>>cipher;var/text=RC5_Decrypt(cipher,"xo2965829cron784982olo3289gy2390587ox")
if(text){fdel("./saves/chronology.sav");del(S);S=new("./saves/chronology.sav");S.ImportText("/",text)}
S["sunrise"]>>sunrise;S["sunset"]>>sunset;S["starfall"]>>starfall
S["season"]>>season;S["solequin"]>>solequin;S["since_last"]>>since_last
S["phase"]>>phase;S["phase_day"]>>phase_day;S["year"]>>year
S["month"]>>month;S["day"]>>day;S["date"]>>date
S["hour"]>>hour;S["minute"]>>minute;S["nightfall"]>>nightfall
cipher=RC5_Encrypt(S.ExportText("/"),"xo2965829cron784982olo3289gy2390587ox")
if(cipher){fdel("./saves/chronology.sav");del(S);S=new("./saves/chronology.sav");S<<cipher}


Save_Chronos()
fdel("./saves/chronology.sav");var/savefile/S = new("./saves/chronology.sav")
S["sunrise"]<<sunrise;S["sunset"]<<sunset;S["starfall"]<<starfall
S["season"] <<season;S["solequin"]<<solequin;S["since_last"]<<since_last
S["phase"]<<phase;S["phase_day"]<<phase_day;S["year"]<<year
S["month"]<<month;S["day"]<<day;S["date"]<<date
S["hour"]<<hour;S["minute"]<<minute;S["nightfall"]<<nightfall
var/cipher=RC5_Encrypt(S.ExportText("/"),"xo2965829cron784982olo3289gy2390587ox")
if(cipher){fdel("./saves/chronology.sav");del(S);S=new("./saves/chronology.sav");S<<cipher}


World_Loop()
if(++minute>=60)
minute-=60
if(++hour==20)
if(++day>5) day=1
if(++date>months[months[month]])
date=1
if(++month>10){month=1;if(!(++year%4)) starfall=1}
if(++phase_day == phases[phases[phase]])
phase++;phase_day=0
if(phase>phases.len)phase=1
for(var/s in seasons)
if(seasons[s] == round(date+((month-1)*20.5)))
season = seasons.Find(s);break
for(var/se in solequi)
if(solequi[se] == round(date+((month-1)*20.5)-1,1))
since_last = 0
solequin = solequi.Find(se)+1
if(solequin>solequi.len) solequin=1
break
if(solequin==1)
var/timedelta=since_last*2.3529411,hourdelta=0
while(timedelta>=60){hourdelta++;timedelta-=60}
sunrise = "[5+hourdelta]:[round(timedelta)]"
sunset = "[14-hourdelta]:[59-round(timedelta)]"
else if(solequin==2)
var/timedelta=since_last*2.3076923,hourdelta=0
while(timedelta>=60){hourdelta++;timedelta-=60}
sunrise = "[6-hourdelta]:[59-round(timedelta)]"
sunset = "[13+hourdelta]:[round(timedelta)]"
else if(solequin==3)
var/timedelta=since_last*2.3529411,hourdelta=0
while(timedelta>=60){hourdelta++;timedelta-=60}
sunrise = "[4-hourdelta]:[59-round(timedelta)]"
sunset = "[15+hourdelta]:[round(timedelta)]"
else if(solequin==4)
var/timedelta=since_last*2.3529411,hourdelta=0
while(timedelta>=60){hourdelta++;timedelta-=60}
sunrise = "[3+hourdelta]:[round(timedelta)]"
sunset = "[16-hourdelta]:[59-round(timedelta)]"
since_last++
else if(hour>=21) hour-=20
if(sunrise=="[hour]:[minute]")
nightfall=0
for(var/mob/player/P in world)
P << pick("The sun rises.",
"A new day dawns.",
"The sun peaks over the horizon.",
"Another day has dawned.",
"The sun awakens on a new day.",
"The morning sun climbs over the horizon.",
"The day is greeted by the rising sun.",
"A new day breaks with the sunrise.",
"The sun rises with the dawn of a new day.")
for(var/turf/T in world)
P.client.matrix[T.x][T.y]=1;P.client.images-=T.coverimage
T.coverimage=null
else if(sunset=="[hour]:[minute]")
nightfall=1
for(var/mob/player/P in world)
P << pick("The sun sets.",
"Another day ends.",
"The sun sinks beneath the horizon.",
"Another day has passed.",
"The sun sets on another day.",
"The evening sun dips below the horizon.",
"The day is ended by the setting sun."
"Another day closes with the sunset.",
"The sun sets on the dusk of another day.")
for(var/turf/T in world)
T.coverimage=image(T.covericon,T,T.covericon_state,COVER_LAYER)
P.client.matrix[T.x][T.y]=0;P.client.images+=T.coverimage
P.loc.Entered(P)
spawn(60) World_Loop()


~X