Conflicts:
	code/datums/organs/organ_external.dm

Carried over my previous commit with CIB's change.
Used bandage() proc in surgery step too.
This commit is contained in:
Chinsky
2012-10-13 14:02:04 +04:00
72 changed files with 13157 additions and 11722 deletions
+2
View File
@@ -1,3 +1,5 @@
var/global/const/base_law_type = /datum/ai_laws/nanotrasen
/datum/ai_laws
var/name = "Unknown Laws"
+24 -25
View File
@@ -33,6 +33,9 @@
var/open = 0
var/stage = 0
// how often wounds should be updated, a higher number means less often
var/wound_update_accuracy = 20 // update every 20 ticks(roughly every minute)
proc/take_damage(brute, burn, sharp, used_weapon = null, list/forbidden_limbs = list())
// TODO: this proc needs to be rewritten to not update damages directly
if((brute <= 0) && (burn <= 0))
@@ -69,32 +72,22 @@
// If the limbs can break, make sure we don't exceed the maximum damage a limb can take before breaking
if((brute_dam + burn_dam + brute + burn) < max_damage || !config.limbs_can_break)
if(brute)
brute_dam += brute
if( (prob(brute*2) && !sharp) || sharp )
createwound( CUT, brute )
else if(!sharp)
createwound( BRUISE, brute )
if(burn)
burn_dam += burn
createwound( BURN, burn )
else
// If we can't inflict the full amount of damage, spread the damage in other ways
var/can_inflict = max_damage * config.organ_health_multiplier - (brute_dam + burn_dam) //How much damage can we actually cause?
if(can_inflict)
if (brute > 0 && burn > 0)
brute = can_inflict/2
burn = can_inflict/2
var/ratio = brute / (brute + burn)
brute_dam += ratio * can_inflict
burn_dam += (1 - ratio) * can_inflict
else
if (brute > 0)
brute = can_inflict
brute_dam += brute
createwound(BRUISE, brute)
else
burn = can_inflict
burn_dam += burn
createwound(BRUISE, brute)
if (brute > 0)
brute = can_inflict
createwound(BRUISE, brute)
if (burn > 0)
burn = can_inflict
createwound(BURN, burn)
else if(!(status & ORGAN_ROBOT))
var/passed_dam = (brute + burn) - can_inflict //Getting how much overdamage we have.
var/list/datum/organ/external/possible_points = list()
@@ -169,7 +162,7 @@
else if(W.damage_type == BURN)
burn_dam += W.damage
if(!W.bandaged && (W.damage_type == CUT || W.damage_type == BRUISE && W.damage >=20))
if(W.bleeding())
status |= ORGAN_BLEEDING
number_wounds += W.amount
@@ -187,11 +180,16 @@
if(W.salved) amount++
if(W.disinfected) amount++
// amount of healing is spread over all the wounds
W.heal_damage((amount * W.amount * config.organ_regeneration_multiplier) / (5*owner.number_wounds+1))
W.heal_damage((wound_update_accuracy * amount * W.amount * config.organ_regeneration_multiplier) / (20*owner.number_wounds+1))
// sync the organ's damage with its wounds
src.update_damages()
proc/bandage()
status |= ORGAN_BANDAGED
for(var/datum/wound/W in wounds)
W.bandaged = 1
proc/get_damage() //returns total damage
return max(brute_dam + burn_dam - perma_injury, perma_injury) //could use health?
@@ -204,7 +202,7 @@
process()
// process wounds, doing healing etc., only do this every 4 ticks to save processing power
if(owner.life_tick % 4 == 0)
if(owner.life_tick % wound_update_accuracy == 0)
update_wounds()
if(status & ORGAN_DESTROYED)
if(!destspawn && config.limbs_can_break)
@@ -373,14 +371,15 @@
var/size = min( max( 1, damage/10 ) , 6)
// first check whether we can widen an existing wound
if(wounds.len > 0 && prob(25))
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()
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.")
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
+21 -17
View File
@@ -90,42 +90,46 @@
while(src.damage / src.amount < damage_list[current_stage] && current_stage < src.desc_list.len)
current_stage++
desc = desc_list[current_stage]
src.min_damage = damage_list[current_stage]
// return amount of healing still leftover, can be used for other wounds
return amount
// opens the wound again
proc/open_wound()
if(current_stage > 1)
// e.g. current_stage is 2, then reset it to 0 and do next_stage(), bringing it to 1
src.current_stage -= 2
next_stage()
src.damage = src.min_damage + 5
proc/open_wound(damage)
src.damage += damage
while(src.current_stage > 1 && src.damage_list[current_stage-1] <= src.damage)
src.current_stage--
src.desc = desc_list[current_stage]
src.min_damage = damage_list[current_stage]
proc/bleeding()
return (!bandaged && (damage_type == BRUISE && damage >= 20 || damage_type == CUT))
/** CUTS **/
/datum/wound/cut
// link wound descriptions to amounts of damage
stages = list("cut" = 5, "healing cut" = 2, "small scab" = 0)
stages = list("ugly ripped cut" = 20, "ripped cut" = 10, "cut" = 5, "healing cut" = 2, "small scab" = 0)
/datum/wound/deep_cut
stages = list("deep cut" = 15, "clotted cut" = 8, "scab" = 2, "fresh skin" = 0)
stages = list("ugly deep ripped cut" = 25, "deep ripped cut" = 20, "deep cut" = 15, "clotted cut" = 8, "scab" = 2, "fresh skin" = 0)
/datum/wound/flesh_wound
stages = list("flesh wound" = 25, "blood soaked clot" = 15, "large scab" = 5, "fresh skin" = 0)
stages = list("ugly ripped flesh wound" = 35, "ugly flesh wound" = 30, "flesh wound" = 25, "blood soaked clot" = 15, "large scab" = 5, "fresh skin" = 0)
/datum/wound/gaping_wound
stages = list("gaping wound" = 50, "large blood soaked clot" = 25, "large clot" = 15, "small angry scar" = 5, \
"small straight scar" = 0)
/datum/wound/big_gaping_wound
stages = list("big gaping wound" = 60, "gauze wrapped wound" = 50, "blood soaked bandage" = 25,\
"large angry scar" = 10, "large straight scar" = 0)
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
/datum/wound/massive_wound
stages = list("massive wound" = 70, "massive blood soaked bandage" = 40, "huge bloody mess" = 20,\
"massive angry scar" = 10, "massive jagged scar" = 0)
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
@@ -160,28 +164,28 @@
/** BURNS **/
/datum/wound/moderate_burn
stages = list("moderate burn" = 5, "moderate salved burn" = 2, "fresh skin" = 0)
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/large_burn
stages = list("large burn" = 15, "large salved burn" = 5, "fresh skin" = 0)
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/severe_burn
stages = list("severe burn" = 30, "severe salved burn" = 10, "burn scar" = 0)
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/deep_burn
stages = list("deep burn" = 40, "deep salved burn" = 15, "large burn scar" = 0)
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