From f51b366fa0701568f08cbfefae02479b06055242 Mon Sep 17 00:00:00 2001 From: MrMelbert Date: Sun, 30 Nov 2025 18:48:54 -0600 Subject: [PATCH 1/3] Adds event --- .../code/modules/events/secretsanta | 72 +++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 maplestation_modules/code/modules/events/secretsanta diff --git a/maplestation_modules/code/modules/events/secretsanta b/maplestation_modules/code/modules/events/secretsanta new file mode 100644 index 000000000000..126da129ea34 --- /dev/null +++ b/maplestation_modules/code/modules/events/secretsanta @@ -0,0 +1,72 @@ +/datum/round_event_control/secretsanta + name = "Secret Santa" + holidayID = FESTIVE_SEASON + typepath = /datum/round_event/secretsanta + weight = -1 //forces it to be called, regardless of weight + max_occurrences = 1 + earliest_start = 5 MINUTES + category = EVENT_CATEGORY_HOLIDAY + description = "Gives everyone a secret santa to gift something to!" + players_amt = 3 + +/datum/round_event/secretsanta/start() + var/list/mob/living/candidates = list() + for(var/mob/living/candidate as anything in GLOB.mob_living_list) + if(is_candidate(candidate)) + candidates += candidate + + if(length(candidates) < 2) + return // shouldn't happen due to players_amt, but just in case + + var/mob/living/first_gifter = pick_n_take(candidates) + var/mob/living/last_gifter = first_gifter + + while(length(candidates)) + var/mob/living/next_gifter = pick_n_take(candidates) + assign_secret_santa(next_gifter, last_gifter) + last_gifter = next_gifter + + assign_secret_santa(first_gifter, last_gifter) + + // melbert todo : latejoiner handling + +/datum/round_event/secretsanta/proc/is_candidate(mob/living/some_mob) + if(isnull(some_mob.mind)) + return FALSE + var/turf/some_turf = get_turf(some_mob) + // admin characters need not apply, you can spawn whatever you want for christmas + if(is_centcom_level(some_turf.z)) + return FALSE + if(some_mob.mind.assigned_role.job_flags & JOB_CREW_MEMBER) + return TRUE + // sure, we can include silicons in on this. just don't grab ones in deep space i guess + if(issilicon(some_mob) && (is_station_level(some_turf.z) || is_mining_level(some_turf.z))) + return TRUE + return FALSE + +/datum/round_event/secretsanta/proc/assign_secret_santa(mob/living/gifter, mob/living/recipient) + var/datum/antagonist/secret_santa/secret = gifter.mind.add_antagonist(__IMPLIED_TYPE__) + secret.recipient = recipient.mind + to_chat(gifter, examine_block(span_green("[span_big("You are [secret.recipient.name]'s Secret Santa!")]

\ + Come up with an appropriate gift and wait for the festivities to begin!
\ + (If you need help coming up with an idea, try asking their co-workers and friends, or even pray for inspiration!)"))) + +/datum/round_event/secretsanta/announce(fake) + if(fake) + return + + priority_announce("Ho ho ho! The annual Nanotrasen™ Secret Santa is starting! Everyone has been assigned a Secret Santa of another crew member.

\ + When and where you decide to exchange gifts is up to you all to decide - just remember to keep your assignment a secret!
Happy holidays!") + +/datum/antagonist/secret_santa + name = "\improper Secret Santa" + roundend_category = "secret santa" + show_in_antagpanel = FALSE + prevent_roundtype_conversion = FALSE + ui_name = null + silent = TRUE + /// Keep track who we're giving a gift to + var/datum/mind/recipient + +/datum/antagonist/secret_santa/roundend_report() + return "• [owner.name] had [recipient.name] as [owner.p_their()] Secret Santa recipient." From e56c2a341653fb7cbe437eb55c185ebe9d3ceb37 Mon Sep 17 00:00:00 2001 From: MrMelbert Date: Sat, 20 Dec 2025 01:38:05 -0600 Subject: [PATCH 2/3] Fix --- maplestation.dme | 1 + .../events/{secretsanta => secretsanta.dm} | 20 +++++++++++++------ 2 files changed, 15 insertions(+), 6 deletions(-) rename maplestation_modules/code/modules/events/{secretsanta => secretsanta.dm} (88%) diff --git a/maplestation.dme b/maplestation.dme index dde1d478c94b..025854638738 100644 --- a/maplestation.dme +++ b/maplestation.dme @@ -6567,6 +6567,7 @@ #include "maplestation_modules\code\modules\clothing\under\jobs\security.dm" #include "maplestation_modules\code\modules\events\resource_drift.dm" #include "maplestation_modules\code\modules\events\resource_pods.dm" +#include "maplestation_modules\code\modules\events\secretsanta.dm" #include "maplestation_modules\code\modules\events\solar_flare.dm" #include "maplestation_modules\code\modules\flavor_text\flavor_examine.dm" #include "maplestation_modules\code\modules\flavor_text\flavor_helpers.dm" diff --git a/maplestation_modules/code/modules/events/secretsanta b/maplestation_modules/code/modules/events/secretsanta.dm similarity index 88% rename from maplestation_modules/code/modules/events/secretsanta rename to maplestation_modules/code/modules/events/secretsanta.dm index 126da129ea34..62b28f02dcb4 100644 --- a/maplestation_modules/code/modules/events/secretsanta +++ b/maplestation_modules/code/modules/events/secretsanta.dm @@ -6,8 +6,14 @@ max_occurrences = 1 earliest_start = 5 MINUTES category = EVENT_CATEGORY_HOLIDAY - description = "Gives everyone a secret santa to gift something to!" - players_amt = 3 + description = "Gives everyone a secret santa to gift something to! \ + You can execute this multiple times per round to include latejoiners." + min_players = 3 + +/datum/round_event/secretsanta + fakeable = FALSE + /// Only announce once + var/static/announced = FALSE /datum/round_event/secretsanta/start() var/list/mob/living/candidates = list() @@ -28,15 +34,16 @@ assign_secret_santa(first_gifter, last_gifter) - // melbert todo : latejoiner handling - /datum/round_event/secretsanta/proc/is_candidate(mob/living/some_mob) if(isnull(some_mob.mind)) return FALSE + if(some_mob.mind.has_antag_datum(/datum/antagonist/secret_santa)) + return FALSE var/turf/some_turf = get_turf(some_mob) // admin characters need not apply, you can spawn whatever you want for christmas if(is_centcom_level(some_turf.z)) return FALSE + // crew secret santa if(some_mob.mind.assigned_role.job_flags & JOB_CREW_MEMBER) return TRUE // sure, we can include silicons in on this. just don't grab ones in deep space i guess @@ -45,16 +52,17 @@ return FALSE /datum/round_event/secretsanta/proc/assign_secret_santa(mob/living/gifter, mob/living/recipient) - var/datum/antagonist/secret_santa/secret = gifter.mind.add_antagonist(__IMPLIED_TYPE__) + var/datum/antagonist/secret_santa/secret = gifter.mind.add_antag_datum(__IMPLIED_TYPE__) secret.recipient = recipient.mind to_chat(gifter, examine_block(span_green("[span_big("You are [secret.recipient.name]'s Secret Santa!")]

\ Come up with an appropriate gift and wait for the festivities to begin!
\ (If you need help coming up with an idea, try asking their co-workers and friends, or even pray for inspiration!)"))) /datum/round_event/secretsanta/announce(fake) - if(fake) + if(fake || announced) return + announced = TRUE priority_announce("Ho ho ho! The annual Nanotrasen™ Secret Santa is starting! Everyone has been assigned a Secret Santa of another crew member.

\ When and where you decide to exchange gifts is up to you all to decide - just remember to keep your assignment a secret!
Happy holidays!") From 44eda9fa9d4252c5b0b1a975f5ebf3d6a37cbc50 Mon Sep 17 00:00:00 2001 From: MrMelbert Date: Sat, 20 Dec 2025 02:07:08 -0600 Subject: [PATCH 3/3] Done --- .../code/modules/events/secretsanta.dm | 31 ++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/maplestation_modules/code/modules/events/secretsanta.dm b/maplestation_modules/code/modules/events/secretsanta.dm index 62b28f02dcb4..16b682e0563d 100644 --- a/maplestation_modules/code/modules/events/secretsanta.dm +++ b/maplestation_modules/code/modules/events/secretsanta.dm @@ -64,7 +64,7 @@ announced = TRUE priority_announce("Ho ho ho! The annual Nanotrasen™ Secret Santa is starting! Everyone has been assigned a Secret Santa of another crew member.

\ - When and where you decide to exchange gifts is up to you all to decide - just remember to keep your assignment a secret!
Happy holidays!") + When and where you decide to exchange gifts is up to you all to decide - just remember to keep your assignment a secret!
Happy holidays!", encode_text = FALSE) /datum/antagonist/secret_santa name = "\improper Secret Santa" @@ -78,3 +78,32 @@ /datum/antagonist/secret_santa/roundend_report() return "• [owner.name] had [recipient.name] as [owner.p_their()] Secret Santa recipient." + +/datum/antagonist/secret_santa/apply_innate_effects(mob/living/mob_override) + var/mob/living/target = mob_override || owner.current + var/datum/action/secret_santa_reminder/reminder = new(src) + reminder.Grant(target) + +/datum/antagonist/secret_santa/remove_innate_effects(mob/living/mob_override) + var/mob/living/target = mob_override || owner.current + for(var/datum/action/secret_santa_reminder/reminder in target.actions) + qdel(reminder) + +/datum/action/secret_santa_reminder + name = "Secret Santa Reminder" + desc = "Reminds you of who your Secret Santa recipient is." + button_icon_state = "round_end" + show_to_observers = FALSE + +/datum/action/secret_santa_reminder/Trigger(trigger_flags) + . = ..() + if(!.) + return + + var/datum/antagonist/secret_santa/secret = target + if(!istype(secret)) + return + + to_chat(usr, examine_block(span_green("[span_big("You are [secret.recipient.name]'s Secret Santa!")]

\ + Come up with an appropriate gift and wait for the festivities to begin!
\ + (If you need help coming up with an idea, try asking their co-workers and friends, or even pray for inspiration!)")))