Skip to content

Commit

Permalink
CO Biometrics (#5520)
Browse files Browse the repository at this point in the history
<!-- Write **BELOW** The Headers and **ABOVE** The comments else it may
not be viewable. -->

# About the pull request
Adds more biometric checks to certain command interactions.
<!-- Remove this text and explain what the purpose of your PR is.

Mention if you have tested your changes. If you changed a map, make sure
you used the mapmerge tool.
If this is an Issue Correction, you can type "Fixes Issue #169420" to
link the PR to the corresponding Issue number #169420.

Remember: something that is self-evident to you might not be to others.
Explain your rationale fully, even if you feel it goes without saying.
-->

# Explain why it's good for the game

<!-- Please add a short description of why you think these changes would
benefit the game. If you can't justify it in words, it might not be
worth adding, and may discourage maintainers from reviewing or merging
your PR. This section is not strictly required for (non-controversial)
fix PRs or backend PRs. -->


# Testing Photographs and Procedure
<!-- Include any screenshots/videos/debugging steps of the modified code
functioning successfully, ideally including edge cases. -->
<details>
<summary>Screenshots & Videos</summary>

Put screenshots and videos here with an empty line between the
screenshots and the `<details>` tags.

</details>


# Changelog

<!-- If your PR modifies aspects of the game that can be concretely
observed by players or admins you should add a changelog. If your change
does NOT meet this description, remove this section. Be sure to properly
label your changes in the changelog. Please note that maintainers freely
reserve the right to remove and add tags should they deem it
appropriate. You can attempt to finagle the system all you want, but
it's best to shoot for clear communication right off the bat. -->
<!-- If you add a name after the ':cl', that name will be used in the
changelog. You must add your CKEY after the CL if your GitHub name
doesn't match. Maintainers freely reserve the right to remove and add
tags should they deem it appropriate. -->

:cl:
add: Added biometric checks to command announcements.
/:cl:

<!-- Both :cl:'s are required for the changelog to work! -->
  • Loading branch information
realforest2001 authored Jan 28, 2024
1 parent ac085fe commit a9b7b17
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 8 deletions.
21 changes: 15 additions & 6 deletions code/game/machinery/computer/almayer_control.dm
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,19 @@
. = TRUE

if("ship_announce")
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(!COOLDOWN_FINISHED(src, cooldown_message))
to_chat(usr, SPAN_WARNING("Please allow at least [COOLDOWN_TIMELEFT(src, cooldown_message)/10] second\s to pass between announcements."))
return FALSE
Expand All @@ -201,12 +214,8 @@
return FALSE

var/signed = null
if(ishuman(usr))
var/mob/living/carbon/human/human_user = usr
var/obj/item/card/id/id = human_user.wear_id
if(istype(id))
var/paygrade = get_paygrades(id.paygrade, FALSE, human_user.gender)
signed = "[paygrade] [id.registered_name]"
var/paygrade = get_paygrades(idcard.paygrade, FALSE, human_user.gender)
signed = "[paygrade] [idcard.registered_name]"

COOLDOWN_START(src, cooldown_message, COOLDOWN_COMM_MESSAGE)
shipwide_ai_announcement(input, COMMAND_SHIP_ANNOUNCE, signature = signed)
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 @@ -113,6 +113,19 @@

if("announce")
if(authenticated == 2)
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(usr.client.prefs.muted & MUTE_IC)
to_chat(usr, SPAN_DANGER("You cannot send Announcements (muted)."))
return
Expand Down
26 changes: 26 additions & 0 deletions code/game/machinery/computer/groundside_operations.dm
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,19 @@
return

if("announce")
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(usr.client.prefs.muted & MUTE_IC)
to_chat(usr, SPAN_DANGER("You cannot send Announcements (muted)."))
return
Expand Down Expand Up @@ -295,6 +308,19 @@
usr.RegisterSignal(cam, COMSIG_PARENT_QDELETING, TYPE_PROC_REF(/mob, reset_observer_view_on_deletion))

if("activate_echo")
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

var/reason = strip_html(input(usr, "What is the purpose of Echo Squad?", "Activation Reason"))
if(!reason)
return
Expand Down
4 changes: 2 additions & 2 deletions code/game/objects/items/devices/cictablet.dm
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@
add_pmcs = FALSE
UnregisterSignal(SSdcs, COMSIG_GLOB_MODE_PRESETUP)

/obj/item/device/cotablet/attack_self(mob/user as mob)
/obj/item/device/cotablet/attack_self(mob/living/carbon/human/user as mob)
..()

if(src.allowed(user))
if(src.allowed(user) && user.wear_id?.check_biometrics(user))
tgui_interact(user)
else
to_chat(user, SPAN_DANGER("Access denied."))
Expand Down

0 comments on commit a9b7b17

Please sign in to comment.