From d030b8afb8b60a0cf871007d446536c1534ba719 Mon Sep 17 00:00:00 2001 From: CRUNCH <143041327+CRUNCH-Borg@users.noreply.github.com> Date: Thu, 2 Apr 2026 03:32:15 +0100 Subject: [PATCH] Migrates `/obj/item/stack` to the new attack chain (#31709) * e * stuff not in the stack folder * A * Update gift_wrappaper.dm * golg * dancing around SHOULD_NOT_SLEEP and storage still being legacy * Update asteroid_floors.dm * Update medical_packs.dm * Update medical_packs.dm --- code/game/objects/items/caution.dm | 17 +- .../objects/items/stacks/medical_packs.dm | 223 ++++++++++-------- code/game/objects/items/stacks/nanopaste.dm | 90 ++++--- code/game/objects/items/stacks/seaweed.dm | 5 +- .../game/objects/items/stacks/sheets/glass.dm | 47 ++-- .../objects/items/stacks/sheets/leather.dm | 208 +++++++++------- .../game/objects/items/stacks/sheets/light.dm | 30 ++- .../objects/items/stacks/sheets/mineral.dm | 31 +-- .../items/stacks/sheets/sheet_types.dm | 28 +-- code/game/objects/items/stacks/stack.dm | 95 ++++---- .../objects/items/stacks/synthetic_skin.dm | 17 +- code/game/objects/items/stacks/telecrystal.dm | 55 +++-- code/game/objects/items/tape.dm | 56 +++-- .../objects/items/weapons/gift_wrappaper.dm | 4 +- .../turfs/simulated/floor/asteroid_floors.dm | 2 +- code/modules/arcade/arcade_prize.dm | 5 +- code/modules/hydroponics/grown/cotton.dm | 2 +- .../mining/equipment/marker_beacons.dm | 12 +- code/modules/power/cables/cable_coil.dm | 61 +++-- code/modules/telesci/bscrystal.dm | 5 +- 20 files changed, 559 insertions(+), 434 deletions(-) diff --git a/code/game/objects/items/caution.dm b/code/game/objects/items/caution.dm index 88a4595ab30..86ad22eab42 100644 --- a/code/game/objects/items/caution.dm +++ b/code/game/objects/items/caution.dm @@ -76,23 +76,22 @@ energy_type = /datum/robot_storage/energy/jani_landmine is_cyborg = TRUE -/obj/item/stack/caution/proximity_sign/malf/afterattack__legacy__attackchain(atom/target, mob/user, proximity) +/obj/item/stack/caution/proximity_sign/malf/interact_with_atom(atom/target, mob/living/user, list/modifiers) if(!check_allowed_items(target, 1)) - return - if(!proximity) - return - var/turf/T = get_turf(target) + return ITEM_INTERACT_COMPLETE + var/turf/T = get_turf(target) if(T.is_blocked_turf(exclude_mobs = TRUE)) //can't put mines on a tile that has dense stuff to_chat(user, SPAN_NOTICE("The space is occupied! You cannot place a mine there!")) - return + return ITEM_INTERACT_COMPLETE + if(!use(1)) //Can't place a landmine if you don't have a landmine to_chat(user, SPAN_NOTICE("[src] is out of landmines! It can be refilled at a cyborg charger.")) - return + return ITEM_INTERACT_COMPLETE + playsound(src.loc, 'sound/machines/click.ogg', 20, TRUE) var/obj/item/caution/proximity_sign/M = new /obj/item/caution/proximity_sign(get_turf(target), src) M.timing = TRUE START_PROCESSING(SSobj, M) to_chat(user, SPAN_NOTICE("You place a landmine with [src]. You have 15 seconds until it is armed.")) - return M - + return ITEM_INTERACT_COMPLETE diff --git a/code/game/objects/items/stacks/medical_packs.dm b/code/game/objects/items/stacks/medical_packs.dm index f92da44586c..3a329bc4d16 100644 --- a/code/game/objects/items/stacks/medical_packs.dm +++ b/code/game/objects/items/stacks/medical_packs.dm @@ -20,67 +20,81 @@ if(get_amount() <= 0) if(is_cyborg) to_chat(user, SPAN_WARNING("You don't have enough energy to dispense more [singular_name]\s!")) - return TRUE + return FALSE if(!iscarbon(M) && !isanimal_or_basicmob(M)) to_chat(user, SPAN_DANGER("[src] cannot be applied to [M]!")) - return TRUE + return FALSE if(!user.IsAdvancedToolUser()) to_chat(user, SPAN_DANGER("You don't have the dexterity to do this!")) - return TRUE - + return FALSE if(ishuman(M)) var/mob/living/carbon/human/H = M var/obj/item/organ/external/affecting = H.get_organ(user.zone_selected) if(!H.can_inject(user, TRUE)) - return TRUE + return FALSE if(!affecting) to_chat(user, SPAN_DANGER("That limb is missing!")) - return TRUE + return FALSE if(affecting.is_robotic()) to_chat(user, SPAN_DANGER("This can't be used on a robotic limb.")) - return TRUE + return FALSE if(M == user && !unique_handling) user.visible_message(SPAN_NOTICE("[user] starts to apply [src] on [H]...")) if(!do_mob(user, H, delay)) - return TRUE - return + return FALSE + + return TRUE if(isanimal_or_basicmob(M)) var/mob/living/critter = M if(!(critter.healable)) to_chat(user, SPAN_NOTICE("You cannot use [src] on [critter]!")) - return - else if(critter.health == critter.maxHealth) + return FALSE + + if(critter.health == critter.maxHealth) to_chat(user, SPAN_NOTICE("[critter] is at full health.")) - return - else if(heal_brute < 1) + return FALSE + + if(heal_brute < 1) to_chat(user, SPAN_NOTICE("[src] won't help [critter] at all.")) - return + return FALSE critter.heal_organ_damage(heal_brute, heal_burn) - user.visible_message(SPAN_GREEN("[user] applies [src] on [critter]."), \ - SPAN_GREEN("You apply [src] on [critter].")) - + user.visible_message( + SPAN_GREEN("[user] applies [src] on [critter]."), + SPAN_GREEN("You apply [src] on [critter].") + ) use(1) + return TRUE - else - M.heal_organ_damage(heal_brute, heal_burn) - user.visible_message(SPAN_GREEN("[user] applies [src] on [M]."), \ - SPAN_GREEN("You apply [src] on [M].")) - use(1) + M.heal_organ_damage(heal_brute, heal_burn) + user.visible_message( + SPAN_GREEN("[user] applies [src] on [M]."), + SPAN_GREEN("You apply [src] on [M].") + ) + use(1) + return TRUE -/obj/item/stack/medical/attack__legacy__attackchain(mob/living/M, mob/user) - return apply(M, user) +/obj/item/stack/medical/interact_with_atom(atom/target, mob/living/user, list/modifiers) + if(!ismob(target)) + return ..() -/obj/item/stack/medical/attack_self__legacy__attackchain(mob/user) - return apply(user, user) + apply(target, user) + return ITEM_INTERACT_COMPLETE + +/obj/item/stack/medical/activate_self(mob/user) + if(..()) + return ITEM_INTERACT_COMPLETE + + apply(user, user) + return ITEM_INTERACT_COMPLETE /obj/item/stack/medical/proc/heal(mob/living/M, mob/user) var/mob/living/carbon/human/H = M @@ -134,40 +148,45 @@ stop_bleeding = 1800 dynamic_icon_state = TRUE -/obj/item/stack/medical/bruise_pack/attackby__legacy__attackchain(obj/item/I, mob/user, params) - if(I.sharp) +/obj/item/stack/medical/bruise_pack/item_interaction(mob/living/user, obj/item/used, list/modifiers) + if(used.sharp) if(get_amount() < 2) to_chat(user, SPAN_WARNING("You need at least two gauzes to do this!")) - return + return ITEM_INTERACT_COMPLETE + new /obj/item/stack/sheet/cloth(user.drop_location()) - user.visible_message("[user] cuts [src] into pieces of cloth with [I].", \ - SPAN_NOTICE("You cut [src] into pieces of cloth with [I]."), \ - SPAN_ITALICS("You hear cutting.")) + user.visible_message( + SPAN_NOTICE("[user] cuts [src] into pieces of cloth with [used]."), + SPAN_NOTICE("You cut [src] into pieces of cloth with [used]."), + SPAN_ITALICS("You hear cutting.") + ) use(2) - else - return ..() + return ITEM_INTERACT_COMPLETE + + return ..() /obj/item/stack/medical/bruise_pack/apply(mob/living/M, mob/user) - if(..()) - return TRUE + if(!..()) + return FALSE - if(ishuman(M)) - var/mob/living/carbon/human/H = M - var/obj/item/organ/external/affecting = H.get_organ(user.zone_selected) - for(var/obj/item/organ/external/E in H.bodyparts) - if(E.open >= ORGAN_ORGANIC_OPEN) - to_chat(user, SPAN_WARNING("[E] is cut open, you'll need more than a bandage!")) - return - affecting.germ_level = 0 + if(!ishuman(M)) + return FALSE - if(stop_bleeding) - if(!H.bleedsuppress) //so you can't stack bleed suppression - H.suppress_bloodloss(stop_bleeding) + var/mob/living/carbon/human/H = M + var/obj/item/organ/external/affecting = H.get_organ(user.zone_selected) + for(var/obj/item/organ/external/E in H.bodyparts) + if(E.open >= ORGAN_ORGANIC_OPEN) + to_chat(user, SPAN_WARNING("[E] is cut open, you'll need more than a bandage!")) + return FALSE - heal(H, user) - - H.UpdateDamageIcon() - use(1) + affecting.germ_level = 0 + if(stop_bleeding) + if(!H.bleedsuppress) //so you can't stack bleed suppression + H.suppress_bloodloss(stop_bleeding) + heal(H, user) + H.UpdateDamageIcon() + use(1) + return TRUE /obj/item/stack/medical/bruise_pack/improvised name = "improvised gauze" @@ -214,22 +233,21 @@ merge_type = /obj/item/stack/medical/ointment /obj/item/stack/medical/ointment/apply(mob/living/M, mob/user) - if(..()) - return 1 + ..() + if(!ishuman(M)) + return TRUE - if(ishuman(M)) - var/mob/living/carbon/human/H = M - var/obj/item/organ/external/affecting = H.get_organ(user.zone_selected) + var/mob/living/carbon/human/H = M + var/obj/item/organ/external/affecting = H.get_organ(user.zone_selected) + if(affecting.open >= ORGAN_ORGANIC_OPEN) + to_chat(user, SPAN_WARNING("[affecting] is cut open, you'll need more than some ointment!")) + return TRUE - if(affecting.open == ORGAN_CLOSED) - affecting.germ_level = 0 - - heal(H, user) - - H.UpdateDamageIcon() - use(1) - else - to_chat(user, SPAN_WARNING("[affecting] is cut open, you'll need more than some ointment!")) + affecting.germ_level = 0 + heal(H, user) + H.UpdateDamageIcon() + use(1) + return TRUE /obj/item/stack/medical/ointment/heal(mob/living/M, mob/user) var/obj/item/organ/external/affecting = ..() @@ -313,39 +331,44 @@ var/other_delay = 0 /obj/item/stack/medical/splint/apply(mob/living/M, mob/user) - if(..()) - return TRUE + if(!..()) + return FALSE - if(ishuman(M)) - var/mob/living/carbon/human/H = M - var/obj/item/organ/external/affecting = H.get_organ(user.zone_selected) - var/limb = affecting.name + if(!ishuman(M)) + return FALSE - if(affecting.status & ORGAN_SPLINTED) - to_chat(user, SPAN_DANGER("[H]'s [limb] is already splinted!")) - if(tgui_alert(user, "Would you like to remove the splint from [H]'s [limb]?", "Splint removal", list("Yes", "No")) == "Yes") - affecting.status &= ~ORGAN_SPLINTED - H.handle_splints() - to_chat(user, SPAN_NOTICE("You remove the splint from [H]'s [limb].")) - return TRUE + var/mob/living/carbon/human/H = M + var/obj/item/organ/external/affecting = H.get_organ(user.zone_selected) + var/limb = affecting.name + if(affecting.status & ORGAN_SPLINTED) + to_chat(user, SPAN_DANGER("[H]'s [limb] is already splinted!")) + if(tgui_alert(user, "Would you like to remove the splint from [H]'s [limb]?", "Splint removal", list("Yes", "No")) == "Yes") + affecting.status &= ~ORGAN_SPLINTED + H.handle_splints() + to_chat(user, SPAN_NOTICE("You remove the splint from [H]'s [limb].")) + return FALSE - if((M == user && delay > 0) || (M != user && other_delay > 0)) - user.visible_message(SPAN_NOTICE("[user] starts to apply [src] to [H]'s [limb]."), \ - SPAN_NOTICE("You start to apply [src] to [H]'s [limb]."), \ - SPAN_NOTICE("You hear something being wrapped.")) + if((M == user && delay > 0) || (M != user && other_delay > 0)) + user.visible_message( + SPAN_NOTICE("[user] starts to apply [src] to [H]'s [limb]."), + SPAN_NOTICE("You start to apply [src] to [H]'s [limb]."), + SPAN_NOTICE("You hear something being wrapped.") + ) + if(M == user && !do_mob(user, H, delay)) + return FALSE - if(M == user && !do_mob(user, H, delay)) - return TRUE - else if(!do_mob(user, H, other_delay)) - return TRUE + if(!do_mob(user, H, other_delay)) + return FALSE - user.visible_message(SPAN_NOTICE("[user] applies [src] to [H]'s [limb]."), \ - SPAN_NOTICE("You apply [src] to [H]'s [limb].")) - - affecting.status |= ORGAN_SPLINTED - affecting.splinted_count = H.step_count - H.handle_splints() - use(1) + user.visible_message( + SPAN_NOTICE("[user] applies [src] to [H]'s [limb]."), + SPAN_NOTICE("You apply [src] to [H]'s [limb].") + ) + affecting.status |= ORGAN_SPLINTED + affecting.splinted_count = H.step_count + H.handle_splints() + use(1) + return TRUE /obj/item/stack/medical/splint/cyborg energy_type = /datum/robot_storage/energy/medical/splint @@ -455,29 +478,33 @@ if(.) qdel(target_needle) -/obj/item/stack/medical/suture/attackby__legacy__attackchain(obj/item/thing, mob/user, params) - if(!can_merge(thing, TRUE)) +/obj/item/stack/medical/suture/item_interaction(mob/living/user, obj/item/used, list/modifiers) + if(!can_merge(used, TRUE)) return ..() - var/obj/item/stack/material = thing + var/obj/item/stack/material = used var/merge_amount = merge(material) if(merge_amount) if(istype(material)) merge_amount = material.get_amount() to_chat(user, SPAN_NOTICE("Your [material.name] stack now contains [merge_amount] [singular_name]\s.")) + return ITEM_INTERACT_COMPLETE /obj/item/stack/medical/suture/apply(mob/living/carbon/human/target, mob/user) - . = TRUE + . = FALSE if(current_target) if(current_target != target) to_chat(user, SPAN_WARNING("You're already suturing [current_target].")) return + // Allow for cancelling of the target by clicking again interrupt_do_after_once(user, current_target) to_chat(user, SPAN_WARNING("You stop [healverb] [target.i_yourself(user)].")) return + if(!ishuman(target) || !target.can_inject(user, TRUE)) return + var/heal_type = (heal_brute ? BRUTE : BURN) var/heal_display = (heal_brute ? BRUTE : "burn") if(!target.get_damage_amount(heal_type)) @@ -488,9 +515,11 @@ if(!current_limb) to_chat(user, SPAN_WARNING("That limb is missing!")) return + if(current_limb.is_robotic()) to_chat(user, SPAN_WARNING("This can't be used on a robotic limb.")) return + // Swap to another limb if the current one has no damage. if(!most_damaged_limb(target)) to_chat(user, SPAN_WARNING("[target.i_you(user, TRUE)] [target.i_do(user)]n't have any [heal_display] damage that could be [healverb_past].")) diff --git a/code/game/objects/items/stacks/nanopaste.dm b/code/game/objects/items/stacks/nanopaste.dm index 17113d5023b..47902a9df36 100644 --- a/code/game/objects/items/stacks/nanopaste.dm +++ b/code/game/objects/items/stacks/nanopaste.dm @@ -11,49 +11,63 @@ max_amount = 6 merge_type = /obj/item/stack/nanopaste -/obj/item/stack/nanopaste/attack__legacy__attackchain(mob/living/M as mob, mob/user as mob) - if(!istype(M) || !istype(user)) - return 0 - if(isrobot(M)) //Repairing cyborgs - var/mob/living/silicon/robot/R = M - if(R.getBruteLoss() || R.getFireLoss()) +/obj/item/stack/nanopaste/interact_with_atom(atom/target, mob/living/user, list/modifiers) + if(ismob(target)) + if(isrobot(target)) // Repairing cyborgs. + var/mob/living/silicon/robot/R = target + if(!R.getBruteLoss() && !R.getFireLoss()) + to_chat(user, SPAN_NOTICE("All [R]'s systems are nominal.")) + return ITEM_INTERACT_COMPLETE + R.heal_overall_damage(15, 15) use(1) - user.visible_message(SPAN_NOTICE("[user] applies some [src] at [R]'s damaged areas."),\ - SPAN_NOTICE("You apply some [src] at [R]'s damaged areas.")) - else - to_chat(user, SPAN_NOTICE("All [R]'s systems are nominal.")) + user.visible_message( + SPAN_NOTICE("[user] applies some [src] at [R]'s damaged areas."), + SPAN_NOTICE("You apply some [src] at [R]'s damaged areas.") + ) + return ITEM_INTERACT_COMPLETE - if(ishuman(M)) //Repairing robotic limbs and IPCs - var/mob/living/carbon/human/H = M - var/obj/item/organ/external/external_limb = H.get_organ(user.zone_selected) + if(ishuman(target)) // Repairing robotic limbs and IPCs. + var/mob/living/carbon/human/H = target + var/obj/item/organ/external/external_limb = H.get_organ(user.zone_selected) + if(!external_limb) + to_chat(user, SPAN_WARNING("[H] is missing that limb!")) + return ITEM_INTERACT_COMPLETE + + if(!external_limb.is_robotic()) + to_chat(user, SPAN_WARNING("That limb is not robotic!")) + return ITEM_INTERACT_COMPLETE - if(external_limb && external_limb.is_robotic()) robotic_limb_repair(user, external_limb, H) - else - to_chat(user, SPAN_NOTICE("[src] won't work on that.")) + return ITEM_INTERACT_COMPLETE -/obj/item/stack/nanopaste/afterattack__legacy__attackchain(atom/A, mob/user, proximity_flag) - if(!ismecha(A) || user.a_intent == INTENT_HARM || !proximity_flag) - return - var/obj/mecha/mecha = A - if((mecha.obj_integrity >= mecha.max_integrity) && !mecha.internal_damage) - to_chat(user, SPAN_NOTICE("[mecha] is at full integrity!")) - return - if(mecha.state == MECHA_MAINT_OFF) - to_chat(user, SPAN_WARNING("[mecha] cannot be repaired without maintenance protocols active!")) - return - if(mecha.repairing) - to_chat(user, SPAN_NOTICE("[mecha] is currently being repaired!")) - return - if(mecha.internal_damage & MECHA_INT_TANK_BREACH) - mecha.clearInternalDamage(MECHA_INT_TANK_BREACH) - user.visible_message(SPAN_NOTICE("[user] repairs the damaged air tank."), SPAN_NOTICE("You repair the damaged air tank.")) - else if(mecha.obj_integrity < mecha.max_integrity) - mecha.obj_integrity += min(20, mecha.max_integrity - mecha.obj_integrity) - use(1) - user.visible_message(SPAN_NOTICE("[user] applies some [src] to [mecha]'s damaged areas."),\ - SPAN_NOTICE("You apply some [src] to [mecha]'s damaged areas.")) + if(ismecha(target)) + var/obj/mecha/mecha = target + if((mecha.obj_integrity >= mecha.max_integrity) && !mecha.internal_damage) + to_chat(user, SPAN_NOTICE("[mecha] is at full integrity!")) + return ITEM_INTERACT_COMPLETE + + if(mecha.state == MECHA_MAINT_OFF) + to_chat(user, SPAN_WARNING("[mecha] cannot be repaired without maintenance protocols active!")) + return ITEM_INTERACT_COMPLETE + + if(mecha.repairing) + to_chat(user, SPAN_NOTICE("[mecha] is currently being repaired!")) + return ITEM_INTERACT_COMPLETE + + if(mecha.internal_damage & MECHA_INT_TANK_BREACH) + mecha.clearInternalDamage(MECHA_INT_TANK_BREACH) + user.visible_message(SPAN_NOTICE("[user] repairs the damaged air tank."), SPAN_NOTICE("You repair the damaged air tank.")) + return ITEM_INTERACT_COMPLETE + + if(mecha.obj_integrity < mecha.max_integrity) + mecha.obj_integrity += min(20, mecha.max_integrity - mecha.obj_integrity) + use(1) + user.visible_message(SPAN_NOTICE("[user] applies some [src] to [mecha]'s damaged areas."),\ + SPAN_NOTICE("You apply some [src] to [mecha]'s damaged areas.")) + return ITEM_INTERACT_COMPLETE + + return ..() /obj/item/stack/nanopaste/proc/robotic_limb_repair(mob/user, obj/item/organ/external/external_limb, mob/living/carbon/human/H) if(!external_limb.get_damage()) @@ -93,7 +107,7 @@ energy_type = /datum/robot_storage/energy/medical/nanopaste is_cyborg = TRUE -/obj/item/stack/nanopaste/cyborg/attack__legacy__attackchain(mob/living/M, mob/user) +/obj/item/stack/nanopaste/cyborg/interact_with_atom(atom/target, mob/living/user, list/modifiers) if(get_amount() <= 0) to_chat(user, SPAN_WARNING("You don't have enough energy to dispense more [name]!")) else diff --git a/code/game/objects/items/stacks/seaweed.dm b/code/game/objects/items/stacks/seaweed.dm index 45b3c02a608..8078b8007a0 100644 --- a/code/game/objects/items/stacks/seaweed.dm +++ b/code/game/objects/items/stacks/seaweed.dm @@ -1,6 +1,6 @@ /obj/item/stack/seaweed name = "seaweed sheet" - desc = "Weed.. from the Sea!" + desc = "Weed... From the Sea!" singular_name = "seaweed sheet" icon = 'icons/obj/stacks/organic.dmi' icon_state = "seaweed" @@ -10,9 +10,6 @@ usesound = 'sound/items/deconstruct.ogg' merge_type = /obj/item/stack/seaweed -/obj/item/stack/seaweed/attack_self__legacy__attackchain(mob/user) - return - /obj/item/stack/seaweed/attack_self_tk() return diff --git a/code/game/objects/items/stacks/sheets/glass.dm b/code/game/objects/items/stacks/sheets/glass.dm index ad57f5658d4..624eb2953a0 100644 --- a/code/game/objects/items/stacks/sheets/glass.dm +++ b/code/game/objects/items/stacks/sheets/glass.dm @@ -65,20 +65,21 @@ GLOBAL_LIST_INIT(glass_recipes, list ( . = ..() recipes = GLOB.glass_recipes -/obj/item/stack/sheet/glass/attackby__legacy__attackchain(obj/item/W, mob/user, params) - if(istype(W, /obj/item/stack/cable_coil)) - var/obj/item/stack/cable_coil/CC = W +/obj/item/stack/sheet/glass/item_interaction(mob/living/user, obj/item/used, list/modifiers) + if(istype(used, /obj/item/stack/cable_coil)) + var/obj/item/stack/cable_coil/CC = used if(CC.get_amount() < 5) - to_chat(user, "There is not enough wire in this coil. You need 5 lengths.") - return + to_chat(user, SPAN_WARNING("[used] doesn't have enough cable! You need 5 lengths.")) + return ITEM_INTERACT_COMPLETE + CC.use(5) to_chat(user, SPAN_NOTICE("You attach wire to [src].")) new /obj/item/stack/light_w(user.loc) use(1) - return + return ITEM_INTERACT_COMPLETE - if(istype(W, /obj/item/stack/rods)) - var/obj/item/stack/rods/V = W + if(istype(used, /obj/item/stack/rods)) + var/obj/item/stack/rods/V = used var/obj/item/stack/sheet/rglass/RG = new (user.loc) RG.add_fingerprint(user) V.use(1) @@ -88,7 +89,7 @@ GLOBAL_LIST_INIT(glass_recipes, list ( G.use(1) if(!G && !RG && replace) user.put_in_hands(RG) - return + return ITEM_INTERACT_COMPLETE return ..() @@ -186,22 +187,22 @@ GLOBAL_LIST_INIT(pglass_recipes, list ( . = ..() recipes = GLOB.pglass_recipes -/obj/item/stack/sheet/plasmaglass/attackby__legacy__attackchain(obj/item/W, mob/user, params) - ..() - if(istype(W, /obj/item/stack/rods)) - var/obj/item/stack/rods/V = W - var/obj/item/stack/sheet/plasmarglass/RG = new (user.loc) - RG.add_fingerprint(user) - V.use(1) - var/obj/item/stack/sheet/glass/G = src - src = null - var/replace = (user.get_inactive_hand()==G) - G.use(1) - if(!G && !RG && replace) - user.put_in_hands(RG) - else +/obj/item/stack/sheet/plasmaglass/item_interaction(mob/living/user, obj/item/used, list/modifiers) + if(!istype(used, /obj/item/stack/rods)) return ..() + var/obj/item/stack/rods/V = used + var/obj/item/stack/sheet/plasmarglass/RG = new (user.loc) + RG.add_fingerprint(user) + V.use(1) + var/obj/item/stack/sheet/glass/G = src + src = null + var/replace = (user.get_inactive_hand() == G) + G.use(1) + if(!G && !RG && replace) + user.put_in_hands(RG) + return ITEM_INTERACT_COMPLETE + ////////////////////////////// // MARK: REINFORCED PLASMA GLASS ////////////////////////////// diff --git a/code/game/objects/items/stacks/sheets/leather.dm b/code/game/objects/items/stacks/sheets/leather.dm index 9b746707b2a..9b2ab3df418 100644 --- a/code/game/objects/items/stacks/sheets/leather.dm +++ b/code/game/objects/items/stacks/sheets/leather.dm @@ -187,48 +187,62 @@ GLOBAL_LIST_INIT(sinew_recipes, list ( /obj/item/clothing/head/hooded/explorer, /obj/item/clothing/head/helmet/space/plasmaman/mining)) -/obj/item/stack/sheet/animalhide/goliath_hide/afterattack__legacy__attackchain(atom/target, mob/user, proximity_flag) - if(!proximity_flag) - return +/obj/item/stack/sheet/animalhide/goliath_hide/interact_with_atom(atom/target, mob/living/user, list/modifiers) if(is_type_in_typecache(target, goliath_platable_armor_typecache)) var/obj/item/clothing/C = target var/datum/armor/current_armor = C.armor - if(current_armor.getRating(MELEE) < 75) - if(!use(1)) - to_chat(user, SPAN_NOTICE("You dont have enough [src] for this!")) - return - C.armor = current_armor.setRating(melee_value = min(current_armor.getRating(MELEE) + 15, 75)) - to_chat(user, SPAN_NOTICE("You strengthen [target], improving its resistance against melee attacks.")) - else + if(current_armor.getRating(MELEE) >= 75) to_chat(user, SPAN_WARNING("You can't improve [C] any further!")) - else if(istype(target, /obj/mecha/working/ripley)) + return ITEM_INTERACT_COMPLETE + + if(!use(1)) + to_chat(user, SPAN_WARNING("You dont have enough [src] for this!")) + return ITEM_INTERACT_COMPLETE + + C.armor = current_armor.setRating(melee_value = min(current_armor.getRating(MELEE) + 15, 75)) + to_chat(user, SPAN_NOTICE("You strengthen [target], improving its resistance against melee attacks.")) + return ITEM_INTERACT_COMPLETE + + if(istype(target, /obj/mecha/working/ripley)) var/obj/mecha/working/ripley/D = target - if(D.hides < HIDES_COVERED_FULL && !D.plates && !D.drake_hides) - if(!use(1)) - to_chat(user, SPAN_NOTICE("You dont have enough [src] for this!")) - return - D.hides++ - D.armor = D.armor.setRating(melee_value = min(D.armor.getRating(MELEE) + 10, 70)) - D.armor = D.armor.setRating(bullet_value = min(D.armor.getRating(BULLET) + 7, 60)) - D.armor = D.armor.setRating(laser_value = min(D.armor.getRating(LASER) + 7, 60)) - to_chat(user, SPAN_NOTICE("You strengthen [target], improving its resistance against attacks.")) - D.update_appearance(UPDATE_DESC|UPDATE_OVERLAYS) - else + if(D.hides >= HIDES_COVERED_FULL) to_chat(user, SPAN_WARNING("You can't improve [D] any further!")) - else if(isrobot(target)) + return ITEM_INTERACT_COMPLETE + + if(D.plates || D.drake_hides) + to_chat(user, SPAN_WARNING("[D] is already protected by a different kind of armor!")) + return ITEM_INTERACT_COMPLETE + + if(!use(1)) + to_chat(user, SPAN_WARNING("You dont have enough [src] for this!")) + return ITEM_INTERACT_COMPLETE + + D.hides++ + D.armor = D.armor.setRating(melee_value = min(D.armor.getRating(MELEE) + 10, 70)) + D.armor = D.armor.setRating(bullet_value = min(D.armor.getRating(BULLET) + 7, 60)) + D.armor = D.armor.setRating(laser_value = min(D.armor.getRating(LASER) + 7, 60)) + D.update_appearance(UPDATE_DESC|UPDATE_OVERLAYS) + to_chat(user, SPAN_NOTICE("You strengthen [target], improving its resistance against attacks.")) + return ITEM_INTERACT_COMPLETE + + if(isrobot(target)) var/mob/living/silicon/robot/R = target - if(istype(R.module, /obj/item/robot_module/miner)) - var/datum/armor/current_armor = R.armor - if(current_armor.getRating(MELEE) < 75) - if(!use(1)) - to_chat(user, SPAN_NOTICE("You dont have enough [src] for this!")) - return - R.armor = current_armor.setRating(melee_value = min(current_armor.getRating(MELEE) + 15, 75)) - to_chat(user, SPAN_NOTICE("You strengthen [target], improving its resistance against melee attacks.")) - else - to_chat(user, SPAN_WARNING("You can't improve [R] any further!")) - else - to_chat(user, SPAN_WARNING("[R]'s armor can not be improved!")) + if(!istype(R.module, /obj/item/robot_module/miner)) + to_chat(user, SPAN_WARNING("[R]'s armor can not be improved, only mining modules have hardpoints for attaching [src]!")) + return ITEM_INTERACT_COMPLETE + + var/datum/armor/current_armor = R.armor + if(current_armor.getRating(MELEE) >= 75) + to_chat(user, SPAN_WARNING("You can't improve the armor on [R] any further!")) + return ITEM_INTERACT_COMPLETE + + if(!use(1)) + to_chat(user, SPAN_WARNING("You dont have enough [src] for this!")) + return ITEM_INTERACT_COMPLETE + + R.armor = current_armor.setRating(melee_value = min(current_armor.getRating(MELEE) + 15, 75)) + to_chat(user, SPAN_NOTICE("You strengthen [target], improving its resistance against melee attacks.")) + return ITEM_INTERACT_COMPLETE /obj/item/stack/sheet/animalhide/armor_plate name = "armor plate" @@ -240,26 +254,29 @@ GLOBAL_LIST_INIT(sinew_recipes, list ( layer = MOB_LAYER materials = list(MAT_METAL = 20000, MAT_TITANIUM = 5000) -/obj/item/stack/sheet/animalhide/armor_plate/afterattack__legacy__attackchain(atom/target, mob/user, proximity_flag) - if(!proximity_flag) - return - if(istype(target, /obj/mecha/working/ripley)) - var/obj/mecha/working/ripley/D = target - if(D.plates < PLATES_COVERED_FULL && !D.hides && !D.drake_hides) - if(!use(1)) - to_chat(user, SPAN_NOTICE("You dont have enough [src] for this!")) - return - D.plates++ - D.armor = D.armor.setRating(melee_value = min(D.armor.getRating(MELEE) + 7, 60)) - D.armor = D.armor.setRating(bullet_value = min(D.armor.getRating(BULLET) + 4, 50)) - D.armor = D.armor.setRating(laser_value = min(D.armor.getRating(LASER) + 4, 50)) - to_chat(user, SPAN_NOTICE("You strengthen [target], improving its resistance against attacks.")) - D.update_appearance(UPDATE_DESC|UPDATE_OVERLAYS) - else - to_chat(user, SPAN_WARNING("You can't improve [D] any further!")) +/obj/item/stack/sheet/animalhide/armor_plate/interact_with_atom(atom/target, mob/living/user, list/modifiers) + if(!istype(target, /obj/mecha/working/ripley)) + return ..() -/obj/item/stack/sheet/animalhide/armor_plate/attackby__legacy__attackchain(obj/item/W, mob/user, params) - return // no steel leather for ya + var/obj/mecha/working/ripley/D = target + if(D.plates >= PLATES_COVERED_FULL) + to_chat(user, SPAN_WARNING("You can't improve [D] any further!")) + return ITEM_INTERACT_COMPLETE + + if(D.hides || D.drake_hides) + to_chat(user, SPAN_WARNING("[D] is already protected by a different kind of armor!")) + return ITEM_INTERACT_COMPLETE + + if(!use(1)) + to_chat(user, SPAN_NOTICE("You dont have enough [src] for this!")) + return ITEM_INTERACT_COMPLETE + + D.plates++ + D.armor = D.armor.setRating(melee_value = min(D.armor.getRating(MELEE) + 7, 60)) + D.armor = D.armor.setRating(bullet_value = min(D.armor.getRating(BULLET) + 4, 50)) + D.armor = D.armor.setRating(laser_value = min(D.armor.getRating(LASER) + 4, 50)) + D.update_appearance(UPDATE_DESC|UPDATE_OVERLAYS) + to_chat(user, SPAN_NOTICE("You strengthen [target], improving its resistance against attacks.")) /obj/item/stack/sheet/animalhide/ashdrake name = "ash drake hide" @@ -270,45 +287,58 @@ GLOBAL_LIST_INIT(sinew_recipes, list ( layer = MOB_LAYER dynamic_icon_state = TRUE -/obj/item/stack/sheet/animalhide/ashdrake/afterattack__legacy__attackchain(atom/target, mob/user, proximity_flag) - if(!proximity_flag) - return - if(istype(target, /obj/mecha/working/ripley)) - var/obj/mecha/working/ripley/D = target - if(D.drake_hides < DRAKE_HIDES_COVERED_FULL && !D.hides && !D.plates) - if(!use(3)) - to_chat(user, SPAN_NOTICE("You dont have enough [src] for this!")) - return - D.drake_hides++ - D.max_integrity += 50 - D.obj_integrity += 50 - D.armor = D.armor.setRating(melee_value = min(D.armor.getRating(MELEE) + 13, 80)) - D.armor = D.armor.setRating(bullet_value = min(D.armor.getRating(BULLET) + 7, 60)) - D.armor = D.armor.setRating(laser_value = min(D.armor.getRating(LASER) + 7, 60)) - to_chat(user, SPAN_NOTICE("You strengthen [target], improving its resistance against attacks.")) - D.update_appearance(UPDATE_DESC|UPDATE_OVERLAYS) - else - to_chat(user, SPAN_WARNING("You can't improve [D] any further!")) +/obj/item/stack/sheet/animalhide/ashdrake/interact_with_atom(atom/target, mob/living/user, list/modifiers) + if(!istype(target, /obj/mecha/working/ripley)) + return ..() + + var/obj/mecha/working/ripley/D = target + if(D.drake_hides >= DRAKE_HIDES_COVERED_FULL) + to_chat(user, SPAN_WARNING("You can't improve [D] any further!")) + return ITEM_INTERACT_COMPLETE + + if(D.hides || D.plates) + to_chat(user, SPAN_WARNING("[D] is already protected by a different kind of armor!")) + return ITEM_INTERACT_COMPLETE + + if(!use(3)) + to_chat(user, SPAN_NOTICE("You dont have enough [src] for this!")) + return ITEM_INTERACT_COMPLETE + + D.drake_hides++ + D.max_integrity += 50 + D.obj_integrity += 50 + D.armor = D.armor.setRating(melee_value = min(D.armor.getRating(MELEE) + 13, 80)) + D.armor = D.armor.setRating(bullet_value = min(D.armor.getRating(BULLET) + 7, 60)) + D.armor = D.armor.setRating(laser_value = min(D.armor.getRating(LASER) + 7, 60)) + D.update_appearance(UPDATE_DESC|UPDATE_OVERLAYS) + to_chat(user, SPAN_NOTICE("You strengthen [target], improving its resistance against attacks.")) //Step one - dehairing. +/obj/item/stack/sheet/animalhide/item_interaction(mob/living/user, obj/item/used, list/modifiers) + if(!used.sharp) + return ..() -/obj/item/stack/sheet/animalhide/attackby__legacy__attackchain(obj/item/W, mob/user, params) - if(W.sharp) - user.visible_message("[user] starts cutting hair off \the [src].", SPAN_NOTICE("You start cutting the hair off \the [src]..."), SPAN_ITALICS("You hear the sound of a knife rubbing against flesh.")) - if(do_after(user, 50 * W.toolspeed, target = src)) - to_chat(user, SPAN_NOTICE("You cut the hair from this [src.singular_name].")) - //Try locating an exisitng stack on the tile and add to there if possible - for(var/obj/item/stack/sheet/hairlesshide/HS in usr.loc) - if(HS.amount < 50) - HS.amount++ - src.use(1) - break - //If it gets to here it means it did not find a suitable stack on the tile. - var/obj/item/stack/sheet/hairlesshide/HS = new(usr.loc) - HS.amount = 1 + user.visible_message( + SPAN_NOTICE("[user] starts cutting hair off [src]."), + SPAN_NOTICE("You start cutting the hair off [src]..."), + SPAN_WARNING("You hear the sound of a knife rubbing against flesh!") + ) + if(!do_after(user, 50 * used.toolspeed, target = src)) + return ITEM_INTERACT_COMPLETE + + to_chat(user, SPAN_NOTICE("You cut the hair from this [src.singular_name].")) + //Try locating an exisitng stack on the tile and add to there if possible + for(var/obj/item/stack/sheet/hairlesshide/hide in usr.loc) + if(hide.amount < 50) + hide.amount++ src.use(1) - else - ..() + return ITEM_INTERACT_COMPLETE + + //If it gets to here it means it did not find a suitable stack on the tile. + var/obj/item/stack/sheet/hairlesshide/hide = new(usr.loc) + hide.amount = 1 + src.use(1) + return ITEM_INTERACT_COMPLETE //Step two - washing (also handled by water reagent code and washing machine code) /obj/item/stack/sheet/hairlesshide/water_act(volume, temperature, source, method = REAGENT_TOUCH) diff --git a/code/game/objects/items/stacks/sheets/light.dm b/code/game/objects/items/stacks/sheets/light.dm index adf1749ba6c..cea9b1079fc 100644 --- a/code/game/objects/items/stacks/sheets/light.dm +++ b/code/game/objects/items/stacks/sheets/light.dm @@ -12,16 +12,22 @@ flags = CONDUCT max_amount = 60 -/obj/item/stack/light_w/attackby__legacy__attackchain(obj/item/I, mob/user, params) - ..() - if(istype(I, /obj/item/wirecutters)) - var/obj/item/stack/cable_coil/CC = new(user.loc) - CC.amount = 5 - new/obj/item/stack/sheet/glass(user.loc) - use(1) +/obj/item/stack/light_w/item_interaction(mob/living/user, obj/item/used, list/modifiers) + if(!istype(used, /obj/item/stack/sheet/metal)) + return ..() - if(istype(I, /obj/item/stack/sheet/metal)) - var/obj/item/stack/sheet/metal/M = I - M.use(1) - new /obj/item/stack/tile/light(user.loc) - use(1) + var/obj/item/stack/sheet/metal/M = used + M.use(1) + new /obj/item/stack/tile/light(user.loc) + use(1) + return ITEM_INTERACT_COMPLETE + +/obj/item/stack/light_w/wirecutter_act(mob/living/user, obj/item/I) + if(!istype(I, /obj/item/wirecutters)) + return + + var/obj/item/stack/cable_coil/CC = new(user.loc) + CC.amount = 5 + new/obj/item/stack/sheet/glass(user.loc) + use(1) + return ITEM_INTERACT_COMPLETE diff --git a/code/game/objects/items/stacks/sheets/mineral.dm b/code/game/objects/items/stacks/sheets/mineral.dm index fcae7b373a1..948689a3955 100644 --- a/code/game/objects/items/stacks/sheets/mineral.dm +++ b/code/game/objects/items/stacks/sheets/mineral.dm @@ -197,19 +197,21 @@ GLOBAL_LIST_INIT(sandbag_recipes, list ( icon = 'icons/obj/stacks/miscellaneous.dmi' icon_state = "empty-sandbags" w_class = WEIGHT_CLASS_TINY + new_attack_chain = TRUE -/obj/item/emptysandbag/attackby__legacy__attackchain(obj/item/I, mob/user, params) - if(istype(I, /obj/item/stack/ore/glass)) - var/obj/item/stack/ore/glass/G = I - to_chat(user, SPAN_NOTICE("You fill the sandbag.")) - var/obj/item/stack/sheet/mineral/sandbags/S = new /obj/item/stack/sheet/mineral/sandbags(drop_location()) - qdel(src) - if(Adjacent(user) && !issilicon(user)) - user.put_in_hands(S) - G.use(1) - else +/obj/item/emptysandbag/item_interaction(mob/living/user, obj/item/used, list/modifiers) + if(!istype(used, /obj/item/stack/ore/glass)) return ..() + to_chat(user, SPAN_NOTICE("You fill the sandbag.")) + var/obj/item/stack/sheet/mineral/sandbags/S = new /obj/item/stack/sheet/mineral/sandbags(drop_location()) + if(Adjacent(user) && ishuman(user)) + user.put_in_hands(S) + var/obj/item/stack/ore/glass/G = used + G.use(1) + qdel(src) + return ITEM_INTERACT_COMPLETE + /obj/item/stack/sheet/mineral/diamond name = "diamond" desc = "Sparkles like a twinkling star." @@ -311,12 +313,13 @@ GLOBAL_LIST_INIT(sandbag_recipes, list ( log_and_set_aflame(user, I) return TRUE -/obj/item/stack/sheet/mineral/plasma/attackby__legacy__attackchain(obj/item/I, mob/living/user, params) - if(I.get_heat()) - log_and_set_aflame(user, I) - else +/obj/item/stack/sheet/mineral/plasma/item_interaction(mob/living/user, obj/item/used, list/modifiers) + if(!used.get_heat()) return ..() + log_and_set_aflame(user, used) + return ITEM_INTERACT_COMPLETE + /obj/item/stack/sheet/mineral/plasma/proc/log_and_set_aflame(mob/user, obj/item/I) var/turf/T = get_turf(src) message_admins("Plasma sheets ignited by [key_name_admin(user)]([ADMIN_QUE(user, "?")]) ([ADMIN_FLW(user, "FLW")]) in ([COORD(T)] - [ADMIN_JMP(T)]") diff --git a/code/game/objects/items/stacks/sheets/sheet_types.dm b/code/game/objects/items/stacks/sheets/sheet_types.dm index 0ca7f6557e9..c523d3c633c 100644 --- a/code/game/objects/items/stacks/sheets/sheet_types.dm +++ b/code/game/objects/items/stacks/sheets/sheet_types.dm @@ -535,15 +535,16 @@ GLOBAL_LIST_INIT(cardboard_recipes, list ( )), )) -/obj/item/stack/sheet/cardboard/attackby__legacy__attackchain(obj/item/I, mob/user, params) - if(istype(I, /obj/item/stamp/clown) && !isstorage(loc)) +/obj/item/stack/sheet/cardboard/item_interaction(mob/living/user, obj/item/used, list/modifiers) + if(!istype(used, /obj/item/stamp/clown) || isstorage(loc)) + return ..() + + if(use(1)) var/atom/droploc = drop_location() - if(use(1)) - playsound(I, 'sound/items/bikehorn.ogg', 50, TRUE, -1) - to_chat(user, SPAN_NOTICE("You stamp the cardboard! It's a clown box! Honk!")) - new/obj/item/storage/box/clown(droploc) //bugfix - else - . = ..() + to_chat(user, SPAN_NOTICE("You stamp the cardboard! It's a clown box! Honk!")) + playsound(used, 'sound/items/bikehorn.ogg', 50, TRUE, -1) + new/obj/item/storage/box/clown(droploc) + return ITEM_INTERACT_COMPLETE /// BubbleWrap /obj/item/stack/sheet/cardboard @@ -621,15 +622,14 @@ GLOBAL_LIST_INIT(cult_recipes, list ( icon_state = GET_CULT_DATA(runed_metal_icon_state, initial(icon_state)) recipes = GLOB.cult_recipes -/obj/item/stack/sheet/runed_metal/attack_self__legacy__attackchain(mob/living/user) - if(!IS_CULTIST(user)) +/obj/item/stack/sheet/runed_metal/activate_self(mob/user) + if(!IS_CULTIST(user) || user.holy_check()) to_chat(user, SPAN_WARNING("Only one with forbidden knowledge could hope to work this metal...")) - return - if(usr.holy_check()) - return + return ITEM_INTERACT_COMPLETE + if(!is_level_reachable(user.z)) to_chat(user, SPAN_WARNING("The energies of this place interfere with the metal shaping!")) - return + return ITEM_INTERACT_COMPLETE return ..() diff --git a/code/game/objects/items/stacks/stack.dm b/code/game/objects/items/stacks/stack.dm index 586e391bb9c..5c206cde515 100644 --- a/code/game/objects/items/stacks/stack.dm +++ b/code/game/objects/items/stacks/stack.dm @@ -10,6 +10,7 @@ */ /obj/item/stack origin_tech = "materials=1" + new_attack_chain = TRUE /// Whether this stack is a `/cyborg` subtype or not. var/is_cyborg = FALSE /// The storage datum that will be used with this stack. Used only with `/cyborg` type stacks. @@ -36,6 +37,24 @@ /// Whether this stack can't stack with subtypes. var/parent_stack = FALSE +/obj/item/stack/examine(mob/user) + . = ..() + if(!in_range(user, src)) + return + + if(is_cyborg) + if(singular_name) + . += "There is enough energy for [get_amount()] [singular_name]\s." + else + . += "There is enough energy for [get_amount()]." + return + + if(singular_name) + . += "There are [amount] [singular_name]\s in the stack." + else + . += "There are [amount] [name]\s in the stack." + . +=SPAN_NOTICE("Alt-click to take a custom amount.") + /obj/item/stack/Initialize(mapload, new_amount, merge = TRUE) if(dynamic_icon_state && isnull(inhand_icon_state)) //If we have a dynamic icon state, we don't want inhand icon states to follow the same pattern. inhand_icon_state = initial(icon_state) @@ -67,6 +86,21 @@ AddElement(/datum/element/connect_loc, loc_connections) update_icon(UPDATE_ICON_STATE) +/obj/item/stack/activate_self(mob/user) + if(..()) + return ITEM_INTERACT_COMPLETE + + ui_interact(user) + return ITEM_INTERACT_COMPLETE + +/obj/item/stack/item_interaction(mob/living/user, obj/item/used, list/modifiers) + if(!can_merge(used, TRUE)) + return ..() + + var/obj/item/stack/material = used + if(merge(material)) + to_chat(user, SPAN_NOTICE("Your [material.name] stack now contains [material.get_amount()] [material.singular_name]\s.")) + /obj/item/stack/update_icon_state() . = ..() if(!dynamic_icon_state) @@ -97,24 +131,6 @@ merge(hitting) . = ..() -/obj/item/stack/examine(mob/user) - . = ..() - if(!in_range(user, src)) - return - - if(is_cyborg) - if(singular_name) - . += "There is enough energy for [get_amount()] [singular_name]\s." - else - . += "There is enough energy for [get_amount()]." - return - - if(singular_name) - . += "There are [amount] [singular_name]\s in the stack." - else - . += "There are [amount] [name]\s in the stack." - . +=SPAN_NOTICE("Alt-click to take a custom amount.") - /obj/item/stack/proc/add(newamount) if(is_cyborg) source.add_charge(newamount * cost) @@ -140,8 +156,22 @@ return FALSE return TRUE -/obj/item/stack/attack_self__legacy__attackchain(mob/user) - ui_interact(user) +/obj/item/stack/use(used, check = TRUE) + if(check && is_zero_amount(TRUE)) + return FALSE + + if(is_cyborg) + return source.use_charge(used * cost) + + if(amount < used) + return FALSE + + amount -= used + if(check && is_zero_amount(TRUE)) + return TRUE + + update_icon(UPDATE_ICON_STATE) + return TRUE /obj/item/stack/attack_self_tk(mob/user) ui_interact(user) @@ -169,31 +199,6 @@ if(src && user.machine == src) ui_interact(user) -/obj/item/stack/attackby__legacy__attackchain(obj/item/thing, mob/user, params) - if(!can_merge(thing, TRUE)) - return ..() - - var/obj/item/stack/material = thing - if(merge(material)) - to_chat(user, SPAN_NOTICE("Your [material.name] stack now contains [material.get_amount()] [material.singular_name]\s.")) - -/obj/item/stack/use(used, check = TRUE) - if(check && is_zero_amount(TRUE)) - return FALSE - - if(is_cyborg) - return source.use_charge(used * cost) - - if(amount < used) - return FALSE - - amount -= used - if(check && is_zero_amount(TRUE)) - return TRUE - - update_icon(UPDATE_ICON_STATE) - return TRUE - /obj/item/stack/AltClick(mob/living/user) if(!istype(user) || user.incapacitated()) to_chat(user, SPAN_WARNING("You can't do that right now!")) diff --git a/code/game/objects/items/stacks/synthetic_skin.dm b/code/game/objects/items/stacks/synthetic_skin.dm index bdb00783f29..b647adbdd30 100644 --- a/code/game/objects/items/stacks/synthetic_skin.dm +++ b/code/game/objects/items/stacks/synthetic_skin.dm @@ -10,22 +10,23 @@ materials = list(MAT_METAL = 1000, MAT_GLASS = 500) var/skin_level = 1 -/obj/item/stack/synthetic_skin/attack__legacy__attackchain(mob/living/M as mob, mob/user as mob) - if(!ishuman(M) || !istype(user)) - return FALSE - var/mob/living/carbon/human/H = M +/obj/item/stack/synthetic_skin/interact_with_atom(atom/target, mob/living/user, list/modifiers) + if(!ishuman(target) || !istype(user)) + return ..() + + var/mob/living/carbon/human/H = target var/obj/item/organ/external/external_limb = H.get_organ(user.zone_selected) if(external_limb) user.visible_message(SPAN_NOTICE("[user] starts to apply [src] on [H]'s [external_limb.name]...")) if(!do_mob(user, H, 5 SECONDS)) - return FALSE - use(1) + return ITEM_INTERACT_COMPLETE + if(external_limb.apply_augmented_skin(skin_level)) + use(1) user.visible_message(SPAN_NOTICE("[user] applies some [src] on [H]'s [external_limb.name].")) - return TRUE else to_chat(user, SPAN_WARNING("You fail to apply a better skin cover to [H]'s [external_limb.name].")) - return FALSE + return ITEM_INTERACT_COMPLETE /obj/item/stack/synthetic_skin/level_2 name = "level-2 synthetic skin patch" diff --git a/code/game/objects/items/stacks/telecrystal.dm b/code/game/objects/items/stacks/telecrystal.dm index 7a8d402f521..41831f51ee8 100644 --- a/code/game/objects/items/stacks/telecrystal.dm +++ b/code/game/objects/items/stacks/telecrystal.dm @@ -10,35 +10,42 @@ origin_tech = "materials=6;syndicate=1" dynamic_icon_state = TRUE -/obj/item/stack/telecrystal/attack__legacy__attackchain(mob/target, mob/user) - if(target == user) //You can't go around smacking people with crystals to find out if they have an uplink or not. - for(var/obj/item/bio_chip/uplink/I in target) - if(I && I.imp_in) - I.hidden_uplink.uses += amount - use(amount) - to_chat(user, SPAN_NOTICE("You press [src] onto yourself and charge your hidden uplink.")) - -/obj/item/stack/telecrystal/afterattack__legacy__attackchain(obj/item/I, mob/user, proximity) - if(!proximity) - return - if(istype(I) && I.hidden_uplink && I.hidden_uplink.active) //No metagaming by using this on every PDA around just to see if it gets used up. - I.hidden_uplink.uses += amount - use(amount) - to_chat(user, SPAN_NOTICE("You slot [src] into [I] and charge its internal uplink.")) - else if(istype(I, /obj/item/cartridge/frame)) - var/obj/item/cartridge/frame/cart = I - if(!cart.charges) - to_chat(user, SPAN_NOTICE("[cart] is out of charges, it's refusing to accept [src]")) - return - cart.telecrystals += amount - use(amount) - to_chat(user, SPAN_NOTICE("You slot [src] into [cart]. The next time it's used, it will also give telecrystals")) - /obj/item/stack/telecrystal/examine(mob/user) . = ..() if(isAntag(user)) . += SPAN_WARNING("Telecrystals can be activated by utilizing them on devices with an actively running uplink. They will not activate on inactive uplinks.") +/obj/item/stack/telecrystal/interact_with_atom(atom/target, mob/living/user, list/modifiers) + if(isitem(target)) + var/obj/item/I = target + if(I.hidden_uplink && I.hidden_uplink.active) //No metagaming by using this on every PDA around just to see if it gets used up. + I.hidden_uplink.uses += amount + use(amount) + to_chat(user, SPAN_NOTICE("You slot [src] into [target] and charge its internal uplink.")) + return ITEM_INTERACT_COMPLETE + + if(istype(target, /obj/item/cartridge/frame)) + var/obj/item/cartridge/frame/cart = target + if(!cart.charges) + to_chat(user, SPAN_NOTICE("[cart] is out of charges, it's refusing to accept [src]")) + return ITEM_INTERACT_COMPLETE + + cart.telecrystals += amount + use(amount) + to_chat(user, SPAN_NOTICE("You slot [src] into [cart]. The next time it's used, it will also give telecrystals")) + return ITEM_INTERACT_COMPLETE + + if(target != user) //You can't go around smacking people with crystals to find out if they have an uplink or not. + return ..() + + for(var/obj/item/bio_chip/uplink/implant in target) + if(implant && implant.imp_in) + implant.hidden_uplink.uses += amount + use(amount) + to_chat(user, SPAN_NOTICE("You press [src] onto yourself and charge your hidden uplink.")) + break + return ITEM_INTERACT_COMPLETE + /obj/item/stack/telecrystal/five amount = 5 diff --git a/code/game/objects/items/tape.dm b/code/game/objects/items/tape.dm index 1644b424501..1c293dc5f0c 100644 --- a/code/game/objects/items/tape.dm +++ b/code/game/objects/items/tape.dm @@ -12,33 +12,43 @@ . = ..() update_icon(UPDATE_ICON_STATE) -/obj/item/stack/tape_roll/attack__legacy__attackchain(mob/living/carbon/human/M, mob/living/user) - if(!istype(M)) //What good is a duct tape mask if you are unable to speak? - return - if(M.wear_mask) - to_chat(user, "Remove [M.p_their()] mask first!") - return +/obj/item/stack/tape_roll/interact_with_atom(atom/target, mob/living/user, list/modifiers) + if(!ishuman(target)) // What good is a duct tape mask if you are unable to speak? + return ..() + + var/mob/living/carbon/human/H = target + if(H.wear_mask) + to_chat(user, SPAN_WARNING("Remove [H.p_their()] mask first!")) + return ITEM_INTERACT_COMPLETE + if(amount < 2) - to_chat(user, "You'll need more tape for this!") - return - if(!M.check_has_mouth()) - to_chat(user, "[M.p_they(TRUE)] [M.p_have()] no mouth to tape over!") - return - user.visible_message(SPAN_WARNING("[user] is taping [M]'s mouth closed!"), - SPAN_NOTICE("You try to tape [M == user ? "your own" : "[M]'s"] mouth shut!"), - SPAN_WARNING("You hear tape ripping.")) - if(!do_after(user, 50, target = M)) - return + to_chat(user, SPAN_WARNING("You'll need more tape for this!")) + return ITEM_INTERACT_COMPLETE + + if(!H.check_has_mouth()) + to_chat(user, "[H.p_they(TRUE)] [H.p_have()] no mouth to tape over!") + return ITEM_INTERACT_COMPLETE + + user.visible_message( + SPAN_WARNING("[user] is taping [H]'s mouth closed!"), + SPAN_NOTICE("You try to tape [H == user ? "your own" : "[H]'s"] mouth shut!"), + SPAN_WARNING("You hear tape ripping.") + ) + if(!do_after(user, 5 SECONDS, target = H)) + return ITEM_INTERACT_COMPLETE + if(!use(2)) to_chat(user, SPAN_NOTICE("You don't have enough tape!")) - return - if(M.wear_mask) - to_chat(user, SPAN_NOTICE("[M == user ? user : M]'s mouth is already covered!")) - return - user.visible_message(SPAN_WARNING("[user] tapes [M]'s mouth shut!"), - SPAN_NOTICE("You cover [M == user ? "your own" : "[M]'s"] mouth with a piece of duct tape.[M == user ? null : " That will shut them up."]")) + return ITEM_INTERACT_COMPLETE + + if(H.wear_mask) + to_chat(user, SPAN_NOTICE("[H == user ? user : H]'s mouth is already covered!")) + return ITEM_INTERACT_COMPLETE + + user.visible_message(SPAN_WARNING("[user] tapes [H]'s mouth shut!"), + SPAN_NOTICE("You cover [H == user ? "your own" : "[H]'s"] mouth with a piece of duct tape.[H == user ? null : " That will shut them up."]")) var/obj/item/clothing/mask/muzzle/G = new /obj/item/clothing/mask/muzzle/tapegag - M.equip_to_slot(G, ITEM_SLOT_MASK) + H.equip_to_slot(G, ITEM_SLOT_MASK) G.add_fingerprint(user) /obj/item/stack/tape_roll/update_icon_state() diff --git a/code/game/objects/items/weapons/gift_wrappaper.dm b/code/game/objects/items/weapons/gift_wrappaper.dm index 9593850ed8b..765014d86f9 100644 --- a/code/game/objects/items/weapons/gift_wrappaper.dm +++ b/code/game/objects/items/weapons/gift_wrappaper.dm @@ -134,5 +134,7 @@ max_amount = 25 resistance_flags = FLAMMABLE -/obj/item/stack/wrapping_paper/attack_self__legacy__attackchain(mob/user) +/obj/item/stack/wrapping_paper/activate_self(mob/user) + . = ..() to_chat(user, SPAN_NOTICE("You need to use it on a package that has already been wrapped!")) + return ITEM_INTERACT_COMPLETE diff --git a/code/game/turfs/simulated/floor/asteroid_floors.dm b/code/game/turfs/simulated/floor/asteroid_floors.dm index cc5e6645a21..f1120c23e29 100644 --- a/code/game/turfs/simulated/floor/asteroid_floors.dm +++ b/code/game/turfs/simulated/floor/asteroid_floors.dm @@ -64,7 +64,7 @@ if(S.pickup_all_on_tile) for(var/obj/item/stack/ore/O in contents) - O.attackby__legacy__attackchain(S, user) + S.attackby__legacy__attackchain(O, user) return /turf/simulated/floor/plating/asteroid/item_interaction(mob/living/user, obj/item/used, list/modifiers) diff --git a/code/modules/arcade/arcade_prize.dm b/code/modules/arcade/arcade_prize.dm index 3d85ea6b87f..2861cff0f50 100644 --- a/code/modules/arcade/arcade_prize.dm +++ b/code/modules/arcade/arcade_prize.dm @@ -83,8 +83,9 @@ w_class = WEIGHT_CLASS_TINY max_amount = 9999 //Dang that's a lot of tickets -/obj/item/stack/tickets/attack_self__legacy__attackchain(mob/user as mob) - return +/obj/item/stack/tickets/activate_self(mob/user) + . = ..() + return ITEM_INTERACT_COMPLETE /obj/item/stack/tickets/update_icon_state() switch(get_amount()) diff --git a/code/modules/hydroponics/grown/cotton.dm b/code/modules/hydroponics/grown/cotton.dm index 2e40f322ceb..9e07fd2a120 100644 --- a/code/modules/hydroponics/grown/cotton.dm +++ b/code/modules/hydroponics/grown/cotton.dm @@ -39,7 +39,7 @@ var/old_cotton_amount = cotton.amount for(var/obj/item/stack/ST in user.loc) if(ST != cotton && istype(ST, cotton_type) && ST.amount < ST.max_amount) - ST.attackby__legacy__attackchain(cotton, user) + ST.item_interaction(cotton, user) if(cotton.amount > old_cotton_amount) to_chat(user, SPAN_NOTICE("You add the newly-formed [cotton_name] to the stack. It now contains [cotton.amount] [cotton_name].")) qdel(src) diff --git a/code/modules/mining/equipment/marker_beacons.dm b/code/modules/mining/equipment/marker_beacons.dm index cc4928ae79b..ee71a9c4f67 100644 --- a/code/modules/mining/equipment/marker_beacons.dm +++ b/code/modules/mining/equipment/marker_beacons.dm @@ -47,18 +47,24 @@ GLOBAL_LIST_INIT(marker_beacon_colors, list( /obj/item/stack/marker_beacon/update_icon_state() icon_state = "[base_icon_state][lowertext(picked_color)]" -/obj/item/stack/marker_beacon/attack_self__legacy__attackchain(mob/user) +/obj/item/stack/marker_beacon/activate_self(mob/user) + if(..()) + return ITEM_INTERACT_COMPLETE + if(!isturf(user.loc)) to_chat(user, SPAN_WARNING("You need more space to place a [singular_name] here.")) - return + return ITEM_INTERACT_COMPLETE + if(locate(/obj/structure/marker_beacon) in user.loc) to_chat(user, SPAN_WARNING("There is already a [singular_name] here.")) - return + return ITEM_INTERACT_COMPLETE + if(use(1)) to_chat(user, SPAN_NOTICE("You activate and anchor [amount ? "a":"the"] [singular_name] in place.")) playsound(user, 'sound/machines/click.ogg', 50, 1) var/obj/structure/marker_beacon/M = new(user.loc, picked_color) transfer_fingerprints_to(M) + return ITEM_INTERACT_COMPLETE /obj/item/stack/marker_beacon/AltClick(mob/living/user) if(!istype(user) || ui_status(user, GLOB.physical_state) != UI_INTERACTIVE) diff --git a/code/modules/power/cables/cable_coil.dm b/code/modules/power/cables/cable_coil.dm index 0fb34efe324..0f3e52dc851 100644 --- a/code/modules/power/cables/cable_coil.dm +++ b/code/modules/power/cables/cable_coil.dm @@ -86,27 +86,32 @@ GLOBAL_LIST_INIT(cable_coil_recipes, list (new/datum/stack_recipe/cable_restrain return . && ..() //you can use wires to heal robotics -/obj/item/stack/cable_coil/attack__legacy__attackchain(mob/M, mob/user) - if(!ishuman(M)) +/obj/item/stack/cable_coil/interact_with_atom(atom/target, mob/living/user, list/modifiers) + if(!ishuman(target)) return ..() - var/mob/living/carbon/human/H = M + + var/mob/living/carbon/human/H = target var/obj/item/organ/external/S = H.bodyparts_by_name[user.zone_selected] - if(!S && ismachineperson(M) && user.a_intent == INTENT_HELP) - to_chat(user, SPAN_NOTICE("[M.p_they(TRUE)] [M.p_are()] missing that limb!")) - return + if(!S && ismachineperson(target) && user.a_intent == INTENT_HELP) + to_chat(user, SPAN_NOTICE("[H.p_they(TRUE)] [H.p_are()] missing that limb!")) + return ITEM_INTERACT_COMPLETE if(!S?.is_robotic() || user.a_intent != INTENT_HELP || S.open == ORGAN_SYNTHETIC_OPEN) return ..() + if(S.burn_dam > ROBOLIMB_SELF_REPAIR_CAP) to_chat(user, SPAN_DANGER("The damage is far too severe to patch over externally.")) - return + return ITEM_INTERACT_COMPLETE + if(!S.burn_dam) to_chat(user, SPAN_NOTICE("Nothing to fix!")) - return + return ITEM_INTERACT_COMPLETE + if(H == user) if(!do_mob(user, H, 10)) - return FALSE + return ITEM_INTERACT_COMPLETE + var/cable_used = 0 var/childlist if(!isnull(S.children)) @@ -132,8 +137,8 @@ GLOBAL_LIST_INIT(cable_coil_recipes, list (new/datum/stack_recipe/cable_restrain cable_used += 1 E.heal_damage(0, HEALPERCABLE, 0, TRUE) H.UpdateDamageIcon() - user.visible_message(SPAN_ALERT("[user] repairs some burn damage on [M]'s [E.name] with [src].")) - return TRUE + user.visible_message(SPAN_ALERT("[user] repairs some burn damage on [H]'s [E.name] with [src].")) + return ITEM_INTERACT_COMPLETE /obj/item/stack/cable_coil/split() var/obj/item/stack/cable_coil/C = ..() @@ -143,27 +148,31 @@ GLOBAL_LIST_INIT(cable_coil_recipes, list (new/datum/stack_recipe/cable_restrain // Items usable on a cable coil : // - Wirecutters : cut them duh ! // - Cable coil : merge cables -/obj/item/stack/cable_coil/attackby__legacy__attackchain(obj/item/W, mob/user) - . = ..() - if(istype(W, /obj/item/stack/cable_coil)) - var/obj/item/stack/cable_coil/C = W +/obj/item/stack/cable_coil/item_interaction(mob/living/user, obj/item/used, list/modifiers) + if(istype(used, /obj/item/stack/cable_coil)) + var/obj/item/stack/cable_coil/C = used // Cable merging is handled by parent proc if(C.cable_merge_id != cable_merge_id) to_chat(user, "These coils are of different types.") - return + return ITEM_INTERACT_COMPLETE + if(C.get_amount() >= MAXCOIL) to_chat(user, "The coil is as long as it will get.") - return + return ITEM_INTERACT_COMPLETE + if((C.get_amount() + get_amount() <= MAXCOIL)) to_chat(user, "You join the cable coils together.") - return - else - to_chat(user, "You transfer [get_amount_transferred()] length\s of cable from one coil to the other.") - return + return ITEM_INTERACT_COMPLETE - if(istype(W, /obj/item/toy/crayon)) - var/obj/item/toy/crayon/C = W + to_chat(user, "You transfer [get_amount_transferred()] length\s of cable from one coil to the other.") + return ITEM_INTERACT_COMPLETE + + if(istype(used, /obj/item/toy/crayon)) + var/obj/item/toy/crayon/C = used cable_color(C.dye_color) + return ITEM_INTERACT_COMPLETE + + return ..() /////////////////////////////////////////////// // Cable laying procedures @@ -417,9 +426,11 @@ GLOBAL_LIST_INIT(cable_coil_recipes, list (new/datum/stack_recipe/cable_restrain cable_type = /obj/structure/cable/extra_insulated/pre_connect icon = 'icons/obj/cable_coils/heavy_duty_connected.dmi' -/obj/item/stack/cable_coil/extra_insulated/attackby__legacy__attackchain(obj/item/I, mob/living/user) - if(I.GetID()) +/obj/item/stack/cable_coil/extra_insulated/item_interaction(mob/living/user, obj/item/used, list/modifiers) + if(used.GetID()) toggle_connection(user) + return ITEM_INTERACT_COMPLETE + return ..() /obj/item/stack/cable_coil/cut diff --git a/code/modules/telesci/bscrystal.dm b/code/modules/telesci/bscrystal.dm index 3fc884eee4e..a2c0b28948f 100644 --- a/code/modules/telesci/bscrystal.dm +++ b/code/modules/telesci/bscrystal.dm @@ -31,10 +31,13 @@ . = ..() scatter_atom() -/obj/item/stack/ore/bluespace_crystal/attack_self__legacy__attackchain(mob/user) +/obj/item/stack/ore/bluespace_crystal/activate_self(mob/user) if(use(1)) blink_mob(user) user.visible_message(SPAN_NOTICE("[user] crushes a [singular_name]!")) + return ITEM_INTERACT_COMPLETE + + return ..() /obj/item/stack/ore/bluespace_crystal/proc/blink_mob(mob/living/L) if(!is_teleport_allowed(L.z))