mirror of
https://github.com/Aurorastation/Aurora-Old.git
synced 2026-08-21 19:56:19 +01:00
Bay Update 26JUN2014
This commit is contained in:
@@ -159,6 +159,9 @@ var/const/BLOOD_VOLUME_SURVIVE = 122
|
||||
this.icon_state = pick(iconL)
|
||||
this.blood_DNA = list()
|
||||
this.blood_DNA[dna.unique_enzymes] = dna.b_type
|
||||
for (var/ID in virus2)
|
||||
var/datum/disease2/disease/V = virus2[ID]
|
||||
this.virus2[ID] = V.getcopy()
|
||||
if (species) this.basecolor = species.blood_color
|
||||
this.update_icon()
|
||||
|
||||
|
||||
@@ -70,9 +70,9 @@
|
||||
if(prob(probability))
|
||||
droplimb(1)
|
||||
else
|
||||
take_damage(damage, 0, 1, used_weapon = "EMP")
|
||||
take_damage(damage, 0, 1, 1, used_weapon = "EMP")
|
||||
|
||||
/datum/organ/external/proc/take_damage(brute, burn, sharp, used_weapon = null, list/forbidden_limbs = list())
|
||||
/datum/organ/external/proc/take_damage(brute, burn, sharp, edge, used_weapon = null, list/forbidden_limbs = list())
|
||||
if((brute <= 0) && (burn <= 0))
|
||||
return 0
|
||||
|
||||
@@ -95,7 +95,7 @@
|
||||
//If limb took enough damage, try to cut or tear it off
|
||||
if(body_part != UPPER_TORSO && body_part != LOWER_TORSO) //as hilarious as it is, getting hit on the chest too much shouldn't effectively gib you.
|
||||
if(config.limbs_can_break && brute_dam >= max_damage * config.organ_health_multiplier)
|
||||
if( (sharp && prob(5 * brute)) || (brute > 20 && prob(2 * brute)) )
|
||||
if( (edge && prob(5 * brute)) || (brute > 20 && prob(2 * brute)) )
|
||||
droplimb(1)
|
||||
return
|
||||
|
||||
@@ -159,7 +159,7 @@
|
||||
if(possible_points.len)
|
||||
//And pass the pain around
|
||||
var/datum/organ/external/target = pick(possible_points)
|
||||
target.take_damage(brute, burn, sharp, used_weapon, forbidden_limbs + src)
|
||||
target.take_damage(brute, burn, sharp, edge, used_weapon, forbidden_limbs + src)
|
||||
|
||||
// sync the organ's damage with its wounds
|
||||
src.update_damages()
|
||||
@@ -223,35 +223,7 @@ This function completely restores a damaged organ to perfect condition.
|
||||
/datum/organ/external/proc/createwound(var/type = CUT, var/damage)
|
||||
if(damage == 0) return
|
||||
|
||||
// first check whether we can widen an existing wound
|
||||
if(wounds.len > 0 && prob(max(50+owner.number_wounds*10,100)))
|
||||
if((type == CUT || type == BRUISE) && damage >= 5)
|
||||
var/datum/wound/W = pick(wounds)
|
||||
if(W.amount == 1 && W.started_healing())
|
||||
W.open_wound(damage)
|
||||
if(prob(25))
|
||||
owner.visible_message("\red The wound on [owner.name]'s [display_name] widens with a nasty ripping voice.",\
|
||||
"\red The wound on your [display_name] widens with a nasty ripping voice.",\
|
||||
"You hear a nasty ripping noise, as if flesh is being torn apart.")
|
||||
return
|
||||
|
||||
//Creating wound
|
||||
var/datum/wound/W
|
||||
var/size = min( max( 1, damage/10 ) , 6)
|
||||
//Possible types of wound
|
||||
var/list/size_names = list()
|
||||
switch(type)
|
||||
if(CUT)
|
||||
size_names = typesof(/datum/wound/cut/) - /datum/wound/cut/
|
||||
if(BRUISE)
|
||||
size_names = typesof(/datum/wound/bruise/) - /datum/wound/bruise/
|
||||
if(BURN)
|
||||
size_names = typesof(/datum/wound/burn/) - /datum/wound/burn/
|
||||
|
||||
size = min(size,size_names.len)
|
||||
var/wound_type = size_names[size]
|
||||
W = new wound_type(damage)
|
||||
|
||||
//moved this before the open_wound check so that having many small wounds for example doesn't somehow protect you from taking internal damage
|
||||
//Possibly trigger an internal wound, too.
|
||||
var/local_damage = brute_dam + burn_dam + damage
|
||||
if(damage > 15 && type != BURN && local_damage > 30 && prob(damage) && !(status & ORGAN_ROBOT))
|
||||
@@ -259,16 +231,58 @@ This function completely restores a damaged organ to perfect condition.
|
||||
wounds += I
|
||||
owner.custom_pain("You feel something rip in your [display_name]!", 1)
|
||||
|
||||
//Check whether we can add the wound to an existing wound
|
||||
for(var/datum/wound/other in wounds)
|
||||
if(other.desc == W.desc)
|
||||
// okay, add it!
|
||||
other.damage += W.damage
|
||||
other.amount += 1
|
||||
W = null // to signify that the wound was added
|
||||
break
|
||||
if(W)
|
||||
wounds += W
|
||||
// first check whether we can widen an existing wound
|
||||
if(wounds.len > 0 && prob(max(50+(number_wounds-1)*10,90)))
|
||||
if((type == CUT || type == BRUISE) && damage >= 5)
|
||||
//we need to make sure that the wound we are going to worsen is compatible with the type of damage...
|
||||
var/list/compatible_wounds = list()
|
||||
for (var/datum/wound/W in wounds)
|
||||
if (W.can_worsen(type, damage))
|
||||
compatible_wounds += W
|
||||
|
||||
if(compatible_wounds.len)
|
||||
var/datum/wound/W = pick(compatible_wounds)
|
||||
W.open_wound(damage)
|
||||
if(prob(25))
|
||||
//maybe have a separate message for BRUISE type damage?
|
||||
owner.visible_message("\red The wound on [owner.name]'s [display_name] widens with a nasty ripping voice.",\
|
||||
"\red The wound on your [display_name] widens with a nasty ripping voice.",\
|
||||
"You hear a nasty ripping noise, as if flesh is being torn apart.")
|
||||
return
|
||||
|
||||
//Creating wound
|
||||
var/wound_type = get_wound_type(type, damage)
|
||||
|
||||
if(wound_type)
|
||||
var/datum/wound/W = new wound_type(damage)
|
||||
|
||||
//Check whether we can add the wound to an existing wound
|
||||
for(var/datum/wound/other in wounds)
|
||||
if(other.can_merge(W))
|
||||
other.merge_wound(W)
|
||||
W = null // to signify that the wound was added
|
||||
break
|
||||
if(W)
|
||||
wounds += W
|
||||
|
||||
/datum/organ/external/proc/get_wound_type(var/type = CUT, var/damage)
|
||||
//if you look a the names in the wound's stages list for each wound type you will see the logic behind these values
|
||||
switch(type)
|
||||
if(CUT)
|
||||
if (damage <= 5) return /datum/wound/cut/small
|
||||
if (damage <= 15) return /datum/wound/cut/deep
|
||||
if (damage <= 25) return /datum/wound/cut/flesh
|
||||
if (damage <= 50) return /datum/wound/cut/gaping
|
||||
if (damage <= 60) return /datum/wound/cut/gaping_big
|
||||
return /datum/wound/cut/massive
|
||||
if(BRUISE)
|
||||
return /datum/wound/bruise
|
||||
if(BURN)
|
||||
if (damage <= 5) return /datum/wound/burn/moderate
|
||||
if (damage <= 15) return /datum/wound/burn/large
|
||||
if (damage <= 30) return /datum/wound/burn/severe
|
||||
if (damage <= 40) return /datum/wound/burn/deep
|
||||
return /datum/wound/burn/carbonised
|
||||
|
||||
/****************************************************
|
||||
PROCESSING & UPDATING
|
||||
@@ -388,15 +402,12 @@ This function completely restores a damaged organ to perfect condition.
|
||||
if(prob(1 * wound_update_accuracy))
|
||||
owner.custom_pain("You feel a stabbing pain in your [display_name]!",1)
|
||||
|
||||
|
||||
// slow healing
|
||||
var/heal_amt = 0
|
||||
|
||||
if (W.damage < 15) //this thing's edges are not in day's travel of each other, what healing?
|
||||
heal_amt += 0.2
|
||||
|
||||
if(W.is_treated() && W.damage < 50) //whoa, not even magical band aid can hold it together
|
||||
heal_amt += 0.3
|
||||
// if damage >= 50 AFTER treatment then it's probably too severe to heal within the timeframe of a round.
|
||||
if (W.is_treated() && W.wound_damage() < 50)
|
||||
heal_amt += 0.5
|
||||
|
||||
//we only update wounds once in [wound_update_accuracy] ticks so have to emulate realtime
|
||||
heal_amt = heal_amt * wound_update_accuracy
|
||||
@@ -800,8 +811,8 @@ This function completely restores a damaged organ to perfect condition.
|
||||
else
|
||||
. = new /icon(owner.race_icon, "[icon_name]_[g]")
|
||||
|
||||
/datum/organ/external/head/take_damage(brute, burn, sharp, used_weapon = null, list/forbidden_limbs = list())
|
||||
..(brute, burn, sharp, used_weapon, forbidden_limbs)
|
||||
/datum/organ/external/head/take_damage(brute, burn, sharp, edge, used_weapon = null, list/forbidden_limbs = list())
|
||||
..(brute, burn, sharp, edge, used_weapon, forbidden_limbs)
|
||||
if (!disfigured)
|
||||
if (brute_dam > 40)
|
||||
if (prob(50))
|
||||
|
||||
@@ -3,8 +3,6 @@
|
||||
WOUNDS
|
||||
****************************************************/
|
||||
/datum/wound
|
||||
// stages such as "cut", "deep cut", etc.
|
||||
var/list/stages
|
||||
// number representing the current stage
|
||||
var/current_stage = 0
|
||||
|
||||
@@ -18,38 +16,42 @@
|
||||
// amount of damage the current wound type requires(less means we need to apply the next healing stage)
|
||||
var/min_damage = 0
|
||||
|
||||
// one of CUT, BRUISE, BURN
|
||||
var/damage_type = CUT
|
||||
|
||||
// whether this wound needs a bandage/salve to heal at all
|
||||
var/needs_treatment = 0
|
||||
|
||||
// is the wound bandaged?
|
||||
var/tmp/bandaged = 0
|
||||
var/bandaged = 0
|
||||
// Similar to bandaged, but works differently
|
||||
var/tmp/clamped = 0
|
||||
var/clamped = 0
|
||||
// is the wound salved?
|
||||
var/tmp/salved = 0
|
||||
var/salved = 0
|
||||
// is the wound disinfected?
|
||||
var/tmp/disinfected = 0
|
||||
var/tmp/created = 0
|
||||
|
||||
var/disinfected = 0
|
||||
var/created = 0
|
||||
// number of wounds of this type
|
||||
var/tmp/amount = 1
|
||||
var/amount = 1
|
||||
// amount of germs in the wound
|
||||
var/germ_level = 0
|
||||
|
||||
/* These are defined by the wound type and should not be changed */
|
||||
|
||||
// stages such as "cut", "deep cut", etc.
|
||||
var/list/stages
|
||||
// internal wounds can only be fixed through surgery
|
||||
var/internal = 0
|
||||
// maximum stage at which bleeding should still happen, counted from the right rather than the left of the list
|
||||
// 1 means all stages except the last should bleed
|
||||
var/max_bleeding_stage = 1
|
||||
// one of CUT, BRUISE, BURN
|
||||
var/damage_type = CUT
|
||||
// whether this wound needs a bandage/salve to heal at all
|
||||
// the maximum amount of damage that this wound can have and still autoheal
|
||||
var/autoheal_cutoff = 15
|
||||
|
||||
|
||||
// internal wounds can only be fixed through surgery
|
||||
var/internal = 0
|
||||
|
||||
// amount of germs in the wound
|
||||
var/germ_level = 0
|
||||
|
||||
// helper lists
|
||||
var/tmp/list/desc_list = list()
|
||||
var/tmp/list/damage_list = list()
|
||||
|
||||
New(var/damage)
|
||||
|
||||
created = world.time
|
||||
@@ -62,42 +64,58 @@
|
||||
|
||||
src.damage = damage
|
||||
|
||||
// initialize with the first stage
|
||||
next_stage()
|
||||
|
||||
// this will ensure the size of the wound matches the damage
|
||||
src.heal_damage(0)
|
||||
|
||||
// make the max_bleeding_stage count from the end of the list rather than the start
|
||||
// this is more robust to changes to the list
|
||||
max_bleeding_stage = src.desc_list.len - max_bleeding_stage
|
||||
|
||||
// initialize with the appropriate stage
|
||||
src.init_stage(damage)
|
||||
|
||||
bleed_timer += damage
|
||||
|
||||
// returns 1 if there's a next stage, 0 otherwise
|
||||
proc/next_stage()
|
||||
if(current_stage + 1 > src.desc_list.len)
|
||||
return 0
|
||||
|
||||
current_stage++
|
||||
proc/init_stage(var/initial_damage)
|
||||
current_stage = stages.len
|
||||
|
||||
while(src.current_stage > 1 && src.damage_list[current_stage-1] <= initial_damage / src.amount)
|
||||
src.current_stage--
|
||||
|
||||
src.min_damage = damage_list[current_stage]
|
||||
src.desc = desc_list[current_stage]
|
||||
return 1
|
||||
|
||||
// returns 1 if the wound has started healing
|
||||
proc/started_healing()
|
||||
return (current_stage > 1)
|
||||
|
||||
// the amount of damage per wound
|
||||
proc/wound_damage()
|
||||
return src.damage / src.amount
|
||||
|
||||
// checks whether the wound has been appropriately treated
|
||||
// always returns 1 for wounds that don't need to be treated
|
||||
// always returns 1 for wounds that are too minor to need treatment
|
||||
proc/is_treated()
|
||||
if(!needs_treatment) return 1
|
||||
if(src.wound_damage() <= autoheal_cutoff)
|
||||
return 1
|
||||
|
||||
if(damage_type == BRUISE || damage_type == CUT)
|
||||
return bandaged
|
||||
else if(damage_type == BURN)
|
||||
return salved
|
||||
|
||||
|
||||
// Checks whether other other can be merged into src.
|
||||
proc/can_merge(var/datum/wound/other)
|
||||
if (other.type != src.type) return 0
|
||||
if (other.current_stage != src.current_stage) return 0
|
||||
if (other.damage_type != src.damage_type) return 0
|
||||
if (!(other.is_treated()) != !(src.is_treated())) return 0
|
||||
if (!(other.bandaged) != !(src.bandaged)) return 0
|
||||
if (!(other.clamped) != !(src.clamped)) return 0
|
||||
if (!(other.salved) != !(src.salved)) return 0
|
||||
if (!(other.disinfected) != !(src.disinfected)) return 0
|
||||
//if (other.germ_level != src.germ_level) return 0
|
||||
return 1
|
||||
|
||||
proc/merge_wound(var/datum/wound/other)
|
||||
src.damage += other.damage
|
||||
src.amount += other.amount
|
||||
src.bleed_timer += other.bleed_timer
|
||||
src.germ_level = max(src.germ_level, other.germ_level)
|
||||
src.created = max(src.created, other.created) //take the newer created time
|
||||
|
||||
// checks if wound is considered open for external infections
|
||||
// untreated cuts (and bleeding bruises) and burns are possibly infectable, chance higher if wound is bigger
|
||||
@@ -128,7 +146,7 @@
|
||||
amount -= healed_damage
|
||||
src.damage -= healed_damage
|
||||
|
||||
while(src.damage / src.amount < damage_list[current_stage] && current_stage < src.desc_list.len)
|
||||
while(src.wound_damage() < damage_list[current_stage] && current_stage < src.desc_list.len)
|
||||
current_stage++
|
||||
desc = desc_list[current_stage]
|
||||
src.min_damage = damage_list[current_stage]
|
||||
@@ -141,118 +159,98 @@
|
||||
src.damage += damage
|
||||
bleed_timer += damage
|
||||
|
||||
while(src.current_stage > 1 && src.damage_list[current_stage-1] <= src.damage)
|
||||
while(src.current_stage > 1 && src.damage_list[current_stage-1] <= src.damage / src.amount)
|
||||
src.current_stage--
|
||||
|
||||
src.desc = desc_list[current_stage]
|
||||
src.min_damage = damage_list[current_stage]
|
||||
|
||||
// returns whether this wound can absorb the given amount of damage.
|
||||
// this will prevent large amounts of damage being trapped in less severe wound types
|
||||
proc/can_worsen(damage_type, damage)
|
||||
if (src.damage_type != damage_type)
|
||||
return 0 //incompatible damage types
|
||||
|
||||
if (src.amount > 1)
|
||||
return 0
|
||||
|
||||
//with 1.5*, a shallow cut will be able to carry at most 30 damage,
|
||||
//37.5 for a deep cut
|
||||
//52.5 for a flesh wound, etc.
|
||||
var/max_wound_damage = 1.5*src.damage_list[1]
|
||||
if (src.damage + damage > max_wound_damage)
|
||||
return 0
|
||||
|
||||
return 1
|
||||
|
||||
|
||||
proc/bleeding()
|
||||
// internal wounds don't bleed in the sense of this function
|
||||
return ((damage > 30 || bleed_timer > 0) && !(bandaged||clamped) && (damage_type == BRUISE && damage >= 20 || damage_type == CUT && damage >= 5) && current_stage <= max_bleeding_stage && !src.internal)
|
||||
return ((wound_damage() > 30 || bleed_timer > 0) && !(bandaged||clamped) && (damage_type == BRUISE && wound_damage() >= 20 || damage_type == CUT && wound_damage() >= 5) && current_stage <= max_bleeding_stage && !src.internal)
|
||||
|
||||
/** CUTS **/
|
||||
/datum/wound/cut/small
|
||||
// link wound descriptions to amounts of damage
|
||||
max_bleeding_stage = 2
|
||||
stages = list("ugly ripped cut" = 20, "ripped cut" = 10, "cut" = 5, "healing cut" = 2, "small scab" = 0)
|
||||
damage_type = CUT
|
||||
|
||||
/datum/wound/cut/deep
|
||||
max_bleeding_stage = 3
|
||||
stages = list("ugly deep ripped cut" = 25, "deep ripped cut" = 20, "deep cut" = 15, "clotted cut" = 8, "scab" = 2, "fresh skin" = 0)
|
||||
damage_type = CUT
|
||||
|
||||
/datum/wound/cut/flesh
|
||||
max_bleeding_stage = 3
|
||||
stages = list("ugly ripped flesh wound" = 35, "ugly flesh wound" = 30, "flesh wound" = 25, "blood soaked clot" = 15, "large scab" = 5, "fresh skin" = 0)
|
||||
damage_type = CUT
|
||||
|
||||
/datum/wound/cut/gaping
|
||||
max_bleeding_stage = 2
|
||||
stages = list("gaping wound" = 50, "large blood soaked clot" = 25, "large clot" = 15, "small angry scar" = 5, \
|
||||
"small straight scar" = 0)
|
||||
stages = list("gaping wound" = 50, "large blood soaked clot" = 25, "large clot" = 15, "small angry scar" = 5, "small straight scar" = 0)
|
||||
damage_type = CUT
|
||||
|
||||
/datum/wound/cut/gaping_big
|
||||
max_bleeding_stage = 2
|
||||
stages = list("big gaping wound" = 60, "healing gaping wound" = 40, "large angry scar" = 10, "large straight scar" = 0)
|
||||
|
||||
needs_treatment = 1 // this only heals when bandaged
|
||||
damage_type = CUT
|
||||
|
||||
datum/wound/cut/massive
|
||||
max_bleeding_stage = 2
|
||||
stages = list("massive wound" = 70, "massive healing wound" = 50, "massive angry scar" = 10, "massive jagged scar" = 0)
|
||||
|
||||
needs_treatment = 1 // this only heals when bandaged
|
||||
damage_type = CUT
|
||||
|
||||
/** BRUISES **/
|
||||
/datum/wound/bruise
|
||||
stages = list("monumental bruise" = 80, "huge bruise" = 50, "large bruise" = 30,\
|
||||
"moderate bruise" = 20, "small bruise" = 10, "tiny bruise" = 5)
|
||||
|
||||
needs_treatment = 1 // this only heals when bandaged
|
||||
max_bleeding_stage = 3
|
||||
autoheal_cutoff = 30
|
||||
damage_type = BRUISE
|
||||
|
||||
/datum/wound/bruise/monumental
|
||||
|
||||
// implement sub-paths by starting at a later stage
|
||||
|
||||
/datum/wound/bruise/tiny
|
||||
current_stage = 5
|
||||
needs_treatment = 0
|
||||
|
||||
/datum/wound/bruise/small
|
||||
current_stage = 4
|
||||
needs_treatment = 0
|
||||
|
||||
/datum/wound/bruise/moderate
|
||||
current_stage = 3
|
||||
needs_treatment = 0
|
||||
|
||||
/datum/wound/bruise/large
|
||||
current_stage = 2
|
||||
|
||||
/datum/wound/bruise/huge
|
||||
current_stage = 1
|
||||
|
||||
/** BURNS **/
|
||||
/datum/wound/burn/moderate
|
||||
stages = list("ripped burn" = 10, "moderate burn" = 5, "moderate salved burn" = 2, "fresh skin" = 0)
|
||||
|
||||
needs_treatment = 1 // this only heals when bandaged
|
||||
|
||||
damage_type = BURN
|
||||
|
||||
/datum/wound/burn/large
|
||||
stages = list("ripped large burn" = 20, "large burn" = 15, "large salved burn" = 5, "fresh skin" = 0)
|
||||
|
||||
needs_treatment = 1 // this only heals when bandaged
|
||||
|
||||
damage_type = BURN
|
||||
|
||||
/datum/wound/burn/severe
|
||||
stages = list("ripped severe burn" = 35, "severe burn" = 30, "severe salved burn" = 10, "burn scar" = 0)
|
||||
|
||||
needs_treatment = 1 // this only heals when bandaged
|
||||
|
||||
damage_type = BURN
|
||||
|
||||
/datum/wound/burn/deep
|
||||
stages = list("ripped deep burn" = 45, "deep burn" = 40, "deep salved burn" = 15, "large burn scar" = 0)
|
||||
|
||||
needs_treatment = 1 // this only heals when bandaged
|
||||
|
||||
damage_type = BURN
|
||||
|
||||
|
||||
/datum/wound/burn/carbonised
|
||||
stages = list("carbonised area" = 50, "treated carbonised area" = 20, "massive burn scar" = 0)
|
||||
|
||||
needs_treatment = 1 // this only heals when bandaged
|
||||
|
||||
damage_type = BURN
|
||||
|
||||
/datum/wound/internal_bleeding
|
||||
internal = 1
|
||||
|
||||
stages = list("severed vein" = 30, "cut vein" = 20, "damaged vein" = 10, "bruised vein" = 5)
|
||||
max_bleeding_stage = 0
|
||||
|
||||
needs_treatment = 1
|
||||
autoheal_cutoff = 5
|
||||
max_bleeding_stage = 0 //all stages bleed. It's called internal bleeding after all.
|
||||
|
||||
Reference in New Issue
Block a user