Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Первоначальная инициализация - Урон органам
Browse files Browse the repository at this point in the history
msw7007 committed Jun 29, 2024
1 parent 261d4aa commit 58deb05
Showing 6 changed files with 183 additions and 0 deletions.
5 changes: 5 additions & 0 deletions modular_bandastation/medical/_medical.dme
Original file line number Diff line number Diff line change
@@ -10,6 +10,11 @@
#include "code/cpr_extension/cpr_extension.dm"

#include "code/organ_damage/remake_organ_decay.dm"
#include "code/organ_damage/organ_damage_ondamage.dm"
//#include "code/organ_damage/organ_damage_brute.dm"
//#include "code/organ_damage/organ_damage_burn.dm"
//#include "code/organ_damage/organ_damage_toxin.dm"
//#include "code/organ_damage/organ_damage_oxygen.dm"

#include "code/new_wounds/internal_bleed.dm"
#include "code/new_wounds/necrosis.dm"
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/mob/living/adjustBruteLoss(amount, updating_health = TRUE, forced = FALSE, required_bodytype = ALL)
if (!can_adjust_brute_loss(amount, forced, required_bodytype))
return 0
. = bruteloss
bruteloss = clamp((bruteloss + (amount * CONFIG_GET(number/damage_multiplier))), 0, maxHealth * 2)
. -= bruteloss

switch(required_bodytype)
if(BODY_ZONE_HEAD)
if(!HAS_TRAIT(src, TRAIT_HEAD_INJURY_BLOCKED))
if(prob(amount))
adjustOrganLoss(ORGAN_SLOT_BRAIN, bruteloss * 0.5)
if(stat == CONSCIOUS)
visible_message(
span_danger("[src] is knocked senseless!"),
span_userdanger("You're knocked senseless!"),
)
set_confusion_if_lower(20 SECONDS)
adjust_eye_blur(20 SECONDS)
if(prob(10))
gain_trauma(/datum/brain_trauma/mild/concussion)
else
adjustOrganLoss(ORGAN_SLOT_BRAIN, bruteloss * 0.2)
if(BODY_ZONE_CHEST)
if(prob(amount))
adjustOrganLoss(ORGAN_SLOT_STOMACH, bruteloss * 0.3)
if(BODY_ZONE_PRECISE_GROIN)
if(prob(amount))
adjustOrganLoss(ORGAN_SLOT_LIVER, bruteloss * 0.4)

if(!.) // no change, no need to update
return 0
if(updating_health)
updatehealth()
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/mob/living/proc/adjustFireLoss(amount, updating_health = TRUE, forced = FALSE, required_bodytype = ALL)
if(!can_adjust_fire_loss(amount, forced, required_bodytype))
return 0
. = fireloss
fireloss = clamp((fireloss + (amount * CONFIG_GET(number/damage_multiplier))), 0, maxHealth * 2)
. -= fireloss

if(BODY_ZONE_CHEST)
if(prob(amount))
adjustOrganLoss(ORGAN_SLOT_LUNGS, fireloss * 0.2,required_organ_flag = ORGAN_ORGANIC)
else
adjustOrganLoss(ORGAN_SLOT_LUNGS, fireloss * 0.05,required_organ_flag = ORGAN_ORGANIC)

if(. == 0) // no change, no need to update
return
if(updating_health)
updatehealth()
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
/mob/living/carbon/human/attack_effects(damage_done, hit_zone, armor_block, obj/item/attacking_item, mob/living/attacker)
. = ..()
switch(hit_zone)
if(BODY_ZONE_HEAD)
if(.)
if(wear_mask)
wear_mask.add_mob_blood(src)
update_worn_mask()
if(head)
head.add_mob_blood(src)
update_worn_head()
if(glasses && prob(33))
glasses.add_mob_blood(src)
update_worn_glasses()

// rev deconversion through blunt trauma.
// this can be signalized to the rev datum
if(mind && stat == CONSCIOUS && src != attacker && prob(damage_done + ((100 - health) * 0.5)))
var/datum/antagonist/rev/rev = mind.has_antag_datum(/datum/antagonist/rev)
rev?.remove_revolutionary(attacker)

if(BODY_ZONE_CHEST)
if(.)
if(wear_suit)
wear_suit.add_mob_blood(src)
update_worn_oversuit()
if(w_uniform)
w_uniform.add_mob_blood(src)
update_worn_undersuit()

if(stat == CONSCIOUS && !attacking_item.get_sharpness() && !HAS_TRAIT(src, TRAIT_BRAWLING_KNOCKDOWN_BLOCKED) && attacking_item.damtype == BRUTE)
if(prob(damage_done))
visible_message(
span_danger("[src] is knocked down!"),
span_userdanger("You're knocked down!"),
)
apply_effect(6 SECONDS, EFFECT_KNOCKDOWN, armor_block)

// Triggers force say events
if(damage_done > 10 || (damage_done >= 5 && prob(33)))
force_say()


/datum/species/handle_environment_pressure(mob/living/carbon/human/H, datum/gas_mixture/environment, seconds_per_tick, times_fired)
var/pressure = environment.return_pressure()
var/adjusted_pressure = H.calculate_affecting_pressure(pressure)

// Set alerts and apply damage based on the amount of pressure
switch(adjusted_pressure)
// Very high pressure, show an alert and take damage
if(HAZARD_HIGH_PRESSURE to INFINITY)
if(HAS_TRAIT(H, TRAIT_RESISTHIGHPRESSURE))
H.clear_alert(ALERT_PRESSURE)
else
var/pressure_damage = min(((adjusted_pressure / HAZARD_HIGH_PRESSURE) - 1) * PRESSURE_DAMAGE_COEFFICIENT, MAX_HIGH_PRESSURE_DAMAGE) * H.physiology.pressure_mod * H.physiology.brute_mod * seconds_per_tick
H.adjustBruteLoss(pressure_damage, required_bodytype = BODYTYPE_ORGANIC)
H.adjustOrganLoss(ORGAN_SLOT_LUNGS, pressure_damage, required_organ_flag = ORGAN_ORGANIC)
H.throw_alert(ALERT_PRESSURE, /atom/movable/screen/alert/highpressure, 2)

// High pressure, show an alert
if(WARNING_HIGH_PRESSURE to HAZARD_HIGH_PRESSURE)
H.throw_alert(ALERT_PRESSURE, /atom/movable/screen/alert/highpressure, 1)

// No pressure issues here clear pressure alerts
if(WARNING_LOW_PRESSURE to WARNING_HIGH_PRESSURE)
H.clear_alert(ALERT_PRESSURE)

// Low pressure here, show an alert
if(HAZARD_LOW_PRESSURE to WARNING_LOW_PRESSURE)
// We have low pressure resit trait, clear alerts
if(HAS_TRAIT(H, TRAIT_RESISTLOWPRESSURE))
H.clear_alert(ALERT_PRESSURE)
else
H.throw_alert(ALERT_PRESSURE, /atom/movable/screen/alert/lowpressure, 1)

// Very low pressure, show an alert and take damage
else
// We have low pressure resit trait, clear alerts
if(HAS_TRAIT(H, TRAIT_RESISTLOWPRESSURE))
H.clear_alert(ALERT_PRESSURE)
else
var/pressure_damage = LOW_PRESSURE_DAMAGE * H.physiology.pressure_mod * H.physiology.brute_mod * seconds_per_tick
H.adjustBruteLoss(pressure_damage, required_bodytype = BODYTYPE_ORGANIC)
H.adjustOrganLoss(ORGAN_SLOT_LUNGS, pressure_damage, required_organ_flag = ORGAN_ORGANIC)
H.throw_alert(ALERT_PRESSURE, /atom/movable/screen/alert/lowpressure, 2)
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/mob/living/proc/adjustOxyLoss(amount, updating_health = TRUE, forced = FALSE, required_biotype = ALL, required_respiration_type = ALL)
if(!can_adjust_oxy_loss(amount, forced, required_biotype, required_respiration_type))
return 0
. = oxyloss
oxyloss = clamp((oxyloss + (amount * CONFIG_GET(number/damage_multiplier))), 0, maxHealth * 2)
. -= oxyloss

adjustOrganLoss(ORGAN_SLOT_BRAIN, oxyloss * 0.15)

if(!.) // no change, no need to update
return FALSE
if(updating_health)
updatehealth()
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/mob/living/adjustToxLoss(amount, updating_health = TRUE, forced = FALSE, required_biotype = ALL)
if(!can_adjust_tox_loss(amount, forced, required_biotype))
return 0

if(!forced && HAS_TRAIT(src, TRAIT_TOXINLOVER)) //damage becomes healing and healing becomes damage
amount = -amount
if(HAS_TRAIT(src, TRAIT_TOXIMMUNE)) //Prevents toxin damage, but not healing
amount = min(amount, 0)
if(blood_volume)
if(amount > 0)
blood_volume = max(blood_volume - (5 * amount), 0)
else
blood_volume = max(blood_volume - amount, 0)

else if(!forced && HAS_TRAIT(src, TRAIT_TOXIMMUNE)) //Prevents toxin damage, but not healing
amount = min(amount, 0)

. = toxloss
toxloss = clamp((toxloss + (amount * CONFIG_GET(number/damage_multiplier))), 0, maxHealth * 2)
if(prob(amount))
adjustOrganLoss(ORGAN_SLOT_LIVER, toxloss * 0.2,required_organ_flag = ORGAN_ORGANIC)
toxloss -= toxloss * 0.2
. -= toxloss

if(!.) // no change, no need to update
return FALSE

if(updating_health)
updatehealth()

0 comments on commit 58deb05

Please sign in to comment.