Cleans up organ processing

This commit is contained in:
mwerezak
2014-06-20 21:02:24 -04:00
parent cf5ff7e992
commit 1b86e3548f
5 changed files with 61 additions and 56 deletions

View File

@@ -316,9 +316,6 @@
if(istype(loc, /obj/machinery/atmospherics/unary/cryo_cell)) return
if(species && (species.flags & NO_BREATHE || species.flags & IS_SYNTHETIC)) return
var/datum/organ/internal/lungs/L = internal_organs["lungs"]
L.process()
var/datum/gas_mixture/environment = loc.return_air()
var/datum/gas_mixture/breath
@@ -1077,12 +1074,6 @@
if(!(species.flags & IS_SYNTHETIC)) handle_trace_chems()
var/datum/organ/internal/liver/liver = internal_organs["liver"]
liver.process()
var/datum/organ/internal/eyes/eyes = internal_organs["eyes"]
eyes.process()
updatehealth()
return //TODO: DEFERRED

View File

@@ -65,19 +65,10 @@
else
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))
@@ -88,36 +79,13 @@
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"))
var/obj/item/c_hand //Getting what's in this hand
var/hand
if(E.name == "l_hand" || E.name == "l_arm")
c_hand = l_hand
hand = "left hand"
if(E.name == "r_hand" || E.name == "r_arm")
c_hand = r_hand
hand = "right hand"
if (c_hand)
if(broken)
u_equip(c_hand)
var/emote_scream = pick("screams in pain and", "let's out a sharp hiss and", "cries out and")
emote("me", 1, "[(species && species.flags & NO_PAIN) ? "" : emote_scream ] drops what they were holding in their [hand]!")
if(malfunction)
u_equip(c_hand)
emote("me", 1, "drops what they were holding, their [hand] 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)

View File

@@ -328,6 +328,7 @@ This function completely restores a damaged organ to perfect condition.
if(!(status & ORGAN_BROKEN))
perma_injury = 0
//Infections
update_germs()
return
@@ -352,23 +353,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))
@@ -713,6 +713,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
****************************************************/
@@ -741,6 +771,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"
@@ -758,6 +792,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"
@@ -793,6 +831,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"
@@ -801,6 +843,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"

View File

@@ -10,6 +10,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
@@ -40,7 +41,6 @@
if (!silent)
owner.custom_pain("Something inside your [parent.display_name] hurts a lot.", 1)
/datum/organ/internal/proc/emp_act(severity)
switch(robotic)
if(0)
@@ -96,7 +96,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"