reworked id spawning, added some fixes

Signed-off-by: Cael_Aislinn <cael_aislinn@yahoo.com.au>
This commit is contained in:
Cael_Aislinn
2012-08-02 14:33:19 +10:00
parent 3c168305ed
commit 4a9383b5af

View File

@@ -25,48 +25,40 @@
P = trim(P) P = trim(P)
var/path = text2path(P) var/path = text2path(P)
var/obj/item/Item = new path() var/obj/item/Item = new path()
if(istype(Item,/obj/item/weapon/card/id))
//id card needs to replace the original ID
if(M.ckey == "nerezza" && M.real_name == "Asher Spock" && M.mind.role_alt_title && M.mind.role_alt_title != "Emergency Physician")
//only spawn ID if asher is joining as an emergency physician
ok = 1
del(Item)
goto skip
var/obj/item/weapon/card/id/I = Item
for(var/obj/item/weapon/card/id/C in M)
//default settings
I.name = "[M.real_name]'s ID Card ([M.mind.role_alt_title ? M.mind.role_alt_title : M.mind.assigned_role])"
I.registered_name = M.real_name
I.access = C.access
I.assignment = C.assignment
I.over_jumpsuit = C.over_jumpsuit
I.blood_type = C.blood_type
I.dna_hash = C.dna_hash
I.fingerprint_hash = C.fingerprint_hash
if(istype(M.back,/obj/item/weapon/storage) && M.back:contents.len < M.back:storage_slots) // Try to place it in something on the mob's back first //custom stuff
if(M.ckey == "fastler" && M.real_name == "Fastler Greay") //This is a Lifetime ID
I.name = "[M.real_name]'s Lifetime ID Card ([M.mind.role_alt_title ? M.mind.role_alt_title : M.mind.assigned_role])"
else if(M.ckey == "nerezza" && M.real_name == "Asher Spock") //This is an Odysseus Specialist ID
I.name = "[M.real_name]'s Odysseus Specialist ID Card ([M.mind.role_alt_title ? M.mind.role_alt_title : M.mind.assigned_role])"
I.access += list(ACCESS_ROBOTICS) //Station-based mecha pilots need this to access the recharge bay.
//replace old ID
del(C)
ok = M.equip_if_possible(I, M.slot_wear_id, 0) //if 1, last argument deletes on fail
break
else if(istype(M.back,/obj/item/weapon/storage) && M.back:contents.len < M.back:storage_slots) // Try to place it in something on the mob's back
Item.loc = M.back Item.loc = M.back
ok = 1 ok = 1
else if(istype(Item,/obj/item/weapon/card/id)) //player wants a custom ID card - only lifetime cards for now (Nerezza: Not anymore! Custom IDs will be handled differently depending on whose it is. Make sure to note what it is.)
if(M.ckey == "fastler" && M.real_name == "Fastler Greay") //This is a Lifetime ID
var/obj/item/weapon/card/id/I = Item
for(var/obj/item/weapon/card/id/C in M)
I.registered_name = M.real_name
I.name = "[M.real_name]'s Lifetime ID Card ([M.mind.role_alt_title ? M.mind.role_alt_title : M.mind.assigned_role])"
I.access = C.access
I.assignment = C.assignment
I.over_jumpsuit = C.over_jumpsuit
I.blood_type = C.blood_type
I.dna_hash = C.dna_hash
I.fingerprint_hash = C.fingerprint_hash
//
I.loc = C.loc
ok = 1
del(C)
break
if(M.ckey == "nerezza" && M.real_name == "Asher Spock") //This is an Odysseus Specialist ID
var/obj/item/weapon/card/id/I = Item
if(M.mind.role_alt_title && M.mind.role_alt_title == "Emergency Physician") //Only spawn if the character is an emergency physician.
for(var/obj/item/weapon/card/id/C in M)
I.registered_name = M.real_name
I.name = "[M.real_name]'s Odysseus Specialist ID Card ([M.mind.role_alt_title ? M.mind.role_alt_title : M.mind.assigned_role])"
I.access = C.access
I.access += list(ACCESS_ROBOTICS) //Station-based mecha pilots need this to access the recharge bay.
I.assignment = C.assignment
I.over_jumpsuit = C.over_jumpsuit
I.blood_type = C.blood_type
I.dna_hash = C.dna_hash
I.fingerprint_hash = C.fingerprint_hash
//
I.loc = C.loc
ok = 1
del(C)
break
else //Was not the right job position, gotta delete the custom item.
ok = 1
del(I)
else else
for(var/obj/item/weapon/storage/S in M.contents) // Try to place it in any item that can store stuff, on the mob. for(var/obj/item/weapon/storage/S in M.contents) // Try to place it in any item that can store stuff, on the mob.
if (S:len < S:storage_slots) if (S:len < S:storage_slots)
@@ -74,5 +66,6 @@
ok = 1 ok = 1
break break
skip:
if (ok == 0) // Finally, since everything else failed, place it on the ground if (ok == 0) // Finally, since everything else failed, place it on the ground
Item.loc = get_turf(M.loc) Item.loc = get_turf(M.loc)