Replace ID/PDA/Wallet checks with GetID() (#10204)

This commit is contained in:
JohnWildkins
2020-10-10 12:58:41 +02:00
committed by GitHub
parent aa24c56893
commit 0ed0cba6b7
29 changed files with 84 additions and 162 deletions
+1 -1
View File
@@ -598,7 +598,7 @@
/mob/living/bot/secbot/attackby(var/obj/item/O, var/mob/user)
..()
if(istype(O, /obj/item/card/id) || O.ispen() || istype(O, /obj/item/device/pda))
if(O.GetID() || O.ispen())
return
target = user
+1 -1
View File
@@ -71,7 +71,7 @@
return
if((istype(O,/obj/item/card/id)||istype(O,/obj/item/device/pda)) && brainmob)
if(O.GetID() && brainmob)
if(allowed(user))
locked = !locked
to_chat(user, "<span class='notice'>You [locked ? "lock" : "unlock"] the brain holder.</span>")
+24 -49
View File
@@ -477,13 +477,9 @@
//Useful when player is being seen by other mobs
/mob/living/carbon/human/proc/get_id_name(var/if_no_id = "Unknown")
. = if_no_id
if(istype(wear_id,/obj/item/device/pda))
var/obj/item/device/pda/P = wear_id
return P.owner
if(wear_id)
var/obj/item/card/id/I = wear_id.GetID()
if(I)
return I.registered_name
var/obj/item/card/id/I = GetIdCard()
if(I)
return I.registered_name
return
//gets ID card object from special clothes slot or null.
@@ -639,12 +635,9 @@
var/perpname = "wot"
var/read = 0
if(wear_id)
if(istype(wear_id,/obj/item/card/id))
perpname = wear_id:registered_name
else if(istype(wear_id,/obj/item/device/pda))
var/obj/item/device/pda/tempPda = wear_id
perpname = tempPda.owner
if(GetIdCard())
var/obj/item/card/id/id = GetIdCard()
perpname = id.registered_name
else
perpname = src.name
var/datum/record/general/R = SSrecords.find_record("name", perpname)
@@ -664,12 +657,9 @@
var/perpname = "wot"
var/read = 0
if(wear_id)
if(istype(wear_id,/obj/item/card/id))
perpname = wear_id:registered_name
else if(istype(wear_id,/obj/item/device/pda))
var/obj/item/device/pda/tempPda = wear_id
perpname = tempPda.owner
if(GetIdCard())
var/obj/item/card/id/id = GetIdCard()
perpname = id.registered_name
else
perpname = src.name
var/datum/record/general/R = SSrecords.find_record("name", perpname)
@@ -689,12 +679,9 @@
if (href_list["secrecordadd"])
if(hasHUD(usr,"security"))
var/perpname = "wot"
if(wear_id)
if(istype(wear_id,/obj/item/card/id))
perpname = wear_id:registered_name
else if(istype(wear_id,/obj/item/device/pda))
var/obj/item/device/pda/tempPda = wear_id
perpname = tempPda.owner
if(GetIdCard())
var/obj/item/card/id/id = GetIdCard()
perpname = id.registered_name
else
perpname = src.name
var/datum/record/general/R = SSrecords.find_record("name", perpname)
@@ -714,12 +701,9 @@
var/perpname = "wot"
var/modified = 0
if(wear_id)
if(istype(wear_id,/obj/item/card/id))
perpname = wear_id:registered_name
else if(istype(wear_id,/obj/item/device/pda))
var/obj/item/device/pda/tempPda = wear_id
perpname = tempPda.owner
if(GetIdCard())
var/obj/item/card/id/id = GetIdCard()
perpname = id.registered_name
else
perpname = src.name
@@ -749,12 +733,9 @@
var/perpname = "wot"
var/read = 0
if(wear_id)
if(istype(wear_id,/obj/item/card/id))
perpname = wear_id:registered_name
else if(istype(wear_id,/obj/item/device/pda))
var/obj/item/device/pda/tempPda = wear_id
perpname = tempPda.owner
if(GetIdCard())
var/obj/item/card/id/id = GetIdCard()
perpname = id.registered_name
else
perpname = src.name
var/datum/record/general/R = SSrecords.find_record("name", perpname)
@@ -775,12 +756,9 @@
var/perpname = "wot"
var/read = 0
if(wear_id)
if(istype(wear_id,/obj/item/card/id))
perpname = wear_id:registered_name
else if(istype(wear_id,/obj/item/device/pda))
var/obj/item/device/pda/tempPda = wear_id
perpname = tempPda.owner
if(GetIdCard())
var/obj/item/card/id/id = GetIdCard()
perpname = id.registered_name
else
perpname = src.name
var/datum/record/general/R = SSrecords.find_record("name", perpname)
@@ -800,12 +778,9 @@
if (href_list["medrecordadd"])
if(hasHUD(usr,"medical"))
var/perpname = "wot"
if(wear_id)
if(istype(wear_id,/obj/item/card/id))
perpname = wear_id:registered_name
else if(istype(wear_id,/obj/item/device/pda))
var/obj/item/device/pda/tempPda = wear_id
perpname = tempPda.owner
if(GetIdCard())
var/obj/item/card/id/id = GetIdCard()
perpname = id.registered_name
else
perpname = src.name
var/datum/record/general/R = SSrecords.find_record("name", perpname)
@@ -223,7 +223,7 @@
else if(W.iscrowbar())
to_chat(user, SPAN_WARNING("\The [src] is hermetically sealed. You can't open the case."))
return
else if(istype(W, /obj/item/card/id)||istype(W, /obj/item/device/pda))
else if(W.GetID())
if(stat == DEAD)
if(!config.allow_drone_spawn || emagged || health < -maxHealth) //It's dead, Dave.
to_chat(user, SPAN_WARNING("The interface is fried, and a distressing burned smell wafts from the robot's interior. You're not rebooting this one."))
@@ -751,7 +751,7 @@
else
to_chat(user, SPAN_WARNING("\The [src] does not have a radio installed!"))
return
else if(istype(W, /obj/item/card/id) ||istype(W, /obj/item/device/pda) || istype(W, /obj/item/card/robot)) // trying to unlock the interface with an ID card
else if(W.GetID()) // trying to unlock the interface with an ID card
if(emagged) //still allow them to open the cover
to_chat(user, SPAN_NOTICE("You notice that \the [src]'s interface appears to be damaged."))
if(opened)
@@ -112,18 +112,15 @@
else
to_chat(user, "<span class='danger'>You need more welding fuel for this task!</span>")
return
else if(istype(O, /obj/item/card/id)||istype(O, /obj/item/device/pda))
else if(O.GetID())
if (!mmi)
to_chat(user, "<span class='danger'>There's no reason to swipe your ID - \the [src] has no brain to remove.</span>")
return 0
var/obj/item/card/id/id_card
var/obj/item/card/id/id_card = O.GetID()
if(istype(O, /obj/item/card/id))
id_card = O
else
var/obj/item/device/pda/pda = O
id_card = pda.id
if(!istype(id_card))
return 0
if(access_robotics in id_card.access)
to_chat(user, "<span class='notice'>You swipe your access card and pop the brain out of \the [src].</span>")