From 34f37bcf93bd8f59f682bc1a4200a05158b4710d Mon Sep 17 00:00:00 2001
From: Contrabang <91113370+Contrabang@users.noreply.github.com>
Date: Sat, 24 Dec 2022 10:56:32 -0500
Subject: [PATCH] Fixes some issues with Deathsquad spawning (#19868)
* fix the ds
* woo NAD changes
* Remove debugging
* s43n review
---
code/game/gamemodes/nuclear/nuclearbomb.dm | 22 +++++++++--
code/modules/admin/verbs/deathsquad.dm | 43 ++++++++++------------
2 files changed, 37 insertions(+), 28 deletions(-)
diff --git a/code/game/gamemodes/nuclear/nuclearbomb.dm b/code/game/gamemodes/nuclear/nuclearbomb.dm
index 68db9c39e22..63cac8b1691 100644
--- a/code/game/gamemodes/nuclear/nuclearbomb.dm
+++ b/code/game/gamemodes/nuclear/nuclearbomb.dm
@@ -526,16 +526,24 @@ GLOBAL_VAR(bomb_set)
max_integrity = 250
armor = list(MELEE = 0, BULLET = 0, LASER = 0, ENERGY = 0, BOMB = 30, BIO = 0, RAD = 0, FIRE = 100, ACID = 100)
resistance_flags = INDESTRUCTIBLE | LAVA_PROOF | FIRE_PROOF | ACID_PROOF
+ /// Is the disk restricted to the station? If true, also respawns the disk when deleted
+ var/restricted_to_station = TRUE
/obj/item/disk/nuclear/unrestricted
+ name = "unrestricted nuclear authentication disk"
desc = "Seems to have been stripped of its safeties, you better not lose it."
+ restricted_to_station = FALSE
/obj/item/disk/nuclear/New()
..()
- START_PROCESSING(SSobj, src)
+ if(restricted_to_station)
+ START_PROCESSING(SSobj, src)
GLOB.poi_list |= src
/obj/item/disk/nuclear/process()
+ if(!restricted_to_station)
+ stack_trace("An unrestricted NAD ([src]) was processing.")
+ return PROCESS_KILL
if(!check_disk_loc())
var/holder = get(src, /mob)
if(holder)
@@ -544,6 +552,8 @@ GLOBAL_VAR(bomb_set)
//station disk is allowed on the station level, escape shuttle/pods, CC, and syndicate shuttles/base, reset otherwise
/obj/item/disk/nuclear/proc/check_disk_loc()
+ if(!restricted_to_station)
+ return TRUE
var/turf/T = get_turf(src)
var/area/A = get_area(src)
if(is_station_level(T.z))
@@ -552,9 +562,6 @@ GLOBAL_VAR(bomb_set)
return TRUE
return FALSE
-/obj/item/disk/nuclear/unrestricted/check_disk_loc()
- return TRUE
-
/obj/item/disk/nuclear/Destroy(force)
var/turf/diskturf = get_turf(src)
@@ -565,6 +572,13 @@ GLOBAL_VAR(bomb_set)
STOP_PROCESSING(SSobj, src)
return ..()
+ if(!restricted_to_station) // Non-restricted NADs should be allowed to be deleted, otherwise it becomes a restricted NAD when teleported
+ message_admins("[src] (unrestricted) has been deleted in ([diskturf ? "[diskturf.x], [diskturf.y] ,[diskturf.z] - JMP":"nonexistent location"]). It will not respawn.")
+ log_game("[src] (unrestricted) has been deleted in ([diskturf ? "[diskturf.x], [diskturf.y] ,[diskturf.z]":"nonexistent location"]). It will not respawn.")
+ GLOB.poi_list.Remove(src)
+ STOP_PROCESSING(SSobj, src)
+ return ..()
+
if(length(GLOB.nukedisc_respawn))
GLOB.poi_list.Remove(src)
var/obj/item/disk/nuclear/NEWDISK = new(pick(GLOB.nukedisc_respawn))
diff --git a/code/modules/admin/verbs/deathsquad.dm b/code/modules/admin/verbs/deathsquad.dm
index 51d1e235e92..f7b95b7cf72 100644
--- a/code/modules/admin/verbs/deathsquad.dm
+++ b/code/modules/admin/verbs/deathsquad.dm
@@ -1,7 +1,5 @@
//Deathsquad
-#define MAX_COMMANDOS 14
-
GLOBAL_VAR_INIT(deathsquad_sent, FALSE)
/client/proc/send_deathsquad()
@@ -19,7 +17,7 @@ GLOBAL_VAR_INIT(deathsquad_sent, FALSE)
return
message_admins("[key_name_admin(proccaller)] has started to spawn a DeathSquad.")
log_admin("[key_name_admin(proccaller)] has started to spawn a DeathSquad.")
- to_chat(proccaller, "This 'mode' will go on until everyone is dead or the station is destroyed. You may also admin-call the evac shuttle or use the end round verb when appropriate. Spawned commandos have internals cameras which are viewable through a monitor inside the Spec. Ops. Office. The first one selected/spawned will be the team leader.")
+ to_chat(proccaller, "This 'mode' will go on until everyone is dead or the station is destroyed. You may also admin-call the evac shuttle or use the end round verb when appropriate. Spawned commandos have internals cameras which are viewable through a monitor inside the Spec. Ops. Office. The first one selected will be the team leader.")
var/mission = sanitize(copytext(input(src, "Please specify which mission the Deathsquad shall undertake.", "Specify Mission", "",), 1, MAX_MESSAGE_LEN))
if(!mission)
@@ -28,14 +26,21 @@ GLOBAL_VAR_INIT(deathsquad_sent, FALSE)
log_admin("[key_name(proccaller)] cancelled their Deathsquad.")
return
- var/is_leader = TRUE
- var/commando_number = input(src, "How many Deathsquad Commandos would you like to send? (Recommended is 6, Max is [MAX_COMMANDOS])", "Specify Commandos") as num|null
+ // Locates commandos spawns
+ var/list/commando_spawn_locations = list()
+ for(var/obj/effect/landmark/spawner/ds/L in GLOB.landmarks_list) //Despite obj/effect/landmark/spawner/ds being in the exact same location and doing the exact same thing as obj/effect/landmark/spawner/ert, switching them breaks it?
+ commando_spawn_locations += L
+
+ var/max_commandos = length(commando_spawn_locations)
+
+ var/commando_number = input(src, "How many Deathsquad Commandos would you like to send? (Recommended is 6, Max is [max_commandos])", "Specify Commandos") as num|null
if(!commando_number)
message_admins("[key_name_admin(proccaller)] cancelled their Deathsquad.")
log_admin("[key_name(proccaller)] cancelled their Deathsquad.")
return
- commando_number = clamp(commando_number, 1, MAX_COMMANDOS)
+ commando_number = clamp(commando_number, 1, max_commandos)
+ var/is_leader = TRUE
if(GLOB.deathsquad_sent)
if(alert("A Deathsquad leader has previously been sent with an unrestricted NAD, would you like to spawn another unrestricted NAD?",, "Yes", "No") != "Yes")
is_leader = FALSE
@@ -69,27 +74,21 @@ GLOBAL_VAR_INIT(deathsquad_sent, FALSE)
to_chat(src, "Nobody volunteered to join the DeathSquad.")
return
- // Spawns commandos and equips them.
- for(var/obj/effect/landmark/spawner/ds/L in GLOB.landmarks_list) //Despite obj/effect/landmark/spawner/ds being in the exact same location and doing the exact same thing as obj/effect/landmark/spawner/ert, switching them breaks it?
- if(commando_number == 0)
- break
- if(!length(commando_ghosts))
- break
-
- var/mob/ghost_mob = pick(commando_ghosts)
- commando_ghosts -= ghost_mob
+ // Equips the Deathsquad
+ for(var/mob/ghost_mob in commando_ghosts)
if(!ghost_mob || !ghost_mob.key || !ghost_mob.client)
continue
+ var/my_spawn_loc = pick_n_take(commando_spawn_locations)
+
var/dstype
if(is_leader)
- dstype = input_async(ghost_mob, "Select Deathsquad Type (10 seconds):", list("Organic", "Cyborg"))
- else
to_chat(ghost_mob.client, "You have been chosen to lead the Deathsquad. Please stand by." )
- addtimer(CALLBACK(src, PROC_REF(deathsquad_spawn), ghost_mob, is_leader, dstype, L, nuke_code, mission), 10 SECONDS) // This may fail if the user switches mobs during it, this is because input_async is only for mobs not clients
+ else
+ dstype = input_async(ghost_mob, "Select Deathsquad Type (10 seconds):", list("Organic", "Cyborg"))
+ addtimer(CALLBACK(src, PROC_REF(deathsquad_spawn), ghost_mob, is_leader, dstype, my_spawn_loc, nuke_code, mission), 10 SECONDS) // This may fail if the user switches mobs during it, this is because input_async is only for mobs not clients
is_leader = FALSE
- commando_number--
//Spawns instruction manuals for DS
for(var/obj/effect/landmark/spawner/commando_manual/L in GLOB.landmarks_list)
@@ -113,14 +112,10 @@ GLOBAL_VAR_INIT(deathsquad_sent, FALSE)
if(!new_dstype_input) // didn't receive any response, or didn't ask them in the first place
new_dstype = "Organic"
- var/use_ds_borg = FALSE
- if(new_dstype == "Cyborg")
- use_ds_borg = TRUE
-
if(!ghost_mob || !ghost_mob.key || !ghost_mob.client) // Doublechecking after async request
return
- if(use_ds_borg)
+ if(new_dstype == "Cyborg")
var/mob/living/silicon/robot/deathsquad/R = new(get_turf(L))
var/rnum = rand(1, 1000)
var/borgname = "Epsilon [rnum]"