Merge pull request #13528 from DeltaFire15/robotic-limbs-PT2

Robotic limbs 2 : Threshhold Boogaloo
This commit is contained in:
silicons
2020-10-11 17:33:00 -07:00
committed by GitHub
43 changed files with 208 additions and 109 deletions
+53 -19
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 && !silent)
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(FALSE))
icon = base_bp_icon || DEFAULT_BODYPART_ICON_ORGANIC
else if(status == BODYPART_ROBOTIC)
else if(is_robotic_limb())
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
@@ -675,9 +709,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
@@ -714,7 +748,7 @@
if(burnstate)
. += image('icons/mob/dam_mob.dmi', "[dmg_overlay_type]_[body_zone]_0[burnstate]", -DAMAGE_LAYER, image_dir)
if(!isnull(body_markings) && status == BODYPART_ORGANIC)
if(!isnull(body_markings) && is_organic_limb(FALSE))
if(!use_digitigrade)
if(body_zone == BODY_ZONE_CHEST)
. += image(body_markings_icon, "[body_markings]_[body_zone]_[icon_gender]", -MARKING_LAYER, image_dir)
@@ -731,7 +765,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]"
@@ -745,7 +779,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]"
@@ -891,7 +925,7 @@
update_disabled()
/obj/item/bodypart/proc/get_bleed_rate()
if(status != BODYPART_ORGANIC) // maybe in the future we can bleed oil from aug parts, but not now
if(!is_organic_limb()) // maybe in the future we can bleed oil from aug parts, but not now
return
var/bleed_rate = 0
if(generic_bleedstacks > 0)
@@ -436,6 +436,5 @@
scaries.generate(L, phantom_loss)
L.attach_limb(src, 1)
if(ROBOTIC_LIMBS in dna.species.species_traits) //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?
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]
@@ -22,6 +22,8 @@
brute_reduction = 2
burn_reduction = 1
easy_heal_threshhold = 35 //Resistant against damage, but high mindamage once the threshhold is passed
threshhold_passed_mindamage = 25
light_brute_msg = ROBOTIC_LIGHT_BRUTE_MSG
medium_brute_msg = ROBOTIC_MEDIUM_BRUTE_MSG
@@ -43,6 +45,8 @@
brute_reduction = 2
burn_reduction = 1
easy_heal_threshhold = 35 //Resistant against damage, but high mindamage once the threshhold is passed
threshhold_passed_mindamage = 25
light_brute_msg = ROBOTIC_LIGHT_BRUTE_MSG
medium_brute_msg = ROBOTIC_MEDIUM_BRUTE_MSG
@@ -64,6 +68,8 @@
brute_reduction = 2
burn_reduction = 1
easy_heal_threshhold = 35 //Resistant against damage, but high mindamage once the threshhold is passed
threshhold_passed_mindamage = 25
light_brute_msg = ROBOTIC_LIGHT_BRUTE_MSG
medium_brute_msg = ROBOTIC_MEDIUM_BRUTE_MSG
@@ -85,6 +91,8 @@
brute_reduction = 2
burn_reduction = 1
easy_heal_threshhold = 35 //Resistant against damage, but high mindamage once the threshhold is passed
threshhold_passed_mindamage = 25
light_brute_msg = ROBOTIC_LIGHT_BRUTE_MSG
medium_brute_msg = ROBOTIC_MEDIUM_BRUTE_MSG
@@ -105,6 +113,8 @@
brute_reduction = 2
burn_reduction = 1
easy_heal_threshhold = 40 //Resistant against damage, but high mindamage once the threshhold is passed
threshhold_passed_mindamage = 25
light_brute_msg = ROBOTIC_LIGHT_BRUTE_MSG
medium_brute_msg = ROBOTIC_MEDIUM_BRUTE_MSG
@@ -166,6 +176,8 @@
brute_reduction = 5
burn_reduction = 4
easy_heal_threshhold = 40 //Resistant against damage, but high mindamage once the threshhold is passed
threshhold_passed_mindamage = 20
light_brute_msg = ROBOTIC_LIGHT_BRUTE_MSG
medium_brute_msg = ROBOTIC_MEDIUM_BRUTE_MSG
@@ -242,6 +254,8 @@
brute_reduction = 0
burn_reduction = 0
max_damage = 20
easy_heal_threshhold = 15 //Weak. Low threshhold, but also relatively low mindamage
threshhold_passed_mindamage = 10
/obj/item/bodypart/r_arm/robot/surplus
name = "surplus prosthetic right arm"
@@ -250,6 +264,8 @@
brute_reduction = 0
burn_reduction = 0
max_damage = 20
easy_heal_threshhold = 15 //Weak. Low threshhold, but also relatively low mindamage
threshhold_passed_mindamage = 10
/obj/item/bodypart/l_leg/robot/surplus
name = "surplus prosthetic left leg"
@@ -258,6 +274,8 @@
brute_reduction = 0
burn_reduction = 0
max_damage = 20
easy_heal_threshhold = 15 //Weak. Low threshhold, but also relatively low mindamage
threshhold_passed_mindamage = 10
/obj/item/bodypart/r_leg/robot/surplus
name = "surplus prosthetic right leg"
@@ -266,39 +284,49 @@
brute_reduction = 0
burn_reduction = 0
max_damage = 20
easy_heal_threshhold = 15 //Weak. Low threshhold, but also relatively low mindamage
threshhold_passed_mindamage = 10
// Upgraded Surplus lims - Better then robotic lims
// Upgraded Surplus lims - Better then robotic limbs
/obj/item/bodypart/l_arm/robot/surplus_upgraded
name = "reinforced surplus prosthetic left arm"
desc = "A skeletal, robotic limb. This one is reinforced to provide better protection, and is made of stronger parts."
desc = "A skeletal, robotic limb. This one is reinforced to provide better protection, and is made of parts with more fallbacks against internal damage."
icon = 'icons/mob/augmentation/surplus_augments.dmi'
brute_reduction = 3
burn_reduction = 2
max_damage = 55
easy_heal_threshhold = 20 //Lower threshhold than true robotic limbs, but very low mindamage too.
threshhold_passed_mindamage = 5
/obj/item/bodypart/r_arm/robot/surplus_upgraded
name = "reinforced surplus prosthetic right arm"
desc = "A skeletal, robotic limb. This one is reinforced to provide better protection, and is made of stronger parts."
desc = "A skeletal, robotic limb. This one is reinforced to provide better protection, and is made of parts with more fallbacks against internal damage."
icon = 'icons/mob/augmentation/surplus_augments.dmi'
brute_reduction = 3
burn_reduction = 2
max_damage = 55
easy_heal_threshhold = 20 //Lower threshhold than true robotic limbs, but very low mindamage too.
threshhold_passed_mindamage = 5
/obj/item/bodypart/l_leg/robot/surplus_upgraded
name = "reinforced surplus prosthetic left leg"
desc = "A skeletal, robotic limb. This one is reinforced to provide better protection, and is made of stronger parts."
desc = "A skeletal, robotic limb. This one is reinforced to provide better protection, and is made of parts with more fallbacks against internal damage."
icon = 'icons/mob/augmentation/surplus_augments.dmi'
brute_reduction = 3
burn_reduction = 2
max_damage = 55
easy_heal_threshhold = 20 //Lower threshhold than true robotic limbs, but very low mindamage too.
threshhold_passed_mindamage = 5
/obj/item/bodypart/r_leg/robot/surplus_upgraded
name = "reinforced surplus prosthetic right leg"
desc = "A skeletal, robotic limb. This one is reinforced to provide better protection, and is made of stronger parts."
desc = "A skeletal, robotic limb. This one is reinforced to provide better protection, and is made of parts with more fallbacks against internal damage."
icon = 'icons/mob/augmentation/surplus_augments.dmi'
brute_reduction = 3
burn_reduction = 2
max_damage = 55
easy_heal_threshhold = 20 //Lower threshhold than true robotic limbs, but very low mindamage too.
threshhold_passed_mindamage = 5
#undef ROBOTIC_LIGHT_BRUTE_MSG
#undef ROBOTIC_MEDIUM_BRUTE_MSG
+2 -2
View File
@@ -10,14 +10,14 @@
target_mobtypes = list(/mob/living/carbon/human, /mob/living/carbon/monkey)
possible_locs = list(BODY_ZONE_HEAD)
requires_bodypart_type = BODYPART_ORGANIC
requires_bodypart_type = 0
/datum/surgery_step/fix_brain
name = "fix brain"
implements = list(TOOL_HEMOSTAT = 85, TOOL_SCREWDRIVER = 35, /obj/item/pen = 15) //don't worry, pouring some alcohol on their open brain will get that chance to 100
time = 120 //long and complicated
/datum/surgery/brain_surgery/can_start(mob/user, mob/living/carbon/target, obj/item/tool)
var/obj/item/organ/brain/B = target.getorganslot(ORGAN_SLOT_BRAIN)
if(!B)
if(!B || istype(B, /obj/item/organ/brain/ipc))
return FALSE
return TRUE
+23 -5
View File
@@ -26,8 +26,17 @@
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.
switch(S.requires_bodypart_type)
if(BODYPART_ORGANIC)
if(!affecting.is_organic_limb(FALSE))
continue
if(BODYPART_ROBOTIC)
if(!affecting.is_robotic_limb())
continue
if(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 +67,17 @@
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
switch(S.requires_bodypart_type)
if(BODYPART_ORGANIC)
if(!affecting.is_organic_limb(FALSE))
return
if(BODYPART_ROBOTIC)
if(!affecting.is_robotic_limb())
return
if(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 +109,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)
+2 -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
@@ -20,7 +20,7 @@
/datum/surgery/robot_brain_surgery/can_start(mob/user, mob/living/carbon/target, obj/item/tool)
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
+11 -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,16 @@
return FALSE
return TRUE
/datum/surgery/robot_healing/can_start(mob/user, mob/living/carbon/target, obj/item/tool)
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)