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.
This commit is contained in:
Crosarius
2024-06-29 20:45:26 +00:00
committed by GitHub
parent f7ddf04c89
commit bb3f4e69ba
2 changed files with 13 additions and 5 deletions
+6 -5
View File
@@ -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()]\] <span class='warning'>Headbutted [target.name] ([target.ckey])</span>")