mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-28 15:47:15 +01:00
## About The Pull Request Refactors martial arts off the mind. Don't worry the martial arts you learn still transfer with mindswap Instead, they are just tracked on a list on the mob, and they also independently track the datum that created them This fixes a lot of jank with martial arts, like say, having your krav maga gloves transfer across slime clones or something... But it also opens an opportunity: As we track all martial arts available, I added a verb (ic tab) that lets you swap between the ones you know  (Some don't let you swap like that one brain trauma) ## Why It's Good For The Game Aforementioned fixes a lot of jank Recently martial arts have just been up and disappearing and this was entirely spurred on by that bug Probably fixes #84710 (haven't checked) Probably fixes #89247 Probably fixes #89948 Probably fixes #90067 ## Changelog 🆑 Melbert refactor: Refactored martial arts, if you notice any oddities like managing to know two martial arts at once or having your powers disappear, report it! add: If you know multiple martial arts, such as krav maga from gloves and cqc from a book, you can now swap between them at will via a button in the IC tab! /🆑 --------- Co-authored-by: Mothblocks <35135081+Mothblocks@users.noreply.github.com>
42 lines
1.2 KiB
Plaintext
42 lines
1.2 KiB
Plaintext
/// when equipped and unequipped this item gives a martial art
|
|
/datum/component/martial_art_giver
|
|
/// the style we give
|
|
var/datum/martial_art/style
|
|
|
|
/datum/component/martial_art_giver/Initialize(style_type)
|
|
if(!isitem(parent))
|
|
return COMPONENT_INCOMPATIBLE
|
|
|
|
style = new style_type(src)
|
|
|
|
/datum/component/martial_art_giver/Destroy()
|
|
QDEL_NULL(style)
|
|
return ..()
|
|
|
|
/datum/component/martial_art_giver/RegisterWithParent()
|
|
RegisterSignal(parent, COMSIG_ITEM_EQUIPPED, PROC_REF(equipped))
|
|
RegisterSignal(parent, COMSIG_ITEM_DROPPED, PROC_REF(dropped))
|
|
|
|
var/obj/item/item = parent
|
|
var/mob/living/wearer = item.loc
|
|
if(istype(wearer))
|
|
equipped(item, wearer, wearer.get_slot_by_item(item))
|
|
|
|
/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))
|
|
return
|
|
style.teach(user)
|
|
|
|
/datum/component/martial_art_giver/proc/dropped(obj/item/source, mob/user)
|
|
SIGNAL_HANDLER
|
|
style.unlearn(user)
|