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

Escape-pod stasis fixes & ID checking proc #4960

Merged
merged 4 commits into from
Dec 18, 2023
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
4 changes: 1 addition & 3 deletions code/datums/medal_awards.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
13 changes: 13 additions & 0 deletions code/game/machinery/computer/almayer_control.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 13 additions & 0 deletions code/game/machinery/computer/communications.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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!"))
Expand Down
24 changes: 13 additions & 11 deletions code/game/machinery/cryopod.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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)

Expand All @@ -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))
Expand Down
10 changes: 5 additions & 5 deletions code/game/machinery/vending/cm_vending.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()
Expand Down
6 changes: 6 additions & 0 deletions code/game/objects/items/cards_ids.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
16 changes: 8 additions & 8 deletions code/game/objects/items/devices/portable_vendor.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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


Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/items/pamphlets.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
14 changes: 7 additions & 7 deletions code/game/objects/items/storage/firstaid.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
39 changes: 28 additions & 11 deletions code/modules/shuttle/computers/escape_pod_computer.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"
Expand All @@ -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()
Expand Down Expand Up @@ -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)
Expand Down