Splits the primary organ checking into another function

Also fixes the head and brain renaming so it works off of DNA instead of
the body you took it of
This commit is contained in:
Crazylemon64
2015-12-17 22:42:28 -08:00
parent d63f1607c3
commit 860275f51d
4 changed files with 41 additions and 32 deletions
+16 -12
View File
@@ -256,21 +256,13 @@ var/list/organ_cache = list()
take_damage(0,3)
/obj/item/organ/proc/removed(var/mob/living/user)
var/primary_organ = 1
if(!istype(owner))
return
if(owner.internal_organs_by_name[organ_tag] == src)
if(is_primary_organ())
owner.internal_organs_by_name[organ_tag] = null
owner.internal_organs_by_name -= organ_tag
owner.internal_organs_by_name -= null
else if(istype(src,/obj/item/organ/external)) // Limbs being a subtype of internal organs is dumb
var/obj/item/organ/external/E = src
if(owner.organs_by_name[E.limb_name] != src)
primary_organ = 0
else
primary_organ = 0
owner.internal_organs_by_name -= null // uh what does this line even do this seems silly
owner.internal_organs -= src
@@ -284,7 +276,7 @@ var/list/organ_cache = list()
if(!organ_blood || !organ_blood.data["blood_DNA"])
owner.vessel.trans_to(src, 5, 1, 1)
if(owner && vital && primary_organ) // I'd do another check for species or whatever so that you couldn't "kill" an IPC by removing a human head from them, but it doesn't matter since they'll come right back from the dead
if(owner && vital && is_primary_organ()) // I'd do another check for species or whatever so that you couldn't "kill" an IPC by removing a human head from them, but it doesn't matter since they'll come right back from the dead
if(user)
user.attack_log += "\[[time_stamp()]\]<font color='red'> removed a vital organ ([src]) from [key_name(owner)] (INTENT: [uppertext(user.a_intent)])</font>"
owner.attack_log += "\[[time_stamp()]\]<font color='orange'> had a vital organ ([src]) removed by [key_name(user)] (INTENT: [uppertext(user.a_intent)])</font>"
@@ -336,4 +328,16 @@ var/list/organ_cache = list()
qdel(src)
/obj/item/organ/proc/surgeryize()
return
return
/*
Returns 1 if this is the organ that is handling all the functionalities of that particular organ slot
Returns 0 if it isn't
I use this so that this can be made better once the organ overhaul rolls out -- Crazylemon
*/
/obj/item/organ/proc/is_primary_organ(var/mob/living/carbon/human/O = null)
if (isnull(O))
O = owner
if (!istype(owner)) // You're not the primary organ of ANYTHING, bucko
return 0
return src == O.internal_organs_by_name[organ_tag]
+9 -1
View File
@@ -855,7 +855,8 @@ Note that amputating the affected organ does in fact remove the infection from t
release_restraints(victim)
victim.organs -= src
victim.organs_by_name[limb_name] = null // Remove from owner's vars.
if(is_primary_organ(victim))
victim.organs_by_name[limb_name] = null // Remove from owner's vars.
//Robotic limbs explode if sabotaged.
if(is_robotic && sabotaged)
@@ -885,3 +886,10 @@ Note that amputating the affected organ does in fact remove the infection from t
"\red <b>Your [name] melts away!</b>", \
"\red You hear a sickening sizzle.")
disfigured = 1
/obj/item/organ/external/is_primary_organ(var/mob/living/carbon/human/O = null)
if (isnull(O))
O = owner
if (!istype(O)) // You're not the primary organ of ANYTHING, bucko
return 0
return src == O.organs_by_name[limb_name]
+1 -1
View File
@@ -137,7 +137,7 @@
/obj/item/organ/external/head/removed()
if(owner)
name = "[owner.real_name]'s head"
name = "[dna.real_name]'s head"
owner.unEquip(owner.glasses)
owner.unEquip(owner.head)
owner.unEquip(owner.l_ear)