Makes 'Plastic Surgery' names include held ID Cards (#14168)

* Update plastic_surgery.dm

* Fix

Thanks to AA for basically writing the code for me.

* Added 'get_id_from_hands' proc

* Changed held ID check to use said proc

* ID cards on patients body are now also shown

Probably overthinking it as usual.

Also added a couple of comments.

* Tweaks
This commit is contained in:
SabreML
2020-10-17 23:42:15 +01:00
committed by GitHub
parent 914e1493cd
commit 668932c256
2 changed files with 73 additions and 4 deletions
@@ -542,6 +542,41 @@
if(istype(id))
return id
//Gets ID card object from hands only
/mob/living/carbon/human/proc/get_id_from_hands()
var/obj/item/card/id/ID
var/obj/item/pda/PDA
var/obj/item/storage/wallet/W
var/active_hand = get_active_hand()
var/inactive_hand = get_inactive_hand()
//ID
if(istype(active_hand, /obj/item/card/id) || istype(inactive_hand, /obj/item/card/id))
if(istype(active_hand, ID))
ID = active_hand
else
ID = inactive_hand
//PDA
else if(istype(active_hand, /obj/item/pda) || istype(inactive_hand, /obj/item/pda))
if(istype(active_hand, PDA))
PDA = active_hand
else
PDA = inactive_hand
if(PDA.id)
ID = PDA.id
//Wallet
else if(istype(active_hand, /obj/item/storage/wallet) || istype(inactive_hand, /obj/item/storage/wallet))
if(istype(active_hand, W))
W = active_hand
else
W = inactive_hand
if(W.front_id)
ID = W.front_id
return ID
/mob/living/carbon/human/update_sight()
if(!client)
return
+38 -4
View File
@@ -30,12 +30,46 @@
user.visible_message("[user] successfully restores [target]'s appearance!", "<span class='notice'>You successfully restore [target]'s appearance.</span>")
else
var/list/names = list()
var/list_size = 10
var/obj/item/card/id/ID
//IDs in hand
if(istype(user, /mob/living/carbon/human)) //Only 'humans' can hold ID cards
var/mob/living/carbon/human/H = user
ID = H.get_id_from_hands()
if(ID)
names += ID.registered_name
list_size-- //To stop list bloat
//IDs on body
var/list/ID_list = list()
for(var/obj/item/I in range(0, target)) //Get ID cards
if(istype(I, /obj/item/card/id))
ID_list += I
else if(istype(I, /obj/item/pda))
var/obj/item/pda/PDA = I
if(PDA.id)
ID_list += PDA.id
else if(istype(I, /obj/item/storage/wallet))
var/obj/item/storage/wallet/W = I
if(W.front_id)
ID_list += W.front_id
for(var/I in ID_list) //Add card names to 'names'
var/obj/item/card/id/Card = I
ID = Card.registered_name
if(ID != target.real_name)
names += ID
list_size--
if(!isabductor(user))
for(var/i in 1 to 10)
for(var/i in 1 to list_size)
names += random_name(target.gender, species_names)
else
for(var/_i in 1 to 9)
names += "Subject [target.gender == MALE ? "i" : "o"]-[pick("a", "b", "c", "d", "e")]-[rand(10000, 99999)]"
else //Abductors get to pick fancy names
list_size-- //One less cause they get a normal name too
for(var/i in 1 to list_size)
names += "Subject [target.gender == MALE ? "I" : "O"]-[pick("A", "B", "C", "D", "E")]-[rand(10000, 99999)]"
names += random_name(target.gender, species_names) //give one normal name in case they want to do regular plastic surgery
var/chosen_name = input(user, "Choose a new name to assign.", "Plastic Surgery") as null|anything in names
if(!chosen_name)