From 0caf77d27260ca34ff9be2f96917e0e90e9db3ee Mon Sep 17 00:00:00 2001 From: Qwertytoforty <52090703+Qwertytoforty@users.noreply.github.com> Date: Sun, 15 Dec 2024 16:06:48 -0500 Subject: [PATCH] Attack Chain Migration: /obj/item/card (#27556) * the work so far * She returns on my TRUE till I ITEM_INTERACT_SUCCESS * do this too (rip good commit name) * Did you know? You can stamp ID cards! --- code/game/atoms.dm | 2 +- code/game/machinery/doors/airlock.dm | 4 +- code/game/machinery/doors/door.dm | 2 +- code/game/machinery/doors/windowdoor.dm | 2 +- code/game/objects/items/devices/megaphone.dm | 7 +- code/game/objects/items/weapons/AI_modules.dm | 1 + code/game/objects/items/weapons/agent_id.dm | 19 ++-- code/game/objects/items/weapons/cards_ids.dm | 91 ++++++++++--------- .../game/objects/items/weapons/clown_items.dm | 2 + .../objects/items/weapons/grenades/grenade.dm | 3 +- code/modules/economy/economy_machinery/atm.dm | 3 +- .../food_and_drinks/food/foods/pizza.dm | 2 + code/modules/hydroponics/gene_modder.dm | 2 + code/modules/mining/machine_vending.dm | 8 +- .../mob/living/simple_animal/bot/honkbot.dm | 3 +- code/modules/supply/supply_console.dm | 2 +- 16 files changed, 84 insertions(+), 69 deletions(-) diff --git a/code/game/atoms.dm b/code/game/atoms.dm index 0f77644ea66..59548e2a038 100644 --- a/code/game/atoms.dm +++ b/code/game/atoms.dm @@ -586,7 +586,7 @@ return /atom/proc/cmag_act(mob/user) - return + return FALSE /atom/proc/uncmag() return diff --git a/code/game/machinery/doors/airlock.dm b/code/game/machinery/doors/airlock.dm index a00ac74e8d2..837ecea566f 100644 --- a/code/game/machinery/doors/airlock.dm +++ b/code/game/machinery/doors/airlock.dm @@ -1396,12 +1396,12 @@ GLOBAL_LIST_EMPTY(airlock_emissive_underlays) /obj/machinery/door/airlock/cmag_act(mob/user) if(operating || HAS_TRAIT(src, TRAIT_CMAGGED) || !density || !arePowerSystemsOn()) - return + return FALSE operating = DOOR_MALF update_icon(AIRLOCK_EMAG, 1) sleep(6) if(QDELETED(src)) - return + return FALSE operating = NONE update_icon(AIRLOCK_CLOSED, 1) ADD_TRAIT(src, TRAIT_CMAGGED, CLOWN_EMAG) diff --git a/code/game/machinery/doors/door.dm b/code/game/machinery/doors/door.dm index 7307e20e5d2..2c1ce8187f7 100644 --- a/code/game/machinery/doors/door.dm +++ b/code/game/machinery/doors/door.dm @@ -306,7 +306,7 @@ /obj/machinery/door/cmag_act(mob/user) if(!density) - return + return FALSE flick("door_spark", src) sleep(6) //The cmag doesn't automatically open doors. It inverts access, not provides it! ADD_TRAIT(src, TRAIT_CMAGGED, CLOWN_EMAG) diff --git a/code/game/machinery/doors/windowdoor.dm b/code/game/machinery/doors/windowdoor.dm index c0f7bac9d8f..8169b96246a 100644 --- a/code/game/machinery/doors/windowdoor.dm +++ b/code/game/machinery/doors/windowdoor.dm @@ -295,7 +295,7 @@ /obj/machinery/door/window/cmag_act(mob/user, obj/weapon) if(operating || !density || HAS_TRAIT(src, TRAIT_CMAGGED)) - return + return FALSE ADD_TRAIT(src, TRAIT_CMAGGED, CLOWN_EMAG) operating = DOOR_MALF flick("[base_state]spark", src) diff --git a/code/game/objects/items/devices/megaphone.dm b/code/game/objects/items/devices/megaphone.dm index 99c3143a414..12bbbb31bc7 100644 --- a/code/game/objects/items/devices/megaphone.dm +++ b/code/game/objects/items/devices/megaphone.dm @@ -89,18 +89,19 @@ /obj/item/megaphone/cmag_act(mob/user) if(HAS_TRAIT(src, TRAIT_CMAGGED)) - return + return FALSE if(user) to_chat(user, "You drip some yellow ooze into [src]'s voice synthesizer, gunking it up.") playsound(src, "sparks", 75, TRUE, SHORT_RANGE_SOUND_EXTRARANGE) ADD_TRAIT(src, TRAIT_CMAGGED, CLOWN_EMAG) + return TRUE /obj/item/megaphone/emag_act(mob/user) if(emagged) - return + return FALSE if(HAS_TRAIT(src, TRAIT_CMAGGED)) // one at a time to_chat(user, "You go to short out [src], but it's covered in yellow ooze! You don't want to gunk up your emag!") - return + return FALSE to_chat(user, "You short out [src]'s dampener circuits.") emagged = TRUE span = "reallybig userdanger" // really obvious, but also really loud diff --git a/code/game/objects/items/weapons/AI_modules.dm b/code/game/objects/items/weapons/AI_modules.dm index 91e8d090404..4ec71d49dbf 100755 --- a/code/game/objects/items/weapons/AI_modules.dm +++ b/code/game/objects/items/weapons/AI_modules.dm @@ -302,6 +302,7 @@ AI MODULES to_chat(user, "Yellow ooze seeps into [src]'s circuits...") new /obj/item/ai_module/pranksimov(user.loc) qdel(src) + return TRUE /******************* Quarantine ********************/ /obj/item/ai_module/quarantine diff --git a/code/game/objects/items/weapons/agent_id.dm b/code/game/objects/items/weapons/agent_id.dm index 31de21cca64..5eea728393b 100644 --- a/code/game/objects/items/weapons/agent_id.dm +++ b/code/game/objects/items/weapons/agent_id.dm @@ -50,16 +50,16 @@ icon_state = "syndie" assignment = "Syndicate Overlord" untrackable = TRUE + can_id_flash = FALSE //This can ID flash, this just prevents it from always flashing. access = list(ACCESS_SYNDICATE, ACCESS_SYNDICATE_LEADER, ACCESS_SYNDICATE_COMMAND, ACCESS_EXTERNAL_AIRLOCKS) -/obj/item/card/id/syndicate/afterattack__legacy__attackchain(atom/target, mob/user, proximity_flag, params) - if(!proximity_flag) - return +/obj/item/card/id/syndicate/interact_with_atom(atom/target, mob/living/user, list/modifiers) if(istype(target, /obj/item/card/id)) var/obj/item/card/id/I = target if(isliving(user) && user?.mind?.special_role) to_chat(usr, "The card's microscanners activate as you pass it over [I], copying its access.") access |= I.access //Don't copy access if user isn't an antag -- to prevent metagaming + return ITEM_INTERACT_SUCCESS /obj/item/card/id/syndicate/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state) if(..()) @@ -127,8 +127,8 @@ ui = new(user, src, "AgentCard", name) ui.open() -/obj/item/card/id/syndicate/attack_self__legacy__attackchain(mob/user) - if(!ishuman(user)) +/obj/item/card/id/syndicate/activate_self(mob/user) + if(..() || !ishuman(user)) return if(!registered_human) registered_human = user @@ -289,12 +289,11 @@ if(isAntag(user)) . += "Similar to an agent ID, this ID card can be used to copy accesses, but it lacks the customization and anti-tracking capabilities of an agent ID." -/obj/item/card/id/syndi_scan_only/afterattack__legacy__attackchain(atom/O, mob/user, proximity_flag, params) - if(!proximity_flag) - return - if(istype(O, /obj/item/card/id)) - var/obj/item/card/id/I = O +/obj/item/card/id/syndi_scan_only/interact_with_atom(atom/target, mob/living/user, list/modifiers) + if(istype(target, /obj/item/card/id)) + var/obj/item/card/id/I = target if(isliving(user) && user.mind) if(user.mind.special_role) to_chat(user, "The card's microscanners activate as you pass it over [I], copying its access.") access |= I.access // Don't copy access if user isn't an antag -- to prevent metagaming + return ITEM_INTERACT_SUCCESS diff --git a/code/game/objects/items/weapons/cards_ids.dm b/code/game/objects/items/weapons/cards_ids.dm index 716ed73ca83..84095575f3e 100644 --- a/code/game/objects/items/weapons/cards_ids.dm +++ b/code/game/objects/items/weapons/cards_ids.dm @@ -11,6 +11,7 @@ desc = "A card." icon = 'icons/obj/card.dmi' w_class = WEIGHT_CLASS_TINY + new_attack_chain = TRUE var/associated_account_number = 0 var/list/files = list() @@ -38,14 +39,13 @@ flags = NOBLUDGEON flags_2 = NO_MAT_REDEMPTION_2 -/obj/item/card/emag/attack__legacy__attackchain() - return +/obj/item/card/emag/pre_attack(atom/target, mob/living/user, params) + if(..() || ismob(target)) + return FINISH_ATTACK -/obj/item/card/emag/afterattack__legacy__attackchain(atom/target, mob/user, proximity) - var/atom/A = target - if(!proximity) - return - A.emag_act(user) +/obj/item/card/emag/interact_with_atom(atom/target, mob/living/user, list/modifiers) + if(target.emag_act(user)) + return ITEM_INTERACT_SUCCESS /obj/item/card/emag/magic_key name = "magic key" @@ -53,14 +53,15 @@ icon_state = "magic_key" origin_tech = "magnets=2" -/obj/item/card/emag/magic_key/afterattack__legacy__attackchain(atom/target, mob/user, proximity) +/obj/item/card/emag/magic_key/interact_with_atom(atom/target, mob/living/user, list/modifiers) if(!isairlock(target)) - return + return ITEM_INTERACT_BLOCKING var/obj/machinery/door/D = target D.locked = FALSE - update_icon() - . = ..() + D.update_icon() + D.emag_act(user) qdel(src) + return ITEM_INTERACT_SUCCESS /obj/item/card/cmag desc = "It's a card coated in a slurry of electromagnetic bananium." @@ -75,13 +76,13 @@ . = ..() AddComponent(/datum/component/slippery, src, 16 SECONDS, 100) -/obj/item/card/cmag/attack__legacy__attackchain() - return +/obj/item/card/cmag/pre_attack(atom/target, mob/living/user, params) + if(..() || ismob(target)) + return FINISH_ATTACK -/obj/item/card/cmag/afterattack__legacy__attackchain(atom/target, mob/user, proximity) - if(!proximity) - return - target.cmag_act(user) +/obj/item/card/cmag/interact_with_atom(atom/target, mob/living/user, list/modifiers) + if(target.cmag_act(user)) + return ITEM_INTERACT_SUCCESS /obj/item/card/id name = "identification card" @@ -117,6 +118,9 @@ var/dat var/stamped = 0 + /// Can we flash the ID? + var/can_id_flash = TRUE + var/obj/item/card/id/guest/guest_pass = null // Guest pass attached to the ID /obj/item/card/id/New() @@ -151,13 +155,11 @@ popup.set_content(dat) popup.open() -/obj/item/card/id/attack_self__legacy__attackchain(mob/user as mob) - user.visible_message("[user] shows you: [bicon(src)] [name]. The assignment on the card: [assignment]",\ - "You flash your ID card: [bicon(src)] [name]. The assignment on the card: [assignment]") - if(mining_points) - to_chat(user, "There's [mining_points] Mining Points loaded onto this card. This card has earned [total_mining_points] Mining Points this Shift!") - add_fingerprint(user) - return +/obj/item/card/id/activate_self(mob/user) + if(..()) + return + if(can_id_flash) + flash_card(user) /obj/item/card/id/proc/UpdateName() name = "[registered_name]'s ID Card ([assignment])" @@ -251,11 +253,9 @@ /obj/item/card/id/proc/get_departments() return get_departments_from_job(rank) -/obj/item/card/id/attackby__legacy__attackchain(obj/item/W as obj, mob/user as mob, params) - ..() - - if(istype(W, /obj/item/id_decal/)) - var/obj/item/id_decal/decal = W +/obj/item/card/id/item_interaction(mob/living/user, obj/item/used, list/modifiers) + if(istype(used, /obj/item/id_decal/)) + var/obj/item/id_decal/decal = used to_chat(user, "You apply [decal] to [src].") if(decal.override_name) name = decal.decal_name @@ -263,25 +263,28 @@ icon_state = decal.decal_icon_state item_state = decal.decal_item_state qdel(decal) - qdel(W) - return + qdel(used) + return ITEM_INTERACT_SUCCESS - else if(istype(W, /obj/item/barcodescanner)) - var/obj/item/barcodescanner/B = W + else if(istype(used, /obj/item/barcodescanner)) + var/obj/item/barcodescanner/B = used B.scanID(src, user) - return + return ITEM_INTERACT_SUCCESS - else if(istype (W,/obj/item/stamp)) + else if(istype(used, /obj/item/stamp)) if(!stamped) - dat+="" + dat+="" stamped = 1 to_chat(user, "You stamp the ID card!") playsound(user, 'sound/items/handling/standard_stamp.ogg', 50, vary = TRUE) - else - to_chat(user, "This ID has already been stamped!") + return ITEM_INTERACT_SUCCESS + to_chat(user, "This ID has already been stamped!") + return ITEM_INTERACT_BLOCKING - else if(istype(W, /obj/item/card/id/guest)) - attach_guest_pass(W, user) + + else if(istype(used, /obj/item/card/id/guest)) + attach_guest_pass(used, user) + return ITEM_INTERACT_SUCCESS /obj/item/card/id/AltClick(mob/user) if(user.stat || HAS_TRAIT(user, TRAIT_HANDS_BLOCKED) || !Adjacent(user)) @@ -749,9 +752,12 @@ desc = "A card used to claim mining points and buy gear. Use it to mark it as yours." icon_state = "research" access = list(ACCESS_FREE_GOLEMS, ACCESS_ROBOTICS, ACCESS_CLOWN, ACCESS_MIME, ACCESS_XENOBIOLOGY) //access to robots/mechs + can_id_flash = FALSE //So you do not flash it the first time you use it. var/registered = FALSE -/obj/item/card/id/golem/attack_self__legacy__attackchain(mob/user as mob) +/obj/item/card/id/golem/activate_self(mob/user) + if(..()) + return if(!registered && ishuman(user)) registered_name = user.real_name SetOwnerInfo(user) @@ -760,9 +766,8 @@ UpdateName() desc = "A card used to claim mining points and buy gear." registered = TRUE + can_id_flash = TRUE to_chat(user, "The ID is now registered as yours.") - else - ..() /obj/item/card/id/data icon_state = "data" diff --git a/code/game/objects/items/weapons/clown_items.dm b/code/game/objects/items/weapons/clown_items.dm index 1aa6d6ba990..599f9ee97d5 100644 --- a/code/game/objects/items/weapons/clown_items.dm +++ b/code/game/objects/items/weapons/clown_items.dm @@ -95,6 +95,8 @@ if(!HAS_TRAIT(src, TRAIT_CMAGGED)) to_chat(user, "Winding back speed has been improved by the bananium ooze!") ADD_TRAIT(src, TRAIT_CMAGGED, CLOWN_EMAG) + return TRUE + return FALSE #undef LAUGH_COOLDOWN #undef LAUGH_COOLDOWN_CMAG diff --git a/code/game/objects/items/weapons/grenades/grenade.dm b/code/game/objects/items/weapons/grenades/grenade.dm index eb6015b3835..29dad811abd 100644 --- a/code/game/objects/items/weapons/grenades/grenade.dm +++ b/code/game/objects/items/weapons/grenades/grenade.dm @@ -117,10 +117,11 @@ /obj/item/grenade/cmag_act(mob/user) if(HAS_TRAIT(src, TRAIT_CMAGGED)) - return + return FALSE ADD_TRAIT(src, TRAIT_CMAGGED, "cmagged grenade") to_chat(user, "You drip some yellow ooze into [src]. [src] suddenly doesn't want to leave you...") AddComponent(/datum/component/boomerang, throw_range, TRUE) + return TRUE /obj/item/grenade/uncmag() if(!HAS_TRAIT(src, TRAIT_CMAGGED)) diff --git a/code/modules/economy/economy_machinery/atm.dm b/code/modules/economy/economy_machinery/atm.dm index 3481fe02895..b55c28d3d74 100644 --- a/code/modules/economy/economy_machinery/atm.dm +++ b/code/modules/economy/economy_machinery/atm.dm @@ -315,10 +315,11 @@ /obj/machinery/economy/atm/cmag_act(mob/user) if(HAS_TRAIT(src, TRAIT_CMAGGED)) - return + return FALSE playsound(src, "sparks", 75, TRUE, SHORT_RANGE_SOUND_EXTRARANGE) to_chat(user, "Yellow ooze seeps into the [src]'s card slot...") ADD_TRAIT(src, TRAIT_CMAGGED, CLOWN_EMAG) + return TRUE /obj/machinery/economy/atm/examine(mob/user) . = ..() diff --git a/code/modules/food_and_drinks/food/foods/pizza.dm b/code/modules/food_and_drinks/food/foods/pizza.dm index a6dc899d744..ea384ed02fe 100644 --- a/code/modules/food_and_drinks/food/foods/pizza.dm +++ b/code/modules/food_and_drinks/food/foods/pizza.dm @@ -575,6 +575,8 @@ if(!HAS_TRAIT(src, TRAIT_CMAGGED)) to_chat(user, "You smear the bananium ooze all over the pizza bomb's internals! You think you smell a bit of tomato sauce.") ADD_TRAIT(src, TRAIT_CMAGGED, CLOWN_EMAG) + return TRUE + return FALSE /obj/item/pizzabox/pizza_bomb/attackby__legacy__attackchain(obj/item/I, mob/user, params) if(!open) diff --git a/code/modules/hydroponics/gene_modder.dm b/code/modules/hydroponics/gene_modder.dm index 1993e781e17..65942a37864 100644 --- a/code/modules/hydroponics/gene_modder.dm +++ b/code/modules/hydroponics/gene_modder.dm @@ -669,6 +669,8 @@ ADD_TRAIT(src, TRAIT_CMAGGED, CLOWN_EMAG) update_appearance(UPDATE_NAME|UPDATE_DESC|UPDATE_ICON) playsound(src, "sparks", 75, TRUE, SHORT_RANGE_SOUND_EXTRARANGE) + return TRUE + return FALSE /obj/item/disk/plantgene/uncmag() update_appearance(UPDATE_NAME|UPDATE_DESC|UPDATE_ICON) diff --git a/code/modules/mining/machine_vending.dm b/code/modules/mining/machine_vending.dm index 590973ad7e5..d434bb35a4d 100644 --- a/code/modules/mining/machine_vending.dm +++ b/code/modules/mining/machine_vending.dm @@ -501,16 +501,16 @@ icon_state = "data" var/points = 500 -/obj/item/card/mining_point_card/attackby__legacy__attackchain(obj/item/I, mob/user, params) - if(istype(I, /obj/item/card/id)) +/obj/item/card/mining_point_card/item_interaction(mob/living/user, obj/item/used, list/modifiers) + if(istype(used, /obj/item/card/id)) if(points) - var/obj/item/card/id/C = I + var/obj/item/card/id/C = used C.mining_points += points to_chat(user, "You transfer [points] points to [C].") points = 0 else to_chat(user, "There's no points left on [src].") - ..() + return ITEM_INTERACT_SUCCESS /obj/item/card/mining_point_card/examine(mob/user) . = ..() diff --git a/code/modules/mob/living/simple_animal/bot/honkbot.dm b/code/modules/mob/living/simple_animal/bot/honkbot.dm index d7736b24c20..20652fdb801 100644 --- a/code/modules/mob/living/simple_animal/bot/honkbot.dm +++ b/code/modules/mob/living/simple_animal/bot/honkbot.dm @@ -132,7 +132,7 @@ /mob/living/simple_animal/bot/honkbot/cmag_act(mob/user) if(HAS_TRAIT(src, TRAIT_CMAGGED)) - return + return FALSE if(locked || !open) to_chat(user, "Unlock and open it with a screwdriver first!") return FALSE @@ -147,6 +147,7 @@ to_chat(user, "You smear bananium ooze all over [src]'s circuitry!") add_attack_logs(user, src, "Cmagged") show_laws() + return TRUE /mob/living/simple_animal/bot/honkbot/examine(mob/user) . = ..() diff --git a/code/modules/supply/supply_console.dm b/code/modules/supply/supply_console.dm index 337e10fd411..eb371ac7cc2 100644 --- a/code/modules/supply/supply_console.dm +++ b/code/modules/supply/supply_console.dm @@ -518,7 +518,7 @@ /obj/machinery/computer/supplycomp/cmag_act(mob/user) if(HAS_TRAIT(src, TRAIT_CMAGGED)) - return + return FALSE to_chat(user, "Special supplies unlocked.") playsound(src, "sparks", 75, TRUE, SHORT_RANGE_SOUND_EXTRARANGE) ADD_TRAIT(src, TRAIT_CMAGGED, CLOWN_EMAG)