mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-20 18:47:20 +01:00
Fix up a number of ID checks
This commit is contained in:
@@ -709,12 +709,19 @@
|
||||
if(!.) . = if_no_id //to prevent null-names making the mob unclickable
|
||||
return
|
||||
|
||||
//gets ID card object from special clothes slot or null.
|
||||
/mob/living/carbon/human/proc/get_idcard()
|
||||
//gets ID card object from special clothes slot or, if applicable, hands as well
|
||||
/mob/living/carbon/human/proc/get_idcard(var/check_hands = FALSE)
|
||||
var/obj/item/weapon/card/id/id = wear_id
|
||||
var/obj/item/device/pda/pda = wear_id
|
||||
if(istype(pda) && pda.id)
|
||||
id = pda.id
|
||||
|
||||
if(check_hands)
|
||||
if(istype(get_active_hand(), /obj/item/weapon/card/id))
|
||||
id = get_active_hand()
|
||||
else if(istype(get_inactive_hand(), /obj/item/weapon/card/id))
|
||||
id = get_inactive_hand()
|
||||
|
||||
if(istype(id))
|
||||
return id
|
||||
|
||||
@@ -1977,6 +1984,12 @@
|
||||
var/obj/item/weapon/card/id/id = wear_id
|
||||
if(istype(id) && id.is_untrackable())
|
||||
return 0
|
||||
if(wear_pda)
|
||||
var/obj/item/device/pda/pda = wear_pda
|
||||
if(istype(pda))
|
||||
var/obj/item/weapon/card/id/id = pda.id
|
||||
if(istype(id) && id.is_untrackable())
|
||||
return 0
|
||||
if(istype(head, /obj/item/clothing/head))
|
||||
var/obj/item/clothing/head/hat = head
|
||||
if(hat.blockTracking)
|
||||
@@ -1992,6 +2005,8 @@
|
||||
|
||||
if(wear_id)
|
||||
. |= wear_id.GetAccess()
|
||||
if(wear_pda)
|
||||
. |= wear_pda.GetAccess()
|
||||
if(istype(w_uniform, /obj/item/clothing/under))
|
||||
var/obj/item/clothing/under/U = w_uniform
|
||||
if(U.accessories)
|
||||
|
||||
@@ -730,18 +730,18 @@ var/list/robot_verbs_default = list(
|
||||
else
|
||||
to_chat(user, "Unable to locate a radio.")
|
||||
|
||||
else if(istype(W, /obj/item/weapon/card/id)||istype(W, /obj/item/device/pda)) // trying to unlock the interface with an ID card
|
||||
else if(istype(W, /obj/item/weapon/card/id) || istype(W, /obj/item/device/pda)) // trying to unlock the interface with an ID card
|
||||
if(emagged)//still allow them to open the cover
|
||||
to_chat(user, "The interface seems slightly damaged")
|
||||
to_chat(user, "The interface seems slightly damaged.")
|
||||
if(opened)
|
||||
to_chat(user, "You must close the cover to swipe an ID card.")
|
||||
else
|
||||
if(allowed(usr))
|
||||
if(allowed(W))
|
||||
locked = !locked
|
||||
to_chat(user, "You [ locked ? "lock" : "unlock"] [src]'s interface.")
|
||||
update_icons()
|
||||
else
|
||||
to_chat(user, "\red Access denied.")
|
||||
to_chat(user, "<span class='warning'>Access denied.</span>")
|
||||
|
||||
else if(istype(W, /obj/item/borg/upgrade/))
|
||||
var/obj/item/borg/upgrade/U = W
|
||||
@@ -957,29 +957,15 @@ var/list/robot_verbs_default = list(
|
||||
user.visible_message("<span class='notice'>[user] pets [src]!</span>", \
|
||||
"<span class='notice'>You pet [src]!</span>")
|
||||
|
||||
/mob/living/silicon/robot/proc/allowed(mob/M)
|
||||
//check if it doesn't require any access at all
|
||||
if(check_access(null))
|
||||
/mob/living/silicon/robot/proc/allowed(obj/item/I)
|
||||
var/obj/dummy = new /obj(null) // Create a dummy object to check access on as to avoid having to snowflake check_access on every mob
|
||||
dummy.req_access = req_access
|
||||
|
||||
if(dummy.check_access(I))
|
||||
qdel(dummy)
|
||||
return 1
|
||||
if(istype(M, /mob/living/carbon/human))
|
||||
var/mob/living/carbon/human/H = M
|
||||
//if they are holding or wearing a card that has access, that works
|
||||
if(check_access(H.get_active_hand()) || check_access(H.wear_id))
|
||||
return 1
|
||||
return 0
|
||||
|
||||
/mob/living/silicon/robot/proc/check_access(obj/item/weapon/card/id/I)
|
||||
if(!istype(req_access, /list)) //something's very wrong
|
||||
return 1
|
||||
|
||||
var/list/L = req_access
|
||||
if(!L.len) //no requirements
|
||||
return 1
|
||||
if(!I || !istype(I, /obj/item/weapon/card/id) || !I.access) //not ID or no access
|
||||
return 0
|
||||
for(var/req in req_access)
|
||||
if(req in I.access) //have one of the required accesses
|
||||
return 1
|
||||
|
||||
qdel(dummy)
|
||||
return 0
|
||||
|
||||
/mob/living/silicon/robot/update_icons()
|
||||
|
||||
Reference in New Issue
Block a user