diff --git a/code/__DEFINES/magic.dm b/code/__DEFINES/magic.dm
index 7e5bf8d07c9..3c28928e46e 100644
--- a/code/__DEFINES/magic.dm
+++ b/code/__DEFINES/magic.dm
@@ -29,8 +29,3 @@
#define INVOCATION_EMOTE "emote"
///Forces the wizard to whisper (and be able to) to cast the spell.
#define INVOCATION_WHISPER "whisper"
-
-///Spawns random guns near players and gives some players antag objectives
-#define SUMMON_GUNS "guns"
-///Spawns random wands and spellbooks near players and gives some players antag objectives
-#define SUMMON_MAGIC "magic"
diff --git a/code/modules/admin/verbs/secrets.dm b/code/modules/admin/verbs/secrets.dm
index 04d4ab04396..bbe3e590202 100644
--- a/code/modules/admin/verbs/secrets.dm
+++ b/code/modules/admin/verbs/secrets.dm
@@ -293,7 +293,8 @@ GLOBAL_DATUM(everyone_a_traitor, /datum/everyone_is_a_traitor_controller)
if("All Antags!")
survivor_probability = 100
- rightandwrong(SUMMON_GUNS, holder, survivor_probability)
+ summon_guns(holder, survivor_probability)
+
if("magic")
if(!is_funmin)
return
@@ -305,24 +306,25 @@ GLOBAL_DATUM(everyone_a_traitor, /datum/everyone_is_a_traitor_controller)
if("All Antags!")
survivor_probability = 100
- rightandwrong(SUMMON_MAGIC, holder, survivor_probability)
+ summon_magic(holder, survivor_probability)
+
if("events")
if(!is_funmin)
return
- if(!SSevents.wizardmode)
- if(tgui_alert(usr,"Do you want to toggle summon events on?",,list("Yes","No")) == "Yes")
- summonevents()
- SSblackbox.record_feedback("nested tally", "admin_secrets_fun_used", 1, list("Summon Events", "Activate"))
-
- else
+ if(SSevents.wizardmode)
switch(tgui_alert(usr,"What would you like to do?",,list("Intensify Summon Events","Turn Off Summon Events","Nothing")))
if("Intensify Summon Events")
- summonevents()
+ summon_events(holder)
SSblackbox.record_feedback("nested tally", "admin_secrets_fun_used", 1, list("Summon Events", "Intensify"))
if("Turn Off Summon Events")
SSevents.toggleWizardmode()
SSevents.resetFrequency()
SSblackbox.record_feedback("nested tally", "admin_secrets_fun_used", 1, list("Summon Events", "Disable"))
+ else
+ if(tgui_alert(usr,"Do you want to toggle summon events on?",,list("Yes","No")) == "Yes")
+ summon_events(holder)
+ SSblackbox.record_feedback("nested tally", "admin_secrets_fun_used", 1, list("Summon Events", "Activate"))
+
if("eagles")
if(!is_funmin)
return
diff --git a/code/modules/antagonists/wizard/equipment/spellbook.dm b/code/modules/antagonists/wizard/equipment/spellbook.dm
index 68e55791531..8d62d02ca3f 100644
--- a/code/modules/antagonists/wizard/equipment/spellbook.dm
+++ b/code/modules/antagonists/wizard/equipment/spellbook.dm
@@ -544,11 +544,15 @@
/datum/spellbook_entry/summon
name = "Summon Stuff"
category = "Rituals"
+ limit = 1
refundable = FALSE
buy_word = "Cast"
-/datum/spellbook_entry/summon/CanBuy(mob/living/carbon/human/user,obj/item/spellbook/book)
- return ..() && !times
+/datum/spellbook_entry/summon/Buy(mob/living/carbon/human/user, obj/item/spellbook/book)
+ log_spellbook("[key_name(user)] cast [src] for [cost] points")
+ SSblackbox.record_feedback("tally", "wizard_spell_learned", 1, name)
+ times++
+ return TRUE
/datum/spellbook_entry/summon/ghosts
name = "Summon Ghosts"
@@ -556,85 +560,66 @@
cost = 0
/datum/spellbook_entry/summon/ghosts/Buy(mob/living/carbon/human/user, obj/item/spellbook/book)
- log_spellbook("[key_name(user)] cast [src] for [cost] points")
- SSblackbox.record_feedback("tally", "wizard_spell_learned", 1, name)
- new /datum/round_event/wizard/ghost()
- times++
- to_chat(user, span_notice("You have cast summon ghosts!"))
+ summon_ghosts(user)
playsound(get_turf(user), 'sound/effects/ghost2.ogg', 50, TRUE)
- return TRUE
+ return ..()
/datum/spellbook_entry/summon/guns
name = "Summon Guns"
desc = "Nothing could possibly go wrong with arming a crew of lunatics just itching for an excuse to kill you. There is a good chance that they will shoot each other first."
/datum/spellbook_entry/summon/guns/IsAvailable()
- if(!SSticker.mode) // In case spellbook is placed on map
+ // Summon Guns requires 100 threat.
+ var/datum/game_mode/dynamic/mode = SSticker.mode
+ if(mode.threat_level < MINIMUM_THREAT_FOR_RITUALS)
return FALSE
- if(istype(SSticker.mode, /datum/game_mode/dynamic)) // Disable events on dynamic
- var/datum/game_mode/dynamic/mode = SSticker.mode
- if(mode.threat_level < MINIMUM_THREAT_FOR_RITUALS)
- return FALSE
+ // Also must be config enabled
return !CONFIG_GET(flag/no_summon_guns)
/datum/spellbook_entry/summon/guns/Buy(mob/living/carbon/human/user,obj/item/spellbook/book)
- log_spellbook("[key_name(user)] cast [src] for [cost] points")
- SSblackbox.record_feedback("tally", "wizard_spell_learned", 1, name)
- rightandwrong(SUMMON_GUNS, user, 10)
- times++
+ summon_guns(user, 10)
playsound(get_turf(user), 'sound/magic/castsummon.ogg', 50, TRUE)
- to_chat(user, span_notice("You have cast summon guns!"))
- return TRUE
+ return ..()
/datum/spellbook_entry/summon/magic
name = "Summon Magic"
desc = "Share the wonders of magic with the crew and show them why they aren't to be trusted with it at the same time."
/datum/spellbook_entry/summon/magic/IsAvailable()
- if(!SSticker.mode) // In case spellbook is placed on map
+ // Summon Magic requires 100 threat.
+ var/datum/game_mode/dynamic/mode = SSticker.mode
+ if(mode.threat_level < MINIMUM_THREAT_FOR_RITUALS)
return FALSE
- if(istype(SSticker.mode, /datum/game_mode/dynamic)) // Disable events on dynamic
- var/datum/game_mode/dynamic/mode = SSticker.mode
- if(mode.threat_level < MINIMUM_THREAT_FOR_RITUALS)
- return FALSE
+ // Also must be config enabled
return !CONFIG_GET(flag/no_summon_magic)
/datum/spellbook_entry/summon/magic/Buy(mob/living/carbon/human/user,obj/item/spellbook/book)
- log_spellbook("[key_name(user)] cast [src] for [cost] points")
- SSblackbox.record_feedback("tally", "wizard_spell_learned", 1, name)
- rightandwrong(SUMMON_MAGIC, user, 10)
- times++
+ summon_magic(user, 10)
playsound(get_turf(user), 'sound/magic/castsummon.ogg', 50, TRUE)
- to_chat(user, span_notice("You have cast summon magic!"))
- return TRUE
+ return ..()
/datum/spellbook_entry/summon/events
name = "Summon Events"
desc = "Give Murphy's law a little push and replace all events with special wizard ones that will confound and confuse everyone. Multiple castings increase the rate of these events."
cost = 2
- limit = 1
+ limit = 5 // Each purchase can intensify it.
/datum/spellbook_entry/summon/events/IsAvailable()
- if(!SSticker.mode) // In case spellbook is placed on map
+ // Summon Events requires 100 threat.
+ var/datum/game_mode/dynamic/mode = SSticker.mode
+ if(mode.threat_level < MINIMUM_THREAT_FOR_RITUALS)
return FALSE
- if(istype(SSticker.mode, /datum/game_mode/dynamic)) // Disable events on dynamic
- var/datum/game_mode/dynamic/mode = SSticker.mode
- if(mode.threat_level < MINIMUM_THREAT_FOR_RITUALS)
- return FALSE
+ // Also, must be config enabled
return !CONFIG_GET(flag/no_summon_events)
-/datum/spellbook_entry/summon/events/Buy(mob/living/carbon/human/user,obj/item/spellbook/book)
- log_spellbook("[key_name(user)] cast [src] for [cost] points")
- SSblackbox.record_feedback("tally", "wizard_spell_learned", 1, name)
- summonevents()
- times++
+/datum/spellbook_entry/summon/events/Buy(mob/living/carbon/human/user, obj/item/spellbook/book)
+ summon_events(user)
playsound(get_turf(user), 'sound/magic/castsummon.ogg', 50, TRUE)
- to_chat(user, span_notice("You have cast summon events."))
- return TRUE
+ return ..()
/datum/spellbook_entry/summon/events/GetInfo()
- if(times>0)
- . += "You cast it [times] times.
"
+ if(times > 0)
+ . += "You have cast it [times] time\s.
"
return .
/datum/spellbook_entry/summon/curse_of_madness
@@ -643,16 +628,12 @@
cost = 4
/datum/spellbook_entry/summon/curse_of_madness/Buy(mob/living/carbon/human/user, obj/item/spellbook/book)
- log_spellbook("[key_name(user)] cast [src] for [cost] points")
- SSblackbox.record_feedback("tally", "wizard_spell_learned", 1, name)
- times++
var/message = tgui_input_text(user, "Whisper a secret truth to drive your victims to madness", "Whispers of Madness")
if(!message)
return FALSE
curse_of_madness(user, message)
- to_chat(user, span_notice("You have cast the curse of insanity!"))
playsound(user, 'sound/magic/mandswap.ogg', 50, TRUE)
- return TRUE
+ return ..()
#undef MINIMUM_THREAT_FOR_RITUALS
diff --git a/code/modules/events/wizard/summons.dm b/code/modules/events/wizard/summons.dm
index 544a5c7cb35..3a5150e39fc 100644
--- a/code/modules/events/wizard/summons.dm
+++ b/code/modules/events/wizard/summons.dm
@@ -8,10 +8,10 @@
/datum/round_event_control/wizard/summonguns/New()
if(CONFIG_GET(flag/no_summon_guns))
weight = 0
- ..()
+ return ..()
/datum/round_event/wizard/summonguns/start()
- rightandwrong(SUMMON_GUNS, null, 10)
+ summon_guns(survivor_probability = 10)
/datum/round_event_control/wizard/summonmagic //The Somewhat Less Classic
name = "Summon Magic"
@@ -23,7 +23,7 @@
/datum/round_event_control/wizard/summonmagic/New()
if(CONFIG_GET(flag/no_summon_magic))
weight = 0
- ..()
+ return ..()
/datum/round_event/wizard/summonmagic/start()
- rightandwrong(SUMMON_MAGIC, null, 10)
+ summon_magic(survivor_probability = 10)
diff --git a/code/modules/spells/spell_types/curse.dm b/code/modules/spells/spell_types/curse.dm
index 7d4a77f359b..8b0f88727f7 100644
--- a/code/modules/spells/spell_types/curse.dm
+++ b/code/modules/spells/spell_types/curse.dm
@@ -10,28 +10,28 @@ GLOBAL_VAR_INIT(curse_of_madness_triggered, FALSE)
deadchat_broadcast("A [span_name("Curse of Madness")] has stricken the station, shattering their minds with the awful secret: \"[message]\"", message_type=DEADCHAT_ANNOUNCEMENT)
- for(var/mob/living/carbon/human/H in GLOB.player_list)
- if(H.stat == DEAD)
+ for(var/mob/living/carbon/human/to_curse in GLOB.player_list)
+ if(to_curse.stat == DEAD)
continue
- var/turf/T = get_turf(H)
- if(T && !is_station_level(T.z))
+ var/turf/curse_turf = get_turf(to_curse)
+ if(curse_turf && !is_station_level(curse_turf.z))
continue
- if(H.anti_magic_check(TRUE, FALSE, TRUE))
- to_chat(H, span_notice("You have a strange feeling for a moment, but then it passes."))
+ if(to_curse.anti_magic_check(TRUE, FALSE, TRUE))
+ to_chat(to_curse, span_notice("You have a strange feeling for a moment, but then it passes."))
continue
- give_madness(H, message)
+ give_madness(to_curse, message)
-/proc/give_madness(mob/living/carbon/human/H, message)
- H.playsound_local(H,'sound/magic/curse.ogg',40,1)
- to_chat(H, "[message]")
- to_chat(H, span_warning("Your mind shatters!"))
- switch(rand(1,10))
+/proc/give_madness(mob/living/carbon/human/to_curse, message)
+ to_curse.playsound_local(to_curse, 'sound/magic/curse.ogg', 40, 1)
+ to_chat(to_curse, span_reallybig(span_hypnophrase(message)))
+ to_chat(to_curse, span_warning("Your mind shatters!"))
+ switch(rand(1, 10))
if(1 to 3)
- H.gain_trauma_type(BRAIN_TRAUMA_MILD, TRAUMA_RESILIENCE_LOBOTOMY)
- H.gain_trauma_type(BRAIN_TRAUMA_MILD, TRAUMA_RESILIENCE_LOBOTOMY)
+ to_curse.gain_trauma_type(BRAIN_TRAUMA_MILD, TRAUMA_RESILIENCE_LOBOTOMY)
+ to_curse.gain_trauma_type(BRAIN_TRAUMA_MILD, TRAUMA_RESILIENCE_LOBOTOMY)
if(4 to 6)
- H.gain_trauma_type(BRAIN_TRAUMA_SEVERE, TRAUMA_RESILIENCE_LOBOTOMY)
+ to_curse.gain_trauma_type(BRAIN_TRAUMA_SEVERE, TRAUMA_RESILIENCE_LOBOTOMY)
if(7 to 8)
- H.gain_trauma_type(BRAIN_TRAUMA_MAGIC, TRAUMA_RESILIENCE_LOBOTOMY)
+ to_curse.gain_trauma_type(BRAIN_TRAUMA_MAGIC, TRAUMA_RESILIENCE_LOBOTOMY)
if(9 to 10)
- H.gain_trauma_type(BRAIN_TRAUMA_SPECIAL, TRAUMA_RESILIENCE_LOBOTOMY)
+ to_curse.gain_trauma_type(BRAIN_TRAUMA_SPECIAL, TRAUMA_RESILIENCE_LOBOTOMY)
diff --git a/code/modules/spells/spell_types/rightandwrong.dm b/code/modules/spells/spell_types/rightandwrong.dm
index 1b9c6678111..7a31b45c0f7 100644
--- a/code/modules/spells/spell_types/rightandwrong.dm
+++ b/code/modules/spells/spell_types/rightandwrong.dm
@@ -1,8 +1,8 @@
//In this file: Summon Magic/Summon Guns/Summon Events
//and corresponding datum controller for them
-GLOBAL_DATUM(summon_guns, /datum/summon_guns_controller)
-GLOBAL_DATUM(summon_magic, /datum/summon_magic_controller)
+GLOBAL_DATUM(summon_guns, /datum/summon_things_controller)
+GLOBAL_DATUM(summon_magic, /datum/summon_things_controller)
// 1 in 50 chance of getting something really special.
#define SPECIALIST_MAGIC_PROB 2
@@ -100,142 +100,196 @@ GLOBAL_LIST_INIT(summoned_magic_objectives, list(
/obj/item/storage/belt/wands/full,
/obj/item/warpwhistle))
-/proc/give_guns(mob/living/carbon/human/H)
- if(H.stat == DEAD || !(H.client))
+/*
+ * Gives [to_equip] a random gun from a list.
+ */
+/proc/give_guns(mob/living/carbon/human/to_equip)
+ if(!GLOB.summon_guns)
+ CRASH("give_guns() was called without a summon guns global datum!")
+ if(to_equip.stat == DEAD || !to_equip.client || !to_equip.mind)
return
- if(H.mind)
- if(IS_WIZARD(H) || H.mind.has_antag_datum(/datum/antagonist/survivalist/guns))
- return
- var/datum/summon_guns_controller/controller = GLOB.summon_guns
- if(prob(controller.survivor_probability) && !(H.mind.has_antag_datum(/datum/antagonist)))
- H.mind.add_antag_datum(/datum/antagonist/survivalist/guns)
- H.log_message("was made into a survivalist, and trusts no one!", LOG_ATTACK, color="red")
+ if(IS_WIZARD(to_equip) || to_equip.mind.has_antag_datum(/datum/antagonist/survivalist/guns))
+ return
+
+ if(!length(to_equip.mind.antag_datums) && prob(GLOB.summon_guns.survivor_probability))
+ to_equip.mind.add_antag_datum(/datum/antagonist/survivalist/guns)
+ to_equip.log_message("was made into a survivalist by summon guns, and trusts no one!", LOG_ATTACK, color = "red")
var/gun_type = pick(GLOB.summoned_guns)
- var/obj/item/gun/G = new gun_type(get_turf(H))
- if (istype(G)) // The list may contain some non-gun type guns which do not have this proc
- G.unlock()
- playsound(get_turf(H),'sound/magic/summon_guns.ogg', 50, TRUE)
+ var/obj/item/gun/spawned_gun = new gun_type(get_turf(to_equip))
+ if (istype(spawned_gun)) // The list may contain some non-gun type guns which do not have this proc
+ spawned_gun.unlock()
+ playsound(get_turf(to_equip), 'sound/magic/summon_guns.ogg', 50, TRUE)
- var/in_hand = H.put_in_hands(G) // not always successful
+ var/in_hand = to_equip.put_in_hands(spawned_gun) // not always successful
- to_chat(H, span_warning("\A [G] appears [in_hand ? "in your hand" : "at your feet"]!"))
+ to_chat(to_equip, span_warning("\A [spawned_gun] appears [in_hand ? "in your hand" : "at your feet"]!"))
-/proc/give_magic(mob/living/carbon/human/H)
- if(H.stat == DEAD || !(H.client))
- return
- if(H.mind)
- if(IS_WIZARD(H) || H.mind.has_antag_datum(/datum/antagonist/survivalist/magic))
- return
+/*
+ * Gives [to_equip] a random magical spell from a list.
+ */
+/proc/give_magic(mob/living/carbon/human/to_equip)
if(!GLOB.summon_magic)
+ CRASH("give_magic() was called without a summon magic global datum!")
+ if(to_equip.stat == DEAD || !to_equip.client || !to_equip.mind)
+ return
+ if(IS_WIZARD(to_equip) || to_equip.mind.has_antag_datum(/datum/antagonist/survivalist/guns))
return
- var/datum/summon_magic_controller/controller = GLOB.summon_magic
- if(prob(controller.survivor_probability) && !(H.mind.has_antag_datum(/datum/antagonist)))
- H.mind.add_antag_datum(/datum/antagonist/survivalist/magic)
- H.log_message("was made into a survivalist, and trusts no one!", LOG_ATTACK, color="red")
- var/magic_type = pick(GLOB.summoned_magic)
- var/lucky = FALSE
- if(prob(SPECIALIST_MAGIC_PROB))
- magic_type = pick(GLOB.summoned_special_magic)
- lucky = TRUE
+ if(!length(to_equip.mind.antag_datums) && prob(GLOB.summon_magic.survivor_probability))
+ to_equip.mind.add_antag_datum(/datum/antagonist/survivalist/magic)
+ to_equip.log_message("was made into a survivalist by summon magic, and trusts no one!", LOG_ATTACK, color = "red")
- var/obj/item/M = new magic_type(get_turf(H))
- playsound(get_turf(H),'sound/magic/summon_magic.ogg', 50, TRUE)
+ var/magic_type = prob(SPECIALIST_MAGIC_PROB) ? pick(GLOB.summoned_special_magic) : pick(GLOB.summoned_magic)
- var/in_hand = H.put_in_hands(M)
+ var/obj/item/spawned_magic = new magic_type(get_turf(to_equip))
+ playsound(get_turf(to_equip), 'sound/magic/summon_magic.ogg', 50, TRUE)
- to_chat(H, span_warning("\A [M] appears [in_hand ? "in your hand" : "at your feet"]!"))
- if(lucky)
- to_chat(H, span_notice("You feel incredibly lucky."))
+ var/in_hand = to_equip.put_in_hands(spawned_magic)
+ to_chat(to_equip, span_warning("\A [spawned_magic] appears [in_hand ? "in your hand" : "at your feet"]!"))
+ if(magic_type in GLOB.summoned_special_magic)
+ to_chat(to_equip, span_notice("You feel incredibly lucky."))
-/proc/rightandwrong(summon_type, mob/user, survivor_probability)
- if(user) //in this case either someone holding a spellbook or a badmin
- to_chat(user, span_warning("You summoned [summon_type]!"))
- message_admins("[ADMIN_LOOKUPFLW(user)] summoned [summon_type]!")
- log_game("[key_name(user)] summoned [summon_type]!")
+/*
+ * Triggers Summon Ghosts from [user].
+ */
+/proc/summon_ghosts(mob/user)
- if(summon_type == SUMMON_MAGIC)
- GLOB.summon_magic = new /datum/summon_magic_controller(survivor_probability)
- else if(summon_type == SUMMON_GUNS)
- GLOB.summon_guns = new /datum/summon_guns_controller(survivor_probability)
+ var/datum/round_event_control/wizard/ghost/ghost_event = locate() in SSevents.control
+ if(ghost_event)
+ if(user)
+ to_chat(user, span_warning("You summoned ghosts!"))
+ message_admins("[ADMIN_LOOKUPFLW(user)] summoned ghosts!")
+ log_game("[key_name(user)] summoned ghosts!")
+ else
+ message_admins("Summon Ghosts was triggered!")
+ log_game("Summon Ghosts was triggered!")
+ ghost_event.runEvent()
else
- CRASH("Bad summon_type given: [summon_type]")
+ stack_trace("Unable to run summon ghosts, due to being unable to locate the associated event.")
+ if(user)
+ to_chat(user, span_warning("You... try to summon ghosts, but nothing seems to happen. Shame."))
-/proc/summonevents()
- if(!SSevents.wizardmode)
- SSevents.frequency_lower = 600 //1 minute lower bound
- SSevents.frequency_upper = 3000 //5 minutes upper bound
- SSevents.toggleWizardmode()
- SSevents.reschedule()
+/*
+ * Triggers Summon Magic from [user].
+ * Can optionally be passed [survivor_probability], to set the chance of creating survivalists.
+ * If Summon Magic has already been triggered, gives out magic to everyone again.
+ */
+/proc/summon_magic(mob/user, survivor_probability = 0)
+ if(user)
+ to_chat(user, span_warning("You summoned magic!"))
+ message_admins("[ADMIN_LOOKUPFLW(user)] summoned magic!")
+ log_game("[key_name(user)] summoned magic!")
+ else
+ message_admins("Summon Magic was triggered!")
+ log_game("Summon Magic was triggered!")
- else //Speed it up
- SSevents.frequency_upper -= 600 //The upper bound falls a minute each time, making the AVERAGE time between events lessen
+ if(GLOB.summon_magic)
+ GLOB.summon_magic.survivor_probability = survivor_probability
+ else
+ GLOB.summon_magic = new /datum/summon_things_controller(/proc/give_magic, survivor_probability)
+ GLOB.summon_magic.give_out_gear()
+
+/*
+ * Triggers Summon Guns from [user].
+ * Can optionally be passed [survivor_probability], to set the chance of creating survivalists.
+ * If Summon Guns has already been triggered, gives out guns to everyone again.
+ */
+/proc/summon_guns(mob/user, survivor_probability = 0)
+ if(user)
+ to_chat(user, span_warning("You summoned guns!"))
+ message_admins("[ADMIN_LOOKUPFLW(user)] summoned guns!")
+ log_game("[key_name(user)] summoned guns!")
+ else
+ message_admins("Summon Guns was triggered!")
+ log_game("Summon Guns was triggered!")
+
+ if(GLOB.summon_guns)
+ GLOB.summon_guns.survivor_probability = survivor_probability
+ else
+ GLOB.summon_guns = new /datum/summon_things_controller(/proc/give_guns, survivor_probability)
+ GLOB.summon_guns.give_out_gear()
+
+/*
+ * Triggers Summon Events from [user].
+ * If Summon Events has already been triggered, speeds up the event timer.
+ */
+/proc/summon_events(mob/user)
+ // Already in wiz-mode? Speed er up
+ if(SSevents.wizardmode)
+ SSevents.frequency_upper -= 1 MINUTES //The upper bound falls a minute each time, making the AVERAGE time between events lessen
if(SSevents.frequency_upper < SSevents.frequency_lower) //Sanity
SSevents.frequency_upper = SSevents.frequency_lower
SSevents.reschedule()
+ if(user)
+ to_chat(user, span_warning("You have intensified summon events, causing them to occur more often!"))
+ message_admins("[ADMIN_LOOKUPFLW(user)] intensified summon events!")
+ log_game("[key_name(user)] intensified events!")
+ else
+ log_game("Summon Events was intensified!")
+
message_admins("Summon Events intensifies, events will now occur every [SSevents.frequency_lower / 600] to [SSevents.frequency_upper / 600] minutes.")
- log_game("Summon Events was increased!")
+
+ // Not in wiz-mode? Get this show on the road
+ else
+ SSevents.frequency_lower = 1 MINUTES //1 minute lower bound
+ SSevents.frequency_upper = 5 MINUTES //5 minutes upper bound
+ SSevents.toggleWizardmode()
+ SSevents.reschedule()
+ if(user)
+ to_chat(user, span_warning("You have cast summon events!"))
+ message_admins("[ADMIN_LOOKUPFLW(user)] summoned events!")
+ log_game("[key_name(user)] summoned events!")
+ else
+ message_admins("Summon Events was triggered!")
+ log_game("Summon Events was triggered!")
#undef SPECIALIST_MAGIC_PROB
/**
- * The magic controller handles the summon magic event.
- * It is first created when summon magic event is triggered, and it can be referenced from GLOB.summon_magic
+ * The "Give everyone in the crew and also latejoins a buncha stuff" controller.
+ * Used for summon magic and summon guns.
*/
-/datum/summon_magic_controller
- ///chances someone who is given magic will be an antagonist
+/datum/summon_things_controller
+ /// Prob. chance someone who is given things will be made a survivalist antagonist.
var/survivor_probability = 0
+ /// The proc path we call on someone to equip them with stuff. Cannot function without it.
+ var/give_proc_path
+ /// The number of equipment we give to latejoiners, to make sure they catch up if it was casted multiple times.
+ var/num_to_give_to_latejoiners = 0
-/datum/summon_magic_controller/New(survivor_probability)
+/datum/summon_things_controller/New(give_proc_path, survivor_probability = 0)
. = ..()
+ if(isnull(give_proc_path))
+ CRASH("[type] was created without a give_proc_path (the proc that gives people stuff)!")
+
src.survivor_probability = survivor_probability
- RegisterSignal(SSdcs, COMSIG_GLOB_CREWMEMBER_JOINED, .proc/magic_up_new_crew)
+ src.give_proc_path = give_proc_path
- for(var/mob/living/carbon/human/unarmed_human in GLOB.player_list)
- var/turf/turf_check = get_turf(unarmed_human)
- if(turf_check && is_away_level(turf_check.z))
- continue
- give_magic(unarmed_human)
+ RegisterSignal(SSdcs, COMSIG_GLOB_CREWMEMBER_JOINED, .proc/gear_up_new_crew)
-/datum/summon_magic_controller/Destroy(force, ...)
+/datum/summon_things_controller/Destroy(force, ...)
. = ..()
UnregisterSignal(SSdcs, COMSIG_GLOB_CREWMEMBER_JOINED)
-///signal proc to give magic to new crewmembers
-/datum/summon_magic_controller/proc/magic_up_new_crew(datum/source, mob/living/new_crewmember, rank)
- SIGNAL_HANDLER
- if(ishuman(new_crewmember))
- INVOKE_ASYNC(GLOB.summon_magic, .proc/give_magic, new_crewmember)
-
-/**
- * The guns controller handles the summon guns event.
- * It is first created when summon guns event is triggered, and it can be referenced from GLOB.summon_guns
- */
-/datum/summon_guns_controller
- ///chances someone who is given guns will be an antagonist
- var/survivor_probability = 0
-
-/datum/summon_guns_controller/New(survivor_probability)
- . = ..()
- src.survivor_probability = survivor_probability
- RegisterSignal(SSdcs, COMSIG_GLOB_CREWMEMBER_JOINED, .proc/arm_up_new_crew)
-
- for(var/mob/living/carbon/human/unarmed_human in GLOB.player_list)
- var/turf/turf_check = get_turf(unarmed_human)
+/// Calls our give_proc_path on all humans in the player list.
+/datum/summon_things_controller/proc/give_out_gear()
+ num_to_give_to_latejoiners++
+ for(var/mob/living/carbon/human/to_equip in GLOB.player_list)
+ var/turf/turf_check = get_turf(to_equip)
if(turf_check && is_away_level(turf_check.z))
continue
- give_guns(unarmed_human)
+ INVOKE_ASYNC(GLOBAL_PROC, give_proc_path, to_equip)
-/datum/summon_guns_controller/Destroy(force, ...)
- . = ..()
- UnregisterSignal(SSdcs, COMSIG_GLOB_CREWMEMBER_JOINED)
-
-///signal proc to give guns to new crewmembers
-/datum/summon_guns_controller/proc/arm_up_new_crew(datum/source, mob/living/new_crewmember, rank)
+/// Signal proc from [COMSIG_GLOB_CREWMEMBER_JOINED].
+/// Calls give_proc_path on latejoiners a number of times (based on num_to_give_to_latejoiners)
+/datum/summon_things_controller/proc/gear_up_new_crew(datum/source, mob/living/new_crewmember, rank)
SIGNAL_HANDLER
- if(ishuman(new_crewmember))
- INVOKE_ASYNC(GLOB.summon_guns, .proc/give_guns, new_crewmember)
+ if(!ishuman(new_crewmember))
+ return
+
+ for(var/i in 1 to num_to_give_to_latejoiners)
+ INVOKE_ASYNC(GLOBAL_PROC, give_proc_path, new_crewmember)