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
+12 -30
View File
@@ -184,11 +184,8 @@
voice_name = "Bluespace Cat"
real_name = "Bluespace Cat"
mind.name = "Bluespace Cat"
if(wear_id)
var/obj/item/card/id/id = wear_id
if(istype(wear_id, /obj/item/device/pda))
var/obj/item/device/pda/pda = wear_id
id = pda.id
if(GetIdCard())
var/obj/item/card/id/id = GetIdCard()
id.registered_name = "Bluespace Cat"
gender = "female"
regenerate_icons()
@@ -204,11 +201,8 @@
voice_name = "Bluespace Bot"
real_name = "Bluespace Bot"
mind.name = "Bluespace Bot"
if(wear_id)
var/obj/item/card/id/id = wear_id
if(istype(wear_id, /obj/item/device/pda))
var/obj/item/device/pda/pda = wear_id
id = pda.id
if(GetIdCard())
var/obj/item/card/id/id = GetIdCard()
id.registered_name = "Bluespace Bot"
regenerate_icons()
else
@@ -222,11 +216,8 @@
voice_name = "Bluespace Tree"
real_name = "Bluespace Tree"
mind.name = "Bluespace Tree"
if(wear_id)
var/obj/item/card/id/id = wear_id
if(istype(wear_id, /obj/item/device/pda))
var/obj/item/device/pda/pda = wear_id
id = pda.id
if(GetIdCard())
var/obj/item/card/id/id = GetIdCard()
id.registered_name = "Bluespace Tree"
regenerate_icons()
else
@@ -241,11 +232,8 @@
voice_name = "Bluespace Lizard"
real_name = "Bluespace Lizard"
mind.name = "Bluespace Lizard"
if(wear_id)
var/obj/item/card/id/id = wear_id
if(istype(wear_id, /obj/item/device/pda))
var/obj/item/device/pda/pda = wear_id
id = pda.id
if(GetIdCard())
var/obj/item/card/id/id = GetIdCard()
id.registered_name = "Bluespace Lizard"
regenerate_icons()
else
@@ -260,11 +248,8 @@
voice_name = "Bluespace Squid"
real_name = "Bluespace Squid"
mind.name = "Bluespace Squid"
if(wear_id)
var/obj/item/card/id/id = wear_id
if(istype(wear_id, /obj/item/device/pda))
var/obj/item/device/pda/pda = wear_id
id = pda.id
if(GetIdCard())
var/obj/item/card/id/id = GetIdCard()
id.registered_name = "Bluespace Squid"
gender = "female"
regenerate_icons()
@@ -280,11 +265,8 @@
voice_name = "Bluespace Bug"
real_name = "Bluespace Bug"
mind.name = "Bluespace Bug"
if(wear_id)
var/obj/item/card/id/id = wear_id
if(istype(wear_id, /obj/item/device/pda))
var/obj/item/device/pda/pda = wear_id
id = pda.id
if(GetIdCard())
var/obj/item/card/id/id = GetIdCard()
id.registered_name = "Bluespace Bug"
regenerate_icons()
else
+2 -5
View File
@@ -131,11 +131,8 @@
return
if (istype(M, /mob/living/carbon/human))
var/mob/living/carbon/human/H = M
if (H.wear_id)
var/obj/item/card/id/id = H.wear_id
if(istype(H.wear_id, /obj/item/device/pda))
var/obj/item/device/pda/pda = H.wear_id
id = pda.id
if (H.GetIdCard())
var/obj/item/card/id/id = H.GetIdCard()
id.icon_state = "gold"
id.access = get_all_accesses()
else
@@ -137,15 +137,12 @@
return 1
/obj/item/clothing/accessory/badge/holo/attackby(var/obj/item/O as obj, var/mob/user as mob)
if(istype(O, /obj/item/card/id) || istype(O, /obj/item/device/pda))
if(O.GetID())
var/obj/item/card/id/id_card = null
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
if(access_security in id_card.access || emagged)
to_chat(user, "You imprint your ID details onto the badge.")
+3 -8
View File
@@ -470,14 +470,9 @@ log transactions
//stolen wholesale and then edited a bit from newscasters, which are awesome and by Agouri
/obj/machinery/atm/proc/scan_user(mob/living/carbon/human/human_user as mob)
if(!authenticated_account)
if(human_user.wear_id)
var/obj/item/card/id/I
if(istype(human_user.wear_id, /obj/item/card/id) )
I = human_user.wear_id
else if(istype(human_user.wear_id, /obj/item/device/pda) )
var/obj/item/device/pda/P = human_user.wear_id
I = P.id
if(I)
if(istype(human_user))
var/obj/item/card/id/I = human_user.GetIdCard()
if(istype(I))
authenticated_account = SSeconomy.attempt_account_access(I.associated_account_number)
if(authenticated_account)
to_chat(human_user, "<span class='notice'>[icon2html(src, usr)] Access granted. Welcome user '[authenticated_account.owner_name].'</span>")
+1 -1
View File
@@ -85,7 +85,7 @@
to_chat(user, SPAN_WARNING("\The [src] is not compatible with \the [W]."))
return
else if (istype(W, /obj/item/card/id) || istype(W, /obj/item/device/pda))
else if (W.GetID())
if(!allowed(user))
to_chat(user, SPAN_WARNING("Access denied."))
return
+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>")
+1 -1
View File
@@ -572,7 +572,7 @@
to_chat(user, "The wires have been [wiresexposed ? "exposed" : "unexposed"]")
update_icon()
else if (istype(W, /obj/item/card/id)||istype(W, /obj/item/device/pda)) // trying to unlock the interface with an ID card
else if (W.GetID()) // trying to unlock the interface with an ID card
if(emagged)
to_chat(user, "The interface is broken.")
else if(opened != COVER_CLOSED)
+1 -1
View File
@@ -84,7 +84,7 @@ var/global/list/rad_collectors = list()
else
disconnect_from_network()
return 1
else if(istype(W, /obj/item/card/id)||istype(W, /obj/item/device/pda))
else if(W.GetID())
if (src.allowed(user))
if(active)
src.locked = !src.locked
+1 -1
View File
@@ -234,7 +234,7 @@
to_chat(user, SPAN_WARNING("You need more welding fuel to complete this task."))
return
if(istype(W, /obj/item/card/id) || istype(W, /obj/item/device/pda))
if(W.GetID())
if(emagged)
to_chat(user, SPAN_WARNING("The lock seems to be broken."))
return
+1 -1
View File
@@ -309,7 +309,7 @@
anchored = TRUE
else if(istype(W, /obj/item/card/id) || istype(W, /obj/item/device/pda))
else if(W.GetID())
if(src.allowed(user))
src.locked = !src.locked
to_chat(user, "The controls are now [src.locked ? "locked." : "unlocked."]")
+1 -2
View File
@@ -158,7 +158,7 @@
user.visible_message(others_msg, SPAN_NOTICE(self_msg), SPAN_NOTICE("You hear a ratcheting noise."))
return
if(istype(W, /obj/item/card/id) || istype(W, /obj/item/device/pda))
if(W.GetID())
add_fingerprint(user)
if(allowed(user))
locked = !locked
@@ -167,7 +167,6 @@
else
to_chat(user, SPAN_WARNING("Access denied."))
return
return ..()
/obj/machinery/shieldwallgen/proc/alldir_cleanup()