From dd05552fe6458dcf00a7fe424761d483bc222b7e Mon Sep 17 00:00:00 2001 From: SmArtKar <44720187+SmArtKar@users.noreply.github.com> Date: Sat, 20 Jun 2026 12:20:52 +0200 Subject: [PATCH] Refactors shards to item_interaction, fixes a runtime (#96465) ## About The Pull Request What title says, shards would runtime when cutting cloth due to calling the wrong proc (which wasn't needed in the first place, qdel already drops the item) ## Changelog :cl: fix: Fixed a runtime when cutting cloth with glass shards refactor: Refactored glass shards to item_interaction /:cl: --- .../game/objects/items/stacks/sheets/glass.dm | 35 ++++++++++--------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/code/game/objects/items/stacks/sheets/glass.dm b/code/game/objects/items/stacks/sheets/glass.dm index 57288319c6a..bf8e9955903 100644 --- a/code/game/objects/items/stacks/sheets/glass.dm +++ b/code/game/objects/items/stacks/sheets/glass.dm @@ -370,24 +370,27 @@ GLOBAL_LIST_INIT(plastitaniumglass_recipes, list( to_chat(user, span_warning("[src] cuts into your hand!")) jab.apply_damage(force * 0.5, BRUTE, user.get_active_hand(), attacking_item = src) -/obj/item/shard/attackby(obj/item/item, mob/user, list/modifiers, list/attack_modifiers) - if(istype(item, /obj/item/lightreplacer)) - var/obj/item/lightreplacer/lightreplacer = item +/obj/item/shard/item_interaction(mob/living/user, obj/item/tool, list/modifiers) + if(istype(tool, /obj/item/lightreplacer)) + var/obj/item/lightreplacer/lightreplacer = tool lightreplacer.attackby(src, user) - else if(istype(item, /obj/item/stack/sheet/cloth)) - var/obj/item/stack/sheet/cloth/cloth = item - to_chat(user, span_notice("You begin to wrap the [cloth] around the [src]...")) - if(do_after(user, craft_time, target = src)) - var/obj/item/knife/shiv/shiv = new shiv_type - shiv.set_custom_materials(custom_materials) - cloth.use(1) - to_chat(user, span_notice("You wrap the [cloth] around the [src], forming a makeshift weapon.")) - remove_item_from_storage(src, user) - qdel(src) - user.put_in_hands(shiv) + return ITEM_INTERACT_SUCCESS - else - return ..() + if(!istype(tool, /obj/item/stack/sheet/cloth)) + return NONE + + var/obj/item/stack/sheet/cloth/cloth = tool + to_chat(user, span_notice("You begin to wrap the [cloth] around the [src]...")) + if(do_after(user, craft_time, target = src)) + return ITEM_INTERACT_FAILURE + + var/obj/item/knife/shiv/shiv = new shiv_type + shiv.set_custom_materials(custom_materials) + cloth.use(1) + to_chat(user, span_notice("You wrap the [cloth] around the [src], forming a makeshift weapon.")) + qdel(src) + user.put_in_hands(shiv) + return ITEM_INTERACT_SUCCESS /obj/item/shard/welder_act(mob/living/user, obj/item/I) if(I.use_tool(src, user, 0, volume=50))