mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2025-12-26 02:02:39 +00:00
Holidays are now actual datums with procs and vars and everything. Holidays run a proc called celebrate() when it's time to celebrate them. Currently none of them do anything but that should change, wink wink. Holidays can now run for more than a day. The important ones, april fools, christmas, halloween, new years, and easter, all last at least a week. The idea is so people can celebrate christmas in game without having to, you know, actually play on fucking christmas. And also to put a time limit on how long stuff like the annoying spookoween closet skeletons will stick around so it doesn't overstay its welcome and become annoying as shit like last year. The event SS now allows more than 1 holiday to run at a time. This matters for new years + christmas, easter + april fools, easter + 4/20, and any holiday that can happen on friday the 13th. The events get stored in a list that's only initialized if there's an active holiday so testing for potential holidays is still pretty easy. Added more easter dates so we won't have to add more until 2040. The current batch run out in 2017. :-------------PARACODE NOTES------------: Tied to event process Extra procs for holidays to be able to run special events alone Admin manual-override functionality maintained and ported to new system
48 lines
1.3 KiB
Plaintext
48 lines
1.3 KiB
Plaintext
/datum/controller/process/event/setup()
|
|
name = "event"
|
|
schedule_interval = 20 // every 2 seconds
|
|
if(!holiday_master)
|
|
holiday_master = new
|
|
holiday_master.Setup()
|
|
|
|
/datum/controller/process/event/doWork()
|
|
event_manager.process()
|
|
holiday_master.process()
|
|
|
|
/////////
|
|
//Holiday controller
|
|
/////////
|
|
|
|
var/global/datum/controller/holiday/holiday_master //This has to be defined before world.
|
|
|
|
/datum/controller/holiday
|
|
var/list/holidays
|
|
|
|
/datum/controller/holiday/proc/Setup()
|
|
getHoliday()
|
|
|
|
/datum/controller/holiday/proc/process()
|
|
if(holiday_master.holidays)
|
|
for(var/datum/holiday/H in holiday_master.holidays)
|
|
if(H.eventChance)
|
|
if(prob(H.eventChance))
|
|
H.handle_event()
|
|
|
|
/datum/controller/holiday/proc/getHoliday()
|
|
if(!config.allow_holidays) return //Holiday stuff was not enabled in the config!
|
|
|
|
var/YY = text2num(time2text(world.timeofday, "YY")) // 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
|
|
|
|
for(var/H in typesof(/datum/holiday) - /datum/holiday)
|
|
var/datum/holiday/holiday = new H()
|
|
if(holiday.shouldCelebrate(DD, MM, YY))
|
|
holiday.celebrate()
|
|
if(!holidays)
|
|
holidays = list()
|
|
holidays[holiday.name] = holiday
|
|
|
|
if(holidays)
|
|
holidays = shuffle(holidays)
|
|
world.update_status() |