From a5aa34e108c3ea08d534ed13362786b7f72c6958 Mon Sep 17 00:00:00 2001 From: MrMelbert Date: Sun, 25 Jan 2026 23:07:35 -0600 Subject: [PATCH 1/2] Fix pain checks --- code/__DEFINES/living.dm | 3 +++ code/_onclick/item_attack.dm | 7 +++---- code/game/objects/items/flamethrower.dm | 2 +- code/game/objects/items/grenades/_grenade.dm | 2 +- code/modules/capture_the_flag/ctf_player_component.dm | 2 +- code/modules/mob/living/basic/bots/_bots.dm | 2 +- code/modules/mob/living/simple_animal/bot/bot.dm | 2 +- code/modules/mob/living/simple_animal/bot/secbot.dm | 2 +- code/modules/projectiles/projectile.dm | 2 +- 9 files changed, 13 insertions(+), 11 deletions(-) diff --git a/code/__DEFINES/living.dm b/code/__DEFINES/living.dm index 56cc96b506f0..4749fe49bbd1 100644 --- a/code/__DEFINES/living.dm +++ b/code/__DEFINES/living.dm @@ -211,3 +211,6 @@ #define examining_span_normal(msg) span_infoplain(span_italics(msg)) /// For consistent examine span formatting (small size) #define examining_span_small(msg) span_slightly_smaller(span_infoplain(span_italics(msg))) + +#define IS_PHYSICAL_DAMAGE(damage_type) (damage_type == BRUTE || damage_type == BURN) +#define IS_DISABLING_DAMAGE(damage_type) (damage_type == STAMINA || damage_type == PAIN) diff --git a/code/_onclick/item_attack.dm b/code/_onclick/item_attack.dm index 26ebf23fb290..4a430a36c91d 100644 --- a/code/_onclick/item_attack.dm +++ b/code/_onclick/item_attack.dm @@ -211,7 +211,7 @@ if(item_flags & NOBLUDGEON) return FALSE - if(damtype != STAMINA && force && HAS_TRAIT(user, TRAIT_PACIFISM)) + if(IS_DISABLING_DAMAGE(damtype) && force && HAS_TRAIT(user, TRAIT_PACIFISM)) to_chat(user, span_warning("You don't want to harm other living beings!")) return FALSE @@ -375,13 +375,13 @@ return FALSE /mob/living/silicon/robot/attack_effects(damage_done, hit_zone, armor_block, obj/item/attacking_item, mob/living/attacker) - if(damage_done > 0 && attacking_item.damtype != STAMINA && stat != DEAD) + if(damage_done > 0 && IS_PHYSICAL_DAMAGE(attacking_item.damtype) && stat != DEAD) spark_system.start() . = TRUE return ..() || . /mob/living/silicon/ai/attack_effects(damage_done, hit_zone, armor_block, obj/item/attacking_item, mob/living/attacker) - if(damage_done > 0 && attacking_item.damtype != STAMINA && stat != DEAD) + if(damage_done > 0 && IS_PHYSICAL_DAMAGE(attacking_item.damtype) && stat != DEAD) spark_system.start() . = TRUE return ..() || . @@ -494,4 +494,3 @@ return " in the [input_area]" return "" - diff --git a/code/game/objects/items/flamethrower.dm b/code/game/objects/items/flamethrower.dm index 744dc9e2542b..80ec054aca08 100644 --- a/code/game/objects/items/flamethrower.dm +++ b/code/game/objects/items/flamethrower.dm @@ -259,7 +259,7 @@ create_with_tank = TRUE /obj/item/flamethrower/hit_reaction(mob/living/carbon/human/owner, atom/movable/hitby, attack_text = "the attack", final_block_chance = 0, damage = 0, attack_type = MELEE_ATTACK, damage_type = BRUTE) - if(damage && attack_type == PROJECTILE_ATTACK && damage_type != STAMINA && prob(15)) + if(damage && attack_type == PROJECTILE_ATTACK && IS_PHYSICAL_DAMAGE(damage_type) && prob(15)) owner.visible_message(span_danger("\The [attack_text] hits the fuel tank on [owner]'s [name], rupturing it! What a shot!")) var/turf/target_turf = get_turf(owner) owner.log_message("held a flamethrower tank detonated by a projectile ([hitby])", LOG_GAME) diff --git a/code/game/objects/items/grenades/_grenade.dm b/code/game/objects/items/grenades/_grenade.dm index fdd9c4486ad6..7c862d2ecae1 100644 --- a/code/game/objects/items/grenades/_grenade.dm +++ b/code/game/objects/items/grenades/_grenade.dm @@ -251,7 +251,7 @@ return attack_hand(user, modifiers) /obj/item/grenade/hit_reaction(mob/living/carbon/human/owner, atom/movable/hitby, attack_text = "the attack", final_block_chance = 0, damage = 0, attack_type = MELEE_ATTACK, damage_type = BRUTE) - if(damage && attack_type == PROJECTILE_ATTACK && damage_type != STAMINA && prob(15)) + if(damage && attack_type == PROJECTILE_ATTACK && IS_PHYSICAL_DAMAGE(damage_type) && prob(15)) owner.visible_message(span_danger("[attack_text] hits [owner]'s [src], setting it off! What a shot!")) var/turf/source_turf = get_turf(src) var/logmsg = "held a grenade detonated by a projectile ([hitby]) at [COORD(source_turf)]" diff --git a/code/modules/capture_the_flag/ctf_player_component.dm b/code/modules/capture_the_flag/ctf_player_component.dm index 990cc499cdb0..004bb71355a0 100644 --- a/code/modules/capture_the_flag/ctf_player_component.dm +++ b/code/modules/capture_the_flag/ctf_player_component.dm @@ -40,7 +40,7 @@ ///Stamina and oxygen damage will not dust a player by themself. /datum/component/ctf_player/proc/damage_type_check(datum/source, damage, damage_type) SIGNAL_HANDLER - if(damage_type != STAMINA && damage_type != OXY) + if(IS_PHYSICAL_DAMAGE(damage_type)) ctf_dust() ///Dusts the player and starts a respawn countdown. diff --git a/code/modules/mob/living/basic/bots/_bots.dm b/code/modules/mob/living/basic/bots/_bots.dm index ecf52f92ecd6..f6e4967cf4e8 100644 --- a/code/modules/mob/living/basic/bots/_bots.dm +++ b/code/modules/mob/living/basic/bots/_bots.dm @@ -452,7 +452,7 @@ GLOBAL_LIST_INIT(command_strings, list( ejectpai(user) /mob/living/basic/bot/attack_effects(damage_done, hit_zone, armor_block, obj/item/attacking_item, mob/living/attacker) - if(damage_done > 0 && attacking_item.damtype != STAMINA && stat != DEAD) + if(damage_done > 0 && IS_PHYSICAL_DAMAGE(attacking_item.damtype) && stat != DEAD) do_sparks(5, TRUE, src) . = TRUE return ..() || . diff --git a/code/modules/mob/living/simple_animal/bot/bot.dm b/code/modules/mob/living/simple_animal/bot/bot.dm index 8705f1ca2baa..fa93f7b02978 100644 --- a/code/modules/mob/living/simple_animal/bot/bot.dm +++ b/code/modules/mob/living/simple_animal/bot/bot.dm @@ -491,7 +491,7 @@ return ..() /mob/living/simple_animal/bot/attack_effects(damage_done, hit_zone, armor_block, obj/item/attacking_item, mob/living/attacker) - if(damage_done > 0 && attacking_item.damtype != STAMINA && stat != DEAD) + if(damage_done > 0 && IS_PHYSICAL_DAMAGE(attacking_item.damtype) && stat != DEAD) do_sparks(5, TRUE, src) . = TRUE return ..() || . diff --git a/code/modules/mob/living/simple_animal/bot/secbot.dm b/code/modules/mob/living/simple_animal/bot/secbot.dm index 93ecce0ad6a9..fe35ca424e88 100644 --- a/code/modules/mob/living/simple_animal/bot/secbot.dm +++ b/code/modules/mob/living/simple_animal/bot/secbot.dm @@ -258,7 +258,7 @@ return if(attacking_item.tool_behaviour == TOOL_WELDER && !user.combat_mode) // Any intent but harm will heal, so we shouldn't get angry. return - if(attacking_item.tool_behaviour != TOOL_SCREWDRIVER && (attacking_item.force) && (!target) && (attacking_item.damtype != STAMINA)) // Added check for welding tool to fix #2432. Welding tool behavior is handled in superclass. + if(attacking_item.tool_behaviour != TOOL_SCREWDRIVER && (attacking_item.force) && (!target) && !IS_DISABLING_DAMAGE(attacking_item.damtype)) // Added check for welding tool to fix #2432. Welding tool behavior is handled in superclass. retaliate(user) special_retaliate_after_attack(user) diff --git a/code/modules/projectiles/projectile.dm b/code/modules/projectiles/projectile.dm index 50438e22c55c..07b5c24561b0 100644 --- a/code/modules/projectiles/projectile.dm +++ b/code/modules/projectiles/projectile.dm @@ -1140,7 +1140,7 @@ * This is used in places such as AI responses to determine if they're being threatened or not (among other places) */ /obj/projectile/proc/is_hostile_projectile() - if(damage > 0 || stamina > 0) + if(damage > 0 || stamina > 0 || pain > 0) return TRUE if(paralyze + stun + immobilize + knockdown > 0 SECONDS) From c7d79a13c524a375fdc5c279b3dc5f987c86055a Mon Sep 17 00:00:00 2001 From: MrMelbert Date: Sun, 25 Jan 2026 23:08:21 -0600 Subject: [PATCH 2/2] Docs --- code/__DEFINES/living.dm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/code/__DEFINES/living.dm b/code/__DEFINES/living.dm index 4749fe49bbd1..c95473aadc50 100644 --- a/code/__DEFINES/living.dm +++ b/code/__DEFINES/living.dm @@ -212,5 +212,7 @@ /// For consistent examine span formatting (small size) #define examining_span_small(msg) span_slightly_smaller(span_infoplain(span_italics(msg))) +/// Damtype is "physical" like a slap to the face #define IS_PHYSICAL_DAMAGE(damage_type) (damage_type == BRUTE || damage_type == BURN) +/// Damtype is intended to disable rather than kill #define IS_DISABLING_DAMAGE(damage_type) (damage_type == STAMINA || damage_type == PAIN)