Files
Paradise/code/modules/admin/verbs/deathsquad.dm
Contrabang b2bdb80ec5 Refactors Deathsquad, adds more customization to their spawning (#18135)
* a new coat of paint

* no shooting teammates on spawn for 100 damage

* datumization part 1, makes DS more OP, spacing fix

* hnng still broken but better

* breaks stuff less 99%

* mostly tgui

* oops, removes left over things from testing

* seperate tgui

* undo changes to ERT file and ERT manager

* build TGUI, front end is working

* minor fix, still broken

* this hurts me

* few small changes

* please dont fail

* mind code runs, but it doesnt work

* logging good, tgui built, will finish later

* mind code hurts, tgui should deconflict

* part one of giving up on TGUI

* 3 days of debugging, 2 lines of errors fixed

* no more unneccessary spawners

* Revert "no more unneccessary spawners"

* wow it works

* tgui, deconflict please

* a little clean up

* little more cleanup

* Sirryan addressed pt1

* Oops should commit this before the next commit

* DS isnt an option in one click antag, nuke it

* oops forgot this one small bit

* wow, simple code works

* oops, forgot to address, doesnt fix headset

* ds headset was broken long ago

* removes testing implants

* addresses requests

* get addressed code, you will be good

* few code improvements

* address moxian

* Makes deathsquad naming consistent

* this comment is true again

* a little precaution to stop AFKs

* no nuke code? no problem

* bing bam boom, more addressing

* no more runtimes I think

* clarified a few things

* gloves now show again following #18190

* Update code/game/objects/items/weapons/explosives.dm

Co-authored-by: Charlie <69320440+hal9000PR@users.noreply.github.com>

* okay I'm a bit stupid

* deathsquad jumpsuit desc update

* CI my beloved, have a fix

* deathsquad gets their proper icon

* Revert "deathsquad gets their proper icon"

This reverts commit a52519305b.

Co-authored-by: Charlie <69320440+hal9000PR@users.noreply.github.com>
2022-07-09 15:25:35 +01:00

208 lines
12 KiB
Plaintext

//Deathsquad
#define MAX_COMMANDOS 14
GLOBAL_VAR_INIT(deathsquad_sent, FALSE)
/client/proc/send_deathsquad()
var/client/proccaller = usr.client
if(!check_rights(R_EVENT))
return
if(SSticker.current_state == GAME_STATE_PREGAME)
to_chat(usr, "<span class='warning'>The round hasn't started yet!</span>")
return
if(GLOB.deathsquad_sent)
if(alert("A Deathsquad is already being sent, are you sure you want to send another?",, "Yes", "No") != "Yes")
return
else
if(alert("Do you want to send in the Deathsquad? Once enabled, this is irreversible.",, "Yes", "No") != "Yes")
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>")
var/mission = sanitize(copytext(input(src, "Please specify which mission the Deathsquad shall undertake.", "Specify Mission", "",), 1, MAX_MESSAGE_LEN))
if(!mission)
if(alert("Error, no mission set. Do you want to exit the setup process?",, "Yes", "No") == "Yes")
message_admins("[key_name_admin(proccaller)] cancelled their Deathsquad.")
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
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)
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
GLOB.deathsquad_sent = TRUE
message_admins("[key_name_admin(proccaller)] has sent a Deathsquad with [commando_number] commandos.")
log_admin("[key_name(proccaller)] has sent a Deathsquad with [commando_number] commandos.")
// Find the nuclear auth code
var/nuke_code
for(var/obj/machinery/nuclearbomb/N in GLOB.machines)
var/temp_code = text2num(N.r_code)
if(temp_code)//if it's actually a number. It won't convert any non-numericals.
nuke_code = N.r_code
break
if(!nuke_code)
message_admins("No nuclear warheads have been detected, the Deathsquad will not be provided detonation codes.")
// Find ghosts willing to be Deathsquad
var/list/commando_ghosts = list()
if(alert("Would you like to custom pick your Deathsquad?",, "Yes", "No") == "Yes")
var/image/source = image('icons/obj/cardboard_cutout.dmi', "cutout_deathsquad")
commando_ghosts = pollCandidatesWithVeto(src, usr, commando_number, "Join the DeathSquad?",, 21, 60 SECONDS, TRUE, GLOB.role_playtime_requirements[ROLE_DEATHSQUAD], TRUE, FALSE, source = source)
else
var/image/source = image('icons/obj/cardboard_cutout.dmi', "cutout_deathsquad")
commando_ghosts = SSghost_spawns.poll_candidates("Join the Deathsquad?",, GLOB.responseteam_age, 60 SECONDS, TRUE, GLOB.role_playtime_requirements[ROLE_DEATHSQUAD], TRUE, FALSE, source = source)
if(length(commando_ghosts) > commando_number)
commando_ghosts.Cut(commando_number + 1) //cuts the ghost candidates down to the amount requested
if(!length(commando_ghosts))
message_admins("[key_name_admin(proccaller)]'s Deathsquad had no volunteers and was cancelled.")
log_admin("[key_name(proccaller)]'s Deathsquad had no volunteers and was cancelled.")
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
if(!ghost_mob || !ghost_mob.key || !ghost_mob.client)
continue
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/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
is_leader = FALSE
commando_number--
//Spawns instruction manuals for DS
for(var/obj/effect/landmark/spawner/commando_manual/L in GLOB.landmarks_list)
var/obj/item/paper/P = new(L.loc)
P.info = "<p><b>Good morning soldier!</b>. This compact guide will familiarize you with standard operating procedure. There are three basic rules to follow:<br>#1 Work as a team.<br>#2 Accomplish your objective at all costs.<br>#3 Leave no witnesses.<br><br> Your mission objective will be relayed to you by Central Command through your headsets or in person.<br>If deemed appropriate, Central Command will also allow members of your team to use mechs for the mission. You will find the mech storage due East of your position. </p><p>In the event that the team does not accomplish their assigned objective in a timely manner, or finds no other way to do so, attached below are instructions on how to operate a Nanotrasen Nuclear Device. Your operations <b>LEADER</b> is provided with a nuclear authentication disk, and all commandos have pinpointer for locating it. You may easily recognize them by their rank: <b>Lieutenant, Captain, or Major</b>. The nuclear device itself will be present somewhere on your destination.<hr></p><p>Hello and thank you for choosing Nanotrasen for your nuclear information needs. Today's crash course will deal with the operation of a Fission Class Nanotrasen made Nuclear Device.<br>First and foremost, <b>DO NOT TOUCH ANYTHING UNTIL THE BOMB IS IN PLACE.</b> Pressing any button on the compacted bomb will cause it to extend and bolt itself into place. If this is done to unbolt it one must completely log in which at this time may not be possible.<br>To make the device functional:<br>#1 Place bomb in designated detonation zone<br> #2 Extend and anchor bomb (attack with hand).<br>#3 Insert Nuclear Auth. Disk into slot.<br>#4 Enter the nuclear authorization code: ([nuke_code]).<br>#5 Enter your desired time until activation.<br>#6 Disable the Safety.<br>#6 Arm the device.<br>You now have activated the device and it will begin counting down to detonation. Remove the Nuclear Authorization Disk and either head back to your shuttle or stay around until the Nuclear Device detonates, depending on your orders from Central Command.</p><p>The nuclear authorization code is: <b>[nuke_code ? nuke_code : "None provided"]</b></p><p><b>Good luck, soldier!</b></p>"
P.name = "Special Operations Manual"
P.update_icon()
var/obj/item/stamp/centcom/stamp = new
P.stamp(stamp)
qdel(stamp)
message_admins("<span class='notice'>[key_name_admin(proccaller)] has spawned a DeathSquad.</span>")
log_admin("[key_name(proccaller)] used Spawn Death Squad.")
return TRUE
/client/proc/deathsquad_spawn(mob/ghost_mob, is_leader = FALSE, datum/async_input/new_dstype_input, obj/L, nuke_code, mission)
var/new_dstype
if(new_dstype_input)
new_dstype_input.close()
new_dstype = new_dstype_input.result
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)
var/mob/living/silicon/robot/deathsquad/R = new(get_turf(L))
var/rnum = rand(1, 1000)
var/borgname = "Epsilon [rnum]"
R.name = borgname
R.custom_name = borgname
R.real_name = R.name
R.mind = new
R.mind.current = R
R.mind.set_original_mob(R)
R.mind.assigned_role = SPECIAL_ROLE_DEATHSQUAD
R.mind.special_role = SPECIAL_ROLE_DEATHSQUAD
R.mind.offstation_role = TRUE
if(!(R.mind in SSticker.minds))
SSticker.minds += R.mind
SSticker.mode.traitors += R.mind
R.key = ghost_mob.key
if(nuke_code)
R.mind.store_memory("<b>Nuke Code:</b> <span class='warning'>[nuke_code].</span>")
R.mind.store_memory("<b>Mission:</b> <span class='warning'>[mission].</span>")
to_chat(R, "<span class='userdanger'>You are a Deathsquad cyborg, in the service of Central Command. \nYour current mission is: <span class='danger'>[mission]</span></span>")
else
var/mob/living/carbon/human/new_commando = create_deathsquad_commando(L, is_leader)
new_commando.mind.key = ghost_mob.key
new_commando.key = ghost_mob.key
new_commando.update_action_buttons_icon()
if(nuke_code)
new_commando.mind.store_memory("<b>Nuke Code:</b> <span class='warning'>[nuke_code].</span>")
new_commando.mind.store_memory("<b>Mission:</b> <span class='warning'>[mission].</span>")
to_chat(new_commando, "<span class='userdanger'>You are a Deathsquad [is_leader ? "<b>TEAM LEADER</b>" : "commando"] in the service of Central Command. Check the table ahead for detailed instructions.\nYour current mission is: <span class='danger'>[mission]</span></span>")
/client/proc/create_deathsquad_commando(obj/spawn_location, is_leader = FALSE)
var/mob/living/carbon/human/new_commando = new(spawn_location.loc)
var/commando_leader_rank = pick("Lieutenant", "Captain", "Major")
var/commando_name = pick(GLOB.deathsquad_names)
var/obj/item/organ/external/head/head_organ = new_commando.get_organ("head") // This appearance code is brought to you by ert.dm, basically the same code. If you change something here change somethere there too.
if(is_leader)
new_commando.age = rand(35, 45)
new_commando.real_name = "[commando_leader_rank] [commando_name]"
else
new_commando.real_name = "[commando_name]"
if(prob(50))
new_commando.change_gender(MALE)
else
new_commando.change_gender(FEMALE)
// All of this code down here too is also from ert.dm, I'm lazy don't blame me
new_commando.set_species(/datum/species/human, TRUE)
new_commando.dna.ready_dna(new_commando)
new_commando.cleanSE() //No fat/blind/colourblind/epileptic/whatever Deathsquad.
new_commando.overeatduration = 0
var/hair_c = pick("#8B4513","#000000","#FF4500","#FFD700") // Brown, black, red, blonde
var/eye_c = pick("#000000","#8B4513","1E90FF") // Black, brown, blue
var/skin_tone = rand(-120, 20) // A range of skin colors (This doesn't work, result is always pale white)
head_organ.facial_colour = hair_c
head_organ.sec_facial_colour = hair_c
head_organ.hair_colour = hair_c
head_organ.sec_hair_colour = hair_c
new_commando.change_eye_color(eye_c)
new_commando.s_tone = skin_tone
head_organ.h_style = random_hair_style(new_commando.gender, head_organ.dna.species.name)
head_organ.f_style = random_facial_hair_style(new_commando.gender, head_organ.dna.species.name)
new_commando.regenerate_icons()
new_commando.update_body()
new_commando.update_dna()
//Creates mind stuff.
new_commando.mind_initialize()
new_commando.mind.assigned_role = SPECIAL_ROLE_DEATHSQUAD
new_commando.mind.special_role = SPECIAL_ROLE_DEATHSQUAD
new_commando.mind.offstation_role = TRUE
SSticker.mode.traitors |= new_commando.mind //Adds them to current traitor list. Which is really the extra antagonist list.
new_commando.equip_deathsquad_commando(is_leader)
return new_commando
/mob/living/carbon/human/proc/equip_deathsquad_commando(is_leader = FALSE)
if(is_leader)
equipOutfit(/datum/outfit/admin/deathsquad_commando/leader)
else
equipOutfit(/datum/outfit/admin/deathsquad_commando)