From ae767daec71de51603ce838797a4309806e6d017 Mon Sep 17 00:00:00 2001 From: CHOMPStation2 <58959929+CHOMPStation2@users.noreply.github.com> Date: Sun, 11 Aug 2024 18:30:36 -0700 Subject: [PATCH] [MIRROR] Emergency Beacon Update (#8762) Co-authored-by: Killian <49700375+KillianKirilenko@users.noreply.github.com> Co-authored-by: Nadyr <41974248+Darlantanis@users.noreply.github.com> --- code/__defines/is_helpers.dm | 2 + code/game/objects/items/devices/e_beacon.dm | 63 ++++++++++++++----- .../crates_lockers/closets/misc_vr.dm | 7 ++- 3 files changed, 54 insertions(+), 18 deletions(-) diff --git a/code/__defines/is_helpers.dm b/code/__defines/is_helpers.dm index f8a0f19ad1..0728b10a62 100644 --- a/code/__defines/is_helpers.dm +++ b/code/__defines/is_helpers.dm @@ -63,6 +63,8 @@ //#define isturf(D) istype(D, /turf) //Built in #define isopenspace(A) istype(A, /turf/simulated/open) #define isspace(A) istype(A, /turf/space) +#define isopenturf(A) istype(A, /turf/simulated/open) || istype(A, /turf/space) +#define isnonsolidturf(A) istype(A, /turf/simulated/open) || istype(A, /turf/space) || istype(A, /turf/simulated/floor/water) || istype(A, /turf/simulated/floor/lava) #define ismineralturf(A) istype(A, /turf/simulated/mineral) #define istaurtail(A) istype(A, /datum/sprite_accessory/tail/taur) diff --git a/code/game/objects/items/devices/e_beacon.dm b/code/game/objects/items/devices/e_beacon.dm index 7db165554f..656835f376 100644 --- a/code/game/objects/items/devices/e_beacon.dm +++ b/code/game/objects/items/devices/e_beacon.dm @@ -5,25 +5,56 @@ icon_state = "e_beacon_off" var/beacon_active = FALSE var/list/levels_for_distress + var/obj/item/device/gps/gps = null + +/obj/item/device/emergency_beacon/New() + gps = new/obj/item/device/gps/emergency_beacon(src) + +/obj/item/device/gps/emergency_beacon + gps_tag = "EMERGENCY BEACON" /obj/item/device/emergency_beacon/attack_self(mob/user) + var/T = user.loc if(!beacon_active) - var/answer = tgui_alert(user, "Would you like to activate this personal emergency beacon?","\The [src]", list("Yes", "No")) - if(answer == "No") + if(!isturf(T)) + to_chat(user,"You cannot activate the beacon when you are not on a turf!") return - else if(do_after(user, (5 SECONDS))) //short delay, so they can still abort if they want to - user.visible_message("[user] activates \the [src]!","You activate \the [src]!") - beacon_active = TRUE - icon_state = "e_beacon_active" - admin_chat_message(message = "'[user?.ckey || "Unknown"]' activated a personal emergency beacon", color = "#FF2222") //VOREStation Add - var/message = "This is an automated distress signal from a MIL-DTL-93352-compliant personal emergency beacon transmitting on [PUB_FREQ*0.1]kHz. \ - This beacon was activated in '\the [get_area(src)]' at X[src.loc.x],Y[src.loc.y]. Due to the limited signal strength, no further information can be provided at this time. \ - Per the Interplanetary Convention on Space SAR, those receiving this message must attempt rescue, \ - or relay the message to those who can." + else if(isnonsolidturf(T)) + to_chat(user,"You cannot activate the beacon when you are not on sufficiently solid ground!") + return + else + var/answer = tgui_alert(user, "Would you like to activate this personal emergency beacon?","\The [src]", list("Yes", "No")) + if(answer == "No") + return + else if(do_after(user, (3 SECONDS))) //short delay, so they can still abort if they want to + user.visible_message("[user] activates \the [src]!","You activate \the [src], spiking it into the ground!") + beacon_active = TRUE + icon_state = "e_beacon_active" + user.drop_item() + anchored = TRUE + gps.tracking = TRUE + admin_chat_message(message = "'[user?.ckey || "Unknown"]' activated a personal emergency beacon", color = "#FF2222") + var/message = "This is an automated distress signal from a MIL-DTL-93352-compliant personal emergency beacon transmitting on [PUB_FREQ*0.1]kHz. \ + This beacon was activated in '\the [get_area(src)]' at X[src.loc.x], Y[src.loc.y]. Due to the limited signal strength, no further information can be provided at this time. \ + Per the Interplanetary Convention on Space SAR, those receiving this message must attempt rescue, \ + or relay the message to those who can." - if(!levels_for_distress) - levels_for_distress = list(1) - for(var/zlevel in levels_for_distress) - priority_announcement.Announce(message, new_title = "Automated Personal Distress Signal", new_sound = 'sound/AI/sos.ogg', zlevel = zlevel) + if(!levels_for_distress) + levels_for_distress = list(1) + for(var/zlevel in levels_for_distress) + priority_announcement.Announce(message, new_title = "Automated Personal Distress Signal", new_sound = 'sound/AI/sos.ogg', zlevel = zlevel) else - to_chat(user,"\The [src] is already active, or is otherwise malfunctioning. There's nothing you can do but wait. And possibly pray.") \ No newline at end of file + to_chat(user,"\The [src] is already active, or is otherwise malfunctioning. There's nothing you can do but wait. And possibly pray.") + +/obj/item/device/emergency_beacon/attack_hand(mob/user) + if(beacon_active) + to_chat(user,"The beacon is already active and cannot be moved!") + return + + . = ..() + +/obj/item/device/emergency_beacon/attackby(obj/item/weapon/W, mob/user) + if(W.is_wrench() && beacon_active) + gps.tracking = FALSE + user.visible_message("[user] disassembles \the [src].") + qdel(src) diff --git a/code/game/objects/structures/crates_lockers/closets/misc_vr.dm b/code/game/objects/structures/crates_lockers/closets/misc_vr.dm index c48760a933..a2386cd3c5 100644 --- a/code/game/objects/structures/crates_lockers/closets/misc_vr.dm +++ b/code/game/objects/structures/crates_lockers/closets/misc_vr.dm @@ -199,7 +199,7 @@ /obj/item/weapon/material/knife/tacknife/survival, /obj/item/weapon/gun/energy/locked/frontier/holdout, //CHOMP explo keep /obj/item/clothing/head/pilot_vr, - /obj/item/clothing/under/rank/pilot1, + /obj/item/clothing/under/rank/pilot1/no_webbing, /obj/item/clothing/suit/storage/toggle/bomber/pilot, /obj/item/clothing/shoes/boots/winter/explorer, /obj/item/clothing/mask/gas/half, @@ -217,7 +217,10 @@ /obj/item/device/gps/explorer, /obj/item/device/cataloguer/compact, //CHOMP edit // /obj/item/weapon/gun/energy/gun/protector/pilotgun/locked, //CHOMP Removed - /obj/item/clothing/gloves/watch/survival + /obj/item/clothing/gloves/watch/survival, + /obj/item/clothing/accessory/storage/webbing/pilot1, + /obj/item/clothing/accessory/storage/webbing/pilot2, + /obj/item/device/emergency_beacon ) /obj/structure/closet/secure_closet/pilot/Initialize()