From 9b170300864469618a9bb2417dc84fafc22977c0 Mon Sep 17 00:00:00 2001 From: forest2001 Date: Sun, 19 Nov 2023 04:57:50 +0000 Subject: [PATCH 1/3] id check proc, cryopod checks --- code/datums/medal_awards.dm | 4 +--- .../machinery/computer/almayer_control.dm | 13 ++++++++++ .../game/machinery/computer/communications.dm | 11 +++++++++ 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 | 21 ++++++++++++---- 10 files changed, 82 insertions(+), 39 deletions(-) diff --git a/code/datums/medal_awards.dm b/code/datums/medal_awards.dm index 54af48fd3345..4e918d2efc27 100644 --- a/code/datums/medal_awards.dm +++ b/code/datums/medal_awards.dm @@ -173,9 +173,7 @@ GLOBAL_LIST_EMPTY(jelly_awards) 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 fb9f7a0375d9..28775f379f0d 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 + if(!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 b39f59530adc..7e234418a6ed 100644 --- a/code/game/machinery/computer/communications.dm +++ b/code/game/machinery/computer/communications.dm @@ -154,6 +154,17 @@ 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() + if(!istype(idcard)) + idcard = human_user.wear_id + if(!istype(idcard)) + to_chat(human_user, SPAN_WARNING("Biometrics failure! You require an authenticated ID card to perform this action!")) + return FALSE + if(!check_biometrics(human_user)) + 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 86bb5f79a035..99af432cc6b5 100644 --- a/code/game/machinery/cryopod.dm +++ b/code/game/machinery/cryopod.dm @@ -385,34 +385,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) @@ -423,7 +424,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) @@ -433,6 +434,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 f2eff1c23e56..df73a83f30df 100644 --- a/code/game/machinery/vending/cm_vending.dm +++ b/code/game/machinery/vending/cm_vending.dm @@ -534,7 +534,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 @@ -751,15 +751,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 a5e0eafe2f91..69c66da6a512 100644 --- a/code/game/objects/items/cards_ids.dm +++ b/code/game/objects/items/cards_ids.dm @@ -129,6 +129,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 29e1d06018ae..9f6f9bf4d275 100644 --- a/code/game/objects/items/devices/portable_vendor.dm +++ b/code/game/objects/items/devices/portable_vendor.dm @@ -44,7 +44,7 @@ if(!ishuman(user)) return - var/mob/living/carbon/human/H = user + var/mob/living/carbon/human/human_user = user src.add_fingerprint(usr) @@ -56,17 +56,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..efaa105d52b6 100644 --- a/code/modules/shuttle/computers/escape_pod_computer.dm +++ b/code/modules/shuttle/computers/escape_pod_computer.dm @@ -97,6 +97,8 @@ 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 @@ -105,6 +107,9 @@ /obj/structure/machinery/cryopod/evacuation/attackby(obj/item/grab/G, mob/user) if(istype(G)) + 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 @@ -127,6 +132,7 @@ if(!M || !G || !G.grabbed_thing || !G.grabbed_thing.loc || G.grabbed_thing != M) return FALSE move_mob_inside(M) + injector_name = user.real_name /obj/structure/machinery/cryopod/evacuation/eject() set name = "Eject Pod" @@ -136,17 +142,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() From bd34545c5b50c37d0b64ac355a3a5b3f3bdaa51d Mon Sep 17 00:00:00 2001 From: forest2001 Date: Sun, 19 Nov 2023 04:59:45 +0000 Subject: [PATCH 2/3] + tweak --- code/game/machinery/computer/almayer_control.dm | 2 +- code/game/machinery/computer/communications.dm | 14 ++++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/code/game/machinery/computer/almayer_control.dm b/code/game/machinery/computer/almayer_control.dm index 28775f379f0d..958f7e158e68 100644 --- a/code/game/machinery/computer/almayer_control.dm +++ b/code/game/machinery/computer/almayer_control.dm @@ -141,7 +141,7 @@ idcard = human_user.wear_id if(!istype(idcard)) bio_fail = TRUE - if(!check_biometrics(human_user)) + 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!")) diff --git a/code/game/machinery/computer/communications.dm b/code/game/machinery/computer/communications.dm index 7e234418a6ed..80f3fe96d913 100644 --- a/code/game/machinery/computer/communications.dm +++ b/code/game/machinery/computer/communications.dm @@ -156,14 +156,16 @@ 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)) - to_chat(human_user, SPAN_WARNING("Biometrics failure! You require an authenticated ID card to perform this action!")) - return FALSE - if(!check_biometrics(human_user)) - to_chat(human_user, SPAN_WARNING("Biometrics failure! You require an authenticated ID card to perform this action!")) - return FALSE + 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()) From ac19f9e4423a1e9c43a5f27d9439fd8f7b53881b Mon Sep 17 00:00:00 2001 From: forest2001 Date: Sun, 19 Nov 2023 07:45:21 +0000 Subject: [PATCH 3/3] silly forest --- code/game/machinery/vending/cm_vending.dm | 2 +- .../shuttle/computers/escape_pod_computer.dm | 18 +++++++++++------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/code/game/machinery/vending/cm_vending.dm b/code/game/machinery/vending/cm_vending.dm index df73a83f30df..231659107eba 100644 --- a/code/game/machinery/vending/cm_vending.dm +++ b/code/game/machinery/vending/cm_vending.dm @@ -534,7 +534,7 @@ GLOBAL_LIST_EMPTY(vending_products) vend_fail() return FALSE var/obj/item/card/id/ID = user.wear_id - if(!istype(ID) || ID.check_biometrics(user)) + 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 diff --git a/code/modules/shuttle/computers/escape_pod_computer.dm b/code/modules/shuttle/computers/escape_pod_computer.dm index efaa105d52b6..c45ac7d56102 100644 --- a/code/modules/shuttle/computers/escape_pod_computer.dm +++ b/code/modules/shuttle/computers/escape_pod_computer.dm @@ -105,8 +105,8 @@ /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 @@ -122,16 +122,19 @@ 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() @@ -189,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)