diff --git a/code/datums/components/twohanded.dm b/code/datums/components/twohanded.dm index 3b015c95383..37df7308217 100644 --- a/code/datums/components/twohanded.dm +++ b/code/datums/components/twohanded.dm @@ -63,7 +63,7 @@ return ..() // Inherit the new values passed to the component -/datum/component/two_handed/InheritComponent(datum/component/two_handed/new_comp, original, require_twohands, wieldsound, unwieldsound, \ +/datum/component/two_handed/InheritComponent(datum/component/two_handed/new_comp, original, require_twohands, wieldsound, unwieldsound, attacksound, \ force_multiplier, force_wielded, force_unwielded, icon_wielded, \ datum/callback/wield_callback, datum/callback/unwield_callback) if(!original) diff --git a/code/game/objects/structures/tables_racks.dm b/code/game/objects/structures/tables_racks.dm index 70829118234..a3ff544800f 100644 --- a/code/game/objects/structures/tables_racks.dm +++ b/code/game/objects/structures/tables_racks.dm @@ -66,7 +66,7 @@ if(istype(held_item, /obj/item/toy/cards/deck)) var/obj/item/toy/cards/deck/dealer_deck = held_item - if(dealer_deck.wielded) + if(HAS_TRAIT(dealer_deck, TRAIT_WIELDED)) context[SCREENTIP_CONTEXT_LMB] = "Deal card" context[SCREENTIP_CONTEXT_RMB] = "Deal card faceup" . = CONTEXTUAL_SCREENTIP_SET @@ -238,7 +238,7 @@ if(istype(I, /obj/item/toy/cards/deck)) var/obj/item/toy/cards/deck/dealer_deck = I - if(dealer_deck.wielded) // deal a card facedown on the table + if(HAS_TRAIT(dealer_deck, TRAIT_WIELDED)) // deal a card facedown on the table var/obj/item/toy/singlecard/card = dealer_deck.draw(user) if(card) attackby(card, user, params) @@ -284,7 +284,7 @@ /obj/structure/table/attackby_secondary(obj/item/weapon, mob/user, params) if(istype(weapon, /obj/item/toy/cards/deck)) var/obj/item/toy/cards/deck/dealer_deck = weapon - if(dealer_deck.wielded) // deal a card faceup on the table + if(HAS_TRAIT(dealer_deck, TRAIT_WIELDED)) // deal a card faceup on the table var/obj/item/toy/singlecard/card = dealer_deck.draw(user) if(card) card.Flip() diff --git a/code/modules/cards/cardhand.dm b/code/modules/cards/cardhand.dm index b03a29a43f4..9dab4e65b58 100644 --- a/code/modules/cards/cardhand.dm +++ b/code/modules/cards/cardhand.dm @@ -29,7 +29,7 @@ /obj/item/toy/cards/cardhand/add_context(atom/source, list/context, obj/item/held_item, mob/living/user) if(istype(held_item, /obj/item/toy/cards/deck)) var/obj/item/toy/cards/deck/dealer_deck = held_item - if(dealer_deck.wielded) + if(HAS_TRAIT(dealer_deck, TRAIT_WIELDED)) context[SCREENTIP_CONTEXT_LMB] = "Deal card" context[SCREENTIP_CONTEXT_RMB] = "Deal card faceup" return CONTEXTUAL_SCREENTIP_SET @@ -77,7 +77,7 @@ if(istype(weapon, /obj/item/toy/cards/deck)) var/obj/item/toy/cards/deck/dealer_deck = weapon - if(!dealer_deck.wielded) // recycle cardhand into deck (if unwielded) + if(!HAS_TRAIT(dealer_deck, TRAIT_WIELDED)) // recycle cardhand into deck (if unwielded) dealer_deck.insert(src) user.balloon_alert_to_viewers("puts card in deck") return diff --git a/code/modules/cards/deck/deck.dm b/code/modules/cards/deck/deck.dm index 189d88822ec..632b01d509d 100644 --- a/code/modules/cards/deck/deck.dm +++ b/code/modules/cards/deck/deck.dm @@ -21,8 +21,6 @@ var/decksize = INFINITY /// The description of the cardgame that is played with this deck (used for memories) var/cardgame_desc = "card game" - /// Wielding status for holding with two hands - var/wielded = FALSE /// The holodeck computer used to spawn a holographic deck (see /obj/item/toy/cards/deck/syndicate/holographic) var/obj/machinery/computer/holodeck/holodeck /// If the cards in the deck have different card faces icons (blank and CAS decks do not) @@ -33,8 +31,6 @@ /obj/item/toy/cards/deck/Initialize(mapload) . = ..() AddElement(/datum/element/drag_pickup) - RegisterSignal(src, COMSIG_TWOHANDED_WIELD, PROC_REF(on_wield)) - RegisterSignal(src, COMSIG_TWOHANDED_UNWIELD, PROC_REF(on_unwield)) AddComponent(/datum/component/two_handed, attacksound='sound/items/cardflip.ogg') register_context() @@ -51,18 +47,6 @@ for(var/person in list("Jack", "Queen", "King")) initial_cards += "[person] of [suit]" -/// triggered on wield of two handed item -/obj/item/toy/cards/deck/proc/on_wield(obj/item/source, mob/user) - SIGNAL_HANDLER - - wielded = TRUE - -/// triggered on unwield of two handed item -/obj/item/toy/cards/deck/proc/on_unwield(obj/item/source, mob/user) - SIGNAL_HANDLER - - wielded = FALSE - /obj/item/toy/cards/deck/suicide_act(mob/living/carbon/user) user.visible_message(span_suicide("[user] is slitting [user.p_their()] wrists with \the [src]! It looks like their luck ran out!")) playsound(src, 'sound/items/cardshuffle.ogg', 50, TRUE) @@ -87,7 +71,7 @@ /obj/item/toy/cards/deck/add_context(atom/source, list/context, obj/item/held_item, mob/living/user) if(src == held_item) var/obj/item/toy/cards/deck/dealer_deck = held_item - context[SCREENTIP_CONTEXT_LMB] = dealer_deck.wielded ? "Recycle mode" : "Dealer mode" + context[SCREENTIP_CONTEXT_LMB] = HAS_TRAIT(dealer_deck, TRAIT_WIELDED) ? "Recycle mode" : "Dealer mode" context[SCREENTIP_CONTEXT_ALT_LMB] = "Shuffle" return CONTEXTUAL_SCREENTIP_SET @@ -161,7 +145,7 @@ /obj/item/toy/cards/deck/AltClick(mob/living/user) if(user.can_perform_action(src, NEED_DEXTERITY|FORBID_TELEKINESIS_REACH)) - if(wielded) + if(HAS_TRAIT(src, TRAIT_WIELDED)) shuffle_cards(user) else to_chat(user, span_notice("You must hold the [src] with both hands to shuffle.")) diff --git a/code/modules/cards/deck/tarot.dm b/code/modules/cards/deck/tarot.dm index ced067c0c39..3dcdc8608c6 100644 --- a/code/modules/cards/deck/tarot.dm +++ b/code/modules/cards/deck/tarot.dm @@ -36,8 +36,16 @@ /// ghost notification cooldown COOLDOWN_DECLARE(ghost_alert_cooldown) -/obj/item/toy/cards/deck/tarot/haunted/on_wield(obj/item/source, mob/living/carbon/user) +/obj/item/toy/cards/deck/tarot/haunted/Initialize(mapload) . = ..() + AddComponent( \ + /datum/component/two_handed, \ + attacksound = 'sound/items/cardflip.ogg', \ + wield_callback = CALLBACK(src, PROC_REF(on_wield)), \ + unwield_callback = CALLBACK(src, PROC_REF(on_unwield)), \ + ) + +/obj/item/toy/cards/deck/tarot/haunted/proc/on_wield(obj/item/source, mob/living/carbon/user) ADD_TRAIT(user, TRAIT_SIXTHSENSE, MAGIC_TRAIT) to_chat(user, span_notice("The veil to the underworld is opened. You can sense the dead souls calling out...")) @@ -54,15 +62,8 @@ action = NOTIFY_ORBIT, ) -/obj/item/toy/cards/deck/tarot/haunted/on_unwield(obj/item/source, mob/living/carbon/user) - . = ..() +/obj/item/toy/cards/deck/tarot/haunted/proc/on_unwield(obj/item/source, mob/living/carbon/user) REMOVE_TRAIT(user, TRAIT_SIXTHSENSE, MAGIC_TRAIT) to_chat(user, span_notice("The veil to the underworld closes shut. You feel your senses returning to normal.")) -/obj/item/toy/cards/deck/tarot/haunted/dropped(mob/living/carbon/user, silent) - . = ..() - if(wielded) - REMOVE_TRAIT(user, TRAIT_SIXTHSENSE, MAGIC_TRAIT) - to_chat(user, span_notice("The veil to the underworld closes shut. You feel your senses returning to normal.")) - #undef TAROT_GHOST_TIMER diff --git a/code/modules/cards/singlecard.dm b/code/modules/cards/singlecard.dm index b918d7708ca..169715c51d9 100644 --- a/code/modules/cards/singlecard.dm +++ b/code/modules/cards/singlecard.dm @@ -78,7 +78,7 @@ if(istype(held_item, /obj/item/toy/cards/deck)) var/obj/item/toy/cards/deck/dealer_deck = held_item - if(dealer_deck.wielded) + if(HAS_TRAIT(dealer_deck, TRAIT_WIELDED)) context[SCREENTIP_CONTEXT_LMB] = "Deal card" context[SCREENTIP_CONTEXT_RMB] = "Deal card faceup" return CONTEXTUAL_SCREENTIP_SET @@ -151,7 +151,7 @@ if(istype(item, /obj/item/toy/cards/deck)) var/obj/item/toy/cards/deck/dealer_deck = item - if(!dealer_deck.wielded) // recycle card into deck (if unwielded) + if(!HAS_TRAIT(dealer_deck, TRAIT_WIELDED)) // recycle card into deck (if unwielded) dealer_deck.insert(src) user.balloon_alert_to_viewers("puts card in deck") return