From bb3f4e69ba0b2e545c01d1092f4b40a5bc4d92b5 Mon Sep 17 00:00:00 2001 From: Crosarius <30341877+Crosarius@users.noreply.github.com> Date: Sun, 30 Jun 2024 06:45:26 +1000 Subject: [PATCH] Helmet Headbutt Protection (#19531) This makes headbutting correctly check for the head armour, to determine whether it's possible to knock someone unconscious. Head armour will now prevent you from being knocked unconscious by a headbutt, unless the attacker has more head armour than you. (e.g. breacher hardsuit vs corporate helmet) You can also knock yourself unconscious by headbutting someone with more head armour than you. --- code/modules/mob/mob_grab_specials.dm | 11 ++++++----- html/changelogs/crosarius-headbutthelmets.yml | 7 +++++++ 2 files changed, 13 insertions(+), 5 deletions(-) create mode 100644 html/changelogs/crosarius-headbutthelmets.yml diff --git a/code/modules/mob/mob_grab_specials.dm b/code/modules/mob/mob_grab_specials.dm index f42f200fb4a..3b950c3cf32 100644 --- a/code/modules/mob/mob_grab_specials.dm +++ b/code/modules/mob/mob_grab_specials.dm @@ -100,16 +100,17 @@ if(isunathi(attacker)) damage += 5 - var/obj/item/clothing/hat = attacker.head - if(istype(hat)) - damage += hat.force * 3 - target.apply_damage(damage, DAMAGE_BRUTE, BP_HEAD) attacker.apply_damage(10, DAMAGE_BRUTE, BP_HEAD) - if(armor < 25 && target.headcheck(BP_HEAD) && prob(damage)) + var/targetarmor = 100 * target.get_blocked_ratio(BP_HEAD, DAMAGE_BRUTE, damage = damage) + var/attackerarmor = 100 * attacker.get_blocked_ratio(BP_HEAD, DAMAGE_BRUTE, damage = damage) + if((targetarmor < 25 || targetarmor < attackerarmor) && target.headcheck(BP_HEAD) && prob(damage)) target.apply_effect(20, PARALYZE) target.visible_message(SPAN_DANGER("[target] [target.species.knockout_message]")) + if(attackerarmor < targetarmor && attacker.headcheck(BP_HEAD) && prob(damage)) + attacker.apply_effect(20, PARALYZE) + attacker.visible_message(SPAN_DANGER("[attacker] [attacker.species.knockout_message]")) playsound(attacker.loc, /singleton/sound_category/swing_hit_sound, 25, 1, -1) attacker.attack_log += text("\[[time_stamp()]\] Headbutted [target.name] ([target.ckey])") diff --git a/html/changelogs/crosarius-headbutthelmets.yml b/html/changelogs/crosarius-headbutthelmets.yml new file mode 100644 index 00000000000..632227ee2af --- /dev/null +++ b/html/changelogs/crosarius-headbutthelmets.yml @@ -0,0 +1,7 @@ +author: Crosarius + +delete-after: True + +changes: + - qol: "Helmets now protect against being knocked unconscious by a headbutt, unless the person headbutting has a better helmet." + - qol: "Headbutting someone who is wearing a helmet can knock yourself out, instead of them."