Replaces most instances of if(E & ORGAN_DESTROYED) with if(E.is_stump()). Fixes #11468

This commit is contained in:
mwerezak
2015-12-06 04:17:52 -05:00
parent 5de9314803
commit 9135a609cb
23 changed files with 48 additions and 145 deletions
+1 -1
View File
@@ -205,7 +205,7 @@
if(40 to INFINITY)
status += "peeling away"
if(org.status & ORGAN_DESTROYED)
if(org.is_stump())
status += "MISSING"
if(org.status & ORGAN_MUTATED)
status += "weirdly shapen"
@@ -269,7 +269,6 @@
var/list/organ_data = species.has_limbs[organ_tag]
var/organ_descriptor = organ_data["descriptor"]
is_destroyed["organ_descriptor"] = 1
var/obj/item/organ/external/E = organs_by_name[organ_tag]
if(!E)
@@ -277,15 +276,10 @@
else if(E.is_stump())
wound_flavor_text["[organ_descriptor]"] = "<span class='warning'><b>[t_He] has a stump where [t_his] [organ_descriptor] should be.</b></span>\n"
else
is_destroyed["organ_descriptor"] = 0
continue
for(var/obj/item/organ/external/temp in organs)
if(temp)
if(temp.status & ORGAN_DESTROYED)
is_destroyed["[temp.name]"] = 1
wound_flavor_text["[temp.name]"] = "<span class='warning'><b>[t_He] [t_is] missing [t_his] [temp.name].</b></span>\n"
continue
if(temp.status & ORGAN_ROBOT)
if(!(temp.brute_dam + temp.burn_dam))
if(!species.flags & IS_SYNTHETIC)
@@ -342,7 +342,7 @@
//Returns "Unknown" if facially disfigured and real_name if not. Useful for setting name when polyacided or when updating a human's name variable
/mob/living/carbon/human/proc/get_face_name()
var/obj/item/organ/external/head = get_organ("head")
if(!head || head.disfigured || (head.status & ORGAN_DESTROYED) || !real_name || (HUSK in mutations) ) //disfigured. use id-name if possible
if(!head || head.disfigured || head.is_stump() || !real_name || (HUSK in mutations) ) //disfigured. use id-name if possible
return "Unknown"
return real_name
@@ -119,7 +119,7 @@
var/hit_zone = H.zone_sel.selecting
var/obj/item/organ/external/affecting = get_organ(hit_zone)
if(!affecting || affecting.is_stump() || (affecting.status & ORGAN_DESTROYED))
if(!affecting || affecting.is_stump())
M << "<span class='danger'>They are missing that limb!</span>"
return 1
@@ -182,7 +182,6 @@ emp_act
if(!O) continue
O.emp_act(severity)
for(var/obj/item/organ/external/O in organs)
if(O.status & ORGAN_DESTROYED) continue
O.emp_act(severity)
for(var/obj/item/organ/I in O.internal_organs)
if(I.robotic == 0) continue
@@ -204,7 +203,7 @@ emp_act
var/obj/item/organ/external/affecting = get_organ(target_zone)
if (!affecting || (affecting.status & ORGAN_DESTROYED) || affecting.is_stump())
if (!affecting || affecting.is_stump())
user << "<span class='danger'>They are missing that limb!</span>"
return
@@ -28,7 +28,7 @@
if(istype(buckled, /obj/structure/bed/chair/wheelchair))
for(var/organ_name in list("l_hand","r_hand","l_arm","r_arm"))
var/obj/item/organ/external/E = get_organ(organ_name)
if(!E || (E.status & ORGAN_DESTROYED))
if(!E || E.is_stump())
tally += 4
if(E.status & ORGAN_SPLINTED)
tally += 0.5
@@ -40,7 +40,7 @@
for(var/organ_name in list("l_foot","r_foot","l_leg","r_leg"))
var/obj/item/organ/external/E = get_organ(organ_name)
if(!E || (E.status & ORGAN_DESTROYED))
if(!E || E.is_stump())
tally += 4
else if(E.status & ORGAN_SPLINTED)
tally += 0.5
@@ -70,7 +70,7 @@
for(var/limb_tag in list("l_leg","r_leg","l_foot","r_foot"))
var/obj/item/organ/external/E = organs_by_name[limb_tag]
if(!E || (E.status & (ORGAN_DESTROYED|ORGAN_DEAD)))
if(!E || (E.status & (ORGAN_MUTATED|ORGAN_DEAD)) || E.is_stump()) //should just be !E.is_usable() here but dislocation screws that up.
stance_damage += 2 // let it fail even if just foot&leg
else if (E.is_malfunctioning())
//malfunctioning only happens intermittently so treat it as a missing limb when it procs
@@ -33,7 +33,7 @@ This saves us from having to call add_fingerprint() any time something is put in
/mob/living/carbon/human/proc/has_organ(name)
var/obj/item/organ/external/O = organs_by_name[name]
return (O && !(O.status & ORGAN_DESTROYED) && !O.is_stump())
return (O && !O.is_stump())
/mob/living/carbon/human/proc/has_organ_for_slot(slot)
switch(slot)
@@ -221,15 +221,9 @@
O.organ_tag = organ_tag
H.internal_organs_by_name[organ_tag] = O
//These should be unnecessary
//for(var/name in H.organs_by_name)
// H.organs |= H.organs_by_name[name]
//for(var/obj/item/organ/external/O in H.organs)
// O.owner = H
if(flags & IS_SYNTHETIC)
for(var/obj/item/organ/external/E in H.organs)
if(E.status & ORGAN_CUT_AWAY || E.status & ORGAN_DESTROYED) continue
if(E.status & ORGAN_CUT_AWAY || E.is_stump()) continue
E.robotize()
for(var/obj/item/organ/I in H.internal_organs)
I.robotize()
@@ -18,11 +18,11 @@
// Check if they have a functioning hand.
var/obj/item/organ/external/E = user.organs_by_name["l_hand"]
if(E && !(E.status & ORGAN_DESTROYED))
if(E && !E.is_stump())
return 1
E = user.organs_by_name["r_hand"]
if(E && !(E.status & ORGAN_DESTROYED))
if(E && !E.is_stump())
return 1
return 0
@@ -170,11 +170,11 @@
return 0
var/obj/item/organ/external/E = user.organs_by_name["l_foot"]
if(E && !(E.status & ORGAN_DESTROYED))
if(E && !E.is_stump())
return 1
E = user.organs_by_name["r_foot"]
if(E && !(E.status & ORGAN_DESTROYED))
if(E && !E.is_stump())
return 1
return 0
@@ -214,11 +214,11 @@
if(target.grabbed_by == user && target.lying)
return 0
var/obj/item/organ/external/E = user.organs_by_name["l_foot"]
if(E && !(E.status & ORGAN_DESTROYED))
if(E && !E.is_stump())
return 1
E = user.organs_by_name["r_foot"]
if(E && !(E.status & ORGAN_DESTROYED))
if(E && !E.is_stump())
return 1
return 0
@@ -186,9 +186,10 @@ var/global/list/damage_icon_parts = list()
for(var/obj/item/organ/external/O in organs)
if(O.is_stump())
continue
if(O.status & ORGAN_DESTROYED) damage_appearance += "d"
else
damage_appearance += O.damage_state
//if(O.status & ORGAN_DESTROYED) damage_appearance += "d" //what is this?
//else
// damage_appearance += O.damage_state
damage_appearance += O.damage_state
if(damage_appearance == previous_damage_appearance)
// nothing to do here
@@ -204,20 +205,20 @@ var/global/list/damage_icon_parts = list()
for(var/obj/item/organ/external/O in organs)
if(O.is_stump())
continue
if(!(O.status & ORGAN_DESTROYED))
O.update_icon()
if(O.damage_state == "00") continue
var/icon/DI
var/cache_index = "[O.damage_state]/[O.icon_name]/[species.blood_color]/[species.get_bodytype()]"
if(damage_icon_parts[cache_index] == null)
DI = new /icon(species.damage_overlays, O.damage_state) // the damage icon for whole human
DI.Blend(new /icon(species.damage_mask, O.icon_name), ICON_MULTIPLY) // mask with this organ's pixels
DI.Blend(species.blood_color, ICON_MULTIPLY)
damage_icon_parts[cache_index] = DI
else
DI = damage_icon_parts[cache_index]
standing_image.overlays += DI
O.update_icon()
if(O.damage_state == "00") continue
var/icon/DI
var/cache_index = "[O.damage_state]/[O.icon_name]/[species.blood_color]/[species.get_bodytype()]"
if(damage_icon_parts[cache_index] == null)
DI = new /icon(species.damage_overlays, O.damage_state) // the damage icon for whole human
DI.Blend(new /icon(species.damage_mask, O.icon_name), ICON_MULTIPLY) // mask with this organ's pixels
DI.Blend(species.blood_color, ICON_MULTIPLY)
damage_icon_parts[cache_index] = DI
else
DI = damage_icon_parts[cache_index]
standing_image.overlays += DI
overlays_standing[DAMAGE_LAYER] = standing_image
@@ -257,7 +258,7 @@ var/global/list/damage_icon_parts = list()
for(var/organ_tag in species.has_limbs)
var/obj/item/organ/external/part = organs_by_name[organ_tag]
if(isnull(part) || part.is_stump() || (part.status & ORGAN_DESTROYED))
if(isnull(part) || part.is_stump())
icon_key += "0"
else if(part.status & ORGAN_ROBOT)
icon_key += "2[part.model ? "-[part.model]": ""]"
@@ -336,7 +337,7 @@ var/global/list/damage_icon_parts = list()
overlays_standing[HAIR_LAYER] = null
var/obj/item/organ/external/head/head_organ = get_organ("head")
if(!head_organ || head_organ.is_stump() || (head_organ.status & ORGAN_DESTROYED) )
if(!head_organ || head_organ.is_stump() )
if(update_icons) update_icons()
return
@@ -74,7 +74,7 @@
var/mob/living/carbon/human/H = M
var/obj/item/organ/external/E = H.organs_by_name["head"]
if(!E || (E.status & ORGAN_DESTROYED))
if(!E || E.is_stump())
src << "\The [H] does not have a head!"
if(!H.species.has_organ["brain"])
+1 -1
View File
@@ -3,7 +3,7 @@
var/obj/item/organ/external/E = H.get_organ(target_zone)
if(!E || (E.status & ORGAN_DESTROYED))
if(!E || E.is_stump())
user << "<span class='notice'>[H] is missing that bodypart.</span>"
return
+1 -1
View File
@@ -295,7 +295,7 @@
var/mob/living/carbon/human/driver = mob.buckled
var/obj/item/organ/external/l_hand = driver.get_organ("l_hand")
var/obj/item/organ/external/r_hand = driver.get_organ("r_hand")
if((!l_hand || (l_hand.status & ORGAN_DESTROYED)) && (!r_hand || (r_hand.status & ORGAN_DESTROYED)))
if((!l_hand || l_hand.is_stump()) && (!r_hand || r_hand.is_stump()))
return // No hands to drive your chair? Tough luck!
//drunk wheelchair driving
if(mob.confused)
-1
View File
@@ -216,7 +216,6 @@ var/list/organ_cache = list()
src.status &= ~ORGAN_SPLINTED
src.status &= ~ORGAN_CUT_AWAY
src.status &= ~ORGAN_ATTACHABLE
src.status &= ~ORGAN_DESTROYED
src.status |= ORGAN_ROBOT
src.status |= ORGAN_ASSISTED
+6 -16
View File
@@ -194,8 +194,6 @@
if((brute <= 0) && (burn <= 0))
return 0
if(status & ORGAN_DESTROYED)
return 0
if(status & ORGAN_ROBOT )
var/brmod = 0.66
@@ -431,15 +429,10 @@ This function completely restores a damaged organ to perfect condition.
/obj/item/organ/external/process()
if(owner)
//Dismemberment
if(status & ORGAN_DESTROYED)
if(config.limbs_can_break)
droplimb(0,DROPLIMB_EDGE) //Might be worth removing this check since take_damage handles it.
return
if(parent)
if(parent.status & ORGAN_DESTROYED)
status |= ORGAN_DESTROYED
owner.update_body(1)
return
//if(parent && parent.is_stump()) //should never happen
// warning("\The [src] ([src.type]) belonging to [owner] ([owner.type]) was attached to a stump")
// remove()
// return
// Process wounds, doing healing etc. Only do this every few ticks to save processing power
if(owner.life_tick % wound_update_accuracy == 0)
@@ -485,7 +478,7 @@ Note that amputating the affected organ does in fact remove the infection from t
*/
/obj/item/organ/external/proc/update_germs()
if(status & (ORGAN_ROBOT|ORGAN_DESTROYED) || (owner.species && owner.species.flags & IS_PLANT)) //Robotic limbs shouldn't be infected, nor should nonexistant limbs.
if(status & (ORGAN_ROBOT) || (owner.species && owner.species.flags & IS_PLANT)) //Robotic limbs shouldn't be infected, nor should nonexistant limbs.
germ_level = 0
return
@@ -657,8 +650,6 @@ Note that amputating the affected organ does in fact remove the infection from t
// new damage icon system
// returns just the brute/burn damage code
/obj/item/organ/external/proc/damage_state_text()
if(status & ORGAN_DESTROYED)
return "--"
var/tburn = 0
var/tbrute = 0
@@ -919,7 +910,7 @@ Note that amputating the affected organ does in fact remove the infection from t
return 0
/obj/item/organ/external/proc/is_usable()
return !is_dislocated() && !(status & (ORGAN_DESTROYED|ORGAN_MUTATED|ORGAN_DEAD))
return !is_dislocated() && !(status & (ORGAN_MUTATED|ORGAN_DEAD))
/obj/item/organ/external/proc/is_malfunctioning()
return ((status & ORGAN_ROBOT) && (brute_dam + burn_dam) >= 10 && prob(brute_dam + burn_dam))
@@ -947,7 +938,6 @@ Note that amputating the affected organ does in fact remove the infection from t
..()
status |= ORGAN_DESTROYED
victim.bad_external_organs -= src
for(var/atom/movable/implant in implants)
@@ -223,7 +223,7 @@
var/target_zone = ran_zone(check_zone(user.zone_sel.selecting, target))
var/obj/item/organ/external/affecting = H.get_organ(target_zone)
if (!affecting || (affecting.status & ORGAN_DESTROYED) || affecting.is_stump())
if (!affecting || affecting.is_stump())
user << "<span class='danger'>They are missing that limb!</span>"
return
+1 -3
View File
@@ -15,7 +15,7 @@
var/obj/item/organ/external/affected = target.get_organ(target_zone)
if (affected == null)
return 0
if (affected.status & ORGAN_DESTROYED)
if (affected.is_stump())
return 0
if (target_zone == "head" && target.species && (target.species.flags & IS_SYNTHETIC))
return 1
@@ -290,8 +290,6 @@
var/obj/item/organ/external/affected = target.get_organ(target_zone)
if (affected == null)
return 0
if (affected.status & ORGAN_DESTROYED)
return 0
return !affected.cannot_amputate
begin_step(mob/user, mob/living/carbon/human/target, target_zone, obj/item/tool)