Ports Bay's Robolimb Changes (#1779)

* Consolidates copypasta for repairing robolimbs

Also prevents self-repairing a limb you are using to hold the tool

* Fixes robot organs becoming undamagable after reaching cap

* Fixes repairing with cable not using any cable, repairing with weldingtool not doing eyecheck

* Removes ORGAN_ROBOT and ORGAN_ASSISTED flags, fixes #13123

* Fixes damage to robotic limbs not triggering organ processing

At the same time, robotic limbs with damage don't need to process.
However, it's much safer to explicitly have robot limbs return 0 from
needs_process() instead of not rechecking bad external organs.

* Build on HarpyEagle changes to apply to Polaris

Had to apply the change from flag to an enumeration.

* Removes unneeded file

* Fix bruisepacks, remove heart

Well, the unused bay version of the heart anyway

* Tweaks examine, reverts isSynthetic

Reverted that because Bay doesn't use it the same way. Also changed Examine to not list every robo-limb on non-FBPs in red, but left them listed as normal per Spookerton
This commit is contained in:
Arokha Sieyes
2016-05-28 09:12:19 -04:00
committed by Yoshax
parent 7835c89bec
commit ea6754597e
41 changed files with 204 additions and 223 deletions
+1 -1
View File
@@ -126,7 +126,7 @@ var/const/BLOOD_VOLUME_SURVIVE = 40
//Bleeding out
var/blood_max = 0
for(var/obj/item/organ/external/temp in organs)
if(!(temp.status & ORGAN_BLEEDING) || (temp.status & ORGAN_ROBOT))
if(!(temp.status & ORGAN_BLEEDING) || (temp.robotic >= ORGAN_ROBOT))
continue
for(var/datum/wound/W in temp.wounds) if(W.bleeding())
blood_max += W.damage / 40
+16 -14
View File
@@ -10,9 +10,10 @@ var/list/organ_cache = list()
var/parent_organ = BP_TORSO // Organ holding this object.
// Status tracking.
var/status = 0 // Various status flags (such as robotic)
var/status = 0 // Various status flags
var/vital // Lose a vital limb, die immediately.
var/damage = 0 // Current damage to the organ
var/robotic = 0
// Reference data.
var/mob/living/carbon/human/owner // Current mob owning the organ.
@@ -77,7 +78,7 @@ var/list/organ_cache = list()
blood_DNA[dna.unique_enzymes] = dna.b_type
/obj/item/organ/proc/die()
if(status & ORGAN_ROBOT)
if(robotic >= ORGAN_ROBOT)
return
damage = max_damage
status |= ORGAN_DEAD
@@ -99,7 +100,7 @@ var/list/organ_cache = list()
if(istype(loc,/obj/structure/closet/body_bag/cryobag) || istype(loc,/obj/structure/closet/crate/freezer) || istype(loc,/obj/item/weapon/storage/box/freezer))
return
//Process infections
if ((status & ORGAN_ROBOT) || (owner && owner.species && (owner.species.flags & IS_PLANT)))
if ((robotic >= ORGAN_ROBOT) || (owner && owner.species && (owner.species.flags & IS_PLANT)))
germ_level = 0
return
@@ -231,7 +232,7 @@ var/list/organ_cache = list()
//Note: external organs have their own version of this proc
/obj/item/organ/proc/take_damage(amount, var/silent=0)
if(src.status & ORGAN_ROBOT)
if(src.robotic >= ORGAN_ROBOT)
src.damage = between(0, src.damage + (amount * 0.8), max_damage)
else
src.damage = between(0, src.damage + amount, max_damage)
@@ -243,19 +244,20 @@ var/list/organ_cache = list()
owner.custom_pain("Something inside your [parent.name] hurts a lot.", 1)
/obj/item/organ/proc/robotize() //Being used to make robutt hearts, etc
status = 0
status |= ORGAN_ASSISTED
status |= ORGAN_ROBOT
robotic = ORGAN_ROBOT
src.status &= ~ORGAN_BROKEN
src.status &= ~ORGAN_BLEEDING
src.status &= ~ORGAN_SPLINTED
src.status &= ~ORGAN_CUT_AWAY
/obj/item/organ/proc/mechassist() //Used to add things like pacemakers, etc
status = 0
status |= ORGAN_ASSISTED
robotize()
robotic = ORGAN_ASSISTED
min_bruised_damage = 15
min_broken_damage = 35
/obj/item/organ/emp_act(severity)
if(!(status & ORGAN_ROBOT))
if(!(robotic >= ORGAN_ROBOT))
return
switch (severity)
if (1)
@@ -316,7 +318,7 @@ var/list/organ_cache = list()
/obj/item/organ/proc/bitten(mob/user)
if(status & ORGAN_ROBOT)
if(robotic >= ORGAN_ROBOT)
return
user << "<span class='notice'>You take an experimental bite out of \the [src].</span>"
@@ -342,9 +344,9 @@ var/list/organ_cache = list()
/obj/item/organ/attack_self(mob/user as mob)
// Convert it to an edible form, yum yum.
if(!(status & ORGAN_ROBOT) && user.a_intent == I_HELP && user.zone_sel.selecting == O_MOUTH)
if(!(robotic >= ORGAN_ROBOT) && user.a_intent == I_HELP && user.zone_sel.selecting == O_MOUTH)
bitten(user)
return
/obj/item/organ/proc/can_feel_pain()
return !(status & (ORGAN_ROBOT|ORGAN_DESTROYED)) && !(species.flags & NO_PAIN)
return !(robotic >= (ORGAN_ROBOT|ORGAN_DESTROYED)) && !(species.flags & NO_PAIN)
+77 -31
View File
@@ -92,7 +92,7 @@
return ..()
/obj/item/organ/external/emp_act(severity)
if(!(status & ORGAN_ROBOT))
if(!(robotic >= ORGAN_ROBOT))
return
switch (severity)
if (1)
@@ -225,7 +225,8 @@
****************************************************/
/obj/item/organ/external/proc/is_damageable(var/additional_damage = 0)
return (vital || brute_dam + burn_dam + additional_damage < max_damage)
//Continued damage to vital organs can kill you, and robot organs don't count towards total damage so no need to cap them.
return (vital || (robotic >= ORGAN_ROBOT) || brute_dam + burn_dam + additional_damage < max_damage)
/obj/item/organ/external/take_damage(brute, burn, sharp, edge, used_weapon = null, list/forbidden_limbs = list())
if((brute <= 0) && (burn <= 0))
@@ -243,12 +244,12 @@
brute -= brute / 2
if(status & ORGAN_BROKEN && prob(40) && brute)
if(!((species.flags & NO_PAIN) || (status & ORGAN_ROBOT)))
if(!((species.flags & NO_PAIN) || (robotic >= ORGAN_ROBOT)))
owner.emote("scream") //getting hit on broken hand hurts
if(used_weapon)
add_autopsy_data("[used_weapon]", brute + burn)
var/can_cut = (prob(brute*2) || sharp) && !(status & ORGAN_ROBOT)
var/can_cut = (prob(brute*2) || sharp) && (robotic < ORGAN_ROBOT)
// If the limbs can break, make sure we don't exceed the maximum damage a limb can take before breaking
// Non-vital organs are limited to max_damage. You can't kill someone by bludeonging their arm all the way to 200 -- you can
@@ -330,7 +331,7 @@
return update_icon()
/obj/item/organ/external/proc/heal_damage(brute, burn, internal = 0, robo_repair = 0)
if(status & ORGAN_ROBOT && !robo_repair)
if(robotic >= ORGAN_ROBOT && !robo_repair)
return
//Heal damage on the individual wounds
@@ -355,12 +356,57 @@
var/result = update_icon()
return result
//Helper proc used by various tools for repairing robot limbs
/obj/item/organ/external/proc/robo_repair(var/repair_amount, var/damage_type, var/damage_desc, obj/item/tool, mob/living/user)
if((src.robotic < ORGAN_ROBOT))
return 0
var/damage_amount
switch(damage_type)
if(BRUTE) damage_amount = brute_dam
if(BURN) damage_amount = burn_dam
else return 0
if(!damage_amount)
user << "<span class='notice'>Nothing to fix!</span>"
return 0
if(damage_amount >= ROBOLIMB_SELF_REPAIR_CAP)
user << "<span class='danger'>The damage is far too severe to patch over externally.</span>"
return 0
if(user == src.owner)
var/grasp
if(user.l_hand == tool && (src.body_part & (ARM_LEFT|HAND_LEFT)))
grasp = "l_hand"
else if(user.r_hand == tool && (src.body_part & (ARM_RIGHT|HAND_RIGHT)))
grasp = "r_hand"
if(grasp)
user << "<span class='warning'>You can't reach your [src.name] while holding [tool] in your [owner.get_bodypart_name(grasp)].</span>"
return 0
user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN)
if(!do_mob(user, owner, 10))
user << "<span class='warning'>You must stand still to do that.</span>"
return 0
switch(damage_type)
if(BRUTE) src.heal_damage(repair_amount, 0, 0, 1)
if(BURN) src.heal_damage(0, repair_amount, 0, 1)
if(user == src.owner)
user.visible_message("<span class='notice'>\The [user] patches [damage_desc] on \his [src.name] with [tool].</span>")
else
user.visible_message("<span class='notice'>\The [user] patches [damage_desc] on [owner]'s [src.name] with [tool].</span>")
return 1
/*
This function completely restores a damaged organ to perfect condition.
*/
/obj/item/organ/external/rejuvenate(var/ignore_prosthetic_prefs)
damage_state = "00"
status = 0
brute_dam = 0
burn_dam = 0
@@ -411,7 +457,7 @@ This function completely restores a damaged organ to perfect condition.
//moved this before the open_wound check so that having many small wounds for example doesn't somehow protect you from taking internal damage (because of the return)
//Possibly trigger an internal wound, too.
var/local_damage = brute_dam + burn_dam + damage
if(damage > 15 && type != BURN && local_damage > 30 && prob(damage) && !(status & ORGAN_ROBOT))
if(damage > 15 && type != BURN && local_damage > 30 && prob(damage) && (robotic < ORGAN_ROBOT))
var/datum/wound/internal_bleeding/I = new (min(damage - 15, 15))
wounds += I
owner.custom_pain("You feel something rip in your [name]!", 1)
@@ -429,7 +475,7 @@ This function completely restores a damaged organ to perfect condition.
var/datum/wound/W = pick(compatible_wounds)
W.open_wound(damage)
if(prob(25))
if(status & ORGAN_ROBOT)
if(robotic >= ORGAN_ROBOT)
owner.visible_message("<span class='danger'>The damage to [owner.name]'s [name] worsens.</span>",\
"<span class='danger'>The damage to your [name] worsens.</span>",\
"<span class='danger'>You hear the screech of abused metal.</span>")
@@ -467,7 +513,7 @@ This function completely restores a damaged organ to perfect condition.
/obj/item/organ/external/proc/need_process()
if(status & (ORGAN_CUT_AWAY|ORGAN_BLEEDING|ORGAN_BROKEN|ORGAN_DESTROYED|ORGAN_SPLINTED|ORGAN_DEAD|ORGAN_MUTATED))
return 1
if(brute_dam || burn_dam)
if((brute_dam || burn_dam) && (robotic < ORGAN_ROBOT)) //Robot limbs don't autoheal and thus don't need to process when damaged
return 1
if(last_dam != brute_dam + burn_dam) // Process when we are fully healed up.
last_dam = brute_dam + burn_dam
@@ -523,7 +569,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) || (owner.species && owner.species.flags & IS_PLANT)) //Robotic limbs shouldn't be infected, nor should nonexistant limbs.
if(robotic >= ORGAN_ROBOT || (owner.species && owner.species.flags & IS_PLANT)) //Robotic limbs shouldn't be infected, nor should nonexistant limbs.
germ_level = 0
return
@@ -581,12 +627,12 @@ Note that amputating the affected organ does in fact remove the infection from t
//spread the infection to child and parent organs
if (children)
for (var/obj/item/organ/external/child in children)
if (child.germ_level < germ_level && !(child.status & ORGAN_ROBOT))
if (child.germ_level < germ_level && (child.robotic < ORGAN_ROBOT))
if (child.germ_level < INFECTION_LEVEL_ONE*2 || prob(30))
child.germ_level++
if (parent)
if (parent.germ_level < germ_level && !(parent.status & ORGAN_ROBOT))
if (parent.germ_level < germ_level && (parent.robotic < ORGAN_ROBOT))
if (parent.germ_level < INFECTION_LEVEL_ONE*2 || prob(30))
parent.germ_level++
@@ -602,10 +648,10 @@ Note that amputating the affected organ does in fact remove the infection from t
//Updating wounds. Handles wound natural I had some free spachealing, internal bleedings and infections
/obj/item/organ/external/proc/update_wounds()
if((status & ORGAN_ROBOT)) //Robotic limbs don't heal or get worse.
for(var/datum/wound/W in wounds)
if(W.damage <= 0)
wounds -= W
if((robotic >= ORGAN_ROBOT)) //Robotic limbs don't heal or get worse.
for(var/datum/wound/W in wounds) //Repaired wounds disappear though
if(W.damage <= 0) //and they disappear right away
wounds -= W //TODO: robot wounds for robot limbs
return
for(var/datum/wound/W in wounds)
@@ -675,7 +721,7 @@ Note that amputating the affected organ does in fact remove the infection from t
else
brute_dam += W.damage
if(!(status & ORGAN_ROBOT) && W.bleeding() && (H && H.should_have_organ(O_HEART)))
if(!(robotic >= ORGAN_ROBOT) && W.bleeding() && (H && !H.should_have_organ(O_HEART)))
W.bleed_timer--
status |= ORGAN_BLEEDING
@@ -688,7 +734,7 @@ Note that amputating the affected organ does in fact remove the infection from t
status |= ORGAN_BLEEDING
//Bone fractures
if(config.bones_can_break && brute_dam > min_broken_damage * config.organ_health_multiplier && !(status & ORGAN_ROBOT))
if(config.bones_can_break && brute_dam > min_broken_damage * config.organ_health_multiplier && !(robotic >= ORGAN_ROBOT))
src.fracture()
// new damage icon system
@@ -742,7 +788,7 @@ Note that amputating the affected organ does in fact remove the infection from t
switch(disintegrate)
if(DROPLIMB_EDGE)
if(!clean)
var/gore_sound = "[(status & ORGAN_ROBOT) ? "tortured metal" : "ripping tendons and flesh"]"
var/gore_sound = "[(robotic >= ORGAN_ROBOT) ? "tortured metal" : "ripping tendons and flesh"]"
owner.visible_message(
"<span class='danger'>\The [owner]'s [src.name] flies off in an arc!</span>",\
"<span class='moderate'><b>Your [src.name] goes flying off!</b></span>",\
@@ -750,7 +796,7 @@ Note that amputating the affected organ does in fact remove the infection from t
if(DROPLIMB_BURN)
if(cannot_gib)
return
var/gore = "[(status & ORGAN_ROBOT) ? "": " of burning flesh"]"
var/gore = "[(robotic >= ORGAN_ROBOT) ? "": " of burning flesh"]"
owner.visible_message(
"<span class='danger'>\The [owner]'s [src.name] flashes away into ashes!</span>",\
"<span class='moderate'><b>Your [src.name] flashes away into ashes!</b></span>",\
@@ -758,8 +804,8 @@ Note that amputating the affected organ does in fact remove the infection from t
if(DROPLIMB_BLUNT)
if(cannot_gib)
return
var/gore = "[(status & ORGAN_ROBOT) ? "": " in shower of gore"]"
var/gore_sound = "[(status & ORGAN_ROBOT) ? "rending sound of tortured metal" : "sickening splatter of gore"]"
var/gore = "[(robotic >= ORGAN_ROBOT) ? "": " in shower of gore"]"
var/gore_sound = "[(status >= ORGAN_ROBOT) ? "rending sound of tortured metal" : "sickening splatter of gore"]"
owner.visible_message(
"<span class='danger'>\The [owner]'s [src.name] explodes[gore]!</span>",\
"<span class='moderate'><b>Your [src.name] explodes[gore]!</b></span>",\
@@ -781,7 +827,7 @@ Note that amputating the affected organ does in fact remove the infection from t
parent_organ.update_damages()
else
var/obj/item/organ/external/stump/stump = new (victim, 0, src)
if(status & ORGAN_ROBOT)
if(robotic >= ORGAN_ROBOT)
stump.robotize()
stump.wounds |= W
victim.organs |= stump
@@ -813,7 +859,7 @@ Note that amputating the affected organ does in fact remove the infection from t
qdel(src)
if(DROPLIMB_BLUNT)
var/obj/effect/decal/cleanable/blood/gibs/gore
if(status & ORGAN_ROBOT)
if(robotic >= ORGAN_ROBOT)
gore = new /obj/effect/decal/cleanable/blood/gibs/robot(get_turf(victim))
else
gore = new /obj/effect/decal/cleanable/blood/gibs(get_turf(victim))
@@ -920,7 +966,7 @@ Note that amputating the affected organ does in fact remove the infection from t
return rval
/obj/item/organ/external/proc/fracture()
if(status & ORGAN_ROBOT)
if(robotic >= ORGAN_ROBOT)
return //ORGAN_BROKEN doesn't have the same meaning for robot limbs
if((status & ORGAN_BROKEN) || cannot_break)
return
@@ -960,7 +1006,7 @@ Note that amputating the affected organ does in fact remove the infection from t
return
/obj/item/organ/external/proc/mend_fracture()
if(status & ORGAN_ROBOT)
if(robotic >= ORGAN_ROBOT)
return 0 //ORGAN_BROKEN doesn't have the same meaning for robot limbs
if(brute_dam > min_broken_damage * config.organ_health_multiplier)
return 0 //will just immediately fracture again
@@ -970,7 +1016,7 @@ Note that amputating the affected organ does in fact remove the infection from t
/obj/item/organ/external/robotize(var/company, var/skip_prosthetics = 0, var/keep_organs = 0)
if(status & ORGAN_ROBOT)
if(robotic >= ORGAN_ROBOT)
return
..()
@@ -1015,7 +1061,7 @@ Note that amputating the affected organ does in fact remove the infection from t
return 1
/obj/item/organ/external/proc/mutate()
if(src.status & ORGAN_ROBOT)
if(src.robotic >= ORGAN_ROBOT)
return
src.status |= ORGAN_MUTATED
if(owner) owner.update_body()
@@ -1037,7 +1083,7 @@ Note that amputating the affected organ does in fact remove the infection from t
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))
return ((robotic >= ORGAN_ROBOT) && (brute_dam + burn_dam) >= 10 && prob(brute_dam + burn_dam))
/obj/item/organ/external/proc/embed(var/obj/item/weapon/W, var/silent = 0)
if(!owner || loc != owner)
@@ -1057,7 +1103,7 @@ Note that amputating the affected organ does in fact remove the infection from t
if(!owner)
return
var/is_robotic = status & ORGAN_ROBOT
var/is_robotic = robotic >= ORGAN_ROBOT
var/mob/living/carbon/human/victim = owner
..()
@@ -1129,7 +1175,7 @@ Note that amputating the affected organ does in fact remove the infection from t
if(status & ORGAN_DESTROYED && !is_stump())
. += "tear at [amputation_point] so severe that it hangs by a scrap of flesh"
if(status & ORGAN_ROBOT)
if(robotic >= ORGAN_ROBOT)
if(brute_dam)
switch(brute_dam)
if(0 to 20)
+3 -3
View File
@@ -16,7 +16,7 @@ var/global/list/limb_icon_cache = list()
s_tone = null
s_col = null
h_col = null
if(status & ORGAN_ROBOT)
if(robotic >= ORGAN_ROBOT)
return
if(species && human.species && species.name != human.species.name)
return
@@ -30,7 +30,7 @@ var/global/list/limb_icon_cache = list()
s_tone = null
s_col = null
h_col = null
if(status & ORGAN_ROBOT)
if(robotic >= ORGAN_ROBOT)
return
if(!isnull(dna.GetUIValue(DNA_UI_SKIN_TONE)) && (species.appearance_flags & HAS_SKIN_TONE))
s_tone = dna.GetUIValue(DNA_UI_SKIN_TONE)
@@ -110,7 +110,7 @@ var/global/list/limb_icon_cache = list()
if(skeletal)
mob_icon = new /icon('icons/mob/human_races/r_skeleton.dmi', "[icon_name][gender ? "_[gender]" : ""]")
else if (status & ORGAN_ROBOT)
else if (robotic >= ORGAN_ROBOT)
mob_icon = new /icon('icons/mob/human_races/robotic.dmi', "[icon_name][gender ? "_[gender]" : ""]")
else
mob_icon = new /icon(species.get_icobase(owner, (status & ORGAN_MUTATED)), "[icon_name][gender ? "_[gender]" : ""]")
+1 -1
View File
@@ -14,7 +14,7 @@
..(holder, internal)
if(istype(limb))
max_damage = limb.max_damage
if((limb.status & ORGAN_ROBOT) && (!parent || (parent.status & ORGAN_ROBOT)))
if((limb.robotic >= ORGAN_ROBOT) && (!parent || (parent.robotic >= ORGAN_ROBOT)))
robotize() //if both limb and the parent are robotic, the stump is robotic too
/obj/item/organ/external/stump/is_stump()
+2 -2
View File
@@ -82,7 +82,7 @@ mob/living/carbon/human/proc/handle_pain()
var/maxdam = 0
var/obj/item/organ/external/damaged_organ = null
for(var/obj/item/organ/external/E in organs)
if(E.status & (ORGAN_DEAD|ORGAN_ROBOT)) continue
if((E.status & ORGAN_DEAD) || E.robotic >= ORGAN_ROBOT) continue
var/dam = E.get_damage()
// make the choice of the organ depend on damage,
// but also sometimes use one of the less damaged ones
@@ -94,7 +94,7 @@ mob/living/carbon/human/proc/handle_pain()
// Damage to internal organs hurts a lot.
for(var/obj/item/organ/I in internal_organs)
if(I.status & (ORGAN_DEAD|ORGAN_ROBOT)) continue
if((I.status & ORGAN_DEAD) || I.robotic >= ORGAN_ROBOT) continue
if(I.damage > 2) if(prob(2))
var/obj/item/organ/external/parent = get_organ(I.parent_organ)
src.custom_pain("You feel a sharp pain in your [parent.name]", 1)
+2 -2
View File
@@ -126,7 +126,7 @@
//DIONA ORGANS.
/obj/item/organ/external/diona/removed()
if(status & ORGAN_ROBOT)
if(robotic >= ORGAN_ROBOT)
return ..()
var/mob/living/carbon/human/H = owner
..()
@@ -142,7 +142,7 @@
organ_tag = "special" // Turns into a nymph instantly, no transplanting possible.
/obj/item/organ/internal/diona/removed(var/mob/living/user, var/skip_nymph)
if(status & ORGAN_ROBOT)
if(robotic >= ORGAN_ROBOT)
return ..()
var/mob/living/carbon/human/H = owner
..()