From 2672d02eb378cd95a0c2e4b26953dcf89259f893 Mon Sep 17 00:00:00 2001 From: Adrer Date: Tue, 3 Oct 2023 08:47:19 +0200 Subject: [PATCH] [s] Martial arts granted by equipped items no longer persist through cloning. (#22684) * Martial arts no longer persist through cloning * Remove unnessecary var declarations * Combo counter --------- Co-authored-by: Adrer --- code/datums/mind.dm | 10 ++++++---- .../game/objects/items/weapons/highlander_swords.dm | 4 ++-- code/modules/clothing/shoes/magboots.dm | 6 +++++- code/modules/martial_arts/judo.dm | 2 +- code/modules/martial_arts/krav_maga.dm | 12 ++++++++---- code/modules/martial_arts/martial.dm | 13 +++++++++++-- code/modules/surgery/organs/augments_arms.dm | 7 +++++-- 7 files changed, 38 insertions(+), 16 deletions(-) diff --git a/code/datums/mind.dm b/code/datums/mind.dm index e5353c1e011..3d13ffbd5ec 100644 --- a/code/datums/mind.dm +++ b/code/datums/mind.dm @@ -149,10 +149,12 @@ transfer_antag_huds(hud_to_transfer) //inherit the antag HUD transfer_actions(new_character) if(martial_art) - if(martial_art.temporary) - martial_art.remove(current) - else - martial_art.teach(current) + for(var/datum/martial_art/MA in known_martial_arts) + if(MA.temporary) + MA.remove(current) + else + MA.remove(current) + MA.teach(current) if(active) new_character.key = key //now transfer the key to link the client to our new body SEND_SIGNAL(src, COMSIG_MIND_TRANSER_TO, new_character) diff --git a/code/game/objects/items/weapons/highlander_swords.dm b/code/game/objects/items/weapons/highlander_swords.dm index fa4019a38ca..a1363ebd90b 100644 --- a/code/game/objects/items/weapons/highlander_swords.dm +++ b/code/game/objects/items/weapons/highlander_swords.dm @@ -37,7 +37,7 @@ var/obj/item/claymore/highlander/sword = H.is_in_hands(/obj/item/claymore/highlander) if(sword) //if we have a highlander sword in the other hand, relearn the style from that sword. - sword.style.teach(H, 1) + sword.style.teach(H, TRUE) /obj/item/claymore/highlander/dropped(mob/user) ..() @@ -49,4 +49,4 @@ var/obj/item/claymore/highlander/sword = H.is_in_hands(/obj/item/claymore/highlander) if(sword) //if we have a highlander sword in the other hand, relearn the style from that sword. - sword.style.teach(H, 1) + sword.style.teach(H, TRUE) diff --git a/code/modules/clothing/shoes/magboots.dm b/code/modules/clothing/shoes/magboots.dm index 1741114ddcb..18d0dd9b772 100644 --- a/code/modules/clothing/shoes/magboots.dm +++ b/code/modules/clothing/shoes/magboots.dm @@ -155,7 +155,7 @@ slowdown_active = SHOES_SLOWDOWN magboot_state = "gravboots" magpulse_name = "micro gravitational traction system" - var/datum/martial_art/grav_stomp/style = new //Only works with core and cell installed. + var/datum/martial_art/grav_stomp/style //Only works with core and cell installed. var/jumpdistance = 5 var/jumpspeed = 3 var/recharging_rate = 6 SECONDS @@ -165,6 +165,10 @@ var/obj/item/assembly/signaler/anomaly/grav/core = null var/obj/item/stock_parts/cell/cell = null +/obj/item/clothing/shoes/magboots/gravity/Initialize() + . = ..() + style = new() + /obj/item/clothing/shoes/magboots/gravity/Destroy() QDEL_NULL(style) QDEL_NULL(cell) diff --git a/code/modules/martial_arts/judo.dm b/code/modules/martial_arts/judo.dm index 765e57e4554..fd7eeea809b 100644 --- a/code/modules/martial_arts/judo.dm +++ b/code/modules/martial_arts/judo.dm @@ -33,7 +33,7 @@ if(HAS_TRAIT(user, TRAIT_PACIFISM)) to_chat(H, "The arts of Corporate Judo echo uselessly in your head, the thought of violence disgusts you!") return - style.teach(H, 1) + style.teach(H, TRUE) to_chat(H, "The belt's nanites infuse you with the prowess of a black belt in Corporate Judo!") to_chat(H, "See the martial arts tab for an explanation of combos.") return diff --git a/code/modules/martial_arts/krav_maga.dm b/code/modules/martial_arts/krav_maga.dm index b7ea3c33a65..43c9ae34ae5 100644 --- a/code/modules/martial_arts/krav_maga.dm +++ b/code/modules/martial_arts/krav_maga.dm @@ -138,16 +138,20 @@ //Krav Maga Gloves /obj/item/clothing/gloves/color/black/krav_maga - var/datum/martial_art/krav_maga/style = new + var/datum/martial_art/krav_maga/style can_be_cut = FALSE resistance_flags = NONE +/obj/item/clothing/gloves/color/black/krav_maga/Initialize() + . = ..() + style = new() + /obj/item/clothing/gloves/color/black/krav_maga/equipped(mob/user, slot) if(!ishuman(user)) return if(slot == slot_gloves) var/mob/living/carbon/human/H = user - style.teach(H,1) + style.teach(H, TRUE) /obj/item/clothing/gloves/color/black/krav_maga/dropped(mob/user) ..() @@ -158,7 +162,7 @@ style.remove(H) /obj/item/clothing/gloves/color/black/krav_maga/sec//more obviously named, given to sec - name = "krav maga gloves" + name = "Krav Maga gloves" desc = "These gloves can teach you to perform Krav Maga using nanochips." icon_state = "fightgloves" item_state = "fightgloves" @@ -168,7 +172,7 @@ RegisterSignal(src, COMSIG_PARENT_QDELETING, PROC_REF(alert_admins_on_destroy)) /obj/item/clothing/gloves/color/black/krav_maga/combat // for nukies - name = "combat gloves plus" + name = "Combat gloves plus" desc = "These combat gloves have been upgraded with nanochips that teach the wearer Krav Maga." icon_state = "combat" item_state = "swat_gl" diff --git a/code/modules/martial_arts/martial.dm b/code/modules/martial_arts/martial.dm index 6ca2bec8087..45c798a1694 100644 --- a/code/modules/martial_arts/martial.dm +++ b/code/modules/martial_arts/martial.dm @@ -160,6 +160,7 @@ return if(has_explaination_verb) H.verbs |= /mob/living/carbon/human/proc/martial_arts_help + temporary = make_temporary owner_UID = H.UID() H.mind.known_martial_arts.Add(src) H.mind.martial_art = get_highest_weight(H) @@ -258,7 +259,11 @@ //ITEMS /obj/item/clothing/gloves/boxing - var/datum/martial_art/boxing/style = new + var/datum/martial_art/boxing/style + +/obj/item/clothing/gloves/boxing/Initialize() + . = ..() + style = new() /obj/item/clothing/gloves/boxing/equipped(mob/user, slot) if(!ishuman(user)) @@ -278,7 +283,11 @@ /obj/item/storage/belt/champion/wrestling name = "Wrestling Belt" - var/datum/martial_art/wrestling/style = new + var/datum/martial_art/wrestling/style + +/obj/item/storage/belt/champion/wrestling/Initialize() + . = ..() + style = new() /obj/item/storage/belt/champion/wrestling/equipped(mob/user, slot) if(!ishuman(user)) diff --git a/code/modules/surgery/organs/augments_arms.dm b/code/modules/surgery/organs/augments_arms.dm index 2c08c0f1c96..01e02780ad0 100644 --- a/code/modules/surgery/organs/augments_arms.dm +++ b/code/modules/surgery/organs/augments_arms.dm @@ -572,10 +572,13 @@ actions_types = list() var/datum/martial_art/muscle_implant/muscle_implant -/obj/item/organ/internal/cyberimp/arm/muscle/insert(mob/living/carbon/M, special, dont_remove_slot) +/obj/item/organ/internal/cyberimp/arm/muscle/Initialize() . = ..() muscle_implant = new() - muscle_implant.teach(M) + +/obj/item/organ/internal/cyberimp/arm/muscle/insert(mob/living/carbon/M, special, dont_remove_slot) + . = ..() + muscle_implant.teach(M, TRUE) /obj/item/organ/internal/cyberimp/arm/muscle/remove(mob/living/carbon/M, special) . = ..()