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
🆑
fix: Fixed a runtime when cutting cloth with glass shards
refactor: Refactored glass shards to item_interaction
/🆑
This commit is contained in:
SmArtKar
2026-06-20 12:20:52 +02:00
committed by GitHub
parent 3bb8759b6f
commit dd05552fe6
+19 -16
View File
@@ -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))