Fix martial arts gloves runtiming when destroyed while equip (#91892)

## About The Pull Request
If you wear the boxing gloves from the baseball field holodeck sim and
walk off, it causes a runtime where it gets deleted and then attempts to
drop it shortly after. The problem is the martial arts component
`Destroy()` nulls the martial arts style first, then later tries to
unlearn the style, which doesn't exist anymore. This causes the style to
never be properly forgotten.

You could theoretically abuse this to destroy several gloves while
wearing them to gain multiple martial arts styles.

## Why It's Good For The Game
Less runtimes and exploits.

## Changelog
🆑
fix: Fix martial arts gloves runtiming when destroyed while equip
/🆑
This commit is contained in:
Tim
2025-07-01 13:30:16 +02:00
committed by GitHub
parent 7c42067509
commit 320cbcf38f
+4 -5
View File
@@ -10,6 +10,10 @@
style = new style_type(src)
/datum/component/martial_art_giver/Destroy()
var/obj/item/item = parent
var/mob/living/wearer = item.loc
if(isliving(wearer))
style.unlearn(wearer)
QDEL_NULL(style)
return ..()
@@ -25,11 +29,6 @@
/datum/component/martial_art_giver/UnregisterFromParent(datum/source)
UnregisterSignal(parent, list(COMSIG_ITEM_EQUIPPED, COMSIG_ITEM_DROPPED))
var/obj/item/item = parent
var/mob/living/wearer = item.loc
if(istype(wearer))
dropped(item, wearer)
/datum/component/martial_art_giver/proc/equipped(obj/item/source, mob/user, slot)
SIGNAL_HANDLER
if(!(source.slot_flags & slot))