From 5f58a80d8abbf776175d2bf374137447123873fa Mon Sep 17 00:00:00 2001 From: S34N <12197162+S34NW@users.noreply.github.com> Date: Sat, 25 Jun 2022 00:07:18 +0100 Subject: [PATCH] Let admins allow ERT borgs to choose sec modules (#17874) * Let admins allow secborgs in ERT * dont force them to be secborgs * fixes up some logic * remove this * Update code/modules/tgui/modules/ert_manager.dm * le indent * deconflict * tgui deconflict * Update code/modules/tgui/modules/ert_manager.dm Co-authored-by: Charlie <69320440+hal9000PR@users.noreply.github.com> Co-authored-by: Charlie <69320440+hal9000PR@users.noreply.github.com> --- code/modules/response_team/ert.dm | 6 +++++- code/modules/tgui/modules/ert_manager.dm | 15 ++++++++++++--- tgui/packages/tgui/interfaces/ERTManager.js | 14 ++++++++++++-- tgui/packages/tgui/public/tgui.bundle.js | 2 +- 4 files changed, 30 insertions(+), 7 deletions(-) diff --git a/code/modules/response_team/ert.dm b/code/modules/response_team/ert.dm index d2ee15f0e6d..0842f823c66 100644 --- a/code/modules/response_team/ert.dm +++ b/code/modules/response_team/ert.dm @@ -57,10 +57,11 @@ GLOBAL_VAR_INIT(ert_request_answered, FALSE) return 1 -/proc/trigger_armed_response_team(datum/response_team/response_team_type, commander_slots, security_slots, medical_slots, engineering_slots, janitor_slots, paranormal_slots, cyborg_slots) +/proc/trigger_armed_response_team(datum/response_team/response_team_type, commander_slots, security_slots, medical_slots, engineering_slots, janitor_slots, paranormal_slots, cyborg_slots, cyborg_security) GLOB.response_team_members = list() GLOB.active_team = response_team_type GLOB.active_team.setSlots(commander_slots, security_slots, medical_slots, engineering_slots, janitor_slots, paranormal_slots, cyborg_slots) + GLOB.active_team.cyborg_security_permitted = cyborg_security GLOB.send_emergency_team = TRUE var/list/ert_candidates = shuffle(SSghost_spawns.poll_candidates("Join the Emergency Response Team?",, GLOB.responseteam_age, 60 SECONDS, TRUE, GLOB.role_playtime_requirements[ROLE_ERT])) @@ -136,6 +137,8 @@ GLOBAL_VAR_INIT(ert_request_answered, FALSE) /client/proc/create_response_team(new_gender, role, turf/spawn_location) if(role == "Cyborg") var/mob/living/silicon/robot/ert/R = new GLOB.active_team.borg_path(spawn_location) + if(GLOB.active_team.cyborg_security_permitted) + R.force_modules = list("Security", "Engineering", "Medical") return R var/mob/living/carbon/human/M = new(null) @@ -209,6 +212,7 @@ GLOBAL_VAR_INIT(ert_request_answered, FALSE) var/janitor_outfit var/paranormal_outfit var/borg_path = /mob/living/silicon/robot/ert + var/cyborg_security_permitted = FALSE /datum/response_team/proc/setSlots(com=1, sec=4, med=0, eng=0, jan=0, par=0, cyb=0) slots["Commander"] = com diff --git a/code/modules/tgui/modules/ert_manager.dm b/code/modules/tgui/modules/ert_manager.dm index a39b6239035..cf64e76ac90 100644 --- a/code/modules/tgui/modules/ert_manager.dm +++ b/code/modules/tgui/modules/ert_manager.dm @@ -8,11 +8,13 @@ var/janitor_slots = 0 var/paranormal_slots = 0 var/cyborg_slots = 0 + /// The below is a toggle for if sec cyborgs are enabled or not + var/cyborg_security = FALSE /datum/ui_module/ert_manager/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, datum/tgui/master_ui = null, datum/ui_state/state = GLOB.admin_state) ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open) if(!ui) - ui = new(user, src, ui_key, "ERTManager", name, 350, 430, master_ui, state) + ui = new(user, src, ui_key, "ERTManager", name, 350, 470, master_ui, state) ui.autoupdate = TRUE ui.open() @@ -36,6 +38,7 @@ data["jan"] = janitor_slots data["par"] = paranormal_slots data["cyb"] = cyborg_slots + data["secborg"] = cyborg_security data["total"] = commander_slots + security_slots + medical_slots + engineering_slots + janitor_slots + paranormal_slots + cyborg_slots data["spawnpoints"] = GLOB.emergencyresponseteamspawn.len return data @@ -47,6 +50,8 @@ switch(action) if("ert_type") ert_type = params["ert_type"] + if(ert_type != "Red") + cyborg_security = FALSE if("toggle_com") commander_slots = commander_slots ? 0 : 1 if("set_sec") @@ -61,6 +66,10 @@ paranormal_slots = text2num(params["set_par"]) if("set_cyb") cyborg_slots = text2num(params["set_cyb"]) + if(!cyborg_slots) + cyborg_security = FALSE + if("toggle_secborg") + cyborg_security = !cyborg_security if("dispatch_ert") var/datum/response_team/D switch(ert_type) @@ -90,10 +99,10 @@ if(cyborg_slots > 0) slots_list += "cyborg: [cyborg_slots]" var/slot_text = english_list(slots_list) - notify_ghosts("An ERT is being dispatched. Open positions: [slot_text]") + notify_ghosts("An ERT is being dispatched. Type: [ert_type]. Open positions: [slot_text]") message_admins("[key_name_admin(usr)] dispatched a [ert_type] ERT. Slots: [slot_text]", 1) log_admin("[key_name(usr)] dispatched a [ert_type] ERT. Slots: [slot_text]") GLOB.event_announcement.Announce("Attention, [station_name()]. We are attempting to assemble an ERT. Standby.", "ERT Protocol Activated") - trigger_armed_response_team(D, commander_slots, security_slots, medical_slots, engineering_slots, janitor_slots, paranormal_slots, cyborg_slots) + trigger_armed_response_team(D, commander_slots, security_slots, medical_slots, engineering_slots, janitor_slots, paranormal_slots, cyborg_slots, cyborg_security) else return FALSE diff --git a/tgui/packages/tgui/interfaces/ERTManager.js b/tgui/packages/tgui/interfaces/ERTManager.js index 16ba0f62fa6..72be21bde59 100644 --- a/tgui/packages/tgui/interfaces/ERTManager.js +++ b/tgui/packages/tgui/interfaces/ERTManager.js @@ -39,8 +39,9 @@ export const ERTManager = (props, context) => {