Fixes up a few Destroys

This commit is contained in:
Fox-McCloud
2015-09-18 04:20:02 -04:00
parent 6a79ff83a1
commit 74565c101b
16 changed files with 127 additions and 21 deletions
+20
View File
@@ -22,6 +22,26 @@ var/list/organ_cache = list()
// links chemical IDs to number of ticks for which they'll stay in the blood
germ_level = 0
/obj/item/organ/Destroy()
if(!owner)
return ..()
if(istype(owner, /mob/living/carbon))
if((owner.internal_organs) && (src in owner.internal_organs))
owner.internal_organs -= src
if(istype(owner, /mob/living/carbon/human))
if((owner.internal_organs_by_name) && (src in owner.internal_organs_by_name))
owner.internal_organs_by_name -= src
if((owner.organs) && (src in owner.organs))
owner.organs -= src
if((owner.organs_by_name) && (src in owner.organs_by_name))
owner.organs_by_name -= src
if(src in owner.contents)
owner.contents -= src
return ..()
/obj/item/organ/attack_self(mob/user as mob)
// Convert it to an edible form, yum yum.
+23 -10
View File
@@ -7,10 +7,10 @@
max_damage = 0
dir = SOUTH
organ_tag = "limb"
var/brute_mod = 1
var/burn_mod = 1
var/icon_name = null
var/body_part = null
var/icon_position = 0
@@ -61,6 +61,19 @@
var/can_grasp
var/can_stand
/obj/item/organ/external/Destroy()
if(parent && parent.children)
parent.children -= src
if(children)
for(var/obj/item/organ/external/C in children)
qdel(C)
if(internal_organs)
for(var/obj/item/organ/O in internal_organs)
qdel(O)
return ..()
/obj/item/organ/external/attackby(obj/item/weapon/W as obj, mob/user as mob)
switch(stage)
@@ -120,7 +133,7 @@
if(!parent.children)
parent.children = list()
parent.children.Add(src)
/obj/item/organ/external/robotize()
..()
//robot limbs take reduced damage
@@ -137,7 +150,7 @@
if(status & ORGAN_DESTROYED)
return 0
brute *= brute_mod
burn *= burn_mod
@@ -311,7 +324,7 @@ This function completely restores a damaged organ to perfect condition.
"<span class='alert'>The wound on your [name] widens with a nasty ripping noise.</span>",\
"You hear a nasty ripping noise, as if flesh is being torn apart.")
return
//Creating wound
var/wound_type = get_wound_type(type, damage)
@@ -536,8 +549,8 @@ Note that amputating the affected organ does in fact remove the infection from t
var/mob/living/carbon/human/H
if(istype(owner,/mob/living/carbon/human))
H = owner
H = owner
for(var/datum/wound/W in wounds)
if(W.damage_type == CUT || W.damage_type == BRUISE)
brute_dam += W.damage
@@ -554,7 +567,7 @@ Note that amputating the affected organ does in fact remove the infection from t
if (open && !clamped && (H && !(H.species.flags & NO_BLOOD)))
status |= ORGAN_BLEEDING
//Bone fractures
if(config.bones_can_break && brute_dam > min_broken_damage * config.organ_health_multiplier && !(status & ORGAN_ROBOT))
src.fracture()
@@ -723,7 +736,7 @@ Note that amputating the affected organ does in fact remove the infection from t
/obj/item/organ/external/proc/fracture()
if(status & ORGAN_ROBOT)
return //ORGAN_BROKEN doesn't have the same meaning for robot limbs
if((status & ORGAN_BROKEN) || cannot_break)
return
if(owner)
@@ -787,7 +800,7 @@ Note that amputating the affected organ does in fact remove the infection from t
/obj/item/organ/external/proc/is_usable()
if((status & ORGAN_ROBOT) && get_damage() >= max_damage) //robot limbs just become inoperable at max damage
return
return
return !(status & (ORGAN_DESTROYED|ORGAN_MUTATED|ORGAN_DEAD))
/obj/item/organ/external/proc/is_malfunctioning()