mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-11 10:11:09 +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:
@@ -50,3 +50,86 @@ When using time2text(), please use "DDD" to find the weekday. Refrain from using
|
||||
#define DS2TICKS(DS) ((DS)/world.tick_lag)
|
||||
|
||||
#define TICKS2DS(T) ((T) TICKS)
|
||||
|
||||
/*Timezones*/
|
||||
|
||||
/// Line Islands Time
|
||||
#define TIMEZONE_LINT 14
|
||||
|
||||
// Chatham Daylight Time
|
||||
#define TIMEZONE_CHADT 13.75
|
||||
|
||||
/// Tokelau Time
|
||||
#define TIMEZONE_TKT 13
|
||||
|
||||
/// Tonga Time
|
||||
#define TIMEZONE_TOT 13
|
||||
|
||||
/// New Zealand Daylight Time
|
||||
#define TIMEZONE_NZDT 13
|
||||
|
||||
/// New Zealand Standard Time
|
||||
#define TIMEZONE_NZST 12
|
||||
|
||||
/// Norfolk Time
|
||||
#define TIMEZONE_NFT 11
|
||||
|
||||
/// Lord Howe Standard Time
|
||||
#define TIMEZONE_LHST 10.5
|
||||
|
||||
/// Australian Eastern Standard Time
|
||||
#define TIMEZONE_AEST 10
|
||||
|
||||
/// Australian Central Standard Time
|
||||
#define TIMEZONE_ACST 9.5
|
||||
|
||||
/// Australian Central Western Standard Time
|
||||
#define TIMEZONE_ACWST 8.75
|
||||
|
||||
/// Australian Western Standard Time
|
||||
#define TIMEZONE_AWST 8
|
||||
|
||||
/// Christmas Island Time
|
||||
#define TIMEZONE_CXT 7
|
||||
|
||||
/// Cocos Islands Time
|
||||
#define TIMEZONE_CCT 6.5
|
||||
|
||||
/// Central European Summer Time
|
||||
#define TIMEZONE_CEST 2
|
||||
|
||||
/// Coordinated Universal Time
|
||||
#define TIMEZONE_UTC 0
|
||||
|
||||
/// Eastern Daylight Time
|
||||
#define TIMEZONE_EDT -4
|
||||
|
||||
/// Central Daylight Time
|
||||
#define TIMEZONE_CDT -5
|
||||
|
||||
/// Mountain Daylight Time
|
||||
#define TIMEZONE_MDT -6
|
||||
|
||||
/// Mountain Standard Time
|
||||
#define TIMEZONE_MST -7
|
||||
|
||||
/// Pacific Daylight Time
|
||||
#define TIMEZONE_PDT -7
|
||||
|
||||
/// Alaska Daylight Time
|
||||
#define TIMEZONE_AKDT -8
|
||||
|
||||
/// Hawaii-Aleutian Daylight Time
|
||||
#define TIMEZONE_HDT -9
|
||||
|
||||
/// Hawaii Standard Time
|
||||
#define TIMEZONE_HST -10
|
||||
|
||||
/// Cook Island Time
|
||||
#define TIMEZONE_CKT -10
|
||||
|
||||
/// Niue Time
|
||||
#define TIMEZONE_NUT -11
|
||||
|
||||
/// Anywhere on Earth
|
||||
#define TIMEZONE_ANYWHERE_ON_EARTH -12
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
var/always_celebrate = FALSE // for christmas neverending, or testing.
|
||||
var/current_year = 0
|
||||
var/year_offset = 0
|
||||
///Timezones this holiday is celebrated in (defaults to three timezones spanning a 50 hour window covering all timezones)
|
||||
var/list/timezones = list(TIMEZONE_LINT, TIMEZONE_UTC, TIMEZONE_ANYWHERE_ON_EARTH)
|
||||
var/obj/item/drone_hat //If this is defined, drones without a default hat will spawn with this one during the holiday; check drones_as_items.dm to see this used
|
||||
|
||||
// This proc gets run before the game starts when the holiday is activated. Do festive shit here.
|
||||
@@ -61,7 +63,7 @@
|
||||
|
||||
/datum/holiday/new_year
|
||||
name = NEW_YEAR
|
||||
begin_day = 30
|
||||
begin_day = 31
|
||||
begin_month = DECEMBER
|
||||
end_day = 2
|
||||
end_month = JANUARY
|
||||
@@ -81,7 +83,7 @@
|
||||
|
||||
/datum/holiday/valentines
|
||||
name = VALENTINES
|
||||
begin_day = 13
|
||||
begin_day = 14
|
||||
end_day = 15
|
||||
begin_month = FEBRUARY
|
||||
|
||||
@@ -166,9 +168,8 @@
|
||||
|
||||
/datum/holiday/april_fools
|
||||
name = APRIL_FOOLS
|
||||
begin_month = MARCH
|
||||
begin_day = 31
|
||||
end_month = APRIL
|
||||
begin_month = APRIL
|
||||
begin_day = 1
|
||||
end_day = 2
|
||||
|
||||
/datum/holiday/april_fools/celebrate()
|
||||
@@ -255,6 +256,7 @@
|
||||
|
||||
/datum/holiday/usa
|
||||
name = "US Independence Day"
|
||||
timezones = list(TIMEZONE_EDT, TIMEZONE_CDT, TIMEZONE_MDT, TIMEZONE_MST, TIMEZONE_PDT, TIMEZONE_AKDT, TIMEZONE_HDT, TIMEZONE_HST)
|
||||
begin_day = 4
|
||||
begin_month = JULY
|
||||
|
||||
@@ -263,6 +265,7 @@
|
||||
|
||||
/datum/holiday/nz
|
||||
name = "Waitangi Day"
|
||||
timezones = list(TIMEZONE_NZDT, TIMEZONE_CHADT)
|
||||
begin_day = 6
|
||||
begin_month = FEBRUARY
|
||||
|
||||
@@ -270,11 +273,12 @@
|
||||
return pick("Aotearoa","Kiwi","Fish 'n' Chips","Kākāpō","Southern Cross")
|
||||
|
||||
/datum/holiday/nz/greet()
|
||||
var/nz_age = text2num(time2text(world.timeofday, "YYYY")) - 1840 //is this work
|
||||
return "On this day [nz_age] years ago, New Zealand's Treaty of Waitangi, the founding document of the nation, was signed!" //thus creating much controversy
|
||||
var/nz_age = text2num(time2text(world.timeofday, "YYYY")) - 1840
|
||||
return "On this day [nz_age] years ago, New Zealand's Treaty of Waitangi, the founding document of the nation, was signed!"
|
||||
|
||||
/datum/holiday/anz
|
||||
name = "ANZAC Day"
|
||||
timezones = list(TIMEZONE_TKT, TIMEZONE_TOT, TIMEZONE_NZST, TIMEZONE_NFT, TIMEZONE_LHST, TIMEZONE_AEST, TIMEZONE_ACST, TIMEZONE_ACWST, TIMEZONE_AWST, TIMEZONE_CXT, TIMEZONE_CCT, TIMEZONE_CKT, TIMEZONE_NUT)
|
||||
begin_day = 25
|
||||
begin_month = APRIL
|
||||
drone_hat = /obj/item/food/grown/poppy
|
||||
@@ -289,6 +293,7 @@
|
||||
|
||||
/datum/holiday/france
|
||||
name = "Bastille Day"
|
||||
timezones = list(TIMEZONE_CEST)
|
||||
begin_day = 14
|
||||
begin_month = JULY
|
||||
drone_hat = /obj/item/clothing/head/beret
|
||||
@@ -365,7 +370,7 @@
|
||||
|
||||
/datum/holiday/halloween
|
||||
name = HALLOWEEN
|
||||
begin_day = 28
|
||||
begin_day = 29
|
||||
begin_month = OCTOBER
|
||||
end_day = 2
|
||||
end_month = NOVEMBER
|
||||
@@ -461,7 +466,7 @@
|
||||
|
||||
/datum/holiday/xmas
|
||||
name = CHRISTMAS
|
||||
begin_day = 22
|
||||
begin_day = 23
|
||||
begin_month = DECEMBER
|
||||
end_day = 27
|
||||
drone_hat = /obj/item/clothing/head/santa
|
||||
|
||||
Reference in New Issue
Block a user