Migrates /obj/item/chair to the new attack chain (#30169)

* Moves chair to the attack chain

* comment fix
This commit is contained in:
Contrabang
2025-08-22 08:10:54 -07:00
committed by GitHub
parent 4bed17ef31
commit 9b735ec3fe

View File

@@ -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("<span class='danger'>[user] smashes \the [src] to pieces against \the [target]</span>")
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("<span class='danger'>[user] smashes \the [src] to pieces against \the [target]</span>")
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("<span class='danger'>[user] breaks [src] over [M]'s back!.</span>")
/obj/item/chair/stool/pre_attack(atom/target, mob/living/user, params)
if(..())
return FINISH_ATTACK
if(prob(5) && isliving(target))
user.visible_message("<span class='danger'>[user] breaks [src] over [target]'s back!.</span>")
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)
. = ..()