Fixes some issues with Deathsquad spawning (#19868)

* fix the ds

* woo NAD changes

* Remove debugging

* s43n review
This commit is contained in:
Contrabang
2022-12-24 10:56:32 -05:00
committed by GitHub
parent 758a15010d
commit 34f37bcf93
2 changed files with 37 additions and 28 deletions
+18 -4
View File
@@ -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] - <A HREF='?_src_=holder;adminplayerobservecoodjump=1;X=[diskturf.x];Y=[diskturf.y];Z=[diskturf.z]'>JMP</a>":"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))
+19 -24
View File
@@ -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("<span class='notice'>[key_name_admin(proccaller)] has started to spawn a DeathSquad.</span>")
log_admin("[key_name_admin(proccaller)] has started to spawn a DeathSquad.")
to_chat(proccaller, "<span class='boldwarning'>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.</span>")
to_chat(proccaller, "<span class='boldwarning'>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.</span>")
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, "<span class='userdanger'>Nobody volunteered to join the DeathSquad.</span>")
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, "<span class='boldwarning'>You have been chosen to lead the Deathsquad. Please stand by.</span>" )
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]"