Refactor the borg access function to account for all ID locations (#7641)

This commit is contained in:
aleksix
2019-12-14 21:44:37 +01:00
committed by Werner
parent 24d63a3e15
commit 513f0cb296
2 changed files with 14 additions and 7 deletions
@@ -791,18 +791,19 @@
return ..(user,Floor(damage/2),attack_message)
/mob/living/silicon/robot/proc/allowed(mob/M)
//check if it doesn't require any access at all
// Check if the borg doesn't require any access at all
if(check_access(null))
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
else if(istype(M, /mob/living/silicon/robot))
// Borgs should be handled a bit differently, since their IDs are not really IDs
if(istype(M, /mob/living/silicon/robot))
var/mob/living/silicon/robot/R = M
if(check_access(R.get_active_hand()) || istype(R.get_active_hand(), /obj/item/card/robot))
return 1
else if(istype(M, /mob/living))
var/id = M.GetIdCard()
// Check if the ID card the user has (if any) has access
if(id)
return check_access(id)
return 0
/mob/living/silicon/robot/proc/check_access(obj/item/card/id/I)
@@ -0,0 +1,6 @@
author: aleksix
delete-after: True
changes:
- refactor: "Borgs ID access code has been refactored to the normal ID access code. Now they properly check for access in PDAs, hands and such."