Adds new type of wounds - piercing.

Unlike cuts they do not merge, so many small-damage stabs will create many small stab wounds instead of one megahole.
Also cleans up checks in wound code a bit with power of OOP
This commit is contained in:
Chinsky
2016-02-11 01:56:12 +03:00
committed by Yoshax
parent 2c27ad3494
commit e12e9300fa
4 changed files with 76 additions and 13 deletions

View File

@@ -9,6 +9,7 @@
#define CUT "cut" #define CUT "cut"
#define BRUISE "bruise" #define BRUISE "bruise"
#define PIERCE "pierce"
#define STUN "stun" #define STUN "stun"
#define WEAKEN "weaken" #define WEAKEN "weaken"

View File

@@ -82,11 +82,12 @@
if(!do_mob(user, M, W.damage/5)) if(!do_mob(user, M, W.damage/5))
user << "<span class='notice'>You must stand still to bandage wounds.</span>" user << "<span class='notice'>You must stand still to bandage wounds.</span>"
break break
if (W.current_stage <= W.max_bleeding_stage) if (W.current_stage <= W.max_bleeding_stage)
user.visible_message("<span class='notice'>\The [user] bandages \a [W.desc] on [M]'s [affecting.name].</span>", \ user.visible_message("<span class='notice'>\The [user] bandages \a [W.desc] on [M]'s [affecting.name].</span>", \
"<span class='notice'>You bandage \a [W.desc] on [M]'s [affecting.name].</span>" ) "<span class='notice'>You bandage \a [W.desc] on [M]'s [affecting.name].</span>" )
//H.add_side_effect("Itch") //H.add_side_effect("Itch")
else if (istype(W,/datum/wound/bruise)) else if (W.damage_type == BRUISE)
user.visible_message("<span class='notice'>\The [user] places a bruise patch over \a [W.desc] on [M]'s [affecting.name].</span>", \ user.visible_message("<span class='notice'>\The [user] places a bruise patch over \a [W.desc] on [M]'s [affecting.name].</span>", \
"<span class='notice'>You place a bruise patch over \a [W.desc] on [M]'s [affecting.name].</span>" ) "<span class='notice'>You place a bruise patch over \a [W.desc] on [M]'s [affecting.name].</span>" )
else else
@@ -183,8 +184,7 @@
if (W.current_stage <= W.max_bleeding_stage) if (W.current_stage <= W.max_bleeding_stage)
user.visible_message("<span class='notice'>\The [user] cleans \a [W.desc] on [M]'s [affecting.name] and seals the edges with bioglue.</span>", \ user.visible_message("<span class='notice'>\The [user] cleans \a [W.desc] on [M]'s [affecting.name] and seals the edges with bioglue.</span>", \
"<span class='notice'>You clean and seal \a [W.desc] on [M]'s [affecting.name].</span>" ) "<span class='notice'>You clean and seal \a [W.desc] on [M]'s [affecting.name].</span>" )
//H.add_side_effect("Itch") else if (W.damage_type == BRUISE)
else if (istype(W,/datum/wound/bruise))
user.visible_message("<span class='notice'>\The [user] places a medical patch over \a [W.desc] on [M]'s [affecting.name].</span>", \ user.visible_message("<span class='notice'>\The [user] places a medical patch over \a [W.desc] on [M]'s [affecting.name].</span>", \
"<span class='notice'>You place a medical patch over \a [W.desc] on [M]'s [affecting.name].</span>" ) "<span class='notice'>You place a medical patch over \a [W.desc] on [M]'s [affecting.name].</span>" )
else else

View File

@@ -255,6 +255,9 @@
if(is_damageable(brute + burn) || !config.limbs_can_break) if(is_damageable(brute + burn) || !config.limbs_can_break)
if(brute) if(brute)
if(can_cut) if(can_cut)
if(sharp && !edge)
createwound( PIERCE, brute )
else
createwound( CUT, brute ) createwound( CUT, brute )
else else
createwound( BRUISE, brute ) createwound( BRUISE, brute )
@@ -269,6 +272,9 @@
if (brute > 0) if (brute > 0)
//Inflict all burte damage we can //Inflict all burte damage we can
if(can_cut) if(can_cut)
if(sharp && !edge)
createwound( PIERCE, min(brute,can_inflict) )
else
createwound( CUT, min(brute,can_inflict) ) createwound( CUT, min(brute,can_inflict) )
else else
createwound( BRUISE, min(brute,can_inflict) ) createwound( BRUISE, min(brute,can_inflict) )
@@ -332,10 +338,10 @@
break break
// heal brute damage // heal brute damage
if(W.damage_type == CUT || W.damage_type == BRUISE) if(W.damage_type == BURN)
brute = W.heal_damage(brute)
else if(W.damage_type == BURN)
burn = W.heal_damage(burn) burn = W.heal_damage(burn)
else
brute = W.heal_damage(brute)
if(internal) if(internal)
status &= ~ORGAN_BROKEN status &= ~ORGAN_BROKEN
@@ -659,10 +665,10 @@ Note that amputating the affected organ does in fact remove the infection from t
//update damage counts //update damage counts
for(var/datum/wound/W in wounds) for(var/datum/wound/W in wounds)
if(!W.internal) //so IB doesn't count towards crit/paincrit if(!W.internal) //so IB doesn't count towards crit/paincrit
if(W.damage_type == CUT || W.damage_type == BRUISE) if(W.damage_type == BURN)
brute_dam += W.damage
else if(W.damage_type == BURN)
burn_dam += W.damage burn_dam += W.damage
else
brute_dam += W.damage
if(!(status & ORGAN_ROBOT) && W.bleeding() && (H && H.should_have_organ(O_HEART))) if(!(status & ORGAN_ROBOT) && W.bleeding() && (H && H.should_have_organ(O_HEART)))
W.bleed_timer-- W.bleed_timer--

View File

@@ -38,7 +38,7 @@
var/internal = 0 var/internal = 0
// maximum stage at which bleeding should still happen. Beyond this stage bleeding is prevented. // maximum stage at which bleeding should still happen. Beyond this stage bleeding is prevented.
var/max_bleeding_stage = 0 var/max_bleeding_stage = 0
// one of CUT, BRUISE, BURN // one of CUT, PIERCE, BRUISE, BURN
var/damage_type = CUT var/damage_type = CUT
// whether this wound needs a bandage/salve to heal at all // whether this wound needs a bandage/salve to heal at all
// the maximum amount of damage that this wound can have and still autoheal // the maximum amount of damage that this wound can have and still autoheal
@@ -211,7 +211,7 @@
if (wound_damage() <= 30 && bleed_timer <= 0) if (wound_damage() <= 30 && bleed_timer <= 0)
return 0 //Bleed timer has run out. Wounds with more than 30 damage don't stop bleeding on their own. return 0 //Bleed timer has run out. Wounds with more than 30 damage don't stop bleeding on their own.
return (damage_type == BRUISE && wound_damage() >= 20 || damage_type == CUT && wound_damage() >= 5) return 1
/** WOUND DEFINITIONS **/ /** WOUND DEFINITIONS **/
@@ -235,6 +235,18 @@
return /datum/wound/cut/deep return /datum/wound/cut/deep
if(0 to 15) if(0 to 15)
return /datum/wound/cut/small return /datum/wound/cut/small
if(PIERCE)
switch(damage)
if(60 to INFINITY)
return /datum/wound/puncture/massive
if(50 to 60)
return /datum/wound/puncture/gaping_big
if(30 to 50)
return /datum/wound/puncture/gaping
if(15 to 30)
return /datum/wound/puncture/flesh
if(0 to 15)
return /datum/wound/puncture/small
if(BRUISE) if(BRUISE)
return /datum/wound/bruise return /datum/wound/bruise
if(BURN) if(BURN)
@@ -252,6 +264,9 @@
return null //no wound return null //no wound
/** CUTS **/ /** CUTS **/
/datum/wound/cut/bleeding()
return ..() && wound_damage() >= 5
/datum/wound/cut/small /datum/wound/cut/small
// link wound descriptions to amounts of damage // link wound descriptions to amounts of damage
// Minor cuts have max_bleeding_stage set to the stage that bears the wound type's name. // Minor cuts have max_bleeding_stage set to the stage that bears the wound type's name.
@@ -285,7 +300,43 @@ datum/wound/cut/massive
stages = list("massive wound" = 70, "massive healing wound" = 50, "massive blood soaked clot" = 25, "massive angry scar" = 10, "massive jagged scar" = 0) stages = list("massive wound" = 70, "massive healing wound" = 50, "massive blood soaked clot" = 25, "massive angry scar" = 10, "massive jagged scar" = 0)
damage_type = CUT damage_type = CUT
/** PUNCTURES **/
/datum/wound/puncture/can_worsen(damage_type, damage)
return 0
/datum/wound/puncture/can_merge(var/datum/wound/other)
return 0
/datum/wound/puncture/bleeding()
return ..() && wound_damage() >= 5
/datum/wound/puncture/small
max_bleeding_stage = 2
stages = list("puncture" = 5, "healing puncture" = 2, "small scab" = 0)
damage_type = PIERCE
/datum/wound/puncture/flesh
max_bleeding_stage = 2
stages = list("puncture wound" = 15, "blood soaked clot" = 5, "large scab" = 2, "small round scar" = 0)
damage_type = PIERCE
/datum/wound/puncture/gaping
max_bleeding_stage = 3
stages = list("gaping hole" = 30, "large blood soaked clot" = 15, "blood soaked clot" = 10, "small angry scar" = 5, "small round scar" = 0)
damage_type = PIERCE
/datum/wound/puncture/gaping_big
max_bleeding_stage = 3
stages = list("big gaping hole" = 50, "healing gaping hole" = 20, "large blood soaked clot" = 15, "large angry scar" = 10, "large round scar" = 0)
damage_type = PIERCE
datum/wound/puncture/massive
max_bleeding_stage = 3
stages = list("massive wound" = 60, "massive healing wound" = 30, "massive blood soaked clot" = 25, "massive angry scar" = 10, "massive jagged scar" = 0)
damage_type = PIERCE
/** BRUISES **/ /** BRUISES **/
/datum/wound/bruise/bleeding()
return ..() && wound_damage() >= 20
/datum/wound/bruise /datum/wound/bruise
stages = list("monumental bruise" = 80, "huge bruise" = 50, "large bruise" = 30, stages = list("monumental bruise" = 80, "huge bruise" = 50, "large bruise" = 30,
"moderate bruise" = 20, "small bruise" = 10, "tiny bruise" = 5) "moderate bruise" = 20, "small bruise" = 10, "tiny bruise" = 5)
@@ -294,6 +345,11 @@ datum/wound/cut/massive
damage_type = BRUISE damage_type = BRUISE
/** BURNS **/ /** BURNS **/
/datum/wound/burn
max_bleeding_stage = 0
/datum/wound/burn/bleeding()
return 0
/datum/wound/burn/moderate /datum/wound/burn/moderate
stages = list("ripped burn" = 10, "moderate burn" = 5, "healing moderate burn" = 2, "fresh skin" = 0) stages = list("ripped burn" = 10, "moderate burn" = 5, "healing moderate burn" = 2, "fresh skin" = 0)
damage_type = BURN damage_type = BURN