mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-26 21:48:21 +01:00
minor external organ refactor (#16183)
Co-authored-by: SabreML <57483089+SabreML@users.noreply.github.com> Co-authored-by: dearmochi <1496804+dearmochi@users.noreply.github.com>
This commit is contained in:
co-authored by
SabreML
dearmochi
parent
192fa1815e
commit
31b336da64
@@ -21,8 +21,8 @@
|
||||
return 0
|
||||
if(affected.is_robotic())
|
||||
return 0
|
||||
if(affected.cannot_break)
|
||||
return 0
|
||||
if(affected.limb_flags & CANNOT_BREAK)
|
||||
return FALSE
|
||||
if(affected.status & ORGAN_BROKEN)
|
||||
return 1
|
||||
return 1
|
||||
@@ -43,7 +43,7 @@
|
||||
|
||||
/datum/surgery_step/glue_bone/can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
|
||||
var/obj/item/organ/external/affected = target.get_organ(target_zone)
|
||||
return affected && !affected.is_robotic() && !(affected.cannot_break)
|
||||
return affected && !affected.is_robotic() && !(affected.limb_flags & CANNOT_BREAK)
|
||||
|
||||
/datum/surgery_step/glue_bone/begin_step(mob/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
|
||||
var/obj/item/organ/external/affected = target.get_organ(target_zone)
|
||||
|
||||
@@ -189,8 +189,7 @@
|
||||
"<span class='notice'> You put \the [tool] inside [target]'s [get_cavity(affected)] cavity.</span>" )
|
||||
if((tool.w_class > get_max_wclass(affected) / 2 && prob(50) && !affected.is_robotic()))
|
||||
to_chat(user, "<span class='warning'> You tear some vessels trying to fit the object in the cavity.</span>")
|
||||
affected.internal_bleeding = TRUE
|
||||
affected.owner.custom_pain("You feel something rip in your [affected.name]!")
|
||||
affected.cause_internal_bleeding()
|
||||
user.drop_item()
|
||||
affected.hidden = tool
|
||||
tool.forceMove(affected)
|
||||
|
||||
@@ -213,7 +213,9 @@
|
||||
var/obj/item/organ/external/affected = target.get_organ(target_zone)
|
||||
if(affected == null)
|
||||
return 0
|
||||
return !affected.cannot_amputate
|
||||
if(affected.limb_flags & CANNOT_DISMEMBER)
|
||||
return FALSE
|
||||
return TRUE
|
||||
|
||||
/datum/surgery_step/generic/amputate/begin_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
|
||||
var/obj/item/organ/external/affected = target.get_organ(target_zone)
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
return 0
|
||||
if(affected.is_robotic())
|
||||
return 0
|
||||
if(affected.cannot_amputate)
|
||||
return 0
|
||||
if(affected.limb_flags & CANNOT_DISMEMBER)
|
||||
return FALSE
|
||||
|
||||
return 1
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@
|
||||
if(BP.open)
|
||||
temp_bleed += 0.5
|
||||
|
||||
if(BP.internal_bleeding)
|
||||
if(BP.status & ORGAN_INT_BLEEDING)
|
||||
internal_bleeding_rate += 0.5
|
||||
|
||||
bleed_rate = max(bleed_rate - 0.5, temp_bleed)//if no wounds, other bleed effects naturally decreases
|
||||
|
||||
@@ -26,9 +26,7 @@
|
||||
var/icon/mob_icon
|
||||
var/gendered_icon = 0
|
||||
var/limb_name
|
||||
var/disfigured = 0
|
||||
var/cannot_amputate
|
||||
var/cannot_break
|
||||
var/limb_flags
|
||||
var/s_tone = null
|
||||
var/s_col = null // If this is instantiated, it should be a hex value.
|
||||
var/list/child_icons = list()
|
||||
@@ -54,7 +52,6 @@
|
||||
|
||||
var/obj/item/hidden = null
|
||||
var/list/embedded_objects = list()
|
||||
var/internal_bleeding = FALSE
|
||||
var/amputation_point // Descriptive string used in amputation.
|
||||
var/can_grasp
|
||||
var/can_stand
|
||||
@@ -105,13 +102,22 @@
|
||||
|
||||
/obj/item/organ/external/New(mob/living/carbon/holder)
|
||||
..()
|
||||
var/mob/living/carbon/human/H = holder
|
||||
icobase = dna.species.icobase
|
||||
if(istype(H))
|
||||
if(ishuman(holder))
|
||||
var/mob/living/carbon/human/H = holder
|
||||
icobase = H.dna.species.icobase
|
||||
replaced(H)
|
||||
sync_colour_to_human(H)
|
||||
get_icon()
|
||||
|
||||
|
||||
/obj/item/organ/external/proc/add_limb_flags()
|
||||
if(HAS_TRAIT(owner, TRAIT_NO_BONES))
|
||||
limb_flags |= CANNOT_BREAK
|
||||
|
||||
if(HAS_TRAIT(owner, TRAIT_STURDY_LIMBS))
|
||||
limb_flags |= CANNOT_DISMEMBER
|
||||
|
||||
|
||||
/obj/item/organ/external/replaced(mob/living/carbon/human/target)
|
||||
owner = target
|
||||
loc = null
|
||||
@@ -227,7 +233,7 @@
|
||||
var/mob/living/carbon/owner_old = owner //Need to update health, but need a reference in case the below check cuts off a limb.
|
||||
//If limb took enough damage, try to cut or tear it off
|
||||
if(owner)
|
||||
if(!cannot_amputate && (brute_dam) >= (max_damage))
|
||||
if(!(limb_flags & CANNOT_DISMEMBER) && brute_dam >= max_damage)
|
||||
if(prob(brute / 2))
|
||||
if(sharp)
|
||||
droplimb(0, DROPLIMB_SHARP)
|
||||
@@ -297,8 +303,6 @@ This function completely restores a damaged organ to perfect condition.
|
||||
brute_dam = 0
|
||||
burn_dam = 0
|
||||
open = 0 //Closing all wounds.
|
||||
internal_bleeding = FALSE
|
||||
disfigured = FALSE
|
||||
|
||||
// handle internal organs
|
||||
for(var/obj/item/organ/internal/current_organ in internal_organs)
|
||||
@@ -408,9 +412,8 @@ Note that amputating the affected organ does in fact remove the infection from t
|
||||
if(owner && (NO_BLOOD in owner.dna.species.species_traits))
|
||||
return
|
||||
var/local_damage = brute_dam + damage
|
||||
if(damage > 15 && local_damage > 30 && prob(damage) && !is_robotic())
|
||||
internal_bleeding = TRUE
|
||||
owner.custom_pain("You feel something rip in your [name]!")
|
||||
if(damage > 15 && local_damage > 30 && prob(damage))
|
||||
cause_internal_bleeding()
|
||||
|
||||
// new damage icon system
|
||||
// returns just the brute/burn damage code
|
||||
@@ -456,7 +459,7 @@ Note that amputating the affected organ does in fact remove the infection from t
|
||||
//Handles dismemberment
|
||||
/obj/item/organ/external/proc/droplimb(clean, disintegrate, ignore_children, nodamage)
|
||||
|
||||
if(cannot_amputate || !owner)
|
||||
if(limb_flags & CANNOT_DISMEMBER || !owner)
|
||||
return
|
||||
|
||||
if(!disintegrate)
|
||||
@@ -605,7 +608,7 @@ Note that amputating the affected organ does in fact remove the infection from t
|
||||
if(is_robotic())
|
||||
return //ORGAN_BROKEN doesn't have the same meaning for robot limbs
|
||||
|
||||
if((status & ORGAN_BROKEN) || cannot_break)
|
||||
if((status & ORGAN_BROKEN) || (limb_flags & CANNOT_BREAK))
|
||||
return
|
||||
if(owner)
|
||||
owner.visible_message(\
|
||||
@@ -638,6 +641,20 @@ Note that amputating the affected organ does in fact remove the infection from t
|
||||
owner.handle_splints()
|
||||
return TRUE
|
||||
|
||||
/obj/item/organ/external/proc/cause_internal_bleeding()
|
||||
if(is_robotic())
|
||||
return
|
||||
if(HAS_TRAIT(owner, NO_BLOOD))
|
||||
return
|
||||
status |= ORGAN_INT_BLEEDING
|
||||
owner.custom_pain("You feel something rip in your [name]!")
|
||||
|
||||
/obj/item/organ/external/proc/fix_internal_bleeding()
|
||||
if(is_robotic())
|
||||
return
|
||||
status &= ~ORGAN_INT_BLEEDING
|
||||
perma_injury = 0
|
||||
|
||||
/obj/item/organ/external/robotize(company, make_tough = 0, convert_all = 1)
|
||||
..()
|
||||
//robot limbs take reduced damage
|
||||
@@ -654,7 +671,7 @@ Note that amputating the affected organ does in fact remove the infection from t
|
||||
if(company && istext(company))
|
||||
set_company(company)
|
||||
|
||||
cannot_break = 1
|
||||
limb_flags |= CANNOT_BREAK
|
||||
get_icon()
|
||||
for(var/obj/item/organ/external/T in children)
|
||||
if((convert_all) || (T.type in convertable_children))
|
||||
@@ -738,13 +755,14 @@ Note that amputating the affected organ does in fact remove the infection from t
|
||||
qdel(src)
|
||||
|
||||
/obj/item/organ/external/proc/disfigure()
|
||||
if(disfigured)
|
||||
if(status & ORGAN_DISFIGURED)
|
||||
return
|
||||
if(owner)
|
||||
owner.visible_message("<span class='warning'>You hear a sickening sound coming from \the [owner]'s [name] as it turns into a mangled mess!</span>", \
|
||||
"<span class='danger'>Your [name] becomes a mangled mess!</span>", \
|
||||
"<span class='warning'>You hear a sickening sound.</span>")
|
||||
disfigured = TRUE
|
||||
|
||||
status |= ORGAN_DISFIGURED
|
||||
|
||||
/obj/item/organ/external/is_primary_organ(mob/living/carbon/human/O = null)
|
||||
if(isnull(O))
|
||||
|
||||
@@ -255,9 +255,8 @@
|
||||
|
||||
/obj/item/organ/external/head/receive_damage(brute, burn, sharp, used_weapon = null, list/forbidden_limbs = list(), ignore_resists = FALSE, updating_health = TRUE)
|
||||
..()
|
||||
if(!disfigured)
|
||||
if(brute_dam + burn_dam > 50)
|
||||
disfigure()
|
||||
if(brute_dam + burn_dam > 50 && !(status & ORGAN_DISFIGURED))
|
||||
disfigure()
|
||||
|
||||
/obj/item/organ/external/head/proc/handle_alt_icon()
|
||||
if(alt_head && GLOB.alt_heads_list[alt_head])
|
||||
|
||||
@@ -1,78 +0,0 @@
|
||||
/obj/item/organ/external/chest/unbreakable
|
||||
cannot_break = TRUE
|
||||
encased = null
|
||||
convertable_children = list(/obj/item/organ/external/groin/unbreakable)
|
||||
|
||||
/obj/item/organ/external/groin/unbreakable
|
||||
cannot_break = TRUE
|
||||
|
||||
/obj/item/organ/external/arm/unbreakable
|
||||
cannot_break = TRUE
|
||||
convertable_children = list(/obj/item/organ/external/hand/unbreakable)
|
||||
|
||||
/obj/item/organ/external/arm/right/unbreakable
|
||||
cannot_break = TRUE
|
||||
convertable_children = list(/obj/item/organ/external/hand/right/unbreakable)
|
||||
|
||||
/obj/item/organ/external/leg/unbreakable
|
||||
cannot_break = TRUE
|
||||
convertable_children = list(/obj/item/organ/external/foot/unbreakable)
|
||||
|
||||
/obj/item/organ/external/leg/right/unbreakable
|
||||
cannot_break = TRUE
|
||||
convertable_children = list(/obj/item/organ/external/foot/right/unbreakable)
|
||||
|
||||
/obj/item/organ/external/foot/unbreakable
|
||||
cannot_break = TRUE
|
||||
|
||||
/obj/item/organ/external/foot/right/unbreakable
|
||||
cannot_break = TRUE
|
||||
|
||||
/obj/item/organ/external/hand/unbreakable
|
||||
cannot_break = TRUE
|
||||
|
||||
/obj/item/organ/external/hand/right/unbreakable
|
||||
cannot_break = TRUE
|
||||
|
||||
/obj/item/organ/external/head/unbreakable
|
||||
cannot_break = TRUE
|
||||
encased = null
|
||||
|
||||
// Cannot dismember or break
|
||||
/obj/item/organ/external/chest/unbreakable/sturdy
|
||||
cannot_amputate = TRUE
|
||||
convertable_children = list(/obj/item/organ/external/groin/unbreakable/sturdy)
|
||||
|
||||
/obj/item/organ/external/groin/unbreakable/sturdy
|
||||
cannot_amputate = TRUE
|
||||
|
||||
/obj/item/organ/external/arm/unbreakable/sturdy
|
||||
cannot_amputate = TRUE
|
||||
convertable_children = list(/obj/item/organ/external/hand/unbreakable/sturdy)
|
||||
|
||||
/obj/item/organ/external/arm/right/unbreakable/sturdy
|
||||
cannot_amputate = TRUE
|
||||
convertable_children = list(/obj/item/organ/external/hand/right/unbreakable/sturdy)
|
||||
|
||||
/obj/item/organ/external/leg/unbreakable/sturdy
|
||||
cannot_amputate = TRUE
|
||||
convertable_children = list(/obj/item/organ/external/foot/unbreakable/sturdy)
|
||||
|
||||
/obj/item/organ/external/leg/right/unbreakable/sturdy
|
||||
cannot_amputate = TRUE
|
||||
convertable_children = list(/obj/item/organ/external/foot/right/unbreakable/sturdy)
|
||||
|
||||
/obj/item/organ/external/foot/unbreakable/sturdy
|
||||
cannot_amputate = TRUE
|
||||
|
||||
/obj/item/organ/external/foot/right/unbreakable/sturdy
|
||||
cannot_amputate = TRUE
|
||||
|
||||
/obj/item/organ/external/hand/unbreakable/sturdy
|
||||
cannot_amputate = TRUE
|
||||
|
||||
/obj/item/organ/external/hand/right/unbreakable/sturdy
|
||||
cannot_amputate = TRUE
|
||||
|
||||
/obj/item/organ/external/head/unbreakable/sturdy
|
||||
cannot_amputate = TRUE
|
||||
@@ -34,11 +34,11 @@
|
||||
var/mob/living/carbon/human/H = target
|
||||
var/obj/item/organ/external/affected = H.get_organ(user.zone_selected)
|
||||
if(!affected)
|
||||
return 0
|
||||
return FALSE
|
||||
|
||||
if(affected.internal_bleeding)
|
||||
return 1
|
||||
return 0
|
||||
if(affected.status & ORGAN_INT_BLEEDING)
|
||||
return TRUE
|
||||
return FALSE
|
||||
|
||||
/datum/surgery/debridement/can_start(mob/user, mob/living/carbon/target)
|
||||
if(ishuman(target))
|
||||
@@ -72,9 +72,10 @@
|
||||
/datum/surgery_step/fix_vein/can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
|
||||
var/obj/item/organ/external/affected = target.get_organ(target_zone)
|
||||
if(!affected)
|
||||
return 0
|
||||
return FALSE
|
||||
|
||||
return affected.internal_bleeding
|
||||
if(affected.status & ORGAN_INT_BLEEDING)
|
||||
return TRUE
|
||||
|
||||
/datum/surgery_step/fix_vein/begin_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool,datum/surgery/surgery)
|
||||
var/obj/item/organ/external/affected = target.get_organ(target_zone)
|
||||
@@ -88,7 +89,7 @@
|
||||
user.visible_message("<span class='notice'> [user] has patched the damaged vein in [target]'s [affected.name] with \the [tool].</span>", \
|
||||
"<span class='notice'> You have patched the damaged vein in [target]'s [affected.name] with \the [tool].</span>")
|
||||
|
||||
affected.internal_bleeding = FALSE
|
||||
affected.fix_internal_bleeding()
|
||||
if(ishuman(user) && prob(40))
|
||||
var/mob/living/carbon/human/U = user
|
||||
U.bloody_hands(target, 0)
|
||||
|
||||
@@ -25,8 +25,8 @@
|
||||
/datum/surgery_step/reshape_face/end_step(mob/user, mob/living/carbon/human/target, target_zone, obj/item/tool, datum/surgery/surgery)
|
||||
var/obj/item/organ/external/head/head = target.get_organ(target_zone)
|
||||
var/species_names = target.dna.species.name
|
||||
if(head.disfigured)
|
||||
head.disfigured = FALSE
|
||||
if(head.status & ORGAN_DISFIGURED)
|
||||
head.status &= ~ORGAN_DISFIGURED
|
||||
user.visible_message("[user] successfully restores [target]'s appearance!", "<span class='notice'>You successfully restore [target]'s appearance.</span>")
|
||||
else
|
||||
var/list/names = list()
|
||||
|
||||
@@ -40,8 +40,8 @@
|
||||
return 0
|
||||
if(!affected.is_robotic())
|
||||
return 0
|
||||
if(affected.cannot_amputate)
|
||||
return 0
|
||||
if(affected.limb_flags & CANNOT_DISMEMBER)
|
||||
return FALSE
|
||||
return 1
|
||||
|
||||
//to do, moar surgerys or condense down ala manipulate organs.
|
||||
@@ -222,7 +222,7 @@
|
||||
|
||||
else if(implement_type in implements_heal_brute)
|
||||
current_type = "brute"
|
||||
if(!(affected.brute_dam > 0 || affected.disfigured))
|
||||
if(!(affected.brute_dam > 0 || (affected.status & ORGAN_DISFIGURED)))
|
||||
to_chat(user, "<span class='warning'>\The [affected] does not require welding repair!</span>")
|
||||
return -1
|
||||
if(tool.tool_behaviour == TOOL_WELDER)
|
||||
@@ -247,7 +247,7 @@
|
||||
user.visible_message("<span class='notice'> [user] finishes patching damage to [target]'s [affected.name] with \the [tool].</span>", \
|
||||
"<span class='notice'> You finish patching damage to [target]'s [affected.name] with \the [tool].</span>")
|
||||
affected.heal_damage(rand(30,50),0,1,1)
|
||||
affected.disfigured = FALSE
|
||||
affected.status &= ~ORGAN_DISFIGURED
|
||||
if("burn")
|
||||
user.visible_message("<span class='notice'> [user] finishes splicing cable into [target]'s [affected.name].</span>", \
|
||||
"<span class='notice'> You finishes splicing new cable into [target]'s [affected.name].</span>")
|
||||
|
||||
Reference in New Issue
Block a user