mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-23 03:57:13 +01:00
Cleans up organ processing
Conflicts: code/modules/organs/organ.dm code/modules/organs/organ_internal.dm
This commit is contained in:
@@ -5,9 +5,9 @@
|
||||
var/list/datum/autopsy_data/autopsy_data = list()
|
||||
var/list/trace_chemicals = list() // traces of chemicals in the organ,
|
||||
// links chemical IDs to number of ticks for which they'll stay in the blood
|
||||
|
||||
|
||||
var/germ_level = 0 // INTERNAL germs inside the organ, this is BAD if it's greater than INFECTION_LEVEL_ONE
|
||||
|
||||
|
||||
proc/process()
|
||||
return 0
|
||||
|
||||
@@ -65,55 +65,26 @@
|
||||
E.process()
|
||||
number_wounds += E.number_wounds
|
||||
|
||||
//Robotic limb malfunctions
|
||||
var/malfunction = 0
|
||||
if (E.status & ORGAN_ROBOT && prob(E.brute_dam + E.burn_dam))
|
||||
malfunction = 1
|
||||
|
||||
//Broken limbs hurt too
|
||||
var/broken = 0
|
||||
if(E.status & ORGAN_BROKEN && !(E.status & ORGAN_SPLINTED) )
|
||||
broken = 1
|
||||
|
||||
if (!lying && world.time - l_move_time < 15)
|
||||
//Moving around with fractured ribs won't do you any good
|
||||
if (broken && E.internal_organs && prob(15))
|
||||
if (E.is_broken() && E.internal_organs && prob(15))
|
||||
var/datum/organ/internal/I = pick(E.internal_organs)
|
||||
custom_pain("You feel broken bones moving in your [E.display_name]!", 1)
|
||||
I.take_damage(rand(3,5))
|
||||
|
||||
|
||||
//Moving makes open wounds get infected much faster
|
||||
if (E.wounds.len)
|
||||
for(var/datum/wound/W in E.wounds)
|
||||
if (W.infection_check())
|
||||
W.germ_level += 1
|
||||
|
||||
//Special effects for limbs.
|
||||
if(E.name in list("l_hand","l_arm","r_hand","r_arm") && (broken||malfunction))
|
||||
var/obj/item/c_hand //Getting what's in this hand
|
||||
if(E.name == "l_hand" || E.name == "l_arm")
|
||||
c_hand = l_hand
|
||||
if(E.name == "r_hand" || E.name == "r_arm")
|
||||
c_hand = r_hand
|
||||
|
||||
if (c_hand)
|
||||
u_equip(c_hand)
|
||||
|
||||
if(broken)
|
||||
emote("me", 1, "[(species && species.flags & NO_PAIN) ? "" : "screams in pain and"] drops what they were holding in their [E.display_name?"[E.display_name]":"[E]"]!")
|
||||
if(malfunction)
|
||||
emote("me", 1, "drops what they were holding, their [E.display_name?"[E.display_name]":"[E]"] malfunctioning!")
|
||||
var/datum/effect/effect/system/spark_spread/spark_system = new /datum/effect/effect/system/spark_spread()
|
||||
spark_system.set_up(5, 0, src)
|
||||
spark_system.attach(src)
|
||||
spark_system.start()
|
||||
spawn(10)
|
||||
del(spark_system)
|
||||
|
||||
else if(E.name in list("l_leg","l_foot","r_leg","r_foot") && !lying)
|
||||
if(E.name in list("l_leg","l_foot","r_leg","r_foot") && !lying)
|
||||
if (!E.is_usable() || malfunction || (broken && !(E.status & ORGAN_SPLINTED)))
|
||||
leg_tally-- // let it fail even if just foot&leg
|
||||
|
||||
for(var/datum/organ/internal/I in internal_organs)
|
||||
I.process()
|
||||
|
||||
// standing is poor
|
||||
if(leg_tally <= 0 && !paralysis && !(lying || resting) && prob(5))
|
||||
if(species && species.flags & NO_PAIN)
|
||||
|
||||
@@ -333,6 +333,7 @@ This function completely restores a damaged organ to perfect condition.
|
||||
if(!(status & ORGAN_BROKEN))
|
||||
perma_injury = 0
|
||||
|
||||
//Infections
|
||||
update_germs()
|
||||
return
|
||||
|
||||
@@ -357,23 +358,22 @@ This function completely restores a damaged organ to perfect condition.
|
||||
germ_level++
|
||||
|
||||
var/antibiotics = owner.reagents.get_reagent_amount("spaceacillin")
|
||||
if (antibiotics > 5)
|
||||
if (germ_level > 0 && antibiotics > 5)
|
||||
if (prob(4*antibiotics)) germ_level--
|
||||
|
||||
if(germ_level > INFECTION_LEVEL_ONE)
|
||||
//having an infection raises your body temperature
|
||||
var/temperature_increase = (owner.species.heat_level_1 - owner.species.body_temperature - 1)* min(germ_level/INFECTION_LEVEL_TWO, 1)
|
||||
owner.bodytemperature += temperature_increase
|
||||
if (owner.bodytemperature < temperature_increase)
|
||||
owner.bodytemperature++
|
||||
|
||||
if(prob(round(germ_level/10))) //aiming for a light infection to become serious after 40 minutes, standing still
|
||||
germ_level += 1
|
||||
owner.adjustToxLoss(1)
|
||||
|
||||
|
||||
if(germ_level > INFECTION_LEVEL_TWO && antibiotics < 30) //overdosing is necessary to stop severe infections
|
||||
germ_level++
|
||||
owner.adjustToxLoss(1)
|
||||
|
||||
|
||||
/*
|
||||
if(germ_level > GANGREN_LEVEL_TERMINAL)
|
||||
if (!(status & ORGAN_DEAD))
|
||||
@@ -752,6 +752,36 @@ This function completely restores a damaged organ to perfect condition.
|
||||
/datum/organ/external/proc/is_usable()
|
||||
return !(status & (ORGAN_DESTROYED|ORGAN_MUTATED|ORGAN_DEAD))
|
||||
|
||||
/datum/organ/external/proc/is_broken()
|
||||
return ((status & ORGAN_BROKEN) && !(status & ORGAN_SPLINTED))
|
||||
|
||||
/datum/organ/external/proc/is_malfunctioning()
|
||||
return ((status & ORGAN_ROBOT) && prob(E.brute_dam + E.burn_dam))
|
||||
|
||||
//for arms and hands
|
||||
/datum/organ/external/proc/process_grasp(var/obj/item/c_hand, var/hand_name)
|
||||
if (!c_hand)
|
||||
return
|
||||
|
||||
if(is_broken())
|
||||
owner.u_equip(c_hand)
|
||||
var/emote_scream = pick("screams in pain and", "lets out a sharp cry and", "cries out and")
|
||||
owner.emote("me", 1, "[(species && species.flags & NO_PAIN) ? "" : emote_scream ] drops what they were holding in their [hand_name]!")
|
||||
if(is_malfunctioning())
|
||||
owner.u_equip(c_hand)
|
||||
owner.emote("me", 1, "drops what they were holding, their [hand_name] malfunctioning!")
|
||||
var/datum/effect/effect/system/spark_spread/spark_system = new /datum/effect/effect/system/spark_spread()
|
||||
spark_system.set_up(5, 0, src)
|
||||
spark_system.attach(src)
|
||||
spark_system.start()
|
||||
spawn(10)
|
||||
del(spark_system)
|
||||
|
||||
//legs
|
||||
//returns 1 if this organ can support standing
|
||||
/datum/organ/external/proc/can_support_standing()
|
||||
if (!E.is_usable() || malfunction || (broken && !(E.status & ORGAN_SPLINTED)))
|
||||
|
||||
/****************************************************
|
||||
ORGAN DEFINES
|
||||
****************************************************/
|
||||
@@ -780,6 +810,10 @@ This function completely restores a damaged organ to perfect condition.
|
||||
max_damage = 50
|
||||
min_broken_damage = 20
|
||||
body_part = ARM_LEFT
|
||||
|
||||
process()
|
||||
..()
|
||||
process_grasp(owner.l_hand, "left hand")
|
||||
|
||||
/datum/organ/external/l_leg
|
||||
name = "l_leg"
|
||||
@@ -797,6 +831,10 @@ This function completely restores a damaged organ to perfect condition.
|
||||
max_damage = 50
|
||||
min_broken_damage = 20
|
||||
body_part = ARM_RIGHT
|
||||
|
||||
process()
|
||||
..()
|
||||
process_grasp(owner.r_hand, "right hand")
|
||||
|
||||
/datum/organ/external/r_leg
|
||||
name = "r_leg"
|
||||
@@ -832,6 +870,10 @@ This function completely restores a damaged organ to perfect condition.
|
||||
max_damage = 30
|
||||
min_broken_damage = 15
|
||||
body_part = HAND_RIGHT
|
||||
|
||||
process()
|
||||
..()
|
||||
process_grasp(owner.r_hand, "right hand")
|
||||
|
||||
/datum/organ/external/l_hand
|
||||
name = "l_hand"
|
||||
@@ -840,6 +882,10 @@ This function completely restores a damaged organ to perfect condition.
|
||||
max_damage = 30
|
||||
min_broken_damage = 15
|
||||
body_part = HAND_LEFT
|
||||
|
||||
process()
|
||||
..()
|
||||
process_grasp(owner.l_hand, "left hand")
|
||||
|
||||
/datum/organ/external/head
|
||||
name = "head"
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
var/min_broken_damage = 30
|
||||
var/parent_organ = "chest"
|
||||
var/robotic = 0 //For being a robot
|
||||
var/germ_level = 0
|
||||
|
||||
/datum/organ/internal/proc/rejuvenate()
|
||||
damage=0
|
||||
@@ -41,11 +42,7 @@
|
||||
var/datum/organ/internal/eyes/E
|
||||
var/datum/organ/internal/heart/H
|
||||
if (!silent)
|
||||
if(istype(E))
|
||||
owner.custom_pain("Your eyes burn like mad!", 1)
|
||||
if(istype(H))
|
||||
owner.custom_pain("You feel a sudden, stabbing pain inside of your [parent.display_name]!", 1)
|
||||
else owner.custom_pain("Something inside your [parent.display_name] hurts a lot.", 1)
|
||||
owner.custom_pain("Something inside your [parent.display_name] hurts a lot.", 1)
|
||||
|
||||
/datum/organ/internal/proc/emp_act(severity)
|
||||
switch(robotic)
|
||||
@@ -102,7 +99,7 @@
|
||||
owner.drip(10)
|
||||
if(prob(4))
|
||||
spawn owner.emote("me", 1, "gasps for air!")
|
||||
owner.losebreath += 5
|
||||
owner.losebreath += 15
|
||||
|
||||
/datum/organ/internal/liver
|
||||
name = "liver"
|
||||
|
||||
Reference in New Issue
Block a user