Simplify checks for valid nuke detonation sites. (#21518)

* Simplify checks for valid nuke detonation sites.

* falsy check was replaced with equality so this needs to be exact

* Use SSmapping.existing_station_areas instead

* swap to guard clause

* Update code/game/gamemodes/nuclear/nuclearbomb.dm

Co-authored-by: Contrabang <91113370+Contrabang@users.noreply.github.com>

* switch to switch

---------

Co-authored-by: Contrabang <91113370+Contrabang@users.noreply.github.com>
This commit is contained in:
warriorstar-orion
2023-08-21 14:28:52 -04:00
committed by GitHub
parent 76d0428022
commit e2a647188e
4 changed files with 81 additions and 50 deletions
+37 -33
View File
@@ -340,7 +340,7 @@ SUBSYSTEM_DEF(ticker)
return TRUE
/datum/controller/subsystem/ticker/proc/station_explosion_cinematic(station_missed = 0, override = null)
/datum/controller/subsystem/ticker/proc/station_explosion_cinematic(nuke_site = NUKE_SITE_ON_STATION, override = null)
if(cinematic)
return //already a cinematic in progress!
@@ -353,11 +353,9 @@ SUBSYSTEM_DEF(ticker)
cinematic.mouse_opacity = MOUSE_OPACITY_TRANSPARENT
cinematic.screen_loc = "1,1"
if(station_missed)
for(var/mob/M in GLOB.mob_list)
if(M.client)
M.client.screen += cinematic //show every client the cinematic
else //nuke kills everyone on z-level 1 to prevent "hurr-durr I survived"
if(nuke_site == NUKE_SITE_ON_STATION)
// Kill everyone on z-level 1 except for mobs in freezers and
// malfunctioning AIs.
for(var/mob/M in GLOB.mob_list)
if(M.stat != DEAD)
var/turf/T = get_turf(M)
@@ -370,34 +368,15 @@ SUBSYSTEM_DEF(ticker)
CHECK_TICK
if(M && M.client) //Play the survivors a cinematic.
M.client.screen += cinematic
else
for(var/mob/M in GLOB.mob_list)
if(M.client)
M.client.screen += cinematic //show every client the cinematic
//Now animate the cinematic
switch(station_missed)
if(1) //nuke was nearby but (mostly) missed
if(mode && !override)
override = mode.name
switch(override)
if("nuclear emergency") //Nuke wasn't on station when it blew up
flick("intro_nuke", cinematic)
sleep(35)
SEND_SOUND(world, sound('sound/effects/explosion_distant.ogg'))
flick("station_intact_fade_red", cinematic)
cinematic.icon_state = "summary_nukefail"
if("fake") //The round isn't over, we're just freaking people out for fun
flick("intro_nuke", cinematic)
sleep(35)
SEND_SOUND(world, sound('sound/items/bikehorn.ogg'))
flick("summary_selfdes", cinematic)
else
flick("intro_nuke", cinematic)
sleep(35)
SEND_SOUND(world, sound('sound/effects/explosion_distant.ogg'))
if(2) //nuke was nowhere nearby //TODO: a really distant explosion animation
sleep(50)
SEND_SOUND(world, sound('sound/effects/explosion_distant.ogg'))
else //station was destroyed
switch(nuke_site)
//Now animate the cinematic
if(NUKE_SITE_ON_STATION)
// station was destroyed
if(mode && !override)
override = mode.name
switch(override)
@@ -420,6 +399,31 @@ SUBSYSTEM_DEF(ticker)
SEND_SOUND(world, sound('sound/effects/explosion_distant.ogg'))
cinematic.icon_state = "summary_selfdes"
stop_delta_alarm()
if(NUKE_SITE_ON_STATION_ZLEVEL)
// nuke was nearby but (mostly) missed
if(mode && !override)
override = mode.name
switch(override)
if("nuclear emergency") //Nuke wasn't on station when it blew up
flick("intro_nuke", cinematic)
sleep(35)
SEND_SOUND(world, sound('sound/effects/explosion_distant.ogg'))
flick("station_intact_fade_red", cinematic)
cinematic.icon_state = "summary_nukefail"
if("fake") //The round isn't over, we're just freaking people out for fun
flick("intro_nuke", cinematic)
sleep(35)
SEND_SOUND(world, sound('sound/items/bikehorn.ogg'))
flick("summary_selfdes", cinematic)
else
flick("intro_nuke", cinematic)
sleep(35)
SEND_SOUND(world, sound('sound/effects/explosion_distant.ogg'))
if(NUKE_SITE_OFF_STATION_ZLEVEL, NUKE_SITE_INVALID)
// nuke was nowhere nearby
// TODO: a really distant explosion animation
sleep(50)
SEND_SOUND(world, sound('sound/effects/explosion_distant.ogg'))
//If its actually the end of the round, wait for it to end.
//Otherwise if its a verb it will continue on afterwards.