From f9c601b7beb58e18591148bea42dab73df5e800a Mon Sep 17 00:00:00 2001 From: Alan Date: Fri, 24 Jul 2026 15:30:00 -0400 Subject: [PATCH] Migrate knuckleduster and kitchen tools to the new attack chain. (#32283) * Migrate knuckleduster and kitchen tools to the new attack chain. * Add fingerprints. * Remove duplicate vars. * Apply suggestions from CRUNCH review Co-authored-by: CRUNCH <143041327+CRUNCH-Borg@users.noreply.github.com> Signed-off-by: Alan * Fix number of macro arguments. * Give organs a source. * Call parent in knuckledusters' after_attack() * Apply suggestion from CRUNCH review. Co-authored-by: CRUNCH <143041327+CRUNCH-Borg@users.noreply.github.com> Signed-off-by: Alan * Apply suggestion from CRUNCH review. Co-authored-by: CRUNCH <143041327+CRUNCH-Borg@users.noreply.github.com> Signed-off-by: Alan --------- Signed-off-by: Alan Co-authored-by: CRUNCH <143041327+CRUNCH-Borg@users.noreply.github.com> --- code/game/objects/items/weapons/kitchen.dm | 2 +- .../objects/items/weapons/knuckledusters.dm | 35 +++++++++++++------ .../ruins/lavalandruin_code/sin_ruins.dm | 1 - code/modules/smithing/smithed_items/knives.dm | 1 - 4 files changed, 25 insertions(+), 14 deletions(-) diff --git a/code/game/objects/items/weapons/kitchen.dm b/code/game/objects/items/weapons/kitchen.dm index 08352887903..181071efe0c 100644 --- a/code/game/objects/items/weapons/kitchen.dm +++ b/code/game/objects/items/weapons/kitchen.dm @@ -18,6 +18,7 @@ icon = 'icons/obj/kitchen.dmi' origin_tech = "materials=1" materials = list(MAT_METAL = 100) + new_attack_chain = TRUE /* * Utensils @@ -36,7 +37,6 @@ armor = list(MELEE = 0, BULLET = 0, LASER = 0, ENERGY = 0, BOMB = 0, RAD = 0, FIRE = 50, ACID = 30) materials = list(MAT_METAL = 100) var/max_contents = 1 - new_attack_chain = TRUE /obj/item/kitchen/utensil/Initialize(mapload) //Initialize(mapload) diff --git a/code/game/objects/items/weapons/knuckledusters.dm b/code/game/objects/items/weapons/knuckledusters.dm index 49a2945e8ea..5bccd7126a4 100644 --- a/code/game/objects/items/weapons/knuckledusters.dm +++ b/code/game/objects/items/weapons/knuckledusters.dm @@ -18,18 +18,26 @@ var/elite = FALSE /// How much organ damage can the weapon do? var/trauma = 5 + new_attack_chain = TRUE + +/obj/item/melee/knuckleduster/activate_self(mob/user) + if(..()) + return ITEM_INTERACT_COMPLETE + + add_fingerprint(user) -/obj/item/melee/knuckleduster/attack_self__legacy__attackchain(mob/user) if(!gripped) gripped = TRUE - to_chat(user, "You tighten your grip on [src], ensuring you won't drop it.") + to_chat(user, SPAN_NOTICE("You tighten your grip on [src], ensuring you won't drop it.")) set_nodrop(TRUE, user) ADD_TRAIT(src, TRAIT_SKIP_EXAMINE, "knuckledusters") - else - gripped = FALSE - to_chat(user, "You relax your grip on [src].") - set_nodrop(FALSE, user) - REMOVE_TRAIT(src, TRAIT_SKIP_EXAMINE, "knuckledusters") + return ITEM_INTERACT_COMPLETE + + gripped = FALSE + to_chat(user, SPAN_NOTICE("You relax your grip on [src].")) + set_nodrop(FALSE, user) + REMOVE_TRAIT(src, TRAIT_SKIP_EXAMINE, "knuckledusters") + return ITEM_INTERACT_COMPLETE /obj/item/melee/knuckleduster/dropped(mob/user, silent) . = ..() @@ -37,21 +45,26 @@ set_nodrop(FALSE, user) REMOVE_TRAIT(src, TRAIT_SKIP_EXAMINE, "knuckledusters") -/obj/item/melee/knuckleduster/attack__legacy__attackchain(mob/living/target, mob/living/user) - . = ..() +/obj/item/melee/knuckleduster/pre_attack(atom/target, mob/living/user, params) hitsound = pick('sound/weapons/punch1.ogg', 'sound/weapons/punch2.ogg', 'sound/weapons/punch3.ogg', 'sound/weapons/punch4.ogg') + return ..() + +/obj/item/melee/knuckleduster/after_attack(mob/living/carbon/human/target, mob/user, proximity_flag, click_parameters) + if(..()) + return FINISH_ATTACK if(!ishuman(target) || QDELETED(target)) - return + return FINISH_ATTACK var/obj/item/organ/external/punched = target.get_organ(user.zone_selected) if(!length(punched.internal_organs)) - return + return FINISH_ATTACK var/obj/item/organ/internal/squishy = pick(punched.internal_organs) if(gripped && elite) squishy.receive_damage(trauma) if(punched.is_broken()) squishy.receive_damage(trauma) // Probably not so good for your organs to have your already broken ribs punched hard by a metal object + return FINISH_ATTACK /obj/item/melee/knuckleduster/syndie name = "syndicate knuckleduster" diff --git a/code/modules/ruins/lavalandruin_code/sin_ruins.dm b/code/modules/ruins/lavalandruin_code/sin_ruins.dm index ab342489e11..343df76a3a7 100644 --- a/code/modules/ruins/lavalandruin_code/sin_ruins.dm +++ b/code/modules/ruins/lavalandruin_code/sin_ruins.dm @@ -186,7 +186,6 @@ inhand_icon_state = "knife" force = 18 w_class = WEIGHT_CLASS_NORMAL - new_attack_chain = TRUE /obj/item/kitchen/knife/envy/after_attack(atom/target, mob/user, proximity_flag, click_parameters) . = ..() diff --git a/code/modules/smithing/smithed_items/knives.dm b/code/modules/smithing/smithed_items/knives.dm index f4ac6bb6286..8721f731f81 100644 --- a/code/modules/smithing/smithed_items/knives.dm +++ b/code/modules/smithing/smithed_items/knives.dm @@ -7,7 +7,6 @@ slot_flags = ITEM_SLOT_BELT embedded_ignore_throwspeed_threshold = TRUE - new_attack_chain = TRUE /// The quality of the item var/datum/smith_quality/quality /// The material of the item