From 9b735ec3fef16ff6f04a0817f567c82f511bb2ce Mon Sep 17 00:00:00 2001 From: Contrabang <91113370+Contrabang@users.noreply.github.com> Date: Fri, 22 Aug 2025 08:10:54 -0700 Subject: [PATCH] Migrates `/obj/item/chair` to the new attack chain (#30169) * Moves chair to the attack chain * comment fix --- .../structures/stool_bed_chair_nest/chairs.dm | 39 ++++++++++--------- 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/code/game/objects/structures/stool_bed_chair_nest/chairs.dm b/code/game/objects/structures/stool_bed_chair_nest/chairs.dm index 1b6f0b0b026..80c7f24d376 100644 --- a/code/game/objects/structures/stool_bed_chair_nest/chairs.dm +++ b/code/game/objects/structures/stool_bed_chair_nest/chairs.dm @@ -518,6 +518,7 @@ hitsound = 'sound/items/trayhit1.ogg' hit_reaction_chance = 50 materials = list(MAT_METAL = 2000) + new_attack_chain = TRUE /// Likelihood of smashing the chair. var/break_chance = 5 /// Used for when placing a chair back down. @@ -610,31 +611,33 @@ return 1 return 0 -/obj/item/chair/afterattack__legacy__attackchain(atom/target, mob/living/carbon/user, proximity) - ..() - if(!proximity) +// We use after_attack here so it still does damage, unlike the stool's chance to break before the attack. Don't ask me why stools do separate stuff. I blame oldcoders. +/obj/item/chair/after_attack(atom/target, mob/user, proximity_flag, click_parameters) + . = ..() + if(!proximity_flag || !prob(break_chance)) return - if(prob(break_chance)) - user.visible_message("[user] smashes \the [src] to pieces against \the [target]") - if(iscarbon(target)) - var/mob/living/carbon/C = target - if(C.health < C.maxHealth*0.5) - C.Weaken(12 SECONDS) - C.Stuttering(12 SECONDS) - playsound(src.loc, 'sound/weapons/punch1.ogg', 50, TRUE, -1) - smash(user) + user.visible_message("[user] smashes \the [src] to pieces against \the [target]") + if(iscarbon(target)) + var/mob/living/carbon/C = target + if(C.health < C.maxHealth*0.5) + C.Weaken(12 SECONDS) + C.Stuttering(12 SECONDS) + playsound(src.loc, 'sound/weapons/punch1.ogg', 50, TRUE, -1) + smash(user) -/obj/item/chair/stool/attack__legacy__attackchain(mob/M as mob, mob/user as mob) - if(prob(5) && isliving(M)) - user.visible_message("[user] breaks [src] over [M]'s back!.") +/obj/item/chair/stool/pre_attack(atom/target, mob/living/user, params) + if(..()) + return FINISH_ATTACK + + if(prob(5) && isliving(target)) + user.visible_message("[user] breaks [src] over [target]'s back!.") user.unequip(src) var/obj/item/stack/sheet/metal/m = new/obj/item/stack/sheet/metal m.loc = get_turf(src) qdel(src) - var/mob/living/T = M + var/mob/living/T = target T.Weaken(10 SECONDS) - return - ..() + return FINISH_ATTACK /obj/item/chair/examine(mob/user) . = ..()