diff --git a/code/__defines/damage.dm b/code/__defines/damage.dm
index e3c45646c796..23d99d245d9a 100644
--- a/code/__defines/damage.dm
+++ b/code/__defines/damage.dm
@@ -1,2 +1,11 @@
///The decimal precision for health values. Health will be rounded against this value.
#define HEALTH_ROUNDING 0.01
+
+#define BRUTE /decl/damage_handler/brute
+#define BURN /decl/damage_handler/burn
+#define TOX /decl/damage_handler/organ
+#define CLONE /decl/damage_handler/genetic
+#define ELECTROCUTE /decl/damage_handler/electrocute
+#define PAIN /decl/damage_handler/pain
+#define OXY /decl/damage_handler/suffocation
+#define IRRADIATE /decl/damage_handler/radiation
\ No newline at end of file
diff --git a/code/__defines/damage_organs.dm b/code/__defines/damage_organs.dm
index 36cc5ad868f1..719591533b8d 100644
--- a/code/__defines/damage_organs.dm
+++ b/code/__defines/damage_organs.dm
@@ -1,21 +1,13 @@
-#define BRUTE "brute"
-#define BURN "fire"
-#define TOX "tox"
-#define OXY "oxy"
-#define CLONE "clone"
-#define PAIN "pain"
-#define ELECTROCUTE "electrocute"
-
-#define CUT "cut"
-#define BRUISE "bruise"
-#define PIERCE "pierce"
-#define LASER "laser"
-#define SHATTER "shatter"
+#define WOUND_CUT "cut"
+#define WOUND_BURN "burn"
+#define WOUND_BRUISE "bruise"
+#define WOUND_PIERCE "pierce"
+#define WOUND_LASER "laser"
+#define WOUND_SHATTER "shatter"
#define STUN "stun"
#define WEAKEN "weaken"
#define PARALYZE "paralize"
-#define IRRADIATE "irradiate"
#define SLUR "slur"
#define STUTTER "stutter"
#define EYE_BLUR "eye_blur"
diff --git a/code/__defines/shields.dm b/code/__defines/shields.dm
index f3b075265e41..edef1cf81101 100644
--- a/code/__defines/shields.dm
+++ b/code/__defines/shields.dm
@@ -1,7 +1,3 @@
-#define SHIELD_DAMTYPE_PHYSICAL 1 // Physical damage - bullets, meteors, various hand objects - aka. BRUTE damtype.
-#define SHIELD_DAMTYPE_EM 2 // Electromagnetic damage - Ion weaponry, stun beams, ...
-#define SHIELD_DAMTYPE_HEAT 3 // Heat damage - Lasers, fire
-
#define ENERGY_PER_HP (45 KILOWATTS)// Base amount energy that will be deducted from the generator's internal reserve per 1 HP of damage taken
#define ENERGY_UPKEEP_PER_TILE (4 KILOWATTS) // Base upkeep per tile protected. Multiplied by various enabled shield modes. Without them the field does literally nothing.
#define ENERGY_UPKEEP_IDLE 45 // Base upkeep when idle; modified by other factors.
diff --git a/code/_helpers/medical_scans.dm b/code/_helpers/medical_scans.dm
index 38e5f245d2d2..706b00bdee0b 100644
--- a/code/_helpers/medical_scans.dm
+++ b/code/_helpers/medical_scans.dm
@@ -10,7 +10,7 @@
if(!brain || H.stat == DEAD || (H.status_flags & FAKEDEATH))
brain_result = 0
else if(H.stat != DEAD)
- brain_result = round(max(0,(1 - brain.damage/brain.max_damage)*100))
+ brain_result = round(max(0,(1 - brain.organ_damage/brain.max_damage)*100))
else
brain_result = -1
scan["brain_activity"] = brain_result
@@ -38,12 +38,12 @@
scan["blood_volume"] = H.vessel.total_volume
scan["blood_volume_max"] = H.vessel.maximum_volume
scan["temperature"] = H.bodytemperature
- scan["trauma"] = H.getBruteLoss()
- scan["burn"] = H.getFireLoss()
- scan["toxin"] = H.getToxLoss()
- scan["oxygen"] = H.getOxyLoss()
- scan["radiation"] = H.radiation
- scan["genetic"] = H.getCloneLoss()
+ scan["trauma"] = H.get_damage(BRUTE)
+ scan["burn"] = H.get_damage(BURN)
+ scan["toxin"] = H.get_damage(TOX)
+ scan["oxygen"] = H.get_damage(OXY)
+ scan["radiation"] = H.get_damage(IRRADIATE)
+ scan["genetic"] = H.get_damage(CLONE)
scan["paralysis"] = GET_STATUS(H, STAT_PARA)
scan["immune_system"] = H.get_immunity()
scan["reagents"] = list()
@@ -78,7 +78,7 @@
O["name"] = I.name
O["is_broken"] = I.is_broken()
O["is_bruised"] = I.is_bruised()
- O["is_damaged"] = I.damage > 0
+ O["is_damaged"] = I.organ_damage > 0
O["scan_results"] = I.get_scan_results(tag)
O["ailments"] = I.has_diagnosable_ailments(scanner = TRUE)
scan["internal_organs"] += list(O)
diff --git a/code/controllers/subsystems/initialization/materials.dm b/code/controllers/subsystems/initialization/materials.dm
index b544be7ef2fa..a955391f46c1 100644
--- a/code/controllers/subsystems/initialization/materials.dm
+++ b/code/controllers/subsystems/initialization/materials.dm
@@ -184,31 +184,3 @@ SUBSYSTEM_DEF(materials)
if(istype(location.owner))
return location.owner.get_rock_color()
-
-// There is a disconnect between legacy damage and armor code. This here helps bridge the gap.
-// This could eventually be removed if we used decls for damage types.
-/datum/controller/subsystem/materials/proc/get_armor_key(damage_type, damage_flags)
- var/key
- switch(damage_type)
- if(BRUTE)
- if(damage_flags & DAM_BULLET)
- key = ARMOR_BULLET
- else if(damage_flags & DAM_EXPLODE)
- key = ARMOR_BOMB
- else
- key = ARMOR_MELEE
- if(BURN)
- if(damage_flags & DAM_LASER)
- key = ARMOR_LASER
- else if(damage_flags & DAM_EXPLODE)
- key = ARMOR_BOMB
- else
- key = ARMOR_ENERGY
- if(TOX)
- if(damage_flags & DAM_BIO)
- key = ARMOR_BIO // Otherwise just not blocked by default.
- if(IRRADIATE)
- key = ARMOR_RAD
- if(ELECTROCUTE)
- key = ARMOR_ENERGY
- return key
\ No newline at end of file
diff --git a/code/controllers/subsystems/statistics.dm b/code/controllers/subsystems/statistics.dm
index c41945144fa4..97064c6df2e0 100644
--- a/code/controllers/subsystems/statistics.dm
+++ b/code/controllers/subsystems/statistics.dm
@@ -157,10 +157,10 @@ SUBSYSTEM_DEF(statistics)
death.gender = dead.gender
death.time_of_death = time2text(world.realtime, "YYYY-MM-DD hh:mm:ss")
death.coords = "[dead.x], [dead.y], [dead.z]"
- death.bruteloss = dead.getBruteLoss()
- death.fireloss = dead.getFireLoss()
- death.brainloss = dead.getBrainLoss()
- death.oxyloss = dead.getOxyLoss()
+ death.bruteloss = dead.get_damage(BRUTE)
+ death.fireloss = dead.get_damage(BURN)
+ death.brainloss = dead.get_brain_damage()
+ death.oxyloss = dead.get_damage(OXY)
death.using_map_name = global.using_map.full_name
var/obj/effect/overmap/visitable/cell = global.overmap_sectors[num2text(dead.z)]
death.overmap_location_name = cell?.name || "Unknown"
diff --git a/code/datums/ai/human.dm b/code/datums/ai/human.dm
index bced65059e1e..b25948f65294 100644
--- a/code/datums/ai/human.dm
+++ b/code/datums/ai/human.dm
@@ -43,6 +43,6 @@
for(var/obj/item/organ/I in H.get_internal_organs())
if((I.status & ORGAN_DEAD) || BP_IS_PROSTHETIC(I)) continue
- if(I.damage > 2) if(prob(2))
+ if(I.organ_damage > 2) if(prob(2))
var/obj/item/organ/external/parent = GET_EXTERNAL_ORGAN(H, I.parent_organ)
H.custom_emote("clutches [G.his] [parent.name]!")
\ No newline at end of file
diff --git a/code/datums/damage/_damage_type.dm b/code/datums/damage/_damage_type.dm
new file mode 100644
index 000000000000..cdaf45c2f973
--- /dev/null
+++ b/code/datums/damage/_damage_type.dm
@@ -0,0 +1,53 @@
+/decl/damage_handler
+ abstract_type = /decl/damage_handler
+ var/name
+ var/color = COLOR_GUNMETAL
+ var/applies_to_machinery = FALSE
+ var/machinery_hit_sound = 'sound/weapons/smash.ogg'
+ var/blocked_by_ablative = FALSE
+ var/can_ignite_reagents = FALSE
+ var/damage_verb = "shatters"
+ var/allow_modification_in_vv = TRUE
+ var/usable_with_backstab = FALSE
+ var/causes_limb_damage = FALSE
+ var/projectile_damage_divisor = 1
+ var/projectile_damages_assembly_casing = TRUE
+ var/barrier_damage_multiplier = 0
+ var/item_damage_flags = 0
+ var/category_type
+ var/expected_type = /mob/living
+
+/decl/damage_handler/validate()
+ . = ..()
+ if(!name)
+ . += "no name set"
+ if(!category_type)
+ . += "no category type set"
+
+/decl/damage_handler/proc/set_mob_damage(var/mob/living/target, var/damage, var/skip_update_health = FALSE)
+ if(!(category_type in target._damage_values))
+ return FALSE
+ var/oldval = target._damage_values[category_type]
+ var/newval = clamp(oldval + damage, 0, target.get_max_health())
+ if(oldval == newval)
+ return FALSE
+ target._damage_values[category_type] = newval
+ if(!skip_update_health)
+ target.update_health()
+ return TRUE
+
+/decl/damage_handler/proc/heal_mob_damage(var/mob/living/target, var/damage, var/skip_update_health = FALSE)
+ return set_mob_damage(target, target.get_damage(category_type)-damage, skip_update_health = skip_update_health)
+
+/decl/damage_handler/proc/apply_damage_to_mob(var/mob/living/target, var/damage, var/def_zone, var/damage_flags = 0, var/used_weapon, var/silent = FALSE, var/skip_update_health = FALSE)
+ return set_mob_damage(target, target.get_damage(category_type)+damage, skip_update_health = skip_update_health)
+
+// There is a disconnect between legacy damage and armor code. This here helps bridge the gap.
+/decl/damage_handler/proc/get_armor_key(var/damage_flags = 0)
+ return null
+
+/decl/damage_handler/proc/get_damage_for_mob(var/mob/living/target)
+ return LAZYACCESS(target._damage_values, category_type) || 0
+
+/decl/damage_handler/proc/damage_limb(var/obj/item/organ/external/organ, var/damage, var/damage_flags = 0, var/used_weapon, var/skip_update_health = FALSE)
+ return organ?.take_damage(damage, category_type, damage_flags = damage_flags, used_weapon = used_weapon, skip_update_health = skip_update_health)
diff --git a/code/datums/damage/damage_brute.dm b/code/datums/damage/damage_brute.dm
new file mode 100644
index 000000000000..b33d73ce5405
--- /dev/null
+++ b/code/datums/damage/damage_brute.dm
@@ -0,0 +1,16 @@
+/decl/damage_handler/brute
+ name = "brute"
+ blocked_by_ablative = TRUE
+ can_ignite_reagents = TRUE // Why?
+ usable_with_backstab = TRUE
+ causes_limb_damage = TRUE
+ projectile_damage_divisor = 2
+ barrier_damage_multiplier = 0.5
+ category_type = /decl/damage_handler/brute
+
+/decl/damage_handler/brute/get_armor_key(var/damage_flags)
+ if(damage_flags & DAM_BULLET)
+ return ARMOR_BULLET
+ if(damage_flags & DAM_EXPLODE)
+ return ARMOR_BOMB
+ return ARMOR_MELEE
diff --git a/code/datums/damage/damage_burn.dm b/code/datums/damage/damage_burn.dm
new file mode 100644
index 000000000000..908d8d0641d4
--- /dev/null
+++ b/code/datums/damage/damage_burn.dm
@@ -0,0 +1,19 @@
+/decl/damage_handler/burn
+ name = "burn"
+ applies_to_machinery = TRUE
+ blocked_by_ablative = TRUE
+ can_ignite_reagents = TRUE
+ damage_verb = "sizzles"
+ usable_with_backstab = TRUE
+ causes_limb_damage = TRUE
+ projectile_damage_divisor = 1.5
+ barrier_damage_multiplier = 0.75
+ item_damage_flags = DAM_LASER
+ category_type = /decl/damage_handler/burn
+
+/decl/damage_handler/burn/get_armor_key(var/damage_flags)
+ if(damage_flags & DAM_LASER)
+ return ARMOR_LASER
+ if(damage_flags & DAM_EXPLODE)
+ return ARMOR_BOMB
+ return ARMOR_ENERGY
diff --git a/code/datums/damage/damage_electrocution.dm b/code/datums/damage/damage_electrocution.dm
new file mode 100644
index 000000000000..e017fd97e1f8
--- /dev/null
+++ b/code/datums/damage/damage_electrocution.dm
@@ -0,0 +1,21 @@
+/decl/damage_handler/electrocute
+ name = "electrocution"
+ can_ignite_reagents = TRUE
+ damage_verb = "sparks"
+ category_type = /decl/damage_handler/electrocute
+
+/decl/damage_handler/electrocute/get_armor_key(var/damage_flags)
+ return ARMOR_ENERGY
+
+/decl/damage_handler/electrocute/apply_damage_to_mob(var/mob/living/target, var/damage, var/def_zone, var/damage_flags = 0, var/used_weapon, var/silent = FALSE, var/skip_update_health = FALSE)
+ target.electrocute_act(damage) // todo
+ return TRUE
+
+/decl/damage_handler/electrocute/set_mob_damage(var/mob/living/target, var/damage, var/skip_update_health = FALSE)
+ return FALSE
+
+/decl/damage_handler/electrocute/heal_mob_damage(var/mob/living/target, var/damage, var/skip_update_health = FALSE)
+ return FALSE
+
+/decl/damage_handler/electrocute/get_damage_for_mob(var/mob/living/target)
+ return 0
\ No newline at end of file
diff --git a/code/datums/damage/damage_genetic.dm b/code/datums/damage/damage_genetic.dm
new file mode 100644
index 000000000000..ea7b0f9b9403
--- /dev/null
+++ b/code/datums/damage/damage_genetic.dm
@@ -0,0 +1,9 @@
+/decl/damage_handler/genetic
+ name = "genetic"
+ usable_with_backstab = TRUE
+ causes_limb_damage = TRUE
+ category_type = /decl/damage_handler/genetic
+
+/decl/damage_handler/genetic/damage_limb(var/obj/item/organ/external/organ, var/damage, var/damage_flags = 0, used_weapon)
+ organ.add_genetic_damage(damage)
+ return TRUE
diff --git a/code/datums/damage/damage_organ.dm b/code/datums/damage/damage_organ.dm
new file mode 100644
index 000000000000..cb888dd0443f
--- /dev/null
+++ b/code/datums/damage/damage_organ.dm
@@ -0,0 +1,11 @@
+/decl/damage_handler/organ
+ name = "organ"
+ usable_with_backstab = TRUE
+ category_type = /decl/damage_handler/organ
+
+
+/decl/damage_handler/organ/get_armor_key(var/damage_flags)
+ if(damage_flags & DAM_BIO)
+ return ARMOR_BIO
+ // Otherwise just not blocked by default.
+ return null
diff --git a/code/datums/damage/damage_pain.dm b/code/datums/damage/damage_pain.dm
new file mode 100644
index 000000000000..d180e695d40e
--- /dev/null
+++ b/code/datums/damage/damage_pain.dm
@@ -0,0 +1,12 @@
+/decl/damage_handler/pain
+ name = "pain"
+ usable_with_backstab = TRUE
+ causes_limb_damage = TRUE
+ projectile_damage_divisor = 3
+ projectile_damages_assembly_casing = FALSE
+ category_type = /decl/damage_handler/pain
+
+
+/decl/damage_handler/pain/damage_limb(var/obj/item/organ/external/organ, var/damage, var/damage_flags = 0, used_weapon)
+ organ.add_pain(damage)
+ return TRUE
diff --git a/code/datums/damage/damage_radiation.dm b/code/datums/damage/damage_radiation.dm
new file mode 100644
index 000000000000..2dcdf6764556
--- /dev/null
+++ b/code/datums/damage/damage_radiation.dm
@@ -0,0 +1,13 @@
+/decl/damage_handler/radiation
+ name = "radiation"
+ category_type = /decl/damage_handler/radiation
+
+/decl/damage_handler/radiation/apply_damage_to_mob(var/mob/living/target, var/damage, var/def_zone, var/damage_flags = 0, var/used_weapon, var/silent = FALSE)
+ . = ..()
+ if(. && iscarbon(target) && !target.isSynthetic())
+ var/mob/living/carbon/target_carbon = target
+ if(!target_carbon.ignore_rads)
+ target.take_damage(0.25 * damage * target.get_damage_modifier(category_type), /decl/damage_handler/burn)
+
+/decl/damage_handler/radiation/get_armor_key(var/damage_flags)
+ return ARMOR_RAD
diff --git a/code/datums/damage/damage_suffocation.dm b/code/datums/damage/damage_suffocation.dm
new file mode 100644
index 000000000000..af722e6b3893
--- /dev/null
+++ b/code/datums/damage/damage_suffocation.dm
@@ -0,0 +1,4 @@
+/decl/damage_handler/suffocation
+ name = "suffocation"
+ usable_with_backstab = TRUE
+ category_type = /decl/damage_handler/suffocation
diff --git a/code/datums/extensions/armor/ablative.dm b/code/datums/extensions/armor/ablative.dm
index fe7c215f4be3..923593b82708 100644
--- a/code/datums/extensions/armor/ablative.dm
+++ b/code/datums/extensions/armor/ablative.dm
@@ -11,21 +11,25 @@
armor_degradation_coef = _armor_degradation_speed
/datum/extension/armor/ablative/on_blocking(damage, damage_type, damage_flags, armor_pen, blocked)
- if(!(damage_type == BRUTE || damage_type == BURN))
+ if(!armor_degradation_coef)
return
- if(armor_degradation_coef)
- var/key = SSmaterials.get_armor_key(damage_type, damage_flags)
- var/damage_blocked = round(damage * blocked)
- if(damage_blocked)
- var/new_armor = max(0, get_value(key) - armor_degradation_coef * damage_blocked)
- set_value(key, new_armor)
- var/mob/M = holder.get_recursive_loc_of_type(/mob)
- if(istype(M))
- var/list/visible = get_visible_damage()
- for(var/k in visible)
- if(LAZYACCESS(last_reported_damage, k) != visible[k])
- LAZYSET(last_reported_damage, k, visible[k])
- to_chat(M, SPAN_WARNING("The [k] armor on your [holder] has [visible[k]] damage now!"))
+ var/decl/damage_handler/damage_type_data = GET_DECL(damage_type)
+ if(!damage_type_data.blocked_by_ablative)
+ return
+ var/damage_blocked = round(damage * blocked)
+ if(!damage_blocked)
+ return
+ var/key = damage_type_data.get_armor_key(damage_flags)
+ var/new_armor = max(0, get_value(key) - armor_degradation_coef * damage_blocked)
+ set_value(key, new_armor)
+ var/mob/M = holder.get_recursive_loc_of_type(/mob)
+ if(!istype(M))
+ return
+ var/list/visible = get_visible_damage()
+ for(var/k in visible)
+ if(LAZYACCESS(last_reported_damage, k) != visible[k])
+ LAZYSET(last_reported_damage, k, visible[k])
+ to_chat(M, SPAN_WARNING("The [k] armor on your [holder] has [visible[k]] damage now!"))
/datum/extension/armor/ablative/proc/get_damage()
for(var/key in armor_values)
diff --git a/code/datums/extensions/armor/armor.dm b/code/datums/extensions/armor/armor.dm
index 8e9dd0055bab..8101032c667e 100644
--- a/code/datums/extensions/armor/armor.dm
+++ b/code/datums/extensions/armor/armor.dm
@@ -52,7 +52,8 @@
// A simpler proc used as a helper for above but can also be used externally. Does not modify state.
/datum/extension/armor/proc/get_blocked(damage_type, damage_flags, armor_pen = 0, damage = 5)
- var/key = SSmaterials.get_armor_key(damage_type, damage_flags)
+ var/decl/damage_handler/damage_type_data = GET_DECL(damage_type)
+ var/key = damage_type_data.get_armor_key(damage_flags)
if(!key)
return 0
diff --git a/code/datums/extensions/assembly/assembly_damage.dm b/code/datums/extensions/assembly/assembly_damage.dm
index f72ab3bdaee2..6ebb31d34008 100644
--- a/code/datums/extensions/assembly/assembly_damage.dm
+++ b/code/datums/extensions/assembly/assembly_damage.dm
@@ -11,11 +11,11 @@
uninstall_component(null, P)
P.forceMove(H.loc)
if(prob(25))
- P.take_damage(rand(10,30))
+ P.take_damage(rand(10,30), BRUTE)
H.physically_destroyed()
qdel(src)
-/datum/extension/assembly/proc/take_damage(var/amount, var/component_probability, var/damage_casing = 1, var/randomize = 1)
+/datum/extension/assembly/proc/take_assembly_damage(var/amount, var/component_probability, var/damage_casing = 1, var/randomize = 1)
//if(!modifiable)
// return
@@ -30,7 +30,7 @@
if(component_probability)
for(var/obj/item/stock_parts/computer/H in get_all_components())
if(prob(component_probability))
- H.take_damage(round(amount / 2))
+ H.take_damage(round(amount / 2), BRUTE)
if(damage >= max_damage)
break_apart()
@@ -38,20 +38,15 @@
// Stronger explosions cause serious damage to internal components
// Minor explosions are mostly mitigitated by casing.
/datum/extension/assembly/proc/ex_act(var/severity)
- take_damage(rand(100,200) / severity, 30 / severity)
+ take_assembly_damage(rand(100,200) / severity, 30 / severity)
// EMPs are similar to explosions, but don't cause physical damage to the casing. Instead they screw up the components
/datum/extension/assembly/proc/emp_act(var/severity)
- take_damage(rand(100,200) / severity, 50 / severity, 0)
+ take_assembly_damage(rand(100,200) / severity, 50 / severity, 0)
// "Stun" weapons can cause minor damage to components (short-circuits?)
// "Burn" damage is equally strong against internal components and exterior casing
// "Brute" damage mostly damages the casing.
/datum/extension/assembly/proc/bullet_act(var/obj/item/projectile/Proj)
- switch(Proj.damage_type)
- if(BRUTE)
- take_damage(Proj.damage, Proj.damage / 2)
- if(PAIN)
- take_damage(Proj.damage, Proj.damage / 3, 0)
- if(BURN)
- take_damage(Proj.damage, Proj.damage / 1.5)
\ No newline at end of file
+ var/decl/damage_handler/damage_type_data = GET_DECL(Proj.damage_type)
+ take_assembly_damage(Proj.damage, Proj.damage / damage_type_data.projectile_damage_divisor, damage_type_data.projectile_damages_assembly_casing)
diff --git a/code/datums/extensions/deity_be_near.dm b/code/datums/extensions/deity_be_near.dm
index 06d3616710d5..38c57449fc06 100644
--- a/code/datums/extensions/deity_be_near.dm
+++ b/code/datums/extensions/deity_be_near.dm
@@ -58,10 +58,10 @@
return TRUE
/datum/extension/deity_be_near/champion/deal_damage(var/mob/living/victim,var/mult)
- victim.adjustOxyLoss(3 * mult)
+ victim.take_damage(3 * mult, OXY)
/datum/extension/deity_be_near/oracle/deal_damage(var/mob/living/victim, var/mult)
- victim.adjustFireLoss(mult)
+ victim.take_damage(mult, BURN)
/datum/extension/deity_be_near/traitor/deal_damage(var/mob/living/victim, var/mult)
- victim.adjustHalLoss(5 * mult)
\ No newline at end of file
+ victim.take_damage(5 * mult, PAIN)
\ No newline at end of file
diff --git a/code/game/atom_damage.dm b/code/game/atom_damage.dm
new file mode 100644
index 000000000000..64adcb97307d
--- /dev/null
+++ b/code/game/atom_damage.dm
@@ -0,0 +1,5 @@
+/atom/proc/take_damage(damage, damage_type = BRUTE, def_zone, damage_flags = 0, used_weapon, armor_pen, silent = FALSE, override_droplimb, skip_update_health = FALSE)
+ return FALSE
+
+/atom/proc/heal_damage(var/damage, var/damage_type = BRUTE, var/def_zone = null, var/damage_flags = 0, skip_update_health = FALSE)
+ return take_damage(-(damage), damage_type, def_zone, damage_flags, skip_update_health = skip_update_health)
diff --git a/code/game/atoms.dm b/code/game/atoms.dm
index c2d8d3f01a52..6fc83cf0b4a2 100644
--- a/code/game/atoms.dm
+++ b/code/game/atoms.dm
@@ -458,7 +458,7 @@
SHOULD_CALL_PARENT(TRUE)
if(isliving(AM))
var/mob/living/M = AM
- M.apply_damage(TT.speed*5, BRUTE)
+ M.take_damage(TT.speed*5, BRUTE)
/**
Attempt to add blood to this atom
@@ -732,10 +732,10 @@
var/obj/item/organ/external/affecting = SAFEPICK(M.get_external_organs())
if(!affecting)
to_chat(M, SPAN_DANGER("You land heavily!"))
- M.adjustBruteLoss(damage)
+ M.take_damage(damage, BRUTE)
else
to_chat(M, SPAN_DANGER("You land heavily on your [affecting.name]!"))
- affecting.take_external_damage(damage, 0)
+ affecting.take_damage(damage, BRUTE)
if(affecting.parent)
affecting.parent.add_autopsy_data("Misadventure", damage)
diff --git a/code/game/gamemodes/cult/cult_items.dm b/code/game/gamemodes/cult/cult_items.dm
index 28daf9435d2b..7fc87fa278a5 100644
--- a/code/game/gamemodes/cult/cult_items.dm
+++ b/code/game/gamemodes/cult/cult_items.dm
@@ -23,7 +23,7 @@
to_chat(user, "An unexplicable force rips through you, tearing the sword from your grasp!")
//random amount of damage between half of the blade's force and the full force of the blade.
- user.apply_damage(rand(force/2, force), BRUTE, zone, (DAM_SHARP|DAM_EDGE), armor_pen = 100)
+ user.take_damage(rand(force/2, force), BRUTE, zone, (DAM_SHARP|DAM_EDGE), armor_pen = 100)
SET_STATUS_MAX(user, STAT_WEAK, 5)
if(user.try_unequip(src))
diff --git a/code/game/gamemodes/cult/ghosts.dm b/code/game/gamemodes/cult/ghosts.dm
index c54ccc706bb8..6df06c574a47 100644
--- a/code/game/gamemodes/cult/ghosts.dm
+++ b/code/game/gamemodes/cult/ghosts.dm
@@ -219,7 +219,7 @@
var/method = pick("bit", "scratched")
to_chat(choice, "Something invisible [method] you!")
- choice.apply_effect(5, PAIN, 0)
+ choice.take_damage(5, PAIN, 0)
to_chat(src, "You [method] \the [choice].")
log_and_message_admins("used ghost magic to bite \the [choice] - [x]-[y]-[z]")
diff --git a/code/game/gamemodes/cult/runes.dm b/code/game/gamemodes/cult/runes.dm
index 6c2bb0e2eeb6..d6d97401ef9b 100644
--- a/code/game/gamemodes/cult/runes.dm
+++ b/code/game/gamemodes/cult/runes.dm
@@ -125,19 +125,19 @@
spamcheck = 0
if(!iscultist(target) && target.loc == get_turf(src)) // They hesitated, resisted, or can't join, and they are still on the rune - burn them
if(target.stat == CONSCIOUS)
- target.take_overall_damage(0, 10)
- switch(target.getFireLoss())
+ target.take_damage(10, BURN)
+ switch(target.get_damage(BURN))
if(0 to 25)
to_chat(target, "Your blood boils as you force yourself to resist the corruption invading every corner of your mind.")
if(25 to 45)
to_chat(target, "Your blood boils and your body burns as the corruption further forces itself into your body and mind.")
- target.take_overall_damage(0, 3)
+ target.take_damage(3, BURN)
if(45 to 75)
to_chat(target, "You begin to hallucinate images of a dark and incomprehensible being and your entire body feels like its engulfed in flame as your mental defenses crumble.")
- target.take_overall_damage(0, 5)
+ target.take_damage(5, BURN)
if(75 to 100)
to_chat(target, "Your mind turns to ash as the burning flames engulf your very soul and images of an unspeakable horror begin to bombard the last remnants of mental resistance.")
- target.take_overall_damage(0, 10)
+ target.take_damage(10, BURN)
/obj/effect/rune/convert/Topic(href, href_list)
if(href_list["join"] && usr.loc == loc && !iscultist(usr))
@@ -179,18 +179,18 @@
showOptions(user)
var/warning = 0
while(user.loc == src)
- user.take_organ_damage(0, 2)
- if(user.getFireLoss() > 50)
+ user.take_damage(2, BURN)
+ if(user.get_damage(BURN) > 50)
to_chat(user, "Your body can't handle the heat anymore!")
leaveRune(user)
return
if(warning == 0)
to_chat(user, "You feel the immerse heat of the realm of Nar-Sie...")
++warning
- if(warning == 1 && user.getFireLoss() > 15)
+ if(warning == 1 && user.get_damage(BURN) > 15)
to_chat(user, "Your burns are getting worse. You should return to your realm soon...")
++warning
- if(warning == 2 && user.getFireLoss() > 35)
+ if(warning == 2 && user.get_damage(BURN) > 35)
to_chat(user, "The heat! It burns!")
++warning
sleep(10)
@@ -307,18 +307,16 @@
qdel(src)
else if(I.force)
user.visible_message("\The [user] hits \the [src] with \the [I].", "You hit \the [src] with \the [I].")
- take_damage(I.force)
+ take_damage(I.force, I.damtype)
user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN)
user.do_attack_animation(src)
/obj/effect/cultwall/bullet_act(var/obj/item/projectile/Proj)
- if(!(Proj.damage_type == BRUTE || Proj.damage_type == BURN))
- return
- take_damage(Proj.damage)
+ take_damage(Proj.damage, Proj.damage_type, damage_flags = Proj.damage_flags)
..()
-/obj/effect/cultwall/proc/take_damage(var/amount)
- health -= amount
+/obj/effect/cultwall/take_damage(damage, damage_type = BRUTE, def_zone, damage_flags = 0, used_weapon, armor_pen, silent = FALSE, override_droplimb, skip_update_health = FALSE)
+ health -= damage
if(health <= 0)
visible_message("\The [src] dissipates.")
qdel(src)
@@ -352,7 +350,7 @@
else if(user.loc != get_turf(src) && soul)
soul.reenter_corpse()
else
- user.take_organ_damage(0, 1)
+ user.take_damage(1, BURN)
sleep(20)
fizzle(user)
@@ -464,12 +462,15 @@
//T.turf_animation('icons/effects/effects.dmi', "rune_sac")
victim.fire_stacks = max(2, victim.fire_stacks)
victim.IgniteMob()
+ // This is to speed up the process and also damage mobs that
+ // don't take damage from being on fire, e.g. borgs
var/dam_amt = 2 + length(casters)
- victim.take_organ_damage(dam_amt, dam_amt) // This is to speed up the process and also damage mobs that don't take damage from being on fire, e.g. borgs
+ victim.take_damage(dam_amt, BRUTE, skip_update_health = TRUE)
+ victim.take_damage(dam_amt, BURN)
if(ishuman(victim))
var/mob/living/carbon/human/H = victim
if(H.is_asystole())
- H.adjustBrainLoss(2 + casters.len)
+ H.adjust_brain_damage(2 + casters.len)
sleep(40)
if(victim && victim.loc == T && victim.stat == DEAD)
var/decl/special_role/cultist/cult = GET_DECL(/decl/special_role/cultist)
@@ -544,9 +545,9 @@
statuses += "you regain lost blood"
if(!charges)
return statuses
- if(user.getBruteLoss() || user.getFireLoss())
- var/healbrute = user.getBruteLoss()
- var/healburn = user.getFireLoss()
+ var/healbrute = user.get_damage(BRUTE)
+ var/healburn = user.get_damage(BURN)
+ if(healbrute || healburn)
if(healbrute < healburn)
healbrute = min(healbrute, charges / 2)
charges -= healbrute
@@ -557,13 +558,14 @@
charges -= healburn
healbrute = min(healbrute, charges)
charges -= healbrute
- user.heal_organ_damage(healbrute, healburn, 1)
+ user.heal_damage(healbrute, BRUTE) // todo readd robo heal check
+ user.heal_damage(healburn, BURN) // todo readd robo heal check
statuses += "your wounds mend"
if(!charges)
return statuses
- if(user.getToxLoss())
- use = min(user.getToxLoss(), charges)
- user.adjustToxLoss(-use)
+ if(user.get_damage(TOX))
+ use = min(user.get_damage(TOX), charges)
+ user.heal_damage(use, TOX)
charges -= use
statuses += "your body stings less"
if(!charges)
@@ -580,15 +582,15 @@
return statuses
var/list/obj/item/organ/damaged = list()
for(var/obj/item/organ/I in user.internal_organs)
- if(I.damage)
+ if(I.organ_damage)
damaged += I
if(damaged.len)
statuses += "you feel pain inside for a moment that passes quickly"
while(charges && damaged.len)
var/obj/item/organ/fix = pick(damaged)
- fix.damage = max(0, fix.damage - min(charges, 1))
+ fix.organ_damage = max(0, fix.organ_damage - min(charges, 1))
charges = max(charges - 1, 0)
- if(fix.damage == 0)
+ if(fix.organ_damage == 0)
damaged -= fix
return statuses
@@ -744,7 +746,8 @@
var/obj/item/nullrod/N = locate() in M
if(N)
continue
- M.take_overall_damage(5, 5)
+ M.take_damage(5, BRUTE, skip_update_health = TRUE)
+ M.take_damage(5, BURN)
if(!(M in previous))
if(M.should_have_organ(BP_HEART))
to_chat(M, "Your blood boils!")
diff --git a/code/game/gamemodes/godmode/form_items/narsie_items.dm b/code/game/gamemodes/godmode/form_items/narsie_items.dm
index 9ee399a014fb..4c814e1ea6da 100644
--- a/code/game/gamemodes/godmode/form_items/narsie_items.dm
+++ b/code/game/gamemodes/godmode/form_items/narsie_items.dm
@@ -28,7 +28,7 @@
if(!do_after(user,200, L))
return
user.visible_message("\The [user] plunges the knife down into \the [a]!")
- L.adjustBruteLoss(20)
+ L.take_damage(20, BRUTE)
if(altar.linked_god)
altar.linked_god.adjust_power_min(2 * multiplier,0,"from a delicious sacrifice!")
diff --git a/code/game/gamemodes/godmode/form_items/narsie_structures.dm b/code/game/gamemodes/godmode/form_items/narsie_structures.dm
index 931188a64f1e..cfa1b5a76c05 100644
--- a/code/game/gamemodes/godmode/form_items/narsie_structures.dm
+++ b/code/game/gamemodes/godmode/form_items/narsie_structures.dm
@@ -87,6 +87,6 @@
if(H.should_have_organ(BP_HEART))
H.drip(5,get_turf(src))
else
- H.adjustBruteLoss(5)
+ H.take_damage(5, BRUTE)
linked_god.adjust_power_min(1,1)
return TRUE
diff --git a/code/game/gamemodes/godmode/form_items/starlight_items.dm b/code/game/gamemodes/godmode/form_items/starlight_items.dm
index fb9cf6fedb2c..191c0570e8da 100644
--- a/code/game/gamemodes/godmode/form_items/starlight_items.dm
+++ b/code/game/gamemodes/godmode/form_items/starlight_items.dm
@@ -100,7 +100,7 @@
/obj/item/knife/ritual/shadow/apply_hit_effect(var/mob/living/target, var/mob/living/user, var/hit_zone)
. = ..()
if(charge)
- if(target.getBruteLoss() > 15)
+ if(target.get_damage(BRUTE) > 15)
var/datum/reagents/R = target.reagents
if(!R)
return
@@ -108,7 +108,7 @@
new /obj/effect/temporary(get_turf(target),3, 'icons/effects/effects.dmi', "fire_goon")
charge--
else
- user.adjustFireLoss(5)
+ user.take_damage(5, BURN)
if(prob(5))
to_chat(user, "\The [src] appears to be out of power!")
new /obj/effect/temporary(get_turf(user),3, 'icons/effects/effects.dmi', "fire_goon")
diff --git a/code/game/gamemodes/godmode/form_items/starlight_structures.dm b/code/game/gamemodes/godmode/form_items/starlight_structures.dm
index 51f3c7342821..6509f79faa73 100644
--- a/code/game/gamemodes/godmode/form_items/starlight_structures.dm
+++ b/code/game/gamemodes/godmode/form_items/starlight_structures.dm
@@ -245,7 +245,7 @@
if(followers.len)
for(var/m in followers)
var/mob/living/L = m
- L.adjustFireLoss(-5)
+ L.heal_damage(5, BURN)
if(prob(5))
to_chat(L, "You feel a pleasant warmth spread throughout your body...")
for(var/s in L.mind.learned_spells)
diff --git a/code/game/gamemodes/godmode/god_altar.dm b/code/game/gamemodes/godmode/god_altar.dm
index 34ddbfa847d4..cc33ac6be692 100644
--- a/code/game/gamemodes/godmode/god_altar.dm
+++ b/code/game/gamemodes/godmode/god_altar.dm
@@ -91,8 +91,8 @@
cycles_before_converted++
if(prob(50))
to_chat(M, "The mental strain is too much for you! You feel your body weakening!")
- M.adjustToxLoss(15, do_update_health = FALSE)
- M.adjustHalLoss(30)
+ M.take_damage(15, TOX, skip_update_health = TRUE)
+ M.take_damage(30, PAIN)
return TOPIC_REFRESH
/obj/structure/deity/altar/on_update_icon()
diff --git a/code/game/gamemodes/godmode/god_structures.dm b/code/game/gamemodes/godmode/god_structures.dm
index 6eaed5e088e6..f0b04eefaf87 100644
--- a/code/game/gamemodes/godmode/god_structures.dm
+++ b/code/game/gamemodes/godmode/god_structures.dm
@@ -50,7 +50,7 @@
"You hit \the [src] with \the [W]!",
"You hear something breaking!"
)
- take_damage(W.force)
+ take_damage(W.force, W.damtype)
/obj/structure/deity/dismantle()
SHOULD_CALL_PARENT(FALSE)
@@ -62,7 +62,7 @@
. = ..()
/obj/structure/deity/bullet_act(var/obj/item/projectile/P)
- take_damage(P.damage)
+ take_damage(P.damage, P.damage_type)
/obj/structure/deity/proc/attack_deity(var/mob/living/deity/deity)
return
\ No newline at end of file
diff --git a/code/game/gamemodes/wizard/servant_items/champion.dm b/code/game/gamemodes/wizard/servant_items/champion.dm
index ace80ee86858..2187a29a2fd5 100644
--- a/code/game/gamemodes/wizard/servant_items/champion.dm
+++ b/code/game/gamemodes/wizard/servant_items/champion.dm
@@ -72,10 +72,10 @@
if(ishuman(loc))
var/mob/living/carbon/human/H = loc
var/obj/item/organ/external/E = GET_EXTERNAL_ORGAN(H, H.get_active_held_item_slot())
- E?.take_external_damage(burn=2,used_weapon="stovetop")
+ E?.take_damage(2, BURN, used_weapon = "stovetop")
else
var/mob/living/M = loc
- M.adjustFireLoss(2)
+ M.take_damage(2, BURN)
if(prob(2))
to_chat(loc,"\The [src] is burning you!")
return 1
diff --git a/code/game/machinery/_machines_base/machinery_damage.dm b/code/game/machinery/_machines_base/machinery_damage.dm
index 8c7953186f99..3c41c93861b6 100644
--- a/code/game/machinery/_machines_base/machinery_damage.dm
+++ b/code/game/machinery/_machines_base/machinery_damage.dm
@@ -1,39 +1,36 @@
-/obj/machinery/proc/take_damage(amount, damtype = BRUTE, silent = FALSE)
+/obj/machinery/take_damage(damage, damage_type = BRUTE, def_zone, damage_flags = 0, used_weapon, armor_pen, silent = FALSE, override_droplimb, skip_update_health = FALSE)
//Let's not bother initializing all the components for nothing
- if(amount <= 0)
+ if(damage <= 0)
return
- if(damtype != BRUTE && damtype != BURN && damtype != ELECTROCUTE)
+ var/decl/damage_handler/damage_type_data = GET_DECL(damtype)
+ if(!damage_type_data.applies_to_machinery)
return
if(!silent)
- var/hitsound = 'sound/weapons/smash.ogg'
- if(damtype == ELECTROCUTE)
- hitsound = "sparks"
- else if(damtype == BURN)
- hitsound = 'sound/items/Welder.ogg'
- playsound(src, hitsound, 10, 1)
+ if(damage_type_data?.machinery_hit_sound)
+ playsound(src, damage_type_data.machinery_hit_sound, 10, 1)
// Shielding components (armor/fuses) take first hit
var/list/shielding = get_all_components_of_type(/obj/item/stock_parts/shielding)
for(var/obj/item/stock_parts/shielding/soak in shielding)
if(soak.is_functional() && (damtype in soak.protection_types))
- amount -= soak.take_damage(amount, damtype)
- if(amount <= 0)
+ damage -= soak.take_damage(damage, damtype)
+ if(damage <= 0)
return
// If some damage got past, next it's generic (non-circuitboard) components
var/obj/item/stock_parts/victim = get_damageable_component(damtype)
- while(amount > 0 && victim)
- amount -= victim.take_damage(amount, damtype)
+ while(damage > 0 && victim)
+ damage -= victim.take_damage(damage, damtype)
victim = get_damageable_component(damtype)
- if(amount <= 0)
+ if(damage <= 0)
return
// And lastly hit the circuitboard
victim = get_component_of_type(/obj/item/stock_parts/circuitboard)
if(victim?.can_take_damage() && victim.is_functional())
- amount -= victim.take_damage(amount, damtype)
+ damage -= victim.take_damage(damage, damtype)
- if(amount && (damtype == BRUTE || damtype == BURN))
+ if(damage && (damtype == BRUTE || damtype == BURN))
dismantle()
/obj/machinery/proc/get_damageable_component(var/damage_type)
@@ -76,11 +73,11 @@
if((severity == 1 || (severity == 2 && prob(25))))
physically_destroyed()
else
- take_damage(100/severity, BRUTE, TRUE)
+ take_damage(100/severity, BRUTE, silent = TRUE)
/obj/machinery/bullet_act(obj/item/projectile/P, def_zone)
. = ..()
- take_damage(P.damage, P.damage_type)
+ take_damage(P.damage, P.damage_type, damage_flags = P.damage_flags)
/obj/machinery/bash(obj/item/W, mob/user)
if(!istype(W) || W.force <= 5 || (W.item_flags & ITEM_FLAG_NO_BLUDGEON))
diff --git a/code/game/machinery/_machines_base/stock_parts/_stock_parts.dm b/code/game/machinery/_machines_base/stock_parts/_stock_parts.dm
index 035c2daf23b2..b7c843ed9bcb 100644
--- a/code/game/machinery/_machines_base/stock_parts/_stock_parts.dm
+++ b/code/game/machinery/_machines_base/stock_parts/_stock_parts.dm
@@ -63,7 +63,7 @@
// RefreshParts has been called, likely meaning other componenets were added/removed.
/obj/item/stock_parts/proc/on_refresh(var/obj/machinery/machine)
-/obj/item/stock_parts/take_damage(damage, damage_type, damage_flags, inflicter, armor_pen)
+/obj/item/stock_parts/take_damage(damage, damage_type = BRUTE, def_zone, damage_flags = 0, used_weapon, armor_pen, silent = FALSE, override_droplimb, skip_update_health = FALSE)
if(damage_type in ignore_damage_types)
return
. = ..()
@@ -79,12 +79,8 @@
/obj/item/stock_parts/proc/on_fail(var/obj/machinery/machine, var/damtype)
machine.on_component_failure(src)
- var/cause = "shatters"
- switch(damtype)
- if(BURN)
- cause = "sizzles"
- if(ELECTROCUTE)
- cause = "sparks"
+ var/decl/damage_handler/damage_type_data = GET_DECL(damtype)
+ var/cause = damage_type_data?.damage_verb || "shatters"
visible_message(SPAN_WARNING("Something [cause] inside \the [machine]."), range = 2)
SetName("broken [name]")
diff --git a/code/game/machinery/camera/camera.dm b/code/game/machinery/camera/camera.dm
index 9993d060e65e..8c6de183dacf 100644
--- a/code/game/machinery/camera/camera.dm
+++ b/code/game/machinery/camera/camera.dm
@@ -179,7 +179,7 @@
START_PROCESSING_MACHINE(src, MACHINERY_PROCESS_SELF)
/obj/machinery/camera/bullet_act(var/obj/item/projectile/P)
- take_damage(P.get_structure_damage())
+ take_damage(P.get_structure_damage(), P.damage_type, damage_flags = P.damage_flags)
/obj/machinery/camera/explosion_act(severity)
..()
@@ -192,7 +192,7 @@
var/obj/O = AM
if (O.throwforce >= src.toughness)
visible_message(SPAN_WARNING("[src] was hit by [O]!"))
- take_damage(O.throwforce)
+ take_damage(O.throwforce, BRUTE)
/obj/machinery/camera/physical_attack_hand(mob/living/carbon/human/user)
if(!istype(user))
diff --git a/code/game/machinery/computer/arcade_orion.dm b/code/game/machinery/computer/arcade_orion.dm
index c35b85a4b5a1..84158e61eb71 100644
--- a/code/game/machinery/computer/arcade_orion.dm
+++ b/code/game/machinery/computer/arcade_orion.dm
@@ -406,7 +406,7 @@
M.set_hallucination(50, 50)
else
to_chat(usr, "Something strikes you from behind! It hurts like hell and feel like a blunt weapon, but nothing is there...")
- M.take_organ_damage(10)
+ M.take_damage(10, BRUTE)
else
to_chat(usr, "The sounds of battle fill your ears...")
if(ORION_TRAIL_ILLNESS)
@@ -419,13 +419,13 @@
if(ORION_TRAIL_CARP)
to_chat(usr, " Something bit you!")
var/mob/living/M = usr
- M.adjustBruteLoss(10)
+ M.take_damage(10, BRUTE)
if(ORION_TRAIL_FLUX)
if(iscarbon(usr) && prob(75))
var/mob/living/carbon/M = usr
SET_STATUS_MAX(M, STAT_WEAK, 3)
src.visible_message("A sudden gust of powerful wind slams \the [M] into the floor!", "You hear a large fwooshing sound, followed by a bang.")
- M.take_organ_damage(10)
+ M.take_damage(10, BRUTE)
else
to_chat(usr, "A violent gale blows past you, and you barely manage to stay standing!")
if(ORION_TRAIL_MALFUNCTION)
@@ -449,8 +449,8 @@
for(var/i=0;i<10;i++)
sleep(10)
SET_STATUS_MAX(M, STAT_STUN, 5)
- M.adjustBruteLoss(10, do_update_health = FALSE)
- M.adjustFireLoss(10)
+ M.take_damage(10, BRUTE, skip_update_health = TRUE)
+ M.take_damage(10, BURN)
usr.gib() //So that people can't cheese it and inject a lot of kelo/bicard before losing
diff --git a/code/game/machinery/deployable.dm b/code/game/machinery/deployable.dm
index a83beb7a1cb1..01409aa0d2f8 100644
--- a/code/game/machinery/deployable.dm
+++ b/code/game/machinery/deployable.dm
@@ -51,11 +51,8 @@
return
return
else
- switch(W.damtype)
- if(BURN)
- src.health -= W.force * 0.75
- if(BRUTE)
- src.health -= W.force * 0.5
+ var/decl/damage_handler/damage_type_data = GET_DECL(W.damtype)
+ health -= W.force * damage_type_data.barrier_damage_multiplier
if (src.health <= 0)
src.explode()
..()
diff --git a/code/game/machinery/doors/_door.dm b/code/game/machinery/doors/_door.dm
index c11d60b67186..bcea73c45c0b 100644
--- a/code/game/machinery/doors/_door.dm
+++ b/code/game/machinery/doors/_door.dm
@@ -62,7 +62,7 @@
if(damage >= 10)
visible_message("\The [user] [attack_verb] into \the [src]!")
- take_damage(damage)
+ take_damage(damage, BRUTE)
else
visible_message("\The [user] bonks \the [src] harmlessly.")
attack_animation(user)
@@ -222,7 +222,7 @@
if(damage)
//cap projectile damage so that there's still a minimum number of hits required to break the door
- take_damage(min(damage, 100), Proj.damage_type)
+ take_damage(min(damage, 100), Proj.damage_type, Proj.damage_flags)
/obj/machinery/door/hitby(var/atom/movable/AM, var/datum/thrownthing/TT)
..()
@@ -233,7 +233,7 @@
else
tforce = AM:throwforce * (TT.speed/THROWFORCE_SPEED_DIVISOR)
playsound(src.loc, hitsound, 100, 1)
- take_damage(tforce)
+ take_damage(tforce, BRUTE)
// This is legacy code that should be revisited, probably by moving the bulk of the logic into here.
/obj/machinery/door/physical_attack_hand(user)
@@ -333,7 +333,7 @@
return TRUE
return FALSE
-/obj/machinery/door/take_damage(var/damage, damtype=BRUTE)
+/obj/machinery/door/take_damage(damage, damage_type = BRUTE, def_zone, damage_flags = 0, used_weapon, armor_pen, silent = FALSE, override_droplimb, skip_update_health = FALSE)
if(!health)
..(damage, damtype)
update_icon()
diff --git a/code/game/machinery/doors/airlock.dm b/code/game/machinery/doors/airlock.dm
index 63a74398ed3d..00c5f845aa6a 100644
--- a/code/game/machinery/doors/airlock.dm
+++ b/code/game/machinery/doors/airlock.dm
@@ -135,7 +135,7 @@ About the new airlock wires panel:
var/mob/living/carbon/C = user
if(istype(C) && C.hallucination_power > 25)
to_chat(user, SPAN_DANGER("You feel a powerful shock course through your body!"))
- user.adjustHalLoss(10)
+ user.take_damage(10, PAIN)
SET_STATUS_MAX(user, STAT_STUN, 10)
return
..(user)
@@ -768,7 +768,7 @@ About the new airlock wires panel:
else if(!repairing)
// Add some minor damage as evidence of forcing.
if(health >= max_health)
- take_damage(1)
+ take_damage(1, BRUTE)
if(arePowerSystemsOn())
to_chat(user, SPAN_WARNING("The airlock's motors resist your efforts to force it."))
else if(locked)
@@ -940,7 +940,7 @@ About the new airlock wires panel:
for(var/turf/turf in locs)
for(var/atom/movable/AM in turf)
if(AM.airlock_crush(door_crush_damage))
- take_damage(door_crush_damage)
+ take_damage(door_crush_damage, BRUTE)
use_power_oneoff(door_crush_damage * 100) // Uses bunch extra power for crushing the target.
use_power_oneoff(360) //360 W seems much more appropriate for an actuator moving an industrial door capable of crushing people
@@ -1075,9 +1075,9 @@ About the new airlock wires panel:
return
// Braces can act as an extra layer of armor - they will take damage first.
-/obj/machinery/door/airlock/take_damage(var/amount, damtype=BRUTE)
+/obj/machinery/door/airlock/take_damage(damage, damage_type = BRUTE, def_zone, damage_flags = 0, used_weapon, armor_pen, silent = FALSE, override_droplimb, skip_update_health = FALSE)
if(brace)
- brace.take_damage(amount)
+ brace.take_damage(damage, damtype)
else
..()
update_icon()
diff --git a/code/game/machinery/doors/airlock_interactions.dm b/code/game/machinery/doors/airlock_interactions.dm
index 681f9258b0bd..571f0812d551 100644
--- a/code/game/machinery/doors/airlock_interactions.dm
+++ b/code/game/machinery/doors/airlock_interactions.dm
@@ -42,14 +42,14 @@
/obj/machinery/portable_atmospherics/canister/airlock_crush(var/crush_damage)
. = ..()
- take_damage(crush_damage)
+ take_damage(crush_damage, BRUTE)
/obj/effect/energy_field/airlock_crush(var/crush_damage)
Stress(crush_damage)
/obj/structure/closet/airlock_crush(var/crush_damage)
..()
- take_damage(crush_damage)
+ take_damage(crush_damage, BRUTE)
for(var/atom/movable/AM in src)
AM.airlock_crush()
@@ -57,7 +57,7 @@
. = ..()
for(var/i in 1 to round(crush_damage/AIRLOCK_CRUSH_INCREMENT, 1))
- apply_damage(AIRLOCK_CRUSH_INCREMENT, BRUTE)
+ take_damage(AIRLOCK_CRUSH_INCREMENT, BRUTE)
set_status(STAT_STUN, round(crush_damage / 8, 1))
set_status(STAT_WEAK, round(crush_damage / 8, 1))
diff --git a/code/game/machinery/doors/windowdoor.dm b/code/game/machinery/doors/windowdoor.dm
index 5cf073d173f5..91ebedb9a363 100644
--- a/code/game/machinery/doors/windowdoor.dm
+++ b/code/game/machinery/doors/windowdoor.dm
@@ -132,7 +132,7 @@
return TRUE
-/obj/machinery/door/window/take_damage(var/damage)
+/obj/machinery/door/window/take_damage(damage, damage_type = BRUTE, def_zone, damage_flags = 0, used_weapon, armor_pen, silent = FALSE, override_droplimb, skip_update_health = FALSE)
src.health = max(0, src.health - damage)
if (src.health <= 0)
shatter()
@@ -144,7 +144,7 @@
if(H.species.can_shred(H))
playsound(src.loc, 'sound/effects/Glasshit.ogg', 75, 1)
visible_message("[user] smashes against the [src.name].", 1)
- take_damage(25)
+ take_damage(25, BRUTE)
return TRUE
return ..()
diff --git a/code/game/machinery/flasher.dm b/code/game/machinery/flasher.dm
index a67c77c795f1..018cf2912533 100644
--- a/code/game/machinery/flasher.dm
+++ b/code/game/machinery/flasher.dm
@@ -81,9 +81,9 @@
var/vision_organ = H.get_bodytype()?.vision_organ
if(vision_organ)
var/obj/item/organ/internal/E = GET_INTERNAL_ORGAN(H, vision_organ)
- if(E && E.is_bruised() && prob(E.damage + 50))
+ if(E && E.is_bruised() && prob(E.organ_damage + 50))
H.flash_eyes()
- E.damage += rand(1, 5)
+ E.organ_damage += rand(1, 5)
if(!O.is_blind())
do_flash(O, flash_time)
diff --git a/code/game/machinery/kitchen/cooking_machines/_cooker.dm b/code/game/machinery/kitchen/cooking_machines/_cooker.dm
index 8b6d0a7b74a8..036435186363 100644
--- a/code/game/machinery/kitchen/cooking_machines/_cooker.dm
+++ b/code/game/machinery/kitchen/cooking_machines/_cooker.dm
@@ -99,7 +99,7 @@
// Gotta hurt.
if(istype(cooking_obj, /obj/item/holder))
for(var/mob/living/M in cooking_obj.contents)
- M.apply_damage(rand(30,40), BURN, BP_CHEST)
+ M.take_damage(rand(30,40), BURN, BP_CHEST)
// Not sure why a food item that passed the previous checks would fail to drop, but safety first.
if(!user.try_unequip(I))
diff --git a/code/game/machinery/kitchen/cooking_machines/fryer.dm b/code/game/machinery/kitchen/cooking_machines/fryer.dm
index ead11db0a552..92c590e79327 100644
--- a/code/game/machinery/kitchen/cooking_machines/fryer.dm
+++ b/code/game/machinery/kitchen/cooking_machines/fryer.dm
@@ -37,10 +37,10 @@
to_chat(user, "They are missing that body part!")
else
visible_message("\The [user] shoves \the [victim][E ? "'s [E.name]" : ""] into \the [src]!")
- H.apply_damage(rand(20,30), BURN, target_zone)
+ H.take_damage(rand(20,30), BURN, target_zone)
else
- victim.apply_damage(rand(30,40), BURN)
+ victim.take_damage(rand(30,40), BURN)
if(victim)
admin_attack_log(user, victim, "Has [cook_type] their victim in \a [src]", "Has been [cook_type] in \a [src] by the attacker.", "[cook_type], in \a [src], ")
diff --git a/code/game/machinery/mech_recharger.dm b/code/game/machinery/mech_recharger.dm
index bd9e8be69364..06d5f6bd2eb7 100644
--- a/code/game/machinery/mech_recharger.dm
+++ b/code/game/machinery/mech_recharger.dm
@@ -71,8 +71,8 @@
var/repaired = FALSE
for(var/obj/item/mech_component/MC in charging)
if(MC)
- MC.repair_brute_damage(repair)
- MC.repair_burn_damage(repair)
+ MC.heal_damage(repair, BRUTE)
+ MC.heal_damage(repair, BURN)
remaining_energy -= repair * repair_power_usage
repaired = TRUE
if(remaining_energy <= 0)
diff --git a/code/game/machinery/portable_turret.dm b/code/game/machinery/portable_turret.dm
index 4ee74cd37561..cdd2627917f9 100644
--- a/code/game/machinery/portable_turret.dm
+++ b/code/game/machinery/portable_turret.dm
@@ -303,7 +303,7 @@ var/global/list/turret_icons
else
//if the turret was attacked with the intention of harming it:
user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN)
- take_damage(I.force * 0.5)
+ take_damage(I.force * 0.5, BRUTE)
if(I.force * 0.5 > 1) //if the force of impact dealt at least 1 damage, the turret gets pissed off
if(!attacked && !emagged)
attacked = 1
@@ -326,14 +326,14 @@ var/global/list/turret_icons
enabled = 1 //turns it back on. The cover popUp() popDown() are automatically called in process(), no need to define it here
return 1
-/obj/machinery/porta_turret/take_damage(var/force)
+/obj/machinery/porta_turret/take_damage(damage, damage_type = BRUTE, def_zone, damage_flags = 0, used_weapon, armor_pen, silent = FALSE, override_droplimb, skip_update_health = FALSE)
if(!raised && !raising)
- force = force / 8
- if(force < 5)
+ damage = damage / 8
+ if(damage < 5)
return
- health -= force
- if (force > 5 && prob(45))
+ health -= damage
+ if (damage > 5 && prob(45))
spark_at(src, amount = 5)
if(health <= 0)
die() //the death process :(
@@ -353,7 +353,7 @@ var/global/list/turret_icons
..()
- take_damage(damage)
+ take_damage(damage, BRUTE)
/obj/machinery/porta_turret/emp_act(severity)
if(enabled)
@@ -383,9 +383,9 @@ var/global/list/turret_icons
if(severity == 1 || (severity == 2 && prob(25)))
physically_destroyed()
else if(severity == 2)
- take_damage(initial(health) * 8)
+ take_damage(initial(health) * 8, BRUTE)
else
- take_damage(initial(health) * 8 / 3)
+ take_damage(initial(health) * 8 / 3, BRUTE)
/obj/machinery/porta_turret/proc/die() //called when the turret dies, ie, health <= 0
health = 0
diff --git a/code/game/machinery/rechargestation.dm b/code/game/machinery/rechargestation.dm
index df55809d8f97..87e0802cdbf3 100644
--- a/code/game/machinery/rechargestation.dm
+++ b/code/game/machinery/rechargestation.dm
@@ -61,12 +61,12 @@
return
// If we have repair capabilities, repair any damage.
- if(weld_rate && occupant.getBruteLoss())
+ if(weld_rate && occupant.get_damage(BRUTE))
var/repair = weld_rate - use_power_oneoff(weld_power_use * weld_rate, LOCAL) / weld_power_use
- occupant.adjustBruteLoss(-repair)
- if(wire_rate && occupant.getFireLoss())
+ occupant.heal_damage(repair, BRUTE)
+ if(wire_rate && occupant.get_damage(BURN))
var/repair = wire_rate - use_power_oneoff(wire_power_use * wire_rate, LOCAL) / wire_power_use
- occupant.adjustFireLoss(-repair)
+ occupant.heal_damage(repair, BURN)
var/obj/item/cell/target
if(isrobot(occupant))
diff --git a/code/game/machinery/suit_cycler.dm b/code/game/machinery/suit_cycler.dm
index fb7cc0aebd4f..d0d4a36b1c58 100644
--- a/code/game/machinery/suit_cycler.dm
+++ b/code/game/machinery/suit_cycler.dm
@@ -443,10 +443,10 @@
if(prob(radiation_level*2) && occupant.can_feel_pain())
occupant.emote("scream")
if(radiation_level > 2)
- occupant.take_organ_damage(0, radiation_level*2 + rand(1,3))
+ occupant.take_damage(radiation_level*2 + rand(1,3), BURN)
if(radiation_level > 1)
- occupant.take_organ_damage(0, radiation_level + rand(1,3))
- occupant.apply_damage(radiation_level*10, IRRADIATE, damage_flags = DAM_DISPERSED)
+ occupant.take_damage(radiation_level + rand(1,3), BURN)
+ occupant.take_damage(radiation_level*10, IRRADIATE, damage_flags = DAM_DISPERSED)
/obj/machinery/suit_cycler/proc/finished_job()
var/turf/T = get_turf(src)
diff --git a/code/game/objects/auras/blueforge_aura.dm b/code/game/objects/auras/blueforge_aura.dm
index 1a1800acbc4e..f7c44d953fb4 100644
--- a/code/game/objects/auras/blueforge_aura.dm
+++ b/code/game/objects/auras/blueforge_aura.dm
@@ -5,7 +5,7 @@
layer = MOB_LAYER
/obj/aura/blueforge_aura/life_tick()
- user.adjustToxLoss(-10)
+ user.heal_damage(-10, TOX)
return 0
/obj/aura/blueforge_aura/bullet_act(var/obj/item/projectile/P)
diff --git a/code/game/objects/auras/regenerating_aura.dm b/code/game/objects/auras/regenerating_aura.dm
index 96707e87154e..1ba3645f8319 100644
--- a/code/game/objects/auras/regenerating_aura.dm
+++ b/code/game/objects/auras/regenerating_aura.dm
@@ -5,9 +5,9 @@
var/tox_mult = 1
/obj/aura/regenerating/life_tick()
- user.adjustBruteLoss(-brute_mult, do_update_health = FALSE)
- user.adjustFireLoss(-fire_mult, do_update_health = FALSE)
- user.adjustToxLoss(-tox_mult)
+ user.heal_damage(brute_mult, BRUTE, skip_update_health = TRUE)
+ user.heal_damage(fire_mult, BURN, skip_update_health = TRUE)
+ user.heal_damage(tox_mult, TOX)
/obj/aura/regenerating/human
var/nutrition_damage_mult = 1 //How much nutrition it takes to heal regular damage
@@ -37,25 +37,25 @@
var/update_health = FALSE
var/organ_regen = get_config_value(/decl/config/num/health_organ_regeneration_multiplier)
- if(brute_mult && H.getBruteLoss())
- update_health = TRUE
- H.adjustBruteLoss(-brute_mult * organ_regen, do_update_health = FALSE)
+ if(brute_mult && H.get_damage(BRUTE))
+ H.heal_damage(brute_mult * organ_regen, BRUTE, skip_update_health = TRUE)
H.adjust_nutrition(-nutrition_damage_mult)
- if(fire_mult && H.getFireLoss())
update_health = TRUE
- H.adjustFireLoss(-fire_mult * organ_regen, do_update_health = FALSE)
+ if(fire_mult && H.get_damage(BURN))
+ H.heal_damage(fire_mult * organ_regen, BURN, skip_update_health = TRUE)
H.adjust_nutrition(-nutrition_damage_mult)
- if(tox_mult && H.getToxLoss())
update_health = TRUE
- H.adjustToxLoss(-tox_mult * organ_regen, do_update_health = FALSE)
+ if(tox_mult && H.get_damage(TOX))
+ H.heal_damage(tox_mult * organ_regen, TOX, skip_update_health = TRUE)
H.adjust_nutrition(-nutrition_damage_mult)
+ update_health = TRUE
if(update_health)
H.update_health()
if(!can_regenerate_organs())
return 1
if(organ_mult)
- if(prob(10) && H.nutrition >= 150 && !H.getBruteLoss() && !H.getFireLoss())
+ if(prob(10) && H.nutrition >= 150 && !H.get_damage(BRUTE) && !H.get_damage(BURN))
var/obj/item/organ/external/D = GET_EXTERNAL_ORGAN(H, BP_HEAD)
if (D.status & ORGAN_DISFIGURED)
if (H.nutrition >= 20)
@@ -69,9 +69,9 @@
if(BP_IS_PROSTHETIC(regen_organ) || regen_organ.organ_tag == ignore_tag)
continue
if(istype(regen_organ))
- if(regen_organ.damage > 0 && !(regen_organ.status & ORGAN_DEAD))
+ if(regen_organ.organ_damage > 0 && !(regen_organ.status & ORGAN_DEAD))
if (H.nutrition >= organ_mult)
- regen_organ.damage = max(regen_organ.damage - organ_mult, 0)
+ regen_organ.organ_damage = max(regen_organ.organ_damage - organ_mult, 0)
H.adjust_nutrition(-organ_mult)
if(prob(5))
to_chat(H, replacetext(regen_message,"ORGAN", regen_organ.name))
diff --git a/code/game/objects/auras/starlight.dm b/code/game/objects/auras/starlight.dm
index 5250704ac33a..44cd91dc014f 100644
--- a/code/game/objects/auras/starlight.dm
+++ b/code/game/objects/auras/starlight.dm
@@ -8,13 +8,13 @@
/obj/aura/starborn/bullet_act(var/obj/item/projectile/P, var/def_zone)
if(P.damage_type == BURN)
user.visible_message("\The [P] seems to only make \the [user] stronger.")
- user.adjustBruteLoss(-P.damage)
+ user.heal_damage(P.damage, BRUTE)
return AURA_FALSE
return 0
/obj/aura/starborn/attackby(var/obj/item/I, var/mob/i_user)
if(I.damtype == BURN)
to_chat(i_user, "\The [I] seems to only feed into \the [user]'s flames.")
- user.adjustBruteLoss(-I.force)
+ user.heal_damage(I.force, BRUTE)
return AURA_FALSE
return 0
\ No newline at end of file
diff --git a/code/game/objects/effects/effect_system.dm b/code/game/objects/effects/effect_system.dm
index 65d922b6cda7..57df0f049c9e 100644
--- a/code/game/objects/effects/effect_system.dm
+++ b/code/game/objects/effects/effect_system.dm
@@ -230,7 +230,7 @@ steam.start() -- spawns the effect
if (!..())
return 0
M.drop_held_items()
- M.adjustOxyLoss(1)
+ M.take_damage(1, OXY)
if (M.coughedtime != 1)
M.coughedtime = 1
M.cough()
@@ -285,7 +285,7 @@ steam.start() -- spawns the effect
if (R.get_equipped_item(slot_wear_suit_str))
return 0
- R.take_overall_damage(0, 0.75)
+ R.take_damage(0.75, BURN)
if (R.coughedtime != 1)
R.coughedtime = 1
R.emote("gasp")
diff --git a/code/game/objects/effects/spiders.dm b/code/game/objects/effects/spiders.dm
index 0952585216fd..24199907e972 100644
--- a/code/game/objects/effects/spiders.dm
+++ b/code/game/objects/effects/spiders.dm
@@ -311,10 +311,10 @@
forceMove(O.owner ? O.owner.loc : O.loc)
src.visible_message("\A [src] emerges from inside [O.owner ? "[O.owner]'s [O.name]" : "\the [O]"]!")
if(O.owner)
- O.owner.apply_damage(5, BRUTE, O.organ_tag)
- O.owner.apply_damage(3, TOX, O.organ_tag)
+ O.owner.take_damage(5, BRUTE, O.organ_tag)
+ O.owner.take_damage(3, TOX, O.organ_tag)
else if(prob(1))
- O.owner.apply_damage(1, TOX, O.organ_tag)
+ O.owner.take_damage(1, TOX, O.organ_tag)
if(world.time > last_itch + 30 SECONDS)
last_itch = world.time
to_chat(O.owner, "Your [O.name] itches...")
diff --git a/code/game/objects/item.dm b/code/game/objects/item.dm
index 342fb5ac2838..aac38c870e54 100644
--- a/code/game/objects/item.dm
+++ b/code/game/objects/item.dm
@@ -620,7 +620,7 @@
if(!istype(attacker))
return 0
var/decl/pronouns/G = attacker.get_pronouns()
- attacker.apply_damage(force, damtype, attacker.get_active_held_item_slot(), used_weapon = src)
+ attacker.take_damage(force, damtype, attacker.get_active_held_item_slot(), used_weapon = src)
attacker.visible_message(SPAN_DANGER("\The [attacker] hurts [G.his] hand on \the [src]!"))
playsound(target, 'sound/weapons/thudswoosh.ogg', 50, 1, -1)
playsound(target, hitsound, 50, 1, -1)
diff --git a/code/game/objects/item_damage.dm b/code/game/objects/item_damage.dm
index fa8caf7822b8..2ba420133b37 100644
--- a/code/game/objects/item_damage.dm
+++ b/code/game/objects/item_damage.dm
@@ -1,5 +1,5 @@
/**Basic damage handling for items. Returns the amount of damage taken after armor if the item was damaged.*/
-/obj/item/proc/take_damage(var/damage, var/damage_type = BRUTE, var/damage_flags = 0, var/inflicter = null, var/armor_pen = 0)
+/obj/item/take_damage(damage, damage_type = BRUTE, def_zone, damage_flags = 0, used_weapon, armor_pen, silent = FALSE, override_droplimb, skip_update_health = FALSE)
if(!can_take_damage()) // This object does not take damage.
return 0 //Must return a number
if(damage < 0)
@@ -42,7 +42,7 @@
if(QDELETED(src))
return
. = ..()
- take_damage(explosion_severity_damage(severity), BURN, DAM_EXPLODE | DAM_DISPERSED, "explosion")
+ take_damage(explosion_severity_damage(severity), BURN, damage_flags = (DAM_EXPLODE | DAM_DISPERSED), used_weapon = "explosion")
/obj/item/proc/explosion_severity_damage(var/severity)
var/mult = explosion_severity_damage_multiplier()
@@ -104,8 +104,8 @@
self_message = SPAN_DANGER("You stab yourself in the eyes with \the [src]!"))
var/obj/item/organ/internal/eyes = GET_INTERNAL_ORGAN(H, BP_EYES)
- eyes.damage += rand(3,4)
- if(eyes.damage >= eyes.min_bruised_damage)
+ eyes.organ_damage += rand(3,4)
+ if(eyes.organ_damage >= eyes.min_bruised_damage)
if(M.stat != DEAD)
if(!BP_IS_PROSTHETIC(eyes)) //robot eyes bleeding might be a bit silly
to_chat(M, SPAN_DANGER("Your eyes start to bleed profusely!"))
@@ -116,13 +116,13 @@
SET_STATUS_MAX(M, STAT_BLURRY, 10)
SET_STATUS_MAX(M, STAT_PARA, 1)
SET_STATUS_MAX(M, STAT_WEAK, 4)
- if (eyes.damage >= eyes.min_broken_damage)
+ if (eyes.organ_damage >= eyes.min_broken_damage)
if(M.stat != DEAD)
to_chat(M, SPAN_WARNING("You go blind!"))
var/obj/item/organ/external/affecting = GET_EXTERNAL_ORGAN(H, eyes.parent_organ)
- affecting.take_external_damage(7)
+ affecting.take_damage(7, BRUTE)
else
- M.take_organ_damage(7)
+ M.take_damage(7, BRUTE)
SET_STATUS_MAX(M, STAT_BLURRY, rand(3,4))
return
diff --git a/code/game/objects/item_materials.dm b/code/game/objects/item_materials.dm
index f86ccb331735..06d87c6d824e 100644
--- a/code/game/objects/item_materials.dm
+++ b/code/game/objects/item_materials.dm
@@ -76,7 +76,7 @@
attack_cooldown = initial(attack_cooldown)
if(material)
- armor_penetration += 2*max(0, material.brute_armor - 2)
+ armor_penetration += 2*max(0, material.wall_armor[BRUTE] - 2)
throwforce = material.get_blunt_damage() * thrown_material_force_multiplier
if(obj_flags & OBJ_FLAG_HOLLOW)
throwforce *= HOLLOW_OBJECT_MATTER_MULTIPLIER
diff --git a/code/game/objects/items/devices/aicard.dm b/code/game/objects/items/devices/aicard.dm
index 697dccf3843d..058be1d994a0 100644
--- a/code/game/objects/items/devices/aicard.dm
+++ b/code/game/objects/items/devices/aicard.dm
@@ -57,7 +57,7 @@
flush = 1
to_chat(carded_ai, "Your core files are being wiped!")
while (carded_ai && carded_ai.stat != DEAD)
- carded_ai.adjustOxyLoss(2)
+ carded_ai.take_damage(2, OXY)
sleep(10)
flush = 0
if (href_list["radio"])
diff --git a/code/game/objects/items/devices/scanners/breath.dm b/code/game/objects/items/devices/scanners/breath.dm
index 02583fae7f05..90a4b74ef738 100644
--- a/code/game/objects/items/devices/scanners/breath.dm
+++ b/code/game/objects/items/devices/scanners/breath.dm
@@ -63,7 +63,7 @@
// Other general warnings.
if(skill_level >= SKILL_BASIC)
- switch(C.getOxyLoss())
+ switch(C.get_damage(OXY))
if(0 to 25)
dat += "Subject oxygen levels nominal."
if(25 to 50)
diff --git a/code/game/objects/items/devices/scanners/health.dm b/code/game/objects/items/devices/scanners/health.dm
index 0bbe2dae5e77..074c971e341a 100644
--- a/code/game/objects/items/devices/scanners/health.dm
+++ b/code/game/objects/items/devices/scanners/health.dm
@@ -147,7 +147,7 @@
dat += "Body temperature: [H.bodytemperature-T0C]°C ([H.bodytemperature*1.8-459.67]°F)"
// Radiation.
- switch(H.radiation)
+ switch(H.get_damage(IRRADIATE))
if(-INFINITY to 0)
dat += "No radiation detected."
if(1 to 30)
@@ -171,13 +171,13 @@
// Other general warnings.
if(skill_level >= SKILL_BASIC)
- if(H.getOxyLossPercent() > 50)
+ if(H.get_suffocation_percent() > 50)
dat += "[b]Severe oxygen deprivation detected.[endb]"
- if(H.getToxLoss() > 50)
+ if(H.get_damage(TOX) > 50)
dat += "[b]Major systemic organ failure detected.[endb]"
- if(H.getFireLoss() > 50)
+ if(H.get_damage(BURN) > 50)
dat += "[b]Severe burn damage detected.[endb]"
- if(H.getBruteLoss() > 50)
+ if(H.get_damage(BRUTE) > 50)
dat += "[b]Severe anatomical damage detected.[endb]"
if(skill_level >= SKILL_BASIC)
diff --git a/code/game/objects/items/flashlights/_flashlight.dm b/code/game/objects/items/flashlights/_flashlight.dm
index 713547f0b98b..c903fec881c3 100644
--- a/code/game/objects/items/flashlights/_flashlight.dm
+++ b/code/game/objects/items/flashlights/_flashlight.dm
@@ -140,11 +140,11 @@
return
if(MUTATION_XRAY in H.mutations)
to_chat(user, SPAN_NOTICE("\The [H]'s pupils give an eerie glow!"))
- if(vision.damage)
+ if(vision.organ_damage)
to_chat(user, SPAN_WARNING("There's visible damage to [H]'s [vision.name]!"))
else if(HAS_STATUS(H, STAT_BLURRY))
to_chat(user, SPAN_NOTICE("\The [H]'s pupils react slower than normally."))
- if(H.getBrainLoss() > 15)
+ if(H.get_brain_damage() > 15)
to_chat(user, SPAN_NOTICE("There's visible lag between left and right pupils' reactions."))
var/static/list/pinpoint = list(
diff --git a/code/game/objects/items/stacks/medical.dm b/code/game/objects/items/stacks/medical.dm
index 106d802502dc..a9dd2082fb86 100644
--- a/code/game/objects/items/stacks/medical.dm
+++ b/code/game/objects/items/stacks/medical.dm
@@ -56,8 +56,8 @@
return 1
H.update_health() // TODO: readd the actual healing logic that goes here, or check that it's applied in afterattack or something
else
-
- M.heal_organ_damage((src.heal_brute/2), (src.heal_burn/2))
+ M.heal_damage(heal_brute/2, BRUTE)
+ M.heal_damage(heal_burn/2, BURN)
user.visible_message( \
SPAN_NOTICE("[M] has been applied with [src] by [user]."), \
SPAN_NOTICE("You apply \the [src] to [M].") \
@@ -102,7 +102,7 @@
user.visible_message(SPAN_NOTICE("\The [user] bandages \a [W.desc] on [M]'s [affecting.name]."), \
SPAN_NOTICE("You bandage \a [W.desc] on [M]'s [affecting.name]."))
//H.add_side_effect("Itch")
- else if (W.damage_type == BRUISE)
+ else if (W.wound_type == WOUND_BRUISE)
user.visible_message(SPAN_NOTICE("\The [user] places a bruise patch over \a [W.desc] on [M]'s [affecting.name]."), \
SPAN_NOTICE("You place a bruise patch over \a [W.desc] on [M]'s [affecting.name].") )
else
@@ -191,7 +191,7 @@
if (W.current_stage <= W.max_bleeding_stage)
user.visible_message(SPAN_NOTICE("\The [user] cleans \a [W.desc] on [M]'s [affecting.name] and seals the edges with bioglue."), \
SPAN_NOTICE("You clean and seal \a [W.desc] on [M]'s [affecting.name].") )
- else if (W.damage_type == BRUISE)
+ else if (W.wound_type == WOUND_BRUISE)
user.visible_message(SPAN_NOTICE("\The [user] places a medical patch over \a [W.desc] on [M]'s [affecting.name]."), \
SPAN_NOTICE("You place a medical patch over \a [W.desc] on [M]'s [affecting.name].") )
else
@@ -200,7 +200,7 @@
playsound(src, pick(apply_sounds), 25)
W.bandage()
W.disinfect()
- W.heal_damage(heal_brute)
+ W.heal_wound_damage(heal_brute)
used++
affecting.update_damages()
if(used == amount)
@@ -242,7 +242,7 @@
return 1
user.visible_message( SPAN_NOTICE("[user] covers wounds on [M]'s [affecting.name] with regenerative membrane."), \
SPAN_NOTICE("You cover wounds on [M]'s [affecting.name] with regenerative membrane.") )
- affecting.heal_damage(0,heal_burn)
+ affecting.heal_damage(heal_burn, BURN)
use(1)
affecting.salve()
affecting.disinfect()
@@ -355,5 +355,7 @@
user.visible_message( \
SPAN_NOTICE("\The [user] patches the fractures on \the [M]'s [affecting.name] with resin."), \
SPAN_NOTICE("You patch fractures on \the [M]'s [affecting.name] with resin."))
- affecting.heal_damage(heal_brute, heal_burn, robo_repair = TRUE)
+ // TODO: reimplement synthetic repair
+ affecting.heal_damage(heal_brute, BRUTE)
+ affecting.heal_damage(heal_burn, BURN)
use(1)
diff --git a/code/game/objects/items/stacks/nanopaste.dm b/code/game/objects/items/stacks/nanopaste.dm
index d99d90fdf997..172c0e0b12ca 100644
--- a/code/game/objects/items/stacks/nanopaste.dm
+++ b/code/game/objects/items/stacks/nanopaste.dm
@@ -15,10 +15,10 @@
return 0
if (isrobot(M)) //Repairing cyborgs
var/mob/living/silicon/robot/R = M
- if (R.getBruteLoss() || R.getFireLoss() )
+ if (R.get_damage(BRUTE) || R.get_damage(BURN) )
user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN)
- R.adjustBruteLoss(-15, do_update_health = FALSE)
- R.adjustFireLoss(-15)
+ R.heal_damage(15, BRUTE, skip_update_health = TRUE)
+ R.heal_damage(15, BURN)
use(1)
user.visible_message("\The [user] applied some [src] on [R]'s damaged areas.",\
"You apply some [src] at [R]'s damaged areas.")
@@ -42,7 +42,9 @@
to_chat(user, "Nothing to fix here.")
else if(can_use(1))
user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN)
- S.heal_damage(15, 15, robo_repair = 1)
+ // TODO synthetic repair
+ S.heal_damage(15, BRUTE)
+ S.heal_damage(15, BURN)
use(1)
user.visible_message("\The [user] applies some nanite paste on [user != M ? "[M]'s [S.name]" : "[S]"] with [src].",\
"You apply some nanite paste on [user == M ? "your" : "[M]'s"] [S.name].")
diff --git a/code/game/objects/items/weapons/defib.dm b/code/game/objects/items/weapons/defib.dm
index 7aef0369e8a6..ef925f37073f 100644
--- a/code/game/objects/items/weapons/defib.dm
+++ b/code/game/objects/items/weapons/defib.dm
@@ -360,7 +360,7 @@
return
if(!user.skill_check(SKILL_MEDICAL, SKILL_BASIC) && !lowskill_revive(H, user))
return
- H.apply_damage(burn_damage_amt, BURN, BP_CHEST)
+ H.take_damage(burn_damage_amt, BURN, BP_CHEST)
//set oxyloss so that the patient is just barely in crit, if possible
make_announcement("pings, \"Resuscitation successful.\"", "notice")
@@ -452,8 +452,7 @@
var/obj/item/organ/internal/brain = GET_INTERNAL_ORGAN(H, BP_BRAIN)
if(!brain) return //no brain
- var/brain_damage = clamp((deadtime - DEFIB_TIME_LOSS)/(DEFIB_TIME_LIMIT - DEFIB_TIME_LOSS)*brain.max_damage, H.getBrainLoss(), brain.max_damage)
- H.setBrainLoss(brain_damage)
+ H.set_brain_damage(clamp((deadtime - DEFIB_TIME_LOSS)/(DEFIB_TIME_LIMIT - DEFIB_TIME_LOSS)*brain.max_damage, H.get_brain_damage(), brain.max_damage))
/obj/item/shockpaddles/proc/make_announcement(var/message, var/msg_class)
audible_message("\The [src] [message]", "\The [src] vibrates slightly.")
diff --git a/code/game/objects/items/weapons/grenades/flashbang.dm b/code/game/objects/items/weapons/grenades/flashbang.dm
index da480a4fbec5..9cad09e67842 100644
--- a/code/game/objects/items/weapons/grenades/flashbang.dm
+++ b/code/game/objects/items/weapons/grenades/flashbang.dm
@@ -16,7 +16,7 @@
for(var/obj/effect/blob/B in objs) //Blob damage here
var/damage = round(30/(get_dist(B,T)+1))
- B.take_damage(damage)
+ B.take_damage(damage, BRUTE)
new /obj/effect/sparks(loc)
new /obj/effect/effect/smoke/illumination(loc, 5, 30, 1, "#ffffff")
diff --git a/code/game/objects/items/weapons/handcuffs.dm b/code/game/objects/items/weapons/handcuffs.dm
index 526ea8ddd1ca..034310b4ee6f 100644
--- a/code/game/objects/items/weapons/handcuffs.dm
+++ b/code/game/objects/items/weapons/handcuffs.dm
@@ -128,7 +128,7 @@ var/global/last_chew = 0 //#FIXME: Its funny how only one person in the world ca
SPAN_DANGER("You chew on your [O.name]!"))
admin_attacker_log(H, "chewed on their [O.name]!")
- O.take_external_damage(3,0, DAM_SHARP|DAM_EDGE ,"teeth marks")
+ O.take_damage(3, BRUTE, damage_flags = DAM_SHARP|DAM_EDGE, used_weapon = "teeth marks")
last_chew = world.time
diff --git a/code/game/objects/items/weapons/implants/implant.dm b/code/game/objects/items/weapons/implants/implant.dm
index a874cd25b112..af2190bb5ef7 100644
--- a/code/game/objects/items/weapons/implants/implant.dm
+++ b/code/game/objects/items/weapons/implants/implant.dm
@@ -100,10 +100,10 @@
if(malfunction == MALFUNCTION_PERMANENT) return
to_chat(imp_in, SPAN_DANGER("You feel something melting inside [part ? "your [part.name]" : "you"]!"))
if (part)
- part.take_external_damage(burn = 15, used_weapon = "Electronics meltdown")
+ part.take_damage(15, BURN, used_weapon = "Electronics meltdown")
else
var/mob/living/M = imp_in
- M.apply_damage(15,BURN)
+ M.take_damage(15, BURN)
name = "melted implant"
desc = "Charred circuit in melted plastic case. Wonder what that used to be..."
icon_state = "implant_melted"
diff --git a/code/game/objects/items/weapons/implants/implants/explosive.dm b/code/game/objects/items/weapons/implants/implants/explosive.dm
index 2ccdddc21534..30b7389986b5 100644
--- a/code/game/objects/items/weapons/implants/implants/explosive.dm
+++ b/code/game/objects/items/weapons/implants/implants/explosive.dm
@@ -132,7 +132,7 @@
if (part)
if (istype(part,/obj/item/organ/external/chest) || \
istype(part,/obj/item/organ/external/groin))
- part.take_external_damage(60, used_weapon = "Explosion")
+ part.take_damage(60, BRUTE, used_weapon = "Explosion")
else
part.dismember(0,DISMEMBER_METHOD_BLUNT)
explosion(T, -1, -1, 2, 3)
diff --git a/code/game/objects/items/weapons/lighter.dm b/code/game/objects/items/weapons/lighter.dm
index d9e5c449e3e6..3c6792ee98fa 100644
--- a/code/game/objects/items/weapons/lighter.dm
+++ b/code/game/objects/items/weapons/lighter.dm
@@ -48,7 +48,7 @@
to_chat(user, "You burn yourself while lighting the lighter.")
var/hand_tag = user.get_held_slot_for_item(src)
if(hand_tag)
- user.apply_damage(2, BURN, hand_tag)
+ user.take_damage(2, BURN, hand_tag)
user.visible_message("After a few attempts, [user] manages to light the [src], burning their finger in the process.")
playsound(src.loc, "light_bic", 100, 1, -4)
diff --git a/code/game/objects/items/weapons/material/ashtray.dm b/code/game/objects/items/weapons/material/ashtray.dm
index f8c34638f8fc..7defff4a3152 100644
--- a/code/game/objects/items/weapons/material/ashtray.dm
+++ b/code/game/objects/items/weapons/material/ashtray.dm
@@ -54,7 +54,7 @@
dump_contents()
remove_extension(src, /datum/extension/scent)
update_icon()
- take_damage(3, BRUTE, 0, hit_atom)
+ take_damage(3, BRUTE, used_weapon = hit_atom)
/obj/item/ashtray/plastic
material = /decl/material/solid/organic/plastic
diff --git a/code/game/objects/items/weapons/material/kitchen.dm b/code/game/objects/items/weapons/material/kitchen.dm
index 91b0263ebde7..bddfa1700316 100644
--- a/code/game/objects/items/weapons/material/kitchen.dm
+++ b/code/game/objects/items/weapons/material/kitchen.dm
@@ -110,7 +110,7 @@
/obj/item/kitchen/rollingpin/attack(mob/living/M, mob/living/user)
if ((MUTATION_CLUMSY in user.mutations) && prob(50) && user.try_unequip(src))
to_chat(user, "\The [src] slips out of your hand and hits your head.")
- user.take_organ_damage(10)
+ user.take_damage(10, BRUTE, BP_HEAD)
SET_STATUS_MAX(user, STAT_PARA, 2)
return
return ..()
diff --git a/code/game/objects/items/weapons/material/shards.dm b/code/game/objects/items/weapons/material/shards.dm
index 79cb11faedb9..583a323f7907 100644
--- a/code/game/objects/items/weapons/material/shards.dm
+++ b/code/game/objects/items/weapons/material/shards.dm
@@ -30,7 +30,7 @@
var/obj/item/organ/external/hand = GET_EXTERNAL_ORGAN(H, H.get_active_held_item_slot())
if(istype(hand) && !BP_IS_PROSTHETIC(hand))
to_chat(H, SPAN_DANGER("You slice your hand on \the [src]!"))
- hand.take_external_damage(rand(5,10), used_weapon = src)
+ hand.take_damage(rand(5,10), BRUTE, used_weapon = src)
/obj/item/shard/set_material(var/new_material)
..(new_material)
@@ -119,7 +119,7 @@
if(!affecting || BP_IS_PROSTHETIC(affecting))
continue
to_chat(M, SPAN_DANGER("You step on \the [src]!"))
- affecting.take_external_damage(5, 0)
+ affecting.take_damage(5, BRUTE)
if(affecting.can_feel_pain())
SET_STATUS_MAX(M, STAT_WEAK, 3)
return
diff --git a/code/game/objects/items/weapons/material/thrown.dm b/code/game/objects/items/weapons/material/thrown.dm
index a20ac48e7345..4c71f929a145 100644
--- a/code/game/objects/items/weapons/material/thrown.dm
+++ b/code/game/objects/items/weapons/material/thrown.dm
@@ -22,7 +22,7 @@
if(material.radioactivity>0 && isliving(hit_atom))
var/mob/living/M = hit_atom
var/urgh = material.radioactivity
- M.adjustToxLoss(rand(urgh/2,urgh))
+ M.take_damage(rand(urgh/2,urgh), TOX)
/obj/item/star/afterattack(atom/target, mob/user, proximity_flag, click_parameters)
. = ..()
diff --git a/code/game/objects/items/weapons/melee/energy.dm b/code/game/objects/items/weapons/melee/energy.dm
index 1eee7a8b3388..c0a93825074c 100644
--- a/code/game/objects/items/weapons/melee/energy.dm
+++ b/code/game/objects/items/weapons/melee/energy.dm
@@ -145,7 +145,8 @@
SPAN_DANGER("You accidentally cut yourself with \the [src]."))
if(isliving(user))
var/mob/living/M = user
- M.take_organ_damage(5,5)
+ M.take_damage(5, BRUTE, skip_update_health = TRUE)
+ M.take_damage(5, BURN)
toggle_active(user)
add_fingerprint(user)
return TRUE
diff --git a/code/game/objects/items/weapons/policetape.dm b/code/game/objects/items/weapons/policetape.dm
index 29170908a0e4..1c6d04a4d5d4 100644
--- a/code/game/objects/items/weapons/policetape.dm
+++ b/code/game/objects/items/weapons/policetape.dm
@@ -353,7 +353,7 @@ var/global/list/image/hazard_overlays //Cached hazard floor overlays for the bar
/obj/structure/tape_barricade/proc/crumple()
if(!is_crumpled)
playsound(src, 'sound/effects/rip1.ogg', 60, TRUE)
- take_damage(5)
+ take_damage(5, BRUTE)
is_crumpled = TRUE
update_icon()
diff --git a/code/game/objects/items/weapons/shields.dm b/code/game/objects/items/weapons/shields.dm
index 3342015c3831..fddeeb15aba6 100644
--- a/code/game/objects/items/weapons/shields.dm
+++ b/code/game/objects/items/weapons/shields.dm
@@ -189,7 +189,7 @@
to_chat(user, SPAN_DANGER("You beat yourself in the head with [src]."))
if(isliving(user))
var/mob/living/M = user
- M.take_organ_damage(5, 0)
+ M.take_damage(5, BRUTE, BP_HEAD)
active = !active
if (active)
force = 10
diff --git a/code/game/objects/items/weapons/special_attacks/backstab.dm b/code/game/objects/items/weapons/special_attacks/backstab.dm
index 00d5670b2d1f..7721deda6a37 100644
--- a/code/game/objects/items/weapons/special_attacks/backstab.dm
+++ b/code/game/objects/items/weapons/special_attacks/backstab.dm
@@ -31,7 +31,9 @@ Proc returns a boolean if successful.
/obj/item/proc/backstab(var/mob/living/target, mob/user, var/damage = 30, var/damage_type = BRUTE, var/damage_flags, var/target_zone = BP_CHEST, var/location_check = TRUE)
//Runtime prevention.
- if( !( damage_type in list( BRUTE, BURN, TOX, OXY, CLONE, PAIN ) ) ) //End the proc with a false return if we're not doing a valid damage type.
+ //End the proc with a false return if we're not doing a valid damage type.
+ var/decl/damage_handler/damage_type_data = GET_DECL(damage_type)
+ if(!damage_type_data?.usable_with_backstab)
return FALSE
if(!iscarbon(target)) //No. You cannot backstab the borg.
@@ -84,12 +86,12 @@ Proc returns a boolean if successful.
if( !prob(H.get_blocked_ratio(target_zone, BRUTE, damage_flags, 0, damage) * 100) && !isnull(stabbed_part) && LAZYLEN(stabbed_part.internal_organs) )
var/obj/item/organ/internal/damaged_organ = pick(stabbed_part.internal_organs) //This could be improved by checking the size of an internal organ.
var/organ_damage = damage * 0.20
- damaged_organ.take_internal_damage(organ_damage)
+ damaged_organ.take_damage(organ_damage)
var/decl/pronouns/G = target.get_pronouns()
to_chat(user, SPAN_DANGER("You stab [target] in the back of [G.his] [stabbed_part.name]!"))
H.custom_pain(SPAN_DANGER("You feel a stabbing pain in the back of your [stabbed_part.name]!")) //Only the stabber and stabbed should know how bad this is.
else
- target.apply_damage(damage, damage_type, target_zone, DAM_SHARP, src) //Backstabbing. Does extra damage to simple mobs only.
+ target.take_damage(damage, damage_type, target_zone, DAM_SHARP, src) //Backstabbing. Does extra damage to simple mobs only.
to_chat(user, SPAN_DANGER("You stab [target] in the back!"))
return TRUE //Returns a value in case you want to layer additional behavior on this.
diff --git a/code/game/objects/items/weapons/storage/trays.dm b/code/game/objects/items/weapons/storage/trays.dm
index 9b81b952fda7..94c5a9f47840 100644
--- a/code/game/objects/items/weapons/storage/trays.dm
+++ b/code/game/objects/items/weapons/storage/trays.dm
@@ -46,7 +46,7 @@
if((MUTATION_CLUMSY in user.mutations) && prob(50)) // There is a better way to do this but I'll be damned if I'm the one to fix it.
to_chat(user, SPAN_DANGER("You accidentally slam yourself with the [src]!"))
SET_STATUS_MAX(user, STAT_WEAK, 1)
- user.take_organ_damage(2)
+ user.take_damage(10, BRUTE)
if(prob(50))
playsound(M, hitsound, 50, 1)
. = TRUE
diff --git a/code/game/objects/items/weapons/storage/wall_mirror.dm b/code/game/objects/items/weapons/storage/wall_mirror.dm
index 4ae11605eb1f..b6fda31adda0 100644
--- a/code/game/objects/items/weapons/storage/wall_mirror.dm
+++ b/code/game/objects/items/weapons/storage/wall_mirror.dm
@@ -59,7 +59,7 @@
flick("mirror_open",src)
return
-/obj/structure/mirror/take_damage(damage)
+/obj/structure/mirror/take_damage(damage, damage_type = BRUTE, def_zone, damage_flags = 0, used_weapon, armor_pen, silent = FALSE, override_droplimb, skip_update_health = FALSE)
if(prob(damage))
visible_message(SPAN_WARNING("[src] shatters!"))
shatter()
diff --git a/code/game/objects/items/weapons/swords_axes_etc.dm b/code/game/objects/items/weapons/swords_axes_etc.dm
index 287810c296cc..06e8bf62e6ea 100644
--- a/code/game/objects/items/weapons/swords_axes_etc.dm
+++ b/code/game/objects/items/weapons/swords_axes_etc.dm
@@ -21,11 +21,7 @@
if ((MUTATION_CLUMSY in user.mutations) && prob(50))
to_chat(user, "You club yourself over the head.")
SET_STATUS_MAX(user, STAT_WEAK, (3 * force))
- if(ishuman(user))
- var/mob/living/carbon/human/H = user
- H.apply_damage(2*force, BRUTE, BP_HEAD)
- else
- user.take_organ_damage(2*force)
+ user.take_damage(2*force, BRUTE, BP_HEAD)
return
return ..()
@@ -78,11 +74,7 @@
if ((MUTATION_CLUMSY in user.mutations) && prob(50))
to_chat(user, "You club yourself over the head.")
SET_STATUS_MAX(user, STAT_WEAK, (3 * force))
- if(ishuman(user))
- var/mob/living/carbon/human/H = user
- H.apply_damage(2*force, BRUTE, BP_HEAD)
- else
- user.take_organ_damage(2*force)
+ user.take_damage(2*force, BRUTE, BP_HEAD)
return
if(..())
//playsound(src.loc, "swing_hit", 50, 1, -1)
diff --git a/code/game/objects/items/weapons/traps.dm b/code/game/objects/items/weapons/traps.dm
index 56243d3d4d3e..9d14035608a2 100644
--- a/code/game/objects/items/weapons/traps.dm
+++ b/code/game/objects/items/weapons/traps.dm
@@ -80,7 +80,7 @@
else
target_zone = pick(BP_L_FOOT, BP_R_FOOT, BP_L_LEG, BP_R_LEG)
- if(!L.apply_damage(30, BRUTE, target_zone, used_weapon=src))
+ if(!L.take_damage(30, BRUTE, target_zone, used_weapon=src))
return 0
//trap the victim in place
diff --git a/code/game/objects/items/weapons/weaponry.dm b/code/game/objects/items/weapons/weaponry.dm
index 7b4aa541c863..ae6ea8676974 100644
--- a/code/game/objects/items/weapons/weaponry.dm
+++ b/code/game/objects/items/weapons/weaponry.dm
@@ -30,7 +30,7 @@
if ((MUTATION_CLUMSY in user.mutations) && prob(50))
to_chat(user, "The rod slips out of your hand and hits your head.")
- user.take_organ_damage(10)
+ user.take_damage(10, BRUTE, BP_HEAD)
SET_STATUS_MAX(user, STAT_PARA, 20)
return
diff --git a/code/game/objects/objs.dm b/code/game/objects/objs.dm
index ff11e6d8cef1..ba4974fd0090 100644
--- a/code/game/objects/objs.dm
+++ b/code/game/objects/objs.dm
@@ -127,8 +127,10 @@
. |= DAM_EDGE
if(is_sharp(src))
. |= DAM_SHARP
- if(damtype == BURN)
- . |= DAM_LASER
+ if(damtype)
+ var/decl/damage_handler/damage_type_data = GET_DECL(damtype)
+ if(damage_type_data.item_damage_flags)
+ . |= damage_type_data.item_damage_flags
/obj/attackby(obj/item/O, mob/user)
if(obj_flags & OBJ_FLAG_ANCHORABLE)
diff --git a/code/game/objects/structures/__structure.dm b/code/game/objects/structures/__structure.dm
index 71c12758222c..2815a4ae7609 100644
--- a/code/game/objects/structures/__structure.dm
+++ b/code/game/objects/structures/__structure.dm
@@ -86,7 +86,7 @@
set waitfor = FALSE
return FALSE
-/obj/structure/proc/take_damage(var/damage)
+/obj/structure/take_damage(damage, damage_type = BRUTE, def_zone, damage_flags = 0, used_weapon, armor_pen, silent = FALSE, override_droplimb, skip_update_health = FALSE)
if(health == -1) // This object does not take damage.
return
@@ -128,7 +128,7 @@
if(istype(material))
dmg = round(dmg * material.combustion_effect(get_turf(src),temperature, 0.3))
if(dmg)
- take_damage(dmg)
+ take_damage(dmg, BURN)
/obj/structure/Destroy()
var/turf/T = get_turf(src)
@@ -182,13 +182,13 @@
if (prob(30 * (1 - blocked)))
SET_STATUS_MAX(affecting_mob, STAT_WEAK, 5)
- affecting_mob.apply_damage(8, BRUTE, BP_HEAD)
+ affecting_mob.take_damage(8, BRUTE, BP_HEAD)
visible_message(SPAN_DANGER("[G.assailant] slams [affecting_mob]'s face against \the [src]!"))
if (material)
playsound(loc, material.tableslam_noise, 50, 1)
else
playsound(loc, 'sound/weapons/tablehit1.ogg', 50, 1)
- var/list/L = take_damage(rand(1,5))
+ var/list/L = take_damage(rand(1,5), BRUTE)
for(var/obj/item/shard/S in L)
if(S.sharp && prob(50))
affecting_mob.visible_message(SPAN_DANGER("\The [S] slices into [affecting_mob]'s face!"), SPAN_DANGER("\The [S] slices into your face!"))
@@ -212,9 +212,9 @@
if(severity == 1)
physically_destroyed()
else if(severity == 2)
- take_damage(rand(20, 30))
+ take_damage(rand(20, 30), BRUTE)
else
- take_damage(rand(5, 15))
+ take_damage(rand(5, 15), BRUTE)
/obj/structure/proc/can_repair(var/mob/user)
if(health >= max_health)
@@ -223,7 +223,7 @@
return TRUE
/obj/structure/bullet_act(var/obj/item/projectile/Proj)
- if(take_damage(Proj.get_structure_damage()))
+ if(take_damage(Proj.get_structure_damage(), Proj.damage_type, damage_flags = Proj.damage_flags))
return PROJECTILE_CONTINUE
/*
diff --git a/code/game/objects/structures/_structure_construction.dm b/code/game/objects/structures/_structure_construction.dm
index c38aa84cab5e..38b3f8a51aa0 100644
--- a/code/game/objects/structures/_structure_construction.dm
+++ b/code/game/objects/structures/_structure_construction.dm
@@ -117,7 +117,7 @@
if(O.force && user.a_intent == I_HURT)
attack_animation(user)
visible_message(SPAN_DANGER("\The [src] has been [pick(O.attack_verb)] with \the [O] by \the [user]!"))
- take_damage(O.force)
+ take_damage(O.force, O.damtype)
. = TRUE
else if(IS_WRENCH(O))
@@ -149,7 +149,7 @@
return FALSE
if(damage >= 10)
visible_message(SPAN_DANGER("\The [user] [attack_verb] into [src]!"))
- take_damage(damage)
+ take_damage(damage, BRUTE)
else
visible_message(SPAN_NOTICE("\The [user] bonks \the [src] harmlessly."))
return TRUE
\ No newline at end of file
diff --git a/code/game/objects/structures/barricade.dm b/code/game/objects/structures/barricade.dm
index a7709ec0961c..e24dbc0ebbe0 100644
--- a/code/game/objects/structures/barricade.dm
+++ b/code/game/objects/structures/barricade.dm
@@ -73,7 +73,7 @@
parts_type = null
physically_destroyed()
else if(severity == 2)
- take_damage(25)
+ take_damage(25, BRUTE)
/obj/structure/barricade/CanPass(atom/movable/mover, turf/target, height=0, air_group=0)//So bullets will fly over and stuff.
if(air_group || (height==0))
@@ -97,5 +97,5 @@
spike_damage_holder = (spike_damage / 4)
if(isanimal(victim)) //simple animals have simple health, reduce our spike_damage
spike_damage_holder = (spike_damage / 4)
- victim.apply_damage(spike_damage_holder, BRUTE, target_zone, damage_flags = DAM_SHARP, used_weapon = src)
+ victim.take_damage(spike_damage_holder, BRUTE, target_zone, damage_flags = DAM_SHARP, used_weapon = src)
visible_message(SPAN_DANGER("\The [victim] is [pick(poke_description)] by \the [src]!"))
\ No newline at end of file
diff --git a/code/game/objects/structures/charge_pylon.dm b/code/game/objects/structures/charge_pylon.dm
index 16bb11dac279..fc22ea299adf 100644
--- a/code/game/objects/structures/charge_pylon.dm
+++ b/code/game/objects/structures/charge_pylon.dm
@@ -36,7 +36,7 @@
power_cell.charge = power_cell.maxcharge
to_chat(user, "Your [power_cell] has been charged to capacity.")
else if(isrobot(user))
- user.apply_damage(150, BURN, def_zone = BP_CHEST)
+ user.take_damage(150, BURN, def_zone = BP_CHEST)
visible_message("Electricity arcs off [user] as it touches \the [src]!")
to_chat(user, "You detect damage to your components!")
user.throw_at(get_step(user,get_dir(src,user)), 5, 10)
diff --git a/code/game/objects/structures/crates_lockers/closets/__closet.dm b/code/game/objects/structures/crates_lockers/closets/__closet.dm
index 892a16828ed0..4beb64a60bda 100644
--- a/code/game/objects/structures/crates_lockers/closets/__closet.dm
+++ b/code/game/objects/structures/crates_lockers/closets/__closet.dm
@@ -231,7 +231,7 @@ var/global/list/closets = list()
var/proj_damage = Proj.get_structure_damage()
if(proj_damage)
..()
- take_damage(proj_damage)
+ take_damage(proj_damage, Proj.damage_type, Proj.damage_flags)
/obj/structure/closet/attackby(obj/item/W, mob/user)
diff --git a/code/game/objects/structures/crates_lockers/closets/statue.dm b/code/game/objects/structures/crates_lockers/closets/statue.dm
index 4b08f285a1e3..57f195f21c68 100644
--- a/code/game/objects/structures/crates_lockers/closets/statue.dm
+++ b/code/game/objects/structures/crates_lockers/closets/statue.dm
@@ -24,10 +24,10 @@
L.forceMove(src)
L.set_sdisability(MUTED)
health = L.current_health + 100 //stoning damaged mobs will result in easier to shatter statues
- intialTox = L.getToxLoss()
- intialFire = L.getFireLoss()
- intialBrute = L.getBruteLoss()
- intialOxy = L.getOxyLoss()
+ intialTox = L.get_damage(TOX)
+ intialFire = L.get_damage(BURN)
+ intialBrute = L.get_damage(BRUTE)
+ intialOxy = L.get_damage(OXY)
if(ishuman(L))
name = "statue of [L.name]"
if(L.gender == "female")
@@ -49,10 +49,10 @@
/obj/structure/closet/statue/Process()
timer--
for(var/mob/living/M in src) //Go-go gadget stasis field
- M.setToxLoss(intialTox)
- M.adjustFireLoss(intialFire - M.getFireLoss(), do_update_health = FALSE)
- M.adjustBruteLoss(intialBrute - M.getBruteLoss())
- M.setOxyLoss(intialOxy)
+ M.set_damage(intialTox, TOX, skip_update_health = TRUE)
+ M.set_damage(intialFire, BURN, skip_update_health = TRUE)
+ M.set_damage(intialBrute, BRUTE, skip_update_health = TRUE)
+ M.set_damage(intialOxy, OXY)
if (timer <= 0)
dump_contents()
STOP_PROCESSING(SSobj, src)
@@ -65,7 +65,7 @@
for(var/mob/living/M in src)
M.dropInto(loc)
M.unset_sdisability(MUTED)
- M.take_overall_damage((M.current_health - health - 100),0) //any new damage the statue incurred is transfered to the mob
+ M.take_damage((M.current_health - health - 100), BRUTE) //any new damage the statue incurred is transfered to the mob
if(M.client)
M.client.eye = M.client.mob
M.client.perspective = MOB_PERSPECTIVE
diff --git a/code/game/objects/structures/defensive_barrier.dm b/code/game/objects/structures/defensive_barrier.dm
index d28141302bca..3c3fc8fc472f 100644
--- a/code/game/objects/structures/defensive_barrier.dm
+++ b/code/game/objects/structures/defensive_barrier.dm
@@ -106,7 +106,7 @@
var/decl/species/species = user.get_species()
if(ishuman(user) && species?.can_shred(user) && user.a_intent == I_HURT)
- take_damage(20)
+ take_damage(20, BRUTE)
user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN)
return TRUE
@@ -141,7 +141,7 @@
. = ..()
-/obj/structure/defensive_barrier/take_damage(damage)
+/obj/structure/defensive_barrier/take_damage(damage, damage_type = BRUTE, def_zone, damage_flags = 0, used_weapon, armor_pen, silent = FALSE, override_droplimb, skip_update_health = FALSE)
if(damage)
playsound(src.loc, 'sound/effects/bang.ogg', 75, 1)
damage = round(damage * 0.5)
diff --git a/code/game/objects/structures/displaycase.dm b/code/game/objects/structures/displaycase.dm
index e5ab45af656d..ed0e4eee53d5 100644
--- a/code/game/objects/structures/displaycase.dm
+++ b/code/game/objects/structures/displaycase.dm
@@ -45,11 +45,11 @@
AM.dropInto(loc)
qdel(src)
else if(prob(50))
- take_damage(20 - (severity * 5))
+ take_damage(20 - (severity * 5), BRUTE)
/obj/structure/displaycase/bullet_act(var/obj/item/projectile/Proj)
..()
- take_damage(Proj.get_structure_damage())
+ take_damage(Proj.get_structure_damage(), Proj.damage_type)
/obj/structure/proc/subtract_matter(var/obj/subtracting)
if(!length(matter))
@@ -132,5 +132,5 @@
else if(!destroyed && user.a_intent == I_HURT)
visible_message(SPAN_WARNING("[user] kicks \the [src]."), SPAN_WARNING("You kick \the [src]."))
- take_damage(2)
+ take_damage(2, BRUTE)
return TRUE
diff --git a/code/game/objects/structures/doors/_door.dm b/code/game/objects/structures/doors/_door.dm
index 4e047589e64e..b8fb04d40bea 100644
--- a/code/game/objects/structures/doors/_door.dm
+++ b/code/game/objects/structures/doors/_door.dm
@@ -98,7 +98,7 @@
/obj/structure/door/explosion_act(severity)
. = ..()
if(!QDELETED(src))
- take_damage(100 - (severity * 30))
+ take_damage(100 - (severity * 30), BRUTE)
/obj/structure/door/can_repair(var/mob/user)
. = ..()
diff --git a/code/game/objects/structures/fires.dm b/code/game/objects/structures/fires.dm
index ce595ef7b407..7cdf97ecaead 100644
--- a/code/game/objects/structures/fires.dm
+++ b/code/game/objects/structures/fires.dm
@@ -350,7 +350,7 @@
var/mob/living/M = victim
to_chat(M, SPAN_DANGER("You are burned by \the [src]!"))
M.IgniteMob()
- M.apply_damage(rand(5, 15), BURN)
+ M.take_damage(rand(5, 15), BURN)
#undef FUEL_CONSUMPTION_CONSTANT
#undef FIRE_LIT
diff --git a/code/game/objects/structures/fitness.dm b/code/game/objects/structures/fitness.dm
index 2542d145af10..49c34798eedc 100644
--- a/code/game/objects/structures/fitness.dm
+++ b/code/game/objects/structures/fitness.dm
@@ -79,7 +79,7 @@
if(weight - skill > max_weight/2)
if(prob(50))
message = ", getting hurt in the process"
- H.apply_damage(5)
+ H.take_damage(5, BRUTE)
else
message = "; this does not look safe"
else
diff --git a/code/game/objects/structures/girders.dm b/code/game/objects/structures/girders.dm
index c95d6d96d301..9009f3d46126 100644
--- a/code/game/objects/structures/girders.dm
+++ b/code/game/objects/structures/girders.dm
@@ -78,7 +78,7 @@
damage = FLOOR(damage * 0.75)
..()
if(damage)
- take_damage(damage)
+ take_damage(damage, BRUTE)
/obj/structure/girder/CanFluidPass(var/coming_from)
return TRUE
diff --git a/code/game/objects/structures/grille.dm b/code/game/objects/structures/grille.dm
index 08bfd215d85f..72ac8acb92b6 100644
--- a/code/game/objects/structures/grille.dm
+++ b/code/game/objects/structures/grille.dm
@@ -148,9 +148,9 @@
if(passthrough)
. = PROJECTILE_CONTINUE
- damage = clamp(0, (damage - Proj.damage)*(Proj.damage_type == BRUTE? 0.4 : 1), 10) //if the bullet passes through then the grille avoids most of the damage
+ damage = clamp(0, (damage - Proj.damage)*(Proj.damage_type == BRUTE ? 0.4 : 1), 10) //if the bullet passes through then the grille avoids most of the damage
- take_damage(damage*0.2)
+ take_damage(damage*0.2, BRUTE)
/obj/structure/grille/proc/cut_grille()
playsound(loc, 'sound/items/Wirecutter.ogg', 100, 1)
@@ -201,13 +201,15 @@
user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN)
user.do_attack_animation(src)
playsound(loc, 'sound/effects/grillehit.ogg', 80, 1)
- switch(W.damtype)
- if(BURN)
- take_damage(W.force)
- if(BRUTE)
- take_damage(W.force * 0.1)
+ take_damage(W.force, W.damtype)
..()
+// TODO: handle this with armour or something.
+/obj/structure/grille/take_damage(damage, damage_type = BRUTE, def_zone, damage_flags = 0, used_weapon, armor_pen, silent = FALSE, override_droplimb, skip_update_health = FALSE)
+ if(damage_type == BURN)
+ damage = round(damage * 0.1)
+ return ..()
+
/obj/structure/grille/physically_destroyed(var/skip_qdel)
SHOULD_CALL_PARENT(FALSE)
if(!destroyed)
@@ -240,9 +242,8 @@
return 0
/obj/structure/grille/fire_act(datum/gas_mixture/air, exposed_temperature, exposed_volume)
- if(!destroyed)
- if(exposed_temperature > material.melting_point)
- take_damage(1)
+ if(!destroyed && exposed_temperature > material.melting_point)
+ take_damage(1, BURN)
..()
// Used in mapping to avoid
@@ -253,7 +254,7 @@
/obj/structure/grille/broken/Initialize()
. = ..()
- take_damage(rand(1, 5)) //In the destroyed but not utterly threshold.
+ take_damage(rand(1, 5), BRUTE) //In the destroyed but not utterly threshold.
/obj/structure/grille/cult
name = "cult grille"
diff --git a/code/game/objects/structures/inflatable.dm b/code/game/objects/structures/inflatable.dm
index 0acc26f3654e..cb69d932744c 100644
--- a/code/game/objects/structures/inflatable.dm
+++ b/code/game/objects/structures/inflatable.dm
@@ -88,13 +88,13 @@
max_local_temp = max(max_local_temp, env.temperature)
if(prob(50) && (max_pressure - min_pressure > max_pressure_diff || max_local_temp > max_temp))
- take_damage(1)
+ take_damage(1, BRUTE)
/obj/structure/inflatable/CanPass(atom/movable/mover, turf/target, height=0, air_group=0)
return 0
/obj/structure/inflatable/bullet_act(var/obj/item/projectile/Proj)
- take_damage(Proj.get_structure_damage())
+ take_damage(Proj.get_structure_damage(), Proj.damage_type, damage_flags = Proj.damage_flags)
if(QDELETED(src))
return PROJECTILE_CONTINUE
diff --git a/code/game/objects/structures/ironing_board.dm b/code/game/objects/structures/ironing_board.dm
index 473f91bb780c..a7eeef1a4023 100644
--- a/code/game/objects/structures/ironing_board.dm
+++ b/code/game/objects/structures/ironing_board.dm
@@ -94,7 +94,7 @@
visible_message("[user] irons [src.buckled_mob]'s [parsed]!", "You iron [buckled_mob]'s [parsed]!")
var/obj/item/organ/external/affecting = GET_EXTERNAL_ORGAN(H, zone)
- affecting.take_external_damage(0, 15, used_weapon = "Hot metal")
+ affecting.take_damage(15, BURN, used_weapon = "Hot metal")
return
diff --git a/code/game/objects/structures/iv_drip.dm b/code/game/objects/structures/iv_drip.dm
index 596c9f0b506d..d5a1f4eb4bee 100644
--- a/code/game/objects/structures/iv_drip.dm
+++ b/code/game/objects/structures/iv_drip.dm
@@ -206,7 +206,7 @@
/obj/structure/iv_drip/proc/rip_out()
visible_message("The needle is ripped out of [src.attached], doesn't that hurt?")
- attached.apply_damage(1, BRUTE, pick(BP_R_ARM, BP_L_ARM), damage_flags=DAM_SHARP)
+ attached.take_damage(1, BRUTE, pick(BP_R_ARM, BP_L_ARM), damage_flags=DAM_SHARP)
attached = null
/obj/structure/iv_drip/proc/hook_up(mob/living/carbon/human/target, mob/user)
@@ -221,7 +221,7 @@
if(prob(user.skill_fail_chance(SKILL_MEDICAL, 80, SKILL_BASIC)))
user.visible_message("\The [user] fails to find the vein while trying to hook \the [target] up to \the [IV], stabbing them instead!")
- target.apply_damage(2, BRUTE, pick(BP_R_ARM, BP_L_ARM), damage_flags=DAM_SHARP)
+ target.take_damage(2, BRUTE, pick(BP_R_ARM, BP_L_ARM), damage_flags=DAM_SHARP)
return FALSE
user.visible_message("\The [user] hooks \the [target] up to \the [IV].")
diff --git a/code/game/objects/structures/mineral_bath.dm b/code/game/objects/structures/mineral_bath.dm
index 14bb3ef3f230..8b8cf2f3de42 100644
--- a/code/game/objects/structures/mineral_bath.dm
+++ b/code/game/objects/structures/mineral_bath.dm
@@ -128,8 +128,8 @@
// Repair crystalline internal organs.
if(prob(10))
for(var/obj/item/organ/internal/I in occupant.get_internal_organs())
- if(BP_IS_CRYSTAL(I) && I.damage)
- I.heal_damage(rand(3,5))
+ if(BP_IS_CRYSTAL(I) && I.organ_damage)
+ I.heal_damage(rand(3,5), BRUTE)
if(prob(25))
to_chat(occupant, SPAN_NOTICE("The mineral-rich bath mends your [I.name]."))
@@ -143,7 +143,9 @@
to_chat(occupant, SPAN_NOTICE("The mineral-rich bath dissolves the [implanted_object.name]."))
qdel(implanted_object)
if(E.brute_dam || E.burn_dam)
- E.heal_damage(rand(3,5), rand(3,5), robo_repair = 1)
+ // TODO synthetic repair flag
+ E.heal_damage(rand(3,5), BRUTE)
+ E.heal_damage(rand(3,5), BURN)
if(prob(25))
to_chat(occupant, SPAN_NOTICE("The mineral-rich bath mends your [E.name]."))
if(!BP_IS_CRYSTAL(E) && !BP_IS_BRITTLE(E))
diff --git a/code/game/objects/structures/railing.dm b/code/game/objects/structures/railing.dm
index 69a056f2d2d4..94e0178b2fbe 100644
--- a/code/game/objects/structures/railing.dm
+++ b/code/game/objects/structures/railing.dm
@@ -32,7 +32,7 @@
if(!material || !material.radioactivity)
return
for(var/mob/living/L in range(1,src))
- L.apply_damage(round(material.radioactivity/20),IRRADIATE, damage_flags = DAM_DISPERSED)
+ L.take_damage(round(material.radioactivity/20), IRRADIATE, damage_flags = DAM_DISPERSED)
/obj/structure/railing/Initialize()
. = ..()
@@ -195,7 +195,7 @@
var/blocked = H.get_blocked_ratio(BP_HEAD, BRUTE, damage = 8)
if (prob(30 * (1 - blocked)))
SET_STATUS_MAX(H, STAT_WEAK, 5)
- H.apply_damage(8, BRUTE, BP_HEAD)
+ H.take_damage(8, BRUTE, BP_HEAD)
else
if (get_turf(H) == get_turf(src))
H.forceMove(get_step(src, src.dir))
@@ -257,10 +257,10 @@
update_icon()
return
- if(W.force && (W.damtype == BURN || W.damtype == BRUTE))
+ if(W.force && (W.damtype == BRUTE || W.damtype == BURN))
user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN)
visible_message("\The [src] has been [LAZYLEN(W.attack_verb) ? pick(W.attack_verb) : "attacked"] with \the [W] by \the [user]!")
- take_damage(W.force)
+ take_damage(W.force, W.damtype)
return
. = ..()
@@ -279,9 +279,8 @@
/obj/structure/railing/do_climb(var/mob/living/user)
. = ..()
- if(.)
- if(!anchored || material.is_brittle())
- take_damage(max_health) // Fatboy
+ if(. && (!anchored || material.is_brittle()))
+ take_damage(max_health, BRUTE)
user.jump_layer_shift()
addtimer(CALLBACK(user, TYPE_PROC_REF(/mob/living, jump_layer_shift_end)), 2)
diff --git a/code/game/objects/structures/stool_bed_chair_nest_sofa/chairs.dm b/code/game/objects/structures/stool_bed_chair_nest_sofa/chairs.dm
index 197a92739aab..aa0854f87df9 100644
--- a/code/game/objects/structures/stool_bed_chair_nest_sofa/chairs.dm
+++ b/code/game/objects/structures/stool_bed_chair_nest_sofa/chairs.dm
@@ -183,7 +183,7 @@
occupant.apply_effect(6, STUN, blocked)
occupant.apply_effect(6, WEAKEN, blocked) //#TODO: geez that might be a bit overkill
occupant.apply_effect(6, STUTTER, blocked)
- occupant.apply_damage(10, BRUTE, def_zone)
+ occupant.take_damage(10, BRUTE, def_zone)
playsound(src.loc, 'sound/weapons/punch1.ogg', 50, 1, -1)
if(isliving(A))
var/mob/living/victim = A
@@ -192,7 +192,7 @@
victim.apply_effect(6, STUN, blocked)
victim.apply_effect(6, WEAKEN, blocked) //#TODO: geez that might be a bit overkill
victim.apply_effect(6, STUTTER, blocked)
- victim.apply_damage(10, BRUTE, def_zone)
+ victim.take_damage(10, BRUTE, def_zone)
occupant.visible_message("[occupant] crashed into \the [A]!")
/obj/structure/bed/chair/office/light
diff --git a/code/game/objects/structures/stool_bed_chair_nest_sofa/stools.dm b/code/game/objects/structures/stool_bed_chair_nest_sofa/stools.dm
index 29b93c080034..8913dddea39c 100644
--- a/code/game/objects/structures/stool_bed_chair_nest_sofa/stools.dm
+++ b/code/game/objects/structures/stool_bed_chair_nest_sofa/stools.dm
@@ -76,7 +76,7 @@
var/blocked = target.get_blocked_ratio(hit_zone, BRUTE, damage = 20)
SET_STATUS_MAX(target, STAT_WEAK, (10 * (1 - blocked)))
- target.apply_damage(20, BRUTE, hit_zone, src)
+ target.take_damage(20, BRUTE, hit_zone, src)
return 1
return ..()
diff --git a/code/game/objects/structures/stool_bed_chair_nest_sofa/wheelchair.dm b/code/game/objects/structures/stool_bed_chair_nest_sofa/wheelchair.dm
index f2e34f4e701d..11e4d1784eea 100644
--- a/code/game/objects/structures/stool_bed_chair_nest_sofa/wheelchair.dm
+++ b/code/game/objects/structures/stool_bed_chair_nest_sofa/wheelchair.dm
@@ -50,7 +50,7 @@
occupant.apply_effect(6, STUN, blocked)
occupant.apply_effect(6, WEAKEN, blocked)
occupant.apply_effect(6, STUTTER, blocked)
- occupant.apply_damage(10, BRUTE, def_zone)
+ occupant.take_damage(10, BRUTE, def_zone)
playsound(src.loc, 'sound/weapons/punch1.ogg', 50, 1, -1)
if(isliving(A))
var/mob/living/victim = A
@@ -59,7 +59,7 @@
victim.apply_effect(6, STUN, blocked)
victim.apply_effect(6, WEAKEN, blocked)
victim.apply_effect(6, STUTTER, blocked)
- victim.apply_damage(10, BRUTE, def_zone)
+ victim.take_damage(10, BRUTE, def_zone)
occupant.visible_message(SPAN_DANGER("\The [occupant] crashed into \the [A]!"))
/obj/structure/bed/chair/wheelchair/proc/create_track()
diff --git a/code/game/objects/structures/tables.dm b/code/game/objects/structures/tables.dm
index 1d839db87bb7..96f696b8f49c 100644
--- a/code/game/objects/structures/tables.dm
+++ b/code/game/objects/structures/tables.dm
@@ -584,7 +584,7 @@
if(istype(target))
A.throw_at(target, 1, 1)
- take_damage(rand(5, 10))
+ take_damage(rand(5, 10), BRUTE)
update_connections(TRUE)
update_icon()
diff --git a/code/game/objects/structures/wall_frame.dm b/code/game/objects/structures/wall_frame.dm
index c70b7ca45527..d0e37527cf07 100644
--- a/code/game/objects/structures/wall_frame.dm
+++ b/code/game/objects/structures/wall_frame.dm
@@ -136,10 +136,7 @@
update_icon()
/obj/structure/wall_frame/bullet_act(var/obj/item/projectile/Proj)
- var/proj_damage = Proj.get_structure_damage()
- var/damage = min(proj_damage, 100)
- take_damage(damage)
- return
+ take_damage(min(Proj.get_structure_damage(), 100), Proj.damage_type, damage_flags = Proj.damage_flags)
/obj/structure/wall_frame/hitby(AM, var/datum/thrownthing/TT)
..()
@@ -152,7 +149,7 @@
tforce = O.throwforce * (TT.speed/THROWFORCE_SPEED_DIVISOR)
if (tforce < 15)
return
- take_damage(tforce)
+ take_damage(tforce, BRUTE)
/obj/structure/wall_frame/get_color()
return paint_color
diff --git a/code/game/objects/structures/watercloset.dm b/code/game/objects/structures/watercloset.dm
index c9d7b701def3..2d9bc0b702b0 100644
--- a/code/game/objects/structures/watercloset.dm
+++ b/code/game/objects/structures/watercloset.dm
@@ -123,7 +123,7 @@ var/global/list/hygiene_props = list()
SPAN_DANGER("\The [user] slams the toilet seat onto \the [swirlie]'s head!"),
SPAN_NOTICE("You slam the toilet seat onto \the [swirlie]'s head!"),
"You hear reverberating porcelain.")
- swirlie.adjustBruteLoss(8)
+ swirlie.take_damage(8, BRUTE)
return TRUE
if(cistern && !open)
@@ -176,13 +176,13 @@ var/global/list/hygiene_props = list()
swirlie = GM
if(do_after(user, 30, src))
user.visible_message(SPAN_DANGER("\The [user] gives [GM.name] a swirlie!"))
- GM.adjustOxyLoss(5)
+ GM.take_damage(5, OXY)
swirlie = null
else
user.visible_message(
SPAN_DANGER("\The [user] slams \the [GM] into the [src]!"),
SPAN_NOTICE("You slam \the [GM] into the [src]!"))
- GM.adjustBruteLoss(8)
+ GM.take_damage(8, BRUTE)
playsound(src.loc, 'sound/effects/bang.ogg', 25, 1)
return
@@ -220,7 +220,7 @@ var/global/list/hygiene_props = list()
to_chat(user, SPAN_WARNING("\The [GM] needs to be on \the [src]."))
return
user.visible_message(SPAN_DANGER("\The [user] slams \the [GM] into the [src]!"))
- GM.adjustBruteLoss(8)
+ GM.take_damage(8, BRUTE)
. = ..()
/obj/structure/hygiene/shower
diff --git a/code/game/objects/structures/window.dm b/code/game/objects/structures/window.dm
index 80839fb8b84d..c2513f273153 100644
--- a/code/game/objects/structures/window.dm
+++ b/code/game/objects/structures/window.dm
@@ -82,7 +82,7 @@
SHOULD_CALL_PARENT(FALSE)
. = shatter()
-/obj/structure/window/take_damage(damage = 0)
+/obj/structure/window/take_damage(damage, damage_type = BRUTE, def_zone, damage_flags = 0, used_weapon, armor_pen, silent = FALSE, override_droplimb, skip_update_health = FALSE)
. = ..()
playsound(loc, "glasscrack", 100, 1)
@@ -98,10 +98,8 @@
qdel(src)
/obj/structure/window/bullet_act(var/obj/item/projectile/Proj)
- var/proj_damage = Proj.get_structure_damage()
- if(!proj_damage) return
..()
- take_damage(proj_damage)
+ take_damage(Proj.get_structure_damage(), Proj.damage_type, damage_flags = Proj.damage_flags)
/obj/structure/window/explosion_act(severity)
..()
@@ -141,7 +139,7 @@
if(health - tforce <= 7 && !reinf_material)
set_anchored(FALSE)
step(src, get_dir(AM, src))
- take_damage(tforce)
+ take_damage(tforce, BRUTE)
/obj/structure/window/attack_hand(mob/user)
SHOULD_CALL_PARENT(FALSE)
@@ -285,20 +283,20 @@
G.affecting.visible_message(SPAN_DANGER("[G.assailant] bashes [G.affecting] against \the [src]!"))
if(prob(50))
SET_STATUS_MAX(affecting_mob, STAT_WEAK, 2)
- affecting_mob.apply_damage(10, BRUTE, def_zone, used_weapon = src)
+ affecting_mob.take_damage(10, BRUTE, def_zone, used_weapon = src)
hit(25)
qdel(G)
else
G.affecting.visible_message(SPAN_DANGER("[G.assailant] crushes [G.affecting] against \the [src]!"))
SET_STATUS_MAX(affecting_mob, STAT_WEAK, 5)
- affecting_mob.apply_damage(20, BRUTE, def_zone, used_weapon = src)
+ affecting_mob.take_damage(20, BRUTE, def_zone, used_weapon = src)
hit(50)
qdel(G)
return TRUE
/obj/structure/window/proc/hit(var/damage, var/sound_effect = 1)
if(reinf_material) damage *= 0.5
- take_damage(damage)
+ take_damage(damage, BRUTE)
/obj/structure/window/rotate(mob/user)
if(!CanPhysicallyInteract(user))
@@ -591,7 +589,7 @@
SHOULD_CALL_PARENT(FALSE)
return
-/obj/structure/window/reinforced/crescent/take_damage()
+/obj/structure/window/reinforced/crescent/take_damage(damage, damage_type = BRUTE, def_zone, damage_flags = 0, used_weapon, armor_pen, silent = FALSE, override_droplimb, skip_update_health = FALSE)
return
/obj/structure/window/reinforced/crescent/shatter()
diff --git a/code/game/turfs/simulated/wall_attacks.dm b/code/game/turfs/simulated/wall_attacks.dm
index 44e9afff1639..4592b7cf2ff6 100644
--- a/code/game/turfs/simulated/wall_attacks.dm
+++ b/code/game/turfs/simulated/wall_attacks.dm
@@ -56,7 +56,7 @@
/turf/simulated/wall/proc/fail_smash(var/mob/user)
to_chat(user, "You smash against \the [src]!")
- take_damage(rand(25,75))
+ take_damage(rand(25,75), BRUTE)
/turf/simulated/wall/proc/success_smash(var/mob/user)
to_chat(user, "You smash through \the [src]!")
@@ -130,16 +130,16 @@
var/turf/T = user.loc //get user's location for delay checks
- if(damage && istype(W, /obj/item/weldingtool))
+ if(wall_damage && istype(W, /obj/item/weldingtool))
var/obj/item/weldingtool/WT = W
if(WT.weld(0,user))
to_chat(user, "You start repairing the damage to [src].")
playsound(src, 'sound/items/Welder.ogg', 100, 1)
- if(do_after(user, max(5, damage / 5), src) && WT && WT.isOn())
+ if(do_after(user, max(5, wall_damage / 5), src) && WT && WT.isOn())
to_chat(user, "You finish repairing the damage to [src].")
- take_damage(-damage)
+ heal_damage(max(5, wall_damage))
return TRUE
// Basic dismantling.
@@ -343,10 +343,7 @@
return
user.do_attack_animation(src)
- var/material_divisor = max(material.brute_armor, reinf_material?.brute_armor)
- if(W.damtype == BURN)
- material_divisor = max(material.burn_armor, reinf_material?.burn_armor)
- var/effective_force = round(W.force / material_divisor)
+ var/effective_force = round(W.force / max(1, max(material.wall_armor[W.damtype], reinf_material?.wall_armor[W.damtype])))
if(effective_force < 2)
visible_message(SPAN_DANGER("\The [user] [pick(W.attack_verb)] \the [src] with \the [W], but it had no effect!"))
playsound(src, hitsound, 25, 1)
@@ -363,5 +360,5 @@
playsound(src, 'sound/effects/metalhit.ogg', 50, 1)
visible_message(SPAN_DANGER("\The [user] [pick(W.attack_verb)] \the [src] with \the [W]!"))
- take_damage(effective_force)
+ take_damage(effective_force, W.damtype)
return TRUE
\ No newline at end of file
diff --git a/code/game/turfs/simulated/wall_icon.dm b/code/game/turfs/simulated/wall_icon.dm
index b75170c71c8b..b66463ab76c8 100644
--- a/code/game/turfs/simulated/wall_icon.dm
+++ b/code/game/turfs/simulated/wall_icon.dm
@@ -165,11 +165,11 @@
if(texture)
add_overlay(texture)
- if(damage != 0 && SSmaterials.wall_damage_overlays)
+ if(wall_damage != 0 && SSmaterials.wall_damage_overlays)
var/integrity = material.integrity
if(reinf_material)
integrity += reinf_material.integrity
- add_overlay(SSmaterials.wall_damage_overlays[clamp(round(damage / integrity * DAMAGE_OVERLAY_COUNT) + 1, 1, DAMAGE_OVERLAY_COUNT)])
+ add_overlay(SSmaterials.wall_damage_overlays[clamp(round(wall_damage / integrity * DAMAGE_OVERLAY_COUNT) + 1, 1, DAMAGE_OVERLAY_COUNT)])
/turf/simulated/wall/proc/can_join_with(var/turf/simulated/wall/W)
if(material && istype(W.material))
diff --git a/code/game/turfs/simulated/walls.dm b/code/game/turfs/simulated/walls.dm
index 29d376df442c..6f3f7bb6d1bc 100644
--- a/code/game/turfs/simulated/walls.dm
+++ b/code/game/turfs/simulated/walls.dm
@@ -29,7 +29,7 @@ var/global/list/wall_fullblend_objects = list(
color = COLOR_STEEL
turf_flags = TURF_IS_HOLOMAP_OBSTACLE
- var/damage = 0
+ var/wall_damage = 0
var/can_open = 0
var/decl/material/material
var/decl/material/reinf_material
@@ -113,21 +113,13 @@ var/global/list/wall_fullblend_objects = list(
else if(istype(Proj,/obj/item/projectile/ion))
burn(500)
- var/proj_damage = Proj.get_structure_damage()
-
if(Proj.ricochet_sounds && prob(15))
playsound(src, pick(Proj.ricochet_sounds), 100, 1)
-
- if(reinf_material)
- if(Proj.damage_type == BURN)
- proj_damage /= reinf_material.burn_armor
- else if(Proj.damage_type == BRUTE)
- proj_damage /= reinf_material.brute_armor
-
+ var/proj_damage = Proj.get_structure_damage()
+ if(Proj.damage_type in reinf_material?.wall_armor)
+ proj_damage = round(proj_damage / reinf_material.wall_armor[Proj.damage_type])
//cap the amount of damage, so that things like emitters can't destroy walls in one hit.
- var/damage = min(proj_damage, 100)
-
- take_damage(damage)
+ take_damage(min(proj_damage, 100), Proj.damage_type, damage_flags = Proj.damage_flags)
/turf/simulated/wall/hitby(AM, var/datum/thrownthing/TT)
..()
@@ -136,7 +128,7 @@ var/global/list/wall_fullblend_objects = list(
var/tforce = O.throwforce * (TT.speed/THROWFORCE_SPEED_DIVISOR)
playsound(src, hitsound, tforce >= 15 ? 60 : 25, TRUE)
if(tforce > 0)
- take_damage(tforce)
+ take_damage(tforce, BRUTE)
/turf/simulated/wall/proc/clear_plants()
for(var/obj/effect/overlay/wallrot/WR in src)
@@ -155,10 +147,10 @@ var/global/list/wall_fullblend_objects = list(
/turf/simulated/wall/examine(mob/user)
. = ..()
- if(!damage)
+ if(!wall_damage)
to_chat(user, "It looks fully intact.")
else
- var/dam = damage / material.integrity
+ var/dam = wall_damage / material.integrity
if(dam <= 0.3)
to_chat(user, "It looks slightly damaged.")
else if(dam <= 0.6)
@@ -182,9 +174,11 @@ var/global/list/wall_fullblend_objects = list(
F.icon_state = "wall_thermite"
visible_message(SPAN_DANGER("\The [src] spontaneously combusts!"))
-/turf/simulated/wall/proc/take_damage(dam)
- if(dam)
- damage = max(0, damage + dam)
+/turf/simulated/wall/take_damage(damage, damage_type = BRUTE, def_zone, damage_flags = 0, used_weapon, armor_pen, silent = FALSE, override_droplimb, skip_update_health = FALSE)
+ if(reinf_material && (damage_type in reinf_material.wall_armor))
+ damage = round(damage / reinf_material.wall_armor[damage_type])
+ if(damage)
+ wall_damage = max(0, wall_damage + damage)
update_damage()
/turf/simulated/wall/proc/update_damage()
@@ -195,7 +189,7 @@ var/global/list/wall_fullblend_objects = list(
if(locate(/obj/effect/overlay/wallrot) in src)
cap = cap / 10
- if(damage >= cap)
+ if(wall_damage >= cap)
dismantle_wall(1)
else
update_icon()
@@ -209,7 +203,7 @@ var/global/list/wall_fullblend_objects = list(
/turf/simulated/wall/adjacent_fire_act(turf/adj_turf, datum/gas_mixture/adj_air, adj_temp, adj_volume)
burn(adj_temp)
if(adj_temp > material.melting_point)
- take_damage(log(RAND_F(0.9, 1.1) * (adj_temp - material.melting_point)))
+ take_damage(log(RAND_F(0.9, 1.1) * (adj_temp - material.melting_point)), BURN)
return ..()
/turf/simulated/wall/proc/dismantle_wall(var/devastated, var/explode, var/no_product)
@@ -242,11 +236,11 @@ var/global/list/wall_fullblend_objects = list(
dismantle_wall(1,1,1)
else if(severity == 2)
if(prob(75))
- take_damage(rand(150, 250))
+ take_damage(rand(150, 250), BRUTE)
else
dismantle_wall(1,1)
else if(severity == 3)
- take_damage(rand(0, 250))
+ take_damage(rand(0, 250), BRUTE)
// Wall-rot effect, a nasty fungus that destroys walls.
/turf/simulated/wall/proc/rot()
diff --git a/code/game/turfs/turf_changing.dm b/code/game/turfs/turf_changing.dm
index 6cab56ac2889..9718dc261cb3 100644
--- a/code/game/turfs/turf_changing.dm
+++ b/code/game/turfs/turf_changing.dm
@@ -203,7 +203,7 @@
floor_type = other.floor_type
construction_stage = other.construction_stage
- damage = other.damage
+ wall_damage = other.wall_damage
// Do not set directly to other.can_open since it may be in the WALL_OPENING state.
if(other.can_open)
diff --git a/code/game/world_topic_commands.dm b/code/game/world_topic_commands.dm
index b0cb23613b49..ec6714bb2b35 100644
--- a/code/game/world_topic_commands.dm
+++ b/code/game/world_topic_commands.dm
@@ -275,12 +275,12 @@ var/global/list/decl/topic_command/topic_commands = list()
if(isliving(M))
var/mob/living/L = M
info["damage"] = list2params(list(
- oxy = L.getOxyLoss(),
- tox = L.getToxLoss(),
- fire = L.getFireLoss(),
- brute = L.getBruteLoss(),
- clone = L.getCloneLoss(),
- brain = L.getBrainLoss()
+ oxy = L.get_damage(OXY),
+ tox = L.get_damage(TOX),
+ fire = L.get_damage(BURN),
+ brute = L.get_damage(BRUTE),
+ clone = L.get_damage(CLONE),
+ brain = L.get_brain_damage()
))
if(ishuman(M))
var/mob/living/carbon/human/H = M
diff --git a/code/modules/ZAS/Airflow.dm b/code/modules/ZAS/Airflow.dm
index 25b60d627e8a..b9d41159bc40 100644
--- a/code/modules/ZAS/Airflow.dm
+++ b/code/modules/ZAS/Airflow.dm
@@ -143,11 +143,9 @@ Contains helper procs for airflow, called by /connection_group.
bloody_body(src)
var/b_loss = min(airflow_speed, (airborne_acceleration*2)) * vsc.airflow_damage
- apply_damage(b_loss/3, BRUTE, BP_HEAD, used_weapon = "Airflow")
-
- apply_damage(b_loss/3, BRUTE, BP_CHEST, used_weapon = "Airflow")
-
- apply_damage(b_loss/3, BRUTE, BP_GROIN, used_weapon = "Airflow")
+ take_damage(b_loss/3, BRUTE, BP_HEAD, used_weapon = "Airflow")
+ take_damage(b_loss/3, BRUTE, BP_CHEST, used_weapon = "Airflow")
+ take_damage(b_loss/3, BRUTE, BP_GROIN, used_weapon = "Airflow")
if(airflow_speed > 10)
SET_STATUS_MAX(src, STAT_PARA, round(airflow_speed * vsc.airflow_stun))
diff --git a/code/modules/ZAS/Contaminants.dm b/code/modules/ZAS/Contaminants.dm
index 362f59c1fef2..a74d4166f465 100644
--- a/code/modules/ZAS/Contaminants.dm
+++ b/code/modules/ZAS/Contaminants.dm
@@ -78,9 +78,9 @@ var/global/image/contamination_overlay = image('icons/effects/contamination.dmi'
//Burn skin if exposed.
if(vsc.contaminant_control.SKIN_BURNS)
if(!contaminant_head_protected() || !contaminant_suit_protected())
+ take_damage(0.75, BURN)
if(prob(20))
to_chat(src, "Your skin burns!")
- take_overall_damage(0, 0.75)
//Burn eyes if exposed.
if(vsc.contaminant_control.EYE_BURNS)
@@ -105,9 +105,9 @@ var/global/image/contamination_overlay = image('icons/effects/contamination.dmi'
var/obj/item/organ/internal/eyes/E = get_organ(BP_EYES, /obj/item/organ/internal/eyes)
if(E && !E.bodytype.eye_contaminant_guard)
if(prob(20)) to_chat(src, "Your eyes burn!")
- E.damage += 2.5
+ E.organ_damage += 2.5
SET_STATUS_MAX(src, STAT_BLURRY, 50)
- if (prob(max(0,E.damage - 15) + 1) && !GET_STATUS(src, STAT_BLIND))
+ if (prob(max(0,E.organ_damage - 15) + 1) && !GET_STATUS(src, STAT_BLIND))
to_chat(src, "You are blinded!")
SET_STATUS_MAX(src, STAT_BLIND, 20)
diff --git a/code/modules/ZAS/Fire.dm b/code/modules/ZAS/Fire.dm
index ab9bba784855..9826bc2e5168 100644
--- a/code/modules/ZAS/Fire.dm
+++ b/code/modules/ZAS/Fire.dm
@@ -339,7 +339,7 @@ If it gains pressure too slowly, it may leak or just rupture instead of explodin
/mob/living/proc/FireBurn(var/firelevel, var/last_temperature, var/pressure)
var/mx = 5 * firelevel/vsc.fire_firelevel_multiplier * min(pressure / ONE_ATMOSPHERE, 1)
- apply_damage(2.5*mx, BURN)
+ take_damage(2.5*mx, BURN)
return mx
@@ -376,13 +376,13 @@ If it gains pressure too slowly, it may leak or just rupture instead of explodin
//Always check these damage procs first if fire damage isn't working. They're probably what's wrong.
- apply_damage(0.9*mx*head_exposure, BURN, BP_HEAD, used_weapon = "Fire")
- apply_damage(2.5*mx*chest_exposure, BURN, BP_CHEST, used_weapon = "Fire")
- apply_damage(2.0*mx*groin_exposure, BURN, BP_GROIN, used_weapon = "Fire")
- apply_damage(0.6*mx*legs_exposure, BURN, BP_L_LEG, used_weapon = "Fire")
- apply_damage(0.6*mx*legs_exposure, BURN, BP_R_LEG, used_weapon = "Fire")
- apply_damage(0.4*mx*arms_exposure, BURN, BP_L_ARM, used_weapon = "Fire")
- apply_damage(0.4*mx*arms_exposure, BURN, BP_R_ARM, used_weapon = "Fire")
+ take_damage(0.9*mx*head_exposure, BURN, BP_HEAD, used_weapon = "Fire")
+ take_damage(2.5*mx*chest_exposure, BURN, BP_CHEST, used_weapon = "Fire")
+ take_damage(2.0*mx*groin_exposure, BURN, BP_GROIN, used_weapon = "Fire")
+ take_damage(0.6*mx*legs_exposure, BURN, BP_L_LEG, used_weapon = "Fire")
+ take_damage(0.6*mx*legs_exposure, BURN, BP_R_LEG, used_weapon = "Fire")
+ take_damage(0.4*mx*arms_exposure, BURN, BP_L_ARM, used_weapon = "Fire")
+ take_damage(0.4*mx*arms_exposure, BURN, BP_R_ARM, used_weapon = "Fire")
//return a truthy value of whether burning actually happened
return mx * (head_exposure + chest_exposure + groin_exposure + legs_exposure + arms_exposure)
diff --git a/code/modules/admin/topic.dm b/code/modules/admin/topic.dm
index e2e0a2f356b1..3bbca38755e7 100644
--- a/code/modules/admin/topic.dm
+++ b/code/modules/admin/topic.dm
@@ -932,7 +932,7 @@
if (1) status = "Unconscious"
if (2) status = "Dead"
health_description = "Status = [status]"
- health_description += "
Oxy: [L.getOxyLoss()] - Tox: [L.getToxLoss()] - Fire: [L.getFireLoss()] - Brute: [L.getBruteLoss()] - Clone: [L.getCloneLoss()] - Brain: [L.getBrainLoss()]"
+ health_description += "
Oxy: [L.get_damage(OXY)] - Tox: [L.get_damage(TOX)] - Fire: [L.get_damage(BURN)] - Brute: [L.get_damage(BRUTE)] - Clone: [L.get_damage(CLONE)] - Brain: [L.get_brain_damage()]"
else
health_description = "This mob type has no health to speak of."
@@ -1001,7 +1001,7 @@
if(M.current_health == 1)
M.gib()
else
- M.adjustBruteLoss(min(99, M.current_health - 1))
+ M.take_damage(min(99, (M.current_health-1)), BRUTE)
SET_STATUS_MAX(M, STAT_STUN, 20)
SET_STATUS_MAX(M, STAT_WEAK, 20)
M.set_status(STAT_STUTTER, 20)
diff --git a/code/modules/admin/view_variables/helpers.dm b/code/modules/admin/view_variables/helpers.dm
index 8e3350b04079..74ff678c557e 100644
--- a/code/modules/admin/view_variables/helpers.dm
+++ b/code/modules/admin/view_variables/helpers.dm
@@ -15,19 +15,20 @@
"}
/mob/living/get_view_variables_header()
- return {"
- [src]
-
<< [dir2text(dir)] >>
-
[ckey ? ckey : "No ckey"] / [real_name ? real_name : "No real name"]
-
- BRUTE:[getBruteLoss()]
- FIRE:[getFireLoss()]
- TOXIN:[getToxLoss()]
- OXY:[getOxyLoss()]
- CLONE:[getCloneLoss()]
- BRAIN:[getBrainLoss()]
-
- "}
+ . = list(
+ "[src]",
+ "
<< [dir2text(dir)] >>",
+ "
[ckey ? ckey : "No ckey"] / [real_name ? real_name : "No real name"]"
+ )
+
+ var/list/damage_strings = list()
+ for(var/damage_type in _damage_values)
+ var/decl/damage_handler/damage_type_data = resolve_damage_handler(damage_type)
+ if(!damage_type_data?.allow_modification_in_vv)
+ continue
+ damage_strings += "[uppertext(damage_type_data.name)]:[get_damage(damage_type)]"
+ . = "[jointext(., "
")]
[jointext(damage_strings, " ")]"
+
// Same for these as for get_view_variables_header() above
/datum/proc/get_view_variables_options()
diff --git a/code/modules/admin/view_variables/topic.dm b/code/modules/admin/view_variables/topic.dm
index 9b7f36146fbe..7245a7520f9f 100644
--- a/code/modules/admin/view_variables/topic.dm
+++ b/code/modules/admin/view_variables/topic.dm
@@ -569,37 +569,21 @@
else if(href_list["adjustDamage"] && href_list["mobToDamage"])
if(!check_rights(R_DEBUG|R_ADMIN|R_FUN)) return
- var/mob/living/L = locate(href_list["mobToDamage"])
- if(!istype(L)) return
+ var/mob/living/target = locate(href_list["mobToDamage"])
+ if(!istype(target)) return
- var/Text = href_list["adjustDamage"]
-
- var/amount = input("Deal how much damage to mob? (Negative values here heal)","Adjust [Text]loss",0) as num
+ var/decl/damage_handler/damage_type_data = locate(href_list["adjustDamage"])
+ if(!istype(damage_type_data))
+ return
- if(!L)
+ var/amount = input("Deal how much damage to mob? (Negative values here heal)","Adjust [capitalize(damage_type_data.name)] Damage",0) as num
+ if(!target)
to_chat(usr, "Mob doesn't exist anymore")
return
-
- switch(Text)
- if(BRUTE)
- L.adjustBruteLoss(amount)
- if(BURN)
- L.adjustFireLoss(amount)
- if(TOX)
- L.adjustToxLoss(amount)
- if(OXY)
- L.adjustOxyLoss(amount)
- if(BP_BRAIN)
- L.adjustBrainLoss(amount)
- if(CLONE)
- L.adjustCloneLoss(amount)
- else
- to_chat(usr, "You caused an error. DEBUG: Text:[Text] Mob:[L]")
- return
-
if(amount != 0)
- log_admin("[key_name(usr)] dealt [amount] amount of [Text] damage to [L]")
- message_admins("[key_name(usr)] dealt [amount] amount of [Text] damage to [L]")
+ target.take_damage(amount, damage_type_data.type)
+ log_admin("[key_name(usr)] dealt [amount] amount of [damage_type_data.name] damage to [target]")
+ message_admins("[key_name(usr)] dealt [amount] amount of [damage_type_data.name] damage to [target]")
href_list["datumrefresh"] = href_list["mobToDamage"]
else if(href_list["call_proc"])
diff --git a/code/modules/assembly/mousetrap.dm b/code/modules/assembly/mousetrap.dm
index dca5cfcd0a3a..2fbbfcc02934 100644
--- a/code/modules/assembly/mousetrap.dm
+++ b/code/modules/assembly/mousetrap.dm
@@ -41,7 +41,7 @@
affecting = GET_EXTERNAL_ORGAN(H, type)
SET_STATUS_MAX(H, STAT_STUN, 3)
if(affecting)
- affecting.take_external_damage(1, 0)
+ affecting.take_damage(1, BRUTE)
else if(ismouse(target))
var/mob/living/simple_animal/mouse/M = target
diff --git a/code/modules/atmospherics/he_pipes.dm b/code/modules/atmospherics/he_pipes.dm
index cedb053c260a..212f350d0595 100644
--- a/code/modules/atmospherics/he_pipes.dm
+++ b/code/modules/atmospherics/he_pipes.dm
@@ -82,7 +82,7 @@
heat_limit = H.get_mob_temperature_threshold(HEAT_LEVEL_3)
if(pipe_air.temperature > heat_limit + 1)
- buckled_mob.apply_damage(4 * log(pipe_air.temperature - heat_limit), BURN, BP_CHEST, used_weapon = "Excessive Heat")
+ buckled_mob.take_damage(4 * log(pipe_air.temperature - heat_limit), BURN, BP_CHEST, used_weapon = "Excessive Heat")
//fancy radiation glowing
if(pipe_air.temperature && (icon_temperature > 500 || pipe_air.temperature > 500)) //start glowing at 500K
diff --git a/code/modules/blob/blob.dm b/code/modules/blob/blob.dm
index 24c98a418595..72cd1ea3cbd2 100644
--- a/code/modules/blob/blob.dm
+++ b/code/modules/blob/blob.dm
@@ -15,9 +15,20 @@
max_health = 30
var/regen_rate = 5
- var/brute_resist = 4.3
- var/fire_resist = 0.8
- var/laser_resist = 2 // Special resist for laser based weapons - Emitters or handheld energy weaponry. Damage is divided by this and THEN by fire_resist.
+
+ // TODO: make blobs use either damage handlers or an armour extension (or both?).
+ var/list/blob_damage_resistance = list(
+ ARMOR_BULLET = 4.3,
+ ARMOR_BOMB = 4.3,
+ ARMOR_MELEE = 4.3,
+ ARMOR_LASER = 2,
+ ARMOR_ENERGY = 0.8
+ )
+ var/static/list/blob_damage_immunity = list(
+ ARMOR_RAD,
+ ARMOR_BIO
+ )
+
var/expandType = /obj/effect/blob
var/secondary_core_growth_chance = 5 //% chance to grow a secondary blob core instead of whatever was suposed to grown. Secondary cores are considerably weaker, but still nasty.
var/damage_min = 15
@@ -42,7 +53,7 @@
/obj/effect/blob/explosion_act(var/severity)
SHOULD_CALL_PARENT(FALSE)
- take_damage(rand(140 - (severity * 40), 140 - (severity * 20)) / brute_resist)
+ take_damage(rand(140 - (severity * 40), 140 - (severity * 20)), BRUTE)
/obj/effect/blob/on_update_icon()
if(health > max_health / 2)
@@ -56,7 +67,19 @@
return
attempt_attack(global.alldirs)
-/obj/effect/blob/proc/take_damage(var/damage)
+/obj/effect/blob/take_damage(damage, damage_type = BRUTE, def_zone, damage_flags = 0, used_weapon, armor_pen, silent = FALSE, override_droplimb, skip_update_health = FALSE)
+
+ var/decl/damage_handler/damage_type_data = GET_DECL(damage_type)
+ var/armor_key = damage_type_data?.get_armor_key(damage_flags)
+ if(armor_key in blob_damage_immunity)
+ return FALSE
+
+ if(armor_key in blob_damage_resistance)
+ damage = round(damage / blob_damage_resistance[armor_key])
+
+ if(damage <= 0)
+ return FALSE
+
health -= damage
if(health < 0)
playsound(loc, 'sound/effects/splat.ogg', 50, 1)
@@ -73,7 +96,7 @@
return
if(istype(T, /turf/simulated/wall))
var/turf/simulated/wall/SW = T
- SW.take_damage(80)
+ SW.take_damage(80, BRUTE)
return
var/obj/structure/girder/G = locate() in T
if(G)
@@ -107,7 +130,7 @@
return
var/obj/machinery/camera/CA = locate() in T
if(CA)
- CA.take_damage(30)
+ CA.take_damage(30, BRUTE)
return
// Above things, we destroy completely and thus can use locate. Mobs are different.
@@ -137,10 +160,9 @@
/obj/effect/blob/proc/attack_living(var/mob/L)
if(!L)
return
- var/blob_damage = pick(BRUTE, BURN)
L.visible_message(SPAN_DANGER("A tendril flies out from \the [src] and smashes into \the [L]!"), SPAN_DANGER("A tendril flies out from \the [src] and smashes into you!"))
playsound(loc, 'sound/effects/attackblob.ogg', 50, 1)
- L.apply_damage(rand(damage_min, damage_max), blob_damage, used_weapon = "blob tendril")
+ L.take_damage(rand(damage_min, damage_max), pick(BRUTE, BURN), used_weapon = "blob tendril")
/obj/effect/blob/proc/attempt_attack(var/list/dirs)
var/attackDir = pick(dirs)
@@ -150,17 +172,6 @@
continue
attack_living(victim)
-/obj/effect/blob/bullet_act(var/obj/item/projectile/Proj)
- if(!Proj)
- return
-
- switch(Proj.damage_type)
- if(BRUTE)
- take_damage(Proj.damage / brute_resist)
- if(BURN)
- take_damage((Proj.damage / laser_resist) / fire_resist)
- return 0
-
/obj/effect/blob/attackby(var/obj/item/W, var/mob/user)
user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN)
user.do_attack_animation(src)
@@ -179,17 +190,9 @@
to_chat(user, SPAN_WARNING("\The [src] has already been pruned."))
return
- var/damage = 0
- switch(W.damtype)
- if(BURN)
- damage = (W.force / fire_resist)
- if(IS_WELDER(W))
- playsound(loc, 'sound/items/Welder.ogg', 100, 1)
- if(BRUTE)
- damage = (W.force / brute_resist)
-
- take_damage(damage)
- return
+ take_damage(W.force, W.damtype)
+ if(IS_WELDER(W) && W.damtype == BURN)
+ playsound(loc, 'sound/items/Welder.ogg', 100, 1)
/obj/effect/blob/core
name = "master nucleus"
@@ -219,28 +222,36 @@ regen() will cover update_icon() for this proc
/obj/effect/blob/core/proc/process_core_health()
switch(get_health_percent())
if(75 to INFINITY)
- brute_resist = 3.5
- fire_resist = 2
+ blob_damage_resistance[ARMOR_BULLET] = 3.5
+ blob_damage_resistance[ARMOR_MELEE] = 3.5
+ blob_damage_resistance[ARMOR_BOMB] = 3.5
+ blob_damage_resistance[ARMOR_ENERGY] = 2
attack_freq = 5
regen_rate = 2
times_to_pulse = 4
if(reported_low_damage)
report_shield_status("high")
if(50 to 74)
- brute_resist = 2.5
- fire_resist = 1.5
+ blob_damage_resistance[ARMOR_BULLET] = 2.5
+ blob_damage_resistance[ARMOR_MELEE] = 2.5
+ blob_damage_resistance[ARMOR_BOMB] = 2.5
+ blob_damage_resistance[ARMOR_ENERGY] = 1.5
attack_freq = 4
regen_rate = 3
times_to_pulse = 3
if(34 to 49)
- brute_resist = 1
- fire_resist = 0.8
+ blob_damage_resistance[ARMOR_BULLET] = 1
+ blob_damage_resistance[ARMOR_MELEE] = 1
+ blob_damage_resistance[ARMOR_BOMB] = 1
+ blob_damage_resistance[ARMOR_ENERGY] = 0.8
attack_freq = 3
regen_rate = 4
times_to_pulse = 2
if(-INFINITY to 33)
- brute_resist = 0.5
- fire_resist = 0.3
+ blob_damage_resistance[ARMOR_BULLET] = 0.5
+ blob_damage_resistance[ARMOR_MELEE] = 0.5
+ blob_damage_resistance[ARMOR_BOMB] = 0.5
+ blob_damage_resistance[ARMOR_ENERGY] = 0.3
regen_rate = 5
times_to_pulse = 1
if(!reported_low_damage)
diff --git a/code/modules/butchery/butchery.dm b/code/modules/butchery/butchery.dm
index b06d0ed83c54..bbdd57fc5991 100644
--- a/code/modules/butchery/butchery.dm
+++ b/code/modules/butchery/butchery.dm
@@ -134,7 +134,7 @@
if(secures_occupant)
user.visible_message(SPAN_DANGER("\The [user] impales \the [target] on \the [src]!"))
- target.adjustBruteLoss(rand(30, 45))
+ target.take_damage(rand(30, 45), BRUTE)
else
user.visible_message(SPAN_DANGER("\The [user] hangs \the [target] from \the [src]!"))
@@ -176,7 +176,7 @@
/obj/structure/kitchenspike/proc/set_carcass_state(var/_state)
occupant_state = _state
if(occupant)
- occupant.adjustBruteLoss(rand(50,60))
+ occupant.take_damage(rand(50,60), BRUTE)
if(occupant.stat != DEAD)
occupant.death()
if(QDELETED(occupant))
@@ -197,7 +197,7 @@
var/mob/living/last_occupant = occupant
user.visible_message(SPAN_NOTICE("\The [user] begins [butchery_string] \the [occupant]."))
- occupant.adjustBruteLoss(rand(50,60))
+ occupant.take_damage(rand(50,60), BRUTE)
update_icon()
if(do_after(user, 3 SECONDS, src) && !QDELETED(user) && !QDELETED(last_occupant) && occupant == last_occupant && occupant_state == last_state)
diff --git a/code/modules/clothing/shoes/_shoes.dm b/code/modules/clothing/shoes/_shoes.dm
index 1e59942aa10c..1fcdf6092a7a 100644
--- a/code/modules/clothing/shoes/_shoes.dm
+++ b/code/modules/clothing/shoes/_shoes.dm
@@ -151,7 +151,7 @@
/obj/item/clothing/shoes/proc/handle_movement(var/turf/walking, var/running)
if (attached_cuffs && running)
- attached_cuffs.take_damage(1, armor_pen = 100)
+ attached_cuffs.take_damage(1, BRUTE, armor_pen = 100)
if(QDELETED(attached_cuffs))
verbs -= /obj/item/clothing/shoes/proc/remove_cuffs
attached_cuffs = null
diff --git a/code/modules/clothing/spacesuits/breaches.dm b/code/modules/clothing/spacesuits/breaches.dm
index fcab77cc951b..8378a7a1abe4 100644
--- a/code/modules/clothing/spacesuits/breaches.dm
+++ b/code/modules/clothing/spacesuits/breaches.dm
@@ -5,7 +5,7 @@
/datum/breach
var/class = 0 // Size. Lower is smaller. Uses floating point values!
var/descriptor // 'gaping hole' etc.
- var/damtype = BURN // Punctured or melted
+ var/damtype = BURN // Punctured or melted
var/patched = FALSE
var/obj/item/clothing/suit/space/holder // Suit containing the list of breaches holding this instance.
var/static/list/breach_brute_descriptors = list(
diff --git a/code/modules/codex/categories/category_substances.dm b/code/modules/codex/categories/category_substances.dm
index a30a0d1fc04f..13e94f2d72a9 100644
--- a/code/modules/codex/categories/category_substances.dm
+++ b/code/modules/codex/categories/category_substances.dm
@@ -110,16 +110,18 @@
material_info += ""
material_info += "As a building or crafting material, it has the following properties:
"
- if(mat.brute_armor < 2)
+ var/brute_armor = mat.wall_armor[BRUTE]
+ if(brute_armor < 2)
material_info += "- It is weak to physical impacts.
"
- else if(mat.brute_armor > 2)
- material_info += "- It is [mat.brute_armor > 4 ? "very " : null]resistant to physical impacts.
"
+ else if(brute_armor > 2)
+ material_info += "- It is [brute_armor > 4 ? "very " : null]resistant to physical impacts.
"
else
material_info += "- It has average resistance to physical impacts.
"
- if(mat.burn_armor < 2)
+ var/burn_armor = mat.wall_armor[BURN]
+ if(burn_armor < 2)
material_info += "- It is weak to applied energy.
"
- else if(mat.burn_armor > 2)
- material_info += "- It is [mat.burn_armor > 4 ? "very " : null]resistant to applied energy.
"
+ else if(burn_armor > 2)
+ material_info += "- It is [burn_armor > 4 ? "very " : null]resistant to applied energy.
"
else
material_info += "- It has average resistance to applied energy.
"
if(mat.conductive)
diff --git a/code/modules/events/camera_damage.dm b/code/modules/events/camera_damage.dm
index da971e4b0602..c7243e71c613 100644
--- a/code/modules/events/camera_damage.dm
+++ b/code/modules/events/camera_damage.dm
@@ -15,7 +15,7 @@
for(var/obj/machinery/camera/cam in range(severity_range,C))
if(is_valid_camera(cam))
if(prob(2*severity))
- cam.take_damage(100, ELECTROCUTE, TRUE)
+ cam.take_damage(100, ELECTROCUTE, silent = TRUE)
else
if(!cam.wires.IsIndexCut(CAMERA_WIRE_POWER))
cam.wires.CutWireIndex(CAMERA_WIRE_POWER)
diff --git a/code/modules/events/computer_damage.dm b/code/modules/events/computer_damage.dm
index 9cf56ce1e7c9..8a1f4a4ee90a 100644
--- a/code/modules/events/computer_damage.dm
+++ b/code/modules/events/computer_damage.dm
@@ -17,4 +17,4 @@
if(prob(50))
victim.visible_message("[victim] emits some ominous clicks.")
var/obj/item/stock_parts/computer/hard_drive/HDD = victim.get_component_of_type(/obj/item/stock_parts/computer/hard_drive)
- HDD.take_damage(0.5 * HDD.health)
+ HDD.take_damage(0.5 * HDD.health, BRUTE)
diff --git a/code/modules/events/electrical_storm.dm b/code/modules/events/electrical_storm.dm
index 33914e601f4d..6e221ad2491e 100644
--- a/code/modules/events/electrical_storm.dm
+++ b/code/modules/events/electrical_storm.dm
@@ -79,7 +79,7 @@
if(length(shields))
var/obj/machinery/shield_generator/shield_gen = pick(shields)
//Minor breaches aren't enough to let through frying amounts of power
- if(shield_gen.take_shield_damage(30 * severity, SHIELD_DAMTYPE_EM) <= SHIELD_BREACHED_MINOR)
+ if(shield_gen.take_damage(30 * severity, ELECTROCUTE) <= SHIELD_BREACHED_MINOR)
shielded = TRUE
valid_apcs = list()
diff --git a/code/modules/events/solar_storm.dm b/code/modules/events/solar_storm.dm
index e57c8687fba5..287b0a749d55 100644
--- a/code/modules/events/solar_storm.dm
+++ b/code/modules/events/solar_storm.dm
@@ -44,7 +44,7 @@
if(L.increaseBodyTemp(temp_incr))
continue
- L.adjustFireLoss(fire_loss)
+ L.take_damage(fire_loss, BURN)
/datum/event/solar_storm/end()
diff --git a/code/modules/holodeck/HolodeckObjects.dm b/code/modules/holodeck/HolodeckObjects.dm
index 3ef581d0c4d0..32fda080c2ad 100644
--- a/code/modules/holodeck/HolodeckObjects.dm
+++ b/code/modules/holodeck/HolodeckObjects.dm
@@ -183,8 +183,7 @@
var/aforce = I.force
playsound(src.loc, 'sound/effects/Glasshit.ogg', 75, 1)
visible_message("\The [src] was hit by \the [I].")
- if(I.damtype == BRUTE || I.damtype == BURN)
- take_damage(aforce)
+ take_damage(aforce, I.damtype)
return
src.add_fingerprint(user)
diff --git a/code/modules/hydroponics/seed.dm b/code/modules/hydroponics/seed.dm
index c3b8e5833195..c09b2cb97c2a 100644
--- a/code/modules/hydroponics/seed.dm
+++ b/code/modules/hydroponics/seed.dm
@@ -167,7 +167,7 @@
has_edge = prob(get_trait(TRAIT_POTENCY)/5)
var/damage_flags = DAM_SHARP|(has_edge? DAM_EDGE : 0)
- target.apply_damage(damage, BRUTE, target_limb, damage_flags, used_weapon = "Thorns")
+ target.take_damage(damage, BRUTE, target_limb, damage_flags, used_weapon = "Thorns")
// Adds reagents to a target.
/datum/seed/proc/do_sting(var/mob/living/carbon/human/target, var/obj/item/fruit)
diff --git a/code/modules/integrated_electronics/core/assemblies.dm b/code/modules/integrated_electronics/core/assemblies.dm
index 70bf4641b9eb..3f5bc8992996 100644
--- a/code/modules/integrated_electronics/core/assemblies.dm
+++ b/code/modules/integrated_electronics/core/assemblies.dm
@@ -485,7 +485,7 @@
interact(user)
/obj/item/electronic_assembly/bullet_act(var/obj/item/projectile/P)
- take_damage(P.damage)
+ take_damage(P.damage, P.damage_type, damage_flags = P.damage_flags)
/obj/item/electronic_assembly/emp_act(severity)
. = ..()
diff --git a/code/modules/integrated_electronics/subtypes/input.dm b/code/modules/integrated_electronics/subtypes/input.dm
index 14bcd356cdad..e4f84bb1629c 100644
--- a/code/modules/integrated_electronics/subtypes/input.dm
+++ b/code/modules/integrated_electronics/subtypes/input.dm
@@ -201,15 +201,15 @@
var/obj/item/organ/internal/brain = GET_INTERNAL_ORGAN(H, BP_BRAIN)
set_pin_data(IC_OUTPUT, 1, (brain && H.stat != DEAD))
set_pin_data(IC_OUTPUT, 2, (H.stat == CONSCIOUS))
- set_pin_data(IC_OUTPUT, 3, damage_to_severity(100 * H.getBruteLoss() / current_max_health))
- set_pin_data(IC_OUTPUT, 4, damage_to_severity(100 * H.getFireLoss() / current_max_health))
- set_pin_data(IC_OUTPUT, 5, damage_to_severity(100 * H.getToxLoss() / current_max_health))
- set_pin_data(IC_OUTPUT, 6, damage_to_severity(100 * H.getOxyLoss() / current_max_health))
- set_pin_data(IC_OUTPUT, 7, damage_to_severity(100 * H.getCloneLoss() / current_max_health))
+ set_pin_data(IC_OUTPUT, 3, damage_to_severity(100 * H.get_damage(BRUTE) / current_max_health))
+ set_pin_data(IC_OUTPUT, 4, damage_to_severity(100 * H.get_damage(BURN) / current_max_health))
+ set_pin_data(IC_OUTPUT, 5, damage_to_severity(100 * H.get_damage(TOX) / current_max_health))
+ set_pin_data(IC_OUTPUT, 6, damage_to_severity(100 * H.get_damage(OXY) / current_max_health))
+ set_pin_data(IC_OUTPUT, 7, damage_to_severity(100 * H.get_damage(CLONE) / current_max_health))
set_pin_data(IC_OUTPUT, 8, H.get_pulse_as_number())
set_pin_data(IC_OUTPUT, 9, H.get_blood_oxygenation())
set_pin_data(IC_OUTPUT, 10, damage_to_severity(H.get_shock()))
- set_pin_data(IC_OUTPUT, 11, H.radiation)
+ set_pin_data(IC_OUTPUT, 11, H.get_damage(IRRADIATE))
push_data()
activate_pin(2)
diff --git a/code/modules/materials/_materials.dm b/code/modules/materials/_materials.dm
index 34b1cba8ea7f..fcac9e7fec7b 100644
--- a/code/modules/materials/_materials.dm
+++ b/code/modules/materials/_materials.dm
@@ -161,6 +161,12 @@ INITIALIZE_IMMEDIATE(/obj/effect/gas_overlay)
/// Point at which the fluid will proc turf interaction logic. Workaround for mops being ruined forever by 1u of anything else being added.
var/turf_touch_threshold = FLUID_QDEL_POINT
+ /// Damage to a wall is divided by this value if the wall is reinforced by this material.
+ var/list/wall_armor = list(
+ BRUTE = 2,
+ BURN = 2
+ )
+
// Damage values.
var/hardness = MAT_VALUE_HARD // Used for edge damage in weapons.
var/reflectiveness = MAT_VALUE_DULL
@@ -322,8 +328,6 @@ INITIALIZE_IMMEDIATE(/obj/effect/gas_overlay)
adjective_name ||= use_name
if(!shard_icon)
shard_icon = shard_type
- if(!burn_armor)
- burn_armor = brute_armor
if(!gas_symbol)
gas_symbol = "[name]_[sequential_id(abstract_type)]"
if(!gas_symbol_html)
@@ -666,30 +670,30 @@ INITIALIZE_IMMEDIATE(/obj/effect/gas_overlay)
return
if(radioactivity)
- M.apply_damage(radioactivity * removed, IRRADIATE, armor_pen = 100)
+ M.take_damage(radioactivity * removed, IRRADIATE, armor_pen = 100)
if(toxicity)
M.add_chemical_effect(CE_TOXIN, toxicity)
var/dam = (toxicity * removed)
if(toxicity_targets_organ && ishuman(M))
- var/organ_damage = dam * M.get_toxin_resistance()
+ var/organ_damage = dam * M.get_damage_modifier(TOX)
if(organ_damage > 0)
var/mob/living/carbon/human/H = M
var/obj/item/organ/internal/I = GET_INTERNAL_ORGAN(H, toxicity_targets_organ)
if(I)
- var/can_damage = I.max_damage - I.damage
+ var/can_damage = I.max_damage - I.organ_damage
if(can_damage > 0)
if(organ_damage > can_damage)
- I.take_internal_damage(can_damage, silent=TRUE)
+ I.take_damage(can_damage, silent=TRUE)
dam -= can_damage
else
- I.take_internal_damage(organ_damage, silent=TRUE)
+ I.take_damage(organ_damage, TOX, silent=TRUE)
dam = 0
if(dam > 0)
- M.adjustToxLoss(toxicity_targets_organ ? (dam * 0.75) : dam)
+ M.take_damage(toxicity_targets_organ ? (dam * 0.75) : dam, TOX)
if(solvent_power >= MAT_SOLVENT_STRONG)
- M.take_organ_damage(0, removed * solvent_power, override_droplimb = DISMEMBER_METHOD_ACID)
+ M.take_damage(0, removed * solvent_power, BURN, override_droplimb = DISMEMBER_METHOD_ACID)
if(narcosis)
if(prob(10))
@@ -714,7 +718,7 @@ INITIALIZE_IMMEDIATE(/obj/effect/gas_overlay)
return
if(radioactivity)
- M.apply_damage((radioactivity / 2) * removed, IRRADIATE)
+ M.take_damage((radioactivity / 2) * removed, IRRADIATE)
if(dirtiness <= DIRTINESS_STERILE)
if(M.germ_level < INFECTION_LEVEL_TWO) // rest and antibiotics is required to cure serious infections
@@ -755,7 +759,7 @@ INITIALIZE_IMMEDIATE(/obj/effect/gas_overlay)
/decl/material/proc/affect_overdose(var/mob/living/M) // Overdose effect. Doesn't happen instantly.
M.add_chemical_effect(CE_TOXIN, 1)
- M.adjustToxLoss(REM)
+ M.take_damage(REM, TOX)
/decl/material/proc/initialize_data(var/newdata) // Called when the reagent is created.
if(newdata)
diff --git a/code/modules/materials/definitions/gasses/material_gas_mundane.dm b/code/modules/materials/definitions/gasses/material_gas_mundane.dm
index e00322da326c..af394c563b47 100644
--- a/code/modules/materials/definitions/gasses/material_gas_mundane.dm
+++ b/code/modules/materials/definitions/gasses/material_gas_mundane.dm
@@ -67,12 +67,12 @@
if(dosage >= 3)
warning_message = pick("extremely dizzy","short of breath","faint","confused")
warning_prob = 15
- M.adjustOxyLoss(10,20)
+ M.take_damage(rand(10,20), OXY)
if(istype(H))
H.co2_alert = 1
else if(dosage >= 1.5)
warning_message = pick("dizzy","short of breath","faint","momentarily confused")
- M.adjustOxyLoss(3,5)
+ M.take_damage(rand(3,5), OXY)
if(istype(H))
H.co2_alert = 1
else if(dosage >= 0.25)
diff --git a/code/modules/materials/definitions/liquids/materials_liquid_toxins.dm b/code/modules/materials/definitions/liquids/materials_liquid_toxins.dm
index 2d6705b82199..2efce510538f 100644
--- a/code/modules/materials/definitions/liquids/materials_liquid_toxins.dm
+++ b/code/modules/materials/definitions/liquids/materials_liquid_toxins.dm
@@ -125,7 +125,7 @@
if(H.stat != UNCONSCIOUS)
if(H.ticks_since_last_successful_breath >= 10)
H.ticks_since_last_successful_breath = max(10, H.ticks_since_last_successful_breath-10)
- H.adjustOxyLoss(2)
+ H.take_damage(2, OXY)
SET_STATUS_MAX(H, STAT_WEAK, 10)
M.add_chemical_effect(CE_NOPULSE, 1)
@@ -152,7 +152,7 @@
/decl/material/liquid/zombiepowder/affect_blood(var/mob/living/M, var/removed, var/datum/reagents/holder)
..()
M.status_flags |= FAKEDEATH
- M.adjustOxyLoss(3 * removed)
+ M.take_damage(3 * removed, OXY)
SET_STATUS_MAX(M, STAT_WEAK, 10)
SET_STATUS_MAX(M, STAT_SILENCE, 10)
if(LAZYACCESS(M.chem_doses, type) <= removed) //half-assed attempt to make timeofdeath update only at the onset
diff --git a/code/modules/materials/definitions/liquids/materials_liquid_water.dm b/code/modules/materials/definitions/liquids/materials_liquid_water.dm
index e68140e2883a..d8370e67109c 100644
--- a/code/modules/materials/definitions/liquids/materials_liquid_water.dm
+++ b/code/modules/materials/definitions/liquids/materials_liquid_water.dm
@@ -45,8 +45,8 @@
var/decl/special_role/godcult = GET_DECL(/decl/special_role/godcultist)
if(M.mind && godcult.is_antagonist(M.mind))
if(REAGENT_VOLUME(holder, type) > 5)
- M.adjustHalLoss(5, do_update_health = FALSE)
- M.adjustBruteLoss(1)
+ M.take_damage(5, PAIN, skip_update_health = TRUE)
+ M.take_damage(1, BRUTE)
if(prob(10)) //Only annoy them a /bit/
to_chat(M,"You feel your insides curdle and burn! \[Give Into Purity\]")
diff --git a/code/modules/materials/definitions/solids/materials_solid_alien.dm b/code/modules/materials/definitions/solids/materials_solid_alien.dm
index 97ff03bfe45f..8f894f46389a 100644
--- a/code/modules/materials/definitions/solids/materials_solid_alien.dm
+++ b/code/modules/materials/definitions/solids/materials_solid_alien.dm
@@ -18,8 +18,10 @@
wall_flags = PAINT_PAINTABLE
color = rgb(rand(10,150),rand(10,150),rand(10,150))
explosion_resistance = rand(25,40)
- brute_armor = rand(10,20)
- burn_armor = rand(10,20)
+ wall_armor = list(
+ BRUTE = rand(10,20),
+ BURN = rand(10,20)
+ )
hardness = rand(15,100)
reflectiveness = rand(15,100)
integrity = rand(200,400)
diff --git a/code/modules/materials/definitions/solids/materials_solid_gemstones.dm b/code/modules/materials/definitions/solids/materials_solid_gemstones.dm
index 2011742fb68f..1c4d64a99e1a 100644
--- a/code/modules/materials/definitions/solids/materials_solid_gemstones.dm
+++ b/code/modules/materials/definitions/solids/materials_solid_gemstones.dm
@@ -18,6 +18,11 @@
name = "diamond"
uid = "solid_diamond"
lore_text = "An extremely hard allotrope of carbon. Valued for its use in industrial tools."
+ // Diamond walls are immune to fire, therefore it makes sense for them to be almost undamageable by burn damage type.
+ wall_armor = list(
+ BRUTE = 10,
+ BURN = 50
+ )
melting_point = 4300
boiling_point = null
ignition_point = null
diff --git a/code/modules/materials/definitions/solids/materials_solid_glass.dm b/code/modules/materials/definitions/solids/materials_solid_glass.dm
index 23e3b3080507..67d2a87231cc 100644
--- a/code/modules/materials/definitions/solids/materials_solid_glass.dm
+++ b/code/modules/materials/definitions/solids/materials_solid_glass.dm
@@ -16,8 +16,10 @@
boiling_point = null
ignition_point = null
weight = MAT_VALUE_VERY_LIGHT
- brute_armor = 1
- burn_armor = 2
+ wall_armor = list(
+ BRUTE = 1,
+ BURN = 2
+ )
table_icon_base = "solid"
destruction_desc = "shatters"
hitsound = 'sound/effects/Glasshit.ogg'
@@ -40,8 +42,10 @@
hardness = MAT_VALUE_HARD
weight = MAT_VALUE_LIGHT
integrity = 70
- brute_armor = 2
- burn_armor = 5
+ wall_armor = list(
+ BRUTE = 2,
+ BURN = 5
+ )
melting_point = 4274
color = GLASS_COLOR_SILICATE
stack_origin_tech = @'{"materials":4}'
diff --git a/code/modules/materials/definitions/solids/materials_solid_metal.dm b/code/modules/materials/definitions/solids/materials_solid_metal.dm
index 8d247963b5ff..5522e1491dbb 100644
--- a/code/modules/materials/definitions/solids/materials_solid_metal.dm
+++ b/code/modules/materials/definitions/solids/materials_solid_metal.dm
@@ -105,7 +105,10 @@
melting_point = 1184
boiling_point = 2574
color = "#ccbc63"
- brute_armor = 3
+ wall_armor = list(
+ BRUTE = 3,
+ BURN = 3
+ )
hardness = MAT_VALUE_RIGID + 10
icon_base = 'icons/turf/walls/solid.dmi'
icon_reinf = 'icons/turf/walls/reinforced.dmi'
@@ -119,7 +122,10 @@
uid = "solid_black_bronze"
lore_text = "An alloy of copper and silver. Used in ancient ceremonial gear."
color = "#3f352a"
- brute_armor = 4
+ wall_armor = list(
+ BRUTE = 4,
+ BURN = 4
+ )
hardness = MAT_VALUE_HARD
reflectiveness = MAT_VALUE_MATTE
icon_base = 'icons/turf/walls/solid.dmi'
@@ -195,7 +201,10 @@
wall_support_value = MAT_VALUE_VERY_HEAVY // Ideal construction material.
hardness = MAT_VALUE_HARD
integrity = 150
- brute_armor = 5
+ wall_armor = list(
+ BRUTE = 5,
+ BURN = 5
+ )
icon_base = 'icons/turf/walls/solid.dmi'
icon_reinf = 'icons/turf/walls/reinforced.dmi'
wall_flags = PAINT_PAINTABLE|PAINT_STRIPABLE|WALL_HAS_EDGES
@@ -254,7 +263,10 @@
boiling_point = null
wall_support_value = MAT_VALUE_HEAVY
integrity = 175
- burn_armor = 10
+ wall_armor = list(
+ BRUTE = 2,
+ BURN = 10
+ )
color = "#a5a5a5"
icon_base = 'icons/turf/walls/solid.dmi'
icon_reinf = 'icons/turf/walls/reinforced.dmi'
@@ -314,8 +326,10 @@
use_reinf_state = null
color = "#a8a9b2"
explosion_resistance = 25
- brute_armor = 8
- burn_armor = 10
+ wall_armor = list(
+ BRUTE = 8,
+ BURN = 10
+ )
hardness = MAT_VALUE_VERY_HARD
stack_origin_tech = @'{"materials":2}'
hitsound = 'sound/weapons/smash.ogg'
@@ -336,8 +350,10 @@
name = "titanium"
uid = "solid_titanium"
lore_text = "A light, strong, corrosion-resistant metal. Perfect for cladding high-velocity ballistic supply pods."
- brute_armor = 10
- burn_armor = 8
+ wall_armor = list(
+ BRUTE = 10,
+ BURN = 8
+ )
integrity = 200
melting_point = 1944
boiling_point = 3474
@@ -374,8 +390,10 @@
wall_flags = PAINT_PAINTABLE|PAINT_STRIPABLE|WALL_HAS_EDGES
use_reinf_state = null
color = "#9bc6f2"
- brute_armor = 4
- burn_armor = 20
+ wall_armor = list(
+ BRUTE = 4,
+ BURN = 20
+ )
stack_origin_tech = @'{"materials":3}'
construction_difficulty = MAT_VALUE_VERY_HARD_DIY
value = 1.8
@@ -473,7 +491,10 @@
lore_text = "A heavy metal with near perfect reflectiveness. Used in stainless alloys."
color = "#dadada"
integrity = 200
- burn_armor = 15 // Strong against laser weaponry, but not as good as OCP.
+ wall_armor = list(
+ BRUTE = 2,
+ BURN = 15
+ )
melting_point = 2180
boiling_point = 2944
icon_base = 'icons/turf/walls/solid.dmi'
diff --git a/code/modules/materials/definitions/solids/materials_solid_organic.dm b/code/modules/materials/definitions/solids/materials_solid_organic.dm
index 0e3a7623b34f..c881e51cb1da 100644
--- a/code/modules/materials/definitions/solids/materials_solid_organic.dm
+++ b/code/modules/materials/definitions/solids/materials_solid_organic.dm
@@ -88,7 +88,10 @@
use_reinf_state = null
color = "#aaaaaa"
hardness = MAT_VALUE_SOFT
- brute_armor = 1
+ wall_armor = list(
+ BRUTE = 1,
+ BURN = 1
+ )
weight = MAT_VALUE_EXTREMELY_LIGHT - 5
ignition_point = T0C+232 //"the temperature at which book-paper catches fire, and burns." close enough
melting_point = T0C+232 //temperature at which cardboard walls would be destroyed
@@ -132,7 +135,6 @@
weight = MAT_VALUE_EXTREMELY_LIGHT - 9
construction_difficulty = MAT_VALUE_EASY_DIY
wall_flags = PAINT_PAINTABLE | PAINT_STRIPABLE | WALL_HAS_EDGES
- brute_armor = 0.5
ignition_point = T0C + 232 //"the temperature at which book-paper catches fire, and burns." close enough
melting_point = T0C + 232
conductive = FALSE
@@ -143,6 +145,10 @@
exoplanet_rarity_gas = MAT_RARITY_NOWHERE
sound_manipulate = 'sound/foley/paperpickup2.ogg'
sound_dropped = 'sound/foley/paperpickup1.ogg'
+ wall_armor = list(
+ BRUTE = 0.5,
+ BURN = 0.5
+ )
/decl/material/solid/organic/paper/generate_recipes(stack_type, reinforce_material)
. = ..()
@@ -159,7 +165,10 @@
ignition_point = T0C+232
melting_point = T0C+300
flags = MAT_FLAG_PADDING
- brute_armor = 1
+ wall_armor = list(
+ BRUTE = 1,
+ BURN = 1
+ )
conductive = 0
hidden_from_codex = TRUE
construction_difficulty = MAT_VALUE_NORMAL_DIY
@@ -356,7 +365,10 @@
integrity = 75
hardness = MAT_VALUE_RIGID
weight = MAT_VALUE_VERY_LIGHT
- brute_armor = 2
+ wall_armor = list(
+ BRUTE = 2,
+ BURN = 2
+ )
sound_manipulate = 'sound/foley/paperpickup2.ogg'
sound_dropped = 'sound/foley/paperpickup1.ogg'
@@ -550,5 +562,8 @@
color = "#5c5a54"
hardness = MAT_VALUE_HARD
weight = MAT_VALUE_NORMAL
- brute_armor = 2
+ wall_armor = list(
+ BRUTE = 2,
+ BURN = 2
+ )
wall_support_value = MAT_VALUE_NORMAL
diff --git a/code/modules/materials/definitions/solids/materials_solid_stone.dm b/code/modules/materials/definitions/solids/materials_solid_stone.dm
index 5ab7f90f1492..4a45cf1d0c67 100644
--- a/code/modules/materials/definitions/solids/materials_solid_stone.dm
+++ b/code/modules/materials/definitions/solids/materials_solid_stone.dm
@@ -6,7 +6,10 @@
weight = MAT_VALUE_HEAVY
hardness = MAT_VALUE_HARD - 5
reflectiveness = MAT_VALUE_MATTE
- brute_armor = 3
+ wall_armor = list(
+ BRUTE = 3,
+ BURN = 3
+ )
conductive = 0
construction_difficulty = MAT_VALUE_NORMAL_DIY
wall_blend_icons = list(
@@ -42,7 +45,10 @@
exoplanet_rarity_gas = MAT_RARITY_MUNDANE
hardness = MAT_VALUE_HARD + 5
melting_point = T0C + 1260
- brute_armor = 15
+ wall_armor = list(
+ BRUTE = 15,
+ BURN = 15
+ )
explosion_resistance = 15
integrity = 500 //granite is very strong
dissolves_into = list(
diff --git a/code/modules/materials/definitions/solids/materials_solid_wood.dm b/code/modules/materials/definitions/solids/materials_solid_wood.dm
index 5488975444be..f504180cddde 100644
--- a/code/modules/materials/definitions/solids/materials_solid_wood.dm
+++ b/code/modules/materials/definitions/solids/materials_solid_wood.dm
@@ -18,7 +18,10 @@
shard_type = SHARD_SPLINTER
shard_can_repair = 0 // you can't weld splinters back into planks
hardness = MAT_VALUE_FLEXIBLE + 10
- brute_armor = 1
+ wall_armor = list(
+ BRUTE = 1,
+ BURN = 1
+ )
weight = MAT_VALUE_NORMAL
melting_point = T0C+300 //okay, not melting in this case, but hot enough to destroy wood
ignition_point = T0C+288
diff --git a/code/modules/mechs/components/_components.dm b/code/modules/mechs/components/_components.dm
index fa8ae476b26d..732b36606c17 100644
--- a/code/modules/mechs/components/_components.dm
+++ b/code/modules/mechs/components/_components.dm
@@ -29,7 +29,7 @@
return color != last_colour
/obj/item/mech_component/emp_act(var/severity)
- take_burn_damage(rand((10 - (severity*3)),15-(severity*4)))
+ take_damage(rand((10 - (severity*3)),15-(severity*4)), BURN)
for(var/obj/item/thing in contents)
thing.emp_act(severity)
@@ -69,33 +69,22 @@
/obj/item/mech_component/proc/ready_to_install()
return 1
-/obj/item/mech_component/proc/repair_brute_damage(var/amt)
- take_brute_damage(-amt)
-
-/obj/item/mech_component/proc/repair_burn_damage(var/amt)
- take_burn_damage(-amt)
-
-/obj/item/mech_component/proc/take_brute_damage(var/amt)
- brute_damage = max(0, brute_damage + amt)
- update_component_health()
- if(total_damage == max_damage)
- take_component_damage(amt,0)
-
-/obj/item/mech_component/proc/take_burn_damage(var/amt)
- burn_damage = max(0, burn_damage + amt)
+/obj/item/mech_component/take_damage(damage, damage_type = BRUTE, def_zone, damage_flags = 0, used_weapon, armor_pen, silent = FALSE, override_droplimb, skip_update_health = FALSE)
+ if(damage_type == BRUTE)
+ brute_damage = max(0, brute_damage + damage)
+ else if(damage_type == BURN)
+ burn_damage = max(0, burn_damage + damage)
+ else
+ return FALSE
update_component_health()
- if(total_damage == max_damage)
- take_component_damage(0,amt)
-
-/obj/item/mech_component/proc/take_component_damage(var/brute, var/burn)
+ if(total_damage < max_damage)
+ return TRUE
var/list/damageable_components = list()
for(var/obj/item/robot_parts/robot_component/RC in contents)
damageable_components += RC
if(!damageable_components.len) return
var/obj/item/robot_parts/robot_component/RC = pick(damageable_components)
- if(RC.take_damage(brute, BRUTE) || RC.take_damage(burn, BURN))
- qdel(RC)
- update_components()
+ RC.take_damage(damage, damage_type, def_zone, damage_flags, used_weapon, armor_pen, silent, override_droplimb, skip_update_health)
/obj/item/mech_component/attackby(var/obj/item/thing, var/mob/user)
if(IS_SCREWDRIVER(thing))
@@ -149,7 +138,7 @@
)
var/repair_value = 10 * max(user.get_skill_value(SKILL_CONSTRUCTION), user.get_skill_value(SKILL_DEVICES))
if(user.do_skilled(10, SKILL_DEVICES , src, 0.6) && brute_damage)
- repair_brute_damage(repair_value)
+ heal_damage(repair_value, BRUTE)
to_chat(user, SPAN_NOTICE("You mend the damage to \the [src]."))
playsound(user.loc, 'sound/items/Welder.ogg', 25, 1)
@@ -171,7 +160,7 @@
if(QDELETED(CC) || QDELETED(src) || !CC.use(needed_amount))
return
- repair_burn_damage(25)
+ heal_damage(25, BURN)
to_chat(user, SPAN_NOTICE("You mend the damage to \the [src]'s wiring."))
playsound(user.loc, 'sound/items/Deconstruct.ogg', 25, 1)
return
diff --git a/code/modules/mechs/components/legs.dm b/code/modules/mechs/components/legs.dm
index b6d0d4923165..9ad4a460960d 100644
--- a/code/modules/mechs/components/legs.dm
+++ b/code/modules/mechs/components/legs.dm
@@ -60,4 +60,4 @@
if(max_fall_damage > 0)
var/mob/living/exosuit/E = loc
if(istype(E)) //route it through exosuit for proper handling
- E.apply_damage(rand(0, max_fall_damage), BRUTE, BP_R_LEG) //Any leg is good, will damage us correctly
\ No newline at end of file
+ E.take_damage(rand(0, max_fall_damage), BRUTE, BP_R_LEG) //Any leg is good, will damage us correctly
\ No newline at end of file
diff --git a/code/modules/mechs/equipment/utility.dm b/code/modules/mechs/equipment/utility.dm
index 4873d03fbb6a..958f619067f5 100644
--- a/code/modules/mechs/equipment/utility.dm
+++ b/code/modules/mechs/equipment/utility.dm
@@ -463,7 +463,7 @@
mech_cell.use(active_power_use * CELLRATE) //supercall made sure we have one
var/delay = 3 SECONDS //most things
- switch (drill_head.material.brute_armor)
+ switch (drill_head.material.wall_armor[BRUTE])
if (15 to INFINITY) delay = 0.5 SECONDS //voxalloy on a good roll
if (10 to 15) delay = 1 SECOND //titanium, diamond
if (5 to 10) delay = 2 SECONDS //plasteel, steel
diff --git a/code/modules/mechs/exosuit_damage_handlers.dm b/code/modules/mechs/exosuit_damage_handlers.dm
new file mode 100644
index 000000000000..7c606d9d711f
--- /dev/null
+++ b/code/modules/mechs/exosuit_damage_handlers.dm
@@ -0,0 +1,74 @@
+// Exosuits only care about brute and burn.
+/mob/living/exosuit/get_handled_damage_types()
+ var/static/list/mob_damage_types = list(
+ BRUTE = /decl/damage_handler/brute/exosuit,
+ BURN = /decl/damage_handler/burn/exosuit
+ )
+ return mob_damage_types
+
+/decl/damage_handler/brute/exosuit
+ expected_type = /mob/living/exosuit
+
+/decl/damage_handler/brute/exosuit/apply_damage_to_mob(var/mob/living/target, var/damage, var/def_zone, var/damage_flags = 0, var/used_weapon, var/silent = FALSE, var/skip_update_health = FALSE)
+ var/mob/living/exosuit/target_exo = target
+ var/obj/item/mech_component/MC = target_exo.resolve_def_zone_to_component(def_zone)
+ if(MC)
+ MC.take_damage(damage, category_type)
+ MC.update_component_health()
+ return TRUE
+ return FALSE
+
+/decl/damage_handler/brute/exosuit/get_damage_for_mob(var/mob/living/target)
+ . = 0
+ var/mob/living/exosuit/target_exo = target
+ for(var/obj/item/mech_component/MC in list(target_exo.arms, target_exo.legs, target_exo.body, target_exo.head))
+ . += MC.brute_damage
+
+/decl/damage_handler/brute/exosuit/set_mob_damage(var/mob/living/target, var/damage, var/skip_update_health = FALSE)
+ return FALSE // No idea how to handle this sanely for exosuits.
+
+/decl/damage_handler/brute/exosuit/heal_mob_damage(var/mob/living/target, var/damage, var/skip_update_health = FALSE)
+ . = FALSE
+ var/mob/living/exosuit/target_exo = target
+ for(var/obj/item/mech_component/MC in list(target_exo.arms, target_exo.legs, target_exo.body, target_exo.head))
+ if(MC.burn_damage)
+ var/healing = min(damage, MC.brute_damage)
+ MC.brute_damage -= healing
+ damage -= healing
+ . = TRUE
+ if(damage <= 0)
+ break
+
+/decl/damage_handler/burn/exosuit
+ expected_type = /mob/living/exosuit
+
+/decl/damage_handler/burn/exosuit/apply_damage_to_mob(var/mob/living/target, var/damage, var/def_zone, var/damage_flags = 0, var/used_weapon, var/silent = FALSE, var/skip_update_health = FALSE)
+ var/mob/living/exosuit/target_exo = target
+ var/obj/item/mech_component/MC = target_exo.resolve_def_zone_to_component(def_zone)
+ if(MC)
+ MC.take_damage(damage, category_type)
+ MC.update_component_health()
+ return TRUE
+ return FALSE
+
+/decl/damage_handler/burn/exosuit/get_damage_for_mob(var/mob/living/target)
+ . = 0
+ var/mob/living/exosuit/target_exo = target
+ for(var/obj/item/mech_component/MC in list(target_exo.arms, target_exo.legs, target_exo.body, target_exo.head))
+ . += MC.burn_damage
+
+/decl/damage_handler/burn/exosuit/set_mob_damage(var/mob/living/target, var/damage, var/skip_update_health = FALSE)
+ return FALSE // No idea how to handle this sanely for exosuits.
+
+/decl/damage_handler/burn/exosuit/heal_mob_damage(var/mob/living/target, var/damage, var/skip_update_health = FALSE)
+ . = FALSE
+ var/mob/living/exosuit/target_exo = target
+ for(var/obj/item/mech_component/MC in list(target_exo.arms, target_exo.legs, target_exo.body, target_exo.head))
+ if(MC.burn_damage)
+ var/healing = min(damage, MC.burn_damage)
+ MC.burn_damage -= healing
+ damage -= healing
+ . = TRUE
+ if(damage <= 0)
+ break
+
diff --git a/code/modules/mechs/mech_damage.dm b/code/modules/mechs/mech_damage.dm
index 3b8c152f403d..0dc4d4f3b5c0 100644
--- a/code/modules/mechs/mech_damage.dm
+++ b/code/modules/mechs/mech_damage.dm
@@ -1,3 +1,15 @@
+/mob/living/exosuit/proc/resolve_def_zone_to_component(var/def_zone)
+ switch(def_zone)
+ if(BP_HEAD)
+ return head
+ if(BP_CHEST, BP_GROIN)
+ return body
+ if(BP_L_ARM, BP_L_HAND, BP_R_ARM, BP_R_HAND)
+ return arms
+ if(BP_L_LEG, BP_L_FOOT, BP_R_LEG, BP_R_FOOT)
+ return legs
+ return pick(list(arms, legs, body, head))
+
/mob/living/exosuit/explosion_act(severity)
. = ..(4) //We want to avoid the automatic handling of damage to contents
var/b_loss = 0
@@ -13,18 +25,52 @@
b_loss = 45
// spread damage overall
- apply_damage(b_loss, BRUTE, null, DAM_EXPLODE | DAM_DISPERSED, used_weapon = "Explosive blast")
- apply_damage(f_loss, BURN, null, DAM_EXPLODE | DAM_DISPERSED, used_weapon = "Explosive blast")
+ take_damage(b_loss, BRUTE, null, DAM_EXPLODE | DAM_DISPERSED, used_weapon = "Explosive blast")
+ take_damage(f_loss, BURN, null, DAM_EXPLODE | DAM_DISPERSED, used_weapon = "Explosive blast")
+
+/mob/living/exosuit/get_dispersed_damage_zones()
+ for(var/obj/item/part in list(arms, legs, body, head))
+ if(part == arms)
+ LAZYSET(., BP_L_ARM, part.w_class)
+ else if(part == legs)
+ LAZYSET(., BP_L_LEG, part.w_class)
+ else if(part == head)
+ LAZYSET(., BP_HEAD, part.w_class)
+ else if(part == body)
+ LAZYSET(., BP_CHEST, part.w_class)
+
+/mob/living/exosuit/take_damage(damage, damage_type = BRUTE, def_zone, damage_flags = 0, used_weapon, armor_pen, silent = FALSE, override_droplimb, skip_update_health = FALSE)
+ /*
+ if(!def_zone)
+ if(damage_flags & DAM_DISPERSED)
+ var/old_damage = damage
+ var/tally
+ silent = FALSE
+ tally += part.w_class
+ for(var/obj/item/part in list(arms, legs, body, head))
+ damage = old_damage * part.w_class/tally
+ def_zone = BP_CHEST
+
+ . = .() || .
+ return
+ def_zone = ran_zone(def_zone)
+ */
+ // If the hatch is open, pilots are not protected by radiation.
+ if(damage > 0 && damage_type == IRRADIATE && LAZYLEN(pilots) && (!hatch_closed || !prob(body.pilot_coverage)))
+ var/mob/living/pilot = pick(pilots)
+ return pilot.take_damage(damage, damage_type, def_zone, damage_flags, used_weapon, armor_pen, silent, override_droplimb)
+ . = ..()
+ if(. && damage_type != IRRADIATE && prob(25+(damage*2)))
+ sparks.set_up(3,0,src)
+ sparks.start()
/mob/living/exosuit/apply_effect(var/effect = 0,var/effecttype = STUN, var/blocked = 0)
if(!effect || (blocked >= 100))
return 0
if(LAZYLEN(pilots) && (!hatch_closed || !prob(body.pilot_coverage)))
- if(effect > 0 && effecttype == IRRADIATE)
- effect = max((1-(get_armors_by_zone(null, IRRADIATE)/100))*effect/(blocked+1),0)
var/mob/living/pilot = pick(pilots)
return pilot.apply_effect(effect, effecttype, blocked)
- if(!(effecttype in list(PAIN, STUTTER, EYE_BLUR, DROWSY, STUN, WEAKEN)))
+ if(!(effecttype in list(STUTTER, EYE_BLUR, DROWSY, STUN, WEAKEN)))
. = ..()
/mob/living/exosuit/resolve_item_attack(var/obj/item/I, var/mob/living/user, var/def_zone)
@@ -83,20 +129,6 @@
/mob/living/exosuit/get_max_health()
return (body ? body.mech_health : 0)
-/mob/living/exosuit/get_total_life_damage()
- return (getFireLoss()+getBruteLoss())
-
-/mob/living/exosuit/adjustFireLoss(var/amount, var/obj/item/mech_component/MC = pick(list(arms, legs, body, head)), var/do_update_health = TRUE)
- if(MC)
- MC.take_burn_damage(amount)
- if(do_update_health)
- update_health() // TODO: unify these procs somehow instead of having weird brute-wrapping behavior as the default.
-
-/mob/living/exosuit/adjustBruteLoss(var/amount, var/obj/item/mech_component/MC = pick(list(arms, legs, body, head)), var/do_update_health = TRUE)
- if(MC)
- MC.take_brute_damage(amount)
- ..()
-
/mob/living/exosuit/proc/zoneToComponent(var/zone)
switch(zone)
if(BP_EYES , BP_HEAD)
@@ -108,55 +140,6 @@
else
return body
-/mob/living/exosuit/apply_damage(var/damage = 0,var/damagetype = BRUTE, var/def_zone = null, var/damage_flags = 0, var/used_weapon = null, var/armor_pen, var/silent = FALSE)
- if(!damage)
- return 0
-
- if(!def_zone)
- if(damage_flags & DAM_DISPERSED)
- var/old_damage = damage
- var/tally
- silent = FALSE
- for(var/obj/item/part in list(arms, legs, body, head))
- tally += part.w_class
- for(var/obj/item/part in list(arms, legs, body, head))
- damage = old_damage * part.w_class/tally
- def_zone = BP_CHEST
- if(part == arms)
- def_zone = BP_L_ARM
- else if(part == legs)
- def_zone = BP_L_LEG
- else if(part == head)
- def_zone = BP_HEAD
-
- . = .() || .
- return
-
- def_zone = ran_zone(def_zone)
-
- var/list/after_armor = modify_damage_by_armor(def_zone, damage, damagetype, damage_flags, src, armor_pen, TRUE)
- damage = after_armor[1]
- damagetype = after_armor[2]
-
- if(!damage)
- return 0
-
- var/target = zoneToComponent(def_zone)
- //Only 3 types of damage concern mechs and vehicles
- switch(damagetype)
- if(BRUTE)
- adjustBruteLoss(damage, target)
- if(BURN)
- adjustFireLoss(damage, target)
- if(IRRADIATE)
- for(var/mob/living/pilot in pilots)
- pilot.apply_damage(damage, IRRADIATE, def_zone, damage_flags, used_weapon)
-
- if((damagetype == BRUTE || damagetype == BURN) && prob(25+(damage*2)))
- sparks.set_up(3,0,src)
- sparks.start()
- return 1
-
/mob/living/exosuit/rad_act(var/severity)
return FALSE // Pilots already query rads, modify this for radiation alerts and such
@@ -167,20 +150,6 @@
var/list/after_armor = modify_damage_by_armor(null, ., IRRADIATE, DAM_DISPERSED, src, 0, TRUE)
return after_armor[1]
-/mob/living/exosuit/getFireLoss()
- var/total = 0
- for(var/obj/item/mech_component/MC in list(arms, legs, body, head))
- if(MC)
- total += MC.burn_damage
- return total
-
-/mob/living/exosuit/getBruteLoss()
- var/total = 0
- for(var/obj/item/mech_component/MC in list(arms, legs, body, head))
- if(MC)
- total += MC.brute_damage
- return total
-
/mob/living/exosuit/emp_act(var/severity)
var/ratio = get_blocked_ratio(null, BURN, null, (4-severity) * 20)
diff --git a/code/modules/mechs/mech_damage_immunity.dm b/code/modules/mechs/mech_damage_immunity.dm
index 067c613d56d0..92d7ac89588f 100644
--- a/code/modules/mechs/mech_damage_immunity.dm
+++ b/code/modules/mechs/mech_damage_immunity.dm
@@ -8,51 +8,8 @@
/mob/living/exosuit/set_status(condition, amount)
. = !(condition in ignore_status_conditions) && ..()
-/mob/living/exosuit/getOxyLoss()
+/mob/living/exosuit/get_brain_damage()
return 0
-/mob/living/exosuit/setOxyLoss()
+/mob/living/exosuit/set_brain_damage()
return 0
-
-/mob/living/exosuit/adjustOxyLoss(var/damage, var/do_update_health = TRUE)
- SHOULD_CALL_PARENT(FALSE)
- return 0
-
-/mob/living/exosuit/getToxLoss()
- return 0
-
-/mob/living/exosuit/setToxLoss()
- return 0
-
-/mob/living/exosuit/adjustToxLoss(var/amount, var/do_update_health = TRUE)
- return 0
-
-/mob/living/exosuit/getBrainLoss()
- return 0
-
-/mob/living/exosuit/setBrainLoss()
- return 0
-
-/mob/living/exosuit/adjustBrainLoss(var/amount, var/do_update_health = TRUE)
- SHOULD_CALL_PARENT(FALSE)
- return 0
-
-/mob/living/exosuit/getCloneLoss()
- return 0
-
-/mob/living/exosuit/setCloneLoss()
- return 0
-
-/mob/living/exosuit/adjustCloneLoss(var/amount, var/do_update_health = TRUE)
- SHOULD_CALL_PARENT(FALSE)
- return 0
-
-/mob/living/exosuit/getHalLoss()
- return 0
-
-/mob/living/exosuit/setHalLoss()
- return 0
-
-/mob/living/exosuit/adjustHalLoss(var/amount, var/do_update_health = TRUE)
- SHOULD_CALL_PARENT(FALSE)
- return 0
\ No newline at end of file
diff --git a/code/modules/mechs/mech_interaction.dm b/code/modules/mechs/mech_interaction.dm
index 867f92eed149..b572421dbfdc 100644
--- a/code/modules/mechs/mech_interaction.dm
+++ b/code/modules/mechs/mech_interaction.dm
@@ -398,7 +398,7 @@
dismantle()
return
else if(IS_WELDER(thing))
- if(!getBruteLoss())
+ if(!get_damage(BRUTE))
return
var/list/damaged_parts = list()
for(var/obj/item/mech_component/MC in list(arms, legs, body, head))
@@ -409,7 +409,7 @@
to_fix.repair_brute_generic(thing, user)
return
else if(IS_COIL(thing))
- if(!getFireLoss())
+ if(!get_damage(BURN))
return
var/list/damaged_parts = list()
for(var/obj/item/mech_component/MC in list(arms, legs, body, head))
diff --git a/code/modules/mechs/mech_life.dm b/code/modules/mechs/mech_life.dm
index ad1964eb5161..326d149c9b01 100644
--- a/code/modules/mechs/mech_life.dm
+++ b/code/modules/mechs/mech_life.dm
@@ -82,7 +82,7 @@
damage = 10
if(bodytemperature > material.melting_point * 2.15 )
damage = 15
- apply_damage(damage, BURN)
+ take_damage(damage, BURN)
//A possibility is to hook up interface icons here. But this works pretty well in my experience
if(prob(damage))
visible_message(SPAN_DANGER("\The [src]'s hull bends and buckles under the intense heat!"))
diff --git a/code/modules/mechs/premade/exploration.dm b/code/modules/mechs/premade/exploration.dm
index 424a08d64051..b9a3714ed814 100644
--- a/code/modules/mechs/premade/exploration.dm
+++ b/code/modules/mechs/premade/exploration.dm
@@ -24,11 +24,11 @@
//Damage it
var/list/parts = list(arms,legs,head,body)
var/obj/item/mech_component/damaged = pick(parts)
- damaged.take_burn_damage((damaged.max_damage / 4 ) * MECH_COMPONENT_DAMAGE_DAMAGED)
+ damaged.take_damage((damaged.max_damage / 4 ) * MECH_COMPONENT_DAMAGE_DAMAGED, BURN)
if(prob(33))
parts -= damaged
damaged = pick(parts)
- damaged.take_burn_damage((damaged.max_damage / 4 ) * MECH_COMPONENT_DAMAGE_DAMAGED)
+ damaged.take_damage((damaged.max_damage / 4 ) * MECH_COMPONENT_DAMAGE_DAMAGED, BURN)
/mob/living/exosuit/premade/light/exploration/spawn_mech_equipment()
install_system(new /obj/item/mech_equipment/light(src), HARDPOINT_HEAD)
diff --git a/code/modules/mechs/premade/powerloader.dm b/code/modules/mechs/premade/powerloader.dm
index 45c7c782aa46..b4e0bccc60e1 100644
--- a/code/modules/mechs/premade/powerloader.dm
+++ b/code/modules/mechs/premade/powerloader.dm
@@ -162,11 +162,11 @@
MC.color = rgb(255,rand(188, 225),rand(55, 136))
//Damage it
var/obj/item/mech_component/damaged = pick(parts)
- damaged.take_brute_damage((damaged.max_damage / 4 ) * MECH_COMPONENT_DAMAGE_DAMAGED)
+ damaged.take_damage((damaged.max_damage / 4 ) * MECH_COMPONENT_DAMAGE_DAMAGED, BRUTE)
if(prob(33))
parts -= damaged
damaged = pick(parts)
- damaged.take_brute_damage((damaged.max_damage / 4 ) * MECH_COMPONENT_DAMAGE_DAMAGED)
+ damaged.take_damage((damaged.max_damage / 4 ) * MECH_COMPONENT_DAMAGE_DAMAGED, BRUTE)
/mob/living/exosuit/premade/powerloader/old/spawn_mech_equipment()
install_system(new /obj/item/mech_equipment/light(src), HARDPOINT_HEAD)
diff --git a/code/modules/mining/machinery/material_stacker.dm b/code/modules/mining/machinery/material_stacker.dm
index 4db34e69b37f..1deb528ce50d 100644
--- a/code/modules/mining/machinery/material_stacker.dm
+++ b/code/modules/mining/machinery/material_stacker.dm
@@ -46,7 +46,7 @@
if(emagged)
for(var/mob/living/M in input_turf)
visible_message(SPAN_DANGER("\The [src] squashes \the [src] with its stacking mechanism!"))
- M.take_overall_damage(rand(10, 20), 0)
+ M.take_damage(rand(10, 20), BRUTE)
break
if(output_turf)
diff --git a/code/modules/mining/machinery/material_unloader.dm b/code/modules/mining/machinery/material_unloader.dm
index 6450fa1d8ba7..3c663b477005 100644
--- a/code/modules/mining/machinery/material_unloader.dm
+++ b/code/modules/mining/machinery/material_unloader.dm
@@ -13,7 +13,7 @@
if(!output_turf || !input_turf)
return
-
+
if(length(output_turf.contents) >= MAX_UNLOAD_TURF_CONTENTS)
return
@@ -35,7 +35,7 @@
if(emagged)
for(var/mob/living/M in input_turf)
visible_message(SPAN_DANGER("\The [M] is yanked violently through \the [src]!"))
- M.take_overall_damage(rand(10, 20), 0)
+ M.take_damage(rand(10, 20), BRUTE)
M.dropInto(output_turf)
break
diff --git a/code/modules/mob/grab/normal/grab_normal.dm b/code/modules/mob/grab/normal/grab_normal.dm
index 0bcdc241be97..1de99c029d4e 100644
--- a/code/modules/mob/grab/normal/grab_normal.dm
+++ b/code/modules/mob/grab/normal/grab_normal.dm
@@ -168,8 +168,8 @@
attacker.visible_message(SPAN_DANGER("\The [attacker] thrusts [attacker_gender.his] head into \the [target]'s skull!"))
var/armor = target.get_blocked_ratio(BP_HEAD, BRUTE, damage = 10)
- target.apply_damage(damage, BRUTE, BP_HEAD, damage_flags)
- attacker.apply_damage(10, BRUTE, BP_HEAD)
+ target.take_damage(damage, BRUTE, BP_HEAD, damage_flags)
+ attacker.take_damage(10, BRUTE, BP_HEAD)
if(armor < 0.5 && target.headcheck(BP_HEAD) && prob(damage))
target.apply_effect(20, PARALYZE)
@@ -251,7 +251,7 @@
var/total_damage = 0
for(var/i in 1 to 3)
var/damage = min(W.force*1.5, 20)*damage_mod
- affecting.apply_damage(damage, W.damtype, BP_HEAD, damage_flags, armor_pen = 100, used_weapon=W)
+ affecting.take_damage(damage, W.damtype, BP_HEAD, damage_flags, armor_pen = 100, used_weapon=W)
total_damage += damage
if(total_damage)
diff --git a/code/modules/mob/grab/normal/norm_kill.dm b/code/modules/mob/grab/normal/norm_kill.dm
index 5d84027131a5..bcfe16622a6b 100644
--- a/code/modules/mob/grab/normal/norm_kill.dm
+++ b/code/modules/mob/grab/normal/norm_kill.dm
@@ -22,7 +22,7 @@
affecting.drop_held_items()
if(affecting.lying)
SET_STATUS_MAX(affecting, STAT_WEAK, 4)
- affecting.adjustOxyLoss(1)
+ affecting.take_damage(1, OXY)
affecting.apply_effect(STUTTER, 5) //It will hamper your voice, being choked and all.
SET_STATUS_MAX(affecting, STAT_WEAK, 5) //Should keep you down unless you get help.
if(iscarbon(affecting))
diff --git a/code/modules/mob/grab/normal/norm_neck.dm b/code/modules/mob/grab/normal/norm_neck.dm
index e2a31ee765b2..f2a1e8cca462 100644
--- a/code/modules/mob/grab/normal/norm_neck.dm
+++ b/code/modules/mob/grab/normal/norm_neck.dm
@@ -23,4 +23,4 @@
affecting.drop_held_items()
if(affecting.lying)
SET_STATUS_MAX(affecting, STAT_WEAK, 4)
- affecting.adjustOxyLoss(1)
+ affecting.take_damage(1, OXY)
diff --git a/code/modules/mob/living/bot/bot.dm b/code/modules/mob/living/bot/bot.dm
index 4f7229bff8ed..6f1a2255f1a4 100644
--- a/code/modules/mob/living/bot/bot.dm
+++ b/code/modules/mob/living/bot/bot.dm
@@ -66,9 +66,6 @@
set_status(STAT_STUN, 0)
set_status(STAT_PARA, 0)
-/mob/living/bot/get_total_life_damage()
- return getFireLoss() + getBruteLoss()
-
/mob/living/bot/death()
if(stat == DEAD)
return
@@ -97,7 +94,7 @@
else if(IS_WELDER(O))
if(current_health < get_max_health())
if(open)
- heal_overall_damage(10)
+ heal_damage(10, BRUTE)
user.visible_message("\The [user] repairs \the [src].","You repair \the [src].")
else
to_chat(user, "Unable to repair with the maintenance panel closed.")
diff --git a/code/modules/mob/living/bot/medibot.dm b/code/modules/mob/living/bot/medibot.dm
index 41e96d88d810..497cc6127d4e 100644
--- a/code/modules/mob/living/bot/medibot.dm
+++ b/code/modules/mob/living/bot/medibot.dm
@@ -314,22 +314,22 @@
return treatment_emag
// If they're injured, we're using a beaker, and they don't have on of the chems in the beaker
- if(reagent_glass && use_beaker && ((H.getBruteLoss() >= heal_threshold) || (H.getToxLoss() >= heal_threshold) || (H.getToxLoss() >= heal_threshold) || (H.getOxyLoss() >= (heal_threshold + 15))))
+ if(reagent_glass && use_beaker && ((H.get_damage(BRUTE) >= heal_threshold) || (H.get_damage(TOX) >= heal_threshold) || (H.get_damage(OXY) >= (heal_threshold + 15))))
for(var/R in reagent_glass.reagents.reagent_volumes)
if(!H.reagents.has_reagent(R))
return 1
continue
- if((H.getBruteLoss() >= heal_threshold) && (!H.reagents.has_reagent(treatment_brute)))
+ if((H.get_damage(BRUTE) >= heal_threshold) && (!H.reagents.has_reagent(treatment_brute)))
return treatment_brute //If they're already medicated don't bother!
- if((H.getOxyLoss() >= (15 + heal_threshold)) && (!H.reagents.has_reagent(treatment_oxy)))
+ if((H.get_damage(OXY) >= (15 + heal_threshold)) && (!H.reagents.has_reagent(treatment_oxy)))
return treatment_oxy
- if((H.getFireLoss() >= heal_threshold) && (!H.reagents.has_reagent(treatment_fire)))
+ if((H.get_damage(BURN) >= heal_threshold) && (!H.reagents.has_reagent(treatment_fire)))
return treatment_fire
- if((H.getToxLoss() >= heal_threshold) && (!H.reagents.has_reagent(treatment_tox)))
+ if((H.get_damage(TOX) >= heal_threshold) && (!H.reagents.has_reagent(treatment_tox)))
return treatment_tox
/mob/living/bot/medbot/proc/tip_over(mob/user)
diff --git a/code/modules/mob/living/bot/mulebot.dm b/code/modules/mob/living/bot/mulebot.dm
index 6cbd7c103811..2b9014037f1e 100644
--- a/code/modules/mob/living/bot/mulebot.dm
+++ b/code/modules/mob/living/bot/mulebot.dm
@@ -209,12 +209,12 @@
visible_message(SPAN_WARNING("\The [src] drives over \the [victim]!"))
playsound(loc, 'sound/effects/splat.ogg', 50, 1)
var/damage = rand(5, 7)
- victim.apply_damage(2 * damage, BRUTE, BP_HEAD)
- victim.apply_damage(2 * damage, BRUTE, BP_CHEST)
- victim.apply_damage(0.5 * damage, BRUTE, BP_L_LEG)
- victim.apply_damage(0.5 * damage, BRUTE, BP_R_LEG)
- victim.apply_damage(0.5 * damage, BRUTE, BP_L_ARM)
- victim.apply_damage(0.5 * damage, BRUTE, BP_R_ARM)
+ victim.take_damage(2 * damage, BRUTE, BP_HEAD)
+ victim.take_damage(2 * damage, BRUTE, BP_CHEST)
+ victim.take_damage(0.5 * damage, BRUTE, BP_L_LEG)
+ victim.take_damage(0.5 * damage, BRUTE, BP_R_LEG)
+ victim.take_damage(0.5 * damage, BRUTE, BP_L_ARM)
+ victim.take_damage(0.5 * damage, BRUTE, BP_R_ARM)
blood_splatter(src, victim, 1)
/mob/living/bot/mulebot/relaymove(var/mob/user, var/direction)
diff --git a/code/modules/mob/living/carbon/alien/alien_attacks.dm b/code/modules/mob/living/carbon/alien/alien_attacks.dm
index a9589f5725ea..4fffd67f13cc 100644
--- a/code/modules/mob/living/carbon/alien/alien_attacks.dm
+++ b/code/modules/mob/living/carbon/alien/alien_attacks.dm
@@ -19,7 +19,7 @@
if (damage > 4.9)
SET_STATUS_MAX(src, STAT_WEAK, rand(10,15))
user.visible_message(SPAN_DANGER("\The [user] has weakened \the [src]!"), 1, SPAN_WARNING("You hear someone fall."), 2)
- adjustBruteLoss(damage)
+ take_damage(damage, BRUTE)
else
playsound(loc, 'sound/weapons/punchmiss.ogg', 25, 1, -1)
visible_message(SPAN_DANGER("\The [user] has attempted to punch \the [src]!"), 1)
diff --git a/code/modules/mob/living/carbon/alien/alien_damage.dm b/code/modules/mob/living/carbon/alien/alien_damage.dm
index 1a1d4e2ef770..2b22ad529c8e 100644
--- a/code/modules/mob/living/carbon/alien/alien_damage.dm
+++ b/code/modules/mob/living/carbon/alien/alien_damage.dm
@@ -17,5 +17,5 @@
SET_STATUS_MAX(src, STAT_PARA, 1)
SET_STATUS_MAX(src, STAT_TINNITUS, 15)
SET_STATUS_MAX(src, STAT_DEAF, 60)
- adjustBruteLoss(b_loss, do_update_health = FALSE)
- adjustFireLoss(f_loss)
+ take_damage(b_loss, BRUTE, skip_update_health = TRUE)
+ take_damage(f_loss, BURN)
diff --git a/code/modules/mob/living/carbon/alien/life.dm b/code/modules/mob/living/carbon/alien/life.dm
index 58fff70c26a0..702b64266583 100644
--- a/code/modules/mob/living/carbon/alien/life.dm
+++ b/code/modules/mob/living/carbon/alien/life.dm
@@ -1,12 +1,14 @@
/mob/living/carbon/alien/handle_mutations_and_radiation()
..()
- if(radiation)
- var/rads = radiation/25
- radiation -= rads
+ var/rads = get_damage(IRRADIATE)
+ if(rads)
+ rads /= 25
adjust_nutrition(rads)
- heal_overall_damage(rads,rads)
- adjustOxyLoss(-(rads), do_update_health = FALSE)
- adjustToxLoss(-(rads))
+ heal_damage(rads, IRRADIATE)
+ heal_damage(rads, BRUTE)
+ heal_damage(rads, BURN)
+ heal_damage(rads, OXY, skip_update_health = TRUE)
+ heal_damage(rads, TOX)
/mob/living/carbon/alien/handle_regular_status_updates()
@@ -18,22 +20,22 @@
else if(HAS_STATUS(src, STAT_PARA))
SET_STATUS_MAX(src, STAT_BLIND, 2)
set_stat(UNCONSCIOUS)
- if(getHalLoss() > 0)
- adjustHalLoss(-3)
+ if(get_damage(PAIN) > 0)
+ heal_damage(3, PAIN)
if(HAS_STATUS(src, STAT_ASLEEP))
- adjustHalLoss(-3)
+ heal_damage(3, PAIN)
if (mind)
if(mind.active && client != null)
ADJ_STATUS(src, STAT_ASLEEP, -1)
SET_STATUS_MAX(src, STAT_BLIND, 2)
set_stat(UNCONSCIOUS)
else if(resting)
- if(getHalLoss() > 0)
- adjustHalLoss(-3)
+ if(get_damage(PAIN) > 0)
+ heal_damage(3, PAIN)
else
set_stat(CONSCIOUS)
- if(getHalLoss() > 0)
- adjustHalLoss(-1)
+ if(get_damage(PAIN) > 0)
+ heal_damage(3, PAIN)
// Eyes and blindness.
if(!check_has_eyes())
@@ -88,7 +90,7 @@
// Both alien subtypes survive in vaccum and suffer in high temperatures,
// so I'll just define this once, for both (see radiation comment above)
if(environment && environment.temperature > (T0C+66))
- adjustFireLoss((environment.temperature - (T0C+66))/5) // Might be too high, check in testing.
+ take_damage((environment.temperature - (T0C+66))/5, BURN) // Might be too high, check in testing.
if (fire) fire.icon_state = "fire2"
if(prob(20))
to_chat(src, "You feel a searing heat!")
diff --git a/code/modules/mob/living/carbon/brain/MMI.dm b/code/modules/mob/living/carbon/brain/MMI.dm
index a8eca098a30d..98ed8b9b3495 100644
--- a/code/modules/mob/living/carbon/brain/MMI.dm
+++ b/code/modules/mob/living/carbon/brain/MMI.dm
@@ -38,7 +38,7 @@
if(istype(O,/obj/item/organ/internal/brain) && !brainmob) //Time to stick a brain in it --NEO
var/obj/item/organ/internal/brain/B = O
- if(B.damage >= B.max_damage)
+ if(B.organ_damage >= B.max_damage)
to_chat(user, "That brain is well and truly dead.")
return
else if(!B.brainmob || !B.can_use_mmi)
diff --git a/code/modules/mob/living/carbon/brain/life.dm b/code/modules/mob/living/carbon/brain/life.dm
index 692e2ce7fcfe..9a9aa941d105 100644
--- a/code/modules/mob/living/carbon/brain/life.dm
+++ b/code/modules/mob/living/carbon/brain/life.dm
@@ -6,32 +6,33 @@
/mob/living/carbon/brain/handle_mutations_and_radiation()
..()
+ var/radiation = get_damage(IRRADIATE)
if (radiation)
if (radiation > 100)
- radiation = 100
+ set_damage(100, IRRADIATE)
if(!container)//If it's not in an MMI
to_chat(src, "You feel weak.")
else//Fluff-wise, since the brain can't detect anything itself, the MMI handles thing like that
to_chat(src, "STATUS: CRITICAL AMOUNTS OF RADIATION DETECTED.")
switch(radiation)
if(1 to 49)
- radiation--
+ heal_damage(1, IRRADIATE)
if(prob(25))
- adjustToxLoss(1)
+ take_damage(1, TOX)
if(50 to 74)
- radiation -= 2
- adjustToxLoss(1)
+ heal_damage(2, IRRADIATE)
+ take_damage(1, TOX)
if(prob(5))
- radiation -= 5
+ heal_damage(5, IRRADIATE)
if(!container)
to_chat(src, "You feel weak.")
else
to_chat(src, "STATUS: DANGEROUS LEVELS OF RADIATION DETECTED.")
if(75 to 100)
- radiation -= 3
- adjustToxLoss(3)
+ heal_damage(3, IRRADIATE)
+ take_damage(3, TOX)
/mob/living/carbon/brain/handle_environment(datum/gas_mixture/environment)
..()
@@ -52,10 +53,10 @@
if(status_flags & GODMODE) return
if(exposed_temperature > bodytemperature)
var/discomfort = min( abs(exposed_temperature - bodytemperature)*(exposed_intensity)/2000000, 1.0)
- adjustFireLoss(20.0*discomfort)
+ take_damage(20 * discomfort, BURN)
else
var/discomfort = min( abs(exposed_temperature - bodytemperature)*(exposed_intensity)/2000000, 1.0)
- adjustFireLoss(5.0*discomfort)
+ take_damage(5 * discomfort, BURN)
/mob/living/carbon/brain/apply_chemical_effects()
. = ..()
diff --git a/code/modules/mob/living/carbon/carbon.dm b/code/modules/mob/living/carbon/carbon.dm
index c6638f9cd84f..87a57780cf8c 100644
--- a/code/modules/mob/living/carbon/carbon.dm
+++ b/code/modules/mob/living/carbon/carbon.dm
@@ -60,10 +60,10 @@
playsound(user.loc, 'sound/effects/attackblob.ogg', 50, 1)
var/obj/item/organ/external/organ = GET_EXTERNAL_ORGAN(src, BP_CHEST)
if(istype(organ))
- organ.take_external_damage(d, 0)
+ organ.take_damage(d, BRUTE)
else
- take_organ_damage(d)
- if(prob(getBruteLoss() - 50))
+ take_damage(d, BRUTE)
+ if(prob(get_damage(BRUTE) - 50))
gib()
/mob/living/carbon/gib(anim="gibbed-m",do_gibs)
@@ -120,7 +120,7 @@
return 0
if(shock_damage < 1)
shock_damage = 1
- apply_damage(shock_damage, BURN, def_zone, used_weapon="Electrocution")
+ take_damage(shock_damage, BURN, def_zone, used_weapon = "Electrocution")
return(shock_damage)
/mob/proc/swap_hand()
diff --git a/code/modules/mob/living/carbon/carbon_defense.dm b/code/modules/mob/living/carbon/carbon_defense.dm
index 7c9cd0a684f9..7e70f34e1203 100644
--- a/code/modules/mob/living/carbon/carbon_defense.dm
+++ b/code/modules/mob/living/carbon/carbon_defense.dm
@@ -5,7 +5,7 @@
//Apply weapon damage
var/damage_flags = I.damage_flags()
- var/datum/wound/created_wound = apply_damage(effective_force, I.damtype, hit_zone, damage_flags, used_weapon=I, armor_pen=I.armor_penetration)
+ var/datum/wound/created_wound = take_damage(effective_force, I.damtype, hit_zone, damage_flags, used_weapon=I, armor_pen=I.armor_penetration)
//Melee weapon embedded object code.
if(istype(created_wound) && I && I.can_embed() && I.damtype == BRUTE && !I.anchored && !is_robot_module(I))
diff --git a/code/modules/mob/living/carbon/damage_procs.dm b/code/modules/mob/living/carbon/damage_procs.dm
deleted file mode 100644
index 348e5d0fc2ee..000000000000
--- a/code/modules/mob/living/carbon/damage_procs.dm
+++ /dev/null
@@ -1,12 +0,0 @@
-/*
-Contians the proc to handle radiation.
-Specifically made to do radiation burns.
-*/
-
-
-/mob/living/carbon/apply_radiation(damage)
- ..()
- if(!isSynthetic() && !ignore_rads)
- damage = 0.25 * damage * (species ? species.get_radiation_mod(src) : 1)
- adjustFireLoss(damage)
- return TRUE
diff --git a/code/modules/mob/living/carbon/human/examine.dm b/code/modules/mob/living/carbon/human/examine.dm
index b68d1e52ac02..b9163f7b4236 100644
--- a/code/modules/mob/living/carbon/human/examine.dm
+++ b/code/modules/mob/living/carbon/human/examine.dm
@@ -144,7 +144,7 @@
wound_flavor_text[E.name] += "[use_His] [E.name] is irrecoverably damaged!
"
else
wound_flavor_text[E.name] += "[use_His] [E.name] is grey and necrotic!
"
- else if(E.damage >= E.max_damage && E.germ_level >= INFECTION_LEVEL_TWO)
+ else if(E.organ_damage >= E.max_damage && E.germ_level >= INFECTION_LEVEL_TWO)
wound_flavor_text[E.name] += "[use_His] [E.name] is likely beyond saving, and has begun to decay!
"
for(var/datum/wound/wound in E.wounds)
diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm
index e6dbd75befee..5b102e1fdf9d 100644
--- a/code/modules/mob/living/carbon/human/human.dm
+++ b/code/modules/mob/living/carbon/human/human.dm
@@ -487,7 +487,7 @@
SPAN_DANGER("Your movement jostles [O] in your [organ.name] painfully."), \
SPAN_DANGER("Your movement jostles [O] in your [organ.name] painfully."))
custom_pain(msg,40,affecting = organ)
- organ.take_external_damage(rand(1,3) + O.w_class, DAM_EDGE, 0)
+ organ.take_damage(rand(1,3) + O.w_class, BRUTE, damage_flags = DAM_EDGE)
/mob/living/carbon/human/proc/set_bodytype(var/decl/bodytype/new_bodytype)
if(ispath(new_bodytype))
@@ -886,7 +886,7 @@
status += "is irrecoverably damaged"
else
status += "is grey and necrotic"
- else if(org.damage >= org.max_damage && org.germ_level >= INFECTION_LEVEL_TWO)
+ else if(org.organ_damage >= org.max_damage && org.germ_level >= INFECTION_LEVEL_TWO)
status += "is likely beyond saving, and has begun to decay"
if(!org.is_usable() || org.is_dislocated())
status += "dangling uselessly"
@@ -914,8 +914,8 @@
shock_stage = min(shock_stage, 100) // 120 is the point at which the heart stops.
var/oxyloss_threshold = round(species.total_health * 0.35)
- if(getOxyLoss() >= oxyloss_threshold)
- setOxyLoss(oxyloss_threshold)
+ if(get_damage(OXY) >= oxyloss_threshold)
+ set_damage(oxyloss_threshold, OXY)
heart.pulse = PULSE_NORM
heart.handle_pulse()
return TRUE
@@ -934,7 +934,7 @@
//Point at which you dun breathe no more. Separate from asystole crit, which is heart-related.
/mob/living/carbon/human/nervous_system_failure()
- return getBrainLoss() >= get_max_health() * 0.75
+ return get_brain_damage() >= get_max_health() * 0.75
/mob/living/carbon/human/melee_accuracy_mods()
. = ..()
@@ -997,7 +997,7 @@
..()
if(should_have_organ(BP_STOMACH))
var/obj/item/organ/internal/stomach = GET_INTERNAL_ORGAN(src, BP_STOMACH)
- if(!stomach || stomach.is_broken() || (stomach.is_bruised() && prob(stomach.damage)))
+ if(!stomach || stomach.is_broken() || (stomach.is_bruised() && prob(stomach.organ_damage)))
if(should_have_organ(BP_HEART))
vessel.trans_to_obj(vomit, 5)
else
diff --git a/code/modules/mob/living/carbon/human/human_attackhand.dm b/code/modules/mob/living/carbon/human/human_attackhand.dm
index 50172253223d..b291d3c30b3d 100644
--- a/code/modules/mob/living/carbon/human/human_attackhand.dm
+++ b/code/modules/mob/living/carbon/human/human_attackhand.dm
@@ -158,7 +158,7 @@
// Apply additional unarmed effects.
attack.apply_effects(H, src, rand_damage, hit_zone)
// Finally, apply damage to target
- apply_damage(real_damage, attack.get_damage_type(), hit_zone, damage_flags=attack.damage_flags())
+ take_damage(real_damage, attack.get_damage_type(), hit_zone, damage_flags=attack.damage_flags())
return TRUE
/mob/living/carbon/human/attack_hand(mob/user)
diff --git a/code/modules/mob/living/carbon/human/human_damage.dm b/code/modules/mob/living/carbon/human/human_damage.dm
index 5f5928aa041d..8d329bf0e5ec 100644
--- a/code/modules/mob/living/carbon/human/human_damage.dm
+++ b/code/modules/mob/living/carbon/human/human_damage.dm
@@ -1,29 +1,33 @@
+/mob/living/carbon/human/proc/get_suffocation_percent()
+ return (get_damage(OXY) / species.total_health) * 100
+
+// Special override as humans ignore body damage.
/mob/living/carbon/human/get_total_life_damage()
- return getBrainLoss()
+ return get_brain_damage()
//Updates the mob's health from organs and mob damage variables
/mob/living/carbon/human/update_health()
..()
//TODO: fix husking
- if(stat == DEAD && (get_max_health() - getFireLoss()) < get_config_value(/decl/config/num/health_health_threshold_dead))
+ if(stat == DEAD && (get_max_health() - get_damage(/decl/damage_handler/burn)) < get_config_value(/decl/config/num/health_health_threshold_dead))
make_husked()
-/mob/living/carbon/human/adjustBrainLoss(var/amount, var/do_update_health = TRUE)
+/mob/living/carbon/human/adjust_brain_damage(var/amount)
if(!(status_flags & GODMODE) && should_have_organ(BP_BRAIN))
var/obj/item/organ/internal/sponge = GET_INTERNAL_ORGAN(src, BP_BRAIN)
if(sponge)
- sponge.take_internal_damage(amount)
+ sponge.take_damage(amount, TOX)
..()
-/mob/living/carbon/human/setBrainLoss(var/amount)
+/mob/living/carbon/human/set_brain_damage(var/amount)
if(status_flags & GODMODE) return 0 //godmode
if(should_have_organ(BP_BRAIN))
var/obj/item/organ/internal/sponge = GET_INTERNAL_ORGAN(src, BP_BRAIN)
if(sponge)
- sponge.damage = min(max(amount, 0),sponge.species.total_health)
+ sponge.organ_damage = min(max(amount, 0),sponge.species.total_health)
update_health()
-/mob/living/carbon/human/getBrainLoss()
+/mob/living/carbon/human/get_brain_damage()
if(status_flags & GODMODE) return 0 //godmode
if(should_have_organ(BP_BRAIN))
var/obj/item/organ/internal/sponge = GET_INTERNAL_ORGAN(src, BP_BRAIN)
@@ -31,197 +35,17 @@
if(sponge.status & ORGAN_DEAD)
return sponge.species.total_health
else
- return sponge.damage
+ return sponge.organ_damage
else
return species.total_health
return 0
-//Straight pain values, not affected by painkillers etc
-/mob/living/carbon/human/getHalLoss()
- if(isnull(last_pain))
- last_pain = 0
- for(var/obj/item/organ/external/E in get_external_organs())
- last_pain += E.get_pain()
- return last_pain
-
-/mob/living/carbon/human/setHalLoss(var/amount)
- adjustHalLoss(getHalLoss()-amount)
-
-/mob/living/carbon/human/adjustHalLoss(var/amount, var/do_update_health = TRUE)
- var/heal = (amount < 0)
- amount = abs(amount)
- var/list/limbs = get_external_organs()
- if(LAZYLEN(limbs))
- var/list/pick_organs = limbs.Copy()
- while(amount > 0 && pick_organs.len)
- var/obj/item/organ/external/E = pick(pick_organs)
- pick_organs -= E
- if(!istype(E))
- continue
-
- if(heal)
- amount -= E.remove_pain(amount)
- else
- amount -= E.add_pain(amount)
- BITSET(hud_updateflag, HEALTH_HUD)
- if(do_update_health)
- update_health()
-
-//These procs fetch a cumulative total damage from all organs
-/mob/living/carbon/human/getBruteLoss()
- var/amount = 0
- for(var/obj/item/organ/external/O in get_external_organs())
- if(BP_IS_PROSTHETIC(O) && !O.is_vital_to_owner())
- continue //robot limbs don't count towards shock and crit
- amount += O.brute_dam
- return amount
-
-/mob/living/carbon/human/getFireLoss()
- var/amount = 0
- for(var/obj/item/organ/external/O in get_external_organs())
- if(BP_IS_PROSTHETIC(O) && !O.is_vital_to_owner())
- continue //robot limbs don't count towards shock and crit
- amount += O.burn_dam
- return amount
-
-/mob/living/carbon/human/adjustBruteLoss(var/amount, var/do_update_health = TRUE)
- SHOULD_CALL_PARENT(FALSE) // take/heal overall call update_health regardless of arg
- if(amount > 0)
- take_overall_damage(amount, 0)
- else
- heal_overall_damage(-amount, 0)
- BITSET(hud_updateflag, HEALTH_HUD)
-
-/mob/living/carbon/human/adjustFireLoss(var/amount, var/do_update_health = TRUE)
- if(amount > 0)
- take_overall_damage(0, amount)
- else
- heal_overall_damage(0, -amount)
- BITSET(hud_updateflag, HEALTH_HUD)
-
-/mob/living/carbon/human/getCloneLoss()
- var/amount = 0
- for(var/obj/item/organ/external/E in get_external_organs())
- amount += E.get_genetic_damage()
- return amount
-
-/mob/living/carbon/human/setCloneLoss(var/amount)
- adjustCloneLoss(getCloneLoss()-amount)
-
-/mob/living/carbon/human/adjustCloneLoss(var/amount, var/do_update_health = TRUE)
- var/heal = amount < 0
- amount = abs(amount)
- var/list/limbs = get_external_organs()
- if(LAZYLEN(limbs))
- var/list/pick_organs = limbs.Copy()
- while(amount > 0 && pick_organs.len)
- var/obj/item/organ/external/E = pick(pick_organs)
- pick_organs -= E
- if(heal)
- amount -= E.remove_genetic_damage(amount)
- else
- amount -= E.add_genetic_damage(amount)
- BITSET(hud_updateflag, HEALTH_HUD)
- ..()
-
-/mob/living/carbon/human/proc/getOxyLossPercent()
- return (getOxyLoss() / species.total_health) * 100
-
-/mob/living/carbon/human/getOxyLoss()
- if(need_breathe())
- var/obj/item/organ/internal/lungs/breathe_organ = get_organ(get_bodytype().breathing_organ, /obj/item/organ/internal/lungs)
- return breathe_organ ? breathe_organ.oxygen_deprivation : species.total_health
- return 0
-
-/mob/living/carbon/human/setOxyLoss(var/amount)
- adjustOxyLoss(amount - getOxyLoss())
-
-/mob/living/carbon/human/adjustOxyLoss(var/damage, var/do_update_health = TRUE)
- . = FALSE
- if(need_breathe())
- var/obj/item/organ/internal/lungs/breathe_organ = get_organ(get_bodytype().breathing_organ, /obj/item/organ/internal/lungs)
- if(breathe_organ)
- breathe_organ.adjust_oxygen_deprivation(damage)
- BITSET(hud_updateflag, HEALTH_HUD)
- . = TRUE
- ..(do_update_health = FALSE) // Oxyloss cannot directly kill humans
-
-/mob/living/carbon/human/getToxLoss()
- if((species.species_flags & SPECIES_FLAG_NO_POISON) || isSynthetic())
- return 0
- var/amount = 0
- for(var/obj/item/organ/internal/I in get_internal_organs())
- amount += I.getToxLoss()
- return amount
-
-/mob/living/carbon/human/setToxLoss(var/amount)
- if(!(species.species_flags & SPECIES_FLAG_NO_POISON) && !isSynthetic())
- adjustToxLoss(getToxLoss()-amount)
-
-// TODO: better internal organ damage procs.
-/mob/living/carbon/human/adjustToxLoss(var/amount, var/do_update_health = TRUE)
-
- if((species.species_flags & SPECIES_FLAG_NO_POISON) || isSynthetic())
- return
-
- var/heal = amount < 0
- amount = abs(amount)
-
- if (!heal)
- amount *= get_toxin_resistance()
- var/antitox = GET_CHEMICAL_EFFECT(src, CE_ANTITOX)
- if(antitox)
- amount *= 1 - antitox * 0.25
-
- var/list/pick_organs = get_internal_organs()
- if(!LAZYLEN(pick_organs))
- return
- pick_organs = shuffle(pick_organs.Copy())
-
- // Prioritize damaging our filtration organs first.
- for(var/organ in list(BP_KIDNEYS, BP_LIVER))
- var/obj/item/organ/internal/lump = GET_INTERNAL_ORGAN(src, organ)
- if(lump)
- pick_organs -= lump
- pick_organs.Insert(1, lump)
-
- // Move the brain to the very end since damage to it is vastly more dangerous
- // (and isn't technically counted as toxloss) than general organ damage.
- var/obj/item/organ/internal/brain = GET_INTERNAL_ORGAN(src, BP_BRAIN)
- if(brain)
- pick_organs -= brain
- pick_organs += brain
-
- for(var/internal in pick_organs)
- var/obj/item/organ/internal/I = internal
- if(amount <= 0)
- break
- if(heal)
- if(I.damage < amount)
- amount -= I.damage
- I.damage = 0
- else
- I.damage -= amount
- amount = 0
- else
- var/cap_dam = I.max_damage - I.damage
- if(amount >= cap_dam)
- I.take_internal_damage(cap_dam, silent=TRUE)
- amount -= cap_dam
- else
- I.take_internal_damage(amount, silent=TRUE)
- amount = 0
-
- if(do_update_health)
- update_health()
-
/mob/living/carbon/human/proc/can_autoheal(var/dam_type)
if(!species || !dam_type) return FALSE
-
if(dam_type == BRUTE)
- return(getBruteLoss() < species.total_health / 2)
+ return(get_damage(BRUTE) < species.total_health / 2)
else if(dam_type == BURN)
- return(getFireLoss() < species.total_health / 2)
+ return(get_damage(BURN) < species.total_health / 2)
return FALSE
////////////////////////////////////////////
@@ -242,80 +66,6 @@
parts += O
return parts
-//Heals ONE external organ, organ gets randomly selected from damaged ones.
-//It automatically updates damage overlays if necesary
-//It automatically updates health status
-/mob/living/carbon/human/heal_organ_damage(var/brute, var/burn, var/affect_robo = FALSE, var/update_health = TRUE)
- var/list/obj/item/organ/external/parts = get_damaged_organs(brute,burn)
- if(!parts.len) return
- var/obj/item/organ/external/picked = pick(parts)
- if(picked.heal_damage(brute,burn,robo_repair = affect_robo))
- BITSET(hud_updateflag, HEALTH_HUD)
- update_health()
-
-
-//TODO reorganize damage procs so that there is a clean API for damaging living mobs
-
-/*
-In most cases it makes more sense to use apply_damage() instead! And make sure to check armour if applicable.
-*/
-//Damages ONE external organ, organ gets randomly selected from damagable ones.
-//It automatically updates damage overlays if necesary
-//It automatically updates health status
-/mob/living/carbon/human/take_organ_damage(var/brute = 0, var/burn = 0, var/bypass_armour = FALSE, var/override_droplimb)
- var/list/parts = get_damageable_organs()
- if(!length(parts))
- return
- var/obj/item/organ/external/picked = pick(parts)
- if(picked.take_external_damage(brute, burn, override_droplimb = override_droplimb))
- BITSET(hud_updateflag, HEALTH_HUD)
- update_health()
-
-//Heal MANY external organs, in random order
-/mob/living/carbon/human/heal_overall_damage(var/brute, var/burn)
- var/list/obj/item/organ/external/parts = get_damaged_organs(brute,burn)
-
- while(parts.len && (brute>0 || burn>0) )
- var/obj/item/organ/external/picked = pick(parts)
-
- var/brute_was = picked.brute_dam
- var/burn_was = picked.burn_dam
-
- picked.heal_damage(brute,burn)
-
- brute -= (brute_was-picked.brute_dam)
- burn -= (burn_was-picked.burn_dam)
-
- parts -= picked
- update_health()
- BITSET(hud_updateflag, HEALTH_HUD)
-
-// damage MANY external organs, in random order
-/mob/living/carbon/human/take_overall_damage(var/brute, var/burn, var/sharp = 0, var/edge = 0, var/used_weapon = null)
- if(status_flags & GODMODE)
- return //godmode
-
- var/list/obj/item/organ/external/parts = get_damageable_organs()
- if(!parts.len)
- return
-
- var/dam_flags = (sharp? DAM_SHARP : 0)|(edge? DAM_EDGE : 0)
- var/brute_avg = brute / parts.len
- var/burn_avg = burn / parts.len
- for(var/obj/item/organ/external/E in parts)
- if(QDELETED(E))
- continue
- if(E.owner != src)
- continue // The code below may affect the children of an organ.
-
- if(brute_avg)
- apply_damage(damage = brute_avg, damagetype = BRUTE, damage_flags = dam_flags, used_weapon = used_weapon, silent = TRUE, given_organ = E)
- if(burn_avg)
- apply_damage(damage = burn_avg, damagetype = BURN, damage_flags = dam_flags, used_weapon = used_weapon, silent = TRUE, given_organ = E)
-
- update_health()
- BITSET(hud_updateflag, HEALTH_HUD)
-
/*
This function restores all organs.
*/
@@ -328,76 +78,13 @@ This function restores all organs.
recheck_bad_external_organs()
verbs -= /mob/living/carbon/human/proc/undislocate
-/mob/living/carbon/human/proc/HealDamage(zone, brute, burn)
- var/obj/item/organ/external/E = GET_EXTERNAL_ORGAN(src, zone)
- if(!E)
- return FALSE
- if(E.heal_damage(brute, burn))
- BITSET(hud_updateflag, HEALTH_HUD)
-
-/mob/living/carbon/human/apply_damage(var/damage = 0, var/damagetype = BRUTE, var/def_zone = null, var/damage_flags = 0, var/obj/used_weapon = null, var/armor_pen, var/silent = FALSE, var/obj/item/organ/external/given_organ = null)
- if(status_flags & GODMODE) return //godmode
- var/obj/item/organ/external/organ = given_organ
- if(!organ)
- if(isorgan(def_zone))
- organ = def_zone
- else
- if(!def_zone)
- if(damage_flags & DAM_DISPERSED)
- var/old_damage = damage
- var/tally
- silent = TRUE // Will damage a lot of organs, probably, so avoid spam.
- for(var/zone in organ_rel_size)
- tally += organ_rel_size[zone]
- for(var/zone in organ_rel_size)
- damage = old_damage * organ_rel_size[zone]/tally
- def_zone = zone
- . = .() || .
- return
- def_zone = ran_zone(def_zone, target = src)
- organ = GET_EXTERNAL_ORGAN(src, check_zone(def_zone, src))
-
- //Handle other types of damage
- if(!(damagetype in list(BRUTE, BURN, PAIN, CLONE)))
- return ..()
- if(!istype(organ))
- return 0 // This is reasonable and means the organ is missing.
-
- handle_suit_punctures(damagetype, damage, def_zone)
-
- var/list/after_armor = modify_damage_by_armor(def_zone, damage, damagetype, damage_flags, src, armor_pen, silent)
- damage = after_armor[1]
- damagetype = after_armor[2]
- damage_flags = after_armor[3]
- if(!damage)
- return 0
-
- if(damage > 15 && prob(damage*4) && organ.can_feel_pain())
- make_reagent(round(damage/10), /decl/material/liquid/adrenaline)
- var/datum/wound/created_wound
- damageoverlaytemp = 20
- switch(damagetype)
- if(BRUTE)
- created_wound = organ.take_external_damage(damage, 0, damage_flags, used_weapon)
- if(BURN)
- created_wound = organ.take_external_damage(0, damage, damage_flags, used_weapon)
- if(PAIN)
- organ.add_pain(damage)
- if(CLONE)
- organ.add_genetic_damage(damage)
-
- // Will set our damageoverlay icon to the next level, which will then be set back to the normal level the next mob.Life().
- update_health()
- BITSET(hud_updateflag, HEALTH_HUD)
- return created_wound
-
// Find out in how much pain the mob is at the moment.
/mob/living/carbon/human/proc/get_shock()
if (!can_feel_pain())
return 0
- var/traumatic_shock = getHalLoss()
+ var/traumatic_shock = get_damage(PAIN)
traumatic_shock -= GET_CHEMICAL_EFFECT(src, CE_PAINKILLER)
if(stat == UNCONSCIOUS)
diff --git a/code/modules/mob/living/carbon/human/human_damage_handlers.dm b/code/modules/mob/living/carbon/human/human_damage_handlers.dm
new file mode 100644
index 000000000000..32ecd31134e3
--- /dev/null
+++ b/code/modules/mob/living/carbon/human/human_damage_handlers.dm
@@ -0,0 +1,120 @@
+/mob/living/carbon/human/get_lethal_damage_types()
+ var/static/list/lethal_damage_types = list(
+ BRUTE,
+ BURN,
+ TOX,
+ OXY
+ )
+ return lethal_damage_types
+
+/mob/living/carbon/human/get_handled_damage_types()
+ var/static/list/mob_damage_types = list(
+ BRUTE = /decl/damage_handler/brute/limbs,
+ BURN = /decl/damage_handler/burn/limbs,
+ TOX = /decl/damage_handler/organ/internal,
+ IRRADIATE,
+ ELECTROCUTE,
+ PAIN,
+ OXY,
+ CLONE
+ )
+ return mob_damage_types
+
+/decl/damage_handler/brute/limbs
+ expected_type = /mob/living/carbon/human
+
+/decl/damage_handler/brute/limbs/apply_damage_to_mob(mob/living/target, damage, def_zone, damage_flags, used_weapon, silent)
+ if(!causes_limb_damage)
+ return FALSE
+ var/obj/item/organ/external/organ = GET_EXTERNAL_ORGAN(target, def_zone || ran_zone())
+ if(!organ)
+ return FALSE
+ var/mob/living/carbon/human/target_human = target
+ target_human.handle_suit_punctures(category_type, damage, def_zone)
+ if(damage > 15 && prob(damage*4) && organ.can_feel_pain())
+ target_human.make_reagent(round(damage/10), /decl/material/liquid/adrenaline)
+ target_human.damageoverlaytemp = 20
+ BITSET(target_human.hud_updateflag, HEALTH_HUD)
+ return damage_limb(organ, damage, damage_flags, used_weapon)
+
+/decl/damage_handler/burn/limbs
+ expected_type = /mob/living/carbon/human
+
+/decl/damage_handler/burn/limbs/apply_damage_to_mob(mob/living/target, damage, def_zone, damage_flags, used_weapon, silent)
+ if(!causes_limb_damage)
+ return FALSE
+ var/obj/item/organ/external/organ = GET_EXTERNAL_ORGAN(target, def_zone || ran_zone())
+ if(!organ)
+ return FALSE
+ var/mob/living/carbon/human/target_human = target
+ target_human.handle_suit_punctures(category_type, damage, def_zone)
+ if(damage > 15 && prob(damage*4) && organ.can_feel_pain())
+ target_human.make_reagent(round(damage/10), /decl/material/liquid/adrenaline)
+ target_human.damageoverlaytemp = 20
+ BITSET(target_human.hud_updateflag, HEALTH_HUD)
+ return damage_limb(organ, damage, damage_flags, used_weapon)
+
+/decl/damage_handler/organ/internal/get_damage_for_mob(var/mob/living/target)
+ var/decl/species/my_species = target.get_species()
+ if(my_species && (my_species.species_flags & SPECIES_FLAG_NO_POISON))
+ return 0
+ if(target.isSynthetic())
+ return 0
+ . = 0
+ for(var/obj/item/organ/internal/I in target.get_internal_organs())
+ . += I.get_toxins_damage()
+
+/decl/damage_handler/organ/internal/set_mob_damage(var/mob/living/target, var/damage, var/skip_update_health = FALSE)
+ var/decl/species/my_species = target.get_species()
+ if(my_species && (my_species.species_flags & SPECIES_FLAG_NO_POISON))
+ return FALSE
+ if(target.isSynthetic())
+ return FALSE
+
+ var/amount = damage - get_damage_for_mob(target, category_type)
+ var/heal = amount < 0
+ amount = abs(amount)
+ if(!heal)
+ amount *= target.get_damage_modifier(TOX)
+ var/antitox = GET_CHEMICAL_EFFECT(target, CE_ANTITOX)
+ if(antitox)
+ amount *= 1 - antitox * 0.25
+
+ var/list/pick_organs = target.get_internal_organs()
+ if(!LAZYLEN(pick_organs))
+ return
+ pick_organs = shuffle(pick_organs.Copy())
+
+ // Prioritize damaging our filtration organs first.
+ for(var/organ in list(BP_KIDNEYS, BP_LIVER))
+ var/obj/item/organ/internal/lump = GET_INTERNAL_ORGAN(target, organ)
+ if(lump)
+ pick_organs -= lump
+ pick_organs.Insert(1, lump)
+
+ // Move the brain to the very end since damage to it is vastly more dangerous
+ // (and isn't technically counted as toxloss) than general organ damage.
+ var/obj/item/organ/internal/brain = GET_INTERNAL_ORGAN(target, BP_BRAIN)
+ if(brain)
+ pick_organs -= brain
+ pick_organs += brain
+
+ for(var/internal in pick_organs)
+ var/obj/item/organ/internal/I = internal
+ if(amount <= 0)
+ break
+ if(heal)
+ if(I.organ_damage < amount)
+ amount -= I.organ_damage
+ I.organ_damage = 0
+ else
+ I.organ_damage -= amount
+ amount = 0
+ else
+ var/cap_dam = I.max_damage - I.organ_damage
+ if(amount >= cap_dam)
+ I.take_damage(cap_dam, TOX, silent=TRUE)
+ amount -= cap_dam
+ else
+ I.take_damage(amount, TOX, silent=TRUE)
+ amount = 0
diff --git a/code/modules/mob/living/carbon/human/human_defense.dm b/code/modules/mob/living/carbon/human/human_defense.dm
index 0999068197b1..941404471898 100644
--- a/code/modules/mob/living/carbon/human/human_defense.dm
+++ b/code/modules/mob/living/carbon/human/human_defense.dm
@@ -339,7 +339,7 @@ meteor_act
var/datum/wound/created_wound
visible_message(SPAN_DANGER("\The [src] has been hit in \the [affecting.name] by \the [O]."))
- created_wound = apply_damage(throw_damage, dtype, zone, O.damage_flags(), O, O.armor_penetration)
+ created_wound = take_damage(throw_damage, dtype, zone, O.damage_flags(), O, O.armor_penetration)
if(TT.thrower)
var/client/assailant = TT.thrower.client
@@ -500,12 +500,12 @@ meteor_act
SET_STATUS_MAX(src, STAT_PARA, 10)
// focus most of the blast on one organ
- apply_damage(0.7 * b_loss, BRUTE, null, DAM_EXPLODE, used_weapon = "Explosive blast")
- apply_damage(0.7 * f_loss, BURN, null, DAM_EXPLODE, used_weapon = "Explosive blast")
+ take_damage(0.7 * b_loss, BRUTE, null, DAM_EXPLODE, used_weapon = "Explosive blast")
+ take_damage(0.7 * f_loss, BURN, null, DAM_EXPLODE, used_weapon = "Explosive blast")
// distribute the remaining 30% on all limbs equally (including the one already dealt damage)
- apply_damage(0.3 * b_loss, BRUTE, null, DAM_EXPLODE | DAM_DISPERSED, used_weapon = "Explosive blast")
- apply_damage(0.3 * f_loss, BURN, null, DAM_EXPLODE | DAM_DISPERSED, used_weapon = "Explosive blast")
+ take_damage(0.3 * b_loss, BRUTE, null, DAM_EXPLODE | DAM_DISPERSED, used_weapon = "Explosive blast")
+ take_damage(0.3 * f_loss, BURN, null, DAM_EXPLODE | DAM_DISPERSED, used_weapon = "Explosive blast")
//Used by various things that knock people out by applying blunt trauma to the head.
//Checks that the species has a "head" (brain containing organ) and that hit_zone refers to it.
diff --git a/code/modules/mob/living/carbon/human/human_helpers.dm b/code/modules/mob/living/carbon/human/human_helpers.dm
index d8020db5befa..b154ccdf889c 100644
--- a/code/modules/mob/living/carbon/human/human_helpers.dm
+++ b/code/modules/mob/living/carbon/human/human_helpers.dm
@@ -193,28 +193,28 @@
switch(safety)
if(FLASH_PROTECTION_MODERATE)
to_chat(src, "Your eyes sting a little.")
- E.damage += rand(1, 2)
- if(E.damage > 12)
+ E.organ_damage += rand(1, 2)
+ if(E.organ_damage > 12)
ADJ_STATUS(src, STAT_BLURRY, rand(3,6))
if(FLASH_PROTECTION_MINOR)
to_chat(src, "Your eyes stings!")
- E.damage += rand(1, 4)
- if(E.damage > 10)
+ E.organ_damage += rand(1, 4)
+ if(E.organ_damage > 10)
ADJ_STATUS(src, STAT_BLURRY, rand(3,6))
- E.damage += rand(1, 4)
+ E.organ_damage += rand(1, 4)
if(FLASH_PROTECTION_NONE)
to_chat(src, "Your eyes burn!")
- E.damage += rand(2, 4)
- if(E.damage > 10)
- E.damage += rand(4,10)
+ E.organ_damage += rand(2, 4)
+ if(E.organ_damage > 10)
+ E.organ_damage += rand(4,10)
if(FLASH_PROTECTION_REDUCED)
to_chat(src, "Your equipment intensifies the welder's glow. Your eyes itch and burn severely.")
ADJ_STATUS(src, STAT_BLURRY, rand(12,20))
- E.damage += rand(12, 16)
+ E.organ_damage += rand(12, 16)
if(safety 10)
+ if(E.organ_damage > 10)
to_chat(src, "Your eyes are really starting to hurt. This can't be good for you!")
- if (E.damage >= E.min_bruised_damage)
+ if (E.organ_damage >= E.min_bruised_damage)
to_chat(src, "You go blind!")
SET_STATUS_MAX(src, STAT_BLIND, 5)
SET_STATUS_MAX(src, STAT_BLURRY, 5)
diff --git a/code/modules/mob/living/carbon/human/human_organs.dm b/code/modules/mob/living/carbon/human/human_organs.dm
index 2573c969a207..906a1e6a87b8 100644
--- a/code/modules/mob/living/carbon/human/human_organs.dm
+++ b/code/modules/mob/living/carbon/human/human_organs.dm
@@ -10,7 +10,7 @@
return E?.name
/mob/living/carbon/human/proc/should_recheck_bad_external_organs()
- var/damage_this_tick = getToxLoss()
+ var/damage_this_tick = get_damage(TOX)
for(var/obj/item/organ/external/O in get_external_organs())
damage_this_tick += O.burn_dam + O.brute_dam
diff --git a/code/modules/mob/living/carbon/human/human_species.dm b/code/modules/mob/living/carbon/human/human_species.dm
index 71eb35481c60..375307214573 100644
--- a/code/modules/mob/living/carbon/human/human_species.dm
+++ b/code/modules/mob/living/carbon/human/human_species.dm
@@ -37,8 +37,8 @@
/mob/living/carbon/human/corpse/LateInitialize()
..()
var/current_max_health = get_max_health()
- adjustOxyLoss(current_max_health)//cease life functions
- setBrainLoss(current_max_health)
+ take_damage(current_max_health, OXY)//cease life functions
+ set_brain_damage(current_max_health)
death(FALSE, deathmessage = "no message", show_dead_message = FALSE)
var/obj/item/organ/internal/heart/corpse_heart = get_organ(BP_HEART, /obj/item/organ/internal/heart)
if(corpse_heart)
diff --git a/code/modules/mob/living/carbon/human/human_verbs.dm b/code/modules/mob/living/carbon/human/human_verbs.dm
index f83e9512aee9..a05a2c8e4afc 100644
--- a/code/modules/mob/living/carbon/human/human_verbs.dm
+++ b/code/modules/mob/living/carbon/human/human_verbs.dm
@@ -312,7 +312,7 @@
"[self ? "You pop" : "[U] pops"] your [current_limb.joint] in the WRONG place!" \
)
current_limb.add_pain(30)
- current_limb.take_external_damage(5)
+ current_limb.take_damage(5, BRUTE)
shock_stage += 20
else
visible_message( \
diff --git a/code/modules/mob/living/carbon/human/life.dm b/code/modules/mob/living/carbon/human/life.dm
index 7ef04191c853..021f3ac4dbe8 100644
--- a/code/modules/mob/living/carbon/human/life.dm
+++ b/code/modules/mob/living/carbon/human/life.dm
@@ -141,9 +141,9 @@
cough()
/mob/living/carbon/human/handle_mutations_and_radiation()
- if(getFireLoss())
+ if(get_damage(BURN))
if((MUTATION_COLD_RESISTANCE in mutations) || (prob(1)))
- heal_organ_damage(0,1)
+ heal_damage(1, BURN)
// DNA2 - Gene processing.
var/list/all_genes = decls_repository.get_decls_of_subtype(/decl/gene)
@@ -221,7 +221,7 @@
burn_dam = HEAT_DAMAGE_LEVEL_2
else
burn_dam = HEAT_DAMAGE_LEVEL_3
- take_overall_damage(burn=burn_dam, used_weapon = "High Body Temperature")
+ take_damage(burn_dam, BURN, used_weapon = "High Body Temperature")
fire_alert = max(fire_alert, 2)
else if(bodytemperature <= get_mob_temperature_threshold(COLD_LEVEL_1))
@@ -238,7 +238,7 @@
burn_dam = COLD_DAMAGE_LEVEL_3
set_stasis(get_cryogenic_factor(bodytemperature), STASIS_COLD)
if(!has_chemical_effect(CE_CRYO, 1))
- take_overall_damage(burn=burn_dam, used_weapon = "Low Body Temperature")
+ take_damage(burn_dam, BURN, used_weapon = "Low Body Temperature")
fire_alert = max(fire_alert, 1)
// Account for massive pressure differences. Done by Polymorph
@@ -247,7 +247,7 @@
if(adjusted_pressure >= species.hazard_high_pressure)
var/pressure_damage = min( ( (adjusted_pressure / species.hazard_high_pressure) -1 )*PRESSURE_DAMAGE_COEFFICIENT , MAX_HIGH_PRESSURE_DAMAGE)
- take_overall_damage(brute=pressure_damage, used_weapon = "High Pressure")
+ take_damage(pressure_damage, BRUTE, used_weapon = "High Pressure")
pressure_alert = 2
else if(adjusted_pressure >= species.warning_high_pressure)
pressure_alert = 1
@@ -260,10 +260,10 @@
for(var/obj/item/organ/external/O in parts)
if(QDELETED(O) || !(O.owner == src))
continue
- if(O.damage + (LOW_PRESSURE_DAMAGE) < O.min_broken_damage) //vacuum does not break bones
- O.take_external_damage(brute = LOW_PRESSURE_DAMAGE, used_weapon = "Low Pressure")
- if(getOxyLossPercent() < 55) // 11 OxyLoss per 4 ticks when wearing internals; unconsciousness in 16 ticks, roughly half a minute
- adjustOxyLoss(4) // 16 OxyLoss per 4 ticks when no internals present; unconsciousness in 13 ticks, roughly twenty seconds
+ if(O.organ_damage + (LOW_PRESSURE_DAMAGE) < O.min_broken_damage) //vacuum does not break bones
+ O.take_damage(LOW_PRESSURE_DAMAGE, BRUTE, used_weapon = "Low Pressure")
+ if(get_suffocation_percent() < 55) // 11 OxyLoss per 4 ticks when wearing internals; unconsciousness in 16 ticks, roughly half a minute
+ take_damage(4, OXY) // 16 OxyLoss per 4 ticks when no internals present; unconsciousness in 13 ticks, roughly twenty seconds
pressure_alert = -2
return
@@ -366,7 +366,7 @@
for(var/obj/item/I in src)
if(I.contaminated)
total_contamination += vsc.contaminant_control.CONTAMINATION_LOSS
- adjustToxLoss(total_contamination)
+ take_damage(total_contamination, TOX)
. = ..()
if(!.)
@@ -384,7 +384,7 @@
if(HAS_STATUS(src, STAT_PARA) || HAS_STATUS(src, STAT_ASLEEP))
set_stat(UNCONSCIOUS)
animate_tail_reset()
- adjustHalLoss(-3)
+ heal_damage(3, PAIN)
if(prob(2) && is_asystole() && isSynthetic())
visible_message("[src] [pick("emits low pitched whirr","beeps urgently")].")
else
@@ -402,13 +402,13 @@
ADJ_STATUS(src, STAT_DIZZY, -15)
if(HAS_STATUS(src, STAT_JITTER))
ADJ_STATUS(src, STAT_JITTER, -15)
- adjustHalLoss(-3)
+ heal_damage(3, PAIN)
else
if(HAS_STATUS(src, STAT_DIZZY))
ADJ_STATUS(src, STAT_DIZZY, -3)
if(HAS_STATUS(src, STAT_JITTER))
ADJ_STATUS(src, STAT_JITTER, -3)
- adjustHalLoss(-1)
+ heal_damage(1, PAIN)
if(HAS_STATUS(src, STAT_DROWSY))
SET_STATUS_MAX(src, STAT_BLURRY, 2)
@@ -450,9 +450,9 @@
else
clear_fullscreen("crit")
//Oxygen damage overlay
- if(getOxyLoss())
+ if(get_damage(OXY))
var/severity = 0
- switch(getOxyLossPercent())
+ switch(get_suffocation_percent())
if(10 to 20) severity = 1
if(20 to 25) severity = 2
if(25 to 30) severity = 3
@@ -465,7 +465,7 @@
clear_fullscreen("oxy")
//Fire and Brute damage overlay (BSSR)
- var/hurtdamage = src.getBruteLoss() + src.getFireLoss() + damageoverlaytemp
+ var/hurtdamage = get_damage(BRUTE) + get_damage(BURN) + damageoverlaytemp
damageoverlaytemp = 0 // We do this so we can detect if someone hits us or not.
if(hurtdamage)
var/severity = 0
@@ -608,11 +608,11 @@
for(var/tag in list(BP_LIVER,BP_KIDNEYS))
var/obj/item/organ/internal/I = GET_INTERNAL_ORGAN(src, tag)
if(I)
- vomit_score += I.damage
+ vomit_score += I.organ_damage
else if (should_have_organ(tag))
vomit_score += 45
- if(has_chemical_effect(CE_TOXIN, 1) || radiation)
- vomit_score += 0.5 * getToxLoss()
+ if(has_chemical_effect(CE_TOXIN, 1) || get_damage(IRRADIATE))
+ vomit_score += 0.5 * get_damage(TOX)
if(has_chemical_effect(CE_ALCOHOL_TOXIC, 1))
vomit_score += 10 * GET_CHEMICAL_EFFECT(src, CE_ALCOHOL_TOXIC)
if(has_chemical_effect(CE_ALCOHOL, 1))
@@ -850,7 +850,7 @@
for(var/obj/item/organ/external/E in get_external_organs())
if(!(E.body_part & protected_limbs) && prob(20))
- E.take_external_damage(burn = round(species_heat_mod * log(10, (burn_temperature + 10)), 0.1), used_weapon = "fire")
+ E.take_damage(round(species_heat_mod * log(10, (burn_temperature + 10)), 0.1), BURN, used_weapon = "fire")
/mob/living/carbon/human/rejuvenate()
reset_blood()
diff --git a/code/modules/mob/living/carbon/human/unarmed_attack.dm b/code/modules/mob/living/carbon/human/unarmed_attack.dm
index e693d21e9065..da4c40e4646b 100644
--- a/code/modules/mob/living/carbon/human/unarmed_attack.dm
+++ b/code/modules/mob/living/carbon/human/unarmed_attack.dm
@@ -119,11 +119,12 @@ var/global/list/sparring_attack_cache = list()
target.visible_message( \
SPAN_WARNING("\The [target] looks like [G.he] [G.is] in pain!"), \
SPAN_WARNING(G.get_message_for_being_kicked_in_the_dick()))
- target.apply_effects(stutter = attack_damage * 2, agony = attack_damage* 3, blocked = armour)
+ target.apply_effects(stutter = attack_damage * 2, blocked = armour)
+ target.take_damage(attack_damage*3, PAIN)
if(BP_L_LEG, BP_L_FOOT, BP_R_LEG, BP_R_FOOT)
if(!target.lying)
target.visible_message("[target] gives way slightly.")
- target.apply_effect(attack_damage*3, PAIN, armour)
+ target.take_damage(attack_damage*3, PAIN)
else if(attack_damage >= 5 && !(target == user) && (stun_chance + attack_damage * 5 >= 100) && armour < 1) // Chance to get the usual throwdown as well (25% standard chance)
if(!target.lying)
target.visible_message("[target] [pick("slumps", "falls", "drops")] down to the ground!")
@@ -150,7 +151,7 @@ var/global/list/sparring_attack_cache = list()
var/obj/item/organ/internal/eyes = GET_INTERNAL_ORGAN(target, BP_EYES)
var/decl/pronouns/G = user.get_pronouns()
if(eyes)
- eyes.take_internal_damage(rand(3,4), 1)
+ eyes.take_damage(rand(3,4), BRUTE, silent=TRUE)
user.visible_message(SPAN_DANGER("\The [user] jams [G.his] [eye_attack_text] into \the [target]'s [eyes.name]!"))
if(eyes.can_feel_pain())
to_chat(target, SPAN_DANGER("You experience immense pain as [eye_attack_text_victim] are jammed into your [eyes.name]!"))
diff --git a/code/modules/mob/living/carbon/resist.dm b/code/modules/mob/living/carbon/resist.dm
index 0e7af051b096..4ad8f45badc0 100644
--- a/code/modules/mob/living/carbon/resist.dm
+++ b/code/modules/mob/living/carbon/resist.dm
@@ -80,7 +80,7 @@
return
if (cuffs.can_take_damage() && cuffs.health > 0) // Improvised cuffs can break because their health is > 0
var/cuffs_name = "\the [cuffs]"
- cuffs.take_damage(cuffs.max_health / 2)
+ cuffs.take_damage(cuffs.max_health / 2, BRUTE)
if (QDELETED(cuffs) || cuffs.health < 1)
visible_message(
SPAN_DANGER("\The [src] manages to remove [cuffs_name], breaking them!"),
diff --git a/code/modules/mob/living/damage_procs.dm b/code/modules/mob/living/damage_procs.dm
index 1b1257a75d20..3baf5470730e 100644
--- a/code/modules/mob/living/damage_procs.dm
+++ b/code/modules/mob/living/damage_procs.dm
@@ -1,65 +1,3 @@
-/*
- apply_damage() args
- damage - How much damage to take
- damage_type - What type of damage to take, brute, burn
- def_zone - Where to take the damage if its brute or burn
-
- Returns
- standard 0 if fail
-*/
-/mob/living/apply_damage(var/damage = 0,var/damagetype = BRUTE, var/def_zone = null, var/damage_flags = 0, var/used_weapon = null, var/armor_pen, var/silent = FALSE)
-
- if(status_flags & GODMODE)
- return FALSE
-
- if(!damage)
- return FALSE
-
- var/list/after_armor = modify_damage_by_armor(def_zone, damage, damagetype, damage_flags, src, armor_pen, silent)
- damage = after_armor[1]
- damagetype = after_armor[2]
- damage_flags = after_armor[3] // args modifications in case of parent calls
- if(!damage)
- return FALSE
-
- switch(damagetype)
- if(BRUTE)
- adjustBruteLoss(damage)
- if(BURN)
- if(MUTATION_COLD_RESISTANCE in mutations)
- return
- adjustFireLoss(damage)
- if(TOX)
- adjustToxLoss(damage)
- if(OXY)
- adjustOxyLoss(damage)
- if(CLONE)
- adjustCloneLoss(damage)
- if(PAIN)
- adjustHalLoss(damage)
- if(ELECTROCUTE)
- electrocute_act(damage, used_weapon, 1, def_zone)
- if(IRRADIATE)
- apply_radiation(damage)
- return TRUE
-
-
-/mob/living/proc/apply_radiation(var/damage = 0)
- if(!damage)
- return FALSE
-
- radiation = max(0, radiation + damage)
- return TRUE
-
-/mob/living/proc/apply_damages(var/brute = 0, var/burn = 0, var/tox = 0, var/oxy = 0, var/clone = 0, var/halloss = 0, var/def_zone = null, var/damage_flags = 0)
- if(brute) apply_damage(brute, BRUTE, def_zone)
- if(burn) apply_damage(burn, BURN, def_zone)
- if(tox) apply_damage(tox, TOX, def_zone)
- if(oxy) apply_damage(oxy, OXY, def_zone)
- if(clone) apply_damage(clone, CLONE, def_zone)
- if(halloss) apply_damage(halloss, PAIN, def_zone)
- return TRUE
-
/mob/living/apply_effect(var/effect = 0,var/effecttype = STUN, var/blocked = 0)
if(!effect || (blocked >= 100)) return FALSE
switch(effecttype)
@@ -69,8 +7,6 @@
SET_STATUS_MAX(src, STAT_WEAK, effect * blocked_mult(blocked))
if(PARALYZE)
SET_STATUS_MAX(src, STAT_PARA, effect * blocked_mult(blocked))
- if(PAIN)
- adjustHalLoss(effect * blocked_mult(blocked))
if(STUTTER)
if(status_flags & CANSTUN) // stun is usually associated with stutter - TODO CANSTUTTER flag?
SET_STATUS_MAX(src, STAT_STUTTER, effect * blocked_mult(blocked))
@@ -80,12 +16,11 @@
SET_STATUS_MAX(src, STAT_DROWSY, effect * blocked_mult(blocked))
return TRUE
-/mob/living/proc/apply_effects(var/stun = 0, var/weaken = 0, var/paralyze = 0, var/stutter = 0, var/eyeblur = 0, var/drowsy = 0, var/agony = 0, var/blocked = 0)
- if(stun) apply_effect(stun, STUN, blocked)
- if(weaken) apply_effect(weaken, WEAKEN, blocked)
+/mob/living/proc/apply_effects(var/stun = 0, var/weaken = 0, var/paralyze = 0, var/stutter = 0, var/eyeblur = 0, var/drowsy = 0, var/blocked = 0)
+ if(stun) apply_effect(stun, STUN, blocked)
+ if(weaken) apply_effect(weaken, WEAKEN, blocked)
if(paralyze) apply_effect(paralyze, PARALYZE, blocked)
- if(stutter) apply_effect(stutter, STUTTER, blocked)
+ if(stutter) apply_effect(stutter, STUTTER, blocked)
if(eyeblur) apply_effect(eyeblur, EYE_BLUR, blocked)
- if(drowsy) apply_effect(drowsy, DROWSY, blocked)
- if(agony) apply_effect(agony, PAIN, blocked)
+ if(drowsy) apply_effect(drowsy, DROWSY, blocked)
return TRUE
diff --git a/code/modules/mob/living/deity/forms/narsie.dm b/code/modules/mob/living/deity/forms/narsie.dm
index 99b9255d7cc5..a626bc30d676 100644
--- a/code/modules/mob/living/deity/forms/narsie.dm
+++ b/code/modules/mob/living/deity/forms/narsie.dm
@@ -45,5 +45,5 @@
if(istype(H) && H.should_have_organ(BP_HEART))
H.vessel.remove_any(charge)
else
- user.adjustBruteLoss(charge)
+ user.take_damage(charge, BRUTE)
return 1
\ No newline at end of file
diff --git a/code/modules/mob/living/deity/forms/starlight.dm b/code/modules/mob/living/deity/forms/starlight.dm
index 9a0f14f5445f..4d4e7b69bebe 100644
--- a/code/modules/mob/living/deity/forms/starlight.dm
+++ b/code/modules/mob/living/deity/forms/starlight.dm
@@ -43,5 +43,5 @@
charge = max(5, charge/100)
if(prob(charge))
to_chat(user, "Your body burns!")
- user.adjustFireLoss(charge)
+ user.take_damage(charge, BURN)
return 1
\ No newline at end of file
diff --git a/code/modules/mob/living/deity/phenomena/communication.dm b/code/modules/mob/living/deity/phenomena/communication.dm
index 9a76f59dba81..77d998d5e5c3 100644
--- a/code/modules/mob/living/deity/phenomena/communication.dm
+++ b/code/modules/mob/living/deity/phenomena/communication.dm
@@ -65,16 +65,16 @@
linked.adjust_power(-punishment_list[pain])
switch(pain)
if("Pain (0)")
- L.adjustHalLoss(15)
+ L.take_damage(15, PAIN)
to_chat(L, "You feel intense disappointment coming at you from beyond the veil.")
if("Light Wound (5)")
- L.adjustBruteLoss(5)
+ L.take_damage(5, BRUTE)
to_chat(L, "You feel an ethereal whip graze your very soul!")
if("Brain Damage (10)")
- L.adjustBrainLoss(5)
+ L.adjust_brain_damage(5)
to_chat(L, "You feel your mind breaking under a otherwordly hammer...")
if("Heavy Wounds (20)")
- L.adjustBruteLoss(25)
+ L.take_damage(25, BRUTE)
to_chat(L, "You feel your master turn its destructive potential against you!")
to_chat(linked, "You punish \the [L].")
log_admin("[key_name(linked)] used Punishment [pain] on \the [key_name(L)]")
\ No newline at end of file
diff --git a/code/modules/mob/living/deity/phenomena/conjuration.dm b/code/modules/mob/living/deity/phenomena/conjuration.dm
index ac0f27c60752..5eabb9e2f168 100644
--- a/code/modules/mob/living/deity/phenomena/conjuration.dm
+++ b/code/modules/mob/living/deity/phenomena/conjuration.dm
@@ -56,7 +56,7 @@
/datum/phenomena/banishing_smite/activate(var/mob/living/L, var/mob/living/deity/user)
..()
- L.take_overall_damage(rand(5,30),0,0,0,"blunt intrument") //Actual spell does 5d10 but maaaybe too much.
+ L.take_damage(rand(5,30), BRUTE, used_weapon = "blunt intrument") //Actual spell does 5d10 but maaaybe too much.
playsound(get_turf(L), 'sound/effects/bamf.ogg', 100, 1)
to_chat(L, "Something hard hits you!")
if(L.current_health < L.get_max_health()/2) //If it reduces past 50%
diff --git a/code/modules/mob/living/deity/phenomena/starlight.dm b/code/modules/mob/living/deity/phenomena/starlight.dm
index 762cb18d5493..a2a34543f14f 100644
--- a/code/modules/mob/living/deity/phenomena/starlight.dm
+++ b/code/modules/mob/living/deity/phenomena/starlight.dm
@@ -158,8 +158,8 @@
/datum/phenomena/burning_glare/activate(var/mob/living/L)
..()
to_chat(L, "You feel yourself burn!")
- L.adjustFireLoss(10)
- if(L.getFireLoss() > 60)
+ L.take_damage(10, BURN)
+ if(L.get_damage(BURN) > 60)
L.fire_stacks += 50
L.IgniteMob()
diff --git a/code/modules/mob/living/deity/phenomena/transmutation.dm b/code/modules/mob/living/deity/phenomena/transmutation.dm
index 7f6f20a83993..1a985da60bb0 100644
--- a/code/modules/mob/living/deity/phenomena/transmutation.dm
+++ b/code/modules/mob/living/deity/phenomena/transmutation.dm
@@ -8,7 +8,7 @@
/datum/phenomena/warp/activate(var/mob/living/L)
..()
- L.adjustCloneLoss(20)
+ L.take_damage(20, CLONE)
SET_STATUS_MAX(L, STAT_WEAK, 2)
to_chat(L, "You feel your body warp and change underneath you!")
diff --git a/code/modules/mob/living/life.dm b/code/modules/mob/living/life.dm
index 3260b6ece413..58c5d91038d6 100644
--- a/code/modules/mob/living/life.dm
+++ b/code/modules/mob/living/life.dm
@@ -97,7 +97,7 @@
/mob/living/proc/handle_mutations_and_radiation()
SHOULD_CALL_PARENT(TRUE)
- radiation = clamp(radiation,0,500)
+ var/radiation = clamp(get_damage(IRRADIATE), 0, 500)
var/decl/species/my_species = get_species()
var/decl/bodytype/my_bodytype = get_bodytype()
if(my_species && my_bodytype && (my_bodytype.appearance_flags & RADIATION_GLOWS))
@@ -110,16 +110,16 @@
return
var/damage = 0
- radiation -= 1 * RADIATION_SPEED_COEFFICIENT
+ heal_damage(1 * RADIATION_SPEED_COEFFICIENT, IRRADIATE)
if(prob(25))
damage = 2
if (radiation > 50)
damage = 2
- radiation -= 2 * RADIATION_SPEED_COEFFICIENT
+ heal_damage(2 * RADIATION_SPEED_COEFFICIENT, IRRADIATE)
if(!isSynthetic())
if(prob(5) && prob(100 * RADIATION_SPEED_COEFFICIENT))
- radiation -= 5 * RADIATION_SPEED_COEFFICIENT
+ heal_damage(5 * RADIATION_SPEED_COEFFICIENT, IRRADIATE)
to_chat(src, "You feel weak.")
SET_STATUS_MAX(src, STAT_WEAK, 3)
if(!lying)
@@ -129,22 +129,21 @@
if (radiation > 75)
damage = 3
- radiation -= 3 * RADIATION_SPEED_COEFFICIENT
+ heal_damage(3 * RADIATION_SPEED_COEFFICIENT, IRRADIATE)
if(!isSynthetic())
if(prob(5))
- take_overall_damage(0, 5 * RADIATION_SPEED_COEFFICIENT, used_weapon = "Radiation Burns")
+ take_damage(5 * RADIATION_SPEED_COEFFICIENT, BURN, used_weapon = "Radiation Burns")
if(prob(1))
to_chat(src, "You feel strange!")
- adjustCloneLoss(5 * RADIATION_SPEED_COEFFICIENT)
+ take_damage(5 * RADIATION_SPEED_COEFFICIENT, CLONE)
emote("gasp")
if(radiation > 150)
damage = 8
- radiation -= 4 * RADIATION_SPEED_COEFFICIENT
+ heal_damage(4 * RADIATION_SPEED_COEFFICIENT, IRRADIATE)
- damage = FLOOR(damage * (my_species ? my_species.get_radiation_mod(src) : 1))
if(damage)
immunity = max(0, immunity - damage * 15 * RADIATION_SPEED_COEFFICIENT)
- adjustToxLoss(damage * RADIATION_SPEED_COEFFICIENT)
+ take_damage(damage * RADIATION_SPEED_COEFFICIENT, TOX)
var/list/limbs = get_external_organs()
if(!isSynthetic() && LAZYLEN(limbs))
var/obj/item/organ/external/O = pick(limbs)
@@ -204,7 +203,8 @@
var/burn_regen = GET_CHEMICAL_EFFECT(src, CE_REGEN_BURN)
var/brute_regen = GET_CHEMICAL_EFFECT(src, CE_REGEN_BRUTE)
if(burn_regen || brute_regen)
- heal_organ_damage(brute_regen, burn_regen, FALSE) // apply_chemical_effects() calls update_health() if it returns true; don't do it unnecessarily.
+ heal_damage(brute_regen, BRUTE)
+ heal_damage(burn_regen, BURN)
return TRUE
return FALSE
@@ -441,5 +441,5 @@
if(!my_species?.check_no_slip(src) && prob(current_size*5))
to_chat(src, SPAN_DANGER("A strong gravitational force slams you to the ground!"))
SET_STATUS_MAX(src, STAT_WEAK, current_size)
- apply_damage(current_size * 3, IRRADIATE, damage_flags = DAM_DISPERSED)
+ take_damage(current_size * 3, IRRADIATE, damage_flags = DAM_DISPERSED)
return ..()
diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm
index cb376c38ef38..0c823df130ff 100644
--- a/code/modules/mob/living/living.dm
+++ b/code/modules/mob/living/living.dm
@@ -1,6 +1,7 @@
/mob/living/Initialize()
current_health = get_max_health()
+ setup_damage_types()
original_fingerprint_seed = sequential_id(/mob)
fingerprint = md5(num2text(original_fingerprint_seed))
original_genetic_seed = sequential_id(/mob)
@@ -129,7 +130,7 @@ default behaviour is:
SET_STATUS_MAX(src, STAT_WEAK, 2)
playsound(loc, "punch", 25, 1, -1)
visible_message("[src] [pick("ran", "slammed")] into \the [AM]!")
- src.apply_damage(5, BRUTE)
+ take_damage(5, BRUTE)
return
if (!now_pushing)
now_pushing = 1
@@ -188,7 +189,7 @@ default behaviour is:
set hidden = 1
var/current_max_health = get_max_health()
if (current_health < (current_max_health/2)) // Health below half of maxhealth.
- adjustBrainLoss(current_max_health * 2) // Deal 2x health in BrainLoss damage, as before but variable.
+ adjust_brain_damage(current_max_health * 2) // Deal 2x health in BrainLoss damage, as before but variable.
to_chat(src, SPAN_NOTICE("You have given up life and succumbed to death."))
/mob/living/proc/update_body(var/update_icons=1)
@@ -199,7 +200,9 @@ default behaviour is:
return current_health <= 0
/mob/living/proc/get_total_life_damage()
- return (getOxyLoss()+getToxLoss()+getFireLoss()+getBruteLoss()+getCloneLoss()+getHalLoss())
+ . = 0
+ for(var/damage_type in get_lethal_damage_types())
+ . += get_damage(damage_type)
/mob/living/proc/update_health()
SHOULD_CALL_PARENT(TRUE)
@@ -229,7 +232,6 @@ default behaviour is:
var/difference = abs(actual-desired) //get difference
var/increments = difference/10 //find how many increments apart they are
var/change = increments*incrementboost // Get the amount to change by (x per increment)
-
// Too cold
if(actual < desired)
btemperature += change
@@ -240,79 +242,8 @@ default behaviour is:
btemperature -= change
if(actual < desired)
btemperature = desired
-// if(ishuman(src))
-// log_debug("[src] ~ [src.bodytemperature] ~ [temperature]")
-
return btemperature
-/mob/living/proc/setBruteLoss(var/amount)
- adjustBruteLoss((amount * 0.5)-getBruteLoss())
-
-/mob/living/proc/getBruteLoss()
- return get_max_health() - current_health
-
-/mob/living/proc/adjustBruteLoss(var/amount, var/do_update_health = TRUE)
- SHOULD_CALL_PARENT(TRUE)
- if(do_update_health)
- update_health()
-
-/mob/living/proc/getOxyLoss()
- return 0
-
-/mob/living/proc/adjustOxyLoss(var/damage, var/do_update_health = TRUE)
- SHOULD_CALL_PARENT(TRUE)
- if(do_update_health)
- update_health()
-
-/mob/living/proc/setOxyLoss(var/amount)
- return
-
-/mob/living/proc/getToxLoss()
- return 0
-
-/mob/living/proc/adjustToxLoss(var/amount, var/do_update_health = TRUE)
- adjustBruteLoss(amount * 0.5, do_update_health)
-
-/mob/living/proc/setToxLoss(var/amount)
- adjustBruteLoss((amount * 0.5)-getBruteLoss())
-
-/mob/living/proc/getFireLoss()
- return
-
-/mob/living/proc/adjustFireLoss(var/amount, var/do_update_health = TRUE)
- adjustBruteLoss(amount * 0.5, do_update_health)
-
-/mob/living/proc/setFireLoss(var/amount)
- adjustBruteLoss((amount * 0.5)-getBruteLoss())
-
-/mob/living/proc/getHalLoss()
- return 0
-
-/mob/living/proc/adjustHalLoss(var/amount, var/do_update_health = TRUE)
- adjustBruteLoss(amount * 0.5, do_update_health)
-
-/mob/living/proc/setHalLoss(var/amount)
- adjustBruteLoss((amount * 0.5)-getBruteLoss())
-
-/mob/living/proc/adjustBrainLoss(var/amount, var/do_update_health = TRUE)
- SHOULD_CALL_PARENT(TRUE)
- if(do_update_health)
- update_health()
-
-/mob/living/proc/setBrainLoss(var/amount)
- return
-
-/mob/living/proc/getCloneLoss()
- return 0
-
-/mob/living/proc/setCloneLoss(var/amount)
- return
-
-/mob/living/proc/adjustCloneLoss(var/amount, var/do_update_health = TRUE)
- SHOULD_CALL_PARENT(TRUE)
- if(do_update_health)
- update_health()
-
/mob/living/proc/get_health_ratio() // ratio might be the wrong word
return current_health/get_max_health()
@@ -370,34 +301,9 @@ default behaviour is:
var/obj/item/organ/external/def_zone = ran_zone(t, target = src)
return def_zone
-
-// heal ONE external organ, organ gets randomly selected from damaged ones.
-/mob/living/proc/heal_organ_damage(var/brute, var/burn, var/affect_robo = FALSE, var/update_health = TRUE)
- adjustBruteLoss(-brute, do_update_health = FALSE)
- adjustFireLoss(-burn, do_update_health = update_health)
-
-// damage ONE external organ, organ gets randomly selected from damaged ones.
-/mob/living/proc/take_organ_damage(var/brute = 0, var/burn = 0, var/bypass_armour = FALSE, var/override_droplimb)
- if(status_flags & GODMODE)
- return
- adjustBruteLoss(brute, do_update_health = FALSE)
- adjustFireLoss(burn)
-
-// heal MANY external organs, in random order
-/mob/living/proc/heal_overall_damage(var/brute, var/burn)
- adjustBruteLoss(-brute, do_update_health = FALSE)
- adjustFireLoss(-burn)
-
-// damage MANY external organs, in random order
-/mob/living/proc/take_overall_damage(var/brute, var/burn, var/used_weapon = null)
- if(status_flags & GODMODE) return 0 //godmode
- adjustBruteLoss(brute, do_update_health = FALSE)
- adjustFireLoss(burn)
-
/mob/living/proc/restore_all_organs()
return
-
/mob/living/carbon/revive()
var/obj/item/cuffs = get_equipped_item(slot_handcuffed_str)
if (cuffs)
@@ -421,24 +327,24 @@ default behaviour is:
reagent_list.clear_reagents()
// shut down various types of badness
- setToxLoss(0)
- setOxyLoss(0)
- setCloneLoss(0)
- setBrainLoss(0)
+ clear_damage(TOX)
+ clear_damage(OXY)
+ clear_damage(CLONE)
+ clear_damage(IRRADIATE)
+
+ set_brain_damage(0)
set_status(STAT_PARA, 0)
set_status(STAT_STUN, 0)
set_status(STAT_WEAK, 0)
// shut down ongoing problems
- radiation = 0
bodytemperature = get_species()?.body_temperature || initial(bodytemperature)
sdisabilities = 0
disabilities = 0
// fix all status conditions including blind/deaf
clear_status_effects()
-
- heal_overall_damage(getBruteLoss(), getFireLoss())
+ clear_all_damage()
// fix all of our organs
restore_all_organs()
@@ -464,9 +370,9 @@ default behaviour is:
/mob/living/proc/basic_revival(var/repair_brain = TRUE)
- if(repair_brain && getBrainLoss() > 50)
+ if(repair_brain && get_brain_damage() > 50)
repair_brain = FALSE
- setBrainLoss(50)
+ set_brain_damage(50)
if(stat == DEAD)
switch_from_dead_to_living_mob_list()
@@ -487,8 +393,8 @@ default behaviour is:
repair_brain = FALSE
var/obj/item/organ/internal/brain = GET_INTERNAL_ORGAN(src, BP_BRAIN)
if(brain)
- if(brain.damage > (brain.max_damage/2))
- brain.damage = (brain.max_damage/2)
+ if(brain.organ_damage > (brain.max_damage/2))
+ brain.organ_damage = (brain.max_damage/2)
if(brain.status & ORGAN_DEAD)
brain.status &= ~ORGAN_DEAD
START_PROCESSING(SSobj, brain)
@@ -844,7 +750,7 @@ default behaviour is:
visible_message(SPAN_DANGER("\The [src] starts having a seizure!"))
SET_STATUS_MAX(src, STAT_PARA, rand(8,16))
set_status(STAT_JITTER, rand(150,200))
- adjustHalLoss(rand(50,60))
+ take_damage(rand(50,60), PAIN)
/mob/living/proc/get_digestion_product()
return null
@@ -932,11 +838,11 @@ default behaviour is:
..()
if(!has_gravity())
return
- if(isturf(loc) && pull_damage() && prob(getBruteLoss() / 6))
+ if(isturf(loc) && pull_damage() && prob(get_damage(BRUTE) / 6))
if (!should_have_organ(BP_HEART))
blood_splatter(loc, src, large = TRUE)
if(prob(25))
- adjustBruteLoss(1)
+ take_damage(1, BRUTE)
visible_message(SPAN_DANGER("\The [src]'s [isSynthetic() ? "state worsens": "wounds open more"] from being dragged!"))
/mob/living/CanUseTopicPhysical(mob/user)
@@ -1098,11 +1004,7 @@ default behaviour is:
A.alert_on_fall(src)
/mob/living/proc/apply_fall_damage(var/turf/landing)
- adjustBruteLoss(rand(max(1, CEILING(mob_size * 0.33)), max(1, CEILING(mob_size * 0.66))) * get_fall_height())
-
-/mob/living/proc/get_toxin_resistance()
- var/decl/species/species = get_species()
- return isnull(species) ? 1 : species.toxins_mod
+ take_damage(rand(max(1, CEILING(mob_size * 0.33)), max(1, CEILING(mob_size * 0.66))) * get_fall_height(), BRUTE)
/mob/living/proc/get_metabolizing_reagent_holders(var/include_contact = FALSE)
for(var/datum/reagents/adding in list(reagents, get_ingested_reagents(), get_inhaled_reagents()))
diff --git a/code/modules/mob/living/living_damage.dm b/code/modules/mob/living/living_damage.dm
new file mode 100644
index 000000000000..8524263204d3
--- /dev/null
+++ b/code/modules/mob/living/living_damage.dm
@@ -0,0 +1,128 @@
+/mob/living
+ var/list/_damage_values
+ var/list/_damage_type_mapping
+
+/mob/living/proc/resolve_damage_handler(var/damage_type)
+ RETURN_TYPE(/decl/damage_handler)
+ if(!(damage_type in _damage_values))
+ return // We don't handle this damage type.
+ . = LAZYACCESS(_damage_type_mapping, damage_type) || damage_type
+ if(.)
+ . = GET_DECL(.)
+
+/mob/living/proc/get_lethal_damage_types()
+ var/static/list/lethal_damage_types = list(
+ BRUTE,
+ BURN
+ )
+ return lethal_damage_types
+
+/mob/living/proc/get_handled_damage_types()
+ var/static/list/mob_damage_types = list(
+ BRUTE,
+ BURN
+ )
+ return mob_damage_types
+
+/mob/living/proc/setup_damage_types()
+ var/list/handled_damage_types = get_handled_damage_types()
+ for(var/primary_type in handled_damage_types)
+ LAZYSET(_damage_values, primary_type, 0)
+ var/validate_type = handled_damage_types[primary_type]
+ if(validate_type)
+ if(validate_type != primary_type)
+ LAZYSET(_damage_type_mapping, primary_type, validate_type)
+ else
+ validate_type = primary_type
+ var/decl/damage_handler/damage_handler_data = GET_DECL(validate_type)
+ if(!istype(src, damage_handler_data.expected_type))
+ PRINT_STACK_TRACE("Damage handler [validate_type] validation got unexpected type [damage_handler_data.expected_type].")
+
+/mob/living/proc/get_damage(var/damage_type)
+ if(damage_type)
+ var/decl/damage_handler/damage_type_data = resolve_damage_handler(damage_type)
+ return damage_type_data?.get_damage_for_mob(src)
+ var/decl/species/my_species = get_species()
+ if(my_species && isSynthetic())
+ return my_species.total_health - current_health
+ return 0
+
+/mob/living/heal_damage(var/damage, var/damage_type = BRUTE, var/def_zone = null, var/damage_flags = 0, skip_update_health = FALSE)
+ if(damage < 0)
+ return take_damage(abs(damage), damage_type, def_zone, damage_flags, skip_update_health = skip_update_health)
+ return resolve_damage_handler(damage_type)?.heal_mob_damage(src, damage, skip_update_health = skip_update_health)
+
+/mob/living/proc/clear_all_damage()
+ for(var/damage_type in _damage_values)
+ clear_damage(damage_type)
+
+/mob/living/proc/clear_damage(var/damage_type, skip_update_health = FALSE)
+ return set_damage(0, damage_type, skip_update_health = skip_update_health) // TODO
+
+/mob/living/proc/set_damage(var/damage, var/damage_type, skip_update_health = FALSE)
+ return resolve_damage_handler(damage_type)?.set_mob_damage(src, damage, skip_update_health = skip_update_health)
+
+// TODO: check if organ_rel_size[zone] should be used
+/mob/living/proc/get_dispersed_damage_zones()
+ for(var/obj/item/organ/organ in get_external_organs())
+ LAZYSET(., organ.organ_tag, organ.w_class)
+
+/mob/living/take_damage(damage, damage_type = BRUTE, def_zone, damage_flags = 0, used_weapon, armor_pen, silent = FALSE, override_droplimb, skip_update_health = FALSE)
+
+ if((status_flags & GODMODE) || !damage || !damage_type)
+ return FALSE
+
+ if(damage < 0)
+ return heal_damage(abs(damage), damage_type, def_zone, damage_flags)
+
+ // Dispersed damage recurses using our available target zones.
+ // We assume that the damage handlers know what to do with the zones when supplied.
+ if(damage_flags & DAM_DISPERSED)
+ var/tally = 0
+ var/list/dispersed_damage_zones = get_dispersed_damage_zones()
+ // Sum our overall size.
+ for(var/zone in dispersed_damage_zones)
+ tally += dispersed_damage_zones[zone]
+ // Recursively call the proc on valid zones with the weighted damage value.
+ for(var/zone in dispersed_damage_zones)
+ . = .(damage * dispersed_damage_zones[zone]/tally, def_zone = zone)
+ return
+ else if(isnull(def_zone))
+ def_zone = ran_zone()
+
+ // Modify based on armour, if a bodypart is supplied.
+ // No bodypart indicates this should bypass armour.
+ if(!isnull(def_zone))
+ var/list/after_armor = modify_damage_by_armor(def_zone, damage, damage_type, damage_flags, src, armor_pen, silent)
+ damage = after_armor[1]
+ damage_type = after_armor[2]
+ damage_flags = after_armor[3]
+
+ // Modify based on mob (such as species malus)
+ // This does not care about def_zone being supplied.
+ damage = round(damage * get_damage_modifier(damage_type))
+
+ if(!damage)
+ return FALSE
+
+ var/decl/damage_handler/damage_type_instance = resolve_damage_handler(damage_type)
+ if(damage_type_instance?.apply_damage_to_mob(src, damage, def_zone, damage_flags, used_weapon, silent))
+ if(!skip_update_health)
+ update_health()
+ return TRUE
+ return FALSE
+
+/mob/living/proc/get_damage_modifier(var/damage_type)
+ var/decl/species/my_species = get_species()
+ return my_species ? my_species.get_damage_modifier(src, damage_type) : 1
+
+// Special procs; not handled by damage system above.
+// Primarily used by humans.
+/mob/proc/get_brain_damage()
+ return 0
+
+/mob/living/proc/adjust_brain_damage(var/amount)
+ return
+
+/mob/living/proc/set_brain_damage(var/amount)
+ return
\ No newline at end of file
diff --git a/code/modules/mob/living/living_defense.dm b/code/modules/mob/living/living_defense.dm
index 5cfb37d77a8e..af2877507322 100644
--- a/code/modules/mob/living/living_defense.dm
+++ b/code/modules/mob/living/living_defense.dm
@@ -5,6 +5,7 @@
var/datum/extension/armor/armor_datum = armor
. = armor_datum.apply_damage_modifications(arglist(.))
+// TODO check that this handles decls instead of armour keys for damage_type
/mob/living/get_blocked_ratio(def_zone, damage_type, damage_flags, armor_pen, damage)
var/list/armors = get_armors_by_zone(def_zone, damage_type, damage_flags)
. = 0
@@ -33,7 +34,7 @@
var/flags = P.damage_flags()
var/damaged
if(!P.nodamage)
- damaged = apply_damage(damage, P.damage_type, def_zone, flags, P, P.armor_penetration)
+ damaged = take_damage(damage, P.damage_type, def_zone, flags, P, P.armor_penetration)
bullet_impact_visuals(P, def_zone, damaged)
if(damaged || P.nodamage) // Run the block computation if we did damage or if we only use armor for effects (nodamage)
. = get_blocked_ratio(def_zone, P.damage_type, flags, P.armor_penetration, P.damage)
@@ -81,7 +82,7 @@
apply_effect(stun_amount, EYE_BLUR)
if (agony_amount)
- apply_damage(agony_amount, PAIN, def_zone, used_weapon)
+ take_damage(agony_amount, PAIN, def_zone, used_weapon)
apply_effect(agony_amount/10, STUTTER)
apply_effect(agony_amount/10, EYE_BLUR)
@@ -116,7 +117,7 @@
//returns 0 if the effects failed to apply for some reason, 1 otherwise.
/mob/living/standard_weapon_hit_effects(obj/item/I, mob/living/user, var/effective_force, var/hit_zone)
if(effective_force)
- return apply_damage(effective_force, I.damtype, hit_zone, I.damage_flags(), used_weapon=I, armor_pen=I.armor_penetration)
+ return take_damage(effective_force, I.damtype, hit_zone, I.damage_flags(), used_weapon=I, armor_pen=I.armor_penetration)
//this proc handles being hit by a thrown atom
/mob/living/hitby(var/atom/movable/AM, var/datum/thrownthing/TT)
@@ -147,7 +148,7 @@
return
src.visible_message("\The [src] has been hit by \the [O].")
- apply_damage(throw_damage, dtype, null, O.damage_flags(), O)
+ take_damage(throw_damage, dtype, null, O.damage_flags(), O)
if(TT.thrower)
var/client/assailant = TT.thrower.client
@@ -199,7 +200,7 @@
/mob/living/proc/turf_collision(var/turf/T, var/speed)
visible_message("[src] slams into \the [T]!")
playsound(T, 'sound/effects/bangtaper.ogg', 50, 1, 1)//so it plays sounds on the turf instead, makes for awesome carps to hull collision and such
- apply_damage(speed*5, BRUTE)
+ take_damage(speed*5, BRUTE)
/mob/living/proc/near_wall(var/direction,var/distance=1)
var/turf/T = get_step(get_turf(src),direction)
@@ -225,7 +226,7 @@
admin_attack_log(user, src, "Attacked", "Was attacked", "attacked")
src.visible_message("\The [user] has [attack_message] \the [src]!")
- adjustBruteLoss(damage)
+ take_damage(damage, BRUTE)
user.do_attack_animation(src)
return 1
@@ -333,4 +334,4 @@
screamed = TRUE
emote("scream")
affecting.status |= ORGAN_DISFIGURED
- take_organ_damage(0, severity, override_droplimb = DISMEMBER_METHOD_ACID)
+ take_damage(severity, BURN, override_droplimb = DISMEMBER_METHOD_ACID)
diff --git a/code/modules/mob/living/living_powers.dm b/code/modules/mob/living/living_powers.dm
index 49d07235d00f..e7cbc0e94aee 100644
--- a/code/modules/mob/living/living_powers.dm
+++ b/code/modules/mob/living/living_powers.dm
@@ -66,7 +66,7 @@
if(do_mob(src, target, 5 SECONDS))
to_chat(target,"\The [src] scrapes your flesh from your bones!")
to_chat(src,"You feed hungrily off \the [target]'s flesh.")
- target.adjustBruteLoss(25)
- if(target.getBruteLoss() < -target.get_max_health())
+ target.take_damage(25, BRUTE)
+ if(target.get_damage(BRUTE) < -target.get_max_health())
target.gib()
- src.adjustBruteLoss(-25)
\ No newline at end of file
+ heal_damage(25, BRUTE)
\ No newline at end of file
diff --git a/code/modules/mob/living/silicon/ai/ai_damage.dm b/code/modules/mob/living/silicon/ai/ai_damage.dm
index 6949d387b0cc..4b27621e2e28 100644
--- a/code/modules/mob/living/silicon/ai/ai_damage.dm
+++ b/code/modules/mob/living/silicon/ai/ai_damage.dm
@@ -1,55 +1,23 @@
-/mob/living/silicon/ai
- var/fireloss = 0
- var/bruteloss = 0
- var/oxyloss = 0
-
-/mob/living/silicon/ai/getFireLoss()
- return fireloss
-
-/mob/living/silicon/ai/getBruteLoss()
- return bruteloss
-
-/mob/living/silicon/ai/getOxyLoss()
- return oxyloss
-
-/mob/living/silicon/ai/adjustFireLoss(var/amount, var/do_update_health = TRUE)
- if(status_flags & GODMODE) return
- fireloss = max(0, fireloss + min(amount, current_health))
- if(do_update_health)
- update_health()
-
-/mob/living/silicon/ai/adjustBruteLoss(var/amount, var/do_update_health = TRUE)
- if(!(status_flags & GODMODE))
- bruteloss = max(0, bruteloss + min(amount, current_health))
- ..()
-
-/mob/living/silicon/ai/adjustOxyLoss(var/damage, var/do_update_health = TRUE)
- if(!(status_flags & GODMODE))
- oxyloss = max(0, oxyloss + min(damage, get_max_health() - oxyloss))
- ..()
-
-/mob/living/silicon/ai/setBruteLoss(var/amount)
- if(status_flags & GODMODE)
- bruteloss = 0
- return
- bruteloss = max(0, amount)
-
-/mob/living/silicon/ai/setFireLoss(var/amount)
- if(status_flags & GODMODE)
- fireloss = 0
- return
- fireloss = max(0, amount)
-
-/mob/living/silicon/ai/setOxyLoss(var/amount)
- if(status_flags & GODMODE)
- oxyloss = 0
- return
- oxyloss = max(0, amount)
+/mob/living/silicon/ai/get_handled_damage_types()
+ var/static/list/mob_damage_types = list(
+ BRUTE,
+ BURN,
+ OXY
+ )
+ return mob_damage_types
+
+/mob/living/silicon/ai/get_lethal_damage_types()
+ var/static/list/lethal_damage_types = list(
+ BRUTE,
+ BURN,
+ OXY
+ )
+ return lethal_damage_types
/mob/living/silicon/ai/update_health()
..()
if(status_flags & GODMODE)
- setOxyLoss(0)
+ clear_damage(OXY)
/mob/living/silicon/ai/rejuvenate()
..()
@@ -58,4 +26,4 @@
// Returns percentage of AI's remaining backup capacitor charge (max_health - oxyloss).
/mob/living/silicon/ai/proc/backup_capacitor()
var/current_max_health = get_max_health()
- return ((getOxyLoss() - current_max_health) / current_max_health) * (-100)
+ return ((get_damage(OXY) - current_max_health) / current_max_health) * (-100)
diff --git a/code/modules/mob/living/silicon/ai/examine.dm b/code/modules/mob/living/silicon/ai/examine.dm
index fea4ebf1c424..538a4df38022 100644
--- a/code/modules/mob/living/silicon/ai/examine.dm
+++ b/code/modules/mob/living/silicon/ai/examine.dm
@@ -6,20 +6,20 @@
msg += "It appears to be powered-down.\n"
else
msg += ""
- if (src.getBruteLoss())
- if (src.getBruteLoss() < 30)
+ if (get_damage(BRUTE))
+ if (get_damage(BRUTE) < 30)
msg += "It looks slightly dented.\n"
else
msg += "It looks severely dented!\n"
- if (src.getFireLoss())
- if (src.getFireLoss() < 30)
+ if (get_damage(BURN))
+ if (get_damage(BURN) < 30)
msg += "It looks slightly charred.\n"
else
msg += "Its casing is melted and heat-warped!\n"
if (!has_power())
- if (src.getOxyLoss() > 175)
+ if (get_damage(OXY) > 175)
msg += "It seems to be running on backup power. Its display is blinking a \"BACKUP POWER CRITICAL\" warning.\n"
- else if(src.getOxyLoss() > 100)
+ else if(get_damage(OXY) > 100)
msg += "It seems to be running on backup power. Its display is blinking a \"BACKUP POWER LOW\" warning.\n"
else
msg += "It seems to be running on backup power.\n"
diff --git a/code/modules/mob/living/silicon/ai/power.dm b/code/modules/mob/living/silicon/ai/power.dm
index aa92b054d913..5e64af7b4368 100644
--- a/code/modules/mob/living/silicon/ai/power.dm
+++ b/code/modules/mob/living/silicon/ai/power.dm
@@ -126,7 +126,7 @@
else if(aiRestorePowerRoutine)
return AI_POWERUSAGE_RESTORATION
- if(getOxyLoss())
+ if(get_damage(OXY))
return AI_POWERUSAGE_RECHARGING
return AI_POWERUSAGE_NORMAL
@@ -142,11 +142,11 @@
if(has_power(0))
// Self-shutdown mode uses only 10kW, so we don't have any spare power to charge.
if(!self_shutdown || carded)
- adjustOxyLoss(AI_POWERUSAGE_NORMAL - AI_POWERUSAGE_RECHARGING)
+ take_damage(AI_POWERUSAGE_NORMAL - AI_POWERUSAGE_RECHARGING, OXY)
return
// Not powered. Gain oxyloss depeding on our power usage.
- adjustOxyLoss(calculate_power_usage())
+ take_damage(calculate_power_usage(), OXY)
// This verb allows the AI to disable or enable the power override mode.
/mob/living/silicon/ai/proc/ai_power_override()
diff --git a/code/modules/mob/living/silicon/pai/pai.dm b/code/modules/mob/living/silicon/pai/pai.dm
index 2be9d6e687e5..6311c0570768 100644
--- a/code/modules/mob/living/silicon/pai/pai.dm
+++ b/code/modules/mob/living/silicon/pai/pai.dm
@@ -191,7 +191,7 @@ var/global/list/possible_say_verbs = list(
var/mob/living/carbon/human/H = holder
for(var/obj/item/organ/external/affecting in H.get_external_organs())
if(card in affecting.implants)
- affecting.take_external_damage(rand(30,50))
+ affecting.take_damage(rand(30,50), BRUTE)
LAZYREMOVE(affecting.implants, card)
H.visible_message("\The [src] explodes out of \the [H]'s [affecting.name] in a shower of gore!")
break
@@ -273,7 +273,7 @@ var/global/list/possible_say_verbs = list(
return
if(W.force)
visible_message(SPAN_DANGER("[user] attacks [src] with [W]!"))
- adjustBruteLoss(W.force)
+ take_damage(W.force, BRUTE)
else
visible_message(SPAN_WARNING("[user] bonks [src] harmlessly with [W]."))
diff --git a/code/modules/mob/living/silicon/robot/analyzer.dm b/code/modules/mob/living/silicon/robot/analyzer.dm
index c3187cfa3d9b..83d674de239b 100644
--- a/code/modules/mob/living/silicon/robot/analyzer.dm
+++ b/code/modules/mob/living/silicon/robot/analyzer.dm
@@ -42,9 +42,9 @@
user.visible_message("\The [user] has analyzed [M]'s components.","You have analyzed [M]'s components.")
switch(scan_type)
if("robot")
- var/BU = M.getFireLoss() > 50 ? "[M.getFireLoss()]" : M.getFireLoss()
- var/BR = M.getBruteLoss() > 50 ? "[M.getBruteLoss()]" : M.getBruteLoss()
- user.show_message("Analyzing Results for [M]:\n\t Overall Status: [M.stat > 1 ? "fully disabled" : "[M.current_health - M.getHalLoss()]% functional"]")
+ var/BU = M.get_damage(BURN) > 50 ? "[M.get_damage(BURN)]" : M.get_damage(BURN)
+ var/BR = M.get_damage(BRUTE) > 50 ? "[M.get_damage(BRUTE)]" : M.get_damage(BRUTE)
+ user.show_message("Analyzing Results for [M]:\n\t Overall Status: [M.stat > 1 ? "fully disabled" : "[M.current_health - M.get_damage(PAIN)]% functional"]")
user.show_message("\t Key: Electronics/Brute", 1)
user.show_message("\t Damage Specifics: [BU] - [BR]")
if(M.stat == DEAD)
@@ -93,7 +93,7 @@
if(!BP_IS_PROSTHETIC(O))
continue
organ_found = 1
- to_chat(user, "[O.name]: [SPAN_RED(O.damage)]")
+ to_chat(user, "[O.name]: [SPAN_RED(O.organ_damage)]")
if(!organ_found)
to_chat(user, "No prosthetics located.")
diff --git a/code/modules/mob/living/silicon/robot/component.dm b/code/modules/mob/living/silicon/robot/component.dm
index 245fce449907..2e56f6235706 100644
--- a/code/modules/mob/living/silicon/robot/component.dm
+++ b/code/modules/mob/living/silicon/robot/component.dm
@@ -52,7 +52,7 @@
installed = 1
install()
-/datum/robot_component/proc/take_damage(brute, electronics, sharp, edge)
+/datum/robot_component/proc/take_component_damage(brute, electronics, sharp, edge)
if(installed != 1) return
brute_damage += brute
@@ -60,7 +60,7 @@
if(brute_damage + electronics_damage >= max_damage) destroy()
-/datum/robot_component/proc/heal_damage(brute, electronics)
+/datum/robot_component/proc/heal_component_damage(brute, electronics)
if(installed != 1)
// If it's not installed, can't repair it.
return 0
diff --git a/code/modules/mob/living/silicon/robot/drone/drone.dm b/code/modules/mob/living/silicon/robot/drone/drone.dm
index 31414a6c4f47..4528ded02009 100644
--- a/code/modules/mob/living/silicon/robot/drone/drone.dm
+++ b/code/modules/mob/living/silicon/robot/drone/drone.dm
@@ -35,6 +35,9 @@
var/module_type = /obj/item/robot_module/drone
+/mob/living/silicon/robot/drone/is_drone()
+ return TRUE
+
/mob/living/silicon/robot/drone/Initialize()
. = ..()
add_inventory_slot(new /datum/inventory_slot/head/simple)
diff --git a/code/modules/mob/living/silicon/robot/drone/drone_damage.dm b/code/modules/mob/living/silicon/robot/drone/drone_damage.dm
index 2e5a4d814c6e..0a8a29215533 100644
--- a/code/modules/mob/living/silicon/robot/drone/drone_damage.dm
+++ b/code/modules/mob/living/silicon/robot/drone/drone_damage.dm
@@ -1,30 +1,7 @@
-//Redefining some robot procs, since drones can't be repaired and really shouldn't take component damage.
-/mob/living/silicon/robot/drone
- var/fireloss = 0
- var/bruteloss = 0
-
-/mob/living/silicon/robot/drone/take_overall_damage(var/brute = 0, var/burn = 0, var/sharp = 0, var/used_weapon = null)
- bruteloss += brute
- fireloss += burn
- update_health()
-
-/mob/living/silicon/robot/drone/heal_overall_damage(var/brute, var/burn)
- bruteloss -= brute
- fireloss -= burn
- if(bruteloss<0)
- bruteloss = 0
- if(fireloss<0)
- fireloss = 0
- update_health()
-
-/mob/living/silicon/robot/drone/take_organ_damage(var/brute = 0, var/burn = 0, var/bypass_armour = FALSE, var/override_droplimb)
- take_overall_damage(brute, burn)
-
-/mob/living/silicon/robot/drone/heal_organ_damage(var/brute, var/burn, var/affect_robo = FALSE, var/update_health = TRUE)
- heal_overall_damage(brute, burn)
-
-/mob/living/silicon/robot/drone/getFireLoss()
- return fireloss
-
-/mob/living/silicon/robot/drone/getBruteLoss()
- return bruteloss
\ No newline at end of file
+//Redefining some drone procs, since drones can't be repaired and really shouldn't take component damage.
+/mob/living/silicon/robot/drone/get_handled_damage_types()
+ var/static/list/mob_damage_types = list(
+ BRUTE = BRUTE,
+ BURN = BURN
+ )
+ return mob_damage_types
diff --git a/code/modules/mob/living/silicon/robot/examine.dm b/code/modules/mob/living/silicon/robot/examine.dm
index 4a4b77588f22..e85c2226091f 100644
--- a/code/modules/mob/living/silicon/robot/examine.dm
+++ b/code/modules/mob/living/silicon/robot/examine.dm
@@ -4,13 +4,13 @@
var/msg = ""
msg += ""
- if (src.getBruteLoss())
- if (src.getBruteLoss() < 75)
+ if (get_damage(BRUTE))
+ if (get_damage(BRUTE) < 75)
msg += "It looks slightly dented.\n"
else
msg += "It looks severely dented!\n"
- if (src.getFireLoss())
- if (src.getFireLoss() < 75)
+ if (get_damage(BURN))
+ if (get_damage(BURN) < 75)
msg += "It looks slightly charred.\n"
else
msg += "It looks severely burnt and heat-warped!\n"
diff --git a/code/modules/mob/living/silicon/robot/robot.dm b/code/modules/mob/living/silicon/robot/robot.dm
index e7c0646d9f3a..fc2abb448fad 100644
--- a/code/modules/mob/living/silicon/robot/robot.dm
+++ b/code/modules/mob/living/silicon/robot/robot.dm
@@ -93,6 +93,9 @@
light_wedge = LIGHT_WIDE
+/mob/living/silicon/robot/proc/is_drone()
+ return FALSE
+
/mob/living/silicon/robot/Initialize()
. = ..()
@@ -488,13 +491,13 @@
to_chat(user, "You lack the reach to be able to repair yourself.")
return
- if (!getBruteLoss())
+ if (!get_damage(BRUTE))
to_chat(user, "Nothing to fix here!")
return
var/obj/item/weldingtool/WT = W
if (WT.weld(0))
user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN)
- adjustBruteLoss(-30)
+ heal_damage(30, BRUTE)
add_fingerprint(user)
user.visible_message(SPAN_NOTICE("\The [user] has fixed some of the dents on \the [src]!"))
else
@@ -502,13 +505,13 @@
return
else if(istype(W, /obj/item/stack/cable_coil) && (wiresexposed || isdrone(src)))
- if (!getFireLoss())
+ if (!get_damage(BURN))
to_chat(user, "Nothing to fix here!")
return
var/obj/item/stack/cable_coil/coil = W
if (coil.use(1))
user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN)
- adjustFireLoss(-30)
+ heal_damage(30, BURN)
user.visible_message(SPAN_NOTICE("\The [user] has fixed some of the burnt wires on \the [src]!"))
else if(IS_CROWBAR(W) && user.a_intent != I_HURT) // crowbar means open or close the cover - we all know what a crowbar is by now
diff --git a/code/modules/mob/living/silicon/robot/robot_damage.dm b/code/modules/mob/living/silicon/robot/robot_damage.dm
index 550429f8d686..2a8d3846bc4c 100644
--- a/code/modules/mob/living/silicon/robot/robot_damage.dm
+++ b/code/modules/mob/living/silicon/robot/robot_damage.dm
@@ -1,30 +1,3 @@
-/mob/living/silicon/robot/getBruteLoss()
- var/amount = 0
- for(var/V in components)
- var/datum/robot_component/C = components[V]
- if(C.installed != 0) amount += C.brute_damage
- return amount
-
-/mob/living/silicon/robot/getFireLoss()
- var/amount = 0
- for(var/V in components)
- var/datum/robot_component/C = components[V]
- if(C.installed != 0) amount += C.electronics_damage
- return amount
-
-/mob/living/silicon/robot/adjustBruteLoss(var/amount, var/do_update_health = TRUE)
- SHOULD_CALL_PARENT(FALSE) // take/heal overall call update_health regardless of arg
- if(amount > 0)
- take_overall_damage(amount, 0)
- else
- heal_overall_damage(-amount, 0)
-
-/mob/living/silicon/robot/adjustFireLoss(var/amount, var/do_update_health = TRUE)
- if(amount > 0)
- take_overall_damage(0, amount)
- else
- heal_overall_damage(0, -amount)
-
/mob/living/silicon/robot/proc/get_damaged_components(var/brute, var/burn, var/destroyed = 0)
var/list/datum/robot_component/parts = list()
for(var/V in components)
@@ -42,101 +15,12 @@
return rval
/mob/living/silicon/robot/proc/get_armour()
-
if(!components.len) return 0
var/datum/robot_component/C = components["armour"]
if(C && C.installed == 1)
return C
return 0
-/mob/living/silicon/robot/heal_organ_damage(var/brute, var/burn, var/affect_robo = FALSE, var/update_health = TRUE)
- var/list/datum/robot_component/parts = get_damaged_components(brute, burn)
- if(!parts.len) return
- var/datum/robot_component/picked = pick(parts)
- picked.heal_damage(brute,burn)
-
-/mob/living/silicon/robot/take_organ_damage(var/brute = 0, var/burn = 0, var/bypass_armour = FALSE, var/override_droplimb)
- var/list/components = get_damageable_components()
- if(!components.len)
- return
-
- //Combat shielding absorbs a percentage of damage directly into the cell.
- if(module_active && istype(module_active,/obj/item/borg/combat/shield))
- var/obj/item/borg/combat/shield/shield = module_active
- //Shields absorb a certain percentage of damage based on their power setting.
- var/absorb_brute = brute*shield.shield_level
- var/absorb_burn = burn*shield.shield_level
- var/cost = (absorb_brute+absorb_burn)*100
-
- cell.charge -= cost
- if(cell.charge <= 0)
- cell.charge = 0
- to_chat(src, "Your shield has overloaded!")
- else
- brute -= absorb_brute
- burn -= absorb_burn
- to_chat(src, "Your shield absorbs some of the impact!")
-
- if(!bypass_armour)
- var/datum/robot_component/armour/A = get_armour()
- if(A)
- A.take_damage(brute, burn)
- return
-
- var/datum/robot_component/C = pick(components)
- C.take_damage(brute, burn)
-
-/mob/living/silicon/robot/heal_overall_damage(var/brute, var/burn)
- var/list/datum/robot_component/parts = get_damaged_components(brute,burn)
-
- while(parts.len && (brute>0 || burn>0) )
- var/datum/robot_component/picked = pick(parts)
-
- var/brute_was = picked.brute_damage
- var/burn_was = picked.electronics_damage
-
- picked.heal_damage(brute,burn)
-
- brute -= (brute_was-picked.brute_damage)
- burn -= (burn_was-picked.electronics_damage)
-
- parts -= picked
-
-/mob/living/silicon/robot/take_overall_damage(var/brute = 0, var/burn = 0, var/sharp = 0, var/used_weapon = null)
- if(status_flags & GODMODE) return //godmode
- var/list/datum/robot_component/parts = get_damageable_components()
-
- //Combat shielding absorbs a percentage of damage directly into the cell.
- if(module_active && istype(module_active,/obj/item/borg/combat/shield))
- var/obj/item/borg/combat/shield/shield = module_active
- //Shields absorb a certain percentage of damage based on their power setting.
- var/absorb_brute = brute*shield.shield_level
- var/absorb_burn = burn*shield.shield_level
- var/cost = (absorb_brute+absorb_burn)*100
-
- cell.charge -= cost
- if(cell.charge <= 0)
- cell.charge = 0
- to_chat(src, "Your shield has overloaded!")
- else
- brute -= absorb_brute
- burn -= absorb_burn
- to_chat(src, "Your shield absorbs some of the impact!")
-
- var/datum/robot_component/armour/A = get_armour()
- if(A)
- A.take_damage(brute,burn,sharp)
- else
- while(parts.len && (brute>0 || burn>0) )
- var/datum/robot_component/picked = pick(parts)
- var/brute_was = picked.brute_damage
- var/burn_was = picked.electronics_damage
- picked.take_damage(brute,burn)
- brute -= (picked.brute_damage - brute_was)
- burn -= (picked.electronics_damage - burn_was)
- parts -= picked
- update_health()
-
/mob/living/silicon/robot/emp_act(severity)
uneq_all()
..() //Damage is handled at /silicon/ level.
diff --git a/code/modules/mob/living/silicon/robot/robot_damage_handlers.dm b/code/modules/mob/living/silicon/robot/robot_damage_handlers.dm
new file mode 100644
index 000000000000..491cbfce53d2
--- /dev/null
+++ b/code/modules/mob/living/silicon/robot/robot_damage_handlers.dm
@@ -0,0 +1,92 @@
+/mob/living/silicon/robot/get_handled_damage_types()
+ var/static/list/mob_damage_types = list(
+ BRUTE = /decl/damage_handler/brute/robot,
+ BURN = /decl/damage_handler/burn/robot
+ )
+ return mob_damage_types
+
+/decl/damage_handler/brute/robot/apply_damage_to_mob(var/mob/living/target, var/damage, var/def_zone, var/damage_flags = 0, var/used_weapon, var/silent = FALSE, var/skip_update_health = FALSE)
+ //var/mob/living/silicon/robot/target_robo = target
+
+/decl/damage_handler/brute/robot/heal_mob_damage(var/mob/living/target, var/damage, var/skip_update_health = FALSE)
+ //var/mob/living/silicon/robot/target_robo = target
+
+/decl/damage_handler/brute/robot/get_damage_for_mob(var/mob/living/target)
+ . = 0
+ var/mob/living/silicon/robot/target_robo = target
+ for(var/V in target_robo.components)
+ var/datum/robot_component/C = target_robo.components[V]
+ if(C.installed != 0)
+ . += C.brute_damage
+
+/decl/damage_handler/brute/robot/set_mob_damage(var/mob/living/target, var/damage, var/skip_update_health = FALSE)
+ return FALSE // No idea how to handle this for components.
+
+/decl/damage_handler/burn/robot/apply_damage_to_mob(var/mob/living/target, var/damage, var/def_zone, var/damage_flags = 0, var/used_weapon, var/silent = FALSE, var/skip_update_health = FALSE)
+ //var/mob/living/silicon/robot/target_robo = target
+
+/decl/damage_handler/burn/robot/heal_mob_damage(var/mob/living/target, var/damage, var/skip_update_health = FALSE)
+ //var/mob/living/silicon/robot/target_robo = target
+
+/decl/damage_handler/burn/robot/get_damage_for_mob(var/mob/living/target)
+ . = 0
+ var/mob/living/silicon/robot/target_robo = target
+ for(var/V in target_robo.components)
+ var/datum/robot_component/C = target_robo.components[V]
+ if(C.installed != 0)
+ . += C.electronics_damage
+
+/*
+/mob/living/silicon/robot/_heal_overall_damage(var/brute, var/burn)
+ if(is_drone())
+ return ..()
+ var/list/datum/robot_component/parts = get_damaged_components(brute,burn)
+ while(parts.len && (brute>0 || burn>0) )
+ var/datum/robot_component/picked = pick(parts)
+
+ var/brute_was = picked.brute_damage
+ var/burn_was = picked.electronics_damage
+
+ picked.heal_damage(brute,burn)
+
+ brute -= (brute_was-picked.brute_damage)
+ burn -= (burn_was-picked.electronics_damage)
+
+ parts -= picked
+
+/mob/living/silicon/robot/take_damage(var/damage, var/damage_type = BRUTE, var/def_zone = null, var/damage_flags = 0, var/used_weapon = null, var/armor_pen, var/silent = FALSE)
+ //Combat shielding absorbs a percentage of damage directly into the cell.
+ if(module_active && istype(module_active, /obj/item/borg/combat/shield))
+ var/obj/item/borg/combat/shield/shield = module_active
+ if(damage_type in shield.absorbs_damage_types)
+ //Shields absorb a certain percentage of damage based on their power setting.
+ var/absorb_damage = damage * shield.shield_level
+ var/cost = absorb_damage*100
+ cell.charge -= cost
+ if(cell.charge <= 0)
+ cell.charge = 0
+ to_chat(src, SPAN_DAMAGE("Your shield has overloaded!"))
+ else
+ damage -= absorb_damage
+ to_chat(src, SPAN_WARNING("Your shield absorbs some of the impact!"))
+ return ..()
+
+/mob/living/silicon/robot/_take_overall_damage(var/brute = 0, var/burn = 0, var/sharp = 0, var/used_weapon = null)
+ if(is_drone())
+ return ..()
+ if(status_flags & GODMODE) return //godmode
+ var/list/datum/robot_component/parts = get_damageable_components()
+ var/datum/robot_component/armour/A = get_armour()
+ if(A)
+ A.take_damage(brute,burn,sharp)
+ return
+
+ while(parts.len && (brute>0 || burn>0) )
+ var/datum/robot_component/picked = pick(parts)
+ var/brute_was = picked.brute_damage
+ var/burn_was = picked.electronics_damage
+ picked.take_damage(brute,burn)
+ brute -= (picked.brute_damage - brute_was)
+ burn -= (picked.electronics_damage - burn_was)
+ parts -= picked
+*/
\ No newline at end of file
diff --git a/code/modules/mob/living/silicon/silicon.dm b/code/modules/mob/living/silicon/silicon.dm
index d0958ccfa389..a4906facff08 100644
--- a/code/modules/mob/living/silicon/silicon.dm
+++ b/code/modules/mob/living/silicon/silicon.dm
@@ -106,13 +106,13 @@
/mob/living/silicon/emp_act(severity)
switch(severity)
if(1)
- src.take_organ_damage(0, 16, bypass_armour = TRUE)
+ take_damage(16, BURN)
if(prob(50))
SET_STATUS_MAX(src, STAT_STUN, rand(5,10))
else
ADJ_STATUS(src, STAT_CONFUSE, rand(2,40))
if(2)
- src.take_organ_damage(0, 7, bypass_armour = TRUE)
+ take_damage(7, BURN)
ADJ_STATUS(src, STAT_CONFUSE, rand(2,30))
flash_eyes(affect_silicon = 1)
to_chat(src, "*BZZZT*")
@@ -128,7 +128,7 @@
spark_at(loc, amount=5, cardinal_only = TRUE)
shock_damage *= 0.75 //take reduced damage
- take_overall_damage(0, shock_damage)
+ take_damage(shock_damage, BURN)
visible_message("\The [src] was shocked by \the [source]!", \
"Energy pulse detected, system damaged!", \
"You hear an electrical crack")
@@ -143,9 +143,9 @@
if(!Proj.nodamage)
switch(Proj.damage_type)
if(BRUTE)
- adjustBruteLoss(Proj.damage)
+ take_damage(Proj.damage, BRUTE)
if(BURN)
- adjustFireLoss(Proj.damage)
+ take_damage(Proj.damage, BURN)
Proj.on_hit(src,100) //wow this is a terrible hack
return 100
@@ -285,8 +285,8 @@
burn = 60
if(3)
brute = 30
- apply_damage(brute, BRUTE, damage_flags = DAM_EXPLODE)
- apply_damage(burn, BURN, damage_flags = DAM_EXPLODE)
+ take_damage(brute, BRUTE, damage_flags = DAM_EXPLODE)
+ take_damage(burn, BURN, damage_flags = DAM_EXPLODE)
/mob/living/silicon/proc/receive_alarm(var/datum/alarm_handler/alarm_handler, var/datum/alarm/alarm, was_raised)
if(!(alarm.alarm_z() in SSmapping.get_connected_levels(get_z(src))))
@@ -460,7 +460,3 @@
// This seems to be specifically to stop ghosted maintenance drones being used as free all-access cards.
if(istype(idcard) && !stat && !(ckey && !client) && !is_type_in_list(idcard, exceptions))
LAZYDISTINCTADD(., idcard)
-
-/mob/living/silicon/get_total_life_damage()
- return (getBruteLoss() + getFireLoss())
-
diff --git a/code/modules/mob/living/simple_animal/constructs/constructs.dm b/code/modules/mob/living/simple_animal/constructs/constructs.dm
index 23d000c9ea5e..c71600b0bc7e 100644
--- a/code/modules/mob/living/simple_animal/constructs/constructs.dm
+++ b/code/modules/mob/living/simple_animal/constructs/constructs.dm
@@ -69,7 +69,7 @@
/mob/living/simple_animal/construct/attack_animal(var/mob/user)
if(istype(user, /mob/living/simple_animal/construct/builder))
if(current_health < get_max_health())
- adjustBruteLoss(-5)
+ heal_damage(5, BRUTE)
user.visible_message("\The [user] mends some of \the [src]'s wounds.")
else
to_chat(user, "\The [src] is undamaged.")
@@ -131,7 +131,7 @@
if(istype(P, /obj/item/projectile/energy) || istype(P, /obj/item/projectile/beam))
var/reflectchance = 80 - round(P.damage/3)
if(prob(reflectchance))
- adjustBruteLoss(P.damage * 0.5)
+ take_damage(P.damage * 0.5, BRUTE)
visible_message("The [P.name] gets reflected by [src]'s shell!", \
"The [P.name] gets reflected by [src]'s shell!")
diff --git a/code/modules/mob/living/simple_animal/friendly/mouse.dm b/code/modules/mob/living/simple_animal/friendly/mouse.dm
index 4e841b450f18..cdc7563ef65d 100644
--- a/code/modules/mob/living/simple_animal/friendly/mouse.dm
+++ b/code/modules/mob/living/simple_animal/friendly/mouse.dm
@@ -82,7 +82,7 @@
desc = "It's a small [body_color] rodent, often seen hiding in maintenance areas and making a nuisance of itself."
/mob/living/simple_animal/mouse/proc/splat()
- adjustBruteLoss(get_max_health()) // Enough damage to kill
+ take_damage(get_max_health(), BRUTE) // Enough damage to kill
splatted = TRUE
death()
diff --git a/code/modules/mob/living/simple_animal/friendly/possum.dm b/code/modules/mob/living/simple_animal/friendly/possum.dm
index d9d8fef29a49..3728028cea36 100644
--- a/code/modules/mob/living/simple_animal/friendly/possum.dm
+++ b/code/modules/mob/living/simple_animal/friendly/possum.dm
@@ -47,14 +47,9 @@
if(prob(10))
poss.is_angry = TRUE
-/mob/living/simple_animal/opossum/adjustBruteLoss(damage, do_update_health = FALSE)
+/mob/living/simple_animal/opossum/take_damage(damage, damage_type = BRUTE, def_zone, damage_flags = 0, used_weapon, armor_pen, silent = FALSE, override_droplimb, skip_update_health = FALSE)
. = ..()
- if(damage >= 3)
- respond_to_damage()
-
-/mob/living/simple_animal/opossum/adjustFireLoss(damage, do_update_health = TRUE)
- . = ..()
- if(damage >= 3)
+ if(damage >= 3 && (damage_type == BRUTE || damage_type == BURN))
respond_to_damage()
/mob/living/simple_animal/opossum/lay_down()
diff --git a/code/modules/mob/living/simple_animal/hostile/antlion.dm b/code/modules/mob/living/simple_animal/hostile/antlion.dm
index 5f604dfdc9cf..853ebfa12dea 100644
--- a/code/modules/mob/living/simple_animal/hostile/antlion.dm
+++ b/code/modules/mob/living/simple_animal/hostile/antlion.dm
@@ -77,7 +77,8 @@
/mob/living/simple_animal/hostile/antlion/proc/process_healing()
if(!incapacitated() && healing && current_health < get_max_health())
- heal_overall_damage(rand(heal_amount), rand(heal_amount))
+ heal_damage(rand(heal_amount), BRUTE, skip_update_health = TRUE)
+ heal_damage(rand(heal_amount), BURN)
/mob/living/simple_animal/hostile/antlion/proc/prep_burrow(var/new_bool)
stop_automated_movement = new_bool
diff --git a/code/modules/mob/living/simple_animal/hostile/bear.dm b/code/modules/mob/living/simple_animal/hostile/bear.dm
index f6d7712a7c44..5da9fc2e1cbe 100644
--- a/code/modules/mob/living/simple_animal/hostile/bear.dm
+++ b/code/modules/mob/living/simple_animal/hostile/bear.dm
@@ -119,9 +119,9 @@
var/mob/living/carbon/human/H = target_mob
var/dam_zone = pick(BP_CHEST, BP_L_HAND, BP_R_HAND, BP_L_LEG, BP_R_LEG)
var/obj/item/organ/external/affecting = GET_EXTERNAL_ORGAN(H, ran_zone(dam_zone, target = H))
- H.apply_damage(damage, BRUTE, affecting, DAM_SHARP|DAM_EDGE) //TODO damage_flags var on simple_animals, maybe?
+ H.take_damage(damage, BRUTE, affecting, DAM_SHARP|DAM_EDGE) //TODO damage_flags var on simple_animals, maybe?
return H
else if(isliving(target_mob))
var/mob/living/L = target_mob
- L.adjustBruteLoss(damage)
+ L.take_damage(damage, BRUTE)
return L
diff --git a/code/modules/mob/living/simple_animal/hostile/commanded/nanomachines.dm b/code/modules/mob/living/simple_animal/hostile/commanded/nanomachines.dm
index 10da002cdd75..7245a800e47b 100644
--- a/code/modules/mob/living/simple_animal/hostile/commanded/nanomachines.dm
+++ b/code/modules/mob/living/simple_animal/hostile/commanded/nanomachines.dm
@@ -46,7 +46,7 @@
regen_time++
if(regen_time == 2 && current_health < get_max_health()) //slow regen
regen_time = 0
- heal_overall_damage(1)
+ heal_damage(1, BRUTE)
/mob/living/simple_animal/hostile/commanded/nanomachine/death(gibbed, deathmessage, show_dead_message)
..(null, "dissipates into thin air", "You have been destroyed.")
@@ -73,9 +73,9 @@
stance = COMMANDED_HEAL
return 0
src.visible_message("\The [src] glows green for a moment, healing \the [target_mob]'s wounds.")
- adjustBruteLoss(3)
- target_mob.adjustBruteLoss(-5, do_update_health = FALSE)
- target_mob.adjustFireLoss(-5)
+ current_health -= 3
+ target_mob.heal_damage(5, BRUTE)
+ target_mob.heal_damage(5, BURN)
/mob/living/simple_animal/hostile/commanded/nanomachine/misc_command(var/mob/speaker,var/text)
if(stance != COMMANDED_HEAL || stance != COMMANDED_HEALING) //dont want attack to bleed into heal.
diff --git a/code/modules/mob/living/simple_animal/hostile/giant_spider.dm b/code/modules/mob/living/simple_animal/hostile/giant_spider.dm
index cd6186aaf6ed..51169c405d27 100644
--- a/code/modules/mob/living/simple_animal/hostile/giant_spider.dm
+++ b/code/modules/mob/living/simple_animal/hostile/giant_spider.dm
@@ -164,7 +164,7 @@
if(current_health < get_max_health())
var/obj/item/attacking_with = get_natural_weapon()
if(attacking_with)
- heal_overall_damage(0.2 * attacking_with.force) //heal a bit on hit
+ heal_damage(0.2 * attacking_with.force, BRUTE) //heal a bit on hit
if(ishuman(.))
var/mob/living/carbon/human/H = .
var/obj/item/clothing/suit/space/S = H.get_covering_equipped_item_by_zone(BP_CHEST)
diff --git a/code/modules/mob/living/simple_animal/hostile/leech.dm b/code/modules/mob/living/simple_animal/hostile/leech.dm
index 870cb7fee400..970204dc2ab5 100644
--- a/code/modules/mob/living/simple_animal/hostile/leech.dm
+++ b/code/modules/mob/living/simple_animal/hostile/leech.dm
@@ -36,7 +36,7 @@
return
H.remove_blood_simple(suck_potency)
if(current_health < get_max_health())
- heal_overall_damage(suck_potency / 1.5)
+ heal_damage(suck_potency / 1.5, BRUTE)
belly += clamp(suck_potency, 0, 100)
/obj/structure/leech_spawner
diff --git a/code/modules/mob/living/simple_animal/hostile/mimic.dm b/code/modules/mob/living/simple_animal/hostile/mimic.dm
index 7f4a5c37e0ec..26976dad8156 100644
--- a/code/modules/mob/living/simple_animal/hostile/mimic.dm
+++ b/code/modules/mob/living/simple_animal/hostile/mimic.dm
@@ -151,9 +151,11 @@ var/global/list/protected_objects = list(/obj/machinery,
src.visible_message("\The [src] starts to move!")
awake = 1
-/mob/living/simple_animal/hostile/mimic/sleeping/adjustBruteLoss(var/damage, var/do_update_health = FALSE)
- ..(damage)
- trigger()
+/mob/living/simple_animal/hostile/mimic/sleeping/take_damage(damage, damage_type = BRUTE, def_zone, damage_flags = 0, used_weapon, armor_pen, silent = FALSE, override_droplimb, skip_update_health = FALSE)
+ . = ..()
+ if(damage_type == BRUTE)
+ trigger()
+ ..()
/mob/living/simple_animal/hostile/mimic/sleeping/attack_hand()
trigger()
diff --git a/code/modules/mob/living/simple_animal/hostile/retaliate/drone.dm b/code/modules/mob/living/simple_animal/hostile/retaliate/drone.dm
index de79538013c0..adb0a523b6df 100644
--- a/code/modules/mob/living/simple_animal/hostile/retaliate/drone.dm
+++ b/code/modules/mob/living/simple_animal/hostile/retaliate/drone.dm
@@ -108,8 +108,8 @@
if(prob(1))
src.visible_message("[html_icon(src)] [src] shudders and shakes as some of it's damaged systems come back online.")
spark_at(src, cardinal_only = TRUE)
- adjustBruteLoss(-(rand(10,50)), do_update_health = FALSE)
- adjustFireLoss(-(rand(10,50)))
+ heal_damage(rand(10,50), BRUTE, skip_update_health = TRUE)
+ heal_damage(rand(10,50), BURN)
//spark for no reason
if(prob(5))
@@ -170,7 +170,7 @@
//ion rifle!
/mob/living/simple_animal/hostile/retaliate/malf_drone/emp_act(severity)
- adjustFireLoss(rand(3,15) * (severity + 1))
+ take_damage(rand(3,15) * (severity + 1), BURN)
disabled = rand(150, 600)
hostile_drone = 0
walk(src,0)
diff --git a/code/modules/mob/living/simple_animal/hostile/retaliate/giant_crab.dm b/code/modules/mob/living/simple_animal/hostile/retaliate/giant_crab.dm
index a13a98f31030..7546a2f71be3 100644
--- a/code/modules/mob/living/simple_animal/hostile/retaliate/giant_crab.dm
+++ b/code/modules/mob/living/simple_animal/hostile/retaliate/giant_crab.dm
@@ -93,7 +93,7 @@
release_grab()
return
visible_message(SPAN_DANGER("\The [src] [pick(grab_desc)] \the [victim] in its pincer!"))
- victim.apply_damage(grab_damage, BRUTE, BP_CHEST, DAM_EDGE, used_weapon = "crab's pincer")
+ victim.take_damage(grab_damage, BRUTE, BP_CHEST, DAM_EDGE, used_weapon = "crab's pincer")
/mob/living/simple_animal/hostile/retaliate/giant_crab/proc/release_grab()
if(victim)
diff --git a/code/modules/mob/living/simple_animal/hostile/retaliate/goose.dm b/code/modules/mob/living/simple_animal/hostile/retaliate/goose.dm
index d0b1e8afcff8..5305944b5f0e 100644
--- a/code/modules/mob/living/simple_animal/hostile/retaliate/goose.dm
+++ b/code/modules/mob/living/simple_animal/hostile/retaliate/goose.dm
@@ -54,8 +54,8 @@
if(!loose && prob(25) && (attacking_with && attacking_with.force >= loose_threshold)) //second wind
loose = TRUE
set_max_health(initial(mob_default_max_health) * 1.5)
- setBruteLoss(0)
- setFireLoss(0)
+ set_damage(0, BRUTE, skip_update_health = TRUE)
+ set_damage(0, BURN)
enrage_potency = enrage_potency_loose
desc += " The [name] is loose! Oh no!"
update_icon()
diff --git a/code/modules/mob/living/simple_animal/hostile/retaliate/king_of_goats.dm b/code/modules/mob/living/simple_animal/hostile/retaliate/king_of_goats.dm
index 017b5fe527f8..173df1160336 100644
--- a/code/modules/mob/living/simple_animal/hostile/retaliate/king_of_goats.dm
+++ b/code/modules/mob/living/simple_animal/hostile/retaliate/king_of_goats.dm
@@ -26,7 +26,7 @@
natural_weapon = /obj/item/natural_weapon/goatking
var/current_damtype = BRUTE
var/list/elemental_weapons = list(
- BURN = /obj/item/natural_weapon/goatking/fire,
+ BURN = /obj/item/natural_weapon/goatking/fire,
ELECTROCUTE = /obj/item/natural_weapon/goatking/lightning
)
var/stun_chance = 5 //chance per attack to Weaken target
@@ -61,7 +61,7 @@
mob_default_max_health = 750
natural_weapon = /obj/item/natural_weapon/goatking/unleashed
elemental_weapons = list(
- BURN = /obj/item/natural_weapon/goatking/fire/unleashed,
+ BURN = /obj/item/natural_weapon/goatking/fire/unleashed,
ELECTROCUTE = /obj/item/natural_weapon/goatking/lightning/unleashed
)
default_pixel_y = 5
@@ -153,16 +153,16 @@
visible_message("\The [src]' eyes begin to glow ominously as dust and debris in the area is kicked up in a light breeze.")
stop_automation = TRUE
if(do_after(src, 6 SECONDS, src))
- var/initial_brute = getBruteLoss()
- var/initial_burn = getFireLoss()
+ var/initial_brute = get_damage(BRUTE)
+ var/initial_burn = get_damage(BURN)
visible_message(SPAN_MFAUNA("\The [src] raises its fore-hooves and stomps them into the ground with incredible force!"))
explosion(get_step(src,pick(global.cardinal)), -1, 2, 2, 3, 6)
explosion(get_step(src,pick(global.cardinal)), -1, 1, 4, 4, 6)
explosion(get_step(src,pick(global.cardinal)), -1, 3, 4, 3, 6)
stop_automation = FALSE
spellscast += 2
- setBruteLoss(initial_brute)
- setFireLoss(initial_burn)
+ set_damage(initial_brute, BRUTE, skip_update_health = TRUE)
+ set_damage(initial_burn, BURN)
else
visible_message(SPAN_NOTICE("The [src] loses concentration and huffs haughtily."))
stop_automation = FALSE
diff --git a/code/modules/mob/living/simple_animal/hostile/retaliate/retaliate.dm b/code/modules/mob/living/simple_animal/hostile/retaliate/retaliate.dm
index 706053d576b3..a4d8d49423e8 100644
--- a/code/modules/mob/living/simple_animal/hostile/retaliate/retaliate.dm
+++ b/code/modules/mob/living/simple_animal/hostile/retaliate/retaliate.dm
@@ -42,9 +42,10 @@
H.enemies |= enemies
return 0
-/mob/living/simple_animal/hostile/retaliate/adjustBruteLoss(var/damage, var/do_update_health = FALSE)
+/mob/living/simple_animal/hostile/retaliate/take_damage(damage, damage_type = BRUTE, def_zone, damage_flags = 0, used_weapon, armor_pen, silent = FALSE, override_droplimb, skip_update_health = FALSE)
+ if(damage_type == BRUTE)
+ Retaliate()
..()
- Retaliate()
/mob/living/simple_animal/hostile/retaliate/buckle_mob(mob/living/M)
. = ..()
diff --git a/code/modules/mob/living/simple_animal/hostile/slug.dm b/code/modules/mob/living/simple_animal/hostile/slug.dm
index 6be1362d635d..3b54817d1e90 100644
--- a/code/modules/mob/living/simple_animal/hostile/slug.dm
+++ b/code/modules/mob/living/simple_animal/hostile/slug.dm
@@ -47,7 +47,7 @@
. = ..()
if(ishuman(.))
var/mob/living/carbon/human/H = .
- if(prob(H.getBruteLoss()/2))
+ if(prob(H.get_damage(BRUTE)/2))
attach(H)
/mob/living/simple_animal/hostile/slug/handle_regular_status_updates()
diff --git a/code/modules/mob/living/simple_animal/hostile/vagrant.dm b/code/modules/mob/living/simple_animal/hostile/vagrant.dm
index 36ad1d84c935..12a504ce04df 100644
--- a/code/modules/mob/living/simple_animal/hostile/vagrant.dm
+++ b/code/modules/mob/living/simple_animal/hostile/vagrant.dm
@@ -54,7 +54,7 @@
var/blood_volume = round(gripping.vessel.total_volume)
if(blood_volume > 5)
gripping.vessel.remove_any(blood_per_tick)
- heal_overall_damage(health_per_tick)
+ heal_damage(health_per_tick, BRUTE)
if(prob(15))
to_chat(gripping, SPAN_DANGER("You feel your fluids being drained!"))
else
diff --git a/code/modules/mob/living/simple_animal/simple_animal.dm b/code/modules/mob/living/simple_animal/simple_animal.dm
index 044a3274cb9c..865b0802db41 100644
--- a/code/modules/mob/living/simple_animal/simple_animal.dm
+++ b/code/modules/mob/living/simple_animal/simple_animal.dm
@@ -268,15 +268,15 @@ var/global/list/simplemob_icon_bitflag_cache = list()
if(bodytemperature < minbodytemp)
fire_alert = 2
- adjustBruteLoss(cold_damage_per_tick)
+ take_damage(cold_damage_per_tick, BRUTE)
else if(bodytemperature > maxbodytemp)
fire_alert = 1
- adjustBruteLoss(heat_damage_per_tick)
+ take_damage(heat_damage_per_tick, BRUTE)
else
fire_alert = 0
if(!atmos_suitable)
- adjustBruteLoss(unsuitable_atmos_damage)
+ take_damage(unsuitable_atmos_damage, BRUTE)
/mob/living/simple_animal/proc/escape(mob/living/M, obj/O)
O.unbuckle_mob(M)
@@ -300,7 +300,7 @@ var/global/list/simplemob_icon_bitflag_cache = list()
damage = Proj.damage / 6
if(Proj.damtype == BRUTE)
damage = Proj.damage / 2
- if(Proj.damtype == BURN)
+ if(Proj.damtype == BRUTE)
damage = Proj.damage / 1.5
if(Proj.agony)
damage += Proj.agony / 6
@@ -309,7 +309,7 @@ var/global/list/simplemob_icon_bitflag_cache = list()
visible_message("[src] is stunned momentarily!")
bullet_impact_visuals(Proj)
- adjustBruteLoss(damage)
+ take_damage(damage, BRUTE)
Proj.on_hit(src)
return 0
@@ -342,7 +342,7 @@ var/global/list/simplemob_icon_bitflag_cache = list()
harm_verb = pick(attack.attack_verb)
if(attack.sharp || attack.edge)
adjustBleedTicks(dealt_damage)
- adjustBruteLoss(dealt_damage)
+ take_damage(dealt_damage, BRUTE)
user.visible_message(SPAN_DANGER("\The [user] [harm_verb] \the [src]!"))
user.do_attack_animation(src)
return TRUE
@@ -355,7 +355,7 @@ var/global/list/simplemob_icon_bitflag_cache = list()
if(!MED.animal_heal)
to_chat(user, SPAN_WARNING("\The [MED] won't help \the [src] at all!"))
else if(current_health < get_max_health() && MED.can_use(1))
- adjustBruteLoss(-MED.animal_heal)
+ heal_damage(MED.animal_heal, BRUTE)
visible_message(SPAN_NOTICE("\The [user] applies \the [MED] to \the [src]."))
MED.use(1)
else
@@ -394,12 +394,10 @@ var/global/list/simplemob_icon_bitflag_cache = list()
var/damage = O.force
if (O.damtype == PAIN)
damage = 0
- if (O.damtype == STUN)
- damage = (O.force / 8)
if(supernatural && istype(O,/obj/item/nullrod))
damage *= 2
purge = 3
- adjustBruteLoss(damage)
+ take_damage(damage, BRUTE)
if(O.edge || O.sharp)
adjustBleedTicks(damage)
@@ -424,7 +422,7 @@ var/global/list/simplemob_icon_bitflag_cache = list()
/mob/living/simple_animal/death(gibbed, deathmessage = "dies!", show_dead_message)
density = FALSE
- adjustBruteLoss(get_max_health()) //Make sure dey dead.
+ take_damage(get_max_health(), BRUTE) //Make sure dey dead.
walk_to(src,0)
. = ..(gibbed,deathmessage,show_dead_message)
@@ -438,7 +436,7 @@ var/global/list/simplemob_icon_bitflag_cache = list()
damage = 120
if(3)
damage = 30
- apply_damage(damage, BRUTE, damage_flags = DAM_EXPLODE)
+ take_damage(damage, BRUTE, damage_flags = DAM_EXPLODE)
/mob/living/simple_animal/proc/SA_attackable(target_mob)
if (isliving(target_mob))
@@ -522,7 +520,7 @@ var/global/list/simplemob_icon_bitflag_cache = list()
/mob/living/simple_animal/proc/handle_bleeding()
bleed_ticks--
- adjustBruteLoss(1)
+ take_damage(1, BRUTE)
var/obj/effect/decal/cleanable/blood/drip/drip = new(get_turf(src))
drip.basecolor = bleed_colour
@@ -544,7 +542,7 @@ var/global/list/simplemob_icon_bitflag_cache = list()
/mob/living/simple_animal/proc/reflect_unarmed_damage(var/mob/living/carbon/human/attacker, var/damage_type, var/description)
if(attacker.a_intent == I_HURT)
- attacker.apply_damage(rand(return_damage_min, return_damage_max), damage_type, attacker.get_active_held_item_slot(), used_weapon = description)
+ attacker.take_damage(rand(return_damage_min, return_damage_max), damage_type, attacker.get_active_held_item_slot(), used_weapon = description)
if(rand(25))
to_chat(attacker, SPAN_WARNING("Your attack has no obvious effect on \the [src]'s [description]!"))
@@ -553,22 +551,6 @@ var/global/list/simplemob_icon_bitflag_cache = list()
natural_weapon = new natural_weapon(src)
return natural_weapon
-/mob/living/simple_animal/getCloneLoss()
- . = max(0, gene_damage)
-
-/mob/living/simple_animal/adjustCloneLoss(var/amount, var/do_update_health = TRUE)
- SHOULD_CALL_PARENT(FALSE)
- setCloneLoss(gene_damage + amount)
- if(do_update_health)
- update_health()
-
-/mob/living/simple_animal/setCloneLoss(amount)
- if(gene_damage >= 0)
- var/current_max_health = get_max_health()
- gene_damage = clamp(amount, 0, current_max_health)
- if(gene_damage >= current_max_health)
- death()
-
/mob/living/simple_animal/get_admin_job_string()
return "Animal"
@@ -647,3 +629,23 @@ var/global/list/simplemob_icon_bitflag_cache = list()
/mob/living/simple_animal/check_has_mouth()
return TRUE
+
+/mob/living/simple_animal/get_handled_damage_types()
+ var/static/list/mob_damage_types = list(
+ BRUTE,
+ BURN,
+ TOX,
+ OXY,
+ CLONE
+ )
+ return mob_damage_types
+
+/mob/living/simple_animal/get_lethal_damage_types()
+ var/static/list/lethal_damage_types = list(
+ BRUTE,
+ BURN,
+ TOX,
+ OXY,
+ CLONE
+ )
+ return lethal_damage_types
\ No newline at end of file
diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm
index 64eb428b4be6..0f96437f7e6c 100644
--- a/code/modules/mob/mob.dm
+++ b/code/modules/mob/mob.dm
@@ -585,7 +585,7 @@
return 0
/mob/living/carbon/human/pull_damage()
- if(!lying || getBruteLoss() + getFireLoss() < 100)
+ if(!lying || get_damage(BRUTE) + get_damage(BURN) < 100)
return FALSE
for(var/obj/item/organ/external/e in get_external_organs())
if((e.status & ORGAN_BROKEN) && !e.splinted)
@@ -813,8 +813,8 @@
/mob/living/silicon/robot/remove_implant(var/obj/item/implant, var/surgical_removal = FALSE)
LAZYREMOVE(embedded, implant)
- adjustBruteLoss(5, do_update_health = FALSE)
- adjustFireLoss(10)
+ take_damage(5, BRUTE, skip_update_health = TRUE)
+ take_damage(10, BURN)
. = ..()
/mob/living/carbon/human/remove_implant(var/obj/item/implant, var/surgical_removal = FALSE, var/obj/item/organ/external/affected)
@@ -830,7 +830,7 @@
LAZYREMOVE(wound.embedded_objects, implant)
if(!surgical_removal)
shock_stage+=20
- affected.take_external_damage((implant.w_class * 3), 0, DAM_EDGE, "Embedded object extraction")
+ affected.take_damage((implant.w_class * 3), BRUTE, damage_flags = DAM_EDGE, used_weapon = "Embedded object extraction")
if(!BP_IS_PROSTHETIC(affected) && prob(implant.w_class * 5) && affected.sever_artery()) //I'M SO ANEMIC I COULD JUST -DIE-.
custom_pain("Something tears wetly in your [affected.name] as [implant] is pulled free!", 50, affecting = affected)
. = ..()
@@ -1084,10 +1084,11 @@
// Work out if we have any brain damage impacting our dexterity.
var/dex_malus = 0
- if(getBrainLoss())
+ var/brainloss = get_brain_damage()
+ if(brainloss)
var/brainloss_threshold = get_config_value(/decl/config/num/dex_malus_brainloss_threshold)
- if(getBrainLoss() > brainloss_threshold) ///brainloss shouldn't instantly cripple you, so the effects only start once past the threshold and escalate from there.
- dex_malus = clamp(CEILING((getBrainLoss()-brainloss_threshold)/10), 0, length(global.dexterity_levels))
+ if(brainloss > brainloss_threshold) ///brainloss shouldn't instantly cripple you, so the effects only start once past the threshold and escalate from there.
+ dex_malus = clamp(CEILING((brainloss-brainloss_threshold)/10), 0, length(global.dexterity_levels))
if(dex_malus > 0)
dex_malus = global.dexterity_levels[dex_malus]
@@ -1437,9 +1438,6 @@
/mob/can_be_injected_by(var/atom/injector)
return FALSE // Handled elsewhere in syringe logic.
-/mob/proc/getBrainLoss()
- return 0
-
/mob/proc/get_bodytype_category()
return get_bodytype()?.bodytype_category
diff --git a/code/modules/mob/mob_defines.dm b/code/modules/mob/mob_defines.dm
index a23c167a1422..f1860d4fe69e 100644
--- a/code/modules/mob/mob_defines.dm
+++ b/code/modules/mob/mob_defines.dm
@@ -121,8 +121,6 @@
var/list/mutations = list() // TODO: Lazylist this var.
//see: setup.dm for list of mutations
- var/radiation = 0.0//Carbon
-
var/voice_name = "unidentifiable voice"
var/faction = MOB_FACTION_NEUTRAL //Used for checking whether hostile simple animals will attack you, possibly more stuff later
diff --git a/code/modules/mob/mob_grabs.dm b/code/modules/mob/mob_grabs.dm
index cbef1aadfc60..303f9add53ce 100644
--- a/code/modules/mob/mob_grabs.dm
+++ b/code/modules/mob/mob_grabs.dm
@@ -1,6 +1,4 @@
// Casting stubs for grabs, check /mob/living for full definition.
-/mob/proc/apply_damage(var/damage = 0,var/damagetype = BRUTE, var/def_zone = null, var/damage_flags = 0, var/used_weapon = null, var/armor_pen, var/silent = FALSE)
- return
/mob/proc/get_blocked_ratio(def_zone, damage_type, damage_flags, armor_pen, damage)
return
/mob/proc/standard_weapon_hit_effects(obj/item/I, mob/living/user, var/effective_force, var/hit_zone)
diff --git a/code/modules/modular_computers/file_system/programs/generic/folding.dm b/code/modules/modular_computers/file_system/programs/generic/folding.dm
index 30c5c9ffcd0e..1f61cbbd50ec 100644
--- a/code/modules/modular_computers/file_system/programs/generic/folding.dm
+++ b/code/modules/modular_computers/file_system/programs/generic/folding.dm
@@ -75,7 +75,7 @@
program_status = PROGRAM_STATUS_RUNNING_WARM
if(PROGRAM_STATUS_RUNNING_WARM) //50% chance on subsequent ticks to make the program able to crash.
to_chat(holder, SPAN_WARNING("\The [host] gets scaldingly hot, burning you!"))
- holder?.take_overall_damage(0, 0.45) //It checks holder? so that it doesn't cause a runtime error if no one is holding it.
+ holder?.take_damage(0.45, BURN) //It checks holder? so that it doesn't cause a runtime error if no one is holding it.
if (program_status == PROGRAM_STATUS_RUNNING_WARM)
program_status = PROGRAM_STATUS_RUNNING_SCALDING
if(PROGRAM_STATUS_RUNNING_SCALDING) //1/3 chance on all following ticks for the program to crash.
diff --git a/code/modules/modular_computers/file_system/programs/research/ai_restorer.dm b/code/modules/modular_computers/file_system/programs/research/ai_restorer.dm
index 0f99a187cc34..50d9fcdab322 100644
--- a/code/modules/modular_computers/file_system/programs/research/ai_restorer.dm
+++ b/code/modules/modular_computers/file_system/programs/research/ai_restorer.dm
@@ -66,9 +66,9 @@
if(!A || !restoring)
restoring = 0 // If the AI was removed, stop the restoration sequence.
return
- A.adjustFireLoss(-4, do_update_health = FALSE)
- A.adjustBruteLoss(-4, do_update_health = FALSE)
- A.adjustOxyLoss(-4)
+ A.heal_damage(4, BURN, skip_update_health = TRUE)
+ A.heal_damage(4, BRUTE, skip_update_health = TRUE)
+ A.heal_damage(4, OXY)
A.update_health()
// If the AI is dead, revive it.
if (A.stat == DEAD && !A.should_be_dead())
diff --git a/code/modules/modular_computers/os/_os.dm b/code/modules/modular_computers/os/_os.dm
index f842de5083b5..582efd719fa1 100644
--- a/code/modules/modular_computers/os/_os.dm
+++ b/code/modules/modular_computers/os/_os.dm
@@ -164,10 +164,10 @@
if(hard_drive)
if(prob(10))
hard_drive.visible_message("[src] emits some ominous clicks.")
- hard_drive.take_damage(0.5 * hard_drive.health)
+ hard_drive.take_damage(0.5 * hard_drive.health, BRUTE)
else if(prob(5))
hard_drive.visible_message("[src] emits some ominous clicks.")
- hard_drive.take_damage(hard_drive.health)
+ hard_drive.take_damage(hard_drive.health, BRUTE)
update_host_icon()
/datum/extension/interactive/os/proc/system_boot()
diff --git a/code/modules/multiz/movement.dm b/code/modules/multiz/movement.dm
index b36246164d43..b9f748be3723 100644
--- a/code/modules/multiz/movement.dm
+++ b/code/modules/multiz/movement.dm
@@ -245,7 +245,7 @@
if(M == src)
continue
visible_message("\The [src] hits \the [M.name]!")
- M.take_overall_damage(fall_damage)
+ M.take_damage(fall_damage, BRUTE)
return TRUE
return FALSE
@@ -267,15 +267,15 @@
var/fall_height = get_fall_height()
var/min_damage = 7 * fall_height
var/max_damage = 14 * fall_height
- apply_damage(rand(min_damage, max_damage), BRUTE, BP_HEAD, armor_pen = 50)
- apply_damage(rand(min_damage, max_damage), BRUTE, BP_CHEST, armor_pen = 50)
- apply_damage(rand(min_damage, max_damage), BRUTE, BP_GROIN, armor_pen = 75)
- apply_damage(rand(min_damage, max_damage), BRUTE, BP_L_LEG, armor_pen = 100)
- apply_damage(rand(min_damage, max_damage), BRUTE, BP_R_LEG, armor_pen = 100)
- apply_damage(rand(min_damage, max_damage), BRUTE, BP_L_FOOT, armor_pen = 100)
- apply_damage(rand(min_damage, max_damage), BRUTE, BP_R_FOOT, armor_pen = 100)
- apply_damage(rand(min_damage, max_damage), BRUTE, BP_L_ARM, armor_pen = 75)
- apply_damage(rand(min_damage, max_damage), BRUTE, BP_R_ARM, armor_pen = 75)
+ take_damage(rand(min_damage, max_damage), BRUTE, BP_HEAD, armor_pen = 50)
+ take_damage(rand(min_damage, max_damage), BRUTE, BP_CHEST, armor_pen = 50)
+ take_damage(rand(min_damage, max_damage), BRUTE, BP_GROIN, armor_pen = 75)
+ take_damage(rand(min_damage, max_damage), BRUTE, BP_L_LEG, armor_pen = 100)
+ take_damage(rand(min_damage, max_damage), BRUTE, BP_R_LEG, armor_pen = 100)
+ take_damage(rand(min_damage, max_damage), BRUTE, BP_L_FOOT, armor_pen = 100)
+ take_damage(rand(min_damage, max_damage), BRUTE, BP_R_FOOT, armor_pen = 100)
+ take_damage(rand(min_damage, max_damage), BRUTE, BP_L_ARM, armor_pen = 75)
+ take_damage(rand(min_damage, max_damage), BRUTE, BP_R_ARM, armor_pen = 75)
SET_STATUS_MAX(src, STAT_WEAK, 3)
if(prob(skill_fail_chance(SKILL_HAULING, 40, SKILL_EXPERT, 2)))
var/list/victims = list()
diff --git a/code/modules/organs/blood.dm b/code/modules/organs/blood.dm
index 6beb21ae5610..895dea783664 100644
--- a/code/modules/organs/blood.dm
+++ b/code/modules/organs/blood.dm
@@ -339,7 +339,7 @@
blood_volume *= 1.25
var/min_efficiency = recent_pump ? 0.5 : 0.3
- blood_volume *= max(min_efficiency, (1-(heart.damage / heart.max_damage)))
+ blood_volume *= max(min_efficiency, (1-(heart.organ_damage / heart.max_damage)))
if(!heart.open && has_chemical_effect(CE_BLOCKAGE, 1))
blood_volume *= max(0, 1-GET_CHEMICAL_EFFECT(src, CE_BLOCKAGE))
@@ -362,7 +362,7 @@
else
blood_volume = 100
- var/blood_volume_mod = max(0, 1 - getOxyLossPercent()/(species.total_health/2))
+ var/blood_volume_mod = max(0, 1 - get_suffocation_percent()/(species.total_health/2))
var/oxygenated_mult = 0
switch(GET_CHEMICAL_EFFECT(src, CE_OXYGENATED))
if(1)
diff --git a/code/modules/organs/external/_external.dm b/code/modules/organs/external/_external.dm
index b84012f2d462..6e32580f929f 100644
--- a/code/modules/organs/external/_external.dm
+++ b/code/modules/organs/external/_external.dm
@@ -186,7 +186,7 @@
if(owner && burn_damage)
owner.custom_pain("Something inside your [src] burns a [severity < 2 ? "bit" : "lot"]!", power * 15) //robotic organs won't feel it anyway
- take_external_damage(0, burn_damage, 0, used_weapon = "Hot metal")
+ take_damage(burn_damage, BURN, used_weapon = "Hot metal")
check_pain_disarm()
if(owner && (limb_flags & ORGAN_FLAG_CAN_STAND))
@@ -430,8 +430,7 @@
owner.verbs -= /mob/living/carbon/human/proc/undislocate
/obj/item/organ/external/update_organ_health()
- damage = min(max_damage, (brute_dam + burn_dam))
- return
+ organ_damage = min(max_damage, (brute_dam + burn_dam))
//If "in_place" is TRUE will make organs skip their install/uninstall effects and the sub-limbs and internal organs
/obj/item/organ/external/do_install(mob/living/carbon/human/target, obj/item/organ/external/affected, in_place, update_icon, detached)
@@ -571,9 +570,7 @@
to_chat(user, SPAN_WARNING("You must stand still to do that."))
return 0
- switch(damage_type)
- if(BRUTE) src.heal_damage(repair_amount, 0, 0, 1)
- if(BURN) src.heal_damage(0, repair_amount, 0, 1)
+ heal_damage(repair_amount, damage_type) // todo robo repair
owner.try_refresh_visible_overlays()
if(user == src.owner)
var/decl/pronouns/G = user.get_pronouns()
@@ -629,19 +626,19 @@ This function completely restores a damaged organ to perfect condition.
I.remove_rejuv()
..()
-/obj/item/organ/external/proc/createwound(var/type = CUT, var/damage, var/surgical)
+/obj/item/organ/external/proc/createwound(var/type = WOUND_CUT, var/damage, var/surgical)
if(!owner || damage <= 0)
return
if(BP_IS_CRYSTAL(src) && (damage >= 15 || prob(1)))
- type = SHATTER
+ type = WOUND_SHATTER
playsound(loc, 'sound/effects/hit_on_shattered_glass.ogg', 40, 1) // Crash!
//moved these before the open_wound check so that having many small wounds for example doesn't somehow protect you from taking internal damage (because of the return)
//Brute damage can possibly trigger an internal wound, too.
var/local_damage = brute_dam + burn_dam + damage
- if(!surgical && (type in list(CUT, PIERCE, BRUISE)) && damage > 15 && local_damage > 30)
+ if(!surgical && (type in list(WOUND_CUT, WOUND_PIERCE, WOUND_BRUISE)) && damage > 15 && local_damage > 30)
var/internal_damage
if(prob(damage) && sever_artery())
@@ -652,17 +649,17 @@ This function completely restores a damaged organ to perfect condition.
owner.custom_pain("You feel something rip in your [name]!", 50, affecting = src)
//Burn damage can cause fluid loss due to blistering and cook-off
- if((type in list(BURN, LASER)) && (damage > 5 || damage + burn_dam >= 15) && !BP_IS_PROSTHETIC(src))
+ if((type in list(WOUND_BURN, WOUND_LASER)) && (damage > 5 || damage + burn_dam >= 15) && !BP_IS_PROSTHETIC(src))
var/fluid_loss_severity
switch(type)
- if(BURN) fluid_loss_severity = FLUIDLOSS_WIDE_BURN
- if(LASER) fluid_loss_severity = FLUIDLOSS_CONC_BURN
+ if(WOUND_BURN) fluid_loss_severity = FLUIDLOSS_WIDE_BURN
+ if(WOUND_LASER) fluid_loss_severity = FLUIDLOSS_CONC_BURN
var/fluid_loss = (damage/(owner.get_max_health() - get_config_value(/decl/config/num/health_health_threshold_dead))) * SPECIES_BLOOD_DEFAULT * fluid_loss_severity
owner.remove_blood(fluid_loss)
// first check whether we can widen an existing wound
if(!surgical && LAZYLEN(wounds) && prob(max(50+(number_wounds-1)*10,90)))
- if((type == CUT || type == BRUISE) && damage >= 5)
+ if((type == WOUND_CUT || type == WOUND_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)
@@ -728,7 +725,7 @@ This function completely restores a damaged organ to perfect condition.
return TRUE
for(var/obj/item/organ/internal/I in internal_organs)
- if(I.getToxLoss())
+ if(I.get_toxins_damage())
return TRUE
if(last_dam != brute_dam + burn_dam) // Process when we are fully healed up.
@@ -850,7 +847,7 @@ Note that amputating the affected organ does in fact remove the infection from t
owner.update_body(1)
germ_level++
- owner.adjustToxLoss(1)
+ owner.take_damage(1, TOX)
//Updating wounds. Handles wound natural I had some free spachealing, internal bleedings and infections
/obj/item/organ/external/proc/update_wounds()
@@ -893,10 +890,10 @@ Note that amputating the affected organ does in fact remove the infection from t
// making it look prettier on scanners
heal_amt = round(heal_amt,0.1)
var/dam_type = BRUTE
- if(W.damage_type == BURN)
+ if(W.wound_type == WOUND_BURN)
dam_type = BURN
if(owner?.can_autoheal(dam_type))
- W.heal_damage(heal_amt)
+ W.heal_wound_damage(heal_amt)
// sync the organ's damage with its wounds
update_damages()
@@ -926,7 +923,7 @@ Note that amputating the affected organ does in fact remove the infection from t
qdel(W)
continue
- if(W.damage_type == BURN)
+ if(W.wound_type == WOUND_BURN)
burn_dam += W.damage
else
brute_dam += W.damage
@@ -938,7 +935,7 @@ Note that amputating the affected organ does in fact remove the infection from t
clamped |= W.clamped
number_wounds += W.amount
- damage = brute_dam + burn_dam
+ organ_damage = brute_dam + burn_dam
update_damage_ratios()
/obj/item/organ/external/proc/update_damage_ratios()
@@ -1331,11 +1328,11 @@ Note that amputating the affected organ does in fact remove the infection from t
if(!supplied_wound)
for(var/datum/wound/wound in wounds)
- if((wound.damage_type == CUT || wound.damage_type == PIERCE) && wound.damage >= W.w_class * 5)
+ if((wound.wound_type == WOUND_CUT || wound.wound_type == WOUND_PIERCE) && wound.damage >= W.w_class * 5)
supplied_wound = wound
break
if(!supplied_wound)
- supplied_wound = createwound(PIERCE, W.w_class * 5)
+ supplied_wound = createwound(WOUND_PIERCE, W.w_class * 5)
if(!supplied_wound || (W in supplied_wound.embedded_objects)) // Just in case.
return
@@ -1501,7 +1498,7 @@ Note that amputating the affected organ does in fact remove the infection from t
if(LAZYLEN(internal_organs) && prob(brute_dam + force))
owner.custom_pain("A piece of bone in your [encased ? encased : name] moves painfully!", 50, affecting = src)
var/obj/item/organ/internal/I = pick(internal_organs)
- I.take_internal_damage(rand(3,5))
+ I.take_damage(rand(3,5), BRUTE)
/obj/item/organ/external/proc/jointlock(mob/attacker)
if(!can_feel_pain())
@@ -1512,7 +1509,7 @@ Note that amputating the affected organ does in fact remove the infection from t
to_chat(owner, "You feel extreme pain!")
var/max_halloss = round(owner.species.total_health * 0.8 * ((100 - armor) / 100)) //up to 80% of passing out, further reduced by armour
- add_pain(clamp(0, max_halloss - owner.getHalLoss(), 30))
+ add_pain(clamp(0, max_halloss - owner.get_damage(PAIN), 30))
//Adds autopsy data for used_weapon.
/obj/item/organ/external/proc/add_autopsy_data(var/used_weapon, var/damage)
@@ -1543,7 +1540,7 @@ Note that amputating the affected organ does in fact remove the infection from t
else if(status & ORGAN_BROKEN)
. += max_delay * 3/8
else if(BP_IS_PROSTHETIC(src))
- . += max_delay * CLAMP01(damage/max_damage)
+ . += max_delay * CLAMP01(organ_damage/max_damage)
/obj/item/organ/external/proc/is_robotic()
return bodytype.is_robotic
@@ -1558,7 +1555,7 @@ Note that amputating the affected organ does in fact remove the infection from t
/obj/item/organ/external/die() //External organs dying on a dime causes some real issues in combat
if(!BP_IS_PROSTHETIC(src) && !BP_IS_CRYSTAL(src))
- var/decay_rate = damage/(max_damage*2)
+ var/decay_rate = organ_damage/(max_damage*2)
germ_level += round(rand(decay_rate,decay_rate*1.5)) //So instead, we're going to say the damage is so severe its functions are slowly failing due to the extensive damage
else //TODO: more advanced system for synths
if(istype(src,/obj/item/organ/external/chest) || istype(src,/obj/item/organ/external/groin))
diff --git a/code/modules/organs/external/_external_damage.dm b/code/modules/organs/external/_external_damage.dm
index 6f6f150edcbd..47f70a135e6f 100644
--- a/code/modules/organs/external/_external_damage.dm
+++ b/code/modules/organs/external/_external_damage.dm
@@ -6,16 +6,14 @@
//Continued damage to vital organs can kill you, and robot organs don't count towards total damage so no need to cap them.
return (BP_IS_PROSTHETIC(src) || brute_dam + burn_dam + additional_damage < max_damage * 4)
-/obj/item/organ/external/take_general_damage(var/amount, var/silent = FALSE)
- take_external_damage(amount)
-
-/obj/item/organ/external/proc/take_external_damage(brute, burn, damage_flags, used_weapon, override_droplimb)
+/obj/item/organ/external/take_damage(damage, damage_type = BRUTE, def_zone, damage_flags = 0, used_weapon, armor_pen, silent = FALSE, override_droplimb, skip_update_health = FALSE)
if(!owner)
return
- brute = round(brute * get_brute_mod(damage_flags), 0.1)
- burn = round(burn * get_burn_mod(damage_flags), 0.1)
+ // TODO: rework organs to use damage handlers.
+ var/brute = (damage_type == BRUTE) ? round(damage * get_brute_mod(damage_flags), 0.1) : 0
+ var/burn = (damage_type == BURN) ? round(damage * get_burn_mod(damage_flags), 0.1) : 0
if((brute <= 0) && (burn <= 0))
return 0
@@ -76,21 +74,21 @@
var/can_cut = !block_cut && !BP_IS_PROSTHETIC(src) && (sharp || prob(brute))
if(brute)
- var/to_create = BRUISE
+ var/to_create = WOUND_BRUISE
if(can_cut)
- to_create = CUT
+ to_create = WOUND_CUT
//need to check sharp again here so that blunt damage that was strong enough to break skin doesn't give puncture wounds
if(sharp && !edge)
- to_create = PIERCE
+ to_create = WOUND_PIERCE
created_wound = createwound(to_create, brute)
if(burn)
if(laser)
- createwound(LASER, burn)
+ createwound(WOUND_LASER, burn)
if(prob(40))
owner.IgniteMob()
else
- createwound(BURN, burn)
+ createwound(WOUND_BURN, burn)
//Initial pain spike
add_pain(0.6*burn + 0.4*brute)
@@ -153,7 +151,7 @@
var/list/victims = list()
var/organ_hit_chance = 0
for(var/obj/item/organ/internal/I in internal_organs)
- if(I.damage < I.max_damage)
+ if(I.organ_damage < I.max_damage)
victims[I] = I.relative_size
organ_hit_chance += I.relative_size
@@ -170,31 +168,35 @@
if(prob(organ_hit_chance))
var/obj/item/organ/internal/victim = pickweight(victims)
damage_amt -= max(damage_amt*victim.damage_reduction, 0)
- victim.take_internal_damage(damage_amt)
+ victim.take_damage(damage_amt, burn ? BURN : BRUTE)
return TRUE
-/obj/item/organ/external/heal_damage(brute, burn, internal = 0, robo_repair = 0)
- if(BP_IS_PROSTHETIC(src) && !robo_repair)
+/obj/item/organ/external/heal_damage(var/damage, var/damage_type = BRUTE, var/def_zone = null, var/damage_flags = 0, skip_update_health = FALSE)
+ if(BP_IS_PROSTHETIC(src)) // && !robo_repair)
return
+ // TODO: rework organs to use damage handlers.
+ var/brute = (damage_type == BRUTE) ? damage : 0
+ var/burn = (damage_type == BURN) ? damage : 0
+
//Heal damage on the individual wounds
for(var/datum/wound/W in wounds)
- if(brute == 0 && burn == 0)
- break
-
- // heal brute damage
- if(W.damage_type == BURN)
- burn = W.heal_damage(burn)
- else
- brute = W.heal_damage(brute)
-
- if(internal)
- status &= ~ORGAN_BROKEN
+ if(damage_type == BRUTE)
+ if(brute == 0)
+ break
+ if(W.wound_type != WOUND_BURN)
+ brute = W.heal_wound_damage(brute)
+
+ if(damage_type == BURN)
+ if(burn == 0)
+ break
+ if(W.wound_type == WOUND_BURN)
+ burn = W.heal_wound_damage(burn)
//Sync the organ's damage with its wounds
update_damages()
- owner.update_health()
-
+ if(owner && !skip_update_health)
+ owner.update_health()
return update_damstate()
// Brute/burn
@@ -260,7 +262,7 @@
lasting_pain += 5
var/tox_dam = 0
for(var/obj/item/organ/internal/I in internal_organs)
- tox_dam += I.getToxLoss()
+ tox_dam += I.get_toxins_damage()
return pain + lasting_pain + 0.7 * brute_dam + 0.8 * burn_dam + 0.3 * tox_dam + 0.5 * get_genetic_damage()
/obj/item/organ/external/proc/remove_pain(var/amount)
@@ -331,7 +333,7 @@
if(A)
B = A.brute_mult
if(!BP_IS_PROSTHETIC(src))
- B *= species.get_brute_mod(owner)
+ B *= species.get_damage_modifier(owner, BRUTE)
var/blunt = !(damage_flags & DAM_EDGE|DAM_SHARP)
if(blunt && BP_IS_BRITTLE(src))
B *= 1.5
@@ -345,7 +347,7 @@
if(A)
B = A.burn_mult
if(!BP_IS_PROSTHETIC(src))
- B *= species.get_burn_mod(owner)
+ B *= species.get_damage_modifier(owner, BURN)
if(BP_IS_CRYSTAL(src))
B *= 0.1
return B
diff --git a/code/modules/organs/external/diagnostics.dm b/code/modules/organs/external/diagnostics.dm
index d37c96f03597..41b3f758a0c9 100644
--- a/code/modules/organs/external/diagnostics.dm
+++ b/code/modules/organs/external/diagnostics.dm
@@ -29,7 +29,7 @@
var/list/wound_descriptors = list()
for(var/datum/wound/W in wounds)
var/this_wound_desc = W.desc
- if(W.damage_type == BURN && W.salved)
+ if(W.wound_type == WOUND_BURN && W.salved)
this_wound_desc = "salved [this_wound_desc]"
if(W.bleeding())
@@ -211,7 +211,7 @@
explanation = "Patient has internal organ damage."
/decl/diagnostic_sign/liver/manifested_in(obj/item/organ/external/victim)
- return victim.owner && victim.owner.getToxLoss() >= 25
+ return victim.owner && victim.owner.get_damage(TOX) >= 25
/decl/diagnostic_sign/oxygenation
name = "Cyanosis"
diff --git a/code/modules/organs/external/head.dm b/code/modules/organs/external/head.dm
index 9ea8af56647d..8ce48ecaf7e7 100644
--- a/code/modules/organs/external/head.dm
+++ b/code/modules/organs/external/head.dm
@@ -80,7 +80,7 @@
has_lips = (bodytype.appearance_flags & HAS_LIPS)
can_intake_reagents = !(bodytype.body_flags & BODY_FLAG_NO_EAT)
-/obj/item/organ/external/head/take_external_damage(brute, burn, damage_flags, used_weapon, override_droplimb)
+/obj/item/organ/external/head/take_damage(damage, damage_type = BRUTE, def_zone, damage_flags = 0, used_weapon, armor_pen, silent = FALSE, override_droplimb, skip_update_health = FALSE)
. = ..()
if (!(status & ORGAN_DISFIGURED))
if (brute_dam > 40)
diff --git a/code/modules/organs/external/wounds/wound.dm b/code/modules/organs/external/wounds/wound.dm
index 06d0648078fb..c551dae24b59 100644
--- a/code/modules/organs/external/wounds/wound.dm
+++ b/code/modules/organs/external/wounds/wound.dm
@@ -16,12 +16,13 @@
var/created = 0
var/amount = 1 // number of wounds of this type
var/germ_level = 0 // amount of germs in the wound
- var/obj/item/organ/external/parent_organ // the organ the wound is on, if on an organ
+ // the organ the wound is on, if on an organ
+ var/obj/item/organ/external/parent_organ
/* These are defined by the wound type and should not be changed */
var/list/stages // stages such as "cut", "deep cut", etc.
var/max_bleeding_stage = 0 // maximum stage at which bleeding should still happen. Beyond this stage bleeding is prevented.
- var/damage_type = CUT // one of CUT, PIERCE, BRUISE, BURN
+ var/wound_type = WOUND_CUT // one of WOUND_CUT, WOUND_PIERCE, WOUND_BRUISE, WOUND_BURN, WOUND_SHATTER
var/autoheal_cutoff = 15 // the maximum amount of damage that this wound can have and still autoheal
// helper lists
@@ -81,26 +82,38 @@
// checks whether the wound has been appropriately treated
/datum/wound/proc/is_treated()
- if(!LAZYLEN(embedded_objects))
- switch(damage_type)
- if(BRUISE, CUT, PIERCE)
- return bandaged
- if(BURN)
- return salved
-
- // Checks whether other other can be merged into src.
+ if(LAZYLEN(embedded_objects))
+ return FALSE
+ switch(wound_type)
+ if(WOUND_BRUISE, WOUND_CUT, WOUND_PIERCE)
+ return !!bandaged
+ if(WOUND_BURN)
+ return !!salved
+ return FALSE
+
+// Checks whether other other can be merged into src.
/datum/wound/proc/can_merge_wounds(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.can_autoheal()) != !(src.can_autoheal())) return 0
- if (other.is_surgical() != src.is_surgical()) 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.parent_organ != parent_organ) return 0
- return 1
+ if (other.type != type)
+ return FALSE
+ if (other.current_stage != current_stage)
+ return FALSE
+ if (other.wound_type != wound_type)
+ return FALSE
+ if (!!other.can_autoheal() != !!can_autoheal())
+ return FALSE
+ if (other.is_surgical() != is_surgical())
+ return FALSE
+ if (!!other.bandaged != !!bandaged)
+ return FALSE
+ if (!!other.clamped != !!clamped)
+ return FALSE
+ if (!other.salved != !!salved)
+ return FALSE
+ if (!!other.disinfected != !!disinfected)
+ return FALSE
+ if (other.parent_organ != parent_organ)
+ return FALSE
+ return TRUE
/datum/wound/proc/merge_wound(var/datum/wound/other)
if(LAZYLEN(other.embedded_objects))
@@ -116,43 +129,43 @@
// untreated cuts (and bleeding bruises) and burns are possibly infectable, chance higher if wound is bigger
/datum/wound/proc/infection_check()
if (damage < 10) //small cuts, tiny bruises, and moderate burns shouldn't be infectable.
- return 0
+ return FALSE
if (is_treated() && damage < 25) //anything less than a flesh wound (or equivalent) isn't infectable if treated properly
- return 0
+ return FALSE
if (disinfected)
germ_level = 0 //reset this, just in case
- return 0
+ return FALSE
- if (damage_type == BRUISE && !bleeding()) //bruises only infectable if bleeding
- return 0
+ if (wound_type == WOUND_BRUISE && !bleeding()) //bruises only infectable if bleeding
+ return FALSE
var/dam_coef = round(damage/10)
- switch (damage_type)
- if (BRUISE)
+ switch (wound_type)
+ if (WOUND_BRUISE)
return prob(dam_coef*5)
- if (BURN)
+ if (WOUND_BURN)
return prob(dam_coef*25)
- if (CUT)
+ if (WOUND_CUT)
return prob(dam_coef*10)
- return 0
+ return FALSE
/datum/wound/proc/bandage()
- bandaged = 1
+ bandaged = TRUE
/datum/wound/proc/salve()
- salved = 1
+ salved = TRUE
/datum/wound/proc/disinfect()
- disinfected = 1
+ disinfected = TRUE
// heal the given amount of damage, and if the given amount of damage was more
// than what needed to be healed, return how much heal was left
-/datum/wound/proc/heal_damage(amount)
+/datum/wound/proc/heal_wound_damage(amount)
if(LAZYLEN(embedded_objects))
return amount // heal nothing
if(parent_organ)
- if(damage_type == BURN && !(parent_organ.burn_ratio < 1 || (parent_organ.limb_flags & ORGAN_FLAG_HEALS_OVERKILL)))
+ if(wound_type == WOUND_BURN && !(parent_organ.burn_ratio < 1 || (parent_organ.limb_flags & ORGAN_FLAG_HEALS_OVERKILL)))
return amount //We don't want to heal wounds on irreparable organs.
else if(!(parent_organ.brute_ratio < 1 || (parent_organ.limb_flags & ORGAN_FLAG_HEALS_OVERKILL)))
return amount
@@ -183,7 +196,7 @@
// 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
/datum/wound/proc/can_worsen(damage_type, damage)
- if (src.damage_type != damage_type)
+ if (src.wound_type != damage_type)
return 0 //incompatible damage types
if (src.amount > 1)
diff --git a/code/modules/organs/external/wounds/wound_types.dm b/code/modules/organs/external/wounds/wound_types.dm
index 0508751aa120..9b4c79baa9ac 100644
--- a/code/modules/organs/external/wounds/wound_types.dm
+++ b/code/modules/organs/external/wounds/wound_types.dm
@@ -5,7 +5,7 @@
//because in it's stages list, "deep cut" = 15.
/proc/get_wound_type(var/type, var/damage)
switch(type)
- if(CUT)
+ if(WOUND_CUT)
switch(damage)
if(70 to INFINITY)
return /datum/wound/cut/massive
@@ -19,7 +19,7 @@
return /datum/wound/cut/deep
if(0 to 15)
return /datum/wound/cut/small
- if(PIERCE)
+ if(WOUND_PIERCE)
switch(damage)
if(60 to INFINITY)
return /datum/wound/puncture/massive
@@ -31,9 +31,9 @@
return /datum/wound/puncture/flesh
if(0 to 15)
return /datum/wound/puncture/small
- if(BRUISE)
+ if(WOUND_BRUISE)
return /datum/wound/bruise
- if(BURN, LASER)
+ if(WOUND_BURN, WOUND_LASER)
switch(damage)
if(50 to INFINITY)
return /datum/wound/burn/carbonised
@@ -45,7 +45,7 @@
return /datum/wound/burn/large
if(0 to 15)
return /datum/wound/burn/moderate
- if(SHATTER)
+ if(WOUND_SHATTER)
switch(damage)
if(50 to INFINITY)
return /datum/wound/shatter/smashed
@@ -66,7 +66,7 @@
/** CUTS **/
/datum/wound/cut
bleed_threshold = 5
- damage_type = CUT
+ wound_type = WOUND_CUT
/datum/wound/cut/bandage()
..()
@@ -81,7 +81,7 @@
desc = desc_list[current_stage]
min_damage = damage_list[current_stage]
if(damage > min_damage)
- heal_damage(damage-min_damage)
+ heal_wound_damage(damage-min_damage)
autoheal_cutoff = initial(autoheal_cutoff)
/datum/wound/cut/small
@@ -152,7 +152,7 @@
/** PUNCTURES **/
/datum/wound/puncture
bleed_threshold = 10
- damage_type = PIERCE
+ wound_type = WOUND_PIERCE
/datum/wound/puncture/can_worsen(damage_type, damage)
return 0 //puncture wounds cannot be enlargened
@@ -218,11 +218,11 @@
bleed_threshold = 20
max_bleeding_stage = 3 //only large bruise and above can bleed.
autoheal_cutoff = 30
- damage_type = BRUISE
+ wound_type = WOUND_BRUISE
/** BURNS **/
/datum/wound/burn
- damage_type = BURN
+ wound_type = WOUND_BURN
max_bleeding_stage = 0
/datum/wound/burn/bleeding()
@@ -278,7 +278,7 @@
switch(losstype)
if(DISMEMBER_METHOD_EDGE, DISMEMBER_METHOD_BLUNT)
- damage_type = CUT
+ wound_type = WOUND_CUT
if(BP_IS_PROSTHETIC(lost_limb))
max_bleeding_stage = -1
bleed_threshold = INFINITY
@@ -299,7 +299,7 @@
"scarred stump" = 0
)
if(DISMEMBER_METHOD_BURN, DISMEMBER_METHOD_ACID)
- damage_type = BURN
+ wound_type = WOUND_BURN
stages = list(
"mangled charred stump" = damage_amt*1.3,
"charred stump" = damage_amt,
@@ -315,7 +315,7 @@
/** CRYSTALLINE WOUNDS **/
/datum/wound/shatter
bleed_threshold = INFINITY
- damage_type = SHATTER
+ wound_type = WOUND_SHATTER
max_bleeding_stage = -1
/datum/wound/shatter/close()
diff --git a/code/modules/organs/internal/_internal.dm b/code/modules/organs/internal/_internal.dm
index 009577fb2d48..03d35fa88e07 100644
--- a/code/modules/organs/internal/_internal.dm
+++ b/code/modules/organs/internal/_internal.dm
@@ -83,16 +83,16 @@
/obj/item/organ/internal/is_usable()
return ..() && !is_broken()
-/obj/item/organ/internal/proc/getToxLoss()
+/obj/item/organ/internal/proc/get_toxins_damage()
if(BP_IS_PROSTHETIC(src))
- return damage * 0.5
- return damage
+ return organ_damage * 0.5
+ return organ_damage
/obj/item/organ/internal/proc/bruise()
- damage = max(damage, min_bruised_damage)
+ organ_damage = max(organ_damage, min_bruised_damage)
/obj/item/organ/internal/proc/is_bruised()
- return damage >= min_bruised_damage
+ return organ_damage >= min_bruised_damage
/obj/item/organ/internal/proc/set_max_damage(var/ndamage)
max_damage = FLOOR(ndamage)
@@ -101,17 +101,14 @@
if(damage_threshold_count > 0)
damage_threshold_value = round(max_damage / damage_threshold_count)
-/obj/item/organ/internal/take_general_damage(var/amount, var/silent = FALSE)
- take_internal_damage(amount, silent)
-
-/obj/item/organ/internal/proc/take_internal_damage(amount, var/silent=0)
+/obj/item/organ/internal/take_damage(damage, damage_type = BRUTE, def_zone, damage_flags = 0, used_weapon, armor_pen, silent = FALSE, override_droplimb, skip_update_health = FALSE)
if(BP_IS_PROSTHETIC(src))
- damage = clamp(0, src.damage + (amount * 0.8), max_damage)
+ damage = clamp(0, organ_damage + (damage * 0.8), max_damage)
else
- damage = clamp(0, src.damage + amount, max_damage)
+ damage = clamp(0, organ_damage + damage, max_damage)
//only show this if the organ is not robotic
- if(owner && can_feel_pain() && parent_organ && (amount > 5 || prob(10)))
+ if(owner && can_feel_pain() && parent_organ && (damage > 5 || prob(10)))
var/obj/item/organ/external/parent = GET_EXTERNAL_ORGAN(owner, parent_organ)
if(parent && !silent)
var/degree = ""
@@ -119,16 +116,16 @@
degree = " a lot"
if(damage < 5)
degree = " a bit"
- owner.custom_pain("Something inside your [parent.name] hurts[degree].", amount, affecting = parent)
+ owner.custom_pain("Something inside your [parent.name] hurts[degree].", damage, affecting = parent)
/obj/item/organ/internal/proc/get_visible_state()
- if(damage > max_damage)
+ if(organ_damage > max_damage)
. = "bits and pieces of a destroyed "
else if(is_broken())
. = "broken "
else if(is_bruised())
. = "badly damaged "
- else if(damage > 5)
+ else if(organ_damage > 5)
. = "damaged "
if(status & ORGAN_DEAD)
if(can_recover())
@@ -144,7 +141,7 @@
/obj/item/organ/internal/Process()
SHOULD_CALL_PARENT(TRUE)
..()
- if(owner && damage && !(status & ORGAN_DEAD))
+ if(owner && organ_damage && !(status & ORGAN_DEAD))
handle_damage_effects()
/obj/item/organ/internal/proc/handle_damage_effects()
@@ -160,18 +157,18 @@
// We clamp/round here so that we don't accidentally heal past the threshold and
// cheat our way into a full second threshold of healing.
- damage = clamp(damage-get_organ_heal_amount(), min_heal_val, absolute_max_damage)
+ organ_damage = clamp(organ_damage-get_organ_heal_amount(), min_heal_val, absolute_max_damage)
// If we're within 1 damage of the nearest threshold (such as 0), round us down.
// This should be removed when float-aware modulo comes in in 515, but for now is needed
// as modulo only deals with integers, but organ regeneration is <= 0.3 by default.
- if(!(damage % damage_threshold_value))
- damage = round(damage)
+ if(!(organ_damage % damage_threshold_value))
+ organ_damage = round(organ_damage)
/obj/item/organ/internal/proc/get_organ_heal_amount()
- if(damage >= min_broken_damage)
+ if(organ_damage >= min_broken_damage)
return 0.1
- if(damage >= min_bruised_damage)
+ if(organ_damage >= min_bruised_damage)
return 0.2
return 0.3
@@ -180,7 +177,7 @@
if(!damage_threshold_count || !damage_threshold_value || BP_IS_PROSTHETIC(src))
return FALSE
// Our owner is under stress.
- if(owner.get_blood_oxygenation() < BLOOD_VOLUME_SAFE || GET_CHEMICAL_EFFECT(owner, CE_TOXIN) || owner.radiation || owner.is_asystole())
+ if(owner.get_blood_oxygenation() < BLOOD_VOLUME_SAFE || GET_CHEMICAL_EFFECT(owner, CE_TOXIN) || owner.get_damage(IRRADIATE) || owner.is_asystole())
return FALSE
// If we haven't hit the regeneration cutoff point, heal.
if(min_regeneration_cutoff_threshold && !past_damage_threshold(min_regeneration_cutoff_threshold))
@@ -189,19 +186,19 @@
// - do not have a max cutoff threshold (point at which no further regeneration will occur)
// - are not past our max cutoff threshold
// - are dosed with stabilizer (ignores max cutoff threshold)
- if((damage % damage_threshold_value) && (!max_regeneration_cutoff_threshold || !past_damage_threshold(max_regeneration_cutoff_threshold) || GET_CHEMICAL_EFFECT(owner, CE_STABLE)))
+ if((organ_damage % damage_threshold_value) && (!max_regeneration_cutoff_threshold || !past_damage_threshold(max_regeneration_cutoff_threshold) || GET_CHEMICAL_EFFECT(owner, CE_STABLE)))
return TRUE
return FALSE
/obj/item/organ/internal/proc/surgical_fix(mob/user)
- if(damage > min_broken_damage)
- var/scarring = damage/max_damage
+ if(organ_damage > min_broken_damage)
+ var/scarring = organ_damage/max_damage
scarring = 1 - 0.3 * scarring ** 2 // Between ~15 and 30 percent loss
var/new_max_dam = FLOOR(scarring * max_damage)
if(new_max_dam < max_damage)
to_chat(user, SPAN_WARNING("Not every part of [src] could be saved; some dead tissue had to be removed, making it more susceptible to damage in the future."))
set_max_damage(new_max_dam)
- heal_damage(damage)
+ heal_damage(organ_damage, TOX)
/obj/item/organ/internal/proc/get_scarring_level()
. = (absolute_max_damage - max_damage)/absolute_max_damage
@@ -217,11 +214,11 @@
return
switch (severity)
if (1)
- take_internal_damage(16)
+ take_damage(16, BURN)
if (2)
- take_internal_damage(9)
+ take_damage(9, BURN)
if (3)
- take_internal_damage(6.5)
+ take_damage(6.5, BURN)
/obj/item/organ/internal/on_update_icon()
. = ..()
@@ -235,7 +232,7 @@
// Damage recovery procs! Very exciting.
/obj/item/organ/internal/proc/get_current_damage_threshold()
- return damage_threshold_value > 0 ? round(damage / damage_threshold_value) : INFINITY
+ return damage_threshold_value > 0 ? round(organ_damage / damage_threshold_value) : INFINITY
/obj/item/organ/internal/proc/past_damage_threshold(var/threshold)
return (get_current_damage_threshold() > threshold)
diff --git a/code/modules/organs/internal/appendix.dm b/code/modules/organs/internal/appendix.dm
index 53822e930857..8c9adf39828e 100644
--- a/code/modules/organs/internal/appendix.dm
+++ b/code/modules/organs/internal/appendix.dm
@@ -22,10 +22,10 @@
owner.visible_message("\The [owner] winces slightly.")
if(inflamed > 200)
if(prob(3))
- take_internal_damage(0.1)
+ take_damage(0.1, TOX)
if(owner.can_feel_pain())
owner.visible_message("\The [owner] winces painfully.")
- owner.adjustToxLoss(1)
+ owner.take_damage(1, TOX)
if(inflamed > 400)
if(prob(1))
germ_level += rand(2,6)
@@ -39,5 +39,5 @@
var/obj/item/organ/external/E = GET_EXTERNAL_ORGAN(owner, parent_organ)
E.sever_artery()
E.germ_level = max(INFECTION_LEVEL_TWO, E.germ_level)
- owner.adjustToxLoss(25)
+ owner.take_damage(25, TOX)
qdel(src)
diff --git a/code/modules/organs/internal/brain.dm b/code/modules/organs/internal/brain.dm
index 903247ae18e6..d7ed788d3e6b 100644
--- a/code/modules/organs/internal/brain.dm
+++ b/code/modules/organs/internal/brain.dm
@@ -19,7 +19,7 @@
var/should_announce_brain_damage = TRUE
var/oxygen_reserve = 6
-/obj/item/organ/internal/brain/getToxLoss()
+/obj/item/organ/internal/brain/get_toxins_damage()
return 0
/obj/item/organ/internal/brain/set_species(species_name)
@@ -100,7 +100,7 @@
alert(owner, "You have taken massive brain damage! You will not be able to remember the events leading up to your injury.", "Brain Damaged")
/obj/item/organ/internal/brain/organ_can_heal()
- return (damage && GET_CHEMICAL_EFFECT(owner, CE_BRAIN_REGEN)) || ..()
+ return (organ_damage && GET_CHEMICAL_EFFECT(owner, CE_BRAIN_REGEN)) || ..()
/obj/item/organ/internal/brain/get_organ_heal_amount()
return 1
@@ -108,7 +108,7 @@
/obj/item/organ/internal/brain/Process()
if(owner)
- if(damage < (max_damage / 4))
+ if(organ_damage < (max_damage / 4))
should_announce_brain_damage = TRUE
handle_disabilities()
@@ -136,12 +136,12 @@
to_chat(owner, "You feel [pick("dizzy","woozy","faint")]...")
damprob = stability_effect ? 30 : 60
if(!past_damage_threshold(2) && prob(damprob))
- take_internal_damage(1)
+ take_damage(1, OXY)
if(BLOOD_VOLUME_BAD to BLOOD_VOLUME_OKAY)
SET_STATUS_MAX(owner, STAT_BLURRY, 6)
damprob = stability_effect ? 40 : 80
if(!past_damage_threshold(4) && prob(damprob))
- take_internal_damage(1)
+ take_damage(1, OXY)
if(!HAS_STATUS(owner, STAT_PARA) && prob(10))
SET_STATUS_MAX(owner, STAT_PARA, rand(1,3))
to_chat(owner, "You feel extremely [pick("dizzy","woozy","faint")]...")
@@ -149,7 +149,7 @@
SET_STATUS_MAX(owner, STAT_BLURRY, 6)
damprob = stability_effect ? 60 : 100
if(!past_damage_threshold(6) && prob(damprob))
- take_internal_damage(1)
+ take_damage(1, OXY)
if(!HAS_STATUS(owner, STAT_PARA) && prob(15))
SET_STATUS_MAX(owner, STAT_PARA, rand(3,5))
to_chat(owner, "You feel extremely [pick("dizzy","woozy","faint")]...")
@@ -157,12 +157,12 @@
SET_STATUS_MAX(owner, STAT_BLURRY, 6)
damprob = stability_effect ? 80 : 100
if(prob(damprob))
- take_internal_damage(1)
+ take_damage(1, OXY)
if(prob(damprob))
- take_internal_damage(1)
+ take_damage(1, OXY)
..()
-/obj/item/organ/internal/brain/take_internal_damage(var/damage, var/silent)
+/obj/item/organ/internal/brain/take_damage(damage, damage_type = BRUTE, def_zone, damage_flags = 0, used_weapon, armor_pen, silent = FALSE, override_droplimb, skip_update_health = FALSE)
..()
if(damage >= 10) //This probably won't be triggered by oxyloss or mercury. Probably.
var/damage_secondary = damage * 0.20
@@ -199,7 +199,7 @@
/obj/item/organ/internal/brain/handle_damage_effects()
..()
- if(damage >= round(max_damage / 2) && should_announce_brain_damage)
+ if(organ_damage >= round(max_damage / 2) && should_announce_brain_damage)
handle_severe_damage()
if(!BP_IS_PROSTHETIC(src) && prob(1))
@@ -208,10 +208,10 @@
to_chat(owner, "It becomes hard to see for some reason.")
owner.set_status(STAT_BLURRY, 10)
var/held = owner.get_active_hand()
- if(damage >= 0.5*max_damage && prob(1) && held)
+ if(organ_damage >= 0.5*max_damage && prob(1) && held)
to_chat(owner, "Your hand won't respond properly, and you drop what you are holding!")
owner.try_unequip(held)
- if(damage >= 0.6*max_damage)
+ if(organ_damage >= 0.6*max_damage)
SET_STATUS_MAX(owner, STAT_SLUR, 2)
if(is_broken())
if(!owner.lying)
@@ -222,8 +222,8 @@
var/blood_volume = owner.get_blood_oxygenation()
if(blood_volume < BLOOD_VOLUME_SURVIVE)
to_chat(user, "Parts of [src] didn't survive the procedure due to lack of air supply!")
- set_max_damage(FLOOR(max_damage - 0.25*damage))
- heal_damage(damage)
+ set_max_damage(FLOOR(max_damage - 0.25*organ_damage))
+ heal_damage(organ_damage, TOX)
/obj/item/organ/internal/brain/get_scarring_level()
. = (species.total_health - max_damage)/species.total_health
diff --git a/code/modules/organs/internal/eyes.dm b/code/modules/organs/internal/eyes.dm
index bdb11a3dd1ff..d22e75124277 100644
--- a/code/modules/organs/internal/eyes.dm
+++ b/code/modules/organs/internal/eyes.dm
@@ -67,7 +67,7 @@
if(istype(head))
head._icon_cache_key = null
-/obj/item/organ/internal/eyes/take_internal_damage(amount, var/silent=0)
+/obj/item/organ/internal/eyes/take_damage(damage, damage_type = BRUTE, def_zone, damage_flags = 0, used_weapon, armor_pen, silent = FALSE, override_droplimb, skip_update_health = FALSE)
var/oldbroken = is_broken()
. = ..()
if(is_broken() && !oldbroken && owner && !owner.stat)
diff --git a/code/modules/organs/internal/heart.dm b/code/modules/organs/internal/heart.dm
index e160e3182787..63d44a99087b 100644
--- a/code/modules/organs/internal/heart.dm
+++ b/code/modules/organs/internal/heart.dm
@@ -28,9 +28,9 @@
if(pulse)
handle_heartbeat()
if(pulse == PULSE_2FAST && prob(1))
- take_internal_damage(0.5)
+ take_damage(0.5, TOX)
if(pulse == PULSE_THREADY && prob(5))
- take_internal_damage(0.5)
+ take_damage(0.5, TOX)
handle_blood()
..()
@@ -47,7 +47,7 @@
if(pulse_mod > 2 && !is_stable)
var/damage_chance = (pulse_mod - 2) ** 2
if(prob(damage_chance))
- take_internal_damage(0.5)
+ take_damage(0.5, TOX)
// Now pulse mod is impacted by shock stage and other things too
if(owner.shock_stage > 30)
@@ -70,7 +70,7 @@
return
else //and if it's beating, let's see if it should
var/should_stop = prob(80) && owner.get_blood_circulation() < BLOOD_VOLUME_SURVIVE //cardiovascular shock, not enough liquid to pump
- should_stop = should_stop || prob(max(0, owner.getBrainLoss() - owner.get_max_health() * 0.75)) //brain failing to work heart properly
+ should_stop = should_stop || prob(max(0, owner.get_brain_damage() - owner.get_max_health() * 0.75)) //brain failing to work heart properly
should_stop = should_stop || (prob(5) && pulse == PULSE_THREADY) //erratic heart patterns, usually caused by oxyloss
if(should_stop) // The heart has stopped due to going into traumatic or cardiovascular shock.
to_chat(owner, "Your heart has stopped!")
@@ -130,7 +130,7 @@
for(var/datum/wound/W in temp.wounds)
- if(!open_wound && (W.damage_type == CUT || W.damage_type == PIERCE) && W.damage && !W.is_treated())
+ if(!open_wound && (W.wound_type == WOUND_CUT || W.wound_type == WOUND_PIERCE) && W.damage && !W.is_treated())
open_wound = TRUE
if(W.bleeding())
diff --git a/code/modules/organs/internal/kidneys.dm b/code/modules/organs/internal/kidneys.dm
index 9e92768a9378..62aca3278869 100644
--- a/code/modules/organs/internal/kidneys.dm
+++ b/code/modules/organs/internal/kidneys.dm
@@ -21,9 +21,9 @@
// what else kidneys can process in our reagent list.
if(REAGENT_VOLUME(owner.reagents, /decl/material/liquid/drink/coffee))
if(is_bruised())
- owner.adjustToxLoss(0.1)
+ owner.take_damage(0.1, TOX)
else if(is_broken())
- owner.adjustToxLoss(0.3)
+ owner.take_damage(0.3, TOX)
if(is_bruised())
if(prob(5) && REAGENT_VOLUME(reagents, /decl/material/solid/potassium) < 5)
@@ -36,8 +36,8 @@
if(!GET_CHEMICAL_EFFECT(owner, CE_ANTITOX))
if(prob(33))
if(is_broken())
- owner.adjustToxLoss(0.5)
+ owner.take_damage(0.5, TOX)
if(status & ORGAN_DEAD)
- owner.adjustToxLoss(1)
+ owner.take_damage(1, TOX)
diff --git a/code/modules/organs/internal/liver.dm b/code/modules/organs/internal/liver.dm
index 907cb8627bb4..ced43489ce0c 100644
--- a/code/modules/organs/internal/liver.dm
+++ b/code/modules/organs/internal/liver.dm
@@ -31,8 +31,8 @@
spawn owner.vomit()
//Detox can heal small amounts of damage
- if (damage < max_damage && !GET_CHEMICAL_EFFECT(owner, CE_TOXIN))
- heal_damage(0.2 * GET_CHEMICAL_EFFECT(owner, CE_ANTITOX))
+ if (organ_damage < max_damage && !GET_CHEMICAL_EFFECT(owner, CE_TOXIN))
+ heal_damage(0.2 * GET_CHEMICAL_EFFECT(owner, CE_ANTITOX), TOX)
var/alco = GET_CHEMICAL_EFFECT(owner, CE_ALCOHOL)
var/alcotox = GET_CHEMICAL_EFFECT(owner, CE_ALCOHOL_TOXIC)
@@ -50,10 +50,10 @@
// If you're not filtering well, you're in trouble. Ammonia buildup to toxic levels and damage from alcohol
if(filter_effect < 2)
if(alco)
- owner.adjustToxLoss(0.5 * max(2 - filter_effect, 0) * (alcotox + 0.5 * alco))
+ owner.take_damage(0.5 * max(2 - filter_effect, 0) * (alcotox + 0.5 * alco), TOX)
if(alcotox)
- take_internal_damage(alcotox, prob(90)) // Chance to warn them
+ take_damage(alcotox, TOX, silent = prob(90)) // Chance to warn them
//Blood regeneration if there is some space
owner.regenerate_blood(0.1 + GET_CHEMICAL_EFFECT(owner, CE_BLOODRESTORE))
diff --git a/code/modules/organs/internal/lungs.dm b/code/modules/organs/internal/lungs.dm
index a0dcbf6e66e8..0e2498f0ee00 100644
--- a/code/modules/organs/internal/lungs.dm
+++ b/code/modules/organs/internal/lungs.dm
@@ -170,7 +170,7 @@
var/safe_pressure_min = min_breath_pressure // Minimum safe partial pressure of breathable gas in kPa
// Lung damage increases the minimum safe pressure.
- safe_pressure_min *= 1 + rand(1,4) * damage/max_damage
+ safe_pressure_min *= 1 + rand(1,4) * organ_damage/max_damage
var/breatheffect = GET_CHEMICAL_EFFECT(owner, CE_BREATHLOSS)
if(!forced && breatheffect && !GET_CHEMICAL_EFFECT(owner, CE_STABLE)) //opiates are bad mmkay
@@ -238,7 +238,7 @@
var/failed_breath = failed_inhale || failed_exhale
if(!failed_breath)
last_successful_breath = world.time
- owner.adjustOxyLoss(-5 * inhale_efficiency)
+ owner.heal_damage(5 * inhale_efficiency, OXY)
if(!BP_IS_PROSTHETIC(src) && species.breathing_sound && is_below_sound_pressure(get_turf(owner)))
if(breathing || owner.shock_stage >= 10)
sound_to(owner, sound(species.breathing_sound,0,0,0,5))
@@ -263,8 +263,8 @@
else
owner.emote(pick("shiver","twitch"))
- if(damage || GET_CHEMICAL_EFFECT(owner, CE_BREATHLOSS) || world.time > last_successful_breath + 2 MINUTES)
- owner.adjustOxyLoss(HUMAN_MAX_OXYLOSS*breath_fail_ratio)
+ if(organ_damage || GET_CHEMICAL_EFFECT(owner, CE_BREATHLOSS) || world.time > last_successful_breath + 2 MINUTES)
+ owner.take_damage(HUMAN_MAX_OXYLOSS*breath_fail_ratio, OXY)
owner.oxygen_alert = max(owner.oxygen_alert, 2)
last_int_pressure = 0
@@ -286,9 +286,9 @@
damage = COLD_GAS_DAMAGE_LEVEL_1
if(prob(20))
- owner.apply_damage(damage, BURN, BP_HEAD, used_weapon = "Excessive Cold")
+ owner.take_damage(damage, BURN, BP_HEAD, used_weapon = "Excessive Cold")
else
- src.damage += damage
+ organ_damage += damage
owner.fire_alert = 1
else if(breath.temperature >= heat_1)
if(prob(20))
@@ -302,9 +302,9 @@
damage = HEAT_GAS_DAMAGE_LEVEL_3
if(prob(20))
- owner.apply_damage(damage, BURN, BP_HEAD, used_weapon = "Excessive Heat")
+ owner.take_damage(damage, BURN, BP_HEAD, used_weapon = "Excessive Heat")
else
- src.damage += damage
+ organ_damage += damage
owner.fire_alert = 2
//breathing in hot/cold air also heats/cools you a bit
@@ -346,7 +346,7 @@
. += "[pick("wheezing", "gurgling")] sounds"
var/list/breathtype = list()
- if(owner.getOxyLossPercent() > 50)
+ if(owner.get_suffocation_percent() > 50)
breathtype += pick("straining","labored")
if(owner.shock_stage > 50)
breathtype += pick("shallow and rapid")
diff --git a/code/modules/organs/internal/posibrain.dm b/code/modules/organs/internal/posibrain.dm
index ba69416cdd0d..ea24e4e9f649 100644
--- a/code/modules/organs/internal/posibrain.dm
+++ b/code/modules/organs/internal/posibrain.dm
@@ -186,7 +186,7 @@
return 0
if(status & ORGAN_DEAD)
return 0
- return round(cell.charge*(1 - damage/max_damage))
+ return round(cell.charge*(1 - organ_damage/max_damage))
/obj/item/organ/internal/cell/proc/checked_use(var/amount)
if(!is_usable())
@@ -199,7 +199,7 @@
return cell && cell.use(amount)
/obj/item/organ/internal/cell/proc/get_power_drain()
- var/damage_factor = 1 + 10 * damage/max_damage
+ var/damage_factor = 1 + 10 * organ_damage/max_damage
return servo_cost * damage_factor
/obj/item/organ/internal/cell/Process()
diff --git a/code/modules/organs/internal/stomach.dm b/code/modules/organs/internal/stomach.dm
index d2e15775d76b..5366b91e8e11 100644
--- a/code/modules/organs/internal/stomach.dm
+++ b/code/modules/organs/internal/stomach.dm
@@ -95,7 +95,7 @@
if(owner)
var/functioning = is_usable()
- if(damage >= min_bruised_damage && prob((damage / max_damage) * 100))
+ if(organ_damage >= min_bruised_damage && prob((organ_damage / max_damage) * 100))
functioning = FALSE
if(functioning)
@@ -104,9 +104,9 @@
qdel(M)
continue
- M.adjustBruteLoss(3, do_update_health = FALSE)
- M.adjustFireLoss(3, do_update_health = FALSE)
- M.adjustToxLoss(3)
+ M.take_damage(3, BRUTE, skip_update_health = TRUE)
+ M.take_damage(3, BURN, skip_update_health = TRUE)
+ M.take_damage(3, TOX)
var/digestion_product = M.get_digestion_product()
if(digestion_product)
diff --git a/code/modules/organs/organ.dm b/code/modules/organs/organ.dm
index 98cc4129f70e..4197bcd3fb58 100644
--- a/code/modules/organs/organ.dm
+++ b/code/modules/organs/organ.dm
@@ -25,7 +25,7 @@
var/list/ailments // Current active ailments if any.
// Damage vars.
- var/damage = 0 // Current damage to the organ
+ var/organ_damage = 0 // Current damage to the organ
var/min_broken_damage = 30 // Damage before becoming broken
var/max_damage = 30 // Damage cap, including scarring
var/absolute_max_damage = 0 // Lifetime damage cap, ignoring scarring.
@@ -58,7 +58,7 @@
return
/obj/item/organ/proc/is_broken()
- return (damage >= min_broken_damage || (status & ORGAN_CUT_AWAY) || (status & ORGAN_BROKEN))
+ return (organ_damage >= min_broken_damage || (status & ORGAN_CUT_AWAY) || (status & ORGAN_BROKEN))
//Third argument may be a dna datum; if null will be set to holder's dna.
/obj/item/organ/Initialize(mapload, material_key, datum/dna/given_dna, decl/bodytype/new_bodytype)
@@ -186,7 +186,7 @@
reset_status()
/obj/item/organ/proc/die()
- damage = max_damage
+ organ_damage = max_damage
status |= ORGAN_DEAD
STOP_PROCESSING(SSobj, src)
QDEL_NULL_LIST(ailments)
@@ -216,7 +216,7 @@
blood_splatter(get_turf(src), src, 1)
reagents.remove_any(0.1)
if(get_config_value(/decl/config/toggle/health_organs_decay))
- take_general_damage(rand(1,3))
+ take_damage(rand(1,3), TOX)
germ_level += rand(2,6)
if(germ_level >= INFECTION_LEVEL_TWO)
germ_level += rand(2,6)
@@ -234,7 +234,7 @@
handle_ailment(ailment)
//check if we've hit max_damage
- if(damage >= max_damage)
+ if(organ_damage >= max_damage)
die()
/obj/item/organ/proc/handle_ailment(var/datum/ailment/ailment)
@@ -291,7 +291,7 @@
parent.germ_level++
if (prob(3)) //about once every 30 seconds
- take_general_damage(1,silent=prob(30))
+ take_damage(1, TOX, silent=prob(30))
/obj/item/organ/proc/handle_rejection()
// Process unsuitable transplants. TODO: consider some kind of
@@ -329,7 +329,7 @@
SHOULD_CALL_PARENT(TRUE)
if(!owner)
PRINT_STACK_TRACE("rejuvenate() called on organ of type [type] with no owner.")
- damage = 0
+ organ_damage = 0
reset_status()
if(!ignore_organ_aspects && length(owner?.personal_aspects))
for(var/decl/aspect/aspect as anything in owner.personal_aspects)
@@ -361,14 +361,12 @@
germ_level -= 2
germ_level = max(0, germ_level)
-/obj/item/organ/proc/take_general_damage(var/amount, var/silent = FALSE)
- CRASH("Not Implemented")
-
-/obj/item/organ/proc/heal_damage(amount)
- if(can_recover())
- damage = clamp(0, damage - round(amount, 0.1), max_damage)
- if(owner)
- owner.update_health()
+/obj/item/organ/heal_damage(var/damage, var/damage_type = BRUTE, var/def_zone = null, var/damage_flags = 0, skip_update_health = FALSE)
+ if(!can_recover())
+ return
+ organ_damage = clamp(0, organ_damage - round(damage, 0.1), max_damage)
+ if(owner && !skip_update_health)
+ owner.update_health()
/obj/item/organ/attack(var/mob/target, var/mob/user)
if(BP_IS_PROSTHETIC(src) || !istype(target) || !istype(user) || (user != target && user.a_intent == I_HELP))
diff --git a/code/modules/organs/pain.dm b/code/modules/organs/pain.dm
index d9bff64a519c..54ad00398bfb 100644
--- a/code/modules/organs/pain.dm
+++ b/code/modules/organs/pain.dm
@@ -26,7 +26,7 @@
if(affecting)
affecting.add_pain(CEILING(power/2))
else
- adjustHalLoss(CEILING(power/2))
+ take_damage(CEILING(power/2), PAIN)
flash_pain(min(round(2*power)+55, 255))
// Anti message spam checks
@@ -85,7 +85,7 @@
custom_pain(msg, maxdam, prob(10), damaged_organ, TRUE)
// Damage to internal organs hurts a lot.
for(var/obj/item/organ/internal/I in get_internal_organs())
- if(prob(1) && !((I.status & ORGAN_DEAD) || BP_IS_PROSTHETIC(I)) && I.damage > 5)
+ if(prob(1) && !((I.status & ORGAN_DEAD) || BP_IS_PROSTHETIC(I)) && I.organ_damage > 5)
var/obj/item/organ/external/parent = GET_EXTERNAL_ORGAN(src, I.parent_organ)
if(parent)
var/pain = 10
@@ -100,14 +100,15 @@
if(prob(1))
- switch(getToxLoss())
+ var/organ_damage = get_damage(TOX)
+ switch(organ_damage)
if(5 to 17)
- custom_pain("Your body stings slightly.", getToxLoss())
+ custom_pain("Your body stings slightly.", organ_damage)
if(17 to 35)
- custom_pain("Your body stings.", getToxLoss())
+ custom_pain("Your body stings.", organ_damage)
if(35 to 60)
- custom_pain("Your body stings strongly.", getToxLoss())
+ custom_pain("Your body stings strongly.", organ_damage)
if(60 to 100)
- custom_pain("Your whole body hurts badly.", getToxLoss())
+ custom_pain("Your whole body hurts badly.", organ_damage)
if(100 to INFINITY)
- custom_pain("Your body aches all over, it's driving you mad.", getToxLoss())
\ No newline at end of file
+ custom_pain("Your body aches all over, it's driving you mad.", organ_damage)
\ No newline at end of file
diff --git a/code/modules/organs/prosthetics/_prosthetics.dm b/code/modules/organs/prosthetics/_prosthetics.dm
index 916eb8ea4927..fd73fbf56102 100644
--- a/code/modules/organs/prosthetics/_prosthetics.dm
+++ b/code/modules/organs/prosthetics/_prosthetics.dm
@@ -48,7 +48,7 @@
// Checks if an organ (or the parent of one) is in a fit state for modular limb stuff to happen.
/obj/item/organ/external/proc/check_modular_limb_damage(var/mob/living/carbon/human/user)
- . = damage >= min_broken_damage || (status & ORGAN_BROKEN) // can't use is_broken() as the limb has ORGAN_CUT_AWAY
+ . = organ_damage >= min_broken_damage || (status & ORGAN_BROKEN) // can't use is_broken() as the limb has ORGAN_CUT_AWAY
// Human mob procs:
// Checks the organ list for limbs meeting a predicate. Way overengineered for such a limited use
diff --git a/code/modules/overmap/ftl_shunt/core.dm b/code/modules/overmap/ftl_shunt/core.dm
index c9ae2ac1b462..f64ddf06f046 100644
--- a/code/modules/overmap/ftl_shunt/core.dm
+++ b/code/modules/overmap/ftl_shunt/core.dm
@@ -379,7 +379,7 @@
to_chat(H, SPAN_WARNING("Being untethered from a ship entering FTL is a bad idea, but you roll the dice..."))
if(prob(50))
to_chat(H, SPAN_NOTICE("and win, surviving the energy dancing over your body. Not unharmed, however."))
- H.apply_damage(300, IRRADIATE, damage_flags = DAM_DISPERSED)
+ H.take_damage(300, IRRADIATE, damage_flags = DAM_DISPERSED)
return
else
to_chat(H, SPAN_DANGER("and lose, being ripped apart in a nanosecond by energies beyond comprehension."))
diff --git a/code/modules/paperwork/paper_plane.dm b/code/modules/paperwork/paper_plane.dm
index 18d0a6664a11..d1cc8969569a 100644
--- a/code/modules/paperwork/paper_plane.dm
+++ b/code/modules/paperwork/paper_plane.dm
@@ -48,7 +48,7 @@
var/mob/living/carbon/C = hit_atom
//Only hurt if received right into the eyes
if(TT.target_zone == BP_EYES && !(BP_EYES in C.get_covered_body_parts()))
- C.apply_damage(1, BRUTE, BP_EYES, 0, src, 0)
+ C.take_damage(1, BRUTE, BP_EYES, 0, src, 0)
C.apply_effects(2, 0, 0, 0, 1, 0, 15)
take_damage(TT.speed * w_class, BRUTE)
diff --git a/code/modules/paperwork/papershredder.dm b/code/modules/paperwork/papershredder.dm
index d71d22b1c96a..0f92f8993737 100644
--- a/code/modules/paperwork/papershredder.dm
+++ b/code/modules/paperwork/papershredder.dm
@@ -52,14 +52,14 @@
var/decl/material/M = I.material
if(M.hardness > MAT_VALUE_FLEXIBLE && M.hardness < MAT_VALUE_RIGID)
audible_message(SPAN_WARNING("You hear a loud mechanical grinding!"))
- take_damage(1, BRUTE, TRUE)
+ take_damage(1, BRUTE, silent = TRUE)
spark_at(get_turf(src), 1, FALSE, src)
. = TRUE
else if(M.hardness >= MAT_VALUE_RIGID)
audible_message(SPAN_DANGER("You hear rattling and then a loud bang!"))
use_power_oneoff(200)
- take_damage(25, BRUTE, TRUE)
+ take_damage(25, BRUTE, silent = TRUE)
set_broken(TRUE, MACHINE_BROKEN_GENERIC)
. = FALSE
diff --git a/code/modules/power/lighting.dm b/code/modules/power/lighting.dm
index b0279ba8abd3..27bcdb93fb9c 100644
--- a/code/modules/power/lighting.dm
+++ b/code/modules/power/lighting.dm
@@ -341,7 +341,7 @@
else if(user.a_intent != I_HELP)
var/obj/item/organ/external/hand = GET_EXTERNAL_ORGAN(H, user.get_active_held_item_slot())
if(hand && hand.is_usable() && !hand.can_feel_pain())
- user.apply_damage(3, BURN, hand.organ_tag, used_weapon = src)
+ user.take_damage(3, BURN, hand.organ_tag, used_weapon = src)
var/decl/pronouns/G = user.get_pronouns()
user.visible_message( \
SPAN_DANGER("\The [user]'s [hand.name] burns and sizzles as [G.he] touch[G.es] the hot [get_fitting_name()]."), \
diff --git a/code/modules/power/singularity/particle_accelerator/particle.dm b/code/modules/power/singularity/particle_accelerator/particle.dm
index dc88c1bb9c83..378a5dd7539e 100644
--- a/code/modules/power/singularity/particle_accelerator/particle.dm
+++ b/code/modules/power/singularity/particle_accelerator/particle.dm
@@ -62,7 +62,7 @@
/obj/effect/accelerated_particle/proc/toxmob(var/mob/living/M)
var/radiation = (energy*2)
- M.apply_damage((radiation*3),IRRADIATE, damage_flags = DAM_DISPERSED)
+ M.take_damage((radiation*3), IRRADIATE, damage_flags = DAM_DISPERSED)
/obj/effect/accelerated_particle/proc/move(var/lag)
set waitfor = FALSE
diff --git a/code/modules/power/singularity/singularity_events.dm b/code/modules/power/singularity/singularity_events.dm
index 9ecdc2ae467e..4c50ad287847 100644
--- a/code/modules/power/singularity/singularity_events.dm
+++ b/code/modules/power/singularity/singularity_events.dm
@@ -23,7 +23,7 @@
radiation = round(((source.energy-150)/50)*5,1)
SSradiation.radiate(source, radiation) //Always radiate at max, so a decent dose of radiation is applied
for(var/mob/living/M in view(toxrange, source.loc))
- M.apply_damage(toxdamage, TOX, null, damage_flags = DAM_DISPERSED)
+ M.take_damage(toxdamage, TOX, null, damage_flags = DAM_DISPERSED)
/decl/singularity_event/mesmerize/handle_event(obj/effect/singularity/source)
for(var/mob/living/carbon/M in oviewers(8, source))
diff --git a/code/modules/projectiles/gun.dm b/code/modules/projectiles/gun.dm
index 74fee2674780..902e61edf95b 100644
--- a/code/modules/projectiles/gun.dm
+++ b/code/modules/projectiles/gun.dm
@@ -561,11 +561,11 @@
in_chamber.on_hit(M)
if (in_chamber.damage_type != PAIN)
log_and_message_admins("[key_name(user)] commited suicide using \a [src]")
- user.apply_damage(in_chamber.damage*2.5, in_chamber.damage_type, BP_HEAD, in_chamber.damage_flags(), used_weapon = "Point blank shot in the mouth with \a [in_chamber]")
+ user.take_damage(in_chamber.damage*2.5, in_chamber.damage_type, BP_HEAD, in_chamber.damage_flags(), used_weapon = "Point blank shot in the mouth with \a [in_chamber]")
user.death()
else
to_chat(user, "Ow...")
- user.apply_effect(110,PAIN,0)
+ user.take_damage(110, PAIN)
qdel(in_chamber)
mouthshoot = 0
return
diff --git a/code/modules/projectiles/guns/projectile.dm b/code/modules/projectiles/guns/projectile.dm
index 0954d63ee06d..4c6d0e7b2ea8 100644
--- a/code/modules/projectiles/guns/projectile.dm
+++ b/code/modules/projectiles/guns/projectile.dm
@@ -94,7 +94,7 @@
var/obj/item/organ/external/E = GET_EXTERNAL_ORGAN(H, zone)
if(E)
chambered.put_residue_on(E)
- H.apply_damage(3, BURN, used_weapon = "Gunpowder Burn", given_organ = E)
+ H.take_damage(3, BURN, used_weapon = "Gunpowder Burn", def_zone = E.organ_tag)
/obj/item/gun/projectile/handle_click_empty()
..()
diff --git a/code/modules/projectiles/guns/projectile/flaregun.dm b/code/modules/projectiles/guns/projectile/flaregun.dm
index 0a0cbea61c70..b00fa0b1e4f3 100644
--- a/code/modules/projectiles/guns/projectile/flaregun.dm
+++ b/code/modules/projectiles/guns/projectile/flaregun.dm
@@ -39,7 +39,7 @@
C.visible_message("[src] explodes in [C]'s hands!", "[src] explodes in your face!")
C.drop_from_inventory(src)
for(var/zone in list(BP_L_HAND, BP_R_HAND))
- C.apply_damage(rand(10,20), def_zone=zone)
+ C.take_damage(rand(10,20), BRUTE, def_zone=zone)
else
visible_message("[src] explodes!")
explosion(get_turf(src), -1, -1, 1)
diff --git a/code/modules/projectiles/projectile.dm b/code/modules/projectiles/projectile.dm
index 8094266a8122..1565f5485293 100644
--- a/code/modules/projectiles/projectile.dm
+++ b/code/modules/projectiles/projectile.dm
@@ -33,7 +33,7 @@
var/distance_falloff = 2 //multiplier, higher value means accuracy drops faster with distance
var/damage = 10
- var/damage_type = BRUTE //BRUTE, BURN, TOX, OXY, CLONE, ELECTROCUTE are the only things that should be in here, Try not to use PAIN as it doesn't go through stun_effect_act
+ var/damage_type = BRUTE
var/nodamage = 0 //Determines if the projectile will skip any damage inflictions
var/damage_flags = DAM_BULLET
var/penetrating = 0 //If greater than zero, the projectile will pass through dense objects as specified by on_penetrate()
@@ -115,7 +115,7 @@
L.apply_effects(0, weaken, paralyze, stutter, eyeblur, drowsy, 0, blocked)
L.stun_effect_act(stun, agony, def_zone, src)
//radiation protection is handled separately from other armour types.
- L.apply_damage(irradiate, IRRADIATE, damage_flags = DAM_DISPERSED)
+ L.take_damage(irradiate, IRRADIATE, damage_flags = DAM_DISPERSED)
return 1
@@ -330,7 +330,7 @@
/obj/item/projectile/after_wounding(obj/item/organ/external/organ, datum/wound/wound)
//Check if we even broke skin in first place
- if(!wound || !(wound.damage_type == CUT || wound.damage_type == PIERCE))
+ if(!wound || !(wound.wound_type == WOUND_CUT || wound.wound_type == WOUND_PIERCE))
return
//Check if we can do nasty stuff inside
if(!can_embed() || (organ.species.species_flags & SPECIES_FLAG_NO_EMBED))
diff --git a/code/modules/projectiles/projectile/special.dm b/code/modules/projectiles/projectile/special.dm
index 037a41b6fc3d..9e7947d4749c 100644
--- a/code/modules/projectiles/projectile/special.dm
+++ b/code/modules/projectiles/projectile/special.dm
@@ -84,7 +84,7 @@
var/mob/living/carbon/human/H = M
if((H.species.species_flags & SPECIES_FLAG_IS_PLANT) && (H.nutrition < 500))
if(prob(15))
- H.apply_damage((rand(30,80)),IRRADIATE, damage_flags = DAM_DISPERSED)
+ H.take_damage((rand(30,80)), IRRADIATE, damage_flags = DAM_DISPERSED)
SET_STATUS_MAX(H, STAT_WEAK, 5)
var/decl/pronouns/G = M.get_pronouns()
visible_message(
@@ -98,7 +98,7 @@
randmutg(M)
domutcheck(M,null)
else
- M.adjustFireLoss(rand(5,15))
+ M.take_damage(rand(5,15), BURN)
M.show_message("The radiation beam singes you!")
else if(iscarbon(target))
M.show_message("The radiation beam dissipates harmlessly through your body.")
diff --git a/code/modules/radiation/radiation.dm b/code/modules/radiation/radiation.dm
index 0feee45d7730..46001d9cae40 100644
--- a/code/modules/radiation/radiation.dm
+++ b/code/modules/radiation/radiation.dm
@@ -64,6 +64,6 @@
/mob/living/rad_act(var/severity)
if(severity > RAD_LEVEL_LOW)
- src.apply_damage(severity, IRRADIATE, damage_flags = DAM_DISPERSED)
+ take_damage(severity, IRRADIATE, damage_flags = DAM_DISPERSED)
for(var/atom/I in src)
I.rad_act(severity)
diff --git a/code/modules/reagents/Chemistry-Grinder.dm b/code/modules/reagents/Chemistry-Grinder.dm
index 4a99f1941d68..79a9578b290c 100644
--- a/code/modules/reagents/Chemistry-Grinder.dm
+++ b/code/modules/reagents/Chemistry-Grinder.dm
@@ -236,7 +236,7 @@
var/dam = rand(10, 15)
user.visible_message(SPAN_DANGER("\The [user]'s hand gets caught in \the [src]!"), SPAN_DANGER("Your hand gets caught in \the [src]!"))
- user.apply_damage(dam, BRUTE, hand, damage_flags = DAM_SHARP, used_weapon = "grinder")
+ user.take_damage(dam, BRUTE, hand, damage_flags = DAM_SHARP, used_weapon = "grinder")
if(BP_IS_PROSTHETIC(hand_organ))
beaker.reagents.add_reagent(/decl/material/solid/metal/iron, dam)
else
diff --git a/code/modules/reagents/chems/chems_blood.dm b/code/modules/reagents/chems/chems_blood.dm
index c56c0a0dc81a..5101461a62e0 100644
--- a/code/modules/reagents/chems/chems_blood.dm
+++ b/code/modules/reagents/chems/chems_blood.dm
@@ -66,9 +66,9 @@
if(M.HasTrait(/decl/trait/metabolically_inert))
return
if(LAZYACCESS(M.chem_doses, type) > 5)
- M.adjustToxLoss(removed)
+ M.take_damage(removed, TOX)
if(LAZYACCESS(M.chem_doses, type) > 15)
- M.adjustToxLoss(removed)
+ M.take_damage(removed, TOX)
/decl/material/liquid/blood/affect_touch(var/mob/living/M, var/removed, var/datum/reagents/holder)
if(ishuman(M))
diff --git a/code/modules/reagents/chems/chems_compounds.dm b/code/modules/reagents/chems/chems_compounds.dm
index 465931dd12a3..e347aaea1a38 100644
--- a/code/modules/reagents/chems/chems_compounds.dm
+++ b/code/modules/reagents/chems/chems_compounds.dm
@@ -100,7 +100,7 @@
var/slime_temp_adj = 10
/decl/material/liquid/capsaicin/affect_blood(var/mob/living/M, var/removed, var/datum/reagents/holder)
- M.adjustToxLoss(0.5 * removed)
+ M.take_damage(0.5 * removed, TOX)
/decl/material/liquid/capsaicin/affect_ingest(var/mob/living/M, var/removed, var/datum/reagents/holder)
holder.remove_reagent(/decl/material/liquid/frostoil, 5)
@@ -118,7 +118,7 @@
if(prob(5) || dose == metabolism) //dose == metabolism is a very hacky way of forcing the message the first time this procs
to_chat(M, discomfort_message)
else
- M.apply_effect(agony_amount, PAIN, 0)
+ M.take_damage(agony_amount, PAIN)
if(prob(5))
M.custom_emote(2, "[pick("dry heaves!","coughs!","splutters!")]")
to_chat(M, "You feel like your insides are burning!")
@@ -204,7 +204,7 @@
if(LAZYACCESS(M.chem_doses, type) == metabolism)
to_chat(M, "You feel like your insides are burning!")
else
- M.apply_effect(6, PAIN, 0)
+ M.take_damage(6, PAIN)
if(prob(5))
to_chat(M, "You feel like your insides are burning!")
M.custom_emote(2, "[pick("coughs.","gags.","retches.")]")
@@ -246,7 +246,7 @@
randmutg(M)
domutcheck(M, null)
M.UpdateAppearance()
- M.apply_damage(10 * removed, IRRADIATE, armor_pen = 100)
+ M.take_damage(10 * removed, IRRADIATE, armor_pen = 100)
/decl/material/liquid/lactate
name = "lactate"
@@ -373,12 +373,14 @@
/decl/material/liquid/nanitefluid/affect_blood(var/mob/living/M, var/removed, var/datum/reagents/holder)
M.add_chemical_effect(CE_CRYO, 1)
if(M.bodytemperature < 170)
- M.heal_organ_damage(30 * removed, 30 * removed, affect_robo = 1)
+ var/heal_amt = 30 * removed
+ M.heal_damage(heal_amt, BRUTE) //TODO readd affect_robot checks
+ M.heal_damage(heal_amt, BURN) //TODO readd affect_robot checks
if(ishuman(M))
var/mob/living/carbon/human/H = M
for(var/obj/item/organ/internal/I in H.get_internal_organs())
if(BP_IS_PROSTHETIC(I))
- I.heal_damage(20*removed)
+ I.heal_damage(20*removed, TOX)
/decl/material/liquid/antiseptic
name = "antiseptic"
@@ -415,7 +417,8 @@
if((E.brute_dam + E.burn_dam) > 0)
if(prob(35))
to_chat(M, SPAN_NOTICE("You feel a crawling sensation as fresh crystal grows over your [E.name]."))
- E.heal_damage(rand(5,8), rand(5,8))
+ E.heal_damage(rand(5,8), BRUTE)
+ E.heal_damage(rand(5,8), BURN)
break
if(BP_IS_BRITTLE(E))
E.status &= ~ORGAN_BRITTLE
@@ -429,7 +432,7 @@
new /obj/item/shard(get_turf(E), result_mat)
E.dismember(0, DISMEMBER_METHOD_BLUNT)
else
- E.take_external_damage(rand(20,30), 0)
+ E.take_damage(rand(20,30), BRUTE)
BP_SET_CRYSTAL(E)
E.status |= ORGAN_BRITTLE
break
@@ -437,14 +440,14 @@
var/list/internal_organs = H.get_internal_organs()
var/list/shuffled_organs = LAZYLEN(internal_organs) ? shuffle(internal_organs.Copy()) : null
for(var/obj/item/organ/internal/I in shuffled_organs)
- if(BP_IS_PROSTHETIC(I) || !BP_IS_CRYSTAL(I) || I.damage <= 0 || I.organ_tag == BP_BRAIN)
+ if(BP_IS_PROSTHETIC(I) || !BP_IS_CRYSTAL(I) || I.organ_damage <= 0 || I.organ_tag == BP_BRAIN)
continue
if(prob(35))
to_chat(M, SPAN_NOTICE("You feel a deep, sharp tugging sensation as your [I.name] is mended."))
- I.heal_damage(rand(1,3))
+ I.heal_damage(rand(1,3), BRUTE)
break
else
to_chat(M, SPAN_DANGER("Your flesh is being lacerated from within!"))
- M.adjustBruteLoss(rand(3,6))
+ M.take_damage(rand(3,6), BRUTE)
if(prob(10))
new /obj/item/shard(get_turf(M), result_mat)
diff --git a/code/modules/reagents/chems/chems_drinks.dm b/code/modules/reagents/chems/chems_drinks.dm
index 4ae6d0b79ea6..278970436add 100644
--- a/code/modules/reagents/chems/chems_drinks.dm
+++ b/code/modules/reagents/chems/chems_drinks.dm
@@ -14,7 +14,7 @@
var/adj_temp = 0
/decl/material/liquid/drink/affect_blood(var/mob/living/M, var/removed, var/datum/reagents/holder)
- M.adjustToxLoss(removed) // Probably not a good idea; not very deadly though
+ M.take_damage(removed, TOX) // Probably not a good idea; not very deadly though
/decl/material/liquid/drink/affect_ingest(var/mob/living/M, var/removed, var/datum/reagents/holder)
if(M.HasTrait(/decl/trait/metabolically_inert))
@@ -118,7 +118,7 @@
if(M.HasTrait(/decl/trait/metabolically_inert))
return
- M.adjustToxLoss(-0.5 * removed)
+ M.heal_damage(0.5 * removed, TOX)
/decl/material/liquid/drink/juice/orange
name = "orange juice"
@@ -137,7 +137,7 @@
if(M.HasTrait(/decl/trait/metabolically_inert))
return
- M.adjustOxyLoss(-2 * removed)
+ M.heal_damage(2 * removed, TOX)
/decl/material/liquid/poisonberryjuice
name = "poison berry juice"
@@ -200,7 +200,7 @@
if(M.HasTrait(/decl/trait/metabolically_inert))
return
- M.heal_organ_damage(0, 0.5 * removed)
+ M.heal_damage(0.5 * removed, BURN)
/decl/material/liquid/drink/juice/watermelon
name = "watermelon juice"
@@ -276,7 +276,7 @@
if(M.HasTrait(/decl/trait/metabolically_inert))
return
- M.heal_organ_damage(0.5 * removed, 0)
+ M.heal_damage(0.5 * removed, BRUTE)
/decl/material/liquid/drink/milk/cream
name = "cream"
@@ -664,7 +664,7 @@
if(M.HasTrait(/decl/trait/metabolically_inert))
return
- M.adjustToxLoss(-0.5 * removed)
+ M.heal_damage(0.5 * removed, TOX)
/decl/material/liquid/drink/tea/black
name = "black tea"
diff --git a/code/modules/reagents/chems/chems_drugs.dm b/code/modules/reagents/chems/chems_drugs.dm
index d03237b924de..683cd4bcae92 100644
--- a/code/modules/reagents/chems/chems_drugs.dm
+++ b/code/modules/reagents/chems/chems_drugs.dm
@@ -29,7 +29,7 @@
/decl/material/liquid/narcotics/affect_blood(var/mob/living/M, var/removed, var/datum/reagents/holder)
ADJ_STATUS(M, STAT_JITTER, -5)
if(prob(80))
- M.adjustBrainLoss(5.25 * removed)
+ M.adjust_brain_damage(5.25 * removed)
if(prob(50))
SET_STATUS_MAX(M, STAT_DROWSY, 3)
if(prob(10))
@@ -219,7 +219,7 @@
if(prob(0.1) && ishuman(M))
var/mob/living/carbon/human/H = M
H.seizure()
- H.adjustBrainLoss(rand(8, 12))
+ H.adjust_brain_damage(rand(8, 12))
if(prob(5))
to_chat(M, SPAN_WARNING("[pick(dose_messages)]"))
@@ -230,7 +230,7 @@
M.remove_client_color(/datum/client_color/noir/thirdeye)
/decl/material/liquid/glowsap/gleam/affect_overdose(var/mob/living/M)
- M.adjustBrainLoss(rand(1, 5))
+ M.adjust_brain_damage(rand(1, 5))
if(ishuman(M) && prob(10))
var/mob/living/carbon/human/H = M
H.seizure()
diff --git a/code/modules/reagents/chems/chems_ethanol.dm b/code/modules/reagents/chems/chems_ethanol.dm
index 4009ab27374f..e8c8c0250297 100644
--- a/code/modules/reagents/chems/chems_ethanol.dm
+++ b/code/modules/reagents/chems/chems_ethanol.dm
@@ -40,7 +40,7 @@
/decl/material/liquid/ethanol/affect_blood(var/mob/living/M, var/removed, var/datum/reagents/holder)
..()
- M.adjustToxLoss(removed * 2 * alcohol_toxicity)
+ M.take_damage(removed * 2 * alcohol_toxicity, TOX)
M.add_chemical_effect(CE_ALCOHOL_TOXIC, alcohol_toxicity)
/decl/material/liquid/ethanol/affect_ingest(var/mob/living/M, var/removed, var/datum/reagents/holder)
@@ -454,15 +454,15 @@
var/dose = LAZYACCESS(M.chem_doses, type)
if(dose > 30)
- M.adjustToxLoss(2 * removed)
+ M.take_damage(2 * removed, TOX)
if(dose > 60 && ishuman(M) && prob(5))
var/mob/living/carbon/human/H = M
var/obj/item/organ/internal/heart = GET_INTERNAL_ORGAN(H, BP_HEART)
if(heart)
if(dose < 120)
- heart.take_internal_damage(10 * removed, 0)
+ heart.take_damage(10 * removed, TOX)
else
- heart.take_internal_damage(100, 0)
+ heart.take_damage(100, TOX)
/decl/material/liquid/ethanol/aged_whiskey // I have no idea what this is and where it comes from. //It comes from Dinnlan now
name = "aged whiskey"
diff --git a/code/modules/reagents/chems/chems_fuel.dm b/code/modules/reagents/chems/chems_fuel.dm
index f631468ba4a3..93d651a1ff49 100644
--- a/code/modules/reagents/chems/chems_fuel.dm
+++ b/code/modules/reagents/chems/chems_fuel.dm
@@ -17,7 +17,7 @@
value = 1.5
/decl/material/liquid/fuel/affect_blood(var/mob/living/M, var/removed, var/datum/reagents/holder)
- M.adjustToxLoss(2 * removed)
+ M.take_damage(2 * removed, TOX)
/decl/material/liquid/fuel/explosion_act(obj/item/chems/holder, severity)
. = ..()
diff --git a/code/modules/reagents/chems/chems_medicines.dm b/code/modules/reagents/chems/chems_medicines.dm
index a703f497f9af..943d78d2a43a 100644
--- a/code/modules/reagents/chems/chems_medicines.dm
+++ b/code/modules/reagents/chems/chems_medicines.dm
@@ -17,7 +17,7 @@
if(E && istype(E) && !E.is_broken())
ADJ_STATUS(M, STAT_BLURRY, -5)
ADJ_STATUS(M, STAT_BLIND, -5)
- E.damage = max(E.damage - 5 * removed, 0)
+ E.organ_damage = max(E.organ_damage - 5 * removed, 0)
/decl/material/liquid/antirads
name = "antirads"
@@ -33,7 +33,7 @@
uid = "chem_antirads"
/decl/material/liquid/antirads/affect_blood(var/mob/living/M, var/removed, var/datum/reagents/holder)
- M.radiation = max(M.radiation - 30 * removed, 0)
+ M.heal_damage(30 * removed, IRRADIATE)
/decl/material/liquid/brute_meds
name = "styptic powder"
@@ -64,7 +64,7 @@
/decl/material/liquid/brute_meds/affect_blood(var/mob/living/M, var/removed, var/datum/reagents/holder)
..()
M.add_stressor(/datum/stressor/used_chems, 5 MINUTES)
- M.add_chemical_effect_max(CE_REGEN_BRUTE, round(effectiveness*ADJUSTED_REGEN_VAL(M.getBruteLoss())))
+ M.add_chemical_effect_max(CE_REGEN_BRUTE, round(effectiveness*ADJUSTED_REGEN_VAL(M.get_damage(BRUTE))))
M.add_chemical_effect(CE_PAINKILLER, 10)
/decl/material/liquid/burn_meds
@@ -83,7 +83,7 @@
/decl/material/liquid/burn_meds/affect_blood(mob/living/M, removed, var/datum/reagents/holder)
..()
M.add_stressor(/datum/stressor/used_chems, 5 MINUTES)
- M.add_chemical_effect_max(CE_REGEN_BURN, round(effectiveness*ADJUSTED_REGEN_VAL(M.getFireLoss())))
+ M.add_chemical_effect_max(CE_REGEN_BURN, round(effectiveness*ADJUSTED_REGEN_VAL(M.get_damage(BURN))))
M.add_chemical_effect(CE_PAINKILLER, 10)
#undef ADJUSTED_REGEN_VAL
@@ -262,7 +262,7 @@
E.limb_flags |= ORGAN_FLAG_DEFORMED
/decl/material/liquid/retrovirals/affect_blood(var/mob/living/M, var/removed, var/datum/reagents/holder)
- M.adjustCloneLoss(-20 * removed)
+ M.heal_damage(20 * removed, CLONE)
if(LAZYACCESS(M.chem_doses, type) > 10)
ADJ_STATUS(M, STAT_DIZZY, 5)
ADJ_STATUS(M, STAT_JITTER, 5)
@@ -304,7 +304,7 @@
var/mob/living/carbon/human/H = M
if(H.resuscitate())
var/obj/item/organ/internal/heart = GET_INTERNAL_ORGAN(H, BP_HEART)
- heart.take_internal_damage(heart.max_damage * 0.15)
+ heart.take_damage(heart.max_damage * 0.15, TOX)
/decl/material/liquid/stabilizer
name = "stabilizer"
@@ -404,7 +404,7 @@
/decl/material/liquid/clotting_agent/affect_overdose(var/mob/living/M)
var/obj/item/organ/internal/heart = GET_INTERNAL_ORGAN(M, BP_HEART)
if(heart && prob(25))
- heart.take_general_damage(rand(1,3))
+ heart.take_damage(rand(1,3), TOX)
return ..()
#define DETOXIFIER_EFFECTIVENESS 6 // 6u of opiates removed per 1u of detoxifier; 5u is enough to remove 30u, i.e. an overdose
diff --git a/code/modules/reagents/chems/chems_nutriment.dm b/code/modules/reagents/chems/chems_nutriment.dm
index 1e04eee2dd2a..5f65662ba7a0 100644
--- a/code/modules/reagents/chems/chems_nutriment.dm
+++ b/code/modules/reagents/chems/chems_nutriment.dm
@@ -47,7 +47,7 @@
/decl/material/liquid/nutriment/affect_blood(var/mob/living/M, var/removed, var/datum/reagents/holder)
if(!injectable)
- M.adjustToxLoss(0.2 * removed)
+ M.take_damage(0.2 * removed, TOX)
return
affect_ingest(M, removed, holder)
@@ -57,7 +57,7 @@
if(M.HasTrait(/decl/trait/metabolically_inert))
return
- M.heal_organ_damage(0.5 * removed, 0) //what
+ M.heal_damage(0.5 * removed, BRUTE)
M.add_chemical_effect(CE_BLOODRESTORE, 4 * removed)
/decl/material/liquid/nutriment/proc/adjust_nutrition(var/mob/living/carbon/M, var/removed)
@@ -101,7 +101,8 @@
/decl/material/liquid/nutriment/protein/adjust_nutrition(mob/living/carbon/M, removed)
var/malus_level = M.GetTraitLevel(/decl/trait/malus/animal_protein)
var/malus_factor = malus_level ? malus_level * 0.25 : 0
- M.adjustToxLoss(removed * malus_factor)
+ if(malus_level)
+ M.take_damage(removed * malus_factor, TOX)
M.adjust_nutrition(nutriment_factor * removed * (1 - malus_factor))
/decl/material/liquid/nutriment/protein/egg
diff --git a/code/modules/reagents/chems/chems_poisons.dm b/code/modules/reagents/chems/chems_poisons.dm
index 69196ca0a0c4..010188e7282b 100644
--- a/code/modules/reagents/chems/chems_poisons.dm
+++ b/code/modules/reagents/chems/chems_poisons.dm
@@ -25,7 +25,7 @@
SET_STATUS_MAX(M, STAT_BLURRY, 10)
if(dose > 1 * threshold)
- M.adjustToxLoss(removed)
+ M.take_damage(removed, TOX)
/decl/material/liquid/presyncopics
name = "presyncopics"
diff --git a/code/modules/reagents/chems/random/random_effects.dm b/code/modules/reagents/chems/random/random_effects.dm
index cb99074ef70b..0c91a887c425 100644
--- a/code/modules/reagents/chems/random/random_effects.dm
+++ b/code/modules/reagents/chems/random/random_effects.dm
@@ -227,8 +227,11 @@
mode = RANDOM_CHEM_EFFECT_INT
desc = "acute toxicity"
-/decl/random_chem_effect/random_properties/heal_brute/affect_blood(var/mob/living/M, var/removed, var/value)
- M.adjustToxLoss(value * removed)
+/decl/random_chem_effect/random_properties/tox_damage/affect_blood(var/mob/living/M, var/removed, var/value)
+ if(value > 0)
+ M.take_damage(value * removed, TOX)
+ else
+ M.heal_damage(value * removed, TOX)
/decl/random_chem_effect/random_properties/heal_brute
beneficial = 1
@@ -236,7 +239,7 @@
desc = "tissue repair"
/decl/random_chem_effect/random_properties/heal_brute/affect_blood(var/mob/living/M, var/removed, var/value)
- M.heal_organ_damage(removed * value, 0)
+ M.heal_damage(removed * value, BRUTE)
/decl/random_chem_effect/random_properties/heal_burns
beneficial = 1
@@ -244,7 +247,7 @@
desc = "burn repair"
/decl/random_chem_effect/random_properties/heal_brute/affect_blood(var/mob/living/M, var/removed, var/value)
- M.heal_organ_damage(0, removed * value)
+ M.heal_damage(removed * value, BURN)
#undef RANDOM_CHEM_EFFECT_TRUE
#undef RANDOM_CHEM_EFFECT_INT
diff --git a/code/modules/reagents/reagent_containers/beaker.dm b/code/modules/reagents/reagent_containers/beaker.dm
index 5aaca6207b0e..0a4031c78d0f 100644
--- a/code/modules/reagents/reagent_containers/beaker.dm
+++ b/code/modules/reagents/reagent_containers/beaker.dm
@@ -63,7 +63,7 @@
. = ..()
if(ATOM_IS_OPEN_CONTAINER(src))
reagents.splash(hit_atom, rand(reagents.total_volume*0.25,reagents.total_volume), min_spill = 60, max_spill = 100)
- take_damage(rand(4,8))
+ take_damage(rand(4,8), BRUTE)
/obj/item/chems/glass/beaker/large
name = "large beaker"
diff --git a/code/modules/reagents/reagent_containers/food/meat/cubes.dm b/code/modules/reagents/reagent_containers/food/meat/cubes.dm
index 7394c2c4411a..c794a3355525 100644
--- a/code/modules/reagents/reagent_containers/food/meat/cubes.dm
+++ b/code/modules/reagents/reagent_containers/food/meat/cubes.dm
@@ -53,7 +53,7 @@
target.visible_message(SPAN_DANGER("A screeching creature bursts out of \the [target]!"))
var/obj/item/organ/external/organ = GET_EXTERNAL_ORGAN(target, BP_CHEST)
if(organ)
- organ.take_external_damage(50, 0, 0, "Animal escaping the ribcage")
+ organ.take_damage(50, /decl/damage_handler/brute, used_weapon = "Animal escaping the ribcage")
Expand(get_turf(target))
/obj/item/chems/food/monkeycube/on_reagent_change()
diff --git a/code/modules/reagents/reagent_containers/food/sandwich.dm b/code/modules/reagents/reagent_containers/food/sandwich.dm
index 1ce36ad42556..7c6002164827 100644
--- a/code/modules/reagents/reagent_containers/food/sandwich.dm
+++ b/code/modules/reagents/reagent_containers/food/sandwich.dm
@@ -98,5 +98,5 @@
if(H && shard && M == user) //This needs a check for feeding the food to other people, but that could be abusable.
to_chat(H, "You lacerate your mouth on a [shard.name] in the sandwich!")
- H.adjustBruteLoss(5) //TODO: Target head if human.
+ H.take_damage(5, BRUTE) //TODO: Target head if human.
..()
diff --git a/code/modules/reagents/reagent_containers/syringes.dm b/code/modules/reagents/reagent_containers/syringes.dm
index b408d1c88ec8..41d16e0b7e73 100644
--- a/code/modules/reagents/reagent_containers/syringes.dm
+++ b/code/modules/reagents/reagent_containers/syringes.dm
@@ -143,7 +143,7 @@
if(prob(user.skill_fail_chance(SKILL_MEDICAL, 60, SKILL_BASIC)))
to_chat(user, SPAN_WARNING("You miss the vein!"))
var/target_zone = check_zone(user.get_target_zone(), T)
- T.apply_damage(3, BRUTE, target_zone, damage_flags=DAM_SHARP)
+ T.take_damage(3, BRUTE, target_zone, damage_flags=DAM_SHARP)
return
user.setClickCooldown(DEFAULT_QUICK_COOLDOWN)
@@ -279,11 +279,11 @@
return
user.visible_message(SPAN_DANGER("[user] stabs [target] in \the [hit_area] with [src.name]!"))
- target.apply_damage(3, BRUTE, target_zone, damage_flags=DAM_SHARP)
+ target.take_damage(3, BRUTE, target_zone, damage_flags=DAM_SHARP)
else
user.visible_message(SPAN_DANGER("[user] stabs [target] with [src.name]!"))
- target.apply_damage(3, BRUTE)
+ target.take_damage(3, BRUTE)
var/syringestab_amount_transferred = rand(0, (reagents.total_volume - 5)) //nerfed by popular demand
var/contained_reagents = reagents.get_reagents()
diff --git a/code/modules/reagents/reagent_dispenser.dm b/code/modules/reagents/reagent_dispenser.dm
index b7ea1a71c81b..c8696ca12558 100644
--- a/code/modules/reagents/reagent_dispenser.dm
+++ b/code/modules/reagents/reagent_dispenser.dm
@@ -218,7 +218,8 @@
else
log_and_message_admins("shot a fuel tank outside the world.")
- if((Proj.damage_flags & DAM_EXPLODE) || (Proj.damage_type == BURN) || (Proj.damage_type == ELECTROCUTE) || (Proj.damage_type == BRUTE))
+ var/decl/damage_handler/damage_type_data = GET_DECL(Proj.damage_type)
+ if((Proj.damage_flags & DAM_EXPLODE) || damage_type_data.can_ignite_reagents)
try_detonate_reagents()
return ..()
diff --git a/code/modules/recycling/disposalholder.dm b/code/modules/recycling/disposalholder.dm
index 120782aaff47..94fe8f823297 100644
--- a/code/modules/recycling/disposalholder.dm
+++ b/code/modules/recycling/disposalholder.dm
@@ -66,7 +66,7 @@
if(hasmob && prob(3))
for(var/mob/living/H in check_mob(src))
- H.apply_damage(30, BRUTE, null, DAM_DISPERSED, "Blunt Trauma", ARMOR_MELEE_MAJOR)//horribly maim any living creature jumping down disposals. c'est la vie
+ H.take_damage(30, BRUTE, null, DAM_DISPERSED, "Blunt Trauma", ARMOR_MELEE_MAJOR)//horribly maim any living creature jumping down disposals. c'est la vie
var/obj/structure/disposalpipe/curr = loc
if(!istype(curr))
diff --git a/code/modules/recycling/disposalpipe.dm b/code/modules/recycling/disposalpipe.dm
index 1ef619ed011c..54f60046a324 100644
--- a/code/modules/recycling/disposalpipe.dm
+++ b/code/modules/recycling/disposalpipe.dm
@@ -194,7 +194,7 @@
if(severity == 1)
broken(0)
else
- take_damage(rand(5,15))
+ take_damage(rand(5,15), BRUTE)
//attack by item
//weldingtool: unfasten and convert to obj/disposalconstruct
diff --git a/code/modules/recycling/sortingmachinery.dm b/code/modules/recycling/sortingmachinery.dm
index 048a2674cbf0..d92341d7861a 100644
--- a/code/modules/recycling/sortingmachinery.dm
+++ b/code/modules/recycling/sortingmachinery.dm
@@ -64,7 +64,7 @@
var/obj/item/organ/external/E = pick(crush)
- E.take_external_damage(45, used_weapon = "Blunt Trauma")
+ E.take_damage(45, BRUTE, used_weapon = "Blunt Trauma")
to_chat(L, "\The [src]'s mechanisms crush your [E.name]!")
H.init(src) // copy the contents of disposer to holder
diff --git a/code/modules/shield_generators/shield.dm b/code/modules/shield_generators/shield.dm
index af9266beaba6..5a7c2ba22b1b 100644
--- a/code/modules/shield_generators/shield.dm
+++ b/code/modules/shield_generators/shield.dm
@@ -104,7 +104,7 @@
/obj/effect/shield/proc/diffuse(var/duration)
// The shield is trying to counter diffusers. Cause lasting stress on the shield.
if(gen.check_flag(MODEFLAG_BYPASS) && !disabled_for)
- take_damage(duration * rand(8, 12), SHIELD_DAMTYPE_EM)
+ take_damage(duration * rand(8, 12), ELECTROCUTE)
return
diffused_for = max(duration, 0)
@@ -130,34 +130,30 @@
// The closer we are to impact site, the longer it takes for shield to come back up.
S.fail(-(-range + get_dist(src, S)) * 2)
-/obj/effect/shield/proc/take_damage(var/damage, var/damtype, var/hitby)
+/obj/effect/shield/take_damage(damage, damage_type = BRUTE, def_zone, damage_flags = 0, used_weapon, armor_pen, silent = FALSE, override_droplimb, skip_update_health = FALSE)
if(!gen)
qdel(src)
return
-
if(!damage)
return
-
damage = round(damage)
-
new /obj/effect/temporary(get_turf(src), 2 SECONDS,'icons/obj/machines/shielding.dmi',"shield_impact")
impact_effect(round(abs(damage * 2)))
-
var/list/field_segments = gen.field_segments
- switch(gen.take_shield_damage(damage, damtype))
+ switch(gen.take_damage(damage, damage_type))
if(SHIELD_ABSORBED)
return
if(SHIELD_BREACHED_MINOR)
- fail_adjacent_segments(rand(1, 3), hitby)
+ fail_adjacent_segments(rand(1, 3), used_weapon)
return
if(SHIELD_BREACHED_MAJOR)
- fail_adjacent_segments(rand(2, 5), hitby)
+ fail_adjacent_segments(rand(2, 5), used_weapon)
return
if(SHIELD_BREACHED_CRITICAL)
- fail_adjacent_segments(rand(4, 8), hitby)
+ fail_adjacent_segments(rand(4, 8), used_weapon)
return
if(SHIELD_BREACHED_FAILURE)
- fail_adjacent_segments(rand(8, 16), hitby)
+ fail_adjacent_segments(rand(8, 16), used_weapon)
for(var/obj/effect/shield/S in field_segments)
S.fail(1)
return
@@ -189,30 +185,25 @@
// EMP. It may seem weak but keep in mind that multiple shield segments are likely to be affected.
/obj/effect/shield/emp_act(var/severity)
if(!disabled_for)
- take_damage(rand(30,60) / severity, SHIELD_DAMTYPE_EM)
+ take_damage(rand(30,60) / severity, ELECTROCUTE)
// Explosions
/obj/effect/shield/explosion_act(var/severity)
SHOULD_CALL_PARENT(FALSE)
if(!disabled_for)
- take_damage(rand(10,15) / severity, SHIELD_DAMTYPE_PHYSICAL)
+ take_damage(rand(10,15) / severity, BRUTE)
// Fire
/obj/effect/shield/fire_act(datum/gas_mixture/air, exposed_temperature, exposed_volume)
SHOULD_CALL_PARENT(FALSE)
if(!disabled_for)
- take_damage(rand(5,10), SHIELD_DAMTYPE_HEAT)
+ take_damage(rand(5,10), BURN)
// Projectiles
/obj/effect/shield/bullet_act(var/obj/item/projectile/proj)
- if(proj.damage_type == BURN)
- take_damage(proj.get_structure_damage(), SHIELD_DAMTYPE_HEAT)
- else if (proj.damage_type == BRUTE)
- take_damage(proj.get_structure_damage(), SHIELD_DAMTYPE_PHYSICAL)
- else
- take_damage(proj.get_structure_damage(), SHIELD_DAMTYPE_EM)
+ take_damage(proj.get_structure_damage(), proj.damage_type, damage_flags = proj.damage_flags)
// Attacks with hand tools. Blocked by Hyperkinetic flag.
/obj/effect/shield/attackby(var/obj/item/I, var/mob/user)
@@ -221,12 +212,7 @@
if(gen.check_flag(MODEFLAG_HYPERKINETIC))
user.visible_message("\The [user] [pick(I.attack_verb)] \the [src] with \the [I]!")
- if(I.damtype == BURN)
- take_damage(I.force, SHIELD_DAMTYPE_HEAT)
- else if (I.damtype == BRUTE)
- take_damage(I.force, SHIELD_DAMTYPE_PHYSICAL)
- else
- take_damage(I.force, SHIELD_DAMTYPE_EM)
+ take_damage(I.force, I.damtype)
if(gen.check_flag(MODEFLAG_OVERCHARGE) && (I.obj_flags & OBJ_FLAG_CONDUCTIBLE))
overcharge_shock(user)
else
@@ -244,10 +230,10 @@
/obj/effect/shield/proc/overcharge_shock(var/mob/living/M)
- M.adjustFireLoss(rand(20, 40))
+ M.take_damage(rand(20, 40), BURN)
SET_STATUS_MAX(M, STAT_WEAK, 5)
to_chat(M, "As you come into contact with \the [src] a surge of energy paralyses you!")
- take_damage(10, SHIELD_DAMTYPE_EM)
+ take_damage(10, ELECTROCUTE)
// Called when a flag is toggled. Can be used to add on-toggle behavior, such as visual changes.
/obj/effect/shield/proc/flags_updated()
@@ -309,7 +295,7 @@
/obj/effect/meteor/shield_impact(var/obj/effect/shield/S)
if(!S.gen.check_flag(MODEFLAG_HYPERKINETIC))
return
- S.take_damage(get_shield_damage(), SHIELD_DAMTYPE_PHYSICAL, src)
+ S.take_damage(get_shield_damage(), BRUTE)
visible_message("\The [src] breaks into dust!")
make_debris()
qdel(src)
diff --git a/code/modules/shield_generators/shield_generator.dm b/code/modules/shield_generators/shield_generator.dm
index 0b4a9d14a474..faf2398af801 100644
--- a/code/modules/shield_generators/shield_generator.dm
+++ b/code/modules/shield_generators/shield_generator.dm
@@ -379,23 +379,25 @@
// Takes specific amount of damage
-/obj/machinery/shield_generator/proc/take_shield_damage(var/damage, var/shield_damtype)
+/obj/machinery/shield_generator/take_damage(damage, damage_type = BRUTE, def_zone, damage_flags = 0, used_weapon, armor_pen, silent = FALSE, override_droplimb, skip_update_health = FALSE)
var/energy_to_use = damage * ENERGY_PER_HP
if(check_flag(MODEFLAG_MODULATE))
mitigation_em -= MITIGATION_HIT_LOSS
mitigation_heat -= MITIGATION_HIT_LOSS
mitigation_physical -= MITIGATION_HIT_LOSS
- switch(shield_damtype)
- if(SHIELD_DAMTYPE_PHYSICAL)
+ switch(damage_type)
+ if(BRUTE)
mitigation_physical += MITIGATION_HIT_LOSS + MITIGATION_HIT_GAIN
energy_to_use *= 1 - (mitigation_physical / 100)
- if(SHIELD_DAMTYPE_EM)
+ if(ELECTROCUTE)
mitigation_em += MITIGATION_HIT_LOSS + MITIGATION_HIT_GAIN
energy_to_use *= 1 - (mitigation_em / 100)
- if(SHIELD_DAMTYPE_HEAT)
+ if(BURN)
mitigation_heat += MITIGATION_HIT_LOSS + MITIGATION_HIT_GAIN
energy_to_use *= 1 - (mitigation_heat / 100)
+ else
+ return SHIELD_ABSORBED
mitigation_em = clamp(0, mitigation_em, mitigation_max)
mitigation_heat = clamp(0, mitigation_heat, mitigation_max)
diff --git a/code/modules/species/outsider/random.dm b/code/modules/species/outsider/random.dm
index 25f6d1e37093..6d749e6f3fa2 100644
--- a/code/modules/species/outsider/random.dm
+++ b/code/modules/species/outsider/random.dm
@@ -59,11 +59,24 @@
//Combat stats
MULT_BY_RANDOM_COEF(total_health, 0.8, 1.2)
+
+ var/brute_mod = 1
MULT_BY_RANDOM_COEF(brute_mod, 0.5, 1.5)
+ var/burn_mod = 1
MULT_BY_RANDOM_COEF(burn_mod, 0.8, 1.2)
+ var/oxy_mod = 1
MULT_BY_RANDOM_COEF(oxy_mod, 0.5, 1.5)
+ var/toxins_mod = 1
MULT_BY_RANDOM_COEF(toxins_mod, 0, 2)
+ var/radiation_mod = 1
MULT_BY_RANDOM_COEF(radiation_mod, 0, 2)
+ damage_modifiers = list(
+ BURN = burn_mod,
+ BRUTE = brute_mod,
+ TOX = toxins_mod,
+ IRRADIATE = radiation_mod,
+ OXY = oxy_mod
+ )
if(brute_mod < 1 && prob(40))
species_flags |= SPECIES_FLAG_NO_MINOR_CUT
diff --git a/code/modules/species/outsider/shadow.dm b/code/modules/species/outsider/shadow.dm
index f112533c27b3..7f46e3c24bf6 100644
--- a/code/modules/species/outsider/shadow.dm
+++ b/code/modules/species/outsider/shadow.dm
@@ -45,6 +45,8 @@
var/turf/T = H.loc
light_amount = T.get_lumcount() * 10
if(light_amount > 2) //if there's enough light, start dying
- H.take_overall_damage(1,1)
+ H.take_damage(1, BRUTE)
+ H.take_damage(1, BURN)
else //heal in the dark
- H.heal_overall_damage(1,1)
\ No newline at end of file
+ H.heal_damage(1, BRUTE)
+ H.heal_damage(1, BURN)
diff --git a/code/modules/species/outsider/starlight.dm b/code/modules/species/outsider/starlight.dm
index 76ba51fd1aa4..eb039a5a2aff 100644
--- a/code/modules/species/outsider/starlight.dm
+++ b/code/modules/species/outsider/starlight.dm
@@ -137,11 +137,13 @@
hunger_factor = 0
breath_type = null
- burn_mod = 10
- brute_mod = 0
- oxy_mod = 0
- toxins_mod = 0
- radiation_mod = 0
+ damage_modifiers = list(
+ BURN = 10,
+ BRUTE = 0,
+ TOX = 0,
+ IRRADIATE = 0,
+ OXY = 0
+ )
species_flags = SPECIES_FLAG_NO_MINOR_CUT | SPECIES_FLAG_NO_SLIP | SPECIES_FLAG_NO_POISON | SPECIES_FLAG_NO_EMBED | SPECIES_FLAG_NO_TANGLE
/decl/species/starlight/blueforged/handle_death(var/mob/living/carbon/human/H)
diff --git a/code/modules/species/species.dm b/code/modules/species/species.dm
index 2130b66b273d..6c3ae1a8f630 100644
--- a/code/modules/species/species.dm
+++ b/code/modules/species/species.dm
@@ -72,17 +72,11 @@ var/global/const/DEFAULT_SPECIES_HEALTH = 200
)
var/list/natural_armour_values // Armour values used if naked.
- var/brute_mod = 1 // Physical damage multiplier.
- var/burn_mod = 1 // Burn damage multiplier.
- var/toxins_mod = 1 // Toxloss modifier
- var/radiation_mod = 1 // Radiation modifier
-
- var/oxy_mod = 1 // Oxyloss modifier
+ var/list/damage_modifiers // Various damage multipliers. Defaults to 1.
var/metabolism_mod = 1 // Reagent metabolism modifier
var/stun_mod = 1 // Stun period modifier.
var/paralysis_mod = 1 // Paralysis period modifier.
var/weaken_mod = 1 // Weaken period modifier.
-
var/vision_flags = SEE_SELF // Same flags as glasses.
// Death vars.
@@ -250,9 +244,9 @@ var/global/const/DEFAULT_SPECIES_HEALTH = 200
codex_traits += "- Has a plantlike physiology.
"
var/list/codex_damage_types = list(
- "physical trauma" = brute_mod,
- "burns" = burn_mod,
- "lack of air" = oxy_mod,
+ "physical trauma" = get_damage_modifier(null, BRUTE),
+ "burns" = get_damage_modifier(null, BURN),
+ "lack of air" = get_damage_modifier(null, OXY),
)
for(var/kind in codex_damage_types)
if(codex_damage_types[kind] > 1)
@@ -826,3 +820,8 @@ var/global/const/DEFAULT_SPECIES_HEALTH = 200
H.mob_swap_flags = swap_flags
H.mob_push_flags = push_flags
H.pass_flags = pass_flags
+/decl/species/proc/get_damage_modifier(var/mob/living/owner, var/damage_type)
+ if(damage_type in damage_modifiers)
+ . = damage_modifiers[damage_type]
+ if(owner?.isSynthetic() && damage_type == IRRADIATE)
+ . *= 0.5
diff --git a/code/modules/species/species_getters.dm b/code/modules/species/species_getters.dm
index a54b2fdc0159..624146ec9d7d 100644
--- a/code/modules/species/species_getters.dm
+++ b/code/modules/species/species_getters.dm
@@ -34,15 +34,6 @@
/decl/species/proc/get_footstep(var/mob/living/carbon/human/H, var/footstep_type)
return
-/decl/species/proc/get_brute_mod(var/mob/living/carbon/human/H)
- . = brute_mod
-
-/decl/species/proc/get_burn_mod(var/mob/living/carbon/human/H)
- . = burn_mod
-
-/decl/species/proc/get_radiation_mod(var/mob/living/carbon/human/H)
- . = (H && H.isSynthetic() ? 0.5 : radiation_mod)
-
/decl/species/proc/get_root_species_name(var/mob/living/carbon/human/H)
return name
diff --git a/code/modules/species/species_helpers.dm b/code/modules/species/species_helpers.dm
index 6b8aef39799f..2dce3fcfaaba 100644
--- a/code/modules/species/species_helpers.dm
+++ b/code/modules/species/species_helpers.dm
@@ -13,8 +13,8 @@ var/global/list/stored_shock_by_ref = list()
/decl/species/proc/fluid_act(var/mob/living/carbon/human/H, var/datum/reagents/fluids)
SHOULD_CALL_PARENT(TRUE)
var/water = REAGENT_VOLUME(fluids, /decl/material/liquid/water)
- if(water >= 40 && H.getHalLoss())
- H.adjustHalLoss(-(water_soothe_amount))
+ if(water >= 40 && H.get_damage(PAIN))
+ H.heal_damage(water_soothe_amount, PAIN)
if(prob(5))
to_chat(H, SPAN_NOTICE("The water ripples gently over your skin in a soothing balm."))
diff --git a/code/modules/spells/aoe_turf/drain_blood.dm b/code/modules/spells/aoe_turf/drain_blood.dm
index da5d1be45cd0..d772a7ff270c 100644
--- a/code/modules/spells/aoe_turf/drain_blood.dm
+++ b/code/modules/spells/aoe_turf/drain_blood.dm
@@ -24,7 +24,7 @@
var/mob/living/carbon/human/H = L
H.vessel.remove_any(10)
else
- L.adjustBruteLoss(10)
+ L.take_damage(10, BRUTE)
to_chat(L, "You feel your lifeforce being ripping out of your body!")
//Do effect
@@ -40,9 +40,9 @@
if(amount > 0)
H.adjust_blood(amount)
continue
- L.adjustBruteLoss(-5, do_update_health = FALSE)
- L.adjustFireLoss(-2.5, do_update_health = FALSE)
- L.adjustToxLoss(-2.5)
+ L.heal_damage(5, BRUTE, skip_update_health = TRUE)
+ L.heal_damage(2.5, BURN, skip_update_health = TRUE)
+ L.heal_damage(2.5, TOX)
/obj/item/projectile/beam/blood_effect
name = "blood jet"
diff --git a/code/modules/spells/aoe_turf/exchange_wounds.dm b/code/modules/spells/aoe_turf/exchange_wounds.dm
index 7a3f9b6bbea9..516cccbe06b9 100644
--- a/code/modules/spells/aoe_turf/exchange_wounds.dm
+++ b/code/modules/spells/aoe_turf/exchange_wounds.dm
@@ -28,13 +28,13 @@
if(L.faction != user.faction)
continue
new /obj/effect/temporary(get_turf(L),10,'icons/effects/effects.dmi',"green_sparkles")
- if(L.getBruteLoss() > 5)
- L.adjustBruteLoss(-5)
- user.adjustBruteLoss(2)
+ if(L.get_damage(BRUTE) > 5)
+ L.heal_damage(5, BRUTE)
+ user.take_damage(2, BRUTE)
amt_healed += 5
- if(L.getFireLoss() > 5)
- L.adjustFireLoss(-5)
- user.adjustFireLoss(2)
+ if(L.get_damage(BURN) > 5)
+ L.heal_damage(5, BURN)
+ user.take_damage(2, BURN)
amt_healed += 5
/spell/aoe_turf/exchange_wounds/check_valid_targets()
diff --git a/code/modules/spells/artifacts.dm b/code/modules/spells/artifacts.dm
index a2d586555795..bcb304660e16 100644
--- a/code/modules/spells/artifacts.dm
+++ b/code/modules/spells/artifacts.dm
@@ -37,6 +37,6 @@
if(isliving(user))
var/mob/living/M = user
if(icon_state == "[name][sides]")
- M.adjustBruteLoss(-30)
+ M.heal_damage(30, BRUTE)
else if(icon_state == "[name]1")
- M.adjustBruteLoss(30)
+ M.take_damage(30, BRUTE)
diff --git a/code/modules/spells/hand/burning_grip.dm b/code/modules/spells/hand/burning_grip.dm
index 759eda54cd60..d292915636f4 100644
--- a/code/modules/spells/hand/burning_grip.dm
+++ b/code/modules/spells/hand/burning_grip.dm
@@ -31,11 +31,11 @@
var/obj/item/organ/external/E = GET_EXTERNAL_ORGAN(H, organ)
if(!E)
continue
- E.take_external_damage(burn=10, used_weapon = "hot iron")
+ E.take_damage(10, BURN, used_weapon = "hot iron")
if(E.can_feel_pain())
E.check_pain_disarm()
else
- E.take_external_damage(burn=6, used_weapon = "hot iron")
+ E.take_damage(6, BURN, used_weapon = "hot iron")
to_chat(H, SPAN_WARNING("You notice that your [E] is burned."))
/spell/hand/burning_grip/tower
diff --git a/code/modules/spells/spell_code.dm b/code/modules/spells/spell_code.dm
index 981e56a5f0cc..7238bc9d5521 100644
--- a/code/modules/spells/spell_code.dm
+++ b/code/modules/spells/spell_code.dm
@@ -149,15 +149,15 @@ var/global/list/spells = typesof(/spell) //needed for the badmin verb for now
/spell/proc/adjust_var(mob/living/target = usr, type, amount) //handles the adjustment of the var when the spell is used. has some hardcoded types
switch(type)
if("bruteloss")
- target.adjustBruteLoss(amount)
+ target.take_damage(amount, BRUTE)
if("fireloss")
- target.adjustFireLoss(amount)
+ target.take_damage(amount, BURN)
if("toxloss")
- target.adjustToxLoss(amount)
+ target.take_damage(amount, TOX)
if("oxyloss")
- target.adjustOxyLoss(amount)
+ target.take_damage(amount, OXY)
if("brainloss")
- target.adjustBrainLoss(amount)
+ target.adjust_brain_damage(amount)
if("stunned")
ADJ_STATUS(target, STAT_STUN, amount)
if("weakened")
diff --git a/code/modules/spells/targeted/cleric_spells.dm b/code/modules/spells/targeted/cleric_spells.dm
index 59545660c563..79ec7b95a3e1 100644
--- a/code/modules/spells/targeted/cleric_spells.dm
+++ b/code/modules/spells/targeted/cleric_spells.dm
@@ -178,7 +178,7 @@
effect = new /obj/effect/rift(T)
effect.color = "f0e68c"
L.forceMove(effect)
- var/time = (L.getBruteLoss() + L.getFireLoss()) * 20
+ var/time = (L.get_damage(/decl/damage_handler/) + L.get_damage(BURN)) * 20
L.status_flags &= GODMODE
to_chat(L,"You will be in stasis for [time/10] second\s.")
addtimer(CALLBACK(src,PROC_REF(cancel_rift)),time)
diff --git a/code/modules/spells/targeted/equip/burning_touch.dm b/code/modules/spells/targeted/equip/burning_touch.dm
index b7e9c9dbdb99..17ee0b8fcfde 100644
--- a/code/modules/spells/targeted/equip/burning_touch.dm
+++ b/code/modules/spells/targeted/equip/burning_touch.dm
@@ -47,7 +47,7 @@
else if(src == user.get_equipped_item(BP_R_HAND))
hand = GET_INTERNAL_ORGAN(user, BP_R_HAND)
if(hand)
- hand.take_external_damage(burn = 2 * burn_power)
+ hand.take_damage(2 * burn_power, BURN)
if(burn_power > 5)
user.fire_stacks += 15
user.IgniteMob()
diff --git a/code/modules/spells/targeted/glimpse_of_eternity.dm b/code/modules/spells/targeted/glimpse_of_eternity.dm
index a34920af8f13..83377b6c672f 100644
--- a/code/modules/spells/targeted/glimpse_of_eternity.dm
+++ b/code/modules/spells/targeted/glimpse_of_eternity.dm
@@ -21,6 +21,6 @@
new /obj/effect/temporary(get_turf(L), 5, 'icons/effects/effects.dmi', "electricity_constant")
else
SET_STATUS_MAX(L, STAT_BLIND, 2)
- L.adjustBruteLoss(-10, do_update_health = FALSE)
- L.adjustFireLoss(-10)
+ L.heal_damage(10, BRUTE, skip_update_health = TRUE)
+ L.heal_damage(10, BURN)
new /obj/effect/temporary(get_turf(L), 5, 'icons/effects/effects.dmi', "green_sparkles")
\ No newline at end of file
diff --git a/code/modules/spells/targeted/shapeshift.dm b/code/modules/spells/targeted/shapeshift.dm
index b45e03c42eb1..4a240714270d 100644
--- a/code/modules/spells/targeted/shapeshift.dm
+++ b/code/modules/spells/targeted/shapeshift.dm
@@ -76,7 +76,7 @@
var/transformer_max_health = transformer.get_max_health()
var/damage = transformer.set_max_health(transformer_max_health-round(transformer_max_health*(transformer.get_health_ratio())))
for(var/i in 1 to CEILING(damage/10))
- transformer.adjustBruteLoss(10)
+ transformer.take_damage(10, BRUTE)
if(target.mind)
target.mind.transfer_to(transformer)
else
diff --git a/code/modules/spells/targeted/shatter_mind.dm b/code/modules/spells/targeted/shatter_mind.dm
index 26a3cc56892e..c1b0e0740ba8 100644
--- a/code/modules/spells/targeted/shatter_mind.dm
+++ b/code/modules/spells/targeted/shatter_mind.dm
@@ -25,5 +25,5 @@
ADJ_STATUS(H, STAT_CONFUSE, 2)
ADJ_STATUS(H, STAT_DIZZY, 2)
if(H.hallucination_power > 50)
- H.adjustBrainLoss(5)
+ H.adjust_brain_damage(5)
to_chat(H, "You feel your mind tearing apart!")
\ No newline at end of file
diff --git a/code/modules/spells/targeted/targeted.dm b/code/modules/spells/targeted/targeted.dm
index 04a69e3b7dab..425af9641976 100644
--- a/code/modules/spells/targeted/targeted.dm
+++ b/code/modules/spells/targeted/targeted.dm
@@ -140,22 +140,24 @@ Targeted spells have two useful flags: INCLUDEUSER and SELECTABLE. These are exp
apply_spell_damage(target)
/spell/targeted/proc/apply_spell_damage(mob/living/target)
- target.adjustBruteLoss(amt_dam_brute, do_update_health = FALSE)
- target.adjustFireLoss(amt_dam_fire, do_update_health = FALSE)
- target.adjustToxLoss(amt_dam_tox, do_update_health = FALSE)
- target.adjustOxyLoss(amt_dam_oxy)
+ target.take_damage(amt_dam_brute, BRUTE, skip_update_health = TRUE)
+ target.take_damage(amt_dam_fire, BURN, skip_update_health = TRUE)
+ target.take_damage(amt_dam_tox, TOX, skip_update_health = TRUE)
+ target.take_damage(amt_dam_oxy, OXY)
if(ishuman(target))
var/mob/living/carbon/human/H = target
for(var/obj/item/organ/internal/affecting in H.get_internal_organs())
if(affecting && istype(affecting))
- affecting.heal_damage(amt_organ, amt_organ)
+ affecting.heal_damage(amt_organ, BRUTE)
+ affecting.heal_damage(amt_organ, BURN)
for(var/obj/item/organ/external/affecting in H.get_external_organs())
if(affecting && istype(affecting))
var/dam = BP_IS_PROSTHETIC(affecting) ? -amt_dam_robo : amt_organ
- affecting.heal_damage(dam, dam, robo_repair = BP_IS_PROSTHETIC(affecting))
+ affecting.heal_damage(dam, BRUTE) // TODO, robo_repair = BP_IS_PROSTHETIC(affecting))
+ affecting.heal_damage(dam, BURN) // TODO, robo_repair = BP_IS_PROSTHETIC(affecting))
H.adjust_blood(amt_blood)
- H.adjustBrainLoss(amt_brain)
- H.radiation += min(H.radiation, amt_radiation)
+ H.adjust_brain_damage(amt_brain)
+ H.take_damage(amt_radiation, IRRADIATE)
target.update_icon()
//disabling
diff --git a/code/modules/spells/targeted/torment.dm b/code/modules/spells/targeted/torment.dm
index ea1cdff12a22..781b80102388 100644
--- a/code/modules/spells/targeted/torment.dm
+++ b/code/modules/spells/targeted/torment.dm
@@ -23,7 +23,7 @@
/spell/targeted/torment/cast(var/list/targets, var/mob/user)
gibs(user.loc)
for(var/mob/living/carbon/human/H in targets)
- H.adjustHalLoss(loss)
+ H.take_damage(loss, PAIN)
/spell/targeted/torment/empower_spell()
if(!..())
diff --git a/code/modules/status_conditions/status_jittery.dm b/code/modules/status_conditions/status_jittery.dm
index f196c38b430e..297bd245f14a 100644
--- a/code/modules/status_conditions/status_jittery.dm
+++ b/code/modules/status_conditions/status_jittery.dm
@@ -29,10 +29,10 @@
return
if(prob(5))
if(prob(1))
- heart.take_internal_damage(heart.max_damage / 2, 0)
+ heart.take_damage(heart.max_damage / 2, TOX)
to_chat(victim, SPAN_DANGER("Something bursts in your heart."))
admin_victim_log(victim, "has taken lethal heart damage at jitteriness level [jitteriness].")
else
- heart.take_internal_damage(heart, 0)
+ heart.take_damage(heart, TOX)
to_chat(victim, SPAN_DANGER("The jitters are killing you! You feel your heart beating out of your chest."))
admin_victim_log(victim, "has taken minor heart damage at jitteriness level [jitteriness].")
diff --git a/code/modules/supermatter/supermatter.dm b/code/modules/supermatter/supermatter.dm
index dce747435be1..9d10a2497441 100644
--- a/code/modules/supermatter/supermatter.dm
+++ b/code/modules/supermatter/supermatter.dm
@@ -639,11 +639,10 @@ var/global/list/supermatter_delam_accent_sounds = list(
user.visible_message(SPAN_WARNING("\The [user] touches \the [src] with \a [W] as silence fills the room..."),\
SPAN_DANGER("You touch \the [W] to \the [src] when everything suddenly goes quiet."),\
SPAN_WARNING("Everything suddenly goes silent."))
-
to_chat(user, SPAN_NOTICE("\The [W] flashes into dust as you flinch away from \the [src]."))
user.drop_from_inventory(W)
Consume(user, W, TRUE)
- user.apply_damage(150, IRRADIATE, damage_flags = DAM_DISPERSED)
+ user.take_damage(150, IRRADIATE, damage_flags = DAM_DISPERSED)
/obj/machinery/power/supermatter/Bumped(atom/AM)
if(!Consume(null, AM))
diff --git a/code/modules/surgery/bones.dm b/code/modules/surgery/bones.dm
index 82f52e1d33da..cac87c2a88d2 100644
--- a/code/modules/surgery/bones.dm
+++ b/code/modules/surgery/bones.dm
@@ -107,7 +107,7 @@
user.visible_message("\The [user]'s hand slips, damaging the [affected.encased ? affected.encased : "bones"] in \the [target]'s [affected.name] with \the [tool]!" , \
"Your hand slips, damaging the [affected.encased ? affected.encased : "bones"] in \the [target]'s [affected.name] with \the [tool]!")
affected.fracture()
- affected.take_external_damage(5, used_weapon = tool)
+ affected.take_damage(5, BRUTE, used_weapon = tool)
..()
//////////////////////////////////////////////////////////////////
diff --git a/code/modules/surgery/encased.dm b/code/modules/surgery/encased.dm
index 36a969d13fd8..c93d9f03b0a3 100644
--- a/code/modules/surgery/encased.dm
+++ b/code/modules/surgery/encased.dm
@@ -45,6 +45,6 @@
var/obj/item/organ/external/affected = GET_EXTERNAL_ORGAN(target, target_zone)
user.visible_message("[user]'s hand slips, cracking [target]'s [affected.encased] with \the [tool]!" , \
"Your hand slips, cracking [target]'s [affected.encased] with \the [tool]!" )
- affected.take_external_damage(15, 0, (DAM_SHARP|DAM_EDGE), used_weapon = tool)
+ affected.take_damage(15, BRUTE, damage_flags = (DAM_SHARP|DAM_EDGE), used_weapon = tool)
affected.fracture()
..()
diff --git a/code/modules/surgery/face.dm b/code/modules/surgery/face.dm
index a2baf2e1200d..fbb50bba4889 100644
--- a/code/modules/surgery/face.dm
+++ b/code/modules/surgery/face.dm
@@ -36,5 +36,5 @@
var/obj/item/organ/external/affected = GET_EXTERNAL_ORGAN(target, target_zone)
user.visible_message("[user]'s hand slips, tearing skin on [target]'s face with \the [tool]!", \
"Your hand slips, tearing skin on [target]'s face with \the [tool]!")
- affected.take_external_damage(10, 0, (DAM_SHARP|DAM_EDGE), used_weapon = tool)
+ affected.take_damage(10, BRUTE, damage_flags = (DAM_SHARP|DAM_EDGE), used_weapon = tool)
..()
diff --git a/code/modules/surgery/generic.dm b/code/modules/surgery/generic.dm
index 4f6c83bee519..039603369f75 100644
--- a/code/modules/surgery/generic.dm
+++ b/code/modules/surgery/generic.dm
@@ -50,7 +50,7 @@
var/obj/item/organ/external/affected = GET_EXTERNAL_ORGAN(target, target_zone)
user.visible_message("[user] has made [access_string] on [target]'s [affected.name] with \the [tool].", \
"You have made [access_string] on [target]'s [affected.name] with \the [tool].",)
- affected.createwound(CUT, CEILING(affected.min_broken_damage/2), TRUE)
+ affected.createwound(WOUND_CUT, CEILING(affected.min_broken_damage/2), TRUE)
if(tool.damtype == BURN)
affected.clamp_organ()
playsound(target, 'sound/items/Welder.ogg', 15, 1)
@@ -61,7 +61,7 @@
var/obj/item/organ/external/affected = GET_EXTERNAL_ORGAN(target, target_zone)
user.visible_message("[user]'s hand slips, [fail_string] \the [target]'s [affected.name] in the wrong place with \the [tool]!", \
"Your hand slips, [fail_string] \the [target]'s [affected.name] in the wrong place with \the [tool]!")
- affected.take_external_damage(10, 0, (DAM_SHARP|DAM_EDGE), used_weapon = tool)
+ affected.take_damage(10, BRUTE, damage_flags = (DAM_SHARP|DAM_EDGE), used_weapon = tool)
..()
/decl/surgery_step/generic/cut_open/success_chance(mob/living/user, mob/living/target, obj/item/tool)
@@ -111,7 +111,7 @@
var/obj/item/organ/external/affected = GET_EXTERNAL_ORGAN(target, target_zone)
user.visible_message("[user]'s hand slips, tearing blood vessals and causing massive bleeding in [target]'s [affected.name] with \the [tool]!", \
"Your hand slips, tearing blood vessels and causing massive bleeding in [target]'s [affected.name] with \the [tool]!",)
- affected.take_external_damage(10, 0, (DAM_SHARP|DAM_EDGE), used_weapon = tool)
+ affected.take_damage(10, BRUTE, damage_flags = (DAM_SHARP|DAM_EDGE), used_weapon = tool)
..()
//////////////////////////////////////////////////////////////////
@@ -157,7 +157,7 @@
var/obj/item/organ/external/affected = GET_EXTERNAL_ORGAN(target, target_zone)
user.visible_message("[user]'s hand slips, tearing the edges of the incision on [target]'s [affected.name] with \the [tool]!", \
"Your hand slips, tearing the edges of the incision on [target]'s [affected.name] with \the [tool]!")
- affected.take_external_damage(12, 0, (DAM_SHARP|DAM_EDGE), used_weapon = tool)
+ affected.take_damage(12, BRUTE, damage_flags = (DAM_SHARP|DAM_EDGE), used_weapon = tool)
..()
//////////////////////////////////////////////////////////////////
@@ -213,7 +213,7 @@
var/obj/item/organ/external/affected = GET_EXTERNAL_ORGAN(target, target_zone)
user.visible_message("[user]'s hand slips, damaging [target]'s [affected.name] with \the [tool]!", \
"Your hand slips, damaging [target]'s [affected.name] with \the [tool]!")
- affected.take_external_damage(0, 3, used_weapon = tool)
+ affected.take_damage(3, BURN, used_weapon = tool)
..()
//////////////////////////////////////////////////////////////////
@@ -285,11 +285,11 @@
user.visible_message(
SPAN_DANGER("\The [user] manages to get \the [tool] stuck in \the [target]'s [affected.name]!"), \
SPAN_DANGER("You manage to get \the [tool] stuck in \the [target]'s [affected.name]!"))
- affected.embed(tool, affected.take_external_damage(30, 0, (DAM_SHARP|DAM_EDGE), used_weapon = tool))
+ affected.embed(tool, affected.take_damage(30, BRUTE, damage_flags = (DAM_SHARP|DAM_EDGE), used_weapon = tool))
else
user.visible_message(
SPAN_WARNING("\The [user] slips, mangling \the [target]'s [affected.name] with \the [tool]."), \
SPAN_WARNING("You slip, mangling \the [target]'s [affected.name] with \the [tool]."))
- affected.take_external_damage(30, 0, (DAM_SHARP|DAM_EDGE), used_weapon = tool)
+ affected.take_damage(30, BRUTE, damage_flags = (DAM_SHARP|DAM_EDGE), used_weapon = tool)
affected.fracture()
..()
diff --git a/code/modules/surgery/implant.dm b/code/modules/surgery/implant.dm
index 1b8ef1751a04..fc094ab8d4a5 100644
--- a/code/modules/surgery/implant.dm
+++ b/code/modules/surgery/implant.dm
@@ -18,7 +18,7 @@
var/obj/item/organ/external/affected = GET_EXTERNAL_ORGAN(target, target_zone)
user.visible_message("[user]'s hand slips, scraping around inside [target]'s [affected.name] with \the [tool]!", \
"Your hand slips, scraping around inside [target]'s [affected.name] with \the [tool]!")
- affected.take_external_damage(20, 0, (DAM_SHARP|DAM_EDGE), used_weapon = tool)
+ affected.take_damage(20, BRUTE, damage_flags = (DAM_SHARP|DAM_EDGE), used_weapon = tool)
..()
//////////////////////////////////////////////////////////////////
diff --git a/code/modules/surgery/limb_reattach.dm b/code/modules/surgery/limb_reattach.dm
index 71a67326c502..6f00edc38b24 100644
--- a/code/modules/surgery/limb_reattach.dm
+++ b/code/modules/surgery/limb_reattach.dm
@@ -118,7 +118,7 @@
var/obj/item/organ/external/E = tool
user.visible_message(" [user]'s hand slips, damaging [target]'s [E.amputation_point]!", \
" Your hand slips, damaging [target]'s [E.amputation_point]!")
- target.apply_damage(10, BRUTE, null, damage_flags=DAM_SHARP)
+ target.take_damage(10, BRUTE, null, damage_flags=DAM_SHARP)
..()
//////////////////////////////////////////////////////////////////
@@ -163,5 +163,5 @@
var/obj/item/organ/external/E = GET_EXTERNAL_ORGAN(target, target_zone)
user.visible_message(" [user]'s hand slips, damaging [target]'s [E.amputation_point]!", \
" Your hand slips, damaging [target]'s [E.amputation_point]!")
- target.apply_damage(10, BRUTE, null, damage_flags=DAM_SHARP)
+ target.take_damage(10, BRUTE, null, damage_flags=DAM_SHARP)
..()
diff --git a/code/modules/surgery/necrotic.dm b/code/modules/surgery/necrotic.dm
index cae3b0fc8eb0..87d2a50e5aa5 100644
--- a/code/modules/surgery/necrotic.dm
+++ b/code/modules/surgery/necrotic.dm
@@ -86,7 +86,7 @@
user.visible_message(
SPAN_DANGER("\The [user]'s hand slips, slicing into a healthy portion of \the [target]'s [affected.name] with \the [tool]!"),
SPAN_DANGER("Your hand slips, slicing into a healthy portion of [target]'s [affected.name] with \the [tool]!"))
- affected.take_external_damage(10, 0, (DAM_SHARP|DAM_EDGE), used_weapon = tool)
+ affected.take_damage(10, BRUTE, damage_flags = (DAM_SHARP|DAM_EDGE), used_weapon = tool)
..()
//////////////////////////////////////////////////////////////////
@@ -180,7 +180,7 @@
SPAN_NOTICE("You treat \the [target]'s [O.name] with \the [tool]'s contents."))
O &= ~ORGAN_DEAD
- O.heal_damage(O.max_damage * (0.75 * (usable_amount / 5))) //Assuming they're using a dropper and completely pure chems, put the organ back to a working point
+ O.heal_damage(O.max_damage * (0.75 * (usable_amount / 5)), TOX) //Assuming they're using a dropper and completely pure chems, put the organ back to a working point
else
to_chat(user,SPAN_WARNING("You transferred too little for the organ to regenerate!"))
qdel(temp_reagents)
diff --git a/code/modules/surgery/organs_internal.dm b/code/modules/surgery/organs_internal.dm
index 5ee4834aa702..0642e20faf80 100644
--- a/code/modules/surgery/organs_internal.dm
+++ b/code/modules/surgery/organs_internal.dm
@@ -30,7 +30,7 @@
var/obj/item/organ/external/affected = ..()
if(affected)
for(var/obj/item/organ/internal/I in affected.internal_organs)
- if(I.damage > 0)
+ if(I.organ_damage > 0)
if(I.status & ORGAN_DEAD)
to_chat(user, SPAN_WARNING("\The [I] is [I.can_recover() ? "decaying" : "necrotic"] and cannot be treated with \the [tool] alone."))
continue
@@ -47,7 +47,7 @@
user.visible_message("[user] starts treating damage within \the [target]'s [affected.name] with [tool_name].", \
"You start treating damage within \the [target]'s [affected.name] with [tool_name]." )
for(var/obj/item/organ/internal/I in affected.internal_organs)
- if(I && I.damage > 0 && !BP_IS_PROSTHETIC(I) && !(I.status & ORGAN_DEAD) && (I.surface_accessible || affected.how_open() >= (affected.encased ? SURGERY_ENCASED : SURGERY_RETRACTED)))
+ if(I && I.organ_damage > 0 && !BP_IS_PROSTHETIC(I) && !(I.status & ORGAN_DEAD) && (I.surface_accessible || affected.how_open() >= (affected.encased ? SURGERY_ENCASED : SURGERY_RETRACTED)))
user.visible_message("[user] starts treating damage to [target]'s [I] with [tool_name].", \
"You start treating damage to [target]'s [I] with [tool_name]." )
target.custom_pain("The pain in your [affected.name] is living hell!",100,affecting = affected)
@@ -61,7 +61,7 @@
tool_name = "the bandaid"
var/obj/item/organ/external/affected = GET_EXTERNAL_ORGAN(target, target_zone)
for(var/obj/item/organ/internal/I in affected.internal_organs)
- if(I && I.damage > 0 && !BP_IS_PROSTHETIC(I) && (I.surface_accessible || affected.how_open() >= (affected.encased ? SURGERY_ENCASED : SURGERY_RETRACTED)))
+ if(I && I.organ_damage > 0 && !BP_IS_PROSTHETIC(I) && (I.surface_accessible || affected.how_open() >= (affected.encased ? SURGERY_ENCASED : SURGERY_RETRACTED)))
if(I.status & ORGAN_DEAD)
to_chat(user, SPAN_NOTICE("You were unable to treat \the [I] due to its necrotic state."))
else
@@ -78,14 +78,14 @@
"Your hand slips, getting mess and tearing the inside of [target]'s [affected.name] with \the [tool]!")
var/dam_amt = 2
if(istype(tool, /obj/item/stack/medical/advanced/bruise_pack))
- target.adjustToxLoss(5)
+ target.take_damage(5, TOX)
else
dam_amt = 5
- target.adjustToxLoss(10)
- affected.take_external_damage(dam_amt, 0, (DAM_SHARP|DAM_EDGE), used_weapon = tool)
+ target.take_damage(10, TOX)
+ affected.take_damage(dam_amt, BRUTE, damage_flags = (DAM_SHARP|DAM_EDGE), used_weapon = tool)
for(var/obj/item/organ/internal/I in affected.internal_organs)
- if(I && I.damage > 0 && !BP_IS_PROSTHETIC(I) && (I.surface_accessible || affected.how_open() >= (affected.encased ? SURGERY_ENCASED : SURGERY_RETRACTED)))
- I.take_internal_damage(dam_amt)
+ if(I && I.organ_damage > 0 && !BP_IS_PROSTHETIC(I) && (I.surface_accessible || affected.how_open() >= (affected.encased ? SURGERY_ENCASED : SURGERY_RETRACTED)))
+ I.take_damage(dam_amt, BRUTE)
..()
//////////////////////////////////////////////////////////////////
@@ -135,7 +135,7 @@
if(affected)
user.visible_message("[user]'s hand slips, slicing an artery inside [target]'s [affected.name] with \the [tool]!", \
"Your hand slips, slicing an artery inside [target]'s [affected.name] with \the [tool]!")
- affected.take_external_damage(rand(30,50), 0, (DAM_SHARP|DAM_EDGE), used_weapon = tool)
+ affected.take_damage(rand(30,50), BRUTE, damage_flags = (DAM_SHARP|DAM_EDGE), used_weapon = tool)
..()
//////////////////////////////////////////////////////////////////
@@ -209,7 +209,7 @@
var/obj/item/organ/external/affected = GET_EXTERNAL_ORGAN(target, target_zone)
user.visible_message("[user]'s hand slips, damaging [target]'s [affected.name] with \the [tool]!", \
"Your hand slips, damaging [target]'s [affected.name] with \the [tool]!")
- affected.take_external_damage(20, used_weapon = tool)
+ affected.take_damage(20, BRUTE, used_weapon = tool)
..()
//////////////////////////////////////////////////////////////////
@@ -253,7 +253,7 @@
var/decl/pronouns/G = O.get_pronouns()
if(O.organ_tag == BP_POSIBRAIN && !target.should_have_organ(BP_POSIBRAIN))
to_chat(user, SPAN_WARNING("There's no place in [target] to fit \the [O.organ_tag]."))
- else if(O.damage > (O.max_damage * 0.75))
+ else if(O.organ_damage > (O.max_damage * 0.75))
to_chat(user, SPAN_WARNING("\The [O.name] [G.is] in no state to be transplanted."))
else if(O.w_class > affected.cavity_max_w_class)
to_chat(user, SPAN_WARNING("\The [O.name] [G.is] too big for [affected.cavity_name] cavity!"))
@@ -291,7 +291,7 @@
"Your hand slips, damaging \the [tool]!")
var/obj/item/organ/internal/I = tool
if(istype(I))
- I.take_internal_damage(rand(3,5))
+ I.take_damage(rand(3,5), BRUTE)
..()
//////////////////////////////////////////////////////////////////
@@ -383,5 +383,5 @@
var/obj/item/organ/external/affected = GET_EXTERNAL_ORGAN(target, target_zone)
user.visible_message("[user]'s hand slips, damaging the flesh in [target]'s [affected.name] with \the [tool]!", \
"Your hand slips, damaging the flesh in [target]'s [affected.name] with \the [tool]!")
- affected.take_external_damage(20, used_weapon = tool)
+ affected.take_damage(20, BRUTE, used_weapon = tool)
..()
diff --git a/code/modules/surgery/other.dm b/code/modules/surgery/other.dm
index ab9fe7b5d5bf..c8f22f5f2d89 100644
--- a/code/modules/surgery/other.dm
+++ b/code/modules/surgery/other.dm
@@ -45,7 +45,7 @@
var/obj/item/organ/external/affected = GET_EXTERNAL_ORGAN(target, target_zone)
user.visible_message("[user]'s hand slips, smearing [tool] in the incision in [target]'s [affected.name]!" , \
"Your hand slips, smearing [tool] in the incision in [target]'s [affected.name]!")
- affected.take_external_damage(5, used_weapon = tool)
+ affected.take_damage(5, BRUTE, used_weapon = tool)
..()
//////////////////////////////////////////////////////////////////
@@ -91,7 +91,7 @@
var/obj/item/organ/external/affected = GET_EXTERNAL_ORGAN(target, target_zone)
user.visible_message("[user]'s hand slips, smearing [tool] in the incision in [target]'s [affected.name]!" , \
"Your hand slips, smearing [tool] in the incision in [target]'s [affected.name]!")
- affected.take_external_damage(5, used_weapon = tool)
+ affected.take_damage(5, BRUTE, used_weapon = tool)
..()
diff --git a/code/modules/surgery/robotics.dm b/code/modules/surgery/robotics.dm
index e972107b4b27..2fe20cba1e2d 100644
--- a/code/modules/surgery/robotics.dm
+++ b/code/modules/surgery/robotics.dm
@@ -226,7 +226,7 @@
var/obj/item/organ/external/affected = GET_EXTERNAL_ORGAN(target, target_zone)
user.visible_message("[user] finishes patching damage to [target]'s [affected.name] with \the [tool].", \
"You finish patching damage to [target]'s [affected.name] with \the [tool].")
- affected.heal_damage(rand(30,50),0,1,1)
+ affected.heal_damage(rand(30,50), BRUTE) // todo robo repair
affected.status &= ~ORGAN_DISFIGURED
..()
@@ -234,7 +234,7 @@
var/obj/item/organ/external/affected = GET_EXTERNAL_ORGAN(target, target_zone)
user.visible_message("[user]'s [tool.name] slips, damaging the internal structure of [target]'s [affected.name].",
"Your [tool.name] slips, damaging the internal structure of [target]'s [affected.name].")
- target.apply_damage(rand(5,10), BURN, affected)
+ target.take_damage(rand(5,10), BURN, affected)
..()
//////////////////////////////////////////////////////////////////
@@ -274,7 +274,7 @@
var/obj/item/organ/external/affected = GET_EXTERNAL_ORGAN(target, target_zone)
user.visible_message("[user] causes some of \the [target]'s [affected.name] to crumble!",
"You cause some of \the [target]'s [affected.name] to crumble!")
- target.apply_damage(rand(5,10), BRUTE, affected)
+ target.take_damage(rand(5,10), BRUTE, affected)
..()
//////////////////////////////////////////////////////////////////
@@ -325,7 +325,7 @@
var/obj/item/organ/external/affected = GET_EXTERNAL_ORGAN(target, target_zone)
user.visible_message("[user] finishes splicing cable into [target]'s [affected.name].", \
"You finishes splicing new cable into [target]'s [affected.name].")
- affected.heal_damage(0,rand(30,50),1,1)
+ affected.heal_damage(rand(30,50), BURN) // todo robo repair
affected.status &= ~ORGAN_DISFIGURED
..()
@@ -333,7 +333,7 @@
var/obj/item/organ/external/affected = GET_EXTERNAL_ORGAN(target, target_zone)
user.visible_message("[user] causes a short circuit in [target]'s [affected.name]!",
"You cause a short circuit in [target]'s [affected.name]!")
- target.apply_damage(rand(5,10), BURN, affected)
+ target.take_damage(rand(5,10), BURN, affected)
..()
//////////////////////////////////////////////////////////////////
@@ -361,7 +361,7 @@
var/obj/item/organ/external/affected = ..()
if(affected)
for(var/obj/item/organ/internal/I in affected.internal_organs)
- if(BP_IS_PROSTHETIC(I) && !BP_IS_CRYSTAL(I) && I.damage > 0)
+ if(BP_IS_PROSTHETIC(I) && !BP_IS_CRYSTAL(I) && I.organ_damage > 0)
if(I.surface_accessible)
return affected
if(affected.how_open() >= (affected.encased ? SURGERY_ENCASED : SURGERY_RETRACTED) || affected.hatch_state == HATCH_OPENED)
@@ -370,7 +370,7 @@
/decl/surgery_step/robotics/fix_organ_robotic/begin_step(mob/user, mob/living/target, target_zone, obj/item/tool)
var/obj/item/organ/external/affected = GET_EXTERNAL_ORGAN(target, target_zone)
for(var/obj/item/organ/I in affected.internal_organs)
- if(I && I.damage > 0)
+ if(I && I.organ_damage > 0)
if(BP_IS_PROSTHETIC(I))
user.visible_message("[user] starts mending the damage to [target]'s [I.name]'s mechanisms.", \
"You start mending the damage to [target]'s [I.name]'s mechanisms." )
@@ -379,23 +379,23 @@
/decl/surgery_step/robotics/fix_organ_robotic/end_step(mob/living/user, mob/living/target, target_zone, obj/item/tool)
var/obj/item/organ/external/affected = GET_EXTERNAL_ORGAN(target, target_zone)
for(var/obj/item/organ/I in affected.internal_organs)
- if(I && I.damage > 0)
+ if(I && I.organ_damage > 0)
if(BP_IS_PROSTHETIC(I))
user.visible_message("[user] repairs [target]'s [I.name] with [tool].", \
"You repair [target]'s [I.name] with [tool]." )
- I.damage = 0
+ I.organ_damage = 0
..()
/decl/surgery_step/robotics/fix_organ_robotic/fail_step(mob/living/user, mob/living/target, target_zone, obj/item/tool)
var/obj/item/organ/external/affected = GET_EXTERNAL_ORGAN(target, target_zone)
user.visible_message("[user]'s hand slips, gumming up the mechanisms inside of [target]'s [affected.name] with \the [tool]!", \
"Your hand slips, gumming up the mechanisms inside of [target]'s [affected.name] with \the [tool]!")
- target.adjustToxLoss(5)
- affected.createwound(CUT, 5)
+ target.take_damage(5, TOX)
+ affected.createwound(WOUND_CUT, 5)
for(var/internal in affected.internal_organs)
var/obj/item/organ/internal/I = internal
if(I)
- I.take_internal_damage(rand(3,5))
+ I.take_damage(rand(3,5), BRUTE)
..()
//////////////////////////////////////////////////////////////////
@@ -622,5 +622,5 @@
user.visible_message( \
SPAN_WARNING("\The [user]'s hand slips, damaging \the [target]'s [affected.name] with \the [tool]!"), \
SPAN_WARNING("Your hand slips, damaging \the [target]'s [affected.name] with \the [tool]!"))
- affected.take_external_damage(3, 0, used_weapon = tool)
+ affected.take_damage(3, BRUTE, used_weapon = tool)
..()
diff --git a/code/modules/surgery/suture_wounds.dm b/code/modules/surgery/suture_wounds.dm
index 987107568309..2bce5f13a548 100644
--- a/code/modules/surgery/suture_wounds.dm
+++ b/code/modules/surgery/suture_wounds.dm
@@ -13,7 +13,7 @@
var/obj/item/organ/external/affected = GET_EXTERNAL_ORGAN(target, target_zone)
if(affected)
for(var/datum/wound/W in affected.wounds)
- if(W.damage_type == CUT && W.damage >= W.autoheal_cutoff)
+ if(W.wound_type == WOUND_CUT && W.damage >= W.autoheal_cutoff)
return TRUE
to_chat(user, SPAN_WARNING("\The [target]'s [affected.name] has no wounds that are large enough to need suturing."))
return FALSE
@@ -28,9 +28,9 @@
/decl/surgery_step/suture_wounds/end_step(mob/living/user, mob/living/target, target_zone, obj/item/tool)
var/obj/item/organ/external/affected = GET_EXTERNAL_ORGAN(target, target_zone)
for(var/datum/wound/W in affected.wounds)
- if(W.damage_type == CUT && W.damage >= W.autoheal_cutoff)
+ if(W.wound_type == WOUND_CUT && W.damage >= W.autoheal_cutoff)
// Close it up to a point that it can be bandaged and heal naturally!
- W.heal_damage(rand(10,20)+10)
+ W.heal_wound_damage(rand(10,20)+10)
if(W.damage >= W.autoheal_cutoff)
user.visible_message(SPAN_NOTICE("\The [user] partially closes a wound on [target]'s [affected.name] with \the [tool]."), \
SPAN_NOTICE("You partially close a wound on [target]'s [affected.name] with \the [tool]."))
@@ -50,5 +50,5 @@
var/obj/item/organ/external/affected = GET_EXTERNAL_ORGAN(target, target_zone)
user.visible_message(SPAN_DANGER("[user]'s hand slips, tearing [target]'s [affected.name] with \the [tool]!"), \
SPAN_DANGER("Your hand slips, tearing [target]'s [affected.name] with \the [tool]!"))
- target.apply_damage(3, BRUTE, affected)
+ target.take_damage(3, BRUTE, affected)
..()
diff --git a/code/modules/vehicles/cargo_train.dm b/code/modules/vehicles/cargo_train.dm
index e995266e03f9..e25e789f3501 100644
--- a/code/modules/vehicles/cargo_train.dm
+++ b/code/modules/vehicles/cargo_train.dm
@@ -155,7 +155,7 @@
for(var/i = 1 to rand(1,5))
var/obj/item/organ/external/E = pick(victim.get_external_organs())
if(E)
- victim.apply_damage(rand(5,10), BRUTE, E.organ_tag)
+ victim.take_damage(rand(5,10), BRUTE, E.organ_tag)
/obj/vehicle/train/cargo/trolley/crossed_mob(var/mob/living/victim)
..()
diff --git a/code/modules/vehicles/train.dm b/code/modules/vehicles/train.dm
index 804dea26ff92..8cba2b58c10d 100644
--- a/code/modules/vehicles/train.dm
+++ b/code/modules/vehicles/train.dm
@@ -63,7 +63,7 @@
visible_message("[src] knocks over [M]!")
var/def_zone = ran_zone()
M.apply_effects(5, 5) //knock people down if you hit them
- M.apply_damage(22 / move_delay, BRUTE, def_zone) // and do damage according to how fast the train is going
+ M.take_damage(22 / move_delay, BRUTE, def_zone) // and do damage according to how fast the train is going
if(ishuman(load))
var/mob/living/D = load
to_chat(D, "You hit [M]!")
diff --git a/code/modules/weather/weather_fsm_states.dm b/code/modules/weather/weather_fsm_states.dm
index c77d983c05d2..7e1cea5c4403 100644
--- a/code/modules/weather/weather_fsm_states.dm
+++ b/code/modules/weather/weather_fsm_states.dm
@@ -181,7 +181,7 @@
/decl/state/weather/rain/hail/handle_exposure_effects(var/mob/living/M, var/obj/abstract/weather_system/weather)
to_chat(M, SPAN_DANGER("You are pelted by a shower of hail!"))
- M.adjustBruteLoss(rand(1,3))
+ M.take_damage(rand(1,3), BRUTE)
/decl/state/weather/ash
name = "Ash"
diff --git a/code/modules/xenoarcheaology/artifacts/effects/heal.dm b/code/modules/xenoarcheaology/artifacts/effects/heal.dm
index 57de01f9ec82..20adb444bb19 100644
--- a/code/modules/xenoarcheaology/artifacts/effects/heal.dm
+++ b/code/modules/xenoarcheaology/artifacts/effects/heal.dm
@@ -26,10 +26,13 @@
if(prob(msg_prob))
to_chat(C, "A wave of energy invigorates you.")
var/force = amount * weakness
- C.apply_damages(-force, -force, -force, -force)
- C.adjustBrainLoss(-force)
+ C.heal_damage(force, BRUTE)
+ C.heal_damage(force, BURN)
+ C.heal_damage(force, PAIN)
+ C.heal_damage(force, OXY)
+ C.adjust_brain_damage(-force)
if(strong)
- C.apply_radiation(-25 * weakness)
+ C.heal_damage(25 * weakness, IRRADIATE)
C.bodytemperature = C.species?.body_temperature || initial(C.bodytemperature)
C.adjust_nutrition(50 * weakness)
if(ishuman(C))
diff --git a/code/modules/xenoarcheaology/artifacts/effects/hurt.dm b/code/modules/xenoarcheaology/artifacts/effects/hurt.dm
index 6108ff2be6e6..f97fa3451b39 100644
--- a/code/modules/xenoarcheaology/artifacts/effects/hurt.dm
+++ b/code/modules/xenoarcheaology/artifacts/effects/hurt.dm
@@ -24,10 +24,13 @@
if(prob(msg_prob))
to_chat(C, SPAN_DANGER("A wave of painful energy strikes you!"))
var/force = amount * weakness
- C.apply_damages(force, force, force, force)
- C.adjustBrainLoss(0.1 * weakness)
+ C.take_damage(force, BRUTE)
+ C.take_damage(force, BURN)
+ C.take_damage(force, TOX)
+ C.take_damage(force, OXY)
+ C.adjust_brain_damage(0.1 * weakness)
if(strong)
- C.apply_radiation(25 * weakness)
+ C.take_damage(25 * weakness, IRRADIATE)
C.set_nutrition(min(50 * weakness, C.nutrition))
SET_STATUS_MAX(C, STAT_DIZZY, 6 * weakness)
SET_STATUS_MAX(C, STAT_WEAK, 6 * weakness)
\ No newline at end of file
diff --git a/code/modules/xenoarcheaology/artifacts/effects/radiate.dm b/code/modules/xenoarcheaology/artifacts/effects/radiate.dm
index 591dd8c3a81a..bedc3abd273e 100644
--- a/code/modules/xenoarcheaology/artifacts/effects/radiate.dm
+++ b/code/modules/xenoarcheaology/artifacts/effects/radiate.dm
@@ -9,7 +9,7 @@
/datum/artifact_effect/radiate/DoEffectTouch(var/mob/living/user)
if(istype(user))
- user.apply_radiation(radiation_strength * 2)
+ user.take_damage(radiation_strength * 2, IRRADIATE)
return 1
/datum/artifact_effect/radiate/DoEffectAura()
diff --git a/code/modules/xenoarcheaology/artifacts/effects/roboheal.dm b/code/modules/xenoarcheaology/artifacts/effects/roboheal.dm
index 3b9b2668484f..cb68db3103f2 100644
--- a/code/modules/xenoarcheaology/artifacts/effects/roboheal.dm
+++ b/code/modules/xenoarcheaology/artifacts/effects/roboheal.dm
@@ -10,7 +10,8 @@
if(isrobot(user))
var/mob/living/silicon/robot/R = user
to_chat(R, "Your systems report damaged components mending by themselves!")
- R.heal_overall_damage(rand(10,30), rand(10,30))
+ R.heal_damage(rand(10,30), BRUTE)
+ R.heal_damage(rand(10,30), BURN)
return 1
/datum/artifact_effect/roboheal/DoEffectAura()
@@ -20,7 +21,8 @@
if(world.time - last_message > 200)
to_chat(M, "SYSTEM ALERT: Beneficial energy field detected!")
last_message = world.time
- M.heal_overall_damage(1, 1)
+ M.heal_damage(1, BRUTE)
+ M.heal_damage(1, BURN)
return 1
/datum/artifact_effect/roboheal/DoEffectPulse()
@@ -30,5 +32,6 @@
if(world.time - last_message > 200)
to_chat(M, "SYSTEM ALERT: Structural damage has been repaired by energy pulse!")
last_message = world.time
- M.heal_overall_damage(10, 10)
+ M.heal_damage(10, BRUTE)
+ M.heal_damage(10, BURN)
return 1
diff --git a/code/modules/xenoarcheaology/artifacts/effects/robohurt.dm b/code/modules/xenoarcheaology/artifacts/effects/robohurt.dm
index 0a83ddf57de3..8fdab16bc962 100644
--- a/code/modules/xenoarcheaology/artifacts/effects/robohurt.dm
+++ b/code/modules/xenoarcheaology/artifacts/effects/robohurt.dm
@@ -10,7 +10,8 @@
if(isrobot(user))
var/mob/living/silicon/robot/R = user
to_chat(R, "Your systems report severe damage has been inflicted!")
- R.take_overall_damage(rand(10,50), rand(10,50))
+ R.take_damage(rand(10,50), BRUTE)
+ R.take_damage(rand(10,50), BURN)
return 1
/datum/artifact_effect/robohurt/DoEffectAura()
@@ -20,7 +21,8 @@
if(world.time - last_message > 200)
to_chat(M, "SYSTEM ALERT: Harmful energy field detected!")
last_message = world.time
- M.take_overall_damage(1,1)
+ M.take_damage(1, BRUTE)
+ M.take_damage(1, BURN)
return 1
/datum/artifact_effect/robohurt/DoEffectPulse()
@@ -30,5 +32,6 @@
if(world.time - last_message > 200)
to_chat(M, "SYSTEM ALERT: Structural damage inflicted by energy pulse!")
last_message = world.time
- M.take_overall_damage(10,10)
+ M.take_damage(10, BRUTE)
+ M.take_damage(10, BURN)
return 1
diff --git a/code/modules/xenoarcheaology/artifacts/triggers/energy.dm b/code/modules/xenoarcheaology/artifacts/triggers/energy.dm
index 55d54bed13b2..81a74288f4e5 100644
--- a/code/modules/xenoarcheaology/artifacts/triggers/energy.dm
+++ b/code/modules/xenoarcheaology/artifacts/triggers/energy.dm
@@ -12,7 +12,7 @@
var/obj/item/projectile/P = O
. = (P.damage_type == BURN) || (P.damage_type == ELECTROCUTE)
if(istype(O,/obj/item/baton))
- var/obj/item/baton/B = O
+ var/obj/item/baton/B = O
. = B.status
else if (istype(O,/obj/item/energy_blade))
var/obj/item/energy_blade/E = O
diff --git a/code/modules/xenoarcheaology/finds/find_types/statuette.dm b/code/modules/xenoarcheaology/finds/find_types/statuette.dm
index beb93d05fa37..f5550dd06712 100644
--- a/code/modules/xenoarcheaology/finds/find_types/statuette.dm
+++ b/code/modules/xenoarcheaology/finds/find_types/statuette.dm
@@ -107,7 +107,7 @@
nearby_mobs.Add(M)
var/obj/item/organ/external/target = pick(M.get_external_organs())
- M.apply_damage(rand(5, 10), BRUTE, target.organ_tag)
+ M.take_damage(rand(5, 10), BRUTE, target.organ_tag)
to_chat(M, "The skin on your [parse_zone(target.organ_tag)] feels like it's ripping apart, and a stream of blood flies out.")
var/obj/effect/decal/cleanable/blood/splatter/animated/B = new(M.loc)
B.target_turf = pick(range(1, src))
diff --git a/code/unit_tests/mob_tests.dm b/code/unit_tests/mob_tests.dm
index 4c34523b3eca..34fadfcbf90c 100644
--- a/code/unit_tests/mob_tests.dm
+++ b/code/unit_tests/mob_tests.dm
@@ -31,7 +31,7 @@
var/obj/item/organ/internal/lungs/L = test_subject.get_organ(test_subject.get_bodytype().breathing_organ, /obj/item/organ/internal/lungs)
if(L)
L.last_successful_breath = -INFINITY
- test_subjects["[bodytype.type]"] = list(test_subject, damage_check(test_subject, OXY))
+ test_subjects["[bodytype.type]"] = list(test_subject, test_subject.get_damage(OXY))
return 1
/datum/unit_test/human_breath/check_result()
@@ -43,7 +43,7 @@
var/failcount = 0
for(var/i in test_subjects)
var/mob/living/carbon/human/test_subject = test_subjects[i][1]
- var/ending_oxyloss = damage_check(test_subject, OXY)
+ var/ending_oxyloss = test_subject.get_damage(OXY)
var/starting_oxyloss = test_subjects[i][2]
if(starting_oxyloss >= ending_oxyloss)
failcount++
@@ -87,32 +87,6 @@ var/global/default_mobloc = null
return test_result
-//Generic Check
-// TODO: Need to make sure I didn't just recreate the wheel here.
-
-/proc/damage_check(var/mob/living/M, var/damage_type)
- var/loss = null
-
- switch(damage_type)
- if(BRUTE)
- loss = M.getBruteLoss()
- if(BURN)
- loss = M.getFireLoss()
- if(TOX)
- loss = M.getToxLoss()
- if(OXY)
- loss = M.getOxyLoss()
- if(CLONE)
- loss = M.getCloneLoss()
- if(PAIN)
- loss = M.getHalLoss()
-
- if(!loss && ishuman(M))
- var/mob/living/carbon/human/H = M // Synthetics have robot limbs which don't report damage to getXXXLoss()
- if(H.isSynthetic()) // So we have to hard code this check or create a different one for them.
- return H.species.total_health - H.current_health
- return loss
-
// ==============================================================================================================
//
@@ -171,9 +145,9 @@ var/global/default_mobloc = null
if(L)
L.last_successful_breath = -INFINITY
- H.apply_damage(damage_amount, damagetype, damage_location)
+ H.take_damage(damage_amount, damagetype, damage_location)
- var/ending_damage = damage_check(H, damagetype)
+ var/ending_damage = H.get_damage(damagetype)
var/ending_health = H.current_health
qdel(H)
diff --git a/maps/away/bearcat/bearcat.dm b/maps/away/bearcat/bearcat.dm
index ddfb275ee086..15470e5d54a1 100644
--- a/maps/away/bearcat/bearcat.dm
+++ b/maps/away/bearcat/bearcat.dm
@@ -118,8 +118,8 @@
var/decl/hierarchy/outfit/outfit = outfit_by_type(/decl/hierarchy/outfit/deadcap)
outfit.equip_outfit(corpse)
var/corpse_health = corpse.get_max_health()
- corpse.adjustOxyLoss(corpse_health)
- corpse.setBrainLoss(corpse_health)
+ corpse.take_damage(corpse_health, OXY)
+ corpse.set_brain_damage(corpse_health)
corpse.death(FALSE, deathmessage = "no message", show_dead_message = FALSE)
var/obj/structure/bed/chair/C = locate() in T
if(C)
diff --git a/maps/away/errant_pisces/errant_pisces.dm b/maps/away/errant_pisces/errant_pisces.dm
index 9371428eada8..00c51f216359 100644
--- a/maps/away/errant_pisces/errant_pisces.dm
+++ b/maps/away/errant_pisces/errant_pisces.dm
@@ -116,7 +116,7 @@
if (!do_after(user, 20, src))
visible_message("[user] stops cutting through \the [src] with \the [W]!")
return
- take_damage(20 * (1 + (SH.force-10)/10)) //the sharper the faster, every point of force above 10 adds 10 % to damage
+ take_damage(20 * (1 + (SH.force-10)/10), BRUTE) //the sharper the faster, every point of force above 10 adds 10 % to damage
new /obj/item/stack/net(src.loc)
qdel(src)
return TRUE
@@ -132,8 +132,8 @@
. = PROJECTILE_CONTINUE //few cloth ribbons won't stop bullet or energy ray
if(P.damage_type != BURN)//beams, lasers, fire. Bullets won't make a lot of damage to the few hanging belts.
return
- visible_message("\The [P] hits \the [src] and tears it!")
- take_damage(P.damage)
+ visible_message(SPAN_DANGER("\The [P] hits \the [src] and tears it!"))
+ take_damage(P.damage, P.damage_type, damage_flags = P.damage_flags)
/obj/structure/net/update_connections()//maybe this should also be called when any of the walls nearby is removed but no idea how I can make it happen
overlays.Cut()
diff --git a/maps/random_ruins/exoplanet_ruins/hydrobase/hydrobase.dm b/maps/random_ruins/exoplanet_ruins/hydrobase/hydrobase.dm
index 453e7fb4ffb9..49e2a2c291bf 100644
--- a/maps/random_ruins/exoplanet_ruins/hydrobase/hydrobase.dm
+++ b/maps/random_ruins/exoplanet_ruins/hydrobase/hydrobase.dm
@@ -107,7 +107,7 @@
projectiletype = /obj/item/projectile/beam/drone/weak
/mob/living/simple_animal/hostile/retaliate/malf_drone/hydro/emp_act(severity)
- adjustFireLoss(rand(5,10) * (severity + 1))
+ take_damage(rand(5,10) * (severity + 1), BURN)
disabled = rand(15, 30)
malfunctioning = 1
hostile_drone = 1
diff --git a/mods/content/psionics/_defines.dm b/mods/content/psionics/_defines.dm
index a7be273fe9d0..227383dab682 100644
--- a/mods/content/psionics/_defines.dm
+++ b/mods/content/psionics/_defines.dm
@@ -16,7 +16,7 @@
#define PSI_RANK_GRANDMASTER 4
#define PSI_RANK_PARAMOUNT 5
-#define PSIONIC "psi"
+#define DAM_PSIONIC "psi"
#define MAT_NULLGLASS /decl/material/nullglass
#define COLOR_NULLGLASS "#ff6088"
diff --git a/mods/content/psionics/datum/armour.dm b/mods/content/psionics/datum/armour.dm
index 405cb965b49c..801fcb2a3182 100644
--- a/mods/content/psionics/datum/armour.dm
+++ b/mods/content/psionics/datum/armour.dm
@@ -1,5 +1,8 @@
-/datum/controller/subsystem/materials/get_armor_key(damage_type, damage_flags)
- . = (damage_type == PSIONIC) ? PSIONIC : ..()
+/decl/damage_handler/psionic
+ name = "psionic"
+
+/decl/damage_handler/psionic/get_armor_key()
+ return DAM_PSIONIC
/datum/extension/armor/psionic
expected_type = /datum/psi_complexus
diff --git a/mods/content/psionics/system/psionics/complexus/complexus_helpers.dm b/mods/content/psionics/system/psionics/complexus/complexus_helpers.dm
index a1535398446e..f97d37967f2b 100644
--- a/mods/content/psionics/system/psionics/complexus/complexus_helpers.dm
+++ b/mods/content/psionics/system/psionics/complexus/complexus_helpers.dm
@@ -85,12 +85,12 @@
if(prob(value*10)) owner.emote("scream")
// Your head asplode.
- owner.adjustBrainLoss(value)
+ owner.adjust_brain_damage(value)
if(ishuman(owner))
var/mob/living/carbon/human/pop = owner
if(pop.should_have_organ(BP_BRAIN))
var/obj/item/organ/internal/sponge = GET_INTERNAL_ORGAN(pop, BP_BRAIN)
- if(sponge && sponge.damage >= sponge.max_damage)
+ if(sponge && sponge.organ_damage >= sponge.max_damage)
var/obj/item/organ/external/affecting = GET_EXTERNAL_ORGAN(pop, sponge.parent_organ)
if(affecting)
affecting.dismember(0, DISMEMBER_METHOD_BLUNT)
diff --git a/mods/content/psionics/system/psionics/complexus/complexus_latency.dm b/mods/content/psionics/system/psionics/complexus/complexus_latency.dm
index 373c22831295..605bf1958088 100644
--- a/mods/content/psionics/system/psionics/complexus/complexus_latency.dm
+++ b/mods/content/psionics/system/psionics/complexus/complexus_latency.dm
@@ -14,5 +14,5 @@
var/decl/psionic_faculty/faculty_decl = SSpsi.get_faculty(faculty)
to_chat(owner, SPAN_DANGER("You scream internally as your [faculty_decl.name] faculty is forced into operancy by [source]!"))
next_latency_trigger = world.time + rand(600, 1800) * new_rank
- if(!redactive) owner.adjustBrainLoss(rand(trigger_strength * 2, trigger_strength * 4))
+ if(!redactive) owner.adjust_brain_damage(rand(trigger_strength * 2, trigger_strength * 4))
return TRUE
diff --git a/mods/content/psionics/system/psionics/complexus/complexus_process.dm b/mods/content/psionics/system/psionics/complexus/complexus_process.dm
index 94af375a2923..765b1af8031a 100644
--- a/mods/content/psionics/system/psionics/complexus/complexus_process.dm
+++ b/mods/content/psionics/system/psionics/complexus/complexus_process.dm
@@ -192,8 +192,8 @@
if(I.organ_tag == BP_BRAIN)
continue
- if(I.damage > 0 && spend_power(heal_rate))
- I.damage = max(I.damage - heal_rate, 0)
+ if(I.organ_damage > 0 && spend_power(heal_rate))
+ I.organ_damage = max(I.organ_damage - heal_rate, 0)
if(prob(25))
to_chat(H, SPAN_NOTICE("Your innards itch as your autoredactive faculty mends your [I.name]."))
return
@@ -226,23 +226,22 @@
// Heal radiation, cloneloss and poisoning.
if(heal_poison)
-
- if(owner.radiation && spend_power(heal_rate))
+ if(owner.get_damage(IRRADIATE) && spend_power(heal_rate))
if(prob(25))
to_chat(owner, SPAN_NOTICE("Your autoredactive faculty repairs some of the radiation damage to your body."))
- owner.radiation = max(0, owner.radiation - heal_rate)
+ owner.heal_damage(heal_rate, IRRADIATE)
return
- if(owner.getCloneLoss() && spend_power(heal_rate))
+ if(owner.get_damage(CLONE) && spend_power(heal_rate))
if(prob(25))
to_chat(owner, SPAN_NOTICE("Your autoredactive faculty stitches together some of your mangled DNA."))
- owner.adjustCloneLoss(-heal_rate)
+ owner.heal_damage(heal_rate, CLONE)
return
// Heal everything left.
- if(heal_general && prob(mend_prob) && (owner.getBruteLoss() || owner.getFireLoss() || owner.getOxyLoss()) && spend_power(heal_rate))
- owner.adjustBruteLoss(-(heal_rate), do_update_health = FALSE)
- owner.adjustFireLoss(-(heal_rate), do_update_health = FALSE)
- owner.adjustOxyLoss(-(heal_rate))
+ if(heal_general && prob(mend_prob) && (owner.get_damage(BRUTE) || owner.get_damage(BURN) || owner.get_damage(OXY)) && spend_power(heal_rate))
+ owner.heal_damage(heal_rate, BRUTE, skip_update_health = TRUE)
+ owner.heal_damage(heal_rate, BURN, skip_update_health = TRUE)
+ owner.heal_damage(heal_rate, OXY)
if(prob(25))
to_chat(owner, SPAN_NOTICE("Your skin crawls as your autoredactive faculty heals your body."))
diff --git a/mods/content/psionics/system/psionics/events/mini_spasm.dm b/mods/content/psionics/system/psionics/events/mini_spasm.dm
index 9473db7d4c45..deaa35d6881a 100644
--- a/mods/content/psionics/system/psionics/events/mini_spasm.dm
+++ b/mods/content/psionics/system/psionics/events/mini_spasm.dm
@@ -53,7 +53,7 @@
var/list/faculties = list(PSI_COERCION, PSI_REDACTION, PSI_ENERGISTICS, PSI_PSYCHOKINESIS)
for(var/i = 1 to new_latencies)
to_chat(victim, SPAN_DANGER("[pick(psi_operancy_messages)]"))
- victim.adjustBrainLoss(rand(10,20))
+ victim.adjust_brain_damage(rand(10,20))
victim.set_psi_rank(pick_n_take(faculties), 1)
sleep(30)
victim.psi.update()
diff --git a/mods/content/psionics/system/psionics/events/psi_balm.dm b/mods/content/psionics/system/psionics/events/psi_balm.dm
index 39032bb97ff2..0b153e3d6fed 100644
--- a/mods/content/psionics/system/psionics/events/psi_balm.dm
+++ b/mods/content/psionics/system/psionics/events/psi_balm.dm
@@ -13,8 +13,8 @@
else if(psi.stamina < psi.max_stamina)
psi.stamina = min(psi.max_stamina, psi.stamina + rand(1,3))
soothed = TRUE
- else if(psi.owner.getBrainLoss() > 0)
- psi.owner.adjustBrainLoss(-1)
+ else if(psi.owner.get_brain_damage() > 0)
+ psi.owner.adjust_brain_damage(-1)
soothed = TRUE
if(soothed && prob(10))
to_chat(psi.owner, SPAN_NOTICE("[pick(balm_messages)]"))
diff --git a/mods/content/psionics/system/psionics/faculties/coercion.dm b/mods/content/psionics/system/psionics/faculties/coercion.dm
index defb0df4012c..c6e9117d2d67 100644
--- a/mods/content/psionics/system/psionics/faculties/coercion.dm
+++ b/mods/content/psionics/system/psionics/faculties/coercion.dm
@@ -2,7 +2,7 @@
id = PSI_COERCION
name = "Coercion"
associated_intent = I_DISARM
- armour_types = list(PSIONIC)
+ armour_types = list(DAM_PSIONIC)
/decl/psionic_power/coercion
faculty = PSI_COERCION
@@ -37,7 +37,7 @@
for(var/mob/living/M in orange(user, user.psi.get_rank(PSI_COERCION)))
if(M == user)
continue
- var/blocked = 100 * M.get_blocked_ratio(null, PSIONIC)
+ var/blocked = 100 * M.get_blocked_ratio(null, DAM_PSIONIC)
if(prob(blocked))
to_chat(M, SPAN_DANGER("A psionic onslaught strikes your mind, but you withstand it!"))
continue
@@ -187,7 +187,7 @@
to_chat(user, SPAN_WARNING("\The [target] resists your glamour, writhing in your grip. You hurriedly release them before too much damage is done, but the psyche is left tattered. They should have no memory of this encounter, at least."))
to_chat(target, SPAN_DANGER("You resist \the [user], struggling free of their influence at the cost of your own mind!"))
to_chat(target, SPAN_DANGER("You fall into darkness, losing all memory of the encounter..."))
- target.adjustBrainLoss(rand(25,40))
+ target.adjust_brain_damage(rand(25,40))
SET_STATUS_MAX(target, STAT_PARA, 10 SECONDS)
return TRUE
diff --git a/mods/content/psionics/system/psionics/faculties/redaction.dm b/mods/content/psionics/system/psionics/faculties/redaction.dm
index 2fb94d154426..6eb7ee694a45 100644
--- a/mods/content/psionics/system/psionics/faculties/redaction.dm
+++ b/mods/content/psionics/system/psionics/faculties/redaction.dm
@@ -111,10 +111,10 @@
if(redaction_rank >= PSI_RANK_GRANDMASTER)
for(var/obj/item/organ/internal/I in E.internal_organs)
- if(!BP_IS_PROSTHETIC(I) && !BP_IS_CRYSTAL(I) && I.damage > 0 && I.organ_tag != BP_BRAIN)
+ if(!BP_IS_PROSTHETIC(I) && !BP_IS_CRYSTAL(I) && I.organ_damage > 0 && I.organ_tag != BP_BRAIN)
to_chat(user, SPAN_NOTICE("You encourage the damaged tissue of \the [I] to repair itself."))
var/heal_rate = redaction_rank
- I.damage = max(0, I.damage - rand(heal_rate,heal_rate*2))
+ I.organ_damage = max(0, I.organ_damage - rand(heal_rate,heal_rate*2))
return TRUE
to_chat(user, SPAN_NOTICE("You can find nothing within \the [target]'s [E.name] to mend."))
@@ -135,19 +135,13 @@
if(.)
// No messages, as Mend procs them even if it fails to heal anything, and Cleanse is always checked after Mend.
var/removing = rand(20,25)
- if(target.radiation)
+ if(target.get_damage(IRRADIATE))
to_chat(user, SPAN_NOTICE("You repair some of the radiation-damaged tissue within \the [target]..."))
- if(target.radiation > removing)
- target.radiation -= removing
- else
- target.radiation = 0
+ target.heal_damage(removing, IRRADIATE)
return TRUE
- if(target.getCloneLoss())
+ if(target.get_damage(CLONE))
to_chat(user, SPAN_NOTICE("You stitch together some of the mangled DNA within \the [target]..."))
- if(target.getCloneLoss() >= removing)
- target.adjustCloneLoss(-removing)
- else
- target.adjustCloneLoss(-(target.getCloneLoss()))
+ target.heal_damage(removing, CLONE)
return TRUE
to_chat(user, SPAN_NOTICE("You can find no genetic damage or radiation to heal within \the [target]."))
return TRUE
@@ -186,6 +180,6 @@
break
to_chat(target, SPAN_NOTICE("Life floods back into your body!"))
target.visible_message(SPAN_NOTICE("\The [target] shudders violently!"))
- target.adjustOxyLoss(-rand(15,20))
+ target.heal_damage(rand(15,20), OXY)
target.basic_revival()
return TRUE
diff --git a/mods/content/psionics/system/psionics/mob/mob.dm b/mods/content/psionics/system/psionics/mob/mob.dm
index da28c017a30c..c5a63fa4d60f 100644
--- a/mods/content/psionics/system/psionics/mob/mob.dm
+++ b/mods/content/psionics/system/psionics/mob/mob.dm
@@ -23,7 +23,7 @@
psi.set_rank(faculty, rank, defer_update, temporary)
/mob/living/proc/deflect_psionic_attack(var/attacker)
- var/blocked = 100 * get_blocked_ratio(null, PSIONIC)
+ var/blocked = 100 * get_blocked_ratio(null, DAM_PSIONIC)
if(prob(blocked))
if(attacker)
to_chat(attacker, SPAN_WARNING("Your mental attack is deflected by \the [src]'s defenses!"))
@@ -33,7 +33,8 @@
/mob/living/carbon/human/check_shields(var/damage = 0, var/atom/damage_source = null, var/mob/attacker = null, var/def_zone = null, var/attack_text = "the attack")
var/obj/item/projectile/P = damage_source
- if(istype(P) && !P.disrupts_psionics() && psi && P.starting && prob(psi.get_armour(SSmaterials.get_armor_key(P.damage_type, P.damage_flags())) * 0.5) && psi.spend_power(round(damage/10)))
+ var/decl/damage_handler/psi_damage = GET_DECL(/decl/damage_handler/psionic)
+ if(istype(P) && !P.disrupts_psionics() && psi && P.starting && prob(psi.get_armour(psi_damage.get_armor_key(P.damage_flags())) * 0.5) && psi.spend_power(round(damage/10)))
visible_message("\The [src] deflects [attack_text]!")
P.redirect(P.starting.x + rand(-2,2), P.starting.y + rand(-2,2), get_turf(src), src)
return PROJECTILE_FORCE_MISS
diff --git a/mods/content/psionics/system/psionics/null/turf_wall.dm b/mods/content/psionics/system/psionics/null/turf_wall.dm
index f93df06c2c8a..02c6eda1b709 100644
--- a/mods/content/psionics/system/psionics/null/turf_wall.dm
+++ b/mods/content/psionics/system/psionics/null/turf_wall.dm
@@ -6,8 +6,8 @@
if(. > 0 && disrupts_psionics())
var/cap = material.integrity
if(reinf_material) cap += reinf_material.integrity
- var/stress_total = damage + .
- take_damage(.)
+ var/stress_total = wall_damage + .
+ take_damage(., /decl/damage_handler/psionic)
. = max(0, -(cap-stress_total))
/turf/simulated/wall/nullglass
diff --git a/mods/content/xenobiology/_xenobiology.dme b/mods/content/xenobiology/_xenobiology.dme
index 144a87c31422..b141010fa836 100644
--- a/mods/content/xenobiology/_xenobiology.dme
+++ b/mods/content/xenobiology/_xenobiology.dme
@@ -48,6 +48,7 @@
#include "slime/slime_codex.dm"
#include "slime/slime_commands.dm"
#include "slime/slime_comments.dm"
+#include "slime/slime_damage_handlers.dm"
#include "slime/slime_follow.dm"
#include "slime/slime_hud.dm"
#include "slime/slime_reagents.dm"
diff --git a/mods/content/xenobiology/mobs/slime_feeding_helpers.dm b/mods/content/xenobiology/mobs/slime_feeding_helpers.dm
index c335ffdc7ed7..3e1f33e5a8ea 100644
--- a/mods/content/xenobiology/mobs/slime_feeding_helpers.dm
+++ b/mods/content/xenobiology/mobs/slime_feeding_helpers.dm
@@ -70,12 +70,12 @@ var/global/list/slime_pain_messages = list(
// The return value is the nutrition provided to the slime.
/mob/living/proc/slime_feed_act(var/mob/living/slime/attacker)
var/protection = (1 - get_blocked_ratio(null, TOX, damage_flags = DAM_DISPERSED | DAM_BIO))
- adjustCloneLoss((attacker.is_adult ? 10 : 5) * protection)
- adjustToxLoss(1 * protection)
+ take_damage((attacker.is_adult ? 10 : 5) * protection, CLONE)
+ take_damage(1 * protection, TOX)
if(current_health <= 0)
- adjustToxLoss(1 * protection)
+ take_damage(1 * protection, TOX)
if(prob(15) && client)
handle_additional_slime_effects()
. = 15 * protection
- if(stat == DEAD || getCloneLoss() >= get_max_health())
+ if(stat == DEAD || get_damage(CLONE) >= get_max_health())
eaten_by_slime()
diff --git a/mods/content/xenobiology/slime/_slime.dm b/mods/content/xenobiology/slime/_slime.dm
index 47c66c23309c..24604839dd4a 100644
--- a/mods/content/xenobiology/slime/_slime.dm
+++ b/mods/content/xenobiology/slime/_slime.dm
@@ -47,20 +47,9 @@
AM.dropInto(loc)
. = ..()
-/mob/living/slime/getToxLoss()
- return toxloss
-
/mob/living/slime/get_digestion_product()
return /decl/material/liquid/slimejelly
-/mob/living/slime/adjustToxLoss(var/amount, var/do_update_health = TRUE)
- toxloss = clamp(toxloss + amount, 0, get_max_health())
- if(do_update_health)
- update_health()
-
-/mob/living/slime/setToxLoss(var/amount)
- adjustToxLoss(amount-getToxLoss())
-
/mob/living/slime/Initialize(mapload, var/_stype = /decl/slime_colour/grey)
. = ..(mapload)
@@ -164,9 +153,6 @@
stat(null,"Power Level: [powerlevel]")
-/mob/living/slime/adjustFireLoss(amount, do_update_health = TRUE)
- ..(-abs(amount), do_update_health) // Heals them
-
/mob/living/slime/bullet_act(var/obj/item/projectile/Proj)
var/datum/ai/slime/slime_ai = ai
if(istype(slime_ai))
@@ -266,7 +252,7 @@
return TRUE
playsound(loc, "punch", 25, 1, -1)
visible_message(SPAN_DANGER("\The [user] has punched \the [src]!"))
- adjustBruteLoss(damage)
+ take_damage(damage, BRUTE)
return TRUE
return ..()
@@ -309,7 +295,7 @@
powerlevel++
if(powerlevel > 10)
powerlevel = 10
- adjustToxLoss(-10)
+ heal_damage(10, TOX)
/mob/living/slime/proc/get_hunger_state()
. = 0
diff --git a/mods/content/xenobiology/slime/examine.dm b/mods/content/xenobiology/slime/examine.dm
index cd2c90807fba..e3952ec19cf2 100644
--- a/mods/content/xenobiology/slime/examine.dm
+++ b/mods/content/xenobiology/slime/examine.dm
@@ -4,9 +4,9 @@
if(stat == DEAD)
msg += "It is limp and unresponsive."
else
- if(src.getBruteLoss() >= 40)
+ if(get_damage(BRUTE) >= 40)
msg += SPAN_DANGER("It has severe punctures and tears in its flesh!")
- else if(src.getBruteLoss())
+ else if(get_damage(BRUTE))
msg += SPAN_WARNING("It has some punctures in its flesh!")
switch(powerlevel)
if(2 to 3) msg += SPAN_WARNING("It is flickering gently with a little electrical activity.")
diff --git a/mods/content/xenobiology/slime/feeding.dm b/mods/content/xenobiology/slime/feeding.dm
index 5fb8c6d1cdb1..0da24f8670d3 100644
--- a/mods/content/xenobiology/slime/feeding.dm
+++ b/mods/content/xenobiology/slime/feeding.dm
@@ -31,7 +31,7 @@
if(!silent)
to_chat(src, SPAN_WARNING("\The [src] is dead."))
return FEED_RESULT_DEAD
- if(M.getCloneLoss() >= M.get_max_health() * 1.5)
+ if(M.get_damage(CLONE) >= M.get_max_health() * 1.5)
if(!silent)
to_chat(src, SPAN_WARNING("\The [M] is too degraded to feed upon."))
return FEED_RESULT_DEAD
@@ -102,9 +102,9 @@
gain_nutrition(drained)
var/heal_amt = FLOOR(drained*0.5)
if(heal_amt > 0)
- adjustOxyLoss(-heal_amt, do_update_health = FALSE)
- adjustBruteLoss(-heal_amt, do_update_health = FALSE)
- adjustCloneLoss(-heal_amt)
+ heal_damage(heal_amt, OXY, skip_update_health = TRUE)
+ heal_damage(heal_amt, BRUTE, skip_update_health = TRUE)
+ heal_damage(heal_amt, CLONE)
if(ate_victim && feed_mob)
if(feed_mob.last_handled_by_mob)
diff --git a/mods/content/xenobiology/slime/life.dm b/mods/content/xenobiology/slime/life.dm
index 86af051b3e85..c4af0d4e4e26 100644
--- a/mods/content/xenobiology/slime/life.dm
+++ b/mods/content/xenobiology/slime/life.dm
@@ -8,9 +8,9 @@
change = -(change)
bodytemperature += (min(environment.temperature, bodytemperature + change) - bodytemperature)
if(bodytemperature <= die_temperature)
- adjustToxLoss(200)
+ take_damage(200, TOX)
else if(bodytemperature <= hurt_temperature)
- adjustToxLoss(30)
+ take_damage(30, TOX)
// If we're standing on top of a dead mob or small items, we can
// ingest it (or just melt it a little if we're too small)
@@ -76,11 +76,11 @@
. = ..()
set_stat(CONSCIOUS)
if(prob(30))
- adjustOxyLoss(-1, do_update_health = FALSE)
- adjustToxLoss(-1, do_update_health = FALSE)
- adjustFireLoss(-1, do_update_health = FALSE)
- adjustCloneLoss(-1, do_update_health = FALSE)
- adjustBruteLoss(-1)
+ heal_damage(1, OXY, skip_update_health = TRUE)
+ heal_damage(1, TOX, skip_update_health = TRUE)
+ heal_damage(1, BURN, skip_update_health = TRUE)
+ heal_damage(1, CLONE, skip_update_health = TRUE)
+ heal_damage(1, BRUTE)
/mob/living/slime/handle_nutrition_and_hydration()
. = ..()
@@ -124,7 +124,7 @@
// Update starvation and nutrition.
if(nutrition <= 0)
- adjustToxLoss(2)
+ take_damage(2, TOX)
if (client && prob(5))
to_chat(src, SPAN_DANGER("You are starving!"))
else if(nutrition >= get_grow_nutrition() && amount_grown < SLIME_EVOLUTION_THRESHOLD)
diff --git a/mods/content/xenobiology/slime/slime_comments.dm b/mods/content/xenobiology/slime/slime_comments.dm
index 04edbe8942fc..8ebfe5af3878 100644
--- a/mods/content/xenobiology/slime/slime_comments.dm
+++ b/mods/content/xenobiology/slime/slime_comments.dm
@@ -9,11 +9,11 @@
. += "Bored..."
if(holder.attacked)
. += "Grrr..."
- if(holder.body.getToxLoss() > 30)
+ if(holder.body.get_damage(TOX) > 30)
. += "Cold..."
- if(holder.body.getToxLoss() > 60)
+ if(holder.body.get_damage(TOX) > 60)
. += list("So... cold...", "Very... cold...")
- if(holder.body.getToxLoss() > 90)
+ if(holder.body.get_damage(TOX) > 90)
. += "C... c..."
if(holder.slime.feeding_on)
. += list("Nom...", "Tasty...")
@@ -23,7 +23,7 @@
if(prob(2))
. = list()
var/tension = 10
- if(holder.slime.nutrition < holder.slime.get_hunger_nutrition())
+ if(holder.slime.nutrition < holder.slime.get_hunger_nutrition())
. += list("Hungry...", "Where is the food?", "I want to eat...")
tension += 10
if(holder.slime.nutrition < holder.slime.get_starve_nutrition())
@@ -37,7 +37,7 @@
/decl/slime_comment/zap/get_comment(var/datum/ai/slime/holder)
if(holder.slime.powerlevel > 3)
. = list("Bzzz...")
- if(holder.slime.powerlevel > 5)
+ if(holder.slime.powerlevel > 5)
. += "Zap..."
if(holder.slime.powerlevel > 8)
. += "Zap... Bzz..."
diff --git a/mods/content/xenobiology/slime/slime_damage_handlers.dm b/mods/content/xenobiology/slime/slime_damage_handlers.dm
new file mode 100644
index 000000000000..bbcf0a3232c8
--- /dev/null
+++ b/mods/content/xenobiology/slime/slime_damage_handlers.dm
@@ -0,0 +1,10 @@
+/mob/living/slime/get_handled_damage_types()
+ var/static/list/mob_damage_types = list(
+ BRUTE = /decl/damage_handler/brute,
+ BURN = /decl/damage_handler/burn/slime,
+ TOX = /decl/damage_handler/organ
+ )
+ return mob_damage_types
+
+// TODO work out wtf is meant to happen with slime damage
+/decl/damage_handler/burn/slime
\ No newline at end of file
diff --git a/mods/content/xenobiology/slime/slime_reagents.dm b/mods/content/xenobiology/slime/slime_reagents.dm
index 805de4901303..8e43f6027930 100644
--- a/mods/content/xenobiology/slime/slime_reagents.dm
+++ b/mods/content/xenobiology/slime/slime_reagents.dm
@@ -17,7 +17,7 @@
/decl/material/liquid/water/affect_touch(var/mob/living/M, var/removed, var/datum/reagents/holder)
..()
if(isslime(M))
- M.adjustToxLoss(10 * removed)
+ M.take_damage(10 * removed, TOX)
var/mob/living/slime/S = M
if(istype(S) && istype(S.ai, /datum/ai/slime))
var/datum/ai/slime/slime_ai = S.ai
@@ -36,7 +36,7 @@
/decl/material/liquid/water/affect_blood(var/mob/living/M, var/removed, var/datum/reagents/holder)
..()
if(isslime(M))
- M.adjustToxLoss(2 * removed)
+ M.take_damage(2 * removed, TOX)
/decl/material/liquid/frostoil/affect_blood(var/mob/living/M, var/removed, var/datum/reagents/holder)
..()
diff --git a/mods/mobs/borers/mob/borer/borer.dm b/mods/mobs/borers/mob/borer/borer.dm
index 64dcbde158dc..6c9052b29835 100644
--- a/mods/mobs/borers/mob/borer/borer.dm
+++ b/mods/mobs/borers/mob/borer/borer.dm
@@ -129,8 +129,8 @@
host.release_control()
return
if(prob(5))
- host.adjustBrainLoss(0.1)
- if(prob(host.getBrainLoss()/20))
+ host.adjust_brain_damage(0.1)
+ if(prob(host.get_brain_damage()/20))
INVOKE_ASYNC(host, TYPE_PROC_REF(/mob, say), "*[pick(list("blink","blink_r","choke","aflap","drool","twitch","twitch_v","gasp"))]")
/mob/living/simple_animal/borer/Stat()
diff --git a/mods/mobs/borers/mob/borer/borer_captive.dm b/mods/mobs/borers/mob/borer/borer_captive.dm
index f3fac5146484..e00e42f87bea 100644
--- a/mods/mobs/borers/mob/borer/borer_captive.dm
+++ b/mods/mobs/borers/mob/borer/borer_captive.dm
@@ -45,10 +45,10 @@
to_chat(H, "You begin doggedly resisting the parasite's control (this will take approximately sixty seconds).")
to_chat(B.host, "You feel the captive mind of [src] begin to resist your control.")
- spawn(rand(200,250)+B.host.getBrainLoss())
+ spawn(rand(200,250)+B.host.get_brain_damage())
if(!B || !B.controlling) return
- B.host.adjustBrainLoss(rand(0.1,0.5))
+ B.host.adjust_brain_damage(rand(0.1,0.5))
to_chat(H, "With an immense exertion of will, you regain control of your body!")
to_chat(B.host, "You feel control of the host brain ripped from your grasp, and retract your probosci before the wild neural impulses can damage you.")
B.detach_from_host()
diff --git a/mods/mobs/borers/mob/borer/borer_hud.dm b/mods/mobs/borers/mob/borer/borer_hud.dm
index 301d96256e01..1e2912cb0af6 100644
--- a/mods/mobs/borers/mob/borer/borer_hud.dm
+++ b/mods/mobs/borers/mob/borer/borer_hud.dm
@@ -78,7 +78,7 @@
return
to_chat(worm, SPAN_NOTICE("You begin delicately adjusting your connection to the host brain..."))
- if(!do_after(worm, 100+(worm.host.getBrainLoss()*5) || !worm.host || !worm.can_use_borer_ability()))
+ if(!do_after(worm, 100+(worm.host.get_brain_damage()*5) || !worm.host || !worm.can_use_borer_ability()))
return
to_chat(worm, SPAN_DANGER("You plunge your probosci deep into the cortex of the host brain, interfacing directly with their nervous system."))
diff --git a/mods/mobs/dionaea/mob/nymph_life.dm b/mods/mobs/dionaea/mob/nymph_life.dm
index 4a13f9e580cf..f5ce856e2db9 100644
--- a/mods/mobs/dionaea/mob/nymph_life.dm
+++ b/mods/mobs/dionaea/mob/nymph_life.dm
@@ -12,31 +12,32 @@
var/light_amount = checking.get_lumcount() * 5
- if(radiation <= 20)
+ var/rads = get_damage(IRRADIATE)
+ if(rads <= 20)
if(last_glow)
set_light(0)
last_glow = 0
else
- var/mult = clamp(radiation/200, 0.5, 1)
+ var/mult = clamp(rads/200, 0.5, 1)
if(last_glow != mult)
set_light((5 * mult), mult, "#55ff55")
last_glow = mult
- set_nutrition(clamp(nutrition + FLOOR(radiation/100) + light_amount, 0, 500))
+ set_nutrition(clamp(nutrition + FLOOR(rads/100) + light_amount, 0, 500))
- if(radiation >= 50 || light_amount > 2) //if there's enough light, heal
+ if(rads >= 50 || light_amount > 2) //if there's enough light, heal
var/update_health = FALSE
- if(getBruteLoss())
+ if(get_damage(BRUTE))
update_health = TRUE
- adjustBruteLoss(-1, do_update_health = FALSE)
- if(getFireLoss())
+ heal_damage(1, BRUTE, skip_update_health = TRUE)
+ if(get_damage(BURN))
update_health = TRUE
- adjustFireLoss(-1, do_update_health = FALSE)
- if(getToxLoss())
+ heal_damage(1, BURN, skip_update_health = TRUE)
+ if(get_damage(TOX))
update_health = TRUE
- adjustToxLoss(-1, do_update_health = FALSE)
- if(getOxyLoss())
+ heal_damage(1, TOX, skip_update_health = TRUE)
+ if(get_damage(OXY))
update_health = TRUE
- adjustOxyLoss(-1, do_update_health = FALSE)
+ heal_damage(1, OXY, skip_update_health = TRUE)
if(update_health)
update_health()
\ No newline at end of file
diff --git a/mods/species/ascent/datum/species.dm b/mods/species/ascent/datum/species.dm
index 2f1fac6c318a..3bc3c5fdfb52 100644
--- a/mods/species/ascent/datum/species.dm
+++ b/mods/species/ascent/datum/species.dm
@@ -53,9 +53,12 @@
)
siemens_coefficient = 0.2 // Crystalline body.
- oxy_mod = 0.8 // Don't need as much breathable gas as humans.
- toxins_mod = 0.8 // Not as biologically fragile as meatboys.
- radiation_mod = 0.5 // Not as biologically fragile as meatboys.
+ // Not as biologically fragile as meatboys.
+ damage_modifiers = list(
+ OXY = 0.8,
+ TOX = 0.8,
+ IRRADIATE = 0.5
+ )
age_descriptor = /datum/appearance_descriptor/age/kharmaani
rarity_value = 3
diff --git a/mods/species/ascent/effects/razorweb.dm b/mods/species/ascent/effects/razorweb.dm
index 0908b3f816d6..8c378daf0a69 100644
--- a/mods/species/ascent/effects/razorweb.dm
+++ b/mods/species/ascent/effects/razorweb.dm
@@ -156,7 +156,7 @@
severed = TRUE
if(!severed && !armour_prob)
- L.apply_damage(rand(25, 50), used_weapon = src)
+ L.take_damage(rand(25, 50), used_weapon = src)
visible_message(SPAN_DANGER("The crystalline strands cut deeply into \the [L]!"))
if(prob(break_chance))
diff --git a/mods/species/ascent/items/id_control.dm b/mods/species/ascent/items/id_control.dm
index 6b76ee444d3d..af7f03a6a900 100644
--- a/mods/species/ascent/items/id_control.dm
+++ b/mods/species/ascent/items/id_control.dm
@@ -64,9 +64,9 @@
/obj/item/organ/internal/controller/GetIdCards(list/exceptions)
. = ..()
//Not using is_broken() because it should be able to function when CUT_AWAY is set
- if(id_card && damage < min_broken_damage && !is_type_in_list(id_card, exceptions))
+ if(id_card && organ_damage < min_broken_damage && !is_type_in_list(id_card, exceptions))
LAZYDISTINCTADD(., id_card)
/obj/item/organ/internal/controller/GetAccess()
- if(damage < min_broken_damage)
+ if(organ_damage < min_broken_damage)
return id_card?.GetAccess()
diff --git a/mods/species/bayliens/skrell/datum/species.dm b/mods/species/bayliens/skrell/datum/species.dm
index 9885bf6b98d2..4691c6c1ae21 100644
--- a/mods/species/bayliens/skrell/datum/species.dm
+++ b/mods/species/bayliens/skrell/datum/species.dm
@@ -29,9 +29,12 @@
preview_outfit = /decl/hierarchy/outfit/job/generic/scientist
- burn_mod = 0.9
- oxy_mod = 1.3
- toxins_mod = 0.8
+ damage_modifiers = list(
+ BURN = 0.9,
+ OXY = 1.3,
+ TOX = 0.8
+ )
+
siemens_coefficient = 1.3
warning_low_pressure = WARNING_LOW_PRESSURE * 1.4
hazard_low_pressure = HAZARD_LOW_PRESSURE * 2
diff --git a/mods/species/bayliens/tritonian/datum/species.dm b/mods/species/bayliens/tritonian/datum/species.dm
index a6e415dbce0f..efb9c4625d12 100644
--- a/mods/species/bayliens/tritonian/datum/species.dm
+++ b/mods/species/bayliens/tritonian/datum/species.dm
@@ -8,8 +8,10 @@
/decl/bodytype/human/tritonian/masculine
)
- oxy_mod = 0.5
- toxins_mod = 1.5
+ damage_modifiers = list(
+ OXY = 0.5,
+ TOX = 1.5
+ )
body_temperature = 302
water_soothe_amount = 5
diff --git a/mods/species/bayliens/unathi/datum/species.dm b/mods/species/bayliens/unathi/datum/species.dm
index 664bf3ee73be..418ffd5e3ff0 100644
--- a/mods/species/bayliens/unathi/datum/species.dm
+++ b/mods/species/bayliens/unathi/datum/species.dm
@@ -32,7 +32,9 @@
gluttonous = GLUT_TINY
strength = STR_HIGH
breath_pressure = 18
- brute_mod = 0.8
+ damage_modifiers = list(
+ BRUTE = 0.8
+ )
blood_volume = 800
hunger_factor = DEFAULT_HUNGER_FACTOR * 2
diff --git a/mods/species/serpentid/datum/species.dm b/mods/species/serpentid/datum/species.dm
index 75f206b6f3f1..8b936aff109a 100644
--- a/mods/species/serpentid/datum/species.dm
+++ b/mods/species/serpentid/datum/species.dm
@@ -41,8 +41,11 @@
rarity_value = 4
hud_type = /datum/hud_data/serpentid
total_health = 200
- brute_mod = 0.9
- burn_mod = 1.35
+
+ damage_modifiers = list(
+ BURN = 1.35,
+ BRUTE = 0.9,
+ )
natural_armour_values = list(
ARMOR_MELEE = ARMOR_MELEE_KNIVES,
diff --git a/mods/species/serpentid/mobs/bodyparts_serpentid.dm b/mods/species/serpentid/mobs/bodyparts_serpentid.dm
index 26b976e41ab8..5e30a240fe93 100644
--- a/mods/species/serpentid/mobs/bodyparts_serpentid.dm
+++ b/mods/species/serpentid/mobs/bodyparts_serpentid.dm
@@ -9,10 +9,9 @@
/obj/item/organ/internal/eyes/insectoid/serpentid/additional_flash_effects(var/intensity)
if(!eyes_shielded)
- take_internal_damage(max(0, 4 * (intensity)))
+ take_damage(max(0, 4 * (intensity)), BURN)
return 1
- else
- return -1
+ return -1
/obj/item/organ/internal/eyes/insectoid/serpentid/refresh_action_button()
. = ..()
@@ -70,12 +69,12 @@
var/mob/living/carbon/human/H = owner
var/oxygenated = GET_CHEMICAL_EFFECT(owner, CE_OXYGENATED)
- H.adjustOxyLoss(-(HUMAN_MAX_OXYLOSS * oxygenated))
+ H.heal_damage(HUMAN_MAX_OXYLOSS * oxygenated, OXY)
if(breath_fail_ratio < 0.25 && oxygenated)
H.oxygen_alert = 0
- if(breath_fail_ratio >= 0.25 && (damage || world.time > last_successful_breath + 2 MINUTES))
- H.adjustOxyLoss(HUMAN_MAX_OXYLOSS * breath_fail_ratio)
+ if(breath_fail_ratio >= 0.25 && (organ_damage || world.time > last_successful_breath + 2 MINUTES))
+ H.take_damage(HUMAN_MAX_OXYLOSS * breath_fail_ratio, OXY)
if(oxygenated)
H.oxygen_alert = 1
else
@@ -114,7 +113,7 @@
to_chat(owner, "Your body is barely functioning and is starting to shut down.")
SET_STATUS_MAX(owner, STAT_PARA, 2)
var/obj/item/organ/internal/I = pick(owner.internal_organs)
- I.take_internal_damage(5)
+ I.take_damage(5, TOX)
..()
/obj/item/organ/external/chest/insectoid/serpentid
diff --git a/mods/species/vox/organs_vox.dm b/mods/species/vox/organs_vox.dm
index e664b4284a4b..b06edd4805b9 100644
--- a/mods/species/vox/organs_vox.dm
+++ b/mods/species/vox/organs_vox.dm
@@ -185,7 +185,7 @@
/obj/item/organ/internal/voxstack/emp_act()
return
-/obj/item/organ/internal/voxstack/getToxLoss()
+/obj/item/organ/internal/voxstack/get_toxins_damage()
return 0
/obj/item/organ/internal/voxstack/proc/do_backup()
@@ -222,9 +222,9 @@
/obj/item/organ/internal/voxstack/on_remove_effects(mob/living/last_owner)
var/obj/item/organ/external/head = GET_EXTERNAL_ORGAN(last_owner, parent_organ)
last_owner.visible_message(SPAN_DANGER("\The [src] rips gaping holes in \the [last_owner]'s [head.name] as it is torn loose!"))
- head.take_external_damage(rand(15,20))
+ head.take_damage(rand(15,20), BRUTE)
for(var/obj/item/organ/internal/O in head.contents)
- O.take_internal_damage(rand(30,70))
+ O.take_damage(rand(30,70), BRUTE)
do_backup()
..()
diff --git a/nebula.dme b/nebula.dme
index 1ea46a2d25f8..40b062b53460 100644
--- a/nebula.dme
+++ b/nebula.dme
@@ -388,6 +388,15 @@
#include "code\datums\config\config_types\config_resources.dm"
#include "code\datums\config\config_types\config_server.dm"
#include "code\datums\config\config_types\config_voting.dm"
+#include "code\datums\damage\_damage_type.dm"
+#include "code\datums\damage\damage_brute.dm"
+#include "code\datums\damage\damage_burn.dm"
+#include "code\datums\damage\damage_electrocution.dm"
+#include "code\datums\damage\damage_genetic.dm"
+#include "code\datums\damage\damage_organ.dm"
+#include "code\datums\damage\damage_pain.dm"
+#include "code\datums\damage\damage_radiation.dm"
+#include "code\datums\damage\damage_suffocation.dm"
#include "code\datums\extensions\_defines.dm"
#include "code\datums\extensions\access_provider.dm"
#include "code\datums\extensions\deity_be_near.dm"
@@ -659,6 +668,7 @@
#include "code\datums\wires\vending.dm"
#include "code\datums\wires\wire_description.dm"
#include "code\datums\wires\wires.dm"
+#include "code\game\atom_damage.dm"
#include "code\game\atoms.dm"
#include "code\game\atoms_fluids.dm"
#include "code\game\atoms_init.dm"
@@ -2348,6 +2358,7 @@
#include "code\modules\materials\geology\strata_permafrost.dm"
#include "code\modules\materials\geology\strata_sedimentary.dm"
#include "code\modules\mechs\_mech_setup.dm"
+#include "code\modules\mechs\exosuit_damage_handlers.dm"
#include "code\modules\mechs\mech.dm"
#include "code\modules\mechs\mech_construction.dm"
#include "code\modules\mechs\mech_damage.dm"
@@ -2449,6 +2460,7 @@
#include "code\modules\mob\living\living_attackhand.dm"
#include "code\modules\mob\living\living_bodytemp.dm"
#include "code\modules\mob\living\living_breath.dm"
+#include "code\modules\mob\living\living_damage.dm"
#include "code\modules\mob\living\living_defense.dm"
#include "code\modules\mob\living\living_defines.dm"
#include "code\modules\mob\living\living_dreams.dm"
@@ -2480,7 +2492,6 @@
#include "code\modules\mob\living\carbon\carbon_grabs.dm"
#include "code\modules\mob\living\carbon\carbon_organs.dm"
#include "code\modules\mob\living\carbon\carbon_powers.dm"
-#include "code\modules\mob\living\carbon\damage_procs.dm"
#include "code\modules\mob\living\carbon\give.dm"
#include "code\modules\mob\living\carbon\hallucinations.dm"
#include "code\modules\mob\living\carbon\internals.dm"
@@ -2505,6 +2516,7 @@
#include "code\modules\mob\living\carbon\human\human_appearance.dm"
#include "code\modules\mob\living\carbon\human\human_attackhand.dm"
#include "code\modules\mob\living\carbon\human\human_damage.dm"
+#include "code\modules\mob\living\carbon\human\human_damage_handlers.dm"
#include "code\modules\mob\living\carbon\human\human_defense.dm"
#include "code\modules\mob\living\carbon\human\human_defines.dm"
#include "code\modules\mob\living\carbon\human\human_examine_decl.dm"
@@ -2615,6 +2627,7 @@
#include "code\modules\mob\living\silicon\robot\preset.dm"
#include "code\modules\mob\living\silicon\robot\robot.dm"
#include "code\modules\mob\living\silicon\robot\robot_damage.dm"
+#include "code\modules\mob\living\silicon\robot\robot_damage_handlers.dm"
#include "code\modules\mob\living\silicon\robot\robot_items.dm"
#include "code\modules\mob\living\silicon\robot\robot_movement.dm"
#include "code\modules\mob\living\silicon\robot\drone\drone.dm"