mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-10 17:52:36 +00:00
Makes holidays span all timezones by default (#58673)
* Adds timezone support for regional holidays Also adds timezones to Waitangi Day, ANZAC Day, US Independence Day and Bastille Day * Makes holidays span all timezones by default Changes April Fools, Halloween and Christmas to be the correct dates instead of a range, using three timezones to cover the correct range instead Co-authored-by: Mothblocks <35135081+Mothblocks@users.noreply.github.com>
This commit is contained in:
@@ -153,20 +153,23 @@ SUBSYSTEM_DEF(events)
|
||||
/datum/controller/subsystem/events/proc/getHoliday()
|
||||
if(!CONFIG_GET(flag/allow_holidays))
|
||||
return // Holiday stuff was not enabled in the config!
|
||||
|
||||
var/YYYY = text2num(time2text(world.timeofday, "YYYY")) // get the current year
|
||||
var/MM = text2num(time2text(world.timeofday, "MM")) // get the current month
|
||||
var/DD = text2num(time2text(world.timeofday, "DD")) // get the current day
|
||||
var/DDD = time2text(world.timeofday, "DDD") // get the current weekday
|
||||
|
||||
for(var/H in subtypesof(/datum/holiday))
|
||||
var/datum/holiday/holiday = new H()
|
||||
if(holiday.shouldCelebrate(DD, MM, YYYY, DDD))
|
||||
holiday.celebrate()
|
||||
if(!holidays)
|
||||
holidays = list()
|
||||
holidays[holiday.name] = holiday
|
||||
else
|
||||
var/delete_holiday = TRUE
|
||||
for(var/timezone in holiday.timezones)
|
||||
var/time_in_timezone = world.realtime + timezone HOURS
|
||||
|
||||
var/YYYY = text2num(time2text(time_in_timezone, "YYYY")) // get the current year
|
||||
var/MM = text2num(time2text(time_in_timezone, "MM")) // get the current month
|
||||
var/DD = text2num(time2text(time_in_timezone, "DD")) // get the current day
|
||||
var/DDD = time2text(time_in_timezone, "DDD") // get the current weekday
|
||||
|
||||
if(holiday.shouldCelebrate(DD, MM, YYYY, DDD))
|
||||
holiday.celebrate()
|
||||
LAZYSET(holidays, holiday.name, holiday)
|
||||
delete_holiday = FALSE
|
||||
break
|
||||
if(delete_holiday)
|
||||
qdel(holiday)
|
||||
|
||||
if(holidays)
|
||||
|
||||
Reference in New Issue
Block a user