Files
Bubberstation/code/modules/events/nightmare.dm
Rob Bailey 2029163d33 playsound vary boolean define conversion (#46254)
About The Pull Request

Converts every single usage of playsound's vary parameter to use the boolean define instead of 1 or 0. I'm tired of people copypasting the incorrect usage.
Also changes a couple of places where a list was picked from instead of using get_sfx internal calls

This was done via regex:
(playsound\(.+,.+,.+, ?)1( ?\)| ?,.+\)) to match 1
(playsound\(.+,.+,.+, ?)0( ?\)| ?,.+\)) to match 0
full sed commands:
/(playsound\(.+,.+,.+, ?)1( ?\)| ?,.+\))/\1TRUE\2/ 1 to TRUE
/(playsound\(.+,.+,.+, ?)0( ?\)| ?,.+\))/\1FALSE\2/ 0 to FALSE

I'm not very good with regex and these could probably be optimized, but they worked.
Why It's Good For The Game

Code usability
2019-08-30 18:45:20 +12:00

44 lines
1.4 KiB
Plaintext

/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"
fakeable = FALSE
/datum/round_event/ghost_role/nightmare/spawn_role()
var/list/candidates = get_candidates(ROLE_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/X in GLOB.xeno_spawn)
var/turf/T = X
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"
player_mind.add_antag_datum(/datum/antagonist/nightmare)
S.set_species(/datum/species/shadow/nightmare)
playsound(S, 'sound/magic/ethereal_exit.ogg', 50, TRUE, -1)
message_admins("[ADMIN_LOOKUPFLW(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