replaces all mentions of bodypart_robotic with is_robotic_limb() where possible, adds BODYPART_HYBRID, adds helpers for organic / robotic limbs (is_robotic_limb() / is_organic_limb(), with a arg to override it accepting hybrid limbs)
Also makes the the surgery to heal robotic limbs work if the torso isn't a robot, but rather if there are robotic bodyparts, makes the IPC brain repair.. only accept IPC brains (obviously), makes the damage threshholds for robo-limbs vars instead of a fix 25 with hybrid ones predefined at 25 / 15 (trigger / mindamage), adds an error message to fixing them if already at theshhold, etc. Now just for replacing BODYPART_ORGANIC with is_organic_limb aswell where applicable.. also actual values for the other robo limbs. Fun!
This commit is contained in:
DeltaFire
2020-10-06 17:34:13 +02:00
parent 655d505316
commit 4146566af0
33 changed files with 157 additions and 90 deletions
+51 -17
View File
@@ -71,7 +71,12 @@
var/medium_burn_msg = "blistered"
var/heavy_burn_msg = "peeling away"
var/render_like_organic = FALSE // forces limb to render as if it were an organic limb
//Some special vars for robotic bodyparts, in the base type to prevent needing typecasting / fancy checks.
var/easy_heal_threshhold = -1 //If greater or equal to zero, if limb damage of a type passes this threshhold, it cannot be healed beyond threshhold_passed_mindamage. Only needed for robotic limbs, but is in the basetype to prevent needing spaghetti-checks.
var/threshhold_passed_mindamage = 0 //If the threshhold got passed, what is the minimum damage this limb can be healed to? Loses the threshhold-passed state healing is started while below mindamage.
var/threshhold_brute_passed = FALSE
var/threshhold_burn_passed = FALSE //Ugly but neccessary vars that might get replaced with a flag lateron maybe sometime.
/// The wounds currently afflicting this body part
var/list/wounds
@@ -143,7 +148,7 @@
/obj/item/bodypart/throw_impact(atom/hit_atom, datum/thrownthing/throwingdatum)
..()
if(status != BODYPART_ROBOTIC)
if(!is_robotic_limb())
playsound(get_turf(src), 'sound/misc/splort.ogg', 50, 1, -1)
pixel_x = rand(-3, 3)
pixel_y = rand(-3, 3)
@@ -151,7 +156,7 @@
//empties the bodypart from its organs and other things inside it
/obj/item/bodypart/proc/drop_organs(mob/user)
var/turf/T = get_turf(src)
if(status != BODYPART_ROBOTIC)
if(!is_robotic_limb())
playsound(T, 'sound/misc/splort.ogg', 50, 1, -1)
if(current_gauze)
QDEL_NULL(current_gauze)
@@ -458,10 +463,10 @@
//Cannot remove negative damage (i.e. apply damage)
/obj/item/bodypart/proc/heal_damage(brute, burn, stamina, only_robotic = FALSE, only_organic = TRUE, updating_health = TRUE)
if(only_robotic && status != BODYPART_ROBOTIC) //This makes organic limbs not heal when the proc is in Robotic mode.
if(only_robotic && !is_robotic_limb()) //This makes organic limbs not heal when the proc is in Robotic mode.
return
if(only_organic && status != BODYPART_ORGANIC) //This makes robolimbs not healable by chems.
if(only_organic && !is_organic_limb(FALSE)) //This makes robolimbs and hybridlimbs not healable by chems.
return
brute_dam = round(max(brute_dam - brute, 0), DAMAGE_PRECISION)
@@ -503,7 +508,7 @@
if(!last_maxed)
owner.emote("scream")
last_maxed = TRUE
if(!is_organic_limb() || stamina_dam >= max_damage)
if(!is_organic_limb(FALSE) || stamina_dam >= max_damage)
return BODYPART_DISABLED_DAMAGE
else if(disabled && (get_damage(TRUE) <= (max_damage * 0.8))) // reenabled at 80% now instead of 50% as of wounds update
last_maxed = FALSE
@@ -545,7 +550,8 @@
return FALSE
//Change organ status
/obj/item/bodypart/proc/change_bodypart_status(new_limb_status, heal_limb, change_icon_to_default)
/obj/item/bodypart/proc/change_bodypart_status(new_limb_status, heal_limb, change_icon_to_default, no_update = FALSE)
var/old_status = status
status = new_limb_status
if(heal_limb)
burn_dam = 0
@@ -553,20 +559,48 @@
brutestate = 0
burnstate = 0
if(status == BODYPART_HYBRID)
easy_heal_threshhold = HYBRID_BODYPART_DAMAGE_THRESHHOLD
threshhold_passed_mindamage = HYBRID_BODYPART_THESHHOLD_MINDAMAGE
else if(old_status == BODYPART_HYBRID)
easy_heal_threshhold = initial(easy_heal_threshhold)
threshhold_passed_mindamage = initial(threshhold_passed_mindamage)
update_threshhold_state()
if(change_icon_to_default)
if(status == BODYPART_ORGANIC)
if(is_organic_limb())
icon = base_bp_icon || DEFAULT_BODYPART_ICON_ORGANIC
else if(status == BODYPART_ROBOTIC)
else if(is_robotic_limb(FALSE))
icon = base_bp_icon || DEFAULT_BODYPART_ICON_ROBOTIC
if(owner)
if(owner && !no_update) //Only use no_update if you are sure the bodypart will get updated from other sources anyways, to prevent unneccessary processing use.
owner.updatehealth()
owner.update_body() //if our head becomes robotic, we remove the lizard horns and human hair.
owner.update_hair()
owner.update_damage_overlays()
/obj/item/bodypart/proc/is_organic_limb()
return (status == BODYPART_ORGANIC)
/obj/item/bodypart/proc/is_organic_limb(hybrid_allowed = TRUE)
if(!hybrid_allowed)
return (status == BODYPART_ORGANIC)
return ((status == BODYPART_ORGANIC) || (status == BODYPART_HYBRID)) //Goodbye if(B.status == BODYPART_ORGANIC || B.status == BODYPART_HYBRID)
/obj/item/bodypart/proc/is_robotic_limb(hybrid_allowed = TRUE)
if(!hybrid_allowed)
return (status == BODYPART_ROBOTIC)
return ((status == BODYPART_ROBOTIC) || (status == BODYPART_HYBRID))
/obj/item/bodypart/proc/update_threshhold_state(brute = TRUE, burn = TRUE)
if(brute)
if(brute_dam < threshhold_passed_mindamage || easy_heal_threshhold < 0)
threshhold_brute_passed = FALSE
else if(brute_dam >= easy_heal_threshhold)
threshhold_brute_passed = TRUE
if(burn)
if(burn_dam < threshhold_passed_mindamage || easy_heal_threshhold < 0)
threshhold_burn_passed = FALSE
else if(burn_dam >= easy_heal_threshhold)
threshhold_burn_passed = TRUE
//we inform the bodypart of the changes that happened to the owner, or give it the informations from a source mob.
/obj/item/bodypart/proc/update_limb(dropping_limb, mob/living/carbon/source)
@@ -581,7 +615,7 @@
C = owner
no_update = FALSE
if(HAS_TRAIT(C, TRAIT_HUSK) && (is_organic_limb() || render_like_organic))
if(HAS_TRAIT(C, TRAIT_HUSK) && is_organic_limb())
species_id = "husk" //overrides species_id
dmg_overlay_type = "" //no damage overlay shown when husked
should_draw_gender = FALSE
@@ -672,9 +706,9 @@
else if(animal_origin == MONKEY_BODYPART) //currently monkeys are the only non human mob to have damage overlays.
dmg_overlay_type = animal_origin
if(status == BODYPART_ROBOTIC)
if(is_robotic_limb())
dmg_overlay_type = "robotic"
if(!render_like_organic)
if(is_robotic_limb(FALSE))
body_markings = null
aux_marking = null
@@ -728,7 +762,7 @@
. += limb
if(animal_origin)
if(is_organic_limb())
if(is_organic_limb(FALSE))
limb.icon = 'icons/mob/animal_parts.dmi'
if(species_id == "husk")
limb.icon_state = "[animal_origin]_husk_[body_zone]"
@@ -742,7 +776,7 @@
if((body_zone != BODY_ZONE_HEAD && body_zone != BODY_ZONE_CHEST))
should_draw_gender = FALSE
if(is_organic_limb() || render_like_organic)
if(is_organic_limb())
limb.icon = base_bp_icon || 'icons/mob/human_parts.dmi'
if(should_draw_gender)
limb.icon_state = "[species_id]_[body_zone]_[icon_gender]"
@@ -435,7 +435,6 @@
var/datum/wound/loss/phantom_loss = new // stolen valor, really
scaries.generate(L, phantom_loss)
if(HAS_TRAIT(src, ROBOTIC_LIMBS)) //Snowflake trait moment, but needed.
L.render_like_organic = TRUE
L.change_bodypart_status(BODYPART_ROBOTIC, FALSE, TRUE) //Haha what if IPC-lings actually regenerated the right limbs instead of organic ones? That'd be pretty cool, right?
L.change_bodypart_status(BODYPART_HYBRID, FALSE, TRUE) //Haha what if IPC-lings actually regenerated the right limbs instead of organic ones? That'd be pretty cool, right?
L.attach_limb(src, 1)
return TRUE
+2 -2
View File
@@ -45,7 +45,7 @@
/obj/item/bodypart/head/drop_organs(mob/user)
var/turf/T = get_turf(src)
if(status != BODYPART_ROBOTIC)
if(!is_robotic_limb())
playsound(T, 'sound/misc/splort.ogg', 50, 1, -1)
for(var/obj/item/I in src)
if(I == brain)
@@ -141,7 +141,7 @@
. = ..()
if(dropped) //certain overlays only appear when the limb is being detached from its owner.
if(status != BODYPART_ROBOTIC) //having a robotic head hides certain features.
if(!is_robotic_limb(FALSE)) //having a robotic head hides certain features.
//facial hair
if(facial_hair_style)
var/datum/sprite_accessory/S = GLOB.facial_hair_styles_list[facial_hair_style]
+21 -5
View File
@@ -26,8 +26,16 @@
if(affecting)
if(!S.requires_bodypart)
continue
if(S.requires_bodypart_type && affecting.status != S.requires_bodypart_type)
continue
if(S.requires_bodypart_type) //ugly but it'll do.
if(S.requires_bodypart_type == BODYPART_ORGANIC)
if(!affecting.is_organic_limb(FALSE))
continue
else if(S.requires_bodypart_type == BODYPART_ROBOTIC)
if(!affecting.is_robotic_limb())
continue
else if(S.requires_bodypart_type == BODYPART_HYBRID)
if(!affecting.is_organic_limb() || !affecting.is_robotic_limb())
continue
if(S.requires_real_bodypart && affecting.is_pseudopart)
continue
else if(C && S.requires_bodypart) //mob with no limb in surgery zone when we need a limb
@@ -58,8 +66,16 @@
if(affecting)
if(!S.requires_bodypart)
return
if(S.requires_bodypart_type && affecting.status != S.requires_bodypart_type)
return
if(S.requires_bodypart_type) //*scream
if(S.requires_bodypart_type == BODYPART_ORGANIC)
if(!affecting.is_organic_limb(FALSE))
return
else if(S.requires_bodypart_type == BODYPART_ROBOTIC)
if(!affecting.is_robotic_limb())
return
else if(S.requires_bodypart_type == BODYPART_HYBRID)
if(!affecting.is_organic_limb() || !affecting.is_robotic_limb())
return
else if(C && S.requires_bodypart)
return
if(S.lying_required && !(M.lying))
@@ -91,7 +107,7 @@
else if(S.can_cancel)
var/required_tool_type = TOOL_CAUTERY
var/obj/item/close_tool = user.get_inactive_held_item()
var/is_robotic = S.requires_bodypart_type == BODYPART_ROBOTIC
var/is_robotic = (S.requires_bodypart_type == BODYPART_ROBOTIC || S.requires_bodypart_type == BODYPART_HYBRID)
if(is_robotic)
required_tool_type = TOOL_SCREWDRIVER
if(iscyborg(user))
+1 -1
View File
@@ -10,7 +10,7 @@
if(istype(tool, /obj/item/organ_storage) && istype(tool.contents[1], /obj/item/bodypart))
tool = tool.contents[1]
var/obj/item/bodypart/aug = tool
if(aug.status != BODYPART_ROBOTIC)
if(aug.is_robotic_limb())
to_chat(user, "<span class='warning'>That's not an augment, silly!</span>")
return -1
if(aug.body_zone != target_zone)
@@ -29,10 +29,10 @@
if(istype(tool, /obj/item/bodypart))
var/obj/item/bodypart/BP = tool
if(ismonkey(target))// monkey patient only accept organic monkey limbs
if(BP.status == BODYPART_ROBOTIC || BP.animal_origin != MONKEY_BODYPART)
if(BP.is_robotic_limb() || BP.animal_origin != MONKEY_BODYPART)
to_chat(user, "<span class='warning'>[BP] doesn't match the patient's morphology.</span>")
return -1
if(BP.status != BODYPART_ROBOTIC)
if(!BP.is_robotic_limb())
organ_rejection_dam = 10
if(ishuman(target))
if(BP.animal_origin)
+4 -2
View File
@@ -10,7 +10,7 @@
target_mobtypes = list(/mob/living/carbon/human, /mob/living/carbon/monkey)
possible_locs = list(BODY_ZONE_HEAD)
requires_bodypart_type = BODYPART_ROBOTIC
requires_bodypart_type = 0
desc = "A surgical procedure that restores the default behavior logic and personality matrix of an IPC posibrain."
/datum/surgery_step/fix_robot_brain
@@ -19,8 +19,10 @@
time = 120 //long and complicated
/datum/surgery/robot_brain_surgery/can_start(mob/user, mob/living/carbon/target, obj/item/tool)
if(!..())
return FALSE
var/obj/item/organ/brain/B = target.getorganslot(ORGAN_SLOT_BRAIN)
if(!B)
if(!B || !istype(B, /obj/item/organ/brain/ipc)) //No cheating!
return FALSE
return TRUE
+13 -1
View File
@@ -12,7 +12,7 @@
target_mobtypes = list(/mob/living/carbon/human, /mob/living/carbon/monkey)
possible_locs = list(BODY_ZONE_CHEST)
requires_bodypart_type = BODYPART_ROBOTIC
requires_bodypart_type = 0 //You can do this on anyone, but it won't really be useful on people without augments.
ignore_clothes = TRUE
var/antispam = FALSE
var/healing_step_type = /datum/surgery_step/robot_heal/basic
@@ -42,6 +42,18 @@
return FALSE
return TRUE
/datum/surgery/robot_brain_surgery/can_start(mob/user, mob/living/carbon/target, obj/item/tool)
if(!..())
return FALSE
var/possible = FALSE
for(var/obj/item/bodypart/B in target.bodyparts)
if(B.is_robotic_limb())
possible = TRUE
break
if(!possible)
return FALSE
return TRUE
/datum/surgery_step/robot_heal/preop(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
var/woundtype
if(implement_type == TOOL_WELDER)