From e69c572b19528c9b355a67e5d869a243049be894 Mon Sep 17 00:00:00 2001 From: warriorstar-orion Date: Tue, 11 Mar 2025 19:37:11 -0400 Subject: [PATCH] Attack chain migration: /mob (#28211) * Attack chain migration: /mob * always target zone on attack for tests * thread corgi item interactions through to parent * put away razor * standardize test names * fix harmbaton not beating + stunning * fix ID cards not unlocking bots * fix fulton * fix fulton shenanigans * fix tumor shards --- code/_onclick/item_attack.dm | 18 ++++++--- code/_onclick/item_attack_legacy.dm | 24 ++---------- code/game/gamemodes/miniantags/morph/morph.dm | 5 ++- .../miniantags/pulsedemon/pulsedemon.dm | 9 ++++- .../gamemodes/miniantags/revenant/revenant.dm | 7 +++- .../changeling/powers/summon_spiders.dm | 7 ++-- code/modules/mining/fulton.dm | 39 ++++++++++++------- code/modules/mining/minebot.dm | 12 +++--- .../mob/living/carbon/carbon_defense.dm | 5 ++- .../mob/living/carbon/human/human_defense.dm | 19 +++++---- .../modules/mob/living/silicon/decoy/decoy.dm | 4 +- code/modules/mob/living/silicon/pai/pai.dm | 12 ++++-- .../living/silicon/robot/drone/maint_drone.dm | 10 ++--- .../mob/living/silicon/robot/robot_mob.dm | 26 ++++++------- .../living/silicon/robot/syndicate_robot.dm | 4 +- .../modules/mob/living/silicon/silicon_mob.dm | 8 +++- .../living/simple_animal/animal_defense.dm | 6 +-- .../mob/living/simple_animal/bot/bot.dm | 25 ++++++------ .../mob/living/simple_animal/bot/cleanbot.dm | 8 ++-- .../mob/living/simple_animal/bot/ed209bot.dm | 6 ++- .../mob/living/simple_animal/bot/floorbot.dm | 10 +++-- .../mob/living/simple_animal/bot/griefsky.dm | 11 +++--- .../mob/living/simple_animal/bot/honkbot.dm | 11 +++--- .../mob/living/simple_animal/bot/medbot.dm | 23 ++++++----- .../mob/living/simple_animal/bot/mulebot.dm | 15 +++---- .../mob/living/simple_animal/bot/secbot.dm | 6 ++- .../simple_animal/clockwork_constructs.dm | 10 ++--- .../mob/living/simple_animal/friendly/dog.dm | 15 +++---- .../simple_animal/friendly/farm_animals.dm | 17 ++++---- .../friendly/nian_caterpillar.dm | 6 +-- .../mob/living/simple_animal/friendly/pet.dm | 5 ++- .../simple_animal/friendly/spiderbot.dm | 25 ++++++------ .../living/simple_animal/hostile/hellhound.dm | 6 ++- .../living/simple_animal/hostile/hostile.dm | 6 ++- .../hostile/megafauna/ancient_robot.dm | 7 +++- .../hostile/mining/elites/elite.dm | 13 +++++-- .../simple_animal/hostile/mining/gutlunch.dm | 5 +-- .../living/simple_animal/hostile/mushroom.dm | 12 ++++-- .../simple_animal/hostile/syndicate_mobs.dm | 6 ++- .../mob/living/simple_animal/parrot.dm | 24 ++++++------ .../living/simple_animal/posessed_object.dm | 5 ++- .../modules/mob/living/simple_animal/shade.dm | 5 +-- .../living/simple_animal/slime/slime_mob.dm | 16 +++++--- code/modules/mob/mob_holder.dm | 2 +- code/modules/mob/mob_vars.dm | 2 + code/modules/projectiles/gun.dm | 2 +- 46 files changed, 284 insertions(+), 235 deletions(-) diff --git a/code/_onclick/item_attack.dm b/code/_onclick/item_attack.dm index 625ea59cf73..1fb9c5c0be7 100644 --- a/code/_onclick/item_attack.dm +++ b/code/_onclick/item_attack.dm @@ -108,7 +108,14 @@ if(..()) return TRUE user.changeNext_move(CLICK_CD_MELEE) - return attacking.attack(src, user, params) + + if(attempt_harvest(attacking, user)) + return TRUE + + if(attacking.new_attack_chain) + return attacking.attack(src, user, params) + + return attacking.attack__legacy__attackchain(src, user) /** * Called when we are used by `user` to attack the living `target`. @@ -128,10 +135,11 @@ if(signal_return & COMPONENT_SKIP_ATTACK) return FALSE - . = __attack_core(target, user) - - if(!target.new_attack_chain && .) - return target.attacked_by__legacy__attackchain(src, user, /* def_zone */ null) + // Legacy attack uses TRUE to signal continuing the chain and FALSE otherwise; + // New attack chain flips that around. Horrible. + . = !__attack_core(target, user) + if(!.) + target.attacked_by(src, user) /obj/item/proc/__after_attack_core(mob/user, atom/target, params, proximity_flag = 1) PRIVATE_PROC(TRUE) diff --git a/code/_onclick/item_attack_legacy.dm b/code/_onclick/item_attack_legacy.dm index 1bfc8299e6a..0aa9562e0b9 100644 --- a/code/_onclick/item_attack_legacy.dm +++ b/code/_onclick/item_attack_legacy.dm @@ -13,23 +13,15 @@ /obj/attacked_by__legacy__attackchain(obj/item/I, mob/living/user) return attacked_by(I, user) -/mob/living/attacked_by__legacy__attackchain(obj/item/I, mob/living/user, def_zone) - return attacked_by(I, user, def_zone) - -/mob/living/simple_animal/attacked_by__legacy__attackchain(obj/item/I, mob/living/user) - return attacked_by(I, user) - /obj/item/proc/attack__legacy__attackchain(mob/living/M, mob/living/user, def_zone) if(SEND_SIGNAL(src, COMSIG_ATTACK, M, user) & COMPONENT_CANCEL_ATTACK_CHAIN) return TRUE SEND_SIGNAL(user, COMSIG_MOB_ITEM_ATTACK, M, user) - if(!__attack_core(M, user)) - return - - if(!M.new_attack_chain) - return M.attacked_by__legacy__attackchain(src, user, def_zone) + . = __attack_core(M, user) + if(.) + M.attacked_by(src, user, def_zone) /** * Called when `user` attacks us with item `W`. @@ -50,16 +42,6 @@ ? I.attack_obj(src, user, params) \ : I.attack_obj__legacy__attackchain(src, user, params))) -/mob/living/attackby__legacy__attackchain(obj/item/I, mob/living/user, params) - user.changeNext_move(CLICK_CD_MELEE) - if(attempt_harvest(I, user)) - return TRUE - - if(I.new_attack_chain) - return I.attack(src, user, params) - - return I.attack__legacy__attackchain(src, user) - /** * Called when `user` attacks us with object `O`. * diff --git a/code/game/gamemodes/miniantags/morph/morph.dm b/code/game/gamemodes/miniantags/morph/morph.dm index fb40dd438f3..c53a1fa1d9a 100644 --- a/code/game/gamemodes/miniantags/morph/morph.dm +++ b/code/game/gamemodes/miniantags/morph/morph.dm @@ -224,11 +224,12 @@ #define MORPH_ATTACKED if((. = ..()) && morphed) mimic_spell.restore_form(src) -/mob/living/simple_animal/hostile/morph/attackby__legacy__attackchain(obj/item/O, mob/living/user) +/mob/living/simple_animal/hostile/morph/attack_by(obj/item/O, mob/living/user, params) if(user.a_intent == INTENT_HELP && ambush_prepared) to_chat(user, "You try to use [O] on [src]... it seems different than no-") ambush_attack(user, TRUE) - return TRUE + return FINISH_ATTACK + MORPH_ATTACKED /mob/living/simple_animal/hostile/morph/attack_animal(mob/living/simple_animal/M) diff --git a/code/game/gamemodes/miniantags/pulsedemon/pulsedemon.dm b/code/game/gamemodes/miniantags/pulsedemon/pulsedemon.dm index ad8964afbb0..afb642ee636 100644 --- a/code/game/gamemodes/miniantags/pulsedemon/pulsedemon.dm +++ b/code/game/gamemodes/miniantags/pulsedemon/pulsedemon.dm @@ -759,10 +759,14 @@ visible_message("[M] [response_harm] [src].") try_attack_mob(M) -/mob/living/simple_animal/demon/pulse_demon/attackby__legacy__attackchain(obj/item/O, mob/living/user) +/mob/living/simple_animal/demon/pulse_demon/attack_by(obj/item/O, mob/living/user, params) + if(..()) + return FINISH_ATTACK + if(is_under_tile()) to_chat(user, "You can't interact with something that's under the floor!") - return + return FINISH_ATTACK + var/obj/item/stock_parts/cell/C = O.get_cell() if(C && C.charge) C.use(min(C.charge, power_drain_rate)) @@ -771,6 +775,7 @@ to_chat(src, "[user] touches you with [O] and you drain its power!") visible_message("[O] goes right through [src].") try_shock_mob(user, O.siemens_coefficient) + return FINISH_ATTACK /mob/living/simple_animal/demon/pulse_demon/ex_act() return diff --git a/code/game/gamemodes/miniantags/revenant/revenant.dm b/code/game/gamemodes/miniantags/revenant/revenant.dm index f31d85dfdec..4f58c51b9f0 100644 --- a/code/game/gamemodes/miniantags/revenant/revenant.dm +++ b/code/game/gamemodes/miniantags/revenant/revenant.dm @@ -210,7 +210,10 @@ ghostize() qdel(src) -/mob/living/simple_animal/revenant/attackby__legacy__attackchain(obj/item/W, mob/living/user, params) +/mob/living/simple_animal/revenant/attack_by(obj/item/W, mob/living/user, params) + if(..()) + return FINISH_ATTACK + if(istype(W, /obj/item/nullrod)) visible_message("[src] violently flinches!", \ "As \the [W] passes through you, you feel your essence draining away!") @@ -219,7 +222,7 @@ spawn(30) inhibited = FALSE - ..() + return FINISH_ATTACK /mob/living/simple_animal/revenant/proc/castcheck(essence_cost) if(holy_check(src)) diff --git a/code/modules/antagonists/changeling/powers/summon_spiders.dm b/code/modules/antagonists/changeling/powers/summon_spiders.dm index 37ab081d031..72166420d84 100644 --- a/code/modules/antagonists/changeling/powers/summon_spiders.dm +++ b/code/modules/antagonists/changeling/powers/summon_spiders.dm @@ -159,10 +159,11 @@ if(!faction_check_mob(M)) enemies |= M -/mob/living/simple_animal/hostile/poison/giant_spider/hunter/infestation_spider/attackby__legacy__attackchain(obj/item/W, mob/user, params) - . = ..() +/mob/living/simple_animal/hostile/poison/giant_spider/hunter/infestation_spider/attack_by(obj/item/W, mob/living/user, params) + if(..()) + return FINISH_ATTACK if(W.force == 0) - return + return FINISH_ATTACK if(!faction_check_mob(user)) enemies |= user diff --git a/code/modules/mining/fulton.dm b/code/modules/mining/fulton.dm index 1b6a0a2f1a6..93942dd8783 100644 --- a/code/modules/mining/fulton.dm +++ b/code/modules/mining/fulton.dm @@ -5,7 +5,9 @@ GLOBAL_LIST_EMPTY(total_extraction_beacons) desc = "A balloon that can be used to extract equipment or personnel to a Fulton Recovery Beacon. Anything not bolted down can be moved. Link the pack to a beacon by using the pack in hand." icon = 'icons/obj/fulton.dmi' icon_state = "extraction_pack" + flags = NOBLUDGEON w_class = WEIGHT_CLASS_NORMAL + new_attack_chain = TRUE var/obj/structure/extraction_point/beacon var/list/beacon_networks = list("station") var/uses_left = 3 @@ -17,7 +19,10 @@ GLOBAL_LIST_EMPTY(total_extraction_beacons) . = ..() . += "It has [uses_left] use\s remaining." -/obj/item/extraction_pack/attack_self__legacy__attackchain(mob/user) +/obj/item/extraction_pack/activate_self(mob/user) + if(..()) + return FINISH_ATTACK + var/list/possible_beacons = list() for(var/B in GLOB.total_extraction_beacons) var/obj/structure/extraction_point/EP = B @@ -26,7 +31,7 @@ GLOBAL_LIST_EMPTY(total_extraction_beacons) if(!length(possible_beacons)) to_chat(user, "There are no extraction beacons in existence!") - return + return FINISH_ATTACK else var/A @@ -34,35 +39,40 @@ GLOBAL_LIST_EMPTY(total_extraction_beacons) A = tgui_input_list(user, "Select a beacon to connect to", "Balloon Extraction Pack", possible_beacons) if(!A) - return + return FINISH_ATTACK beacon = A to_chat(user, "You link the extraction pack to the beacon system.") + return FINISH_ATTACK -/obj/item/extraction_pack/afterattack__legacy__attackchain(atom/movable/A, mob/living/carbon/human/user, flag, params) - . = ..() +/obj/item/extraction_pack/interact_with_atom(atom/target, mob/living/user, list/modifiers) + var/atom/movable/A = target + if(!istype(A)) + return ITEM_INTERACT_COMPLETE + + playsound(loc, 'sound/weapons/tap.ogg', get_clamped_volume(), TRUE, -1) + user.do_attack_animation(A) + user.changeNext_move(CLICK_CD_MELEE) if(!beacon) to_chat(user, "[src] is not linked to a beacon, and cannot be used!") - return + return ITEM_INTERACT_COMPLETE if(!can_use_indoors) var/area/area = get_area(A) if(!area.outdoors) to_chat(user, "[src] can only be used on things that are outdoors!") - return + return ITEM_INTERACT_COMPLETE if(area.tele_proof || !is_teleport_allowed(A.z)) to_chat(user, "Bluespace distortions prevent the fulton from inflating!") - return - if(!flag) - return + return ITEM_INTERACT_COMPLETE if(!istype(A)) - return + return ITEM_INTERACT_COMPLETE else if(!safe_for_living_creatures && check_for_living_mobs(A)) to_chat(user, "[src] is not safe for use with living creatures, they wouldn't survive the trip back!") - return + return ITEM_INTERACT_COMPLETE if(!isturf(A.loc)) // no extracting stuff inside other stuff - return + return ITEM_INTERACT_COMPLETE if(A.anchored || (A.move_resist > max_force_fulton)) - return + return ITEM_INTERACT_COMPLETE to_chat(user, "You start attaching the pack to [A]...") if(do_after(user, 50, target = A)) to_chat(user, "You attach the pack to [A] and activate it.") @@ -144,6 +154,7 @@ GLOBAL_LIST_EMPTY(total_extraction_beacons) if(uses_left <= 0) qdel(src) + return ITEM_INTERACT_COMPLETE /obj/item/fulton_core name = "extraction beacon assembly kit" diff --git a/code/modules/mining/minebot.dm b/code/modules/mining/minebot.dm index 6e4e3bd5f4f..f7164021275 100644 --- a/code/modules/mining/minebot.dm +++ b/code/modules/mining/minebot.dm @@ -87,16 +87,16 @@ var/obj/item/borg/upgrade/modkit/M = A . += "There is \a [M] installed, using [M.cost]% capacity." - -/mob/living/simple_animal/hostile/mining_drone/attackby__legacy__attackchain(obj/item/I, mob/user, params) +/mob/living/simple_animal/hostile/mining_drone/item_interaction(mob/living/user, obj/item/I, list/modifiers) if(istype(I, /obj/item/mining_scanner) || istype(I, /obj/item/t_scanner/adv_mining_scanner)) to_chat(user, "You instruct [src] to drop any collected ore.") DropOre() - return + return ITEM_INTERACT_COMPLETE if(istype(I, /obj/item/borg/upgrade/modkit)) - I.melee_attack_chain(user, stored_gun, params) - return - ..() + I.melee_attack_chain(user, stored_gun, list2params(modifiers)) + return ITEM_INTERACT_COMPLETE + + return ..() /mob/living/simple_animal/hostile/mining_drone/crowbar_act(mob/user, obj/item/I) if(user.a_intent != INTENT_HELP) diff --git a/code/modules/mob/living/carbon/carbon_defense.dm b/code/modules/mob/living/carbon/carbon_defense.dm index 7e48f889040..67c8f1040ab 100644 --- a/code/modules/mob/living/carbon/carbon_defense.dm +++ b/code/modules/mob/living/carbon/carbon_defense.dm @@ -21,12 +21,13 @@ if(volume > 10) // Anything over 10 volume will make the mob wetter. wetlevel = min(wetlevel + 1,5) -/mob/living/carbon/attackby__legacy__attackchain(obj/item/I, mob/user, params) +/mob/living/carbon/item_interaction(mob/living/user, obj/item/I, list/modifiers) if(length(surgeries)) if(user.a_intent == INTENT_HELP) for(var/datum/surgery/S in surgeries) if(S.next_step(user, src)) - return TRUE + return ITEM_INTERACT_COMPLETE + return ..() /mob/living/carbon/attack_hand(mob/living/carbon/human/user) diff --git a/code/modules/mob/living/carbon/human/human_defense.dm b/code/modules/mob/living/carbon/human/human_defense.dm index ec4f177e074..8ab535fd81a 100644 --- a/code/modules/mob/living/carbon/human/human_defense.dm +++ b/code/modules/mob/living/carbon/human/human_defense.dm @@ -461,10 +461,9 @@ emp_act w_uniform.add_fingerprint(user) return ..() -//Returns TRUE if the attack hit, FALSE if it missed. -/mob/living/carbon/human/attacked_by__legacy__attackchain(obj/item/I, mob/living/user, def_zone) +/mob/living/carbon/human/attacked_by(obj/item/I, mob/living/user, def_zone) if(!I || !user) - return FALSE + return if(HAS_TRAIT(I, TRAIT_BUTCHERS_HUMANS) && stat == DEAD && user.a_intent == INTENT_HARM) var/obj/item/food/meat/human/newmeat = new /obj/item/food/meat/human(get_turf(loc)) @@ -479,7 +478,7 @@ emp_act if(!meatleft) add_attack_logs(user, src, "Chopped up into meat") qdel(src) - return FALSE + return var/obj/item/organ/external/affecting = get_organ(ran_zone(user.zone_selected)) @@ -492,16 +491,16 @@ emp_act if(user != src) user.do_attack_animation(src) if(check_shields(I, I.force, "the [I.name]", MELEE_ATTACK, I.armour_penetration_flat, I.armour_penetration_percentage)) - return FALSE + return send_item_attack_message(I, user, hit_area) if(!I.force) - return FALSE //item force is zero + return //item force is zero var/armor = run_armor_check(affecting, MELEE, "Your armour has protected your [hit_area].", "Your armour has softened hit to your [hit_area].", armour_penetration_flat = I.armour_penetration_flat, armour_penetration_percentage = I.armour_penetration_percentage) if(armor == INFINITY) - return FALSE + return var/weapon_sharp = I.sharp // do not roll for random blunt if the target mob is dead for the ease of decaps @@ -809,10 +808,10 @@ emp_act O.water_act(volume, temperature, source, method) - -/mob/living/carbon/human/attackby__legacy__attackchain(obj/item/I, mob/user, params) +/mob/living/carbon/human/attack_by(obj/item/I, mob/living/user, params) if(SEND_SIGNAL(src, COMSIG_HUMAN_ATTACKED, user) & COMPONENT_CANCEL_ATTACK_CHAIN) - return TRUE + return FINISH_ATTACK + return ..() /mob/living/carbon/human/is_eyes_covered(check_glasses = TRUE, check_head = TRUE, check_mask = TRUE) diff --git a/code/modules/mob/living/silicon/decoy/decoy.dm b/code/modules/mob/living/silicon/decoy/decoy.dm index 9e589873c6e..e77c177f735 100644 --- a/code/modules/mob/living/silicon/decoy/decoy.dm +++ b/code/modules/mob/living/silicon/decoy/decoy.dm @@ -6,10 +6,10 @@ mobility_flags = 0 a_intent = INTENT_HARM // This is apparently the only thing that stops other mobs walking through them as if they were thin air. -/mob/living/silicon/decoy/attackby__legacy__attackchain(obj/item/W, mob/user, params) +/mob/living/silicon/decoy/item_interaction(mob/living/user, obj/item/W, list/modifiers) if(istype(W, /obj/item/aicard)) to_chat(user, "You cannot find an intellicard slot on [src].") - return TRUE + return ITEM_INTERACT_COMPLETE else return ..() diff --git a/code/modules/mob/living/silicon/pai/pai.dm b/code/modules/mob/living/silicon/pai/pai.dm index 1a0793f528d..4546810ec9d 100644 --- a/code/modules/mob/living/silicon/pai/pai.dm +++ b/code/modules/mob/living/silicon/pai/pai.dm @@ -289,7 +289,7 @@ update_icons() //Overriding this will stop a number of headaches down the track. -/mob/living/silicon/pai/attackby__legacy__attackchain(obj/item/W as obj, mob/user as mob, params) +/mob/living/silicon/pai/item_interaction(mob/living/user, obj/item/W, list/modifiers) if(istype(W, /obj/item/stack/nanopaste)) var/obj/item/stack/nanopaste/N = W if(stat == DEAD) @@ -302,8 +302,13 @@ else to_chat(user, "All [name]'s systems are nominal.") - return - else if(W.force) + return ITEM_INTERACT_COMPLETE + +/mob/living/silicon/pai/attack_by(obj/item/W, mob/living/user, params) + if(..()) + return FINISH_ATTACK + + if(W.force) visible_message("[user.name] attacks [src] with [W]!") adjustBruteLoss(W.force) else @@ -311,7 +316,6 @@ spawn(1) if(stat != 2) close_up() - return /mob/living/silicon/pai/welder_act() return diff --git a/code/modules/mob/living/silicon/robot/drone/maint_drone.dm b/code/modules/mob/living/silicon/robot/drone/maint_drone.dm index a300fa2bac9..cf71c9bf3f6 100644 --- a/code/modules/mob/living/silicon/robot/drone/maint_drone.dm +++ b/code/modules/mob/living/silicon/robot/drone/maint_drone.dm @@ -155,10 +155,10 @@ . += "The ever-loyal workers of Nanotrasen facilities. Known for their small and cute look, these drones seek only to repair damaged parts of the station, being lawed against hurting even a spiderling. These fine drones are programmed against interfering with any business of anyone, so they won't do anything you don't want them to." //Drones cannot be upgraded with borg modules so we need to catch some items before they get used in ..(). -/mob/living/silicon/robot/drone/attackby__legacy__attackchain(obj/item/I, mob/user, params) +/mob/living/silicon/robot/drone/item_interaction(mob/living/user, obj/item/I, list/modifiers) if(istype(I, /obj/item/borg/upgrade)) to_chat(user, "The maintenance drone chassis is not compatible with [I].") - return + return ITEM_INTERACT_COMPLETE else if(istype(I, /obj/item/card/id) || istype(I, /obj/item/pda)) if(stat == DEAD) @@ -186,7 +186,7 @@ drones++ if(drones < config.max_maint_drones) request_player()*/ - return + return ITEM_INTERACT_COMPLETE else var/confirm = tgui_alert(user, "Using your ID on a Maintenance Drone will shut it down, are you sure you want to do this?", "Disable Drone", list("Yes", "No")) @@ -201,9 +201,9 @@ else to_chat(user, "Access denied.") - return + return ITEM_INTERACT_COMPLETE - ..() + return ..() /mob/living/silicon/robot/drone/crowbar_act(mob/user, obj/item/I) . = TRUE diff --git a/code/modules/mob/living/silicon/robot/robot_mob.dm b/code/modules/mob/living/silicon/robot/robot_mob.dm index 9bff14ac1bb..926d1e7324d 100644 --- a/code/modules/mob/living/silicon/robot/robot_mob.dm +++ b/code/modules/mob/living/silicon/robot/robot_mob.dm @@ -921,7 +921,7 @@ GLOBAL_LIST_INIT(robot_verbs_default, list( return 2 -/mob/living/silicon/robot/attackby__legacy__attackchain(obj/item/W, mob/user, params) +/mob/living/silicon/robot/item_interaction(mob/living/user, obj/item/W, list/modifiers) // Check if the user is trying to insert another component like a radio, actuator, armor etc. if(istype(W, /obj/item/robot_parts/robot_component) && opened) for(var/V in components) @@ -930,22 +930,22 @@ GLOBAL_LIST_INIT(robot_verbs_default, list( continue if(!user.drop_item()) to_chat(user, "[W] seems to be stuck in your hand!") - return + return ITEM_INTERACT_COMPLETE var/obj/item/robot_parts/robot_component/WC = W C.brute_damage = WC.brute C.electronics_damage = WC.burn C.install(WC) to_chat(usr, "You install [W].") - return + return ITEM_INTERACT_COMPLETE if(istype(W, /obj/item/stack/cable_coil) && user.a_intent == INTENT_HELP && (wiresexposed || isdrone(src))) user.changeNext_move(CLICK_CD_MELEE) if(!getFireLoss()) to_chat(user, "Nothing to fix!") - return + return ITEM_INTERACT_COMPLETE else if(!getFireLoss(TRUE)) to_chat(user, "The damaged components are beyond saving!") - return + return ITEM_INTERACT_COMPLETE var/obj/item/stack/cable_coil/coil = W adjustFireLoss(-30) updatehealth() @@ -976,13 +976,13 @@ GLOBAL_LIST_INIT(robot_verbs_default, list( module?.update_cells() diag_hud_set_borgcell() - + return ITEM_INTERACT_COMPLETE else if(istype(W, /obj/item/encryptionkey/) && opened) if(radio)//sanityyyyyy radio.attackby__legacy__attackchain(W,user)//GTFO, you have your own procs else to_chat(user, "Unable to locate a radio.") - + return ITEM_INTERACT_COMPLETE else if(istype(W, /obj/item/card/id) || istype(W, /obj/item/pda)) // trying to unlock the interface with an ID card if(emagged)//still allow them to open the cover to_chat(user, "The interface seems slightly damaged.") @@ -996,7 +996,7 @@ GLOBAL_LIST_INIT(robot_verbs_default, list( update_icons() else to_chat(user, "Access denied.") - + return ITEM_INTERACT_COMPLETE else if(istype(W, /obj/item/borg/upgrade/)) var/obj/item/borg/upgrade/U = W if(!opened) @@ -1006,18 +1006,18 @@ GLOBAL_LIST_INIT(robot_verbs_default, list( else if(U.action(user, src)) user.visible_message("[user] applied [U] to [src].", "You apply [U] to [src].") - + return ITEM_INTERACT_COMPLETE else if(istype(W, /obj/item/mmi_radio_upgrade)) if(!opened) to_chat(user, "You must access the borg's internals!") - return + return ITEM_INTERACT_COMPLETE else if(!mmi) to_chat(user, "This cyborg does not have an MMI to augment!") - return + return ITEM_INTERACT_COMPLETE else if(mmi.radio) to_chat(user, "A radio upgrade is already installed in the MMI!") - return + return ITEM_INTERACT_COMPLETE else if(user.drop_item()) to_chat(user, "You apply the upgrade to [src].") to_chat(src, "MMI radio capability installed.") @@ -1133,7 +1133,7 @@ GLOBAL_LIST_INIT(robot_verbs_default, list( -/mob/living/silicon/robot/attacked_by__legacy__attackchain(obj/item/I, mob/living/user, def_zone) +/mob/living/silicon/robot/attacked_by(obj/item/I, mob/living/user, def_zone) if(I.force && I.damtype != STAMINA && stat != DEAD) //only sparks if real damage is dealt. spark_system.start() ..() diff --git a/code/modules/mob/living/silicon/robot/syndicate_robot.dm b/code/modules/mob/living/silicon/robot/syndicate_robot.dm index 891f0fa7d1c..0f1de654931 100644 --- a/code/modules/mob/living/silicon/robot/syndicate_robot.dm +++ b/code/modules/mob/living/silicon/robot/syndicate_robot.dm @@ -118,10 +118,10 @@ return cham_proj.attack_self__legacy__attackchain(src) -/mob/living/silicon/robot/syndicate/saboteur/attackby__legacy__attackchain() +/mob/living/silicon/robot/syndicate/saboteur/attack_by(obj/item/attacking, mob/living/user, params) + . = ..() if(cham_proj) cham_proj.disrupt(src) - ..() /mob/living/silicon/robot/syndicate/saboteur/attack_hand() if(cham_proj) diff --git a/code/modules/mob/living/silicon/silicon_mob.dm b/code/modules/mob/living/silicon/silicon_mob.dm index cdec27e0bcb..e88a7b90b37 100644 --- a/code/modules/mob/living/silicon/silicon_mob.dm +++ b/code/modules/mob/living/silicon/silicon_mob.dm @@ -286,10 +286,14 @@ return 2 -/mob/living/silicon/attacked_by__legacy__attackchain(obj/item/I, mob/living/user, def_zone) +/mob/living/silicon/item_interaction(mob/living/user, obj/item/I, list/modifiers) if(istype(I, /obj/item/clothing/head) && user.a_intent == INTENT_HELP) place_on_head(user.get_active_hand(), user) - return TRUE + return ITEM_INTERACT_COMPLETE + + return ..() + +/mob/living/silicon/attacked_by(obj/item/I, mob/living/user, def_zone) send_item_attack_message(I, user) if(I.force) var/bonus_damage = 0 diff --git a/code/modules/mob/living/simple_animal/animal_defense.dm b/code/modules/mob/living/simple_animal/animal_defense.dm index d99ec190c83..95c22172bf9 100644 --- a/code/modules/mob/living/simple_animal/animal_defense.dm +++ b/code/modules/mob/living/simple_animal/animal_defense.dm @@ -1,9 +1,7 @@ -/mob/living/simple_animal/attackby__legacy__attackchain(obj/item/O, mob/living/user) +/mob/living/simple_animal/item_interaction(mob/living/user, obj/item/O, list/modifiers) if(can_collar && istype(O, /obj/item/petcollar) && !pcollar) add_collar(O, user) - return - else - return ..() + return ITEM_INTERACT_COMPLETE /mob/living/simple_animal/attack_hand(mob/living/carbon/human/M) ..() diff --git a/code/modules/mob/living/simple_animal/bot/bot.dm b/code/modules/mob/living/simple_animal/bot/bot.dm index dfe5e10570b..169b648c17e 100644 --- a/code/modules/mob/living/simple_animal/bot/bot.dm +++ b/code/modules/mob/living/simple_animal/bot/bot.dm @@ -423,44 +423,44 @@ /mob/living/simple_animal/bot/proc/interact(mob/user) show_controls(user) -/mob/living/simple_animal/bot/attackby__legacy__attackchain(obj/item/W, mob/user, params) +/mob/living/simple_animal/bot/item_interaction(mob/living/user, obj/item/W, list/modifiers) if(istype(W, /obj/item/card/id) || istype(W, /obj/item/pda)) if(allowed(user) && !open && !emagged) locked = !locked to_chat(user, "Controls are now [locked ? "locked." : "unlocked."]") - return + return ITEM_INTERACT_COMPLETE if(emagged) to_chat(user, "ERROR") if(open) to_chat(user, "Please close the access panel before locking it.") else to_chat(user, "Access denied.") - return + return ITEM_INTERACT_COMPLETE if(istype(W, /obj/item/paicard)) if(paicard) to_chat(user, "A [paicard] is already inserted!") - return + return ITEM_INTERACT_COMPLETE if(!allow_pai || key) to_chat(user, "[src] is not compatible with [W].") - return + return ITEM_INTERACT_COMPLETE if(locked || open || hijacked) to_chat(user, "The personality slot is locked.") - return + return ITEM_INTERACT_COMPLETE var/obj/item/paicard/card = W if(!card.pai?.mind) to_chat(user, "[W] is inactive.") - return + return ITEM_INTERACT_COMPLETE if(!card.pai.ckey || jobban_isbanned(card.pai, ROLE_SENTIENT)) to_chat(user, "[W] is unable to establish a connection to [src].") - return + return ITEM_INTERACT_COMPLETE if(!user.drop_item()) - return + return ITEM_INTERACT_COMPLETE W.forceMove(src) paicard = card @@ -471,20 +471,19 @@ name = paicard.pai.name faction = user.faction add_attack_logs(user, paicard.pai, "Uploaded to [src.bot_name]") - return + return ITEM_INTERACT_COMPLETE if(istype(W, /obj/item/hemostat) && paicard) if(open) to_chat(user, "Close the access panel before manipulating the personality slot!") - return + return ITEM_INTERACT_COMPLETE to_chat(user, "You attempt to pull [paicard] free...") if(do_after(user, 30 * W.toolspeed, target = src)) if(paicard) user.visible_message("[user] uses [W] to pull [paicard] out of [bot_name]!","You pull [paicard] out of [bot_name] with [W].") ejectpai(user) - return - return ..() + return ITEM_INTERACT_COMPLETE /mob/living/simple_animal/bot/screwdriver_act(mob/living/user, obj/item/I) if(user.a_intent == INTENT_HARM) diff --git a/code/modules/mob/living/simple_animal/bot/cleanbot.dm b/code/modules/mob/living/simple_animal/bot/cleanbot.dm index 697b726d359..4a1e2fbde0b 100644 --- a/code/modules/mob/living/simple_animal/bot/cleanbot.dm +++ b/code/modules/mob/living/simple_animal/bot/cleanbot.dm @@ -88,7 +88,7 @@ text_dehack = "[name]'s software has been reset!" text_dehack_fail = "[name] does not seem to respond to your repair code!" -/mob/living/simple_animal/bot/cleanbot/attackby__legacy__attackchain(obj/item/W, mob/user, params) +/mob/living/simple_animal/bot/cleanbot/item_interaction(mob/living/user, obj/item/W, list/modifiers) if(istype(W, /obj/item/card/id)||istype(W, /obj/item/pda)) if(allowed(user) && !open && !emagged) locked = !locked @@ -100,8 +100,10 @@ to_chat(user, "Please close the access panel before locking it.") else to_chat(user, "\The [src] doesn't seem to respect your authority.") - else - return ..() + + return ITEM_INTERACT_COMPLETE + + return ..() /mob/living/simple_animal/bot/cleanbot/emag_act(mob/user) ..() diff --git a/code/modules/mob/living/simple_animal/bot/ed209bot.dm b/code/modules/mob/living/simple_animal/bot/ed209bot.dm index e8134df8278..1b2bb21f6d9 100644 --- a/code/modules/mob/living/simple_animal/bot/ed209bot.dm +++ b/code/modules/mob/living/simple_animal/bot/ed209bot.dm @@ -184,8 +184,10 @@ retaliate(H) return ..() -/mob/living/simple_animal/bot/ed209/attackby__legacy__attackchain(obj/item/W, mob/user, params) - ..() +/mob/living/simple_animal/bot/ed209/attack_by(obj/item/W, mob/living/user, params) + if(..()) + return FINISH_ATTACK + if(W.force && !target && W.damtype != STAMINA) retaliate(user) if(lasercolor)//To make up for the fact that lasertag bots don't hunt diff --git a/code/modules/mob/living/simple_animal/bot/floorbot.dm b/code/modules/mob/living/simple_animal/bot/floorbot.dm index f4c1ae6edec..65983785559 100644 --- a/code/modules/mob/living/simple_animal/bot/floorbot.dm +++ b/code/modules/mob/living/simple_animal/bot/floorbot.dm @@ -133,11 +133,11 @@ if("ejectpai") ejectpai() -/mob/living/simple_animal/bot/floorbot/attackby__legacy__attackchain(obj/item/W , mob/user, params) +/mob/living/simple_animal/bot/floorbot/item_interaction(mob/living/user, obj/item/W, list/modifiers) if(istype(W, /obj/item/stack/tile/plasteel)) var/obj/item/stack/tile/plasteel/T = W if(amount >= MAX_AMOUNT) - return + return ITEM_INTERACT_COMPLETE var/loaded = min(MAX_AMOUNT - amount, T.amount) T.use(loaded) amount += loaded @@ -147,8 +147,10 @@ update_icon() else to_chat(user, "You need at least one floor tile to put into [src]!") - else - ..() + + return ITEM_INTERACT_COMPLETE + + return ..() /mob/living/simple_animal/bot/floorbot/emag_act(mob/user) ..() diff --git a/code/modules/mob/living/simple_animal/bot/griefsky.dm b/code/modules/mob/living/simple_animal/bot/griefsky.dm index 515bd7eb59b..e122750b31e 100644 --- a/code/modules/mob/living/simple_animal/bot/griefsky.dm +++ b/code/modules/mob/living/simple_animal/bot/griefsky.dm @@ -221,14 +221,15 @@ return return ..() -/mob/living/simple_animal/bot/secbot/griefsky/attackby__legacy__attackchain(obj/item/W, mob/user, params) //cant touch or attack him while spinning +// cant touch or attack him while spinning +/mob/living/simple_animal/bot/secbot/griefsky/attack_by(obj/item/W, mob/living/user, params) + if(..()) + return FINISH_ATTACK + if(src.icon_state == spin_icon) if(prob(block_chance_melee)) user.changeNext_move(CLICK_CD_MELEE) user.do_attack_animation(src) visible_message("[src] deflects [user]'s move with his energy swords!") playsound(loc, 'sound/weapons/blade1.ogg', 50, TRUE, -1) - else - return ..() - else - return ..() + return FINISH_ATTACK diff --git a/code/modules/mob/living/simple_animal/bot/honkbot.dm b/code/modules/mob/living/simple_animal/bot/honkbot.dm index 53d9435b9b7..7abfce0731e 100644 --- a/code/modules/mob/living/simple_animal/bot/honkbot.dm +++ b/code/modules/mob/living/simple_animal/bot/honkbot.dm @@ -116,13 +116,14 @@ addtimer(CALLBACK(src, PROC_REF(react_buzz)), 5) return ..() -/mob/living/simple_animal/bot/honkbot/attackby__legacy__attackchain(obj/item/W, mob/user, params) - ..() - if(istype(W, /obj/item/weldingtool) && user.a_intent != INTENT_HARM) // Any intent but harm will heal, so we shouldn't get angry. - return - if(!isscrewdriver(W) && !locked && (W.force) && (!target) && (W.damtype != STAMINA))//If the target is locked, they are recieving damage from the screwdriver +/mob/living/simple_animal/bot/honkbot/item_interaction(mob/living/user, obj/item/W, list/modifiers) + // If the target is locked, they are recieving damage from the screwdriver + if(!isscrewdriver(W) && !locked && (W.force) && (!target) && (W.damtype != STAMINA)) retaliate(user) addtimer(CALLBACK(src, PROC_REF(react_buzz)), 5) + return ITEM_INTERACT_COMPLETE + + return ..() /mob/living/simple_animal/bot/honkbot/emag_act(mob/user) ..() diff --git a/code/modules/mob/living/simple_animal/bot/medbot.dm b/code/modules/mob/living/simple_animal/bot/medbot.dm index 2124643b007..5a5415b4506 100644 --- a/code/modules/mob/living/simple_animal/bot/medbot.dm +++ b/code/modules/mob/living/simple_animal/bot/medbot.dm @@ -275,28 +275,31 @@ reagent_glass.forceMove(get_turf(src)) reagent_glass = null -/mob/living/simple_animal/bot/medbot/attackby__legacy__attackchain(obj/item/W, mob/user, params) +/mob/living/simple_animal/bot/medbot/item_interaction(mob/living/user, obj/item/W, list/modifiers) if(istype(W, /obj/item/reagent_containers/glass)) - . = TRUE //no afterattack if(locked) to_chat(user, "You cannot insert a beaker because the panel is locked!") - return + return ITEM_INTERACT_COMPLETE if(!isnull(reagent_glass)) to_chat(user, "There is already a beaker loaded!") - return + return ITEM_INTERACT_COMPLETE if(!user.drop_item()) - return + return ITEM_INTERACT_COMPLETE W.forceMove(src) reagent_glass = W to_chat(user, "You insert [W].") ui_interact(user) - else - var/current_health = health - ..() - if(health < current_health) //if medbot took some damage - step_to(src, (get_step_away(src,user))) + return ITEM_INTERACT_COMPLETE + + return ..() + +/mob/living/simple_animal/bot/medbot/attacked_by(obj/item/attacker, mob/living/user) + var/current_health = health + . = ..() + if(health < current_health) //if medbot took some damage + step_to(src, (get_step_away(src,user))) /mob/living/simple_animal/bot/medbot/emag_act(mob/user) ..() diff --git a/code/modules/mob/living/simple_animal/bot/mulebot.dm b/code/modules/mob/living/simple_animal/bot/mulebot.dm index bf6f273569c..6c7de49f142 100644 --- a/code/modules/mob/living/simple_animal/bot/mulebot.dm +++ b/code/modules/mob/living/simple_animal/bot/mulebot.dm @@ -100,16 +100,18 @@ ..() reached_target = 0 -/mob/living/simple_animal/bot/mulebot/attackby__legacy__attackchain(obj/item/I, mob/user, params) +/mob/living/simple_animal/bot/mulebot/item_interaction(mob/living/user, obj/item/I, list/modifiers) if(istype(I,/obj/item/stock_parts/cell) && open && !cell) if(!user.drop_item()) - return + return ITEM_INTERACT_COMPLETE var/obj/item/stock_parts/cell/C = I C.forceMove(src) cell = C visible_message("[user] inserts a cell into [src].", "You insert the new cell into [src].") update_controls() + update_icon() + return ITEM_INTERACT_COMPLETE else if(load && ismob(load)) // chance to knock off rider if(prob(1 + I.force * 2)) unload(0) @@ -117,11 +119,10 @@ "You knock [load] off [src] with \the [I]!") else to_chat(user, "You hit [src] with \the [I] but to no effect!") - ..() - else - ..() - update_icon() - return + update_icon() + return ITEM_INTERACT_COMPLETE + + return ..() /mob/living/simple_animal/bot/mulebot/crowbar_act(mob/living/user, obj/item/I) if(!open || !cell) diff --git a/code/modules/mob/living/simple_animal/bot/secbot.dm b/code/modules/mob/living/simple_animal/bot/secbot.dm index 709943b2313..4c6a8cde2c0 100644 --- a/code/modules/mob/living/simple_animal/bot/secbot.dm +++ b/code/modules/mob/living/simple_animal/bot/secbot.dm @@ -196,8 +196,10 @@ retaliate(H) return ..() -/mob/living/simple_animal/bot/secbot/attackby__legacy__attackchain(obj/item/W, mob/user, params) - ..() +/mob/living/simple_animal/bot/secbot/attacked_by(obj/item/W, mob/living/user) + if(..()) + return FINISH_ATTACK + if(W.force && !target && W.damtype != STAMINA) retaliate(user) diff --git a/code/modules/mob/living/simple_animal/clockwork_constructs.dm b/code/modules/mob/living/simple_animal/clockwork_constructs.dm index 1b528159d21..e443268daa1 100644 --- a/code/modules/mob/living/simple_animal/clockwork_constructs.dm +++ b/code/modules/mob/living/simple_animal/clockwork_constructs.dm @@ -51,18 +51,16 @@ playsound(src, 'sound/effects/pylon_shatter.ogg', 40, TRUE) return ..() -/mob/living/simple_animal/hostile/clockwork_construct/clockwork_marauder/attacked_by__legacy__attackchain(obj/item/I, mob/living/user) +/mob/living/simple_animal/hostile/clockwork_construct/clockwork_marauder/attacked_by(obj/item/I, mob/living/user) + if(..()) + return FINISH_ATTACK + if(istype(I, /obj/item/nullrod)) adjustFireLoss(15) if(shield_health > 0) damage_shield() playsound(src,'sound/hallucinations/veryfar_noise.ogg', 40, 1) - if((I.tool_behaviour == TOOL_WELDER) && (user.a_intent == INTENT_HELP)) - welder_act(user, I) - return - . = ..() - /mob/living/simple_animal/hostile/clockwork_construct/clockwork_marauder/bullet_act(obj/item/projectile/Proj) if(shield_health > 0) damage_shield() diff --git a/code/modules/mob/living/simple_animal/friendly/dog.dm b/code/modules/mob/living/simple_animal/friendly/dog.dm index 76774275d45..345da7051ee 100644 --- a/code/modules/mob/living/simple_animal/friendly/dog.dm +++ b/code/modules/mob/living/simple_animal/friendly/dog.dm @@ -22,7 +22,6 @@ var/last_eaten = 0 footstep_type = FOOTSTEP_MOB_CLAW var/next_spin_message = 0 - var/razor_shave_delay = 5 SECONDS /mob/living/simple_animal/pet/dog/npc_safe(mob/user) return TRUE @@ -84,6 +83,7 @@ var/list/strippable_inventory_slots = list() var/shaved = FALSE var/nofur = FALSE //Corgis that have risen past the material plane of existence. + var/razor_shave_delay = 5 SECONDS /mob/living/simple_animal/pet/dog/corgi/Initialize(mapload) . = ..() @@ -185,14 +185,14 @@ armorval += inventory_back.armor.getRating(type) return armorval * 0.5 -/mob/living/simple_animal/pet/dog/corgi/attackby__legacy__attackchain(obj/item/O, mob/user, params) +/mob/living/simple_animal/pet/dog/corgi/item_interaction(mob/living/user, obj/item/O, list/modifiers) if(istype(O, /obj/item/razor)) if(shaved) to_chat(user, "You can't shave this corgi, it's already been shaved!") - return + return ITEM_INTERACT_COMPLETE if(nofur) to_chat(user, "You can't shave this corgi, it doesn't have a fur coat!") - return + return ITEM_INTERACT_COMPLETE user.visible_message("[user] starts to shave [src] using \the [O].", "You start to shave [src] using \the [O]...") if(do_after(user, razor_shave_delay, target = src)) user.visible_message("[user] shaves [src]'s hair using \the [O].") @@ -204,9 +204,10 @@ icon_state = icon_living else icon_state = icon_dead - return - ..() - update_corgi_fluff() + update_corgi_fluff() + return ITEM_INTERACT_COMPLETE + + return ..() //Corgis are supposed to be simpler, so only a select few objects can actually be put //to be compatible with them. The objects are below. diff --git a/code/modules/mob/living/simple_animal/friendly/farm_animals.dm b/code/modules/mob/living/simple_animal/friendly/farm_animals.dm index 76a098c6b5d..4d87bb98c0c 100644 --- a/code/modules/mob/living/simple_animal/friendly/farm_animals.dm +++ b/code/modules/mob/living/simple_animal/friendly/farm_animals.dm @@ -73,11 +73,10 @@ if(stat == CONSCIOUS) eat_plants() -/mob/living/simple_animal/hostile/retaliate/goat/attackby__legacy__attackchain(obj/item/O as obj, mob/user as mob, params) +/mob/living/simple_animal/hostile/retaliate/goat/item_interaction(mob/living/user, obj/item/O, list/modifiers) if(stat == CONSCIOUS && istype(O, /obj/item/reagent_containers/glass)) udder.milkAnimal(O, user) - else - return ..() + return ITEM_INTERACT_COMPLETE /mob/living/simple_animal/hostile/retaliate/goat/proc/eat_plants() var/eaten = FALSE @@ -146,12 +145,10 @@ QDEL_NULL(udder) return ..() -/mob/living/simple_animal/cow/attackby__legacy__attackchain(obj/item/O, mob/user, params) +/mob/living/simple_animal/cow/item_interaction(mob/living/user, obj/item/O, list/modifiers) if(stat == CONSCIOUS && istype(O, /obj/item/reagent_containers/glass)) udder.milkAnimal(O, user) - return TRUE - else - return ..() + return ITEM_INTERACT_COMPLETE /mob/living/simple_animal/cow/Life(seconds, times_fired) . = ..() @@ -319,7 +316,7 @@ GLOBAL_VAR_INIT(chicken_count, 0) return GLOB.chicken_count -= 1 -/mob/living/simple_animal/chicken/attackby__legacy__attackchain(obj/item/O, mob/user, params) +/mob/living/simple_animal/chicken/item_interaction(mob/living/user, obj/item/O, list/modifiers) if(istype(O, food_type)) //feedin' dem chickens if(stat == CONSCIOUS && eggsleft < 8) var/feedmsg = "[user] feeds [O] to [name]! [pick(feedMessages)]" @@ -330,8 +327,8 @@ GLOBAL_VAR_INIT(chicken_count, 0) //world << eggsleft else to_chat(user, "[name] doesn't seem hungry!") - else - ..() + + return ITEM_INTERACT_COMPLETE /mob/living/simple_animal/chicken/attack_hand(mob/living/carbon/human/M) if(M.a_intent == INTENT_HELP) diff --git a/code/modules/mob/living/simple_animal/friendly/nian_caterpillar.dm b/code/modules/mob/living/simple_animal/friendly/nian_caterpillar.dm index be47ddf0ade..591b9d9ba84 100644 --- a/code/modules/mob/living/simple_animal/friendly/nian_caterpillar.dm +++ b/code/modules/mob/living/simple_animal/friendly/nian_caterpillar.dm @@ -124,11 +124,11 @@ else get_scooped(M) -/mob/living/simple_animal/nian_caterpillar/attacked_by__legacy__attackchain(obj/item/I, mob/living/user, def_zone) +/mob/living/simple_animal/nian_caterpillar/attacked_by(obj/item/I, mob/living/user) + if(..()) + return FINISH_ATTACK if(istype(I, /obj/item/melee/flyswatter) && I.force) gib() // Commit die. - else - ..() /datum/action/innate/nian_caterpillar_emerge name = "Evolve" diff --git a/code/modules/mob/living/simple_animal/friendly/pet.dm b/code/modules/mob/living/simple_animal/friendly/pet.dm index 3fe1738f7f2..45ace13f41c 100644 --- a/code/modules/mob/living/simple_animal/friendly/pet.dm +++ b/code/modules/mob/living/simple_animal/friendly/pet.dm @@ -7,11 +7,12 @@ speed = 0 // same speed as a person. hud_type = /datum/hud/corgi -/mob/living/simple_animal/pet/attackby__legacy__attackchain(obj/item/O, mob/user, params) +/mob/living/simple_animal/pet/item_interaction(mob/living/user, obj/item/O, list/modifiers) if(!istype(O, /obj/item/newspaper)) return ..() var/obj/item/newspaper/paper = O if(stat != CONSCIOUS || !paper.rolled) - return + return ..() user.visible_message("[user] baps [name] on the nose with the rolled up [O].") INVOKE_ASYNC(src, PROC_REF(spin), 7 DECISECONDS, 1) + return ITEM_INTERACT_COMPLETE diff --git a/code/modules/mob/living/simple_animal/friendly/spiderbot.dm b/code/modules/mob/living/simple_animal/friendly/spiderbot.dm index 2b1c3ecc76c..782ce23fe38 100644 --- a/code/modules/mob/living/simple_animal/friendly/spiderbot.dm +++ b/code/modules/mob/living/simple_animal/friendly/spiderbot.dm @@ -46,15 +46,15 @@ eject_brain() return ..() -/mob/living/simple_animal/spiderbot/attackby__legacy__attackchain(obj/item/O, mob/living/user, params) +/mob/living/simple_animal/spiderbot/item_interaction(mob/living/user, obj/item/O, list/modifiers) if(istype(O, /obj/item/mmi)) var/obj/item/mmi/B = O if(mmi) //There's already a brain in it. to_chat(user, "There's already a brain in [src]!") - return + return ITEM_INTERACT_COMPLETE if(!B.brainmob) to_chat(user, "Sticking an empty MMI into the frame would sort of defeat the purpose.") - return + return ITEM_INTERACT_COMPLETE if(!B.brainmob.key) var/ghost_can_reenter = 0 if(B.brainmob.mind) @@ -68,15 +68,15 @@ break if(!ghost_can_reenter) to_chat(user, "[B] is completely unresponsive; there's no point.") - return + return ITEM_INTERACT_COMPLETE if(B.brainmob.stat == DEAD) to_chat(user, "[B] is dead. Sticking it into the frame would sort of defeat the purpose.") - return + return ITEM_INTERACT_COMPLETE if(jobban_isbanned(B.brainmob, "Cyborg") || jobban_isbanned(B.brainmob, "nonhumandept")) to_chat(user, "[B] does not seem to fit.") - return + return ITEM_INTERACT_COMPLETE to_chat(user, "You install [B] in [src]!") @@ -86,16 +86,16 @@ transfer_personality(B) update_icon() - return 1 + return ITEM_INTERACT_COMPLETE else if(istype(O, /obj/item/card/id) || istype(O, /obj/item/pda)) if(!mmi) to_chat(user, "There's no reason to swipe your ID - the spiderbot has no brain to remove.") - return 0 + return ITEM_INTERACT_COMPLETE if(emagged) to_chat(user, "[src] doesn't seem to respond.") - return 0 + return ITEM_INTERACT_COMPLETE var/obj/item/card/id/id_card @@ -108,13 +108,10 @@ if(ACCESS_ROBOTICS in id_card.access) to_chat(user, "You swipe your access card and pop the brain out of [src].") eject_brain() - return 1 + return ITEM_INTERACT_COMPLETE else to_chat(user, "You swipe your card, with no effect.") - return 0 - - else - ..() + return ITEM_INTERACT_COMPLETE /mob/living/simple_animal/spiderbot/welder_act(mob/user, obj/item/I) if(user.a_intent != INTENT_HELP) diff --git a/code/modules/mob/living/simple_animal/hostile/hellhound.dm b/code/modules/mob/living/simple_animal/hostile/hellhound.dm index ea7efce6bb6..8cc3209b113 100644 --- a/code/modules/mob/living/simple_animal/hostile/hellhound.dm +++ b/code/modules/mob/living/simple_animal/hostile/hellhound.dm @@ -92,8 +92,10 @@ return TRUE return FALSE -/mob/living/simple_animal/hostile/hellhound/attackby__legacy__attackchain(obj/item/C, mob/user, params) - . = ..() +/mob/living/simple_animal/hostile/hellhound/attacked_by(obj/item/attacker, mob/living/user) + if(..()) + return FINISH_ATTACK + if(target && isliving(target)) var/mob/living/L = target if(L.stat != CONSCIOUS) diff --git a/code/modules/mob/living/simple_animal/hostile/hostile.dm b/code/modules/mob/living/simple_animal/hostile/hostile.dm index 1e1ec2624d6..da97915a8a7 100644 --- a/code/modules/mob/living/simple_animal/hostile/hostile.dm +++ b/code/modules/mob/living/simple_animal/hostile/hostile.dm @@ -115,10 +115,12 @@ Move(get_step(src, chosen_dir)) face_atom(target) //Looks better if they keep looking at you when dodging -/mob/living/simple_animal/hostile/attacked_by__legacy__attackchain(obj/item/I, mob/living/user) +/mob/living/simple_animal/hostile/attacked_by(obj/item/attacker, mob/living/user) + if(..()) + return FINISH_ATTACK + if(stat == CONSCIOUS && !target && AIStatus != AI_OFF && !client && user) FindTarget(list(user), 1) - return ..() /mob/living/simple_animal/hostile/bullet_act(obj/item/projectile/P) if(stat == CONSCIOUS && !target && AIStatus != AI_OFF && !client) diff --git a/code/modules/mob/living/simple_animal/hostile/megafauna/ancient_robot.dm b/code/modules/mob/living/simple_animal/hostile/megafauna/ancient_robot.dm index 5d1dcec846c..0ce36c72ad3 100644 --- a/code/modules/mob/living/simple_animal/hostile/megafauna/ancient_robot.dm +++ b/code/modules/mob/living/simple_animal/hostile/megafauna/ancient_robot.dm @@ -344,9 +344,12 @@ Difficulty: Hard if(P.damage) disable_shield() -/mob/living/simple_animal/hostile/megafauna/ancient_robot/attacked_by__legacy__attackchain(obj/item/I, mob/living/user) +/mob/living/simple_animal/hostile/megafauna/ancient_robot/attacked_by(obj/item/I, mob/living/user) + if(..()) + return FINISH_ATTACK + if(!body_shield_enabled) - return ..() + return do_sparks(2, 1, src) visible_message("[src]'s shield deflects [I] in a shower of sparks!", "You deflect the attack!") if(I.force) diff --git a/code/modules/mob/living/simple_animal/hostile/mining/elites/elite.dm b/code/modules/mob/living/simple_animal/hostile/mining/elites/elite.dm index 5c9219a88f9..574d59e0890 100644 --- a/code/modules/mob/living/simple_animal/hostile/mining/elites/elite.dm +++ b/code/modules/mob/living/simple_animal/hostile/mining/elites/elite.dm @@ -425,14 +425,17 @@ While using this makes the system rely on OnFire, it still gives options for tim w_class = WEIGHT_CLASS_SMALL throw_speed = 3 throw_range = 5 + new_attack_chain = TRUE -/obj/item/tumor_shard/afterattack__legacy__attackchain(atom/target, mob/user, proximity_flag) - . = ..() - if(istype(target, /mob/living/simple_animal/hostile/asteroid/elite) && proximity_flag) +/obj/item/tumor_shard/interact_with_atom(atom/target, mob/living/user, list/modifiers) + user.changeNext_move(CLICK_CD_MELEE) + user.do_attack_animation(target) + + if(istype(target, /mob/living/simple_animal/hostile/asteroid/elite)) var/mob/living/simple_animal/hostile/asteroid/elite/E = target if(E.stat != DEAD || E.sentience_type != SENTIENCE_BOSS || !E.key) user.visible_message("It appears [E] is unable to be revived right now. Perhaps try again later.") - return + return ITEM_INTERACT_COMPLETE E.faction = list("\ref[user]") E.friends += user E.revive() @@ -453,6 +456,8 @@ While using this makes the system rely on OnFire, it still gives options for tim else to_chat(user, "[src] only works on the corpse of a sentient lavaland elite.") + return ITEM_INTERACT_COMPLETE + /obj/effect/temp_visual/elite_tumor_wall name = "magic wall" icon = 'icons/turf/walls/hierophant_wall_temp.dmi' diff --git a/code/modules/mob/living/simple_animal/hostile/mining/gutlunch.dm b/code/modules/mob/living/simple_animal/hostile/mining/gutlunch.dm index 8152bc5e4fd..7f0f2b40830 100644 --- a/code/modules/mob/living/simple_animal/hostile/mining/gutlunch.dm +++ b/code/modules/mob/living/simple_animal/hostile/mining/gutlunch.dm @@ -58,12 +58,11 @@ if(udder.reagents.total_volume == udder.reagents.maximum_volume) add_overlay("gl_full") -/mob/living/simple_animal/hostile/asteroid/gutlunch/attackby__legacy__attackchain(obj/item/O, mob/user, params) +/mob/living/simple_animal/hostile/asteroid/gutlunch/item_interaction(mob/living/user, obj/item/O, list/modifiers) if(stat == CONSCIOUS && istype(O, /obj/item/reagent_containers/glass)) udder.milkAnimal(O, user) regenerate_icons() - else - return ..() + return ITEM_INTERACT_COMPLETE /mob/living/simple_animal/hostile/asteroid/gutlunch/CanAttack(atom/the_target) // Gutlunch-specific version of CanAttack to handle stupid stat_exclusive = true crap so we don't have to do it for literally every single simple_animal/hostile except the two that spawn in lavaland if(isturf(the_target) || !the_target || the_target.type == /atom/movable/lighting_object) // bail out on invalids diff --git a/code/modules/mob/living/simple_animal/hostile/mushroom.dm b/code/modules/mob/living/simple_animal/hostile/mushroom.dm index 2bb2f7ece42..5028628dac6 100644 --- a/code/modules/mob/living/simple_animal/hostile/mushroom.dm +++ b/code/modules/mob/living/simple_animal/hostile/mushroom.dm @@ -151,17 +151,21 @@ src.visible_message("[src] was bruised!") bruised = 1 -/mob/living/simple_animal/hostile/mushroom/attackby__legacy__attackchain(obj/item/I as obj, mob/user as mob, params) +/mob/living/simple_animal/hostile/mushroom/item_interaction(mob/living/user, obj/item/I, list/modifiers) if(istype(I, /obj/item/food/grown/mushroom)) if(stat == DEAD && !recovery_cooldown) Recover() qdel(I) else to_chat(user, "[src] won't eat it!") - return - if(I.force) + return ITEM_INTERACT_COMPLETE + +/mob/living/simple_animal/hostile/mushroom/attacked_by(obj/item/attacker, mob/living/user) + if(..()) + return FINISH_ATTACK + + if(attacker.force) Bruise() - ..() /mob/living/simple_animal/hostile/mushroom/attack_hand(mob/living/carbon/human/M as mob) ..() diff --git a/code/modules/mob/living/simple_animal/hostile/syndicate_mobs.dm b/code/modules/mob/living/simple_animal/hostile/syndicate_mobs.dm index 763314f704d..d247ce22560 100644 --- a/code/modules/mob/living/simple_animal/hostile/syndicate_mobs.dm +++ b/code/modules/mob/living/simple_animal/hostile/syndicate_mobs.dm @@ -61,7 +61,10 @@ var/melee_block_chance = 20 var/ranged_block_chance = 35 -/mob/living/simple_animal/hostile/syndicate/melee/attackby__legacy__attackchain(obj/item/O as obj, mob/user as mob, params) +/mob/living/simple_animal/hostile/syndicate/melee/attack_by(obj/item/O, mob/living/user, params) + if(..()) + return FINISH_ATTACK + user.changeNext_move(CLICK_CD_MELEE) user.do_attack_animation(src) if(O.force) @@ -81,6 +84,7 @@ to_chat(usr, "This weapon is ineffective, it does no damage.") visible_message("[user] gently taps [src] with [O].") + return FINISH_ATTACK /mob/living/simple_animal/hostile/syndicate/melee/bullet_act(obj/item/projectile/Proj) if(!Proj) diff --git a/code/modules/mob/living/simple_animal/parrot.dm b/code/modules/mob/living/simple_animal/parrot.dm index e35f1243869..ca3f0c5bc3e 100644 --- a/code/modules/mob/living/simple_animal/parrot.dm +++ b/code/modules/mob/living/simple_animal/parrot.dm @@ -177,19 +177,19 @@ return //Mobs with objects -/mob/living/simple_animal/parrot/attackby__legacy__attackchain(obj/item/O, mob/user, params) - ..() - if(stat == CONSCIOUS && !client && !istype(O, /obj/item/stack/medical)) - if(O.force) - if(parrot_state == PARROT_PERCH) - parrot_sleep_dur = parrot_sleep_max //Reset it's sleep timer if it was perched +/mob/living/simple_animal/parrot/attacked_by(obj/item/O, mob/living/user) + if(..()) + return FINISH_ATTACK - parrot_interest = user - parrot_state = PARROT_SWOOP|PARROT_FLEE - icon_state = "parrot_fly" - ADD_TRAIT(src, TRAIT_FLYING, INNATE_TRAIT) - drop_held_item(FALSE) - return + if(O.force) + if(parrot_state == PARROT_PERCH) + parrot_sleep_dur = parrot_sleep_max //Reset it's sleep timer if it was perched + + parrot_interest = user + parrot_state = PARROT_SWOOP|PARROT_FLEE + icon_state = "parrot_fly" + ADD_TRAIT(src, TRAIT_FLYING, INNATE_TRAIT) + drop_held_item(FALSE) //Bullets /mob/living/simple_animal/parrot/bullet_act(obj/item/projectile/P) diff --git a/code/modules/mob/living/simple_animal/posessed_object.dm b/code/modules/mob/living/simple_animal/posessed_object.dm index e0680fdc37d..0807eb841b9 100644 --- a/code/modules/mob/living/simple_animal/posessed_object.dm +++ b/code/modules/mob/living/simple_animal/posessed_object.dm @@ -173,12 +173,13 @@ set_opacity(possessed_item.opacity) return ..(NONE) -/mob/living/simple_animal/possessed_object/attackby__legacy__attackchain(obj/item/O, mob/living/user) - . = ..() +/mob/living/simple_animal/possessed_object/item_interaction(mob/living/user, obj/item/O, list/modifiers) if(istype(O, /obj/item/nullrod)) visible_message("[O] dispels the spooky aura!") death() + return ITEM_INTERACT_COMPLETE + /mob/living/simple_animal/possessed_object/throw_impact(atom/hit_atom, throwingdatum) //Don't call parent here as the mob isn't doing the hitting, technically return possessed_item.throw_impact(hit_atom, throwingdatum) diff --git a/code/modules/mob/living/simple_animal/shade.dm b/code/modules/mob/living/simple_animal/shade.dm index 89e82885dd5..5b01640d90c 100644 --- a/code/modules/mob/living/simple_animal/shade.dm +++ b/code/modules/mob/living/simple_animal/shade.dm @@ -33,12 +33,11 @@ initial_traits = list(TRAIT_FLYING, TRAIT_SHOCKIMMUNE) var/holy = FALSE -/mob/living/simple_animal/shade/attackby__legacy__attackchain(obj/item/O, mob/user) //Marker -Agouri +/mob/living/simple_animal/shade/item_interaction(mob/living/user, obj/item/O, list/modifiers) if(istype(O, /obj/item/soulstone)) var/obj/item/soulstone/SS = O SS.transfer_soul("SHADE", src, user) - else - ..() + return ITEM_INTERACT_COMPLETE /mob/living/simple_animal/shade/Process_Spacemove(movement_dir = 0, continuous_move = FALSE) return TRUE diff --git a/code/modules/mob/living/simple_animal/slime/slime_mob.dm b/code/modules/mob/living/simple_animal/slime/slime_mob.dm index 5ac5ae2d183..9b49db04205 100644 --- a/code/modules/mob/living/simple_animal/slime/slime_mob.dm +++ b/code/modules/mob/living/simple_animal/slime/slime_mob.dm @@ -356,35 +356,39 @@ discipline_slime(M) - -/mob/living/simple_animal/slime/attackby__legacy__attackchain(obj/item/I, mob/living/user, params) +/mob/living/simple_animal/slime/item_interaction(mob/living/user, obj/item/I, list/modifiers) if(stat == DEAD && length(surgeries)) if(user.a_intent == INTENT_HELP || user.a_intent == INTENT_DISARM) for(var/datum/surgery/S in surgeries) if(S.next_step(user, src)) - return 1 + return ITEM_INTERACT_COMPLETE if(istype(I, /obj/item/stack/sheet/mineral/plasma) && stat == CONSCIOUS) //Let's you feed slimes plasma. to_chat(user, "You feed the slime the plasma. It chirps happily.") var/obj/item/stack/sheet/mineral/plasma/S = I S.use(1) discipline_slime(user) - return + return ITEM_INTERACT_COMPLETE if(I.force > 0) attacked += 10 if(prob(25)) user.do_attack_animation(src) user.changeNext_move(CLICK_CD_MELEE) to_chat(user, "[I] passes right through [src]!") - return + return ITEM_INTERACT_COMPLETE if(Discipline && prob(50)) // wow, buddy, why am I getting attacked?? Discipline = 0 + return ITEM_INTERACT_COMPLETE + +/mob/living/simple_animal/slime/attacked_by(obj/item/I, mob/living/user) + if(..()) + return FINISH_ATTACK + if(I.force >= 3) var/force_effect = 2 * I.force if(is_adult) force_effect = round(I.force / 2) if(prob(10 + force_effect)) discipline_slime(user) - ..() /mob/living/simple_animal/slime/water_act(volume, temperature, source, method = REAGENT_TOUCH) . = ..() diff --git a/code/modules/mob/mob_holder.dm b/code/modules/mob/mob_holder.dm index 51bada17cab..dee0d5aeafe 100644 --- a/code/modules/mob/mob_holder.dm +++ b/code/modules/mob/mob_holder.dm @@ -27,7 +27,7 @@ /obj/item/holder/attackby__legacy__attackchain(obj/item/W as obj, mob/user as mob, params) for(var/mob/M in src.contents) - M.attackby__legacy__attackchain(W,user, params) + M.attack_by(W, user, params) /obj/item/holder/proc/show_message(message, m_type, chat_message_type) for(var/mob/living/M in contents) diff --git a/code/modules/mob/mob_vars.dm b/code/modules/mob/mob_vars.dm index 136b305b3d9..9a4424ea66f 100644 --- a/code/modules/mob/mob_vars.dm +++ b/code/modules/mob/mob_vars.dm @@ -256,3 +256,5 @@ /// Does this mob speak OOC? /// Controls whether they can say some symbols. var/speaks_ooc = FALSE + + new_attack_chain = TRUE diff --git a/code/modules/projectiles/gun.dm b/code/modules/projectiles/gun.dm index 780e94bd70b..aa02b7910ad 100644 --- a/code/modules/projectiles/gun.dm +++ b/code/modules/projectiles/gun.dm @@ -333,7 +333,7 @@ /obj/item/gun/attack__legacy__attackchain(mob/M, mob/user) if(user.a_intent == INTENT_HARM) //Flogging if(bayonet) - M.attackby__legacy__attackchain(bayonet, user) + M.attack_by(bayonet, user) else return ..()