Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handheld Beacon Refactor #4676

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 31 additions & 46 deletions code/game/objects/items/handheld_distress_beacon.dm
Original file line number Diff line number Diff line change
@@ -1,12 +1,21 @@

///handheld distress beacons used by goon chem retrieval team to call for PMC back up
/obj/item/handheld_distress_beacon
name = "handheld distress beacon"
name = "\improper PMC handheld distress beacon"
desc = "A standard handheld distress beacon. Generally used by teams who may be out of regular communications range but must signal for assistance. This one is branded with a Weyland Yutani symbol and sold en masse to colonies across the Neroid Sector."
icon = 'icons/obj/items/handheld_distress_beacon.dmi'
icon_state = "beacon_inactive"
w_class = SIZE_SMALL

///The beacons faction that will be sent in message_admins
var/beacon_type = "PMC beacon"
///Tells the user who the beacon will be sent to IC
var/recipient = "the USCSS Royce"
///The name of the ERT that will be passed to get_specific_call
var/list/ert_full_name = list("Weyland-Yutani PMC (Chemical Investigation Squad)")
///The clickable version that will be sent in message_admins
var/list/ert_short_name = list("SEND PMCs")
///Whether beacon can be used, or has already been used
var/active = FALSE

/obj/item/handheld_distress_beacon/get_examine_text(mob/user)
Expand All @@ -20,62 +29,38 @@

if(active)
icon_state = "beacon_active"
else
icon_state = initial(icon_state)
return
icon_state = initial(icon_state)

/obj/item/handheld_distress_beacon/attack_self(mob/user)
. = ..()

if(active)
to_chat(user, "[src] is already active!")
return

for(var/client/C in GLOB.admins)
if((R_ADMIN|R_MOD) & C.admin_holder.rights)
playsound_client(C,'sound/effects/sos-morse-code.ogg',10)
message_admins("[key_name(user)] has requested a PMC Distress Beacon! [CC_MARK(user)] (<A HREF='?_src_=admin_holder;[HrefToken(forceGlobal = TRUE)];distress_pmc=\ref[user]'>SEND</A>) (<A HREF='?_src_=admin_holder;[HrefToken(forceGlobal = TRUE)];ccdeny_pmc=\ref[user]'>DENY</A>) [ADMIN_JMP_USER(user)] [CC_REPLY(user)]")
to_chat(user, SPAN_NOTICE("A distress beacon request has been sent to the USCSS Royce."))

active = TRUE
update_icon()

/// CMB distress beacon held by CMB Marshal for signalling distress to Anchorpoint Station
/obj/item/handheld_distress_beacon_CMB
name = "\improper CMB handheld distress beacon"
desc = "An emergency beacon. This one is branded with a Colonial Marshal Bureau star and 'ANCHORPOINT STATION' is etched in stencil on the side. This device is issued to CMB Marshals and features an extended relay antenna."
icon = 'icons/obj/items/handheld_distress_beacon.dmi'
icon_state = "beacon_inactive"
w_class = SIZE_SMALL

/// whether or not the beacon is turned on, when activated sends message to admins requesting Anchorpoint ERT and changes sprite
var/active = FALSE

/obj/item/handheld_distress_beacon_CMB/get_examine_text(mob/user)
. = ..()

if(active)
. += "The beacon has been activated!"

/obj/item/handheld_distress_beacon_CMB/update_icon()
. = ..()
if(!ert_full_name || !ert_short_name || (length(ert_full_name) != length(ert_short_name))) //Make sure they are greater than 0, and both are same length
to_chat(user, SPAN_BOLDWARNING("[src] is broken!"))
CRASH("[src] was improperly set, and has been disabled.") //For the runtime logs

if(active)
icon_state = "beacon_active"
else
icon_state = initial(icon_state)
var/beacon_call_buttons
for(var/current_ert_num in 1 to length(ert_full_name))
beacon_call_buttons += "(<A HREF='?_src_=admin_holder;[HrefToken(forceGlobal = TRUE)];distress_handheld=\ref[user];ert_name=[ert_full_name[current_ert_num]]'>[ert_short_name[current_ert_num]]</A>) "

/obj/item/handheld_distress_beacon_CMB/attack_self(mob/user)
. = ..()
for(var/client/admin_client in GLOB.admins)
if((R_ADMIN|R_MOD) & admin_client.admin_holder.rights)
playsound_client(admin_client,'sound/effects/sos-morse-code.ogg',10)
message_admins("[key_name(user)] has used a [beacon_type]! [CC_MARK(user)] [beacon_call_buttons](<A HREF='?_src_=admin_holder;[HrefToken(forceGlobal = TRUE)];deny_distress_handheld=\ref[user]'>DENY</A>) [ADMIN_JMP_USER(user)] [CC_REPLY(user)]")
to_chat(user, SPAN_NOTICE("A distress beacon request has been sent to [recipient]."))

if(active)
to_chat(user, "[src] is already active!")
return

for(var/client/client in GLOB.admins)
if((R_ADMIN|R_MOD) & client.admin_holder.rights)
playsound_client(client,'sound/effects/sos-morse-code.ogg',10)
message_admins("[key_name(user)] has signalled CMB in distress, and requests reinforcements! [CC_MARK(user)] (<A HREF='?_src_=admin_holder;[HrefToken(forceGlobal = TRUE)];distress_cmb=\ref[user]'>SEND MARINE QRF</A>) (<A HREF='?_src_=admin_holder;[HrefToken(forceGlobal = TRUE)];distress_cmb_alt=\ref[user]'>SEND CMB TEAM</A>) (<A HREF='?_src_=admin_holder;[HrefToken(forceGlobal = TRUE)];deny_cmb=\ref[user]'>DENY</A>) [ADMIN_JMP_USER(user)] [CC_REPLY(user)]")
to_chat(user, SPAN_NOTICE("The CMB distress beacon flashes red, indicating that the device has been activated and is transmitting."))
/// CMB distress beacon held by CMB Marshal for signalling distress to Anchorpoint Station
/obj/item/handheld_distress_beacon/cmb
name = "\improper CMB handheld distress beacon"
desc = "An emergency beacon. This one is branded with a Colonial Marshal Bureau star and 'ANCHORPOINT STATION' is etched in stencil on the side. This device is issued to CMB Marshals and features an extended relay antenna."

active = TRUE
update_icon()
beacon_type = "CMB beacon"
recipient = "Anchorpoint Station"
ert_full_name = list("CMB - Patrol Team - Marshals in Distress (Friendly)", "CMB - Anchorpoint Station Colonial Marine QRF (Friendly)")
ert_short_name = list("SEND CMB", "SEND QRF")
57 changes: 13 additions & 44 deletions code/modules/admin/topic/topic.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1904,32 +1904,18 @@
addtimer(CALLBACK(src, PROC_REF(accept_ert), usr, locate(href_list["distress"])), 10 SECONDS)
//unanswered_distress -= ref_person

if(href_list["distress_cmb"]) //CMB distress signal, activates Anchorpoint Marine QRF to assist/rescue Colonial Marshals in distress
if(href_list["distress_handheld"]) //Prepares to call and logs accepted handheld distress beacons
var/mob/ref_person = href_list["distress_handheld"]
var/ert_name = href_list["ert_name"]
distress_cancel = FALSE
message_admins("[key_name_admin(usr)] has opted to SEND the Anchorpoint Station Colonial Marine QRF to assist the CMB! Launching in 10 seconds... (<A HREF='?_src_=admin_holder;[HrefToken(forceGlobal = TRUE)];distresscancel=\ref[usr]'>CANCEL</A>)")
addtimer(CALLBACK(src, PROC_REF(accept_cmb_ert), usr, locate(href_list["distress"])), 10 SECONDS)
message_admins("[key_name_admin(usr)] has opted to SEND [ert_name]! Launching in 10 seconds... (<A HREF='?_src_=admin_holder;[HrefToken(forceGlobal = TRUE)];distresscancel=\ref[usr]'>CANCEL</A>)")
addtimer(CALLBACK(src, PROC_REF(accept_handheld_ert), usr, ref_person, ert_name), 10 SECONDS)

if(href_list["distress_cmb_alt"]) //CMB distress signal, activates a nearby CMB Patrol Team to assist/rescue Colonial Marshals in distress
distress_cancel = FALSE
message_admins("[key_name_admin(usr)] has opted to SEND a nearby CMB Patrol Team to assist the CMB! Launching in 10 seconds... (<A HREF='?_src_=admin_holder;[HrefToken(forceGlobal = TRUE)];distresscancel=\ref[usr]'>CANCEL</A>)")
addtimer(CALLBACK(src, PROC_REF(accept_cmb_alt_ert), usr, locate(href_list["distress"])), 10 SECONDS)

if(href_list["deny_cmb"]) // Anchorpoint-deny. The distress call is denied, citing unavailable forces
var/mob/ref_person = locate(href_list["deny_cmb"])
to_chat(ref_person, "A voice barely crackles through the static: CMB Team, this is Anchorpoint Station. No can do, QRF currently dispatched elsewhere, relaying distress. Sorry. Good luck, out.")
log_game("[key_name_admin(usr)] has denied a distress beacon, requested by [key_name_admin(ref_person)]")
message_admins("[key_name_admin(usr)] has denied a distress beacon, requested by [key_name_admin(ref_person)]", 1)

if(href_list["distress_pmc"]) //Wey-Yu specific PMC distress signal for chem retrieval ERT
distress_cancel = FALSE
message_admins("[key_name_admin(usr)] has opted to SEND the distress beacon! Launching in 10 seconds... (<A HREF='?_src_=admin_holder;[HrefToken(forceGlobal = TRUE)];distresscancel=\ref[usr]'>CANCEL</A>)")
addtimer(CALLBACK(src, PROC_REF(accept_pmc_ert), usr, locate(href_list["distress"])), 10 SECONDS)

if(href_list["ccdeny_pmc"]) // CentComm-deny. The distress call is denied, without any further conditions
var/mob/ref_person = locate(href_list["ccdeny_pmc"])
if(href_list["deny_distress_handheld"]) //Logs denied handheld distress beacons
var/mob/ref_person = href_list["deny_distress_handheld"]
to_chat(ref_person, "The distress signal has not received a response.")
log_game("[key_name_admin(usr)] has denied a distress beacon, requested by [key_name_admin(ref_person)]")
message_admins("[key_name_admin(usr)] has denied a distress beacon, requested by [key_name_admin(ref_person)]", 1)
message_admins("[key_name_admin(usr)] has denied a distress beacon, requested by [key_name_admin(ref_person)]")

if(href_list["destroyship"]) //Distress Beacon, sends a random distress beacon when pressed
destroy_cancel = FALSE
Expand Down Expand Up @@ -2108,31 +2094,14 @@
log_game("[key_name_admin(approver)] has sent a randomized distress beacon, requested by [key_name_admin(ref_person)]")
message_admins("[key_name_admin(approver)] has sent a randomized distress beacon, requested by [key_name_admin(ref_person)]")

/// tells admins which admin has sent the Anchorpoint ERT in response to CMB distress
/datum/admins/proc/accept_cmb_ert(mob/approver, mob/ref_person)
if(distress_cancel)
return
distress_cancel = TRUE
SSticker.mode.get_specific_call("CMB - Anchorpoint Station Colonial Marine QRF (Friendly)", FALSE, FALSE)
log_game("[key_name_admin(approver)] has sent an Anchorpoint Station Colonial Marine QRF response, requested by [key_name_admin(ref_person)]")
message_admins("[key_name_admin(approver)] has sent an Anchorpoint Station Colonial Marine QRF response, requested by [key_name_admin(ref_person)]")

/// tells admins which admin has sent the CMB ERT in response to CMB distress
/datum/admins/proc/accept_cmb_alt_ert(mob/approver, mob/ref_person)
if(distress_cancel)
return
distress_cancel = TRUE
SSticker.mode.get_specific_call("CMB - Patrol Team - Marshals in Distress (Friendly)", FALSE, FALSE)
log_game("[key_name_admin(approver)] has sent a CMB Patrol Team distress response, requested by [key_name_admin(ref_person)]")
message_admins("[key_name_admin(approver)] has sent a CMB Patrol Team distress response, requested by [key_name_admin(ref_person)]")

/datum/admins/proc/accept_pmc_ert(mob/approver, mob/ref_person)
///Handles calling the ERT sent by handheld distress beacons
/datum/admins/proc/accept_handheld_ert(mob/approver, mob/ref_person, ert_called)
if(distress_cancel)
return
distress_cancel = TRUE
SSticker.mode.get_specific_call("Weyland-Yutani PMC (Chemical Investigation Squad)", TRUE, FALSE, FALSE)
log_game("[key_name_admin(approver)] has sent a PMC distress beacon, requested by [key_name_admin(ref_person)]")
message_admins("[key_name_admin(approver)] has sent a PMC distress beacon, requested by [key_name_admin(ref_person)]")
SSticker.mode.get_specific_call("[ert_called]", TRUE, FALSE, FALSE)
log_game("[key_name_admin(approver)] has sent [ert_called], requested by [key_name_admin(ref_person)]")
message_admins("[key_name_admin(approver)] has sent [ert_called], requested by [key_name_admin(ref_person)]")

/datum/admins/proc/generate_job_ban_list(mob/M, datum/entity/player/P, list/roles, department, color = "ccccff")
var/counter = 0
Expand Down
2 changes: 1 addition & 1 deletion code/modules/gear_presets/cmb.dm
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@
new_human.equip_to_slot_or_del(new /obj/item/storage/backpack/satchel/sec, WEAR_BACK)
new_human.equip_to_slot_or_del(new /obj/item/weapon/gun/pistol/holdout, WEAR_IN_BACK)
new_human.equip_to_slot_or_del(new /obj/item/explosive/grenade/high_explosive/m15/rubber, WEAR_IN_BACK)
new_human.equip_to_slot_or_del(new /obj/item/handheld_distress_beacon_CMB, WEAR_IN_BACK)
new_human.equip_to_slot_or_del(new /obj/item/handheld_distress_beacon/cmb, WEAR_IN_BACK)
new_human.equip_to_slot_or_del(new /obj/item/device/radio, WEAR_IN_BACK)
new_human.equip_to_slot_or_del(new /obj/item/device/flashlight, WEAR_IN_BACK)
new_human.equip_to_slot_or_del(new /obj/item/device/camera, WEAR_IN_BACK)
Expand Down