From 39728cc9b3255e9c79b319e2a249222dfc88ee97 Mon Sep 17 00:00:00 2001 From: KorPhaeron Date: Sat, 7 Oct 2017 08:41:04 -0500 Subject: [PATCH] Nightmare spawn event (#31376) * Nightmare Event * Update nightmare.dm * Standards --- code/modules/events/nightmare.dm | 43 ++++++++++++++++++++++++++++++++ tgstation.dme | 1 + 2 files changed, 44 insertions(+) create mode 100644 code/modules/events/nightmare.dm diff --git a/code/modules/events/nightmare.dm b/code/modules/events/nightmare.dm new file mode 100644 index 0000000000..7be5db8e84 --- /dev/null +++ b/code/modules/events/nightmare.dm @@ -0,0 +1,43 @@ +/datum/round_event_control/nightmare + name = "Spawn Nightmare" + typepath = /datum/round_event/ghost_role/nightmare + max_occurrences = 1 + min_players = 20 + +/datum/round_event/ghost_role/nightmare + minimum_required = 1 + role_name = "nightmare" + +/datum/round_event/ghost_role/nightmare/spawn_role() + var/list/candidates = get_candidates("alien", null, ROLE_ALIEN) + if(!candidates.len) + return NOT_ENOUGH_PLAYERS + + var/mob/dead/selected = pick(candidates) + + var/datum/mind/player_mind = new /datum/mind(selected.key) + player_mind.active = TRUE + + var/list/spawn_locs = list() + for(var/obj/effect/landmark/xeno_spawn/L in GLOB.landmarks_list) + if(isturf(L.loc)) + var/turf/T = L.loc + var/light_amount = T.get_lumcount() + if(light_amount < SHADOW_SPECIES_LIGHT_THRESHOLD) + spawn_locs += T + + if(!spawn_locs.len) + message_admins("No valid spawn locations found, aborting...") + return MAP_ERROR + + var/mob/living/carbon/human/S = new ((pick(spawn_locs))) + player_mind.transfer_to(S) + player_mind.assigned_role = "Nightmare" + player_mind.special_role = "Nightmare" + SSticker.mode.traitors += player_mind + S.set_species(/datum/species/shadow/nightmare) + playsound(S, 'sound/magic/ethereal_exit.ogg', 50, 1, -1) + message_admins("[key_name_admin(S)] has been made into a Nightmare by an event.") + log_game("[key_name(S)] was spawned as a Nightmare by an event.") + spawned_mobs += S + return SUCCESSFUL_SPAWN diff --git a/tgstation.dme b/tgstation.dme index 32de5b6c33..ab5b26b120 100755 --- a/tgstation.dme +++ b/tgstation.dme @@ -1346,6 +1346,7 @@ #include "code\modules\events\meateor_wave.dm" #include "code\modules\events\meteor_wave.dm" #include "code\modules\events\mice_migration.dm" +#include "code\modules\events\nightmare.dm" #include "code\modules\events\operative.dm" #include "code\modules\events\portal_storm.dm" #include "code\modules\events\prison_break.dm"