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: