From b6380f7051839ad089edafa9061f86f071260b5b Mon Sep 17 00:00:00 2001 From: forest2001 <41653574+realforest2001@users.noreply.github.com> Date: Mon, 18 Dec 2023 10:13:56 +0000 Subject: [PATCH] Escape-pod stasis fixes & ID checking proc (#4960) # About the pull request PR converts most places that are comparing registered_name on an ID, to a mob. I have left places that are explicitly checking for things without use of a direct user, as there are instances where this is necessary. I have also fixed a missing check on escape pod stasis bays allowing xenos to put people into them. In addition to the above change, I have set it so that people who were forced into stasis can eject themselves as there have been cases where people were removed from the round by this against their wishes. # Explain why it's good for the game Makes little sense for xenos to be strapping marines into stasis bays. Nor for corpses to be accepted either, as they're not from the base version. # Testing Photographs and Procedure
Screenshots & Videos Put screenshots and videos here with an empty line between the screenshots and the `
` tags.
# Changelog :cl: add: Added a proc for comparing the registered name of an ID, to the real name of a mob. Also checks registered_ref if one exists. add: Evacuation can no longer be cancelled without passing above check. add: People forced into escape-pod stasis bays against their wishes can now eject themselves. fix: Xenos can no longer force humans into escape-pod stasis bays. fix: Escape-pod stasis bays no longer accept corpses. /:cl: --- code/datums/medal_awards.dm | 4 +- .../machinery/computer/almayer_control.dm | 13 +++++++ .../game/machinery/computer/communications.dm | 13 +++++++ code/game/machinery/cryopod.dm | 24 ++++++------ code/game/machinery/vending/cm_vending.dm | 10 ++--- code/game/objects/items/cards_ids.dm | 6 +++ .../objects/items/devices/portable_vendor.dm | 16 ++++---- code/game/objects/items/pamphlets.dm | 2 +- code/game/objects/items/storage/firstaid.dm | 14 +++---- .../shuttle/computers/escape_pod_computer.dm | 39 +++++++++++++------ 10 files changed, 95 insertions(+), 46 deletions(-) diff --git a/code/datums/medal_awards.dm b/code/datums/medal_awards.dm index 78fec7569582..ba8847c03661 100644 --- a/code/datums/medal_awards.dm +++ b/code/datums/medal_awards.dm @@ -174,9 +174,7 @@ GLOBAL_LIST_INIT(human_medals, list(MARINE_CONDUCT_MEDAL, MARINE_BRONZE_HEART_ME user.visible_message("ERROR: ID card not registered in USCM registry. Potential medal fraud detected.") return - var/real_owner_ref = card.registered_ref - - if(real_owner_ref != WEAKREF(user)) + if(!card.check_biometrics(user)) user.visible_message("ERROR: ID card not registered for [user.real_name] in USCM registry. Potential medal fraud detected.") return diff --git a/code/game/machinery/computer/almayer_control.dm b/code/game/machinery/computer/almayer_control.dm index 2b54d2e1df5b..e9b969e023b8 100644 --- a/code/game/machinery/computer/almayer_control.dm +++ b/code/game/machinery/computer/almayer_control.dm @@ -134,6 +134,19 @@ . = TRUE if("evacuation_cancel") + var/mob/living/carbon/human/human_user = usr + var/obj/item/card/id/idcard = human_user.get_active_hand() + var/bio_fail = FALSE + if(!istype(idcard)) + idcard = human_user.wear_id + if(!istype(idcard)) + bio_fail = TRUE + else if(!idcard.check_biometrics(human_user)) + bio_fail = TRUE + if(bio_fail) + to_chat(human_user, SPAN_WARNING("Biometrics failure! You require an authenticated ID card to perform this action!")) + return FALSE + if(!SShijack.cancel_evacuation()) to_chat(usr, SPAN_WARNING("You are unable to cancel the evacuation right now!")) return FALSE diff --git a/code/game/machinery/computer/communications.dm b/code/game/machinery/computer/communications.dm index 7a51539b8888..bcc4c4ac3ec8 100644 --- a/code/game/machinery/computer/communications.dm +++ b/code/game/machinery/computer/communications.dm @@ -154,6 +154,19 @@ state = STATE_EVACUATION if("evacuation_cancel") + var/mob/living/carbon/human/human_user = usr + var/obj/item/card/id/idcard = human_user.get_active_hand() + var/bio_fail = FALSE + if(!istype(idcard)) + idcard = human_user.wear_id + if(!istype(idcard)) + bio_fail = TRUE + else if(!idcard.check_biometrics(human_user)) + bio_fail = TRUE + if(bio_fail) + to_chat(human_user, SPAN_WARNING("Biometrics failure! You require an authenticated ID card to perform this action!")) + return FALSE + if(state == STATE_EVACUATION_CANCEL) if(!SShijack.cancel_evacuation()) to_chat(usr, SPAN_WARNING("You are unable to cancel the evacuation right now!")) diff --git a/code/game/machinery/cryopod.dm b/code/game/machinery/cryopod.dm index 53bf82c93925..ab5dc6448f4b 100644 --- a/code/game/machinery/cryopod.dm +++ b/code/game/machinery/cryopod.dm @@ -386,34 +386,35 @@ GLOBAL_LIST_INIT(frozen_items, list(SQUAD_MARINE_1 = list(), SQUAD_MARINE_2 = li stop_processing() /obj/structure/machinery/cryopod/attackby(obj/item/W, mob/living/user) - + if(isxeno(user)) + return FALSE if(istype(W, /obj/item/grab)) - if(isxeno(user)) return var/obj/item/grab/G = W if(occupant) to_chat(user, SPAN_WARNING("[src] is occupied.")) - return + return FALSE if(!isliving(G.grabbed_thing)) - return + return FALSE - var/willing = null //We don't want to allow people to be forced into despawning. + var/willing = FALSE //We don't want to allow people to be forced into despawning. var/mob/living/M = G.grabbed_thing if(M.stat == DEAD) //This mob is dead to_chat(user, SPAN_WARNING("[src] immediately rejects [M]. \He passed away!")) - return + return FALSE if(isxeno(M)) to_chat(user, SPAN_WARNING("There is no way [src] will accept [M]!")) - return + return FALSE if(M.client) if(alert(M,"Would you like to enter cryosleep?", , "Yes", "No") == "Yes") - if(!M || !G || !G.grabbed_thing) return - willing = 1 + if(!M || !G || !G.grabbed_thing) + return FALSE + willing = TRUE else - willing = 1 + willing = TRUE if(willing) @@ -424,7 +425,7 @@ GLOBAL_LIST_INIT(frozen_items, list(SQUAD_MARINE_1 = list(), SQUAD_MARINE_2 = li if(!M || !G || !G.grabbed_thing) return if(occupant) to_chat(user, SPAN_WARNING("[src] is occupied.")) - return + return FALSE go_in_cryopod(M) @@ -434,6 +435,7 @@ GLOBAL_LIST_INIT(frozen_items, list(SQUAD_MARINE_1 = list(), SQUAD_MARINE_2 = li //Despawning occurs when process() is called with an occupant without a client. add_fingerprint(user) + return TRUE /obj/structure/machinery/cryopod/relaymove(mob/user) if(user.is_mob_incapacitated(TRUE)) diff --git a/code/game/machinery/vending/cm_vending.dm b/code/game/machinery/vending/cm_vending.dm index 02b602cc8e07..6415e1d0acd5 100644 --- a/code/game/machinery/vending/cm_vending.dm +++ b/code/game/machinery/vending/cm_vending.dm @@ -555,7 +555,7 @@ GLOBAL_LIST_EMPTY(vending_products) vend_fail() return FALSE var/obj/item/card/id/ID = user.wear_id - if(!istype(ID) || ID.registered_ref != WEAKREF(usr)) + if(!istype(ID) || !ID.check_biometrics(user)) to_chat(user, SPAN_WARNING("You must be wearing your [SPAN_INFO("dog tags")] to select a specialization!")) return FALSE var/specialist_assignment @@ -779,15 +779,15 @@ GLOBAL_LIST_EMPTY(vending_products) vend_fail() return FALSE - var/mob/living/carbon/human/H = user - var/obj/item/card/id/I = H.wear_id - if(!istype(I)) + var/mob/living/carbon/human/human_user = user + var/obj/item/card/id/idcard = human_user.wear_id + if(!istype(idcard)) if(display) to_chat(user, SPAN_WARNING("Access denied. No ID card detected")) vend_fail() return FALSE - if(I.registered_name != user.real_name) + if(!idcard.check_biometrics(human_user)) if(display) to_chat(user, SPAN_WARNING("Wrong ID card owner detected.")) vend_fail() diff --git a/code/game/objects/items/cards_ids.dm b/code/game/objects/items/cards_ids.dm index ac5136b07a4a..5f58a3b1d292 100644 --- a/code/game/objects/items/cards_ids.dm +++ b/code/game/objects/items/cards_ids.dm @@ -144,6 +144,12 @@ to_chat(usr, "[icon2html(src, usr)] [name]: The current assignment on the card is [assignment]") to_chat(usr, "The blood type on the card is [blood_type].") +/obj/item/card/id/proc/check_biometrics(mob/living/carbon/human/target) + if(registered_ref && (registered_ref != WEAKREF(target))) + return FALSE + if(target.real_name != registered_name) + return FALSE + return TRUE /obj/item/card/id/data name = "identification holo-badge" diff --git a/code/game/objects/items/devices/portable_vendor.dm b/code/game/objects/items/devices/portable_vendor.dm index 1a4b5143f00f..465ba0666828 100644 --- a/code/game/objects/items/devices/portable_vendor.dm +++ b/code/game/objects/items/devices/portable_vendor.dm @@ -46,7 +46,7 @@ if(!ishuman(user)) return - var/mob/living/carbon/human/H = user + var/mob/living/carbon/human/human_user = user src.add_fingerprint(usr) @@ -58,17 +58,17 @@ to_chat(user, SPAN_WARNING("Access denied.")) return - var/obj/item/card/id/I = H.wear_id - if(!istype(I)) //not wearing an ID - to_chat(H, SPAN_WARNING("Access denied. No ID card detected")) + var/obj/item/card/id/idcard = human_user.wear_id + if(!istype(idcard)) //not wearing an ID + to_chat(human_user, SPAN_WARNING("Access denied. No ID card detected")) return - if(I.registered_name != H.real_name) - to_chat(H, SPAN_WARNING("Wrong ID card owner detected.")) + if(!idcard.check_biometrics(human_user)) + to_chat(human_user, SPAN_WARNING("Wrong ID card owner detected.")) return - if(req_role && I.rank != req_role) - to_chat(H, SPAN_WARNING("This device isn't for you.")) + if(req_role && idcard.rank != req_role) + to_chat(human_user, SPAN_WARNING("This device isn't for you.")) return diff --git a/code/game/objects/items/pamphlets.dm b/code/game/objects/items/pamphlets.dm index 682215be67bb..763d78bd6ea6 100644 --- a/code/game/objects/items/pamphlets.dm +++ b/code/game/objects/items/pamphlets.dm @@ -84,7 +84,7 @@ if(!istype(ID)) //not wearing an ID to_chat(user, SPAN_WARNING("You should wear your ID before doing this.")) return FALSE - if(ID.registered_ref != WEAKREF(user)) + if(!ID.check_biometrics(user)) to_chat(user, SPAN_WARNING("You should wear your ID before doing this.")) return FALSE diff --git a/code/game/objects/items/storage/firstaid.dm b/code/game/objects/items/storage/firstaid.dm index 2514e2e5f10c..06337995479f 100644 --- a/code/game/objects/items/storage/firstaid.dm +++ b/code/game/objects/items/storage/firstaid.dm @@ -650,19 +650,19 @@ if(!idlock) return TRUE - var/mob/living/carbon/human/H = user + var/mob/living/carbon/human/human_user = user - if(!allowed(user)) + if(!allowed(human_user)) to_chat(user, SPAN_NOTICE("It must have some kind of ID lock...")) return FALSE - var/obj/item/card/id/I = H.wear_id - if(!istype(I)) //not wearing an ID - to_chat(H, SPAN_NOTICE("It must have some kind of ID lock...")) + var/obj/item/card/id/idcard = human_user.wear_id + if(!istype(idcard)) //not wearing an ID + to_chat(human_user, SPAN_NOTICE("It must have some kind of ID lock...")) return FALSE - if(I.registered_name != H.real_name) - to_chat(H, SPAN_WARNING("Wrong ID card owner detected.")) + if(!idcard.check_biometrics(human_user)) + to_chat(human_user, SPAN_WARNING("Wrong ID card owner detected.")) return FALSE return TRUE diff --git a/code/modules/shuttle/computers/escape_pod_computer.dm b/code/modules/shuttle/computers/escape_pod_computer.dm index ec523747e18d..c45ac7d56102 100644 --- a/code/modules/shuttle/computers/escape_pod_computer.dm +++ b/code/modules/shuttle/computers/escape_pod_computer.dm @@ -97,14 +97,19 @@ unslashable = TRUE unacidable = TRUE time_till_despawn = 6000000 //near infinite so despawn never occurs. + /// The name of the mob who injected the occupant into the pod. If it does not match the occupant, the occupant can leave. + var/injector_name var/being_forced = 0 //Simple variable to prevent sound spam. var/dock_state = STATE_IDLE /obj/structure/machinery/cryopod/evacuation/ex_act(severity) return FALSE -/obj/structure/machinery/cryopod/evacuation/attackby(obj/item/grab/G, mob/user) - if(istype(G)) +/obj/structure/machinery/cryopod/evacuation/attackby(obj/item/grab/the_grab, mob/user) + if(istype(the_grab)) + if(user.is_mob_incapacitated() || !(ishuman(user))) + return FALSE + if(being_forced) to_chat(user, SPAN_WARNING("There's something forcing it open!")) return FALSE @@ -117,16 +122,20 @@ to_chat(user, SPAN_WARNING("The cryo pod is not responding to commands!")) return FALSE - var/mob/living/carbon/human/M = G.grabbed_thing - if(!istype(M)) + var/mob/living/carbon/human/grabbed_mob = the_grab.grabbed_thing + if(!istype(grabbed_mob)) + return FALSE + if(grabbed_mob.stat == DEAD) //This mob is dead + to_chat(user, SPAN_WARNING("[src] immediately rejects [grabbed_mob]. \He passed away!")) return FALSE - visible_message(SPAN_WARNING("[user] starts putting [M.name] into the cryo pod."), null, null, 3) + visible_message(SPAN_WARNING("[user] starts putting [grabbed_mob.name] into the cryo pod."), null, null, 3) if(do_after(user, 20, INTERRUPT_ALL, BUSY_ICON_GENERIC)) - if(!M || !G || !G.grabbed_thing || !G.grabbed_thing.loc || G.grabbed_thing != M) + if(!grabbed_mob || !the_grab || !the_grab.grabbed_thing || !the_grab.grabbed_thing.loc || the_grab.grabbed_thing != grabbed_mob) return FALSE - move_mob_inside(M) + move_mob_inside(grabbed_mob) + injector_name = user.real_name /obj/structure/machinery/cryopod/evacuation/eject() set name = "Eject Pod" @@ -136,17 +145,24 @@ if(!occupant || !usr.stat || usr.is_mob_restrained()) return FALSE - if(occupant) //Once you're in, you cannot exit, and outside forces cannot eject you. - //The occupant is actually automatically ejected once the evac is canceled. - if(occupant != usr) to_chat(usr, SPAN_WARNING("You are unable to eject the occupant unless the evacuation is canceled.")) - add_fingerprint(usr) + //Once you're in, you cannot exit, and outside forces cannot eject you. + //The occupant is actually automatically ejected once the evac is canceled. + if(occupant != usr) + to_chat(usr, SPAN_WARNING("You are unable to eject the occupant unless the evacuation is canceled.")) + return FALSE + if(occupant.real_name != injector_name) + go_out() + else + to_chat(usr, SPAN_WARNING("You are unable to leave the [src] until evacuation completes, or is cancelled!.")) + return FALSE /obj/structure/machinery/cryopod/evacuation/go_out() //When the system ejects the occupant. if(occupant) occupant.forceMove(get_turf(src)) occupant.in_stasis = FALSE occupant = null + injector_name = null icon_state = orient_right ? "body_scanner_open-r" : "body_scanner_open" /obj/structure/machinery/cryopod/evacuation/move_inside() @@ -176,6 +192,7 @@ if(do_after(user, 20, INTERRUPT_NO_NEEDHAND, BUSY_ICON_GENERIC)) user.stop_pulling() move_mob_inside(user) + injector_name = user.real_name /obj/structure/machinery/cryopod/evacuation/attack_alien(mob/living/carbon/xenomorph/user) if(being_forced)