From a1ada2c9efb044644d3abbb1e1e0a084afc3bb78 Mon Sep 17 00:00:00 2001 From: Tim Date: Thu, 16 Feb 2023 19:22:14 -0600 Subject: [PATCH] Refactor, improve, and rename canUseTopic to be can_perform_action (#73434) This builds on what #69790 did and improved the code even further. Notable things: - `Topic()` is a deprecated proc in our codebase (replaced with Javascript tgui) so it makes sense to rename `canUseTopic` to `can_perform_action` which is more straightforward in what it does. - Positional and named arguments have been converted into a easier to use `action_bitflag` - The bitflags adds some new checks you can use like: `NEED_GRAVITY | NEED_LITERACY | NEED_LIGHT` when you want to perform an action. - Redundant, duplicate, or dead code has been removed. - Fixes several runtimes where `canUseTopic` was being called without a proper target (IV drips, gibber, food processor) - Better documentation for the proc and bitflags with examples --- code/__DEFINES/mobs.dm | 17 ++++++ code/datums/components/gps.dm | 2 +- code/datums/components/religious_tool.dm | 4 +- code/datums/components/rotation.dm | 2 +- code/datums/components/shuttle_cling.dm | 2 +- .../datums/storage/subtypes/bag_of_holding.dm | 2 +- code/game/machinery/_machinery.dm | 2 +- code/game/machinery/announcement_system.dm | 8 +-- code/game/machinery/camera/camera.dm | 2 +- code/game/machinery/camera/camera_assembly.dm | 2 +- code/game/machinery/civilian_bounties.dm | 2 +- code/game/machinery/computer/_computer.dm | 2 +- .../game/machinery/computer/communications.dm | 2 +- code/game/machinery/computer/dna_console.dm | 2 +- .../machinery/computer/records/records.dm | 6 +- code/game/machinery/defibrillator_mount.dm | 2 +- code/game/machinery/deployable.dm | 2 +- code/game/machinery/dish_drive.dm | 2 +- code/game/machinery/doors/poddoor.dm | 2 +- code/game/machinery/fat_sucker.dm | 2 +- code/game/machinery/iv_drip.dm | 6 +- code/game/machinery/launch_pad.dm | 2 +- code/game/machinery/medical_kiosk.dm | 2 +- code/game/machinery/newscaster/newspaper.dm | 2 +- .../porta_turret/portable_turret_construct.dm | 2 +- code/game/machinery/sleepers.dm | 2 +- code/game/machinery/spaceheater.dm | 2 +- code/game/machinery/stasis.dm | 2 +- code/game/machinery/syndicatebomb.dm | 4 +- code/game/machinery/washing_machine.dm | 2 +- .../game/objects/items/AI_modules/freeform.dm | 2 +- code/game/objects/items/AI_modules/repair.dm | 2 +- code/game/objects/items/blueprints.dm | 2 +- code/game/objects/items/cards_ids.dm | 6 +- code/game/objects/items/choice_beacon.dm | 2 +- .../machines/machine_circuitboards.dm | 2 +- code/game/objects/items/cosmetics.dm | 4 +- code/game/objects/items/crayons.dm | 2 +- code/game/objects/items/credit_holochip.dm | 4 +- code/game/objects/items/devices/beacon.dm | 2 +- .../objects/items/devices/desynchronizer.dm | 4 +- .../objects/items/devices/geiger_counter.dm | 2 +- .../items/devices/portable_chem_mixer.dm | 2 +- .../objects/items/devices/quantum_keycard.dm | 2 +- .../objects/items/devices/radio/headset.dm | 2 +- .../items/devices/scanners/gas_analyzer.dm | 2 +- .../items/devices/scanners/health_analyzer.dm | 2 +- .../devices/scanners/sequence_scanner.dm | 2 +- code/game/objects/items/devices/swapper.dm | 2 +- code/game/objects/items/drug_items.dm | 2 +- code/game/objects/items/dyekit.dm | 6 +- code/game/objects/items/extinguisher.dm | 2 +- code/game/objects/items/flamethrower.dm | 2 +- code/game/objects/items/grenades/_grenade.dm | 2 +- .../objects/items/grenades/chem_grenade.dm | 2 +- code/game/objects/items/grenades/plastic.dm | 2 +- .../objects/items/implants/implantcase.dm | 2 +- code/game/objects/items/implants/implanter.dm | 2 +- .../game/objects/items/implants/implantpad.dm | 4 +- code/game/objects/items/inspector.dm | 4 +- code/game/objects/items/pet_carrier.dm | 13 +++-- code/game/objects/items/signs.dm | 2 +- code/game/objects/items/spear.dm | 2 +- code/game/objects/items/stacks/stack.dm | 4 +- code/game/objects/items/stacks/wrap.dm | 2 +- code/game/objects/items/storage/belt.dm | 2 +- code/game/objects/items/storage/lockbox.dm | 2 +- code/game/objects/items/tanks/tank_types.dm | 2 +- code/game/objects/objs.dm | 2 +- .../objects/structures/beds_chairs/bed.dm | 2 +- .../objects/structures/beds_chairs/chair.dm | 4 +- code/game/objects/structures/bedsheet_bin.dm | 2 +- .../structures/crates_lockers/closets.dm | 4 +- .../crates_lockers/closets/bodybag.dm | 4 +- code/game/objects/structures/displaycase.dm | 4 +- code/game/objects/structures/divine.dm | 2 +- code/game/objects/structures/extinguisher.dm | 2 +- code/game/objects/structures/gym.dm | 2 +- .../objects/structures/lavaland/geyser.dm | 2 +- code/game/objects/structures/maintenance.dm | 2 +- code/game/objects/structures/mirror.dm | 22 ++++---- code/game/objects/structures/morgue.dm | 4 +- code/game/objects/structures/reflector.dm | 4 +- code/game/objects/structures/safe.dm | 2 +- .../objects/structures/training_machine.dm | 2 +- .../pirate/pirate_shuttle_equipment.dm | 2 +- .../antagonists/wizard/equipment/artefact.dm | 2 +- code/modules/art/paintings.dm | 4 +- code/modules/assembly/doorcontrol.dm | 2 +- .../machinery/air_alarm/air_alarm_interact.dm | 2 +- .../machinery/portable/canister.dm | 2 +- .../portable/portable_atmospherics.dm | 2 +- code/modules/cards/cardhand.dm | 2 +- code/modules/cards/cards.dm | 2 +- code/modules/cards/deck/deck.dm | 4 +- code/modules/cards/singlecard.dm | 6 +- code/modules/cargo/supplypod_beacon.dm | 4 +- code/modules/cargo/universal_scanner.dm | 2 +- code/modules/clothing/head/jobs.dm | 2 +- code/modules/clothing/head/soft_caps.dm | 2 +- code/modules/clothing/head/wig.dm | 2 +- code/modules/clothing/masks/breath.dm | 2 +- .../clothing/spacesuits/_spacesuits.dm | 4 +- code/modules/clothing/spacesuits/plasmamen.dm | 2 +- code/modules/clothing/under/_under.dm | 2 +- code/modules/clothing/under/accessories.dm | 2 +- code/modules/detectivework/scanner.dm | 8 +-- code/modules/economy/holopay.dm | 4 +- code/modules/events/holiday/vday.dm | 2 +- code/modules/fishing/aquarium/aquarium.dm | 2 +- .../food_and_drinks/machinery/coffeemaker.dm | 6 +- .../food_and_drinks/machinery/gibber.dm | 2 +- .../food_and_drinks/machinery/icecream_vat.dm | 2 +- .../food_and_drinks/machinery/microwave.dm | 6 +- .../food_and_drinks/machinery/processor.dm | 2 +- .../food_and_drinks/machinery/smartfridge.dm | 2 +- code/modules/food_and_drinks/pizzabox.dm | 4 +- code/modules/hydroponics/beekeeping/beebox.dm | 2 +- code/modules/hydroponics/biogenerator.dm | 2 +- code/modules/hydroponics/grown/replicapod.dm | 2 +- code/modules/hydroponics/hydroponics.dm | 8 +-- code/modules/hydroponics/seeds.dm | 8 +-- code/modules/instruments/songs/editor.dm | 2 +- code/modules/instruments/stationary.dm | 4 +- code/modules/library/book.dm | 10 ++-- code/modules/library/bookcase.dm | 4 +- code/modules/mining/abandoned_crates.dm | 4 +- .../mining/equipment/marker_beacons.dm | 8 +-- .../equipment/monster_organs/monster_organ.dm | 2 +- code/modules/mining/machine_redemption.dm | 2 +- code/modules/mob/dead/observer/observer.dm | 2 +- code/modules/mob/living/brain/posibrain.dm | 4 +- code/modules/mob/living/carbon/carbon.dm | 2 +- code/modules/mob/living/living.dm | 56 ++++++++++++++----- code/modules/mob/living/silicon/ai/ai.dm | 4 +- .../modules/mob/living/silicon/robot/robot.dm | 2 +- .../mob/living/simple_animal/bot/bot.dm | 4 +- .../mob/living/simple_animal/revenant.dm | 2 +- code/modules/mob/mob.dm | 26 ++++++--- .../computers/item/computer.dm | 4 +- .../computers/item/disks/virus_disk.dm | 4 +- .../computers/item/laptop.dm | 2 +- .../modular_computers/computers/item/pda.dm | 2 +- .../file_system/programs/ntmessenger.dm | 4 +- code/modules/pai/pai.dm | 7 ++- code/modules/paperwork/folders.dm | 2 +- code/modules/paperwork/paperplane.dm | 2 +- code/modules/paperwork/pen.dm | 10 ++-- code/modules/paperwork/photocopier.dm | 2 +- code/modules/photography/camera/camera.dm | 6 +- code/modules/photography/photos/photo.dm | 2 +- code/modules/plumbing/plumbers/bottler.dm | 2 +- .../plumbing/plumbers/plumbing_buffer.dm | 2 +- code/modules/power/apc/apc_attack.dm | 2 +- code/modules/power/pipecleaners.dm | 2 +- code/modules/projectiles/gun.dm | 6 +- code/modules/projectiles/guns/ballistic.dm | 2 +- .../projectiles/guns/ballistic/automatic.dm | 2 +- .../projectiles/guns/ballistic/shotgun.dm | 4 +- code/modules/projectiles/pins.dm | 4 +- .../chemistry/machinery/chem_dispenser.dm | 4 +- .../chemistry/machinery/chem_heater.dm | 2 +- .../chemistry/machinery/chem_mass_spec.dm | 4 +- .../chemistry/machinery/chem_master.dm | 4 +- .../reagents/chemistry/machinery/pandemic.dm | 2 +- .../chemistry/machinery/reagentgrinder.dm | 6 +- .../reagents/reagent_containers/blood_pack.dm | 2 +- .../reagents/reagent_containers/chem_pack.dm | 2 +- .../reagent_containers/cups/bottle.dm | 2 +- .../reagents/reagent_containers/hypospray.dm | 2 +- .../reagents/reagent_containers/spray.dm | 2 +- code/modules/recycling/conveyor.dm | 2 +- code/modules/recycling/sortingmachinery.dm | 2 +- .../xenobiology/crossbreeding/_misc.dm | 2 +- .../xenobiology/crossbreeding/charged.dm | 2 +- .../xenobiology/crossbreeding/stabilized.dm | 2 +- .../modules/vehicles/mecha/mech_fabricator.dm | 2 +- code/modules/vehicles/mecha/mecha_actions.dm | 2 +- code/modules/vehicles/ridden.dm | 2 +- code/modules/vehicles/wheelchair.dm | 2 +- .../wiremod/components/list/list_pick.dm | 4 +- 181 files changed, 353 insertions(+), 294 deletions(-) diff --git a/code/__DEFINES/mobs.dm b/code/__DEFINES/mobs.dm index 60e6d0f540e..ea99de34d3a 100644 --- a/code/__DEFINES/mobs.dm +++ b/code/__DEFINES/mobs.dm @@ -775,6 +775,23 @@ GLOBAL_LIST_INIT(layers_to_offset, list( /// The layer above mutant body parts #define ABOVE_BODY_FRONT_LAYER (BODY_FRONT_LAYER-1) +/// If gravity must be present to perform action (can't use pens without gravity) +#define NEED_GRAVITY (1<<0) +/// If reading is required to perform action (can't read a book if you are illiterate) +#define NEED_LITERACY (1<<1) +/// If lighting must be present to perform action (can't heal someone in the dark) +#define NEED_LIGHT (1<<2) +/// If other mobs (monkeys, aliens, etc) can perform action (can't use computers if you are a monkey) +#define NEED_DEXTERITY (1<<3) +/// If hands are required to perform action (can't use objects that require hands if you are a cyborg) +#define NEED_HANDS (1<<4) +/// If telekinesis is forbidden to perform action from a distance (ex. canisters are blacklisted from telekinesis manipulation) +#define FORBID_TELEKINESIS_REACH (1<<5) +/// If silicons are allowed to perform action from a distance (silicons can operate airlocks from far away) +#define ALLOW_SILICON_REACH (1<<6) +/// If resting on the floor is allowed to perform action (pAIs can play music while resting) +#define ALLOW_RESTING (1<<7) + /// The default mob sprite size (used for shrinking or enlarging the mob sprite to regular size) #define RESIZE_DEFAULT_SIZE 1 diff --git a/code/datums/components/gps.dm b/code/datums/components/gps.dm index 72d260ccc22..4d75d114b94 100644 --- a/code/datums/components/gps.dm +++ b/code/datums/components/gps.dm @@ -91,7 +91,7 @@ GLOBAL_LIST_EMPTY(GPS_list) ///Toggles the tracking for the gps /datum/component/gps/item/proc/toggletracking(mob/user) - if(!user.canUseTopic(parent, be_close = TRUE)) + if(!user.can_perform_action(parent)) return //user not valid to use gps if(emped) to_chat(user, span_warning("It's busted!")) diff --git a/code/datums/components/religious_tool.dm b/code/datums/components/religious_tool.dm index 1caab166048..d5eb30a69ed 100644 --- a/code/datums/components/religious_tool.dm +++ b/code/datums/components/religious_tool.dm @@ -122,7 +122,7 @@ if(user.mind.holy_role != HOLY_ROLE_HIGHPRIEST) to_chat(user, "You are not the high priest, and therefore cannot select a religious sect.") return - if(!user.canUseTopic(parent, be_close = TRUE, no_dexterity = FALSE, no_tk = TRUE)) + if(!user.can_perform_action(parent, FORBID_TELEKINESIS_REACH)) to_chat(user,span_warning("You cannot select a sect at this time.")) return if(GLOB.religious_sect) @@ -152,7 +152,7 @@ if(performing_rite) to_chat(user, "There is a rite currently being performed here already.") return - if(!user.canUseTopic(parent, be_close = TRUE, no_dexterity = FALSE, no_tk = TRUE)) + if(!user.can_perform_action(parent, FORBID_TELEKINESIS_REACH)) to_chat(user,span_warning("You are not close enough to perform the rite.")) return performing_rite = new path(parent) diff --git a/code/datums/components/rotation.dm b/code/datums/components/rotation.dm index 21522afdcdf..7c1cfc07d23 100644 --- a/code/datums/components/rotation.dm +++ b/code/datums/components/rotation.dm @@ -102,7 +102,7 @@ AfterRotation.Invoke(user, degrees) /datum/component/simple_rotation/proc/CanUserRotate(mob/user, degrees) - if(isliving(user) && user.canUseTopic(parent, be_close = TRUE, no_dexterity = TRUE, no_tk = FALSE, need_hands = !iscyborg(user))) + if(isliving(user) && user.can_perform_action(parent, NEED_DEXTERITY)) return TRUE if((rotation_flags & ROTATION_GHOSTS_ALLOWED) && isobserver(user) && CONFIG_GET(flag/ghost_interaction)) return TRUE diff --git a/code/datums/components/shuttle_cling.dm b/code/datums/components/shuttle_cling.dm index 7f37933ae1f..75ed52046a2 100644 --- a/code/datums/components/shuttle_cling.dm +++ b/code/datums/components/shuttle_cling.dm @@ -91,7 +91,7 @@ var/mob/living/living = movee //Check if we can interact with stuff (checks for alive, arms, stun, etc) - if(!living.canUseTopic(living, be_close = TRUE, no_dexterity = FALSE, no_tk = TRUE, need_hands = TRUE)) + if(!living.can_perform_action(living, FORBID_TELEKINESIS_REACH|NEED_HANDS)) return NOT_HOLDING_ON if(living.buckled) diff --git a/code/datums/storage/subtypes/bag_of_holding.dm b/code/datums/storage/subtypes/bag_of_holding.dm index e1de38948e8..774dffef393 100644 --- a/code/datums/storage/subtypes/bag_of_holding.dm +++ b/code/datums/storage/subtypes/bag_of_holding.dm @@ -18,7 +18,7 @@ return var/safety = tgui_alert(user, "Doing this will have extremely dire consequences for the station and its crew. Be sure you know what you're doing.", "Put in [to_insert.name]?", list("Proceed", "Abort")) - if(safety != "Proceed" || QDELETED(to_insert) || QDELETED(resolve_parent) || QDELETED(user) || !user.canUseTopic(resolve_parent, be_close = TRUE, no_dexterity = iscarbon(user))) + if(safety != "Proceed" || QDELETED(to_insert) || QDELETED(resolve_parent) || QDELETED(user) || !iscarbon(user) || !user.can_perform_action(resolve_parent, NEED_DEXTERITY)) return var/turf/loccheck = get_turf(resolve_parent) diff --git a/code/game/machinery/_machinery.dm b/code/game/machinery/_machinery.dm index e9cad318207..534ff549b6b 100644 --- a/code/game/machinery/_machinery.dm +++ b/code/game/machinery/_machinery.dm @@ -683,7 +683,7 @@ ..() if(!can_interact(usr)) return TRUE - if(!usr.canUseTopic(src)) + if(!usr.can_perform_action(src)) return TRUE add_fingerprint(usr) update_last_used(usr) diff --git a/code/game/machinery/announcement_system.dm b/code/game/machinery/announcement_system.dm index 3474c5e4cb6..87f2a9f01c8 100644 --- a/code/game/machinery/announcement_system.dm +++ b/code/game/machinery/announcement_system.dm @@ -124,7 +124,7 @@ GLOBAL_LIST_EMPTY(announcement_systems) . = ..() if(.) return - if(!usr.canUseTopic(src, !issilicon(usr))) + if(!usr.can_perform_action(src, ALLOW_SILICON_REACH)) return if(machine_stat & BROKEN) visible_message(span_warning("[src] buzzes."), span_hear("You hear a faint buzz.")) @@ -133,14 +133,14 @@ GLOBAL_LIST_EMPTY(announcement_systems) switch(action) if("ArrivalText") var/NewMessage = trim(html_encode(param["newText"]), MAX_MESSAGE_LEN) - if(!usr.canUseTopic(src, !issilicon(usr))) + if(!usr.can_perform_action(src, ALLOW_SILICON_REACH)) return if(NewMessage) arrival = NewMessage usr.log_message("updated the arrivals announcement to: [NewMessage]", LOG_GAME) if("NewheadText") var/NewMessage = trim(html_encode(param["newText"]), MAX_MESSAGE_LEN) - if(!usr.canUseTopic(src, !issilicon(usr))) + if(!usr.can_perform_action(src, ALLOW_SILICON_REACH)) return if(NewMessage) newhead = NewMessage @@ -157,7 +157,7 @@ GLOBAL_LIST_EMPTY(announcement_systems) . = attack_ai(user) /obj/machinery/announcement_system/attack_ai(mob/user) - if(!user.canUseTopic(src, !issilicon(user))) + if(!user.can_perform_action(src, ALLOW_SILICON_REACH)) return if(machine_stat & BROKEN) to_chat(user, span_warning("[src]'s firmware appears to be malfunctioning!")) diff --git a/code/game/machinery/camera/camera.dm b/code/game/machinery/camera/camera.dm index fcadaedccfb..c029d795465 100644 --- a/code/game/machinery/camera/camera.dm +++ b/code/game/machinery/camera/camera.dm @@ -250,7 +250,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/camera/xray, 0) var/obj/item/choice = tgui_input_list(user, "Select a part to remove", "Part Removal", sort_names(droppable_parts)) if(isnull(choice)) return - if(!user.canUseTopic(src, be_close = TRUE, no_dexterity = FALSE, no_tk = TRUE)) + if(!user.can_perform_action(src, FORBID_TELEKINESIS_REACH)) return to_chat(user, span_notice("You remove [choice] from [src].")) if(choice == assembly.xray_module) diff --git a/code/game/machinery/camera/camera_assembly.dm b/code/game/machinery/camera/camera_assembly.dm index 8665e5f6fc2..15baccbcf9c 100644 --- a/code/game/machinery/camera/camera_assembly.dm +++ b/code/game/machinery/camera/camera_assembly.dm @@ -203,7 +203,7 @@ var/obj/item/choice = tgui_input_list(user, "Select a part to remove", "Part Removal", sort_names(droppable_parts)) if(isnull(choice)) return - if(!user.canUseTopic(src, be_close = TRUE, no_dexterity = FALSE, no_tk = TRUE)) + if(!user.can_perform_action(src, FORBID_TELEKINESIS_REACH)) return to_chat(user, span_notice("You remove [choice] from [src].")) drop_upgrade(choice) diff --git a/code/game/machinery/civilian_bounties.dm b/code/game/machinery/civilian_bounties.dm index cca6ed02979..684b22a6d48 100644 --- a/code/game/machinery/civilian_bounties.dm +++ b/code/game/machinery/civilian_bounties.dm @@ -175,7 +175,7 @@ return if(!pad_ref?.resolve()) return - if(!usr.canUseTopic(src, be_close = TRUE) || (machine_stat & (NOPOWER|BROKEN))) + if(!usr.can_perform_action(src) || (machine_stat & (NOPOWER|BROKEN))) return switch(action) if("recalc") diff --git a/code/game/machinery/computer/_computer.dm b/code/game/machinery/computer/_computer.dm index 6506c35d564..f74f9746b6f 100644 --- a/code/game/machinery/computer/_computer.dm +++ b/code/game/machinery/computer/_computer.dm @@ -131,7 +131,7 @@ . = ..() if(!can_interact(user)) return - if(!user.canUseTopic(src, be_close = !issilicon(user)) || !is_operational) + if(!user.can_perform_action(src, ALLOW_SILICON_REACH) || !is_operational) return /obj/machinery/computer/ui_interact(mob/user, datum/tgui/ui) diff --git a/code/game/machinery/computer/communications.dm b/code/game/machinery/computer/communications.dm index e1d7511e9f9..b84166931b9 100755 --- a/code/game/machinery/computer/communications.dm +++ b/code/game/machinery/computer/communications.dm @@ -735,7 +735,7 @@ to_chat(user, span_alert("Intercomms recharging. Please stand by.")) return var/input = tgui_input_text(user, "Message to announce to the station crew", "Announcement") - if(!input || !user.canUseTopic(src, !issilicon(usr))) + if(!input || !user.can_perform_action(src, ALLOW_SILICON_REACH)) return if(user.try_speak(input)) //Adds slurs and so on. Someone should make this use languages too. diff --git a/code/game/machinery/computer/dna_console.dm b/code/game/machinery/computer/dna_console.dm index 5896a06fc80..fe943d4ac06 100644 --- a/code/game/machinery/computer/dna_console.dm +++ b/code/game/machinery/computer/dna_console.dm @@ -215,7 +215,7 @@ . = ..() if(!can_interact(user)) return - if(!user.canUseTopic(src, !issilicon(user))) + if(!user.can_perform_action(src, ALLOW_SILICON_REACH)) return eject_disk(user) diff --git a/code/game/machinery/computer/records/records.dm b/code/game/machinery/computer/records/records.dm index 98450eb85c2..04482aede49 100644 --- a/code/game/machinery/computer/records/records.dm +++ b/code/game/machinery/computer/records/records.dm @@ -129,7 +129,7 @@ /// Inserts a new record into GLOB.manifest.general. Requires a photo to be taken. /obj/machinery/computer/records/proc/insert_new_record(mob/user, obj/item/photo/mugshot) - if(!mugshot || !is_operational || !user.canUseTopic(src, be_close = !issilicon(user))) + if(!mugshot || !is_operational || !user.can_perform_action(src, ALLOW_SILICON_REACH)) return FALSE if(!authenticated && !has_auth(user)) @@ -139,7 +139,7 @@ var/trimmed = copytext(mugshot.name, 9, MAX_NAME_LEN) // Remove "photo - " var/name = tgui_input_text(user, "Enter the name of the new record.", "New Record", trimmed, MAX_NAME_LEN) - if(!name || !is_operational || !user.canUseTopic(src, be_close = !issilicon(user)) || !mugshot || QDELETED(mugshot) || QDELETED(src)) + if(!name || !is_operational || !user.can_perform_action(src, ALLOW_SILICON_REACH) || !mugshot || QDELETED(mugshot) || QDELETED(src)) return FALSE new /datum/record/crew(name = name, character_appearance = mugshot.picture.picture_image) @@ -153,7 +153,7 @@ /// Secure login /obj/machinery/computer/records/proc/secure_login(mob/user) - if(!user.canUseTopic(src, be_close = !issilicon(user)) || !is_operational) + if(!user.can_perform_action(src, ALLOW_SILICON_REACH) || !is_operational) return FALSE if(!has_auth(user)) diff --git a/code/game/machinery/defibrillator_mount.dm b/code/game/machinery/defibrillator_mount.dm index e99d9de06b8..f15bd2a4bbb 100644 --- a/code/game/machinery/defibrillator_mount.dm +++ b/code/game/machinery/defibrillator_mount.dm @@ -155,7 +155,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/defibrillator_mount, 28) return TRUE /obj/machinery/defibrillator_mount/AltClick(mob/living/carbon/user) - if(!istype(user) || !user.canUseTopic(src, be_close = TRUE)) + if(!istype(user) || !user.can_perform_action(src)) return if(!defib) to_chat(user, span_warning("It'd be hard to remove a defib unit from a mount that has none.")) diff --git a/code/game/machinery/deployable.dm b/code/game/machinery/deployable.dm index b900aeb3be7..2b3288fd537 100644 --- a/code/game/machinery/deployable.dm +++ b/code/game/machinery/deployable.dm @@ -178,7 +178,7 @@ . += span_notice("Alt-click to toggle modes.") /obj/item/grenade/barrier/AltClick(mob/living/carbon/user) - if(!istype(user) || !user.canUseTopic(src, be_close = TRUE)) + if(!istype(user) || !user.can_perform_action(src)) return toggle_mode(user) diff --git a/code/game/machinery/dish_drive.dm b/code/game/machinery/dish_drive.dm index e439ccab28d..6805661d984 100644 --- a/code/game/machinery/dish_drive.dm +++ b/code/game/machinery/dish_drive.dm @@ -104,7 +104,7 @@ do_the_dishes(TRUE) /obj/machinery/dish_drive/AltClick(mob/living/user) - if(user.canUseTopic(src, !issilicon(user))) + if(user.can_perform_action(src, ALLOW_SILICON_REACH)) do_the_dishes(TRUE) /obj/machinery/dish_drive/proc/do_the_dishes(manual) diff --git a/code/game/machinery/doors/poddoor.dm b/code/game/machinery/doors/poddoor.dm index ab8b3df2d46..929ec982f92 100644 --- a/code/game/machinery/doors/poddoor.dm +++ b/code/game/machinery/doors/poddoor.dm @@ -45,7 +45,7 @@ if (deconstruction != BLASTDOOR_FINISHED) return var/change_id = tgui_input_number(user, "Set the door controllers ID", "Door Controller ID", id, 100) - if(!change_id || QDELETED(usr) || QDELETED(src) || !usr.canUseTopic(src, be_close = TRUE, no_dexterity = FALSE, no_tk = TRUE)) + if(!change_id || QDELETED(usr) || QDELETED(src) || !usr.can_perform_action(src, FORBID_TELEKINESIS_REACH)) return id = change_id to_chat(user, span_notice("You change the ID to [id].")) diff --git a/code/game/machinery/fat_sucker.dm b/code/game/machinery/fat_sucker.dm index d06c514c98e..a893ba2d654 100644 --- a/code/game/machinery/fat_sucker.dm +++ b/code/game/machinery/fat_sucker.dm @@ -99,7 +99,7 @@ to_chat(user, span_warning("The safety hatch has been disabled!")) /obj/machinery/fat_sucker/AltClick(mob/living/user) - if(!user.canUseTopic(src, be_close = TRUE)) + if(!user.can_perform_action(src)) return if(user == occupant) to_chat(user, span_warning("You can't reach the controls from inside!")) diff --git a/code/game/machinery/iv_drip.dm b/code/game/machinery/iv_drip.dm index ff97b815887..b1773df3e41 100644 --- a/code/game/machinery/iv_drip.dm +++ b/code/game/machinery/iv_drip.dm @@ -158,7 +158,7 @@ /obj/machinery/iv_drip/MouseDrop(atom/target) . = ..() - if(!Adjacent(target) || !usr.canUseTopic(src, be_close = TRUE)) + if(!Adjacent(target) || !usr.can_perform_action(src)) return if(!isliving(usr)) to_chat(usr, span_warning("You can't do that!")) @@ -325,7 +325,7 @@ if(!isliving(usr)) to_chat(usr, span_warning("You can't do that!")) return - if (!usr.canUseTopic()) + if(!usr.can_perform_action(src)) return if(usr.incapacitated()) return @@ -345,7 +345,7 @@ if(!isliving(usr)) to_chat(usr, span_warning("You can't do that!")) return - if (!usr.canUseTopic()) + if(!usr.can_perform_action(src)) return if(usr.incapacitated()) return diff --git a/code/game/machinery/launch_pad.dm b/code/game/machinery/launch_pad.dm index ad5c9298768..f72a4f5a460 100644 --- a/code/game/machinery/launch_pad.dm +++ b/code/game/machinery/launch_pad.dm @@ -287,7 +287,7 @@ /obj/machinery/launchpad/briefcase/MouseDrop(over_object, src_location, over_location) . = ..() if(over_object == usr) - if(!briefcase || !usr.canUseTopic(src, be_close = TRUE, no_dexterity = TRUE, no_tk = FALSE, need_hands = TRUE)) + if(!briefcase || !usr.can_perform_action(src, NEED_DEXTERITY|NEED_HANDS)) return usr.visible_message(span_notice("[usr] starts closing [src]..."), span_notice("You start closing [src]...")) if(do_after(usr, 30, target = usr)) diff --git a/code/game/machinery/medical_kiosk.dm b/code/game/machinery/medical_kiosk.dm index e2cc4574194..47f64b8a466 100644 --- a/code/game/machinery/medical_kiosk.dm +++ b/code/game/machinery/medical_kiosk.dm @@ -125,7 +125,7 @@ return ..() /obj/machinery/medical_kiosk/AltClick(mob/living/carbon/user) - if(!istype(user) || !user.canUseTopic(src, be_close = TRUE)) + if(!istype(user) || !user.can_perform_action(src)) return if(!scanner_wand) to_chat(user, span_warning("The scanner wand is currently removed from the machine.")) diff --git a/code/game/machinery/newscaster/newspaper.dm b/code/game/machinery/newscaster/newspaper.dm index 6b71bfc4266..ffe1d2f9baf 100644 --- a/code/game/machinery/newscaster/newspaper.dm +++ b/code/game/machinery/newscaster/newspaper.dm @@ -166,7 +166,7 @@ var/s = tgui_input_text(user, "Write something", "Newspaper") if (!s) return - if(!user.canUseTopic(src, be_close = TRUE)) + if(!user.can_perform_action(src)) return scribble_page = curr_page scribble = s diff --git a/code/game/machinery/porta_turret/portable_turret_construct.dm b/code/game/machinery/porta_turret/portable_turret_construct.dm index f652a30d423..595c7bb4a12 100644 --- a/code/game/machinery/porta_turret/portable_turret_construct.dm +++ b/code/game/machinery/porta_turret/portable_turret_construct.dm @@ -182,7 +182,7 @@ var/choice = tgui_input_text(user, "Enter a new turret name", "Turret Classification", finish_name, MAX_NAME_LEN) if(!choice) return - if(!user.canUseTopic(src, be_close = TRUE)) + if(!user.can_perform_action(src)) return finish_name = choice diff --git a/code/game/machinery/sleepers.dm b/code/game/machinery/sleepers.dm index bb6c490108c..d2dbe9aad87 100644 --- a/code/game/machinery/sleepers.dm +++ b/code/game/machinery/sleepers.dm @@ -166,7 +166,7 @@ /obj/machinery/sleeper/AltClick(mob/user) . = ..() - if(!user.canUseTopic(src, !issilicon(user))) + if(!user.can_perform_action(src, ALLOW_SILICON_REACH)) return if(state_open) close_machine() diff --git a/code/game/machinery/spaceheater.dm b/code/game/machinery/spaceheater.dm index f6385bb93c8..0708753b4e3 100644 --- a/code/game/machinery/spaceheater.dm +++ b/code/game/machinery/spaceheater.dm @@ -424,7 +424,7 @@ /obj/machinery/space_heater/improvised_chem_heater/AltClick(mob/living/user) . = ..() - if(!can_interact(user) || !user.canUseTopic(src, be_close = TRUE, no_dexterity = FALSE, no_tk = TRUE)) + if(!can_interact(user) || !user.can_perform_action(src, FORBID_TELEKINESIS_REACH)) return replace_beaker(user) diff --git a/code/game/machinery/stasis.dm b/code/game/machinery/stasis.dm index c519d0d24a3..084c4ad802f 100644 --- a/code/game/machinery/stasis.dm +++ b/code/game/machinery/stasis.dm @@ -39,7 +39,7 @@ . = ..() if(!can_interact(user)) return - if(world.time >= stasis_can_toggle && user.canUseTopic(src, !issilicon(user))) + if(world.time >= stasis_can_toggle && user.can_perform_action(src, ALLOW_SILICON_REACH)) stasis_enabled = !stasis_enabled stasis_can_toggle = world.time + STASIS_TOGGLE_COOLDOWN playsound(src, 'sound/machines/click.ogg', 60, TRUE) diff --git a/code/game/machinery/syndicatebomb.dm b/code/game/machinery/syndicatebomb.dm index 88c776b0a60..0224f1ebe9c 100644 --- a/code/game/machinery/syndicatebomb.dm +++ b/code/game/machinery/syndicatebomb.dm @@ -229,10 +229,10 @@ update_appearance() /obj/machinery/syndicatebomb/proc/settings(mob/user) - if(!user.canUseTopic(src, !issilicon(user)) || !user.can_interact_with(src)) + if(!user.can_perform_action(src, ALLOW_SILICON_REACH) || !user.can_interact_with(src)) return var/new_timer = tgui_input_number(user, "Set the timer", "Countdown", timer_set, maximum_timer, minimum_timer) - if(!new_timer || QDELETED(user) || QDELETED(src) || !user.canUseTopic(src, be_close = TRUE, no_dexterity = FALSE, no_tk = TRUE)) + if(!new_timer || QDELETED(user) || QDELETED(src) || !user.can_perform_action(src, FORBID_TELEKINESIS_REACH)) return timer_set = new_timer loc.visible_message(span_notice("[icon2html(src, viewers(src))] timer set for [timer_set] seconds.")) diff --git a/code/game/machinery/washing_machine.dm b/code/game/machinery/washing_machine.dm index c9e0141acf5..0a675bec085 100644 --- a/code/game/machinery/washing_machine.dm +++ b/code/game/machinery/washing_machine.dm @@ -389,7 +389,7 @@ GLOBAL_LIST_INIT(dye_registry, list( if(. == SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN) return - if(!user.canUseTopic(src, !issilicon(user))) + if(!user.can_perform_action(src, ALLOW_SILICON_REACH)) return SECONDARY_ATTACK_CONTINUE_CHAIN if(busy) to_chat(user, span_warning("[src] is busy!")) diff --git a/code/game/objects/items/AI_modules/freeform.dm b/code/game/objects/items/AI_modules/freeform.dm index a76f585fb80..eb55d469318 100644 --- a/code/game/objects/items/AI_modules/freeform.dm +++ b/code/game/objects/items/AI_modules/freeform.dm @@ -34,7 +34,7 @@ /obj/item/ai_module/supplied/freeform/attack_self(mob/user) var/newpos = tgui_input_number(user, "Please enter the priority for your new law. Can only write to law sectors 15 and above.", "Law Priority ", lawpos, 50, 15) - if(!newpos || QDELETED(user) || QDELETED(src) || !usr.canUseTopic(src, be_close = TRUE, no_dexterity = FALSE, no_tk = TRUE)) + if(!newpos || QDELETED(user) || QDELETED(src) || !usr.can_perform_action(src, FORBID_TELEKINESIS_REACH)) return lawpos = newpos var/targName = tgui_input_text(user, "Enter a new law for the AI.", "Freeform Law Entry", laws[1], CONFIG_GET(number/max_law_len), TRUE) diff --git a/code/game/objects/items/AI_modules/repair.dm b/code/game/objects/items/AI_modules/repair.dm index c7265839fa3..7d4eee8de1d 100644 --- a/code/game/objects/items/AI_modules/repair.dm +++ b/code/game/objects/items/AI_modules/repair.dm @@ -12,7 +12,7 @@ /obj/item/ai_module/remove/attack_self(mob/user) lawpos = tgui_input_number(user, "Law to delete", "Law Removal", lawpos, 50) - if(!lawpos || QDELETED(user) || QDELETED(src) || !usr.canUseTopic(src, be_close = TRUE, no_dexterity = FALSE, no_tk = TRUE)) + if(!lawpos || QDELETED(user) || QDELETED(src) || !usr.can_perform_action(src, FORBID_TELEKINESIS_REACH)) return to_chat(user, span_notice("Law [lawpos] selected.")) ..() diff --git a/code/game/objects/items/blueprints.dm b/code/game/objects/items/blueprints.dm index 290fdea7776..65c77e16348 100644 --- a/code/game/objects/items/blueprints.dm +++ b/code/game/objects/items/blueprints.dm @@ -29,7 +29,7 @@ /obj/item/areaeditor/Topic(href, href_list) if(..()) return TRUE - if(!usr.canUseTopic(src) || usr != loc) + if(!usr.can_perform_action(src) || usr != loc) usr << browse(null, "window=blueprints") return TRUE if(href_list["create_area"]) diff --git a/code/game/objects/items/cards_ids.dm b/code/game/objects/items/cards_ids.dm index b8f9b7ade01..e9f6f39cb4b 100644 --- a/code/game/objects/items/cards_ids.dm +++ b/code/game/objects/items/cards_ids.dm @@ -626,7 +626,7 @@ /obj/item/card/id/proc/alt_click_can_use_id(mob/living/user) if(!isliving(user)) return - if(!user.canUseTopic(src, be_close = TRUE, no_dexterity = FALSE, no_tk = TRUE)) + if(!user.can_perform_action(src, FORBID_TELEKINESIS_REACH)) return return TRUE @@ -1226,7 +1226,7 @@ to_chat(user, "Restating prisoner ID to default parameters.") return var/choice = tgui_input_number(user, "Sentence time in seconds", "Sentencing") - if(!choice || QDELETED(user) || QDELETED(src) || !usr.canUseTopic(src, be_close = TRUE, no_dexterity = FALSE, no_tk = TRUE) || loc != user) + if(!choice || QDELETED(user) || QDELETED(src) || !usr.can_perform_action(src, FORBID_TELEKINESIS_REACH) || loc != user) return FALSE time_to_assign = choice to_chat(user, "You set the sentence time to [time_to_assign] seconds.") @@ -1552,7 +1552,7 @@ assignment = target_occupation var/new_age = tgui_input_number(user, "Choose the ID's age", "Agent card age", AGE_MIN, AGE_MAX, AGE_MIN) - if(QDELETED(user) || QDELETED(src) || !user.canUseTopic(user, be_close = TRUE, no_dexterity = TRUE, no_tk = TRUE)) + if(QDELETED(user) || QDELETED(src) || !user.can_perform_action(user, NEED_DEXTERITY| FORBID_TELEKINESIS_REACH)) return if(new_age) registered_age = new_age diff --git a/code/game/objects/items/choice_beacon.dm b/code/game/objects/items/choice_beacon.dm index 59f4e8a005f..07a7808cd84 100644 --- a/code/game/objects/items/choice_beacon.dm +++ b/code/game/objects/items/choice_beacon.dm @@ -27,7 +27,7 @@ /// Checks if this mob can use the beacon, returns TRUE if so or FALSE otherwise. /obj/item/choice_beacon/proc/can_use_beacon(mob/living/user) - if(user.canUseTopic(src, be_close = TRUE, no_dexterity = FALSE, no_tk = TRUE)) + if(user.can_perform_action(src, FORBID_TELEKINESIS_REACH)) return TRUE playsound(src, 'sound/machines/buzz-sigh.ogg', 40, TRUE) diff --git a/code/game/objects/items/circuitboards/machines/machine_circuitboards.dm b/code/game/objects/items/circuitboards/machines/machine_circuitboards.dm index 5357108f26a..4a1e346acfa 100644 --- a/code/game/objects/items/circuitboards/machines/machine_circuitboards.dm +++ b/code/game/objects/items/circuitboards/machines/machine_circuitboards.dm @@ -773,7 +773,7 @@ /obj/item/circuitboard/machine/medical_kiosk/multitool_act(mob/living/user) . = ..() var/new_cost = tgui_input_number(user, "New cost for using this medical kiosk", "Pricing", custom_cost, 1000, 10) - if(!new_cost || QDELETED(user) || QDELETED(src) || !user.canUseTopic(src, be_close = TRUE, no_dexterity = FALSE, no_tk = TRUE)) + if(!new_cost || QDELETED(user) || QDELETED(src) || !user.can_perform_action(src, FORBID_TELEKINESIS_REACH)) return if(loc != user) to_chat(user, span_warning("You must hold the circuitboard to change its cost!")) diff --git a/code/game/objects/items/cosmetics.dm b/code/game/objects/items/cosmetics.dm index 4b17727f05e..b901d470384 100644 --- a/code/game/objects/items/cosmetics.dm +++ b/code/game/objects/items/cosmetics.dm @@ -158,7 +158,7 @@ if (H == user) to_chat(user, span_warning("You need a mirror to properly style your own facial hair!")) return - if(!user.canUseTopic(src, be_close = TRUE, no_dexterity = FALSE, no_tk = TRUE)) + if(!user.can_perform_action(src, FORBID_TELEKINESIS_REACH)) return var/new_style = tgui_input_list(user, "Select a facial hairstyle", "Grooming", GLOB.facial_hairstyles_list) if(isnull(new_style)) @@ -209,7 +209,7 @@ if (H == user) to_chat(user, span_warning("You need a mirror to properly style your own hair!")) return - if(!user.canUseTopic(src, be_close = TRUE, no_dexterity = FALSE, no_tk = TRUE)) + if(!user.can_perform_action(src, FORBID_TELEKINESIS_REACH)) return var/new_style = tgui_input_list(user, "Select a hairstyle", "Grooming", GLOB.hairstyles_list) if(isnull(new_style)) diff --git a/code/game/objects/items/crayons.dm b/code/game/objects/items/crayons.dm index 7e609ddd26d..d0a28365976 100644 --- a/code/game/objects/items/crayons.dm +++ b/code/game/objects/items/crayons.dm @@ -162,7 +162,7 @@ ui.open() /obj/item/toy/crayon/spraycan/AltClick(mob/user) - if(has_cap && user.canUseTopic(src, be_close = TRUE, no_dexterity = TRUE, no_tk = FALSE, need_hands = TRUE)) + if(has_cap && user.can_perform_action(src, NEED_DEXTERITY|NEED_HANDS)) is_capped = !is_capped to_chat(user, span_notice("The cap on [src] is now [is_capped ? "on" : "off"].")) update_appearance() diff --git a/code/game/objects/items/credit_holochip.dm b/code/game/objects/items/credit_holochip.dm index 803a8257c9b..eecef73fd43 100644 --- a/code/game/objects/items/credit_holochip.dm +++ b/code/game/objects/items/credit_holochip.dm @@ -99,13 +99,13 @@ qdel(H) /obj/item/holochip/AltClick(mob/user) - if(!user.canUseTopic(src, be_close = TRUE, no_dexterity = TRUE, no_tk = TRUE, need_hands = !iscyborg(user))) + if(!user.can_perform_action(src, NEED_DEXTERITY|FORBID_TELEKINESIS_REACH)) return if(loc != user) to_chat(user, span_warning("You must be holding the holochip to continue!")) return FALSE var/split_amount = tgui_input_number(user, "How many credits do you want to extract from the holochip? (Max: [credits] cr)", "Holochip", max_value = credits) - if(!split_amount || QDELETED(user) || QDELETED(src) || issilicon(user) || !usr.canUseTopic(src, be_close = TRUE, no_dexterity = TRUE, no_tk = TRUE, need_hands = !iscyborg(user)) || loc != user) + if(!split_amount || QDELETED(user) || QDELETED(src) || issilicon(user) || !usr.can_perform_action(src, NEED_DEXTERITY|FORBID_TELEKINESIS_REACH) || loc != user) return var/new_credits = spend(split_amount, TRUE) var/obj/item/holochip/H = new(user ? user : drop_location(), new_credits) diff --git a/code/game/objects/items/devices/beacon.dm b/code/game/objects/items/devices/beacon.dm index 28ec184d476..00517f78915 100644 --- a/code/game/objects/items/devices/beacon.dm +++ b/code/game/objects/items/devices/beacon.dm @@ -34,7 +34,7 @@ /obj/item/beacon/attackby(obj/item/W, mob/user) if(istype(W, /obj/item/pen)) // needed for things that use custom names like the locator var/new_name = tgui_input_text(user, "What would you like the name to be?", "Beacon", max_length = MAX_NAME_LEN) - if(!user.canUseTopic(src, be_close = TRUE)) + if(!user.can_perform_action(src)) return if(new_name) name = new_name diff --git a/code/game/objects/items/devices/desynchronizer.dm b/code/game/objects/items/devices/desynchronizer.dm index 7726fdb3c0b..6d0c6466f15 100644 --- a/code/game/objects/items/devices/desynchronizer.dm +++ b/code/game/objects/items/devices/desynchronizer.dm @@ -33,10 +33,10 @@ . += span_notice("Can be used again to interrupt the effect early. The recharge time is the same as the time spent in desync.") /obj/item/desynchronizer/AltClick(mob/living/user) - if(!user.canUseTopic(src, be_close = TRUE, no_dexterity = TRUE, no_tk = FALSE, need_hands = !iscyborg(user))) + if(!user.can_perform_action(src, NEED_DEXTERITY)) return var/new_duration = tgui_input_number(user, "Set the duration", "Desynchronizer", duration / 10, max_duration, 5) - if(!new_duration || QDELETED(user) || QDELETED(src) || !usr.canUseTopic(src, be_close = TRUE, no_dexterity = TRUE, no_tk = FALSE, need_hands = !iscyborg(user))) + if(!new_duration || QDELETED(user) || QDELETED(src) || !usr.can_perform_action(src, NEED_DEXTERITY)) return duration = new_duration to_chat(user, span_notice("You set the duration to [DisplayTimeText(duration)].")) diff --git a/code/game/objects/items/devices/geiger_counter.dm b/code/game/objects/items/devices/geiger_counter.dm index e75a9f5a6c2..137dd3b9a64 100644 --- a/code/game/objects/items/devices/geiger_counter.dm +++ b/code/game/objects/items/devices/geiger_counter.dm @@ -111,7 +111,7 @@ to_chat(user, span_notice("[icon2html(src, user)] [isliving(target) ? "Subject" : "Target"] is free of radioactive contamination.")) /obj/item/geiger_counter/AltClick(mob/living/user) - if(!istype(user) || !user.canUseTopic(src, be_close = TRUE)) + if(!istype(user) || !user.can_perform_action(src)) return ..() if(!scanning) to_chat(usr, span_warning("[src] must be on to reset its radiation level!")) diff --git a/code/game/objects/items/devices/portable_chem_mixer.dm b/code/game/objects/items/devices/portable_chem_mixer.dm index ae846a01faf..9c5455c1edd 100644 --- a/code/game/objects/items/devices/portable_chem_mixer.dm +++ b/code/game/objects/items/devices/portable_chem_mixer.dm @@ -80,7 +80,7 @@ /obj/item/storage/portable_chem_mixer/AltClick(mob/living/user) if(!atom_storage.locked) return ..() - if(!can_interact(user) || !user.canUseTopic(src, be_close = TRUE, no_dexterity = FALSE, no_tk = TRUE)) + if(!can_interact(user) || !user.can_perform_action(src, FORBID_TELEKINESIS_REACH)) return replace_beaker(user) update_appearance() diff --git a/code/game/objects/items/devices/quantum_keycard.dm b/code/game/objects/items/devices/quantum_keycard.dm index 9b025efbb0b..9462b812463 100644 --- a/code/game/objects/items/devices/quantum_keycard.dm +++ b/code/game/objects/items/devices/quantum_keycard.dm @@ -41,7 +41,7 @@ . += span_notice("Insert [src] into an active quantum pad to link it.") /obj/item/quantum_keycard/AltClick(mob/living/user) - if(!istype(user) || !user.canUseTopic(src, be_close = TRUE, no_dexterity = TRUE, no_tk = FALSE, need_hands = !iscyborg(user))) + if(!istype(user) || !user.can_perform_action(src, NEED_DEXTERITY)) return to_chat(user, span_notice("You start pressing [src]'s unlink button...")) if(do_after(user, 40, target = src)) diff --git a/code/game/objects/items/devices/radio/headset.dm b/code/game/objects/items/devices/radio/headset.dm index 46f45b20de3..31f033ed529 100644 --- a/code/game/objects/items/devices/radio/headset.dm +++ b/code/game/objects/items/devices/radio/headset.dm @@ -92,7 +92,7 @@ GLOBAL_LIST_INIT(channel_tokens, list( /obj/item/radio/headset/MouseDrop(mob/over, src_location, over_location) var/mob/headset_user = usr - if((headset_user == over) && headset_user.canUseTopic(src, be_close = TRUE, no_dexterity = FALSE, no_tk = TRUE)) + if((headset_user == over) && headset_user.can_perform_action(src, FORBID_TELEKINESIS_REACH)) return attack_self(headset_user) return ..() diff --git a/code/game/objects/items/devices/scanners/gas_analyzer.dm b/code/game/objects/items/devices/scanners/gas_analyzer.dm index 00382aa9089..38c6760690f 100644 --- a/code/game/objects/items/devices/scanners/gas_analyzer.dm +++ b/code/game/objects/items/devices/scanners/gas_analyzer.dm @@ -46,7 +46,7 @@ /obj/item/analyzer/AltClick(mob/user) //Barometer output for measuring when the next storm happens ..() - if(!user.canUseTopic(src, be_close = TRUE) || !user.can_read(src)) + if(!user.can_perform_action(src, NEED_LITERACY|NEED_LIGHT)) return if(cooldown) diff --git a/code/game/objects/items/devices/scanners/health_analyzer.dm b/code/game/objects/items/devices/scanners/health_analyzer.dm index 68e95a9beab..3feccdeaa5d 100644 --- a/code/game/objects/items/devices/scanners/health_analyzer.dm +++ b/code/game/objects/items/devices/scanners/health_analyzer.dm @@ -447,7 +447,7 @@ /obj/item/healthanalyzer/AltClick(mob/user) ..() - if(!user.canUseTopic(src, be_close = TRUE) || !user.can_read(src) || user.is_blind()) + if(!user.can_perform_action(src, NEED_LITERACY|NEED_LIGHT) || user.is_blind()) return mode = !mode diff --git a/code/game/objects/items/devices/scanners/sequence_scanner.dm b/code/game/objects/items/devices/scanners/sequence_scanner.dm index 1824ddcb086..2422b262f32 100644 --- a/code/game/objects/items/devices/scanners/sequence_scanner.dm +++ b/code/game/objects/items/devices/scanners/sequence_scanner.dm @@ -80,7 +80,7 @@ var/answer = tgui_input_list(user, "Analyze Potential", "Sequence Analyzer", sort_list(options)) if(isnull(answer)) return - if(!ready || !user.canUseTopic(src, be_close = TRUE, no_dexterity = FALSE, no_tk = TRUE) || !user.can_read(src)) + if(!ready || !user.can_perform_action(src, NEED_LITERACY|NEED_LIGHT|FORBID_TELEKINESIS_REACH)) return var/sequence diff --git a/code/game/objects/items/devices/swapper.dm b/code/game/objects/items/devices/swapper.dm index 01ecb6e17d0..c5b67bc03bc 100644 --- a/code/game/objects/items/devices/swapper.dm +++ b/code/game/objects/items/devices/swapper.dm @@ -67,7 +67,7 @@ . += span_notice("Not Linked. Use on another quantum spin inverter to establish a quantum link.") /obj/item/swapper/AltClick(mob/living/user) - if(!user.canUseTopic(src, be_close = TRUE, no_dexterity = TRUE, no_tk = FALSE, need_hands = !iscyborg(user))) + if(!user.can_perform_action(src, NEED_DEXTERITY)) return to_chat(user, span_notice("You break the current quantum link.")) if(!QDELETED(linked_swapper)) diff --git a/code/game/objects/items/drug_items.dm b/code/game/objects/items/drug_items.dm index 1e31c8c932c..828d1ade7ee 100644 --- a/code/game/objects/items/drug_items.dm +++ b/code/game/objects/items/drug_items.dm @@ -50,7 +50,7 @@ icon_state = base_icon_state /obj/item/reagent_containers/cup/blastoff_ampoule/attack_self(mob/user) - if(!user.canUseTopic(src, be_close = TRUE, no_dexterity = TRUE) || spillable) + if(!user.can_perform_action(src, NEED_DEXTERITY) || spillable) return ..() reagent_flags |= OPENCONTAINER spillable = TRUE diff --git a/code/game/objects/items/dyekit.dm b/code/game/objects/items/dyekit.dm index 559554cf10f..f2b26a56dc3 100644 --- a/code/game/objects/items/dyekit.dm +++ b/code/game/objects/items/dyekit.dm @@ -24,18 +24,18 @@ return var/mob/living/carbon/human/human_target = target var/beard_or_hair = tgui_alert(user, "What do you want to dye?", "Character Preference", list("Hair", "Facial Hair")) - if(!beard_or_hair || !user.canUseTopic(src, be_close = TRUE, no_dexterity = TRUE, no_tk = FALSE)) + if(!beard_or_hair || !user.can_perform_action(src, NEED_DEXTERITY)) return var/list/choices = beard_or_hair == "Hair" ? GLOB.hair_gradients_list : GLOB.facial_hair_gradients_list var/new_grad_style = tgui_input_list(user, "Choose a color pattern", "Character Preference", choices) if(isnull(new_grad_style)) return - if(!user.canUseTopic(src, be_close = TRUE, no_dexterity = TRUE, no_tk = FALSE)) + if(!user.can_perform_action(src, NEED_DEXTERITY)) return var/new_grad_color = input(user, "Choose a secondary hair color:", "Character Preference",human_target.grad_color) as color|null - if(!new_grad_color || !user.canUseTopic(src, be_close = TRUE, no_dexterity = TRUE, no_tk = FALSE) || !user.CanReach(target)) + if(!new_grad_color || !user.can_perform_action(src, NEED_DEXTERITY) || !user.CanReach(target)) return to_chat(user, span_notice("You start applying the hair dye...")) diff --git a/code/game/objects/items/extinguisher.dm b/code/game/objects/items/extinguisher.dm index a3e19bc71c3..b66aa57244a 100644 --- a/code/game/objects/items/extinguisher.dm +++ b/code/game/objects/items/extinguisher.dm @@ -261,7 +261,7 @@ source.delay = 3 /obj/item/extinguisher/AltClick(mob/user) - if(!user.canUseTopic(src, be_close = TRUE, no_dexterity = TRUE, no_tk = FALSE, need_hands = TRUE)) + if(!user.can_perform_action(src, NEED_DEXTERITY|NEED_HANDS)) return if(!user.is_holding(src)) to_chat(user, span_notice("You must be holding the [src] in your hands do this!")) diff --git a/code/game/objects/items/flamethrower.dm b/code/game/objects/items/flamethrower.dm index e87042d3552..b8d55b66786 100644 --- a/code/game/objects/items/flamethrower.dm +++ b/code/game/objects/items/flamethrower.dm @@ -153,7 +153,7 @@ toggle_igniter(user) /obj/item/flamethrower/AltClick(mob/user) - if(ptank && isliving(user) && user.canUseTopic(src, be_close = TRUE, no_dexterity = TRUE, no_tk = FALSE, need_hands = TRUE)) + if(ptank && isliving(user) && user.can_perform_action(src, NEED_DEXTERITY|NEED_HANDS)) user.put_in_hands(ptank) ptank = null to_chat(user, span_notice("You remove the plasma tank from [src]!")) diff --git a/code/game/objects/items/grenades/_grenade.dm b/code/game/objects/items/grenades/_grenade.dm index c5dd4677b7b..9dfb931a1bb 100644 --- a/code/game/objects/items/grenades/_grenade.dm +++ b/code/game/objects/items/grenades/_grenade.dm @@ -202,7 +202,7 @@ var/newtime = tgui_input_list(user, "Please enter a new detonation time", "Detonation Timer", list("Instant", 3, 4, 5)) if (isnull(newtime)) return - if(!user.canUseTopic(src, be_close = TRUE)) + if(!user.can_perform_action(src)) return if(newtime == "Instant" && change_det_time(0)) to_chat(user, span_notice("You modify the time delay. It's set to be instantaneous.")) diff --git a/code/game/objects/items/grenades/chem_grenade.dm b/code/game/objects/items/grenades/chem_grenade.dm index 2496f64327c..06d60173bd8 100644 --- a/code/game/objects/items/grenades/chem_grenade.dm +++ b/code/game/objects/items/grenades/chem_grenade.dm @@ -355,7 +355,7 @@ if (active) return var/newspread = tgui_input_number(user, "Please enter a new spread amount", "Grenade Spread", 5, 100, 5) - if(!newspread || QDELETED(user) || QDELETED(src) || !usr.canUseTopic(src, be_close = TRUE, no_dexterity = FALSE, no_tk = TRUE)) + if(!newspread || QDELETED(user) || QDELETED(src) || !usr.can_perform_action(src, FORBID_TELEKINESIS_REACH)) return unit_spread = newspread to_chat(user, span_notice("You set the time release to [unit_spread] units per detonation.")) diff --git a/code/game/objects/items/grenades/plastic.dm b/code/game/objects/items/grenades/plastic.dm index 98224529a4d..363bd3e1765 100644 --- a/code/game/objects/items/grenades/plastic.dm +++ b/code/game/objects/items/grenades/plastic.dm @@ -77,7 +77,7 @@ /obj/item/grenade/c4/attack_self(mob/user) var/newtime = tgui_input_number(user, "Please set the timer", "C4 Timer", minimum_timer, maximum_timer, minimum_timer) - if(!newtime || QDELETED(user) || QDELETED(src) || !usr.canUseTopic(src, be_close = TRUE, no_dexterity = FALSE, no_tk = TRUE)) + if(!newtime || QDELETED(user) || QDELETED(src) || !usr.can_perform_action(src, FORBID_TELEKINESIS_REACH)) return det_time = newtime to_chat(user, "Timer set for [det_time] seconds.") diff --git a/code/game/objects/items/implants/implantcase.dm b/code/game/objects/items/implants/implantcase.dm index bbaced216b5..32039874cb3 100644 --- a/code/game/objects/items/implants/implantcase.dm +++ b/code/game/objects/items/implants/implantcase.dm @@ -28,7 +28,7 @@ if(!user.can_write(used_item)) return var/new_name = tgui_input_text(user, "What would you like the label to be?", name, max_length = MAX_NAME_LEN) - if((user.get_active_held_item() != used_item) || !user.canUseTopic(src, be_close = TRUE)) + if((user.get_active_held_item() != used_item) || !user.can_perform_action(src)) return if(new_name) name = "implant case - '[new_name]'" diff --git a/code/game/objects/items/implants/implanter.dm b/code/game/objects/items/implants/implanter.dm index b31c7048596..454ebb07747 100644 --- a/code/game/objects/items/implants/implanter.dm +++ b/code/game/objects/items/implants/implanter.dm @@ -53,7 +53,7 @@ var/new_name = tgui_input_text(user, "What would you like the label to be?", name, max_length = MAX_NAME_LEN) if(user.get_active_held_item() != I) return - if(!user.canUseTopic(src, be_close = TRUE)) + if(!user.can_perform_action(src)) return if(new_name) name = "implanter ([new_name])" diff --git a/code/game/objects/items/implants/implantpad.dm b/code/game/objects/items/implants/implantpad.dm index 08002278e40..32545e92a88 100644 --- a/code/game/objects/items/implants/implantpad.dm +++ b/code/game/objects/items/implants/implantpad.dm @@ -34,7 +34,7 @@ /obj/item/implantpad/AltClick(mob/user) ..() - if(!user.canUseTopic(src, be_close = TRUE, no_dexterity = FALSE, no_tk = TRUE)) + if(!user.can_perform_action(src, FORBID_TELEKINESIS_REACH)) return if(!case) to_chat(user, span_warning("There's no implant to remove from [src].")) @@ -60,7 +60,7 @@ return ..() /obj/item/implantpad/ui_interact(mob/user) - if(!user.canUseTopic(src, be_close = TRUE, no_dexterity = FALSE, no_tk = TRUE)) + if(!user.can_perform_action(src, FORBID_TELEKINESIS_REACH)) user.unset_machine(src) user << browse(null, "window=implantpad") return diff --git a/code/game/objects/items/inspector.dm b/code/game/objects/items/inspector.dm index 30ffe86426d..f28a2480726 100644 --- a/code/game/objects/items/inspector.dm +++ b/code/game/objects/items/inspector.dm @@ -77,7 +77,7 @@ return ..() /obj/item/inspector/CtrlClick(mob/living/user) - if(!user.canUseTopic(src, be_close = TRUE, no_dexterity = TRUE, no_tk = FALSE, need_hands= !iscyborg(user)) || !cell_cover_open || !cell) + if(!user.can_perform_action(src, NEED_DEXTERITY) || !cell_cover_open || !cell) return ..() user.visible_message(span_notice("[user] removes \the [cell] from [src]!"), \ span_notice("You remove [cell].")) @@ -380,7 +380,7 @@ grind_results = list(/datum/reagent/water = 5) /obj/item/paper/fake_report/water/AltClick(mob/living/user, obj/item/I) - if(!user.canUseTopic(src, be_close = TRUE, no_dexterity = TRUE, no_tk = FALSE, need_hands = TRUE)) + if(!user.can_perform_action(src, NEED_DEXTERITY|NEED_HANDS)) return var/datum/action/innate/origami/origami_action = locate() in user.actions if(origami_action?.active) //Origami masters can fold water diff --git a/code/game/objects/items/pet_carrier.dm b/code/game/objects/items/pet_carrier.dm index b191107fc1e..36f526a787d 100644 --- a/code/game/objects/items/pet_carrier.dm +++ b/code/game/objects/items/pet_carrier.dm @@ -52,10 +52,11 @@ . += span_notice("It has [L] inside.") else . += span_notice("It has nothing inside.") - if(user.canUseTopic(src)) - . += span_notice("Activate it in your hand to [open ? "close" : "open"] its door. Click-drag onto floor to release its occupants.") - if(!open) - . += span_notice("Alt-click to [locked ? "unlock" : "lock"] its door.") + + // At some point these need to be converted to contextual screentips + . += span_notice("Activate it in your hand to [open ? "close" : "open"] its door. Click-drag onto floor to release its occupants.") + if(!open) + . += span_notice("Alt-click to [locked ? "unlock" : "lock"] its door.") /obj/item/pet_carrier/attack_self(mob/living/user) if(open) @@ -72,7 +73,7 @@ update_appearance() /obj/item/pet_carrier/AltClick(mob/living/user) - if(open || !user.canUseTopic(src, be_close = TRUE)) + if(open || !user.can_perform_action(src)) return locked = !locked to_chat(user, span_notice("You flip the lock switch [locked ? "down" : "up"].")) @@ -157,7 +158,7 @@ /obj/item/pet_carrier/MouseDrop(atom/over_atom) . = ..() - if(isopenturf(over_atom) && usr.canUseTopic(src, be_close = TRUE, no_dexterity = TRUE, no_tk = FALSE, need_hands = !iscyborg(usr)) && usr.Adjacent(over_atom) && open && occupants.len) + if(isopenturf(over_atom) && usr.can_perform_action(src, NEED_DEXTERITY) && usr.Adjacent(over_atom) && open && occupants.len) usr.visible_message(span_notice("[usr] unloads [src]."), \ span_notice("You unload [src] onto [over_atom].")) for(var/V in occupants) diff --git a/code/game/objects/items/signs.dm b/code/game/objects/items/signs.dm index 08fbf8e6199..38a646d6387 100644 --- a/code/game/objects/items/signs.dm +++ b/code/game/objects/items/signs.dm @@ -23,7 +23,7 @@ if(!user.can_write(writing_instrument)) return var/txt = tgui_input_text(user, "What would you like to write on the sign?", "Sign Label", max_length = 30) - if(txt && user.canUseTopic(src, be_close = TRUE)) + if(txt && user.can_perform_action(src)) label = txt name = "[label] sign" desc = "It reads: [label]" diff --git a/code/game/objects/items/spear.dm b/code/game/objects/items/spear.dm index 747e3b643dc..15640cd3691 100644 --- a/code/game/objects/items/spear.dm +++ b/code/game/objects/items/spear.dm @@ -147,7 +147,7 @@ . += span_notice("Alt-click to set your war cry.") /obj/item/spear/explosive/AltClick(mob/user) - if(user.canUseTopic(src, be_close = TRUE)) + if(user.can_perform_action(src)) ..() if(istype(user) && loc == user) var/input = tgui_input_text(user, "What do you want your war cry to be? You will shout it when you hit someone in melee.", "War Cry", max_length = 50) diff --git a/code/game/objects/items/stacks/stack.dm b/code/game/objects/items/stacks/stack.dm index 53f024a0415..6a0ff3e6718 100644 --- a/code/game/objects/items/stacks/stack.dm +++ b/code/game/objects/items/stacks/stack.dm @@ -657,13 +657,13 @@ if(. == SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN) return - if(is_cyborg || !user.canUseTopic(src, be_close = TRUE, no_dexterity = TRUE, no_tk = FALSE, need_hands = !iscyborg(user))) + if(is_cyborg || !user.can_perform_action(src, NEED_DEXTERITY)) return SECONDARY_ATTACK_CONTINUE_CHAIN if(is_zero_amount(delete_if_zero = TRUE)) return SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN var/max = get_amount() var/stackmaterial = tgui_input_number(user, "How many sheets do you wish to take out of this stack?", "Stack Split", max_value = max) - if(!stackmaterial || QDELETED(user) || QDELETED(src) || !usr.canUseTopic(src, be_close = TRUE, no_dexterity = FALSE, no_tk = TRUE, need_hands = !iscyborg(user))) + if(!stackmaterial || QDELETED(user) || QDELETED(src) || !usr.can_perform_action(src, FORBID_TELEKINESIS_REACH)) return SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN split_stack(user, stackmaterial) to_chat(user, span_notice("You take [stackmaterial] sheets out of the stack.")) diff --git a/code/game/objects/items/stacks/wrap.dm b/code/game/objects/items/stacks/wrap.dm index f74e546d7fb..ca8d609ca51 100644 --- a/code/game/objects/items/stacks/wrap.dm +++ b/code/game/objects/items/stacks/wrap.dm @@ -39,7 +39,7 @@ /obj/item/stack/wrapping_paper/attack_hand_secondary(mob/user, modifiers) var/new_base = input(user, "", "Select a base color", color) as color var/new_ribbon = input(user, "", "Select a ribbon color", color) as color - if(!user.canUseTopic(src, be_close = TRUE)) + if(!user.can_perform_action(src)) return set_greyscale(colors = list(new_base, new_ribbon)) return TRUE diff --git a/code/game/objects/items/storage/belt.dm b/code/game/objects/items/storage/belt.dm index b57284fdfd6..abb9d919fab 100644 --- a/code/game/objects/items/storage/belt.dm +++ b/code/game/objects/items/storage/belt.dm @@ -798,7 +798,7 @@ . += span_notice("Alt-click it to quickly draw the blade.") /obj/item/storage/belt/sabre/AltClick(mob/user) - if(!user.canUseTopic(src, be_close = TRUE, no_dexterity = TRUE, no_tk = FALSE, need_hands = TRUE)) + if(!user.can_perform_action(src, NEED_DEXTERITY|NEED_HANDS)) return if(length(contents)) var/obj/item/I = contents[1] diff --git a/code/game/objects/items/storage/lockbox.dm b/code/game/objects/items/storage/lockbox.dm index 56e2fb398cd..59eb86137a8 100644 --- a/code/game/objects/items/storage/lockbox.dm +++ b/code/game/objects/items/storage/lockbox.dm @@ -116,7 +116,7 @@ . += span_notice("Alt-click to [open ? "close":"open"] it.") /obj/item/storage/lockbox/medal/AltClick(mob/user) - if(user.canUseTopic(src, be_close = TRUE)) + if(user.can_perform_action(src)) if(!atom_storage.locked) open = (open ? FALSE : TRUE) update_appearance() diff --git a/code/game/objects/items/tanks/tank_types.dm b/code/game/objects/items/tanks/tank_types.dm index c25ab3a2c51..6241aa6d2b3 100644 --- a/code/game/objects/items/tanks/tank_types.dm +++ b/code/game/objects/items/tanks/tank_types.dm @@ -11,7 +11,7 @@ /// Allows carbon to toggle internals via AltClick of the equipped tank. /obj/item/tank/internals/AltClick(mob/user) ..() - if((loc == user) && user.canUseTopic(src, be_close = TRUE, no_dexterity = FALSE, no_tk = TRUE, need_hands = TRUE)) + if((loc == user) && user.can_perform_action(src, FORBID_TELEKINESIS_REACH|NEED_HANDS)) toggle_internals(user) /obj/item/tank/internals/examine(mob/user) diff --git a/code/game/objects/objs.dm b/code/game/objects/objs.dm index 67c2ecae9c1..190328ef365 100644 --- a/code/game/objects/objs.dm +++ b/code/game/objects/objs.dm @@ -290,7 +290,7 @@ GLOBAL_LIST_EMPTY(objects_by_id_tag) /obj/AltClick(mob/user) . = ..() - if(unique_reskin && (!current_skin || infinite_reskin) && user.canUseTopic(src, be_close = TRUE, no_dexterity = TRUE)) + if(unique_reskin && (!current_skin || infinite_reskin) && user.can_perform_action(src, NEED_DEXTERITY)) reskin_obj(user) /** diff --git a/code/game/objects/structures/beds_chairs/bed.dm b/code/game/objects/structures/beds_chairs/bed.dm index 7244cba3263..2610498964e 100644 --- a/code/game/objects/structures/beds_chairs/bed.dm +++ b/code/game/objects/structures/beds_chairs/bed.dm @@ -96,7 +96,7 @@ . = ..() if(. == SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN) return SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN - if(!ishuman(user) || !user.canUseTopic(src, be_close = TRUE)) + if(!ishuman(user) || !user.can_perform_action(src)) return SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN if(has_buckled_mobs()) return SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN diff --git a/code/game/objects/structures/beds_chairs/chair.dm b/code/game/objects/structures/beds_chairs/chair.dm index 0498f574e3b..6d0a0d4bd9c 100644 --- a/code/game/objects/structures/beds_chairs/chair.dm +++ b/code/game/objects/structures/beds_chairs/chair.dm @@ -281,7 +281,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/structure/chair/stool, 0) if(over_object == usr && Adjacent(usr)) if(!item_chair || has_buckled_mobs() || src.flags_1 & NODECONSTRUCT_1) return - if(!usr.canUseTopic(src, be_close = TRUE, no_dexterity = TRUE, no_tk = FALSE, need_hands = TRUE)) + if(!usr.can_perform_action(src, NEED_DEXTERITY|NEED_HANDS)) return usr.visible_message(span_notice("[usr] grabs \the [src.name]."), span_notice("You grab \the [src.name].")) var/obj/item/C = new item_chair(loc) @@ -477,7 +477,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/structure/chair/stool/bar, 0) /obj/structure/chair/bronze/AltClick(mob/user) turns = 0 - if(!user.canUseTopic(src, be_close = TRUE, no_dexterity = TRUE, no_tk = FALSE, need_hands = !iscyborg(user))) + if(!user.can_perform_action(src, NEED_DEXTERITY)) return if(!(datum_flags & DF_ISPROCESSING)) user.visible_message(span_notice("[user] spins [src] around, and the last vestiges of Ratvarian technology keeps it spinning FOREVER."), \ diff --git a/code/game/objects/structures/bedsheet_bin.dm b/code/game/objects/structures/bedsheet_bin.dm index ce83258a28a..0ce35d4bab4 100644 --- a/code/game/objects/structures/bedsheet_bin.dm +++ b/code/game/objects/structures/bedsheet_bin.dm @@ -138,7 +138,7 @@ LINEN BINS /obj/item/bedsheet/AltClick(mob/living/user) // double check the canUseTopic args to make sure it's correct - if(!istype(user) || !user.canUseTopic(src, be_close = TRUE, no_dexterity = TRUE, no_tk = FALSE, need_hands = !iscyborg(user))) + if(!istype(user) || !user.can_perform_action(src, NEED_DEXTERITY)) return dir = turn(dir, 180) diff --git a/code/game/objects/structures/crates_lockers/closets.dm b/code/game/objects/structures/crates_lockers/closets.dm index a682d53921b..6eff8c5ff1d 100644 --- a/code/game/objects/structures/crates_lockers/closets.dm +++ b/code/game/objects/structures/crates_lockers/closets.dm @@ -614,7 +614,7 @@ set category = "Object" set name = "Toggle Open" - if(!usr.canUseTopic(src, be_close = TRUE) || !isturf(loc)) + if(!usr.can_perform_action(src) || !isturf(loc)) return if(iscarbon(usr) || issilicon(usr) || isdrone(usr)) @@ -677,7 +677,7 @@ /obj/structure/closet/attack_hand_secondary(mob/user, modifiers) . = ..() - if(!user.canUseTopic(src, be_close = TRUE) || !isturf(loc)) + if(!user.can_perform_action(src) || !isturf(loc)) return if(!opened && secure) diff --git a/code/game/objects/structures/crates_lockers/closets/bodybag.dm b/code/game/objects/structures/crates_lockers/closets/bodybag.dm index 73dca291af4..99ce86d6fa5 100644 --- a/code/game/objects/structures/crates_lockers/closets/bodybag.dm +++ b/code/game/objects/structures/crates_lockers/closets/bodybag.dm @@ -49,7 +49,7 @@ var/t = tgui_input_text(user, "What would you like the label to be?", name, max_length = 53) if(user.get_active_held_item() != interact_tool) return - if(!user.canUseTopic(src, be_close = TRUE)) + if(!user.can_perform_action(src)) return handle_tag("[t ? t : initial(name)]") return @@ -315,7 +315,7 @@ open() /obj/structure/closet/body_bag/environmental/prisoner/attack_hand_secondary(mob/user, modifiers) - if(!user.canUseTopic(src, be_close = TRUE) || !isturf(loc)) + if(!user.can_perform_action(src) || !isturf(loc)) return togglelock(user) return SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN diff --git a/code/game/objects/structures/displaycase.dm b/code/game/objects/structures/displaycase.dm index 3c475b6fa60..3555c5a5d62 100644 --- a/code/game/objects/structures/displaycase.dm +++ b/code/game/objects/structures/displaycase.dm @@ -516,7 +516,7 @@ if(!payments_acc) to_chat(usr, span_notice("[src] hasn't been registered yet.")) return TRUE - if(!usr.canUseTopic(src, be_close = TRUE, no_dexterity = FALSE, no_tk = TRUE)) + if(!usr.can_perform_action(src, FORBID_TELEKINESIS_REACH)) return TRUE if(!potential_acc) to_chat(usr, span_notice("No ID card detected.")) @@ -571,7 +571,7 @@ if(payments_acc != potential_acc.registered_account) to_chat(usr, span_warning("[src] rejects your new price.")) return - if(!usr.canUseTopic(src, be_close = TRUE, no_dexterity = FALSE, no_tk = TRUE)) + if(!usr.can_perform_action(src, FORBID_TELEKINESIS_REACH)) to_chat(usr, span_warning("You need to get closer!")) return sale_price = new_price_input diff --git a/code/game/objects/structures/divine.dm b/code/game/objects/structures/divine.dm index a00f1df8053..4a6be0d9b17 100644 --- a/code/game/objects/structures/divine.dm +++ b/code/game/objects/structures/divine.dm @@ -9,7 +9,7 @@ /obj/structure/sacrificealtar/AltClick(mob/living/user) ..() - if(!istype(user) || !user.canUseTopic(src, be_close = TRUE)) + if(!istype(user) || !user.can_perform_action(src)) return if(!has_buckled_mobs()) return diff --git a/code/game/objects/structures/extinguisher.dm b/code/game/objects/structures/extinguisher.dm index b18c5052952..8b29e093f3d 100644 --- a/code/game/objects/structures/extinguisher.dm +++ b/code/game/objects/structures/extinguisher.dm @@ -111,7 +111,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/structure/extinguisher_cabinet, 29) toggle_cabinet(user) /obj/structure/extinguisher_cabinet/attack_hand_secondary(mob/living/user) - if(!user.canUseTopic(src, be_close = TRUE, no_dexterity = TRUE, no_tk = FALSE, need_hands = TRUE)) + if(!user.can_perform_action(src, NEED_DEXTERITY|NEED_HANDS)) return ..() toggle_cabinet(user) return SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN diff --git a/code/game/objects/structures/gym.dm b/code/game/objects/structures/gym.dm index 8dcfbebd2bf..8d23b3f960c 100644 --- a/code/game/objects/structures/gym.dm +++ b/code/game/objects/structures/gym.dm @@ -107,7 +107,7 @@ . = ..() if(.) return - if(!user.canUseTopic(src, be_close = TRUE, no_dexterity = FALSE, no_tk = TRUE)) + if(!user.can_perform_action(src, FORBID_TELEKINESIS_REACH)) return if(obj_flags & IN_USE) balloon_alert(user, "wait your turn!") diff --git a/code/game/objects/structures/lavaland/geyser.dm b/code/game/objects/structures/lavaland/geyser.dm index c959a006a7e..8e2649fea03 100644 --- a/code/game/objects/structures/lavaland/geyser.dm +++ b/code/game/objects/structures/lavaland/geyser.dm @@ -167,7 +167,7 @@ playsound(src, 'sound/machines/click.ogg', 10, TRUE) /obj/item/plunger/AltClick(mob/user) - if(!istype(user) || !user.canUseTopic(src, be_close = TRUE)) + if(!istype(user) || !user.can_perform_action(src)) return var/new_layer = tgui_input_list(user, "Select a layer", "Layer", GLOB.plumbing_layers) diff --git a/code/game/objects/structures/maintenance.dm b/code/game/objects/structures/maintenance.dm index 4bf533db87b..33f27f40c47 100644 --- a/code/game/objects/structures/maintenance.dm +++ b/code/game/objects/structures/maintenance.dm @@ -151,7 +151,7 @@ at the cost of risking a vicious bite.**/ switch(altar_result) if("Change Color") var/chosen_color = input(user, "", "Choose Color", pants_color) as color|null - if(!isnull(chosen_color) && user.canUseTopic(src, be_close = TRUE)) + if(!isnull(chosen_color) && user.can_perform_action(src)) pants_color = chosen_color if("Create Artefact") if(!COOLDOWN_FINISHED(src, use_cooldown) || status != ALTAR_INACTIVE) diff --git a/code/game/objects/structures/mirror.dm b/code/game/objects/structures/mirror.dm index 81251b1382e..fe98b846dd2 100644 --- a/code/game/objects/structures/mirror.dm +++ b/code/game/objects/structures/mirror.dm @@ -31,7 +31,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/structure/mirror, 28) var/new_style = tgui_input_list(user, "Select a facial hairstyle", "Grooming", GLOB.facial_hairstyles_list) if(isnull(new_style)) return TRUE - if(!user.canUseTopic(src, be_close = TRUE, no_dexterity = FALSE, no_tk = TRUE)) + if(!user.can_perform_action(src, FORBID_TELEKINESIS_REACH)) return TRUE //no tele-grooming if(HAS_TRAIT(hairdresser, TRAIT_SHAVED)) to_chat(hairdresser, span_notice("If only growing back facial hair were that easy for you...")) @@ -43,7 +43,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/structure/mirror, 28) var/new_style = tgui_input_list(user, "Select a hairstyle", "Grooming", GLOB.hairstyles_list) if(isnull(new_style)) return TRUE - if(!user.canUseTopic(src, be_close = TRUE, no_dexterity = FALSE, no_tk = TRUE)) + if(!user.can_perform_action(src, FORBID_TELEKINESIS_REACH)) return TRUE //no tele-grooming if(HAS_TRAIT(hairdresser, TRAIT_BALD)) to_chat(hairdresser, span_notice("If only growing back hair were that easy for you...")) @@ -167,7 +167,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/structure/mirror, 28) if(isnull(choice)) return TRUE - if(!user.canUseTopic(src, be_close = TRUE, no_dexterity = FALSE, no_tk = TRUE)) + if(!user.can_perform_action(src, FORBID_TELEKINESIS_REACH)) return TRUE switch(choice) @@ -175,7 +175,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/structure/mirror, 28) var/newname = sanitize_name(tgui_input_text(amazed_human, "Who are we again?", "Name change", amazed_human.name, MAX_NAME_LEN), allow_numbers = TRUE) //It's magic so whatever. if(!newname) return TRUE - if(!user.canUseTopic(src, be_close = TRUE, no_dexterity = FALSE, no_tk = TRUE)) + if(!user.can_perform_action(src, FORBID_TELEKINESIS_REACH)) return TRUE amazed_human.real_name = newname amazed_human.name = newname @@ -190,7 +190,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/structure/mirror, 28) return TRUE if(!selectable_races[racechoice]) return TRUE - if(!user.canUseTopic(src, be_close = TRUE, no_dexterity = FALSE, no_tk = TRUE)) + if(!user.can_perform_action(src, FORBID_TELEKINESIS_REACH)) return TRUE var/datum/species/newrace = selectable_races[racechoice] @@ -204,7 +204,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/structure/mirror, 28) if(MUTCOLORS in amazed_human.dna.species.species_traits) var/new_mutantcolor = input(user, "Choose your skin color:", "Race change", amazed_human.dna.features["mcolor"]) as color|null - if(!user.canUseTopic(src, be_close = TRUE, no_dexterity = FALSE, no_tk = TRUE)) + if(!user.can_perform_action(src, FORBID_TELEKINESIS_REACH)) return TRUE if(new_mutantcolor) var/temp_hsv = RGBtoHSV(new_mutantcolor) @@ -225,7 +225,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/structure/mirror, 28) return TRUE if(amazed_human.gender == "male") if(tgui_alert(amazed_human, "Become a Witch?", "Confirmation", list("Yes", "No")) == "Yes") - if(!user.canUseTopic(src, be_close = TRUE, no_dexterity = FALSE, no_tk = TRUE)) + if(!user.can_perform_action(src, FORBID_TELEKINESIS_REACH)) return TRUE amazed_human.gender = FEMALE amazed_human.physique = FEMALE @@ -235,7 +235,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/structure/mirror, 28) else if(tgui_alert(amazed_human, "Become a Warlock?", "Confirmation", list("Yes", "No")) == "Yes") - if(!user.canUseTopic(src, be_close = TRUE, no_dexterity = FALSE, no_tk = TRUE)) + if(!user.can_perform_action(src, FORBID_TELEKINESIS_REACH)) return TRUE amazed_human.gender = MALE amazed_human.physique = MALE @@ -248,13 +248,13 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/structure/mirror, 28) if("hair") var/hairchoice = tgui_alert(amazed_human, "Hairstyle or hair color?", "Change Hair", list("Style", "Color")) - if(!user.canUseTopic(src, be_close = TRUE, no_dexterity = FALSE, no_tk = TRUE)) + if(!user.can_perform_action(src, FORBID_TELEKINESIS_REACH)) return TRUE if(hairchoice == "Style") //So you just want to use a mirror then? return ..() else var/new_hair_color = input(amazed_human, "Choose your hair color", "Hair Color",amazed_human.hair_color) as color|null - if(!user.canUseTopic(src, be_close = TRUE, no_dexterity = FALSE, no_tk = TRUE)) + if(!user.can_perform_action(src, FORBID_TELEKINESIS_REACH)) return TRUE if(new_hair_color) amazed_human.hair_color = sanitize_hexcolor(new_hair_color) @@ -268,7 +268,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/structure/mirror, 28) if(BODY_ZONE_PRECISE_EYES) var/new_eye_color = input(amazed_human, "Choose your eye color", "Eye Color", amazed_human.eye_color_left) as color|null - if(!user.canUseTopic(src, be_close = TRUE, no_dexterity = FALSE, no_tk = TRUE)) + if(!user.can_perform_action(src, FORBID_TELEKINESIS_REACH)) return TRUE if(new_eye_color) amazed_human.eye_color_left = sanitize_hexcolor(new_eye_color) diff --git a/code/game/objects/structures/morgue.dm b/code/game/objects/structures/morgue.dm index c0fb9bd6e9c..87d30f50caf 100644 --- a/code/game/objects/structures/morgue.dm +++ b/code/game/objects/structures/morgue.dm @@ -90,7 +90,7 @@ GLOBAL_LIST_EMPTY(bodycontainers) //Let them act as spawnpoints for revenants an var/t = tgui_input_text(user, "What would you like the label to be?", text("[]", name), null) if (user.get_active_held_item() != P) return - if(!user.canUseTopic(src, be_close = TRUE)) + if(!user.can_perform_action(src)) return if (t) name = text("[]- '[]'", initial(name), t) @@ -178,7 +178,7 @@ GLOBAL_LIST_EMPTY(bodycontainers) //Let them act as spawnpoints for revenants an /obj/structure/bodycontainer/morgue/AltClick(mob/user) ..() - if(!user.canUseTopic(src, !issilicon(user))) + if(!user.can_perform_action(src, ALLOW_SILICON_REACH)) return beeper = !beeper to_chat(user, span_notice("You turn the speaker function [beeper ? "on" : "off"].")) diff --git a/code/game/objects/structures/reflector.dm b/code/game/objects/structures/reflector.dm index a9da9c9dfd1..ebbc59a97eb 100644 --- a/code/game/objects/structures/reflector.dm +++ b/code/game/objects/structures/reflector.dm @@ -165,13 +165,13 @@ to_chat(user, span_warning("The rotation is locked!")) return FALSE var/new_angle = tgui_input_number(user, "New angle for primary reflection face", "Reflector Angle", rotation_angle, 360) - if(isnull(new_angle) || QDELETED(user) || QDELETED(src) || !usr.canUseTopic(src, be_close = TRUE, no_dexterity = FALSE, no_tk = TRUE)) + if(isnull(new_angle) || QDELETED(user) || QDELETED(src) || !usr.can_perform_action(src, FORBID_TELEKINESIS_REACH)) return FALSE set_angle(SIMPLIFY_DEGREES(new_angle)) return TRUE /obj/structure/reflector/AltClick(mob/user) - if(!user.canUseTopic(src, be_close = TRUE, no_dexterity = TRUE, no_tk = FALSE, need_hands = !iscyborg(user))) + if(!user.can_perform_action(src, NEED_DEXTERITY)) return else if(finished) rotate(user) diff --git a/code/game/objects/structures/safe.dm b/code/game/objects/structures/safe.dm index b525a86433c..c14c29cc62b 100644 --- a/code/game/objects/structures/safe.dm +++ b/code/game/objects/structures/safe.dm @@ -131,7 +131,7 @@ FLOOR SAFES if(!ishuman(usr)) return var/mob/living/carbon/human/user = usr - if(!user.canUseTopic(src, be_close = TRUE)) + if(!user.can_perform_action(src)) return var/canhear = FALSE diff --git a/code/game/objects/structures/training_machine.dm b/code/game/objects/structures/training_machine.dm index 48b2d99d994..e68761798b9 100644 --- a/code/game/objects/structures/training_machine.dm +++ b/code/game/objects/structures/training_machine.dm @@ -176,7 +176,7 @@ /obj/structure/training_machine/AltClick(mob/user) . = ..() - if(!user.canUseTopic(src, be_close = TRUE, no_dexterity = TRUE, no_tk = TRUE, floor_okay = TRUE)) + if(!user.can_perform_action(src, NEED_DEXTERITY|FORBID_TELEKINESIS_REACH|ALLOW_RESTING)) return if(has_buckled_mobs()) user_unbuckle_mob(buckled_mobs[1], user) diff --git a/code/modules/antagonists/pirate/pirate_shuttle_equipment.dm b/code/modules/antagonists/pirate/pirate_shuttle_equipment.dm index e1bef982f62..cf05964b421 100644 --- a/code/modules/antagonists/pirate/pirate_shuttle_equipment.dm +++ b/code/modules/antagonists/pirate/pirate_shuttle_equipment.dm @@ -43,7 +43,7 @@ var/scramble_response = tgui_alert(user, "Turning the scrambler on will make the shuttle trackable by GPS. Are you sure you want to do it?", "Scrambler", list("Yes", "Cancel")) if(scramble_response != "Yes") return - if(active || !user.canUseTopic(src, be_close = TRUE)) + if(active || !user.can_perform_action(src)) return toggle_on(user) update_appearance() diff --git a/code/modules/antagonists/wizard/equipment/artefact.dm b/code/modules/antagonists/wizard/equipment/artefact.dm index 74f8ccf07a8..ab63a8c3b69 100644 --- a/code/modules/antagonists/wizard/equipment/artefact.dm +++ b/code/modules/antagonists/wizard/equipment/artefact.dm @@ -230,7 +230,7 @@ if(!istype(M)) return ..() - if(!istype(user) || !user.canUseTopic(M, be_close = TRUE)) + if(!istype(user) || !user.can_perform_action(M)) return if(M.stat != DEAD) diff --git a/code/modules/art/paintings.dm b/code/modules/art/paintings.dm index f6ab190b46c..25e6b68c539 100644 --- a/code/modules/art/paintings.dm +++ b/code/modules/art/paintings.dm @@ -207,7 +207,7 @@ return var/sniped_amount = painting_metadata.credit_value var/offer_amount = tgui_input_number(user, "How much do you want to offer?", "Patronage Amount", (painting_metadata.credit_value + 1), account.account_balance, painting_metadata.credit_value) - if(!offer_amount || QDELETED(user) || QDELETED(src) || !usr.canUseTopic(src, be_close = TRUE, no_dexterity = FALSE, no_tk = TRUE)) + if(!offer_amount || QDELETED(user) || QDELETED(src) || !usr.can_perform_action(src, FORBID_TELEKINESIS_REACH)) return if(sniped_amount != painting_metadata.credit_value) return @@ -324,7 +324,7 @@ if(painting_metadata.loaded_from_json) // No renaming old paintings return var/new_name = tgui_input_text(user, "What do you want to name the painting?", "Title Your Masterpiece") - if(new_name != painting_metadata.title && new_name && user.canUseTopic(src, be_close = TRUE)) + if(new_name != painting_metadata.title && new_name && user.can_perform_action(src)) painting_metadata.title = new_name var/sign_choice = tgui_alert(user, "Do you want to sign it or remain anonymous?", "Sign painting?", list("Yes", "No")) if(sign_choice != "Yes") diff --git a/code/modules/assembly/doorcontrol.dm b/code/modules/assembly/doorcontrol.dm index c034597b00f..9d2b5bf45f0 100644 --- a/code/modules/assembly/doorcontrol.dm +++ b/code/modules/assembly/doorcontrol.dm @@ -16,7 +16,7 @@ /obj/item/assembly/control/multitool_act(mob/living/user) var/change_id = tgui_input_number(user, "Set the door controllers ID", "Door ID", id, 100) - if(!change_id || QDELETED(user) || QDELETED(src) || !usr.canUseTopic(src, be_close = TRUE, no_dexterity = FALSE, no_tk = TRUE)) + if(!change_id || QDELETED(user) || QDELETED(src) || !usr.can_perform_action(src, FORBID_TELEKINESIS_REACH)) return id = change_id balloon_alert(user, "id changed") diff --git a/code/modules/atmospherics/machinery/air_alarm/air_alarm_interact.dm b/code/modules/atmospherics/machinery/air_alarm/air_alarm_interact.dm index 732fadc56e4..91bb92a2ea0 100644 --- a/code/modules/atmospherics/machinery/air_alarm/air_alarm_interact.dm +++ b/code/modules/atmospherics/machinery/air_alarm/air_alarm_interact.dm @@ -64,7 +64,7 @@ . = ..() if(!can_interact(user)) return - if(!user.canUseTopic(src, !issilicon(user)) || !isturf(loc)) + if(!user.can_perform_action(src, ALLOW_SILICON_REACH) || !isturf(loc)) return togglelock(user) return SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN diff --git a/code/modules/atmospherics/machinery/portable/canister.dm b/code/modules/atmospherics/machinery/portable/canister.dm index f6c7c958fe9..200b8da60ec 100644 --- a/code/modules/atmospherics/machinery/portable/canister.dm +++ b/code/modules/atmospherics/machinery/portable/canister.dm @@ -767,7 +767,7 @@ GLOBAL_LIST_INIT(gas_id_to_canister, init_gas_id_to_canister()) timer_set = min(maximum_timer_set, timer_set + 10) if("input") var/user_input = tgui_input_number(usr, "Set time to valve toggle", "Canister Timer", timer_set, maximum_timer_set, minimum_timer_set) - if(isnull(user_input) || QDELETED(usr) || QDELETED(src) || !usr.canUseTopic(src, be_close = TRUE, no_dexterity = FALSE, no_tk = TRUE)) + if(isnull(user_input) || QDELETED(usr) || QDELETED(src) || !usr.can_perform_action(src, FORBID_TELEKINESIS_REACH)) return timer_set = user_input log_admin("[key_name(usr)] has activated a prototype valve timer") diff --git a/code/modules/atmospherics/machinery/portable/portable_atmospherics.dm b/code/modules/atmospherics/machinery/portable/portable_atmospherics.dm index 8bf607cb698..f71368ae7d8 100644 --- a/code/modules/atmospherics/machinery/portable/portable_atmospherics.dm +++ b/code/modules/atmospherics/machinery/portable/portable_atmospherics.dm @@ -159,7 +159,7 @@ /obj/machinery/portable_atmospherics/AltClick(mob/living/user) . = ..() - if(!istype(user) || !user.canUseTopic(src, be_close = TRUE, no_dexterity = TRUE, no_tk = FALSE, need_hands = !iscyborg(user)) || !can_interact(user)) + if(!istype(user) || !user.can_perform_action(src, NEED_DEXTERITY) || !can_interact(user)) return if(!holding) return diff --git a/code/modules/cards/cardhand.dm b/code/modules/cards/cardhand.dm index 57beb70d354..b03a29a43f4 100644 --- a/code/modules/cards/cardhand.dm +++ b/code/modules/cards/cardhand.dm @@ -44,7 +44,7 @@ return NONE /obj/item/toy/cards/cardhand/attack_self(mob/living/user) - if(!isliving(user) || !user.canUseTopic(src, be_close = TRUE, no_dexterity = TRUE, no_tk = TRUE)) + if(!isliving(user) || !user.can_perform_action(src, NEED_DEXTERITY| FORBID_TELEKINESIS_REACH)) return var/list/handradial = list() diff --git a/code/modules/cards/cards.dm b/code/modules/cards/cards.dm index 81a4d2e1b52..fb84b2d9789 100644 --- a/code/modules/cards/cards.dm +++ b/code/modules/cards/cards.dm @@ -111,7 +111,7 @@ * * obj/item/toy/singlecard/card (optional) - The card drawn from the hand **/ /obj/item/toy/cards/proc/draw(mob/living/user, obj/item/toy/singlecard/card) - if(!isliving(user) || !user.canUseTopic(src, be_close = TRUE, no_dexterity = TRUE, no_tk = TRUE)) + if(!isliving(user) || !user.can_perform_action(src, NEED_DEXTERITY| FORBID_TELEKINESIS_REACH)) return if(count_cards() == 0) diff --git a/code/modules/cards/deck/deck.dm b/code/modules/cards/deck/deck.dm index 0890cce52a4..189d88822ec 100644 --- a/code/modules/cards/deck/deck.dm +++ b/code/modules/cards/deck/deck.dm @@ -143,7 +143,7 @@ other_players = other_players) /obj/item/toy/cards/deck/attack_hand(mob/living/user, list/modifiers, flip_card = FALSE) - if(!ishuman(user) || !user.canUseTopic(src, be_close = TRUE, no_dexterity = TRUE, no_tk = TRUE, need_hands = !iscyborg(user))) + if(!ishuman(user) || !user.can_perform_action(src, NEED_DEXTERITY|FORBID_TELEKINESIS_REACH)) return var/obj/item/toy/singlecard/card = draw(user) @@ -160,7 +160,7 @@ return SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN /obj/item/toy/cards/deck/AltClick(mob/living/user) - if(user.canUseTopic(src, be_close = TRUE, no_dexterity = TRUE, no_tk = TRUE, need_hands = !iscyborg(user))) + if(user.can_perform_action(src, NEED_DEXTERITY|FORBID_TELEKINESIS_REACH)) if(wielded) shuffle_cards(user) else diff --git a/code/modules/cards/singlecard.dm b/code/modules/cards/singlecard.dm index 37524b343e6..56c7ce968e4 100644 --- a/code/modules/cards/singlecard.dm +++ b/code/modules/cards/singlecard.dm @@ -209,7 +209,7 @@ return var/cardtext = stripped_input(user, "What do you wish to write on the card?", "Card Writing", "", 50) - if(!cardtext || !user.canUseTopic(src, be_close = TRUE)) + if(!cardtext || !user.can_perform_action(src)) return cardname = cardtext @@ -230,7 +230,7 @@ attack_self(user) /obj/item/toy/singlecard/attack_self(mob/living/carbon/human/user) - if(!ishuman(user) || !user.canUseTopic(src, be_close = TRUE, no_dexterity = TRUE, no_tk = TRUE, need_hands = !iscyborg(user))) + if(!ishuman(user) || !user.can_perform_action(src, NEED_DEXTERITY|FORBID_TELEKINESIS_REACH)) return Flip() @@ -238,7 +238,7 @@ user.balloon_alert_to_viewers("flips a card") /obj/item/toy/singlecard/AltClick(mob/living/carbon/human/user) - if(user.canUseTopic(src, be_close = TRUE, no_dexterity = TRUE, no_tk = TRUE, need_hands = !iscyborg(user))) + if(user.can_perform_action(src, NEED_DEXTERITY|FORBID_TELEKINESIS_REACH)) transform = turn(transform, 90) // use the simple_rotation component to make this turn with Alt+RMB & Alt+LMB at some point in the future - TimT return ..() diff --git a/code/modules/cargo/supplypod_beacon.dm b/code/modules/cargo/supplypod_beacon.dm index 36fb2717714..60c413ae102 100644 --- a/code/modules/cargo/supplypod_beacon.dm +++ b/code/modules/cargo/supplypod_beacon.dm @@ -80,7 +80,7 @@ to_chat(user, span_notice("[src] linked to [C].")) /obj/item/supplypod_beacon/AltClick(mob/user) - if (!user.canUseTopic(src, !issilicon(user))) + if (!user.can_perform_action(src, ALLOW_SILICON_REACH)) return if (express_console) unlink_console() @@ -93,7 +93,7 @@ var/new_beacon_name = tgui_input_text(user, "What would you like the tag to be?", "Beacon Tag", max_length = MAX_NAME_LEN) if(isnull(new_beacon_name)) return - if(!user.canUseTopic(src, be_close = TRUE)) + if(!user.can_perform_action(src)) return name += " ([tag])" diff --git a/code/modules/cargo/universal_scanner.dm b/code/modules/cargo/universal_scanner.dm index 7321c743b93..7e352aca98f 100644 --- a/code/modules/cargo/universal_scanner.dm +++ b/code/modules/cargo/universal_scanner.dm @@ -117,7 +117,7 @@ to_chat(user, span_warning("You must be holding \the [src] to continue!")) return var/chosen_price = tgui_input_number(user, "Set price", "Price", new_custom_price) - if(!chosen_price || QDELETED(user) || QDELETED(src) || !user.canUseTopic(src, be_close = TRUE, no_dexterity = FALSE, no_tk = TRUE) || loc != user) + if(!chosen_price || QDELETED(user) || QDELETED(src) || !user.can_perform_action(src, FORBID_TELEKINESIS_REACH) || loc != user) return new_custom_price = chosen_price to_chat(user, span_notice("[src] will now give things a [new_custom_price] cr tag.")) diff --git a/code/modules/clothing/head/jobs.dm b/code/modules/clothing/head/jobs.dm index 9f9285a93f0..9958ead4ea5 100644 --- a/code/modules/clothing/head/jobs.dm +++ b/code/modules/clothing/head/jobs.dm @@ -143,7 +143,7 @@ /obj/item/clothing/head/fedora/det_hat/AltClick(mob/user) . = ..() - if(loc != user || !user.canUseTopic(src, be_close = TRUE, no_dexterity = TRUE, no_tk = FALSE, need_hands = TRUE)) + if(loc != user || !user.can_perform_action(src, NEED_DEXTERITY|NEED_HANDS)) return if(candy_cooldown < world.time) var/obj/item/food/candy_corn/CC = new /obj/item/food/candy_corn(src) diff --git a/code/modules/clothing/head/soft_caps.dm b/code/modules/clothing/head/soft_caps.dm index 708b20fc854..5ee036e3e74 100644 --- a/code/modules/clothing/head/soft_caps.dm +++ b/code/modules/clothing/head/soft_caps.dm @@ -25,7 +25,7 @@ /obj/item/clothing/head/soft/AltClick(mob/user) ..() - if(user.canUseTopic(src, be_close = TRUE, no_dexterity = TRUE, no_tk = FALSE, need_hands = !iscyborg(user))) + if(user.can_perform_action(src, NEED_DEXTERITY)) flip(user) diff --git a/code/modules/clothing/head/wig.dm b/code/modules/clothing/head/wig.dm index fa3f3223fde..3e0104c2a46 100644 --- a/code/modules/clothing/head/wig.dm +++ b/code/modules/clothing/head/wig.dm @@ -50,7 +50,7 @@ /obj/item/clothing/head/wig/attack_self(mob/user) var/new_style = tgui_input_list(user, "Select a hairstyle", "Wig Styling", GLOB.hairstyles_list - "Bald") var/newcolor = adjustablecolor ? input(usr,"","Choose Color",color) as color|null : null - if(!user.canUseTopic(src, be_close = TRUE)) + if(!user.can_perform_action(src)) return if(new_style && new_style != hairstyle) hairstyle = new_style diff --git a/code/modules/clothing/masks/breath.dm b/code/modules/clothing/masks/breath.dm index 04c8e4c3a1d..8ba15fe521d 100644 --- a/code/modules/clothing/masks/breath.dm +++ b/code/modules/clothing/masks/breath.dm @@ -25,7 +25,7 @@ /obj/item/clothing/mask/breath/AltClick(mob/user) ..() - if(user.canUseTopic(src, be_close = TRUE, no_dexterity = TRUE, no_tk = FALSE, need_hands = !iscyborg(user))) + if(user.can_perform_action(src, NEED_DEXTERITY)) adjustmask(user) /obj/item/clothing/mask/breath/examine(mob/user) diff --git a/code/modules/clothing/spacesuits/_spacesuits.dm b/code/modules/clothing/spacesuits/_spacesuits.dm index ff05da126a4..46925d99203 100644 --- a/code/modules/clothing/spacesuits/_spacesuits.dm +++ b/code/modules/clothing/spacesuits/_spacesuits.dm @@ -190,13 +190,13 @@ /// Open the cell cover when ALT+Click on the suit /obj/item/clothing/suit/space/AltClick(mob/living/user) - if(!user.canUseTopic(src, be_close = TRUE, no_dexterity = TRUE, no_tk = FALSE, need_hands = !iscyborg(user))) + if(!user.can_perform_action(src, NEED_DEXTERITY)) return ..() toggle_spacesuit_cell(user) /// Remove the cell whent he cover is open on CTRL+Click /obj/item/clothing/suit/space/CtrlClick(mob/living/user) - if(user.canUseTopic(src, be_close = TRUE, no_dexterity = TRUE, no_tk = FALSE, need_hands = !iscyborg(user))) + if(user.can_perform_action(src, NEED_DEXTERITY)) if(cell_cover_open && cell) remove_cell(user) return diff --git a/code/modules/clothing/spacesuits/plasmamen.dm b/code/modules/clothing/spacesuits/plasmamen.dm index d045cae0898..e78878f3eca 100644 --- a/code/modules/clothing/spacesuits/plasmamen.dm +++ b/code/modules/clothing/spacesuits/plasmamen.dm @@ -85,7 +85,7 @@ . += span_notice("There's nothing placed on the helmet.") /obj/item/clothing/head/helmet/space/plasmaman/AltClick(mob/user) - if(user.canUseTopic(src, be_close = TRUE)) + if(user.can_perform_action(src)) toggle_welding_screen(user) /obj/item/clothing/head/helmet/space/plasmaman/ui_action_click(mob/user, action) diff --git a/code/modules/clothing/under/_under.dm b/code/modules/clothing/under/_under.dm index db428a58968..df27303be82 100644 --- a/code/modules/clothing/under/_under.dm +++ b/code/modules/clothing/under/_under.dm @@ -310,7 +310,7 @@ if(.) return - if(!user.canUseTopic(src, be_close = TRUE, no_dexterity = TRUE, no_tk = FALSE, need_hands = !iscyborg(user))) + if(!user.can_perform_action(src, NEED_DEXTERITY)) return if(attached_accessory) remove_accessory(user) diff --git a/code/modules/clothing/under/accessories.dm b/code/modules/clothing/under/accessories.dm index 7ff37f985a0..66c96a14f3a 100755 --- a/code/modules/clothing/under/accessories.dm +++ b/code/modules/clothing/under/accessories.dm @@ -70,7 +70,7 @@ return /obj/item/clothing/accessory/attack_self_secondary(mob/user) - if(user.canUseTopic(src, be_close = TRUE, no_dexterity = TRUE, no_tk = FALSE, need_hands = !iscyborg(user))) + if(user.can_perform_action(src, NEED_DEXTERITY)) above_suit = !above_suit to_chat(user, "[src] will be worn [above_suit ? "above" : "below"] your suit.") return diff --git a/code/modules/detectivework/scanner.dm b/code/modules/detectivework/scanner.dm index b8f59894174..47734b398ab 100644 --- a/code/modules/detectivework/scanner.dm +++ b/code/modules/detectivework/scanner.dm @@ -83,7 +83,7 @@ safe_scan(user, atom_to_scan = A) return . | AFTERATTACK_PROCESSED_ITEM -/** +/** * safe_scan - a wrapper proc for scan() * * calls scan(), and should a runtime occur within we can still reset the 'busy' state @@ -96,7 +96,7 @@ balloon_alert(user, "scanner error!") // but in case it does, we 'error' instead of just bricking the scanner scanner_busy = FALSE -/** +/** * scan - scans an atom for forensic data and outputs it to the mob holding the scanner * * This should always return TRUE barring a runtime @@ -107,7 +107,7 @@ return TRUE scanner_busy = TRUE - + user.visible_message( span_notice("\The [user] points the [src.name] at \the [scanned_atom] and performs a forensic scan."), @@ -220,7 +220,7 @@ /obj/item/detective_scanner/AltClick(mob/living/user) // Best way for checking if a player can use while not incapacitated, etc - if(!user.canUseTopic(src, be_close=TRUE)) + if(!user.can_perform_action(src)) return if(!LAZYLEN(log)) balloon_alert(user, "no logs!") diff --git a/code/modules/economy/holopay.dm b/code/modules/economy/holopay.dm index 728b27c67be..c9ce23ccb98 100644 --- a/code/modules/economy/holopay.dm +++ b/code/modules/economy/holopay.dm @@ -97,7 +97,7 @@ /// Exit sanity checks if(!cash_deposit) return TRUE - if(QDELETED(held_item) || QDELETED(user) || QDELETED(src) || !user.canUseTopic(src, be_close = TRUE, no_dexterity = FALSE, no_tk = TRUE)) + if(QDELETED(held_item) || QDELETED(user) || QDELETED(src) || !user.can_perform_action(src, FORBID_TELEKINESIS_REACH)) return FALSE if(!chip.spend(cash_deposit, FALSE)) balloon_alert(user, "insufficient credits") @@ -267,7 +267,7 @@ /// If the user has enough money, ask them the amount or charge the force fee var/amount = force_fee || tgui_input_number(user, "How much? (Max: [payee.account_balance])", "Patronage", max_value = payee.account_balance) /// Exit checks in case the user cancelled or entered an invalid amount - if(!amount || QDELETED(user) || QDELETED(src) || !user.canUseTopic(src, be_close = TRUE, no_dexterity = FALSE, no_tk = TRUE)) + if(!amount || QDELETED(user) || QDELETED(src) || !user.can_perform_action(src, FORBID_TELEKINESIS_REACH)) return FALSE if(!payee.adjust_money(-amount, "Holopay: [capitalize(name)]")) balloon_alert(user, "insufficient credits") diff --git a/code/modules/events/holiday/vday.dm b/code/modules/events/holiday/vday.dm index 6dd36099b42..f94ab1bd24a 100644 --- a/code/modules/events/holiday/vday.dm +++ b/code/modules/events/holiday/vday.dm @@ -74,7 +74,7 @@ return var/recipient = tgui_input_text(user, "Who is receiving this valentine?", "To:", max_length = MAX_NAME_LEN) var/sender = tgui_input_text(user, "Who is sending this valentine?", "From:", max_length = MAX_NAME_LEN) - if(!user.canUseTopic(src, be_close = TRUE)) + if(!user.can_perform_action(src)) return if(recipient && sender) name = "valentine - To: [recipient] From: [sender]" diff --git a/code/modules/fishing/aquarium/aquarium.dm b/code/modules/fishing/aquarium/aquarium.dm index b4dc4de3124..d2b20830acd 100644 --- a/code/modules/fishing/aquarium/aquarium.dm +++ b/code/modules/fishing/aquarium/aquarium.dm @@ -101,7 +101,7 @@ . += span_notice("Alt-click to [panel_open ? "close" : "open"] the control panel.") /obj/structure/aquarium/AltClick(mob/user) - if(!user.canUseTopic(src, be_close = TRUE)) + if(!user.can_perform_action(src)) return ..() panel_open = !panel_open update_appearance() diff --git a/code/modules/food_and_drinks/machinery/coffeemaker.dm b/code/modules/food_and_drinks/machinery/coffeemaker.dm index f9c673831a8..37d63443c4d 100644 --- a/code/modules/food_and_drinks/machinery/coffeemaker.dm +++ b/code/modules/food_and_drinks/machinery/coffeemaker.dm @@ -126,7 +126,7 @@ . = ..() if(. == SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN) return - if(!can_interact(user) || !user.canUseTopic(src, !issilicon(user), FALSE, no_tk = TRUE)) + if(!can_interact(user) || !user.can_perform_action(src, ALLOW_SILICON_REACH|FORBID_TELEKINESIS_REACH)) return SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN if(brewing) return SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN @@ -291,7 +291,7 @@ /obj/machinery/coffeemaker/ui_interact(mob/user) // The microwave Menu //I am reasonably certain that this is not a microwave //I am positively certain that this is not a microwave . = ..() - if(brewing || !user.canUseTopic(src, !issilicon(user))) + if(brewing || !user.can_perform_action(src, ALLOW_SILICON_REACH)) return var/list/options = list() @@ -331,7 +331,7 @@ choice = show_radial_menu(user, src, options, require_near = !issilicon(user)) // post choice verification - if(brewing || (isAI(user) && machine_stat & NOPOWER) || !user.canUseTopic(src, !issilicon(user))) + if(brewing || (isAI(user) && machine_stat & NOPOWER) || !user.can_perform_action(src, ALLOW_SILICON_REACH)) return switch(choice) diff --git a/code/modules/food_and_drinks/machinery/gibber.dm b/code/modules/food_and_drinks/machinery/gibber.dm index b21580eec72..0b647e16b16 100644 --- a/code/modules/food_and_drinks/machinery/gibber.dm +++ b/code/modules/food_and_drinks/machinery/gibber.dm @@ -131,7 +131,7 @@ set src in oview(1) if (usr.stat != CONSCIOUS || HAS_TRAIT(usr, TRAIT_HANDS_BLOCKED)) return - if(!usr.canUseTopic()) + if(!usr.can_perform_action(src)) return src.go_out() add_fingerprint(usr) diff --git a/code/modules/food_and_drinks/machinery/icecream_vat.dm b/code/modules/food_and_drinks/machinery/icecream_vat.dm index ad699ffdf08..04f73e2ffa7 100644 --- a/code/modules/food_and_drinks/machinery/icecream_vat.dm +++ b/code/modules/food_and_drinks/machinery/icecream_vat.dm @@ -182,7 +182,7 @@ /obj/machinery/icecream_vat/AltClick(mob/living/user) . = ..() - if(!can_interact(user) || !user.canUseTopic(src, be_close = TRUE, no_dexterity = FALSE, no_tk = TRUE)) + if(!can_interact(user) || !user.can_perform_action(src, FORBID_TELEKINESIS_REACH)) return replace_beaker(user) diff --git a/code/modules/food_and_drinks/machinery/microwave.dm b/code/modules/food_and_drinks/machinery/microwave.dm index 4fc6610a6a9..5c59a64932e 100644 --- a/code/modules/food_and_drinks/machinery/microwave.dm +++ b/code/modules/food_and_drinks/machinery/microwave.dm @@ -324,7 +324,7 @@ return ..() /obj/machinery/microwave/attack_hand_secondary(mob/user, list/modifiers) - if(user.canUseTopic(src, !issilicon(usr))) + if(user.can_perform_action(src, ALLOW_SILICON_REACH)) if(!length(ingredients)) balloon_alert(user, "it's empty!") return SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN @@ -334,7 +334,7 @@ /obj/machinery/microwave/ui_interact(mob/user) . = ..() - if(operating || panel_open || !anchored || !user.canUseTopic(src, !issilicon(user))) + if(operating || panel_open || !anchored || !user.can_perform_action(src, ALLOW_SILICON_REACH)) return if(isAI(user) && (machine_stat & NOPOWER)) return @@ -349,7 +349,7 @@ var/choice = show_radial_menu(user, src, isAI(user) ? ai_radial_options : radial_options, require_near = !issilicon(user)) // post choice verification - if(operating || panel_open || !anchored || !user.canUseTopic(src, !issilicon(user))) + if(operating || panel_open || !anchored || !user.can_perform_action(src, ALLOW_SILICON_REACH)) return if(isAI(user) && (machine_stat & NOPOWER)) return diff --git a/code/modules/food_and_drinks/machinery/processor.dm b/code/modules/food_and_drinks/machinery/processor.dm index 5a230735e72..36738ba03a7 100644 --- a/code/modules/food_and_drinks/machinery/processor.dm +++ b/code/modules/food_and_drinks/machinery/processor.dm @@ -170,7 +170,7 @@ set src in oview(1) if(usr.stat != CONSCIOUS || HAS_TRAIT(usr, TRAIT_HANDS_BLOCKED)) return - if (!usr.canUseTopic()) + if(!usr.can_perform_action(src)) return if(isliving(usr)) var/mob/living/L = usr diff --git a/code/modules/food_and_drinks/machinery/smartfridge.dm b/code/modules/food_and_drinks/machinery/smartfridge.dm index dbf3f346d40..1d7ed908b15 100644 --- a/code/modules/food_and_drinks/machinery/smartfridge.dm +++ b/code/modules/food_and_drinks/machinery/smartfridge.dm @@ -219,7 +219,7 @@ if(!desired) return FALSE - if(QDELETED(src) || QDELETED(usr) || !usr.canUseTopic(src, be_close = TRUE, no_dexterity = FALSE, no_tk = TRUE)) // Sanity checkin' in case stupid stuff happens while we wait for input() + if(QDELETED(src) || QDELETED(usr) || !usr.can_perform_action(src, FORBID_TELEKINESIS_REACH)) // Sanity checkin' in case stupid stuff happens while we wait for input() return FALSE for(var/obj/item/dispensed_item in src) diff --git a/code/modules/food_and_drinks/pizzabox.dm b/code/modules/food_and_drinks/pizzabox.dm index cebc9bbd75e..d56647abd49 100644 --- a/code/modules/food_and_drinks/pizzabox.dm +++ b/code/modules/food_and_drinks/pizzabox.dm @@ -156,7 +156,7 @@ return else bomb_timer = tgui_input_number(user, "Set the bomb timer", "Pizza Bomb", bomb_timer, bomb_timer_max, bomb_timer_min) - if(!bomb_timer || QDELETED(user) || QDELETED(src) || !usr.canUseTopic(src, be_close = TRUE, no_dexterity = FALSE, no_tk = TRUE)) + if(!bomb_timer || QDELETED(user) || QDELETED(src) || !usr.can_perform_action(src, FORBID_TELEKINESIS_REACH)) return bomb_defused = FALSE log_bomber(user, "has trapped a", src, "with [bomb] set to [bomb_timer] seconds") @@ -221,7 +221,7 @@ return var/obj/item/pizzabox/box = length(boxes) ? boxes[length(boxes)] : src box.boxtag += tgui_input_text(user, "Write on [box]'s tag:", box, max_length = 30) - if(!user.canUseTopic(src, be_close = TRUE)) + if(!user.can_perform_action(src)) return balloon_alert(user, "writing box tag...") boxtag_set = TRUE diff --git a/code/modules/hydroponics/beekeeping/beebox.dm b/code/modules/hydroponics/beekeeping/beebox.dm index 207069b0535..06bfa5fa837 100644 --- a/code/modules/hydroponics/beekeeping/beebox.dm +++ b/code/modules/hydroponics/beekeeping/beebox.dm @@ -213,7 +213,7 @@ visible_message(span_danger("[user] disturbs the [name] to no effect!")) else var/option = tgui_alert(user, "Which piece do you wish to remove?", "Apiary Adjustment", list("Honey Frame", "Queen Bee")) - if(!option || QDELETED(user) || QDELETED(src) || !user.canUseTopic(src, be_close = TRUE, no_dexterity = FALSE)) + if(!option || QDELETED(user) || QDELETED(src) || !user.can_perform_action(src, NEED_DEXTERITY)) return switch(option) if("Honey Frame") diff --git a/code/modules/hydroponics/biogenerator.dm b/code/modules/hydroponics/biogenerator.dm index 3c9b76764b3..4462f617b31 100644 --- a/code/modules/hydroponics/biogenerator.dm +++ b/code/modules/hydroponics/biogenerator.dm @@ -222,7 +222,7 @@ /obj/machinery/biogenerator/AltClick(mob/living/user) . = ..() - if(user.canUseTopic(src, be_close = TRUE, no_dexterity = FALSE, no_tk = TRUE) && can_interact(user)) + if(user.can_perform_action(src, FORBID_TELEKINESIS_REACH) && can_interact(user)) eject_beaker(user) diff --git a/code/modules/hydroponics/grown/replicapod.dm b/code/modules/hydroponics/grown/replicapod.dm index c8736d769f7..cb4f62c87f1 100644 --- a/code/modules/hydroponics/grown/replicapod.dm +++ b/code/modules/hydroponics/grown/replicapod.dm @@ -165,7 +165,7 @@ return result // Make sure they can still interact with the parent hydroponics tray. - if(!user.canUseTopic(parent, be_close = TRUE)) + if(!user.can_perform_action(parent)) to_chat(user, text = "You are no longer able to harvest the seeds from [parent]!", type = MESSAGE_TYPE_INFO) return result diff --git a/code/modules/hydroponics/hydroponics.dm b/code/modules/hydroponics/hydroponics.dm index 1d57e95fe8f..23f45668715 100644 --- a/code/modules/hydroponics/hydroponics.dm +++ b/code/modules/hydroponics/hydroponics.dm @@ -941,7 +941,7 @@ var/removed_trait = tgui_input_list(user, "Trait to remove from the [myseed.plantname]", "Plant Trait Removal", sort_list(current_traits)) if(isnull(removed_trait)) return - if(!user.canUseTopic(src, be_close = TRUE)) + if(!user.can_perform_action(src)) return if(!myseed) return @@ -1021,7 +1021,7 @@ return if(isnull(fresh_mut_list[locked_mutation])) return - if(!user.canUseTopic(src, be_close = TRUE)) + if(!user.can_perform_action(src)) return myseed.mutatelist = list(fresh_mut_list[locked_mutation]) myseed.set_endurance(myseed.endurance/2) @@ -1064,7 +1064,7 @@ /obj/machinery/hydroponics/CtrlClick(mob/user) . = ..() - if(!user.canUseTopic(src, be_close = TRUE, no_dexterity = FALSE, no_tk = TRUE)) + if(!user.can_perform_action(src, FORBID_TELEKINESIS_REACH)) return if(!powered()) to_chat(user, span_warning("[name] has no power.")) @@ -1085,7 +1085,7 @@ if(!anchored) return SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN var/warning = tgui_alert(user, "Are you sure you wish to empty the tray's nutrient beaker?","Empty Tray Nutrients?", list("Yes", "No")) - if(warning == "Yes" && user.canUseTopic(src, be_close = TRUE, no_dexterity = FALSE, no_tk = TRUE)) + if(warning == "Yes" && user.can_perform_action(src, FORBID_TELEKINESIS_REACH)) reagents.clear_reagents() to_chat(user, span_warning("You empty [src]'s nutrient tank.")) return SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN diff --git a/code/modules/hydroponics/seeds.dm b/code/modules/hydroponics/seeds.dm index 345868f7567..045134f2771 100644 --- a/code/modules/hydroponics/seeds.dm +++ b/code/modules/hydroponics/seeds.dm @@ -456,14 +456,14 @@ var/choice = tgui_input_list(usr, "What would you like to change?", "Seed Alteration", list("Plant Name", "Seed Description", "Product Description")) if(isnull(choice)) return - if(!user.canUseTopic(src, be_close = TRUE)) + if(!user.can_perform_action(src)) return switch(choice) if("Plant Name") var/newplantname = reject_bad_text(tgui_input_text(user, "Write a new plant name", "Plant Name", plantname, 20)) if(isnull(newplantname)) return - if(!user.canUseTopic(src, be_close = TRUE)) + if(!user.can_perform_action(src)) return name = "[lowertext(newplantname)]" plantname = newplantname @@ -471,7 +471,7 @@ var/newdesc = tgui_input_text(user, "Write a new seed description", "Seed Description", desc, 180) if(isnull(newdesc)) return - if(!user.canUseTopic(src, be_close = TRUE)) + if(!user.can_perform_action(src)) return desc = newdesc if("Product Description") @@ -480,7 +480,7 @@ var/newproductdesc = tgui_input_text(user, "Write a new product description", "Product Description", productdesc, 180) if(isnull(newproductdesc)) return - if(!user.canUseTopic(src, be_close = TRUE)) + if(!user.can_perform_action(src)) return productdesc = newproductdesc diff --git a/code/modules/instruments/songs/editor.dm b/code/modules/instruments/songs/editor.dm index 527341f49dc..6f4bdc06004 100644 --- a/code/modules/instruments/songs/editor.dm +++ b/code/modules/instruments/songs/editor.dm @@ -115,7 +115,7 @@ updateDialog(usr) // make sure updates when complete /datum/song/Topic(href, href_list) - if(!usr.canUseTopic(parent, be_close = TRUE, no_dexterity = FALSE, no_tk = FALSE, need_hands = FALSE, floor_okay = TRUE)) + if(!usr.can_perform_action(parent, ALLOW_RESTING)) usr << browse(null, "window=instrument") usr.unset_machine() return diff --git a/code/modules/instruments/stationary.dm b/code/modules/instruments/stationary.dm index a1cc70dace2..c5c7b97e738 100644 --- a/code/modules/instruments/stationary.dm +++ b/code/modules/instruments/stationary.dm @@ -20,7 +20,9 @@ if(!(anchored || can_play_unanchored) || !ismob(music_player)) return STOP_PLAYING var/mob/user = music_player - if(!user.canUseTopic(src, FALSE, TRUE, FALSE, FALSE)) //can play with TK and while resting because fun. + + if(!ISADVANCEDTOOLUSER(user)) + to_chat(src, span_warning("You don't have the dexterity to do this!")) return STOP_PLAYING /obj/structure/musician/ui_interact(mob/user) diff --git a/code/modules/library/book.dm b/code/modules/library/book.dm index 22358fe20e4..23a5ecd4656 100644 --- a/code/modules/library/book.dm +++ b/code/modules/library/book.dm @@ -141,7 +141,7 @@ /obj/item/book/attackby(obj/item/I, mob/user, params) if(istype(I, /obj/item/pen)) - if(!user.canUseTopic(src, be_close = TRUE) || !user.can_write(I)) + if(!user.can_perform_action(src) || !user.can_write(I)) return if(user.is_blind()) to_chat(user, span_warning("As you are trying to write on the book, you suddenly feel very stupid!")) @@ -153,12 +153,12 @@ var/choice = tgui_input_list(usr, "What would you like to change?", "Book Alteration", list("Title", "Contents", "Author", "Cancel")) if(isnull(choice)) return - if(!user.canUseTopic(src, be_close = TRUE) || !user.can_write(I)) + if(!user.can_perform_action(src) || !user.can_write(I)) return switch(choice) if("Title") var/newtitle = reject_bad_text(tgui_input_text(user, "Write a new title", "Book Title", max_length = 30)) - if(!user.canUseTopic(src, be_close = TRUE) || !user.can_write(I)) + if(!user.can_perform_action(src) || !user.can_write(I)) return if (length_char(newtitle) > 30) to_chat(user, span_warning("That title won't fit on the cover!")) @@ -170,7 +170,7 @@ book_data.set_title(html_decode(newtitle)) //Don't want to double encode here if("Contents") var/content = tgui_input_text(user, "Write your book's contents (HTML NOT allowed)", "Book Contents", multiline = TRUE) - if(!user.canUseTopic(src, be_close = TRUE) || !user.can_write(I)) + if(!user.can_perform_action(src) || !user.can_write(I)) return if(!content) to_chat(user, span_warning("The content is invalid.")) @@ -178,7 +178,7 @@ book_data.set_content(html_decode(content)) if("Author") var/author = tgui_input_text(user, "Write the author's name", "Author Name") - if(!user.canUseTopic(src, be_close = TRUE) || !user.can_write(I)) + if(!user.can_perform_action(src) || !user.can_write(I)) return if(!author) to_chat(user, span_warning("The name is invalid.")) diff --git a/code/modules/library/bookcase.dm b/code/modules/library/bookcase.dm index 897d88cc19b..3eb9c5de2cb 100644 --- a/code/modules/library/bookcase.dm +++ b/code/modules/library/bookcase.dm @@ -126,10 +126,10 @@ to_chat(user, span_notice("You empty \the [I] into \the [src].")) update_appearance() else if(istype(I, /obj/item/pen)) - if(!user.canUseTopic(src, be_close = TRUE) || !user.can_write(I)) + if(!user.can_perform_action(src) || !user.can_write(I)) return var/newname = tgui_input_text(user, "What would you like to title this bookshelf?", "Bookshelf Renaming", max_length = MAX_NAME_LEN) - if(!user.canUseTopic(src, be_close = TRUE) || !user.can_write(I)) + if(!user.can_perform_action(src) || !user.can_write(I)) return if(!newname) return diff --git a/code/modules/mining/abandoned_crates.dm b/code/modules/mining/abandoned_crates.dm index 922d03043bb..99ed31e5c40 100644 --- a/code/modules/mining/abandoned_crates.dm +++ b/code/modules/mining/abandoned_crates.dm @@ -30,7 +30,7 @@ if(locked) to_chat(user, span_notice("The crate is locked with a Deca-code lock.")) var/input = input(usr, "Enter [codelen] digits. All digits must be unique.", "Deca-Code Lock", "") as text|null - if(user.canUseTopic(src, be_close = TRUE) && locked) + if(user.can_perform_action(src) && locked) var/list/sanitised = list() var/sanitycheck = TRUE var/char = "" @@ -60,7 +60,7 @@ return ..() /obj/structure/closet/crate/secure/loot/AltClick(mob/living/user) - if(!user.canUseTopic(src, be_close = TRUE)) + if(!user.can_perform_action(src)) return return attack_hand(user) //this helps you not blow up so easily by overriding unlocking which results in an immediate boom. diff --git a/code/modules/mining/equipment/marker_beacons.dm b/code/modules/mining/equipment/marker_beacons.dm index c359069d783..42c06e775a7 100644 --- a/code/modules/mining/equipment/marker_beacons.dm +++ b/code/modules/mining/equipment/marker_beacons.dm @@ -60,12 +60,12 @@ GLOBAL_LIST_INIT(marker_beacon_colors, sort_list(list( transfer_fingerprints_to(M) /obj/item/stack/marker_beacon/AltClick(mob/living/user) - if(!istype(user) || !user.canUseTopic(src, be_close = TRUE)) + if(!istype(user) || !user.can_perform_action(src)) return var/input_color = tgui_input_list(user, "Choose a color", "Beacon Color", GLOB.marker_beacon_colors) if(isnull(input_color)) return - if(!istype(user) || !user.canUseTopic(src, be_close = TRUE)) + if(!istype(user) || !user.can_perform_action(src)) return picked_color = input_color update_appearance() @@ -158,12 +158,12 @@ GLOBAL_LIST_INIT(marker_beacon_colors, sort_list(list( /obj/structure/marker_beacon/AltClick(mob/living/user) ..() - if(!istype(user) || !user.canUseTopic(src, be_close = TRUE)) + if(!istype(user) || !user.can_perform_action(src)) return var/input_color = tgui_input_list(user, "Choose a color", "Beacon Color", GLOB.marker_beacon_colors) if(isnull(input_color)) return - if(!istype(user) || !user.canUseTopic(src, be_close = TRUE)) + if(!istype(user) || !user.can_perform_action(src)) return picked_color = input_color update_appearance() diff --git a/code/modules/mining/equipment/monster_organs/monster_organ.dm b/code/modules/mining/equipment/monster_organs/monster_organ.dm index 7e664f3f789..931dc7a73b6 100644 --- a/code/modules/mining/equipment/monster_organs/monster_organ.dm +++ b/code/modules/mining/equipment/monster_organs/monster_organ.dm @@ -143,7 +143,7 @@ return . | AFTERATTACK_PROCESSED_ITEM /obj/item/organ/internal/monster_core/attack_self(mob/user) - if (!user.canUseTopic(src, be_close = TRUE, no_dexterity = FALSE, no_tk = TRUE)) + if (!user.can_perform_action(src, FORBID_TELEKINESIS_REACH)) return try_apply(user, user) diff --git a/code/modules/mining/machine_redemption.dm b/code/modules/mining/machine_redemption.dm index bdebef1b6ce..7be6cd41211 100644 --- a/code/modules/mining/machine_redemption.dm +++ b/code/modules/mining/machine_redemption.dm @@ -193,7 +193,7 @@ /obj/machinery/mineral/ore_redemption/AltClick(mob/living/user) . = ..() - if(!user.canUseTopic(src, be_close = TRUE)) + if(!user.can_perform_action(src)) return if(panel_open) input_dir = turn(input_dir, -90) diff --git a/code/modules/mob/dead/observer/observer.dm b/code/modules/mob/dead/observer/observer.dm index ff39a162673..c426f45157e 100644 --- a/code/modules/mob/dead/observer/observer.dm +++ b/code/modules/mob/dead/observer/observer.dm @@ -838,7 +838,7 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp update_appearance() -/mob/dead/observer/canUseTopic(atom/movable/M, be_close=FALSE, no_dexterity=FALSE, no_tk=FALSE, need_hands = FALSE, floor_okay=FALSE) +/mob/dead/observer/can_perform_action(atom/movable/target, action_bitflags) return isAdminGhostAI(usr) /mob/dead/observer/is_literate() diff --git a/code/modules/mob/living/brain/posibrain.dm b/code/modules/mob/living/brain/posibrain.dm index 6d08cf55692..aed1fcf7ece 100644 --- a/code/modules/mob/living/brain/posibrain.dm +++ b/code/modules/mob/living/brain/posibrain.dm @@ -73,12 +73,12 @@ GLOBAL_VAR(posibrain_notify_cooldown) addtimer(CALLBACK(src, PROC_REF(check_success)), ask_delay) /obj/item/mmi/posibrain/AltClick(mob/living/user) - if(!istype(user) || !user.canUseTopic(src, be_close = TRUE)) + if(!istype(user) || !user.can_perform_action(src)) return var/input_seed = tgui_input_text(user, "Enter a personality seed", "Enter seed", ask_role, MAX_NAME_LEN) if(isnull(input_seed)) return - if(!istype(user) || !user.canUseTopic(src, be_close = TRUE)) + if(!istype(user) || !user.can_perform_action(src)) return to_chat(user, span_notice("You set the personality seed to \"[input_seed]\".")) ask_role = input_seed diff --git a/code/modules/mob/living/carbon/carbon.dm b/code/modules/mob/living/carbon/carbon.dm index a4921afad6d..3edd599b8e8 100644 --- a/code/modules/mob/living/carbon/carbon.dm +++ b/code/modules/mob/living/carbon/carbon.dm @@ -214,7 +214,7 @@ /mob/living/carbon/Topic(href, href_list) ..() - if(href_list["embedded_object"] && usr.canUseTopic(src, be_close = TRUE, no_dexterity = TRUE)) + if(href_list["embedded_object"] && usr.can_perform_action(src, NEED_DEXTERITY)) var/obj/item/bodypart/L = locate(href_list["embedded_limb"]) in bodyparts if(!L) return diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm index 172efdca851..4b76dcce43b 100644 --- a/code/modules/mob/living/living.dm +++ b/code/modules/mob/living/living.dm @@ -1202,24 +1202,54 @@ /mob/living/can_hold_items(obj/item/I) return usable_hands && ..() -/mob/living/canUseTopic(atom/movable/M, be_close=FALSE, no_dexterity=FALSE, no_tk=FALSE, need_hands = FALSE, floor_okay=FALSE) - if(!(mobility_flags & MOBILITY_UI) && !floor_okay) +/mob/living/can_perform_action(atom/movable/target, action_bitflags) + if(!istype(target)) + CRASH("Missing target arg for can_perform_action") + + // If the MOBILITY_UI bitflag is not set it indicates the mob's hands are cutoff, blocked, or handcuffed + // Note - AI's and borgs have the MOBILITY_UI bitflag set even though they don't have hands + // Also if it is not set, the mob could be incapcitated, knocked out, unconscious, asleep, EMP'd, etc. + if(!(mobility_flags & MOBILITY_UI) && !(action_bitflags & ALLOW_RESTING)) to_chat(src, span_warning("You can't do that right now!")) return FALSE - if(be_close && !Adjacent(M) && (M.loc != src)) - if(no_tk) - to_chat(src, span_warning("You are too far away!")) + + // NEED_HANDS is already checked by MOBILITY_UI for humans so this is for silicons + if((action_bitflags & NEED_HANDS)) + if(!can_hold_items(isitem(target) ? target : null)) // almost redundant if it weren't for mobs + to_chat(src, span_warning("You don't have the physical ability to do this!")) return FALSE - var/datum/dna/D = has_dna() - if(!D || !D.check_mutation(/datum/mutation/human/telekinesis) || !tkMaxRangeCheck(src, M)) - to_chat(src, span_warning("You are too far away!")) - return FALSE - if(need_hands && !can_hold_items(isitem(M) ? M : null)) //almost redundant if it weren't for mobs, - to_chat(src, span_warning("You don't have the physical ability to do this!")) - return FALSE - if(!no_dexterity && !ISADVANCEDTOOLUSER(src)) + + if(!Adjacent(target) && (target.loc != src)) + if(issilicon(src) && !ispAI(src)) + if(!(action_bitflags & ALLOW_SILICON_REACH)) // silicons can ignore range checks (except pAIs) + to_chat(src, span_warning("You are too far away!")) + return FALSE + else // just a normal carbon mob + if((action_bitflags & FORBID_TELEKINESIS_REACH)) + to_chat(src, span_warning("You are too far away!")) + return FALSE + + var/datum/dna/mob_DNA = has_dna() + if(!mob_DNA || !mob_DNA.check_mutation(/datum/mutation/human/telekinesis) || !tkMaxRangeCheck(src, target)) + to_chat(src, span_warning("You are too far away!")) + return FALSE + + if((action_bitflags & NEED_DEXTERITY) && !ISADVANCEDTOOLUSER(src)) to_chat(src, span_warning("You don't have the dexterity to do this!")) return FALSE + + if((action_bitflags & NEED_LITERACY) && !is_literate()) + to_chat(src, span_warning("You can't comprehend any of this!")) + return FALSE + + if((action_bitflags & NEED_LIGHT) && !has_light_nearby() && !has_nightvision()) + to_chat(src, span_warning("You need more light to do this!")) + return FALSE + + if((action_bitflags & NEED_GRAVITY) && !has_gravity()) + to_chat(src, span_warning("You need gravity to do this!")) + return FALSE + return TRUE /mob/living/proc/can_use_guns(obj/item/G)//actually used for more than guns! diff --git a/code/modules/mob/living/silicon/ai/ai.dm b/code/modules/mob/living/silicon/ai/ai.dm index f284cdf790f..17de45146cf 100644 --- a/code/modules/mob/living/silicon/ai/ai.dm +++ b/code/modules/mob/living/silicon/ai/ai.dm @@ -848,11 +848,11 @@ to_chat(src, "You have been downloaded to a mobile storage device. Remote device connection severed.") to_chat(user, "[span_boldnotice("Transfer successful")]: [name] ([rand(1000,9999)].exe) removed from host terminal and stored within local memory.") -/mob/living/silicon/ai/canUseTopic(atom/movable/M, be_close=FALSE, no_dexterity=FALSE, no_tk=FALSE, need_hands = FALSE, floor_okay=FALSE) +/mob/living/silicon/ai/can_perform_action(atom/movable/target, action_bitflags) if(control_disabled) to_chat(src, span_warning("You can't do that right now!")) return FALSE - return can_see(M) && ..() //stop AIs from leaving windows open and using then after they lose vision + return can_see(target) && ..() //stop AIs from leaving windows open and using then after they lose vision /mob/living/silicon/ai/proc/can_see(atom/A) if(isturf(loc)) //AI in core, check if on cameras diff --git a/code/modules/mob/living/silicon/robot/robot.dm b/code/modules/mob/living/silicon/robot/robot.dm index ce699a93542..f2e93635534 100644 --- a/code/modules/mob/living/silicon/robot/robot.dm +++ b/code/modules/mob/living/silicon/robot/robot.dm @@ -584,7 +584,7 @@ if(AI_NOTIFICATION_CYBORG_DISCONNECTED) //Tampering with the wires to_chat(connected_ai, "

[span_notice("NOTICE - Remote telemetry lost with [name].")]
") -/mob/living/silicon/robot/canUseTopic(atom/movable/M, be_close=FALSE, no_dexterity=FALSE, no_tk=FALSE, need_hands = FALSE, floor_okay=FALSE) +/mob/living/silicon/robot/can_perform_action(atom/movable/target, action_bitflags) if(lockcharge || low_power_mode) to_chat(src, span_warning("You can't do that right now!")) return FALSE diff --git a/code/modules/mob/living/simple_animal/bot/bot.dm b/code/modules/mob/living/simple_animal/bot/bot.dm index f8b80f56036..cf0aba4a384 100644 --- a/code/modules/mob/living/simple_animal/bot/bot.dm +++ b/code/modules/mob/living/simple_animal/bot/bot.dm @@ -350,7 +350,7 @@ . = ..() if(!can_interact(user)) return - if(!user.canUseTopic(src, !issilicon(user))) + if(!user.can_perform_action(src, ALLOW_SILICON_REACH)) return unlock_with_id(user) @@ -946,7 +946,7 @@ Pass a positive integer as an argument to override a bot's default speed. return ..() /mob/living/simple_animal/bot/proc/topic_denied(mob/user) //Access check proc for bot topics! Remember to place in a bot's individual Topic if desired. - if(!user.canUseTopic(src, !issilicon(user))) + if(!user.can_perform_action(src, ALLOW_SILICON_REACH)) return TRUE // 0 for access, 1 for denied. if(bot_cover_flags & BOT_COVER_EMAGGED) //An emagged bot cannot be controlled by humans, silicons can if one hacked it. diff --git a/code/modules/mob/living/simple_animal/revenant.dm b/code/modules/mob/living/simple_animal/revenant.dm index 3c0ccc491c2..5aa5de7401b 100644 --- a/code/modules/mob/living/simple_animal/revenant.dm +++ b/code/modules/mob/living/simple_animal/revenant.dm @@ -99,7 +99,7 @@ RegisterSignal(src, COMSIG_LIVING_BANED, PROC_REF(on_baned)) random_revenant_name() -/mob/living/simple_animal/revenant/canUseTopic(atom/movable/M, be_close=FALSE, no_dexterity=FALSE, no_tk=FALSE, need_hands = FALSE, floor_okay=FALSE) +/mob/living/simple_animal/revenant/can_perform_action(atom/movable/target, action_bitflags) return FALSE /mob/living/simple_animal/revenant/proc/random_revenant_name() diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index 713990af438..39b99594131 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -995,16 +995,24 @@ return ISINRANGE(their_turf.x, our_turf.x - interaction_range, our_turf.x + interaction_range) && ISINRANGE(their_turf.y, our_turf.y - interaction_range, our_turf.y + interaction_range) /** - * Whether the mob can use Topic to interact with machines + * Checks whether a mob can perform an action to interact with an object * - * Args: - * be_close - Whether you need to be next to/on top of M - * no_dexterity - Whether you need to be an ADVANCEDTOOLUSER - * no_tk - If be_close is TRUE, this will block Telekinesis from bypassing the requirement - * need_hands - Whether you need hands to use this - * floor_okay - Whether mobility flags should be checked for MOBILITY_UI to use. - */ -/mob/proc/canUseTopic(atom/movable/M, be_close=FALSE, no_dexterity=FALSE, no_tk=FALSE, need_hands = FALSE, floor_okay=FALSE) + * The default behavior checks if the mob is: + * * Directly adjacent (1-tile radius) + * * Standing up (not resting) + * * Allows telekinesis to be used to skip adjacent checks (if they have DNA mutation) + * * + * action_bitflags: (see code/__DEFINES/mobs.dm) + * * NEED_GRAVITY - If gravity must be present to perform action (can't use pens without gravity) + * * NEED_LITERACY - If reading is required to perform action (can't read a book if you are illiterate) + * * NEED_LIGHT - If lighting must be present to perform action (can't heal someone in the dark) + * * NEED_DEXTERITY - If other mobs (monkeys, aliens, etc) can perform action (can't use computers if you are a monkey) + * * NEED_HANDS - If hands are required to perform action (can't pickup items if you are a cyborg) + * * FORBID_TELEKINESIS_REACH - If telekinesis is forbidden to perform action from a distance (ex. canisters are blacklisted from telekinesis manipulation) + * * ALLOW_SILICON_REACH - If silicons are allowed to perform action from a distance (silicons can operate airlocks from far away) + * * ALLOW_RESTING - If resting on the floor is allowed to perform action () +**/ +/mob/proc/can_perform_action(atom/movable/target, action_bitflags) return ///Can this mob use storage diff --git a/code/modules/modular_computers/computers/item/computer.dm b/code/modules/modular_computers/computers/item/computer.dm index 996cc9a1a9a..47e8cfff55d 100644 --- a/code/modules/modular_computers/computers/item/computer.dm +++ b/code/modules/modular_computers/computers/item/computer.dm @@ -199,7 +199,7 @@ GLOBAL_LIST_EMPTY(TabletMessengers) // a list of all active messengers, similar . = ..() if(issilicon(user)) return FALSE - if(!user.canUseTopic(src, be_close = TRUE)) + if(!user.can_perform_action(src)) return FALSE if(RemoveID(user)) @@ -300,7 +300,7 @@ GLOBAL_LIST_EMPTY(TabletMessengers) // a list of all active messengers, similar /obj/item/modular_computer/MouseDrop(obj/over_object, src_location, over_location) var/mob/M = usr - if((!istype(over_object, /atom/movable/screen)) && usr.canUseTopic(src, be_close = TRUE)) + if((!istype(over_object, /atom/movable/screen)) && usr.can_perform_action(src)) return attack_self(M) return ..() diff --git a/code/modules/modular_computers/computers/item/disks/virus_disk.dm b/code/modules/modular_computers/computers/item/disks/virus_disk.dm index 7a38f1dc8e1..f6e643cdc8d 100644 --- a/code/modules/modular_computers/computers/item/disks/virus_disk.dm +++ b/code/modules/modular_computers/computers/item/disks/virus_disk.dm @@ -77,10 +77,10 @@ var/original_host = source var/fakename = sanitize_name(tgui_input_text(user, "Enter a name for the rigged message.", "Forge Message", max_length = MAX_NAME_LEN), allow_numbers = TRUE) - if(!fakename || source != original_host || !user.canUseTopic(source, be_close = TRUE)) + if(!fakename || source != original_host || !user.can_perform_action(source)) return var/fakejob = sanitize_name(tgui_input_text(user, "Enter a job for the rigged message.", "Forge Message", max_length = MAX_NAME_LEN), allow_numbers = TRUE) - if(!fakejob || source != original_host || !user.canUseTopic(source, be_close = TRUE)) + if(!fakejob || source != original_host || !user.can_perform_action(source)) return var/datum/computer_file/program/messenger/app = locate() in source.stored_files diff --git a/code/modules/modular_computers/computers/item/laptop.dm b/code/modules/modular_computers/computers/item/laptop.dm index faa4c24638f..bd4bd8e60f9 100644 --- a/code/modules/modular_computers/computers/item/laptop.dm +++ b/code/modules/modular_computers/computers/item/laptop.dm @@ -84,7 +84,7 @@ return if(!isturf(loc) && !ismob(loc)) // No opening it in backpack. return - if(!user.canUseTopic(src, be_close = TRUE)) + if(!user.can_perform_action(src)) return toggle_open(user) diff --git a/code/modules/modular_computers/computers/item/pda.dm b/code/modules/modular_computers/computers/item/pda.dm index c4308589d1f..56cf9c0adb7 100644 --- a/code/modules/modular_computers/computers/item/pda.dm +++ b/code/modules/modular_computers/computers/item/pda.dm @@ -179,7 +179,7 @@ /obj/item/modular_computer/pda/proc/remove_pen(mob/user) - if(issilicon(user) || !user.canUseTopic(src, be_close = TRUE, no_dexterity = FALSE, no_tk = TRUE)) //TK doesn't work even with this removed but here for readability + if(issilicon(user) || !user.can_perform_action(src, FORBID_TELEKINESIS_REACH)) //TK doesn't work even with this removed but here for readability return if(inserted_item) diff --git a/code/modules/modular_computers/file_system/programs/ntmessenger.dm b/code/modules/modular_computers/file_system/programs/ntmessenger.dm index 5084515a1e4..aa0932f0766 100644 --- a/code/modules/modular_computers/file_system/programs/ntmessenger.dm +++ b/code/modules/modular_computers/file_system/programs/ntmessenger.dm @@ -237,7 +237,7 @@ if (!input_message || !sending_and_receiving) return - if(!user.canUseTopic(computer, be_close = TRUE)) + if(!user.can_perform_action(computer)) return return sanitize(input_message) @@ -400,7 +400,7 @@ if(computer.active_program != src) if(!computer.open_program(usr, src)) return - if(!href_list["close"] && usr.canUseTopic(computer, be_close = TRUE, no_dexterity = FALSE, no_tk = TRUE)) + if(!href_list["close"] && usr.can_perform_action(computer, FORBID_TELEKINESIS_REACH)) switch(href_list["choice"]) if("Message") send_message(usr, list(locate(href_list["target"]))) diff --git a/code/modules/pai/pai.dm b/code/modules/pai/pai.dm index 6e9fb46e32b..5e74669f5aa 100644 --- a/code/modules/pai/pai.dm +++ b/code/modules/pai/pai.dm @@ -146,9 +146,10 @@ return ..() // See software.dm for Topic() -/mob/living/silicon/pai/canUseTopic(atom/movable/movable, be_close = FALSE, no_dexterity = FALSE, no_tk = FALSE, need_hands = FALSE, floor_okay = FALSE) - // Resting is just an aesthetic feature for them. - return ..(movable, be_close, no_dexterity, no_tk, need_hands, TRUE) +/mob/living/silicon/pai/can_perform_action(atom/movable/target, action_bitflags) + action_bitflags |= ALLOW_RESTING // Resting is just an aesthetic feature for them + action_bitflags &= ~ALLOW_SILICON_REACH // They don't get long reach like the rest of silicons + return ..(target, action_bitflags) /mob/living/silicon/pai/Destroy() QDEL_NULL(atmos_analyzer) diff --git a/code/modules/paperwork/folders.dm b/code/modules/paperwork/folders.dm index 0d2e2ce8367..da685b5fac9 100644 --- a/code/modules/paperwork/folders.dm +++ b/code/modules/paperwork/folders.dm @@ -45,7 +45,7 @@ if(!inputvalue) return - if(user.canUseTopic(src, be_close = TRUE)) + if(user.can_perform_action(src)) name = "folder[(inputvalue ? " - '[inputvalue]'" : null)]" /obj/item/folder/proc/remove_item(obj/item/Item, mob/user) diff --git a/code/modules/paperwork/paperplane.dm b/code/modules/paperwork/paperplane.dm index 0309cc48b38..742a3261972 100644 --- a/code/modules/paperwork/paperplane.dm +++ b/code/modules/paperwork/paperplane.dm @@ -113,7 +113,7 @@ . += span_notice("Alt-click [src] to fold it into a paper plane.") /obj/item/paper/AltClick(mob/living/user, obj/item/I) - if(!user.canUseTopic(src, be_close = TRUE, no_dexterity = TRUE, no_tk = FALSE, need_hands = TRUE)) + if(!user.can_perform_action(src, NEED_DEXTERITY|NEED_HANDS)) return if(istype(src, /obj/item/paper/carbon)) var/obj/item/paper/carbon/Carbon = src diff --git a/code/modules/paperwork/pen.dm b/code/modules/paperwork/pen.dm index 4ac695e9a61..4b519405a9e 100644 --- a/code/modules/paperwork/pen.dm +++ b/code/modules/paperwork/pen.dm @@ -142,7 +142,7 @@ to_chat(user, span_warning("You must be holding the pen to continue!")) return var/deg = tgui_input_number(user, "What angle would you like to rotate the pen head to? (0-360)", "Rotate Pen Head", max_value = 360) - if(isnull(deg) || QDELETED(user) || QDELETED(src) || !user.canUseTopic(src, be_close = TRUE, no_dexterity = FALSE, no_tk = TRUE) || loc != user) + if(isnull(deg) || QDELETED(user) || QDELETED(src) || !user.can_perform_action(src, FORBID_TELEKINESIS_REACH) || loc != user) return degrees = deg to_chat(user, span_notice("You rotate the top of the pen to [deg] degrees.")) @@ -169,12 +169,12 @@ //Changing name/description of items. Only works if they have the UNIQUE_RENAME object flag set if(isobj(O) && (O.obj_flags & UNIQUE_RENAME)) var/penchoice = tgui_input_list(user, "What would you like to edit?", "Pen Setting", list("Rename", "Description", "Reset")) - if(QDELETED(O) || !user.canUseTopic(O, be_close = TRUE)) + if(QDELETED(O) || !user.can_perform_action(O)) return if(penchoice == "Rename") var/input = tgui_input_text(user, "What do you want to name [O]?", "Object Name", "[O.name]", MAX_NAME_LEN) var/oldname = O.name - if(QDELETED(O) || !user.canUseTopic(O, be_close = TRUE)) + if(QDELETED(O) || !user.can_perform_action(O)) return if(input == oldname || !input) to_chat(user, span_notice("You changed [O] to... well... [O].")) @@ -190,7 +190,7 @@ if(penchoice == "Description") var/input = tgui_input_text(user, "Describe [O]", "Description", "[O.desc]", 140) var/olddesc = O.desc - if(QDELETED(O) || !user.canUseTopic(O, be_close = TRUE)) + if(QDELETED(O) || !user.can_perform_action(O)) return if(input == olddesc || !input) to_chat(user, span_notice("You decide against changing [O]'s description.")) @@ -200,7 +200,7 @@ O.renamedByPlayer = TRUE if(penchoice == "Reset") - if(QDELETED(O) || !user.canUseTopic(O, be_close = TRUE)) + if(QDELETED(O) || !user.can_perform_action(O)) return qdel(O.GetComponent(/datum/component/rename)) diff --git a/code/modules/paperwork/photocopier.dm b/code/modules/paperwork/photocopier.dm index 866e3cacb28..77d5f734149 100644 --- a/code/modules/paperwork/photocopier.dm +++ b/code/modules/paperwork/photocopier.dm @@ -486,7 +486,7 @@ /obj/machinery/photocopier/MouseDrop_T(mob/target, mob/user) check_ass() //Just to make sure that you can re-drag somebody onto it after they moved off. - if(!istype(target) || target.anchored || target.buckled || !Adjacent(target) || !user.canUseTopic(src, be_close = TRUE) || target == ass || copier_blocked()) + if(!istype(target) || target.anchored || target.buckled || !Adjacent(target) || !user.can_perform_action(src) || target == ass || copier_blocked()) return add_fingerprint(user) if(target == user) diff --git a/code/modules/photography/camera/camera.dm b/code/modules/photography/camera/camera.dm index 6c600c7266f..ce55fee58c4 100644 --- a/code/modules/photography/camera/camera.dm +++ b/code/modules/photography/camera/camera.dm @@ -63,17 +63,17 @@ to_chat(user, span_warning("You must be holding the camera to continue!")) return FALSE var/desired_x = tgui_input_number(user, "How wide do you want the camera to shoot?", "Zoom", picture_size_x, picture_size_x_max, picture_size_x_min) - if(!desired_x || QDELETED(user) || QDELETED(src) || !user.canUseTopic(src, be_close = TRUE, no_dexterity = FALSE, no_tk = TRUE) || loc != user) + if(!desired_x || QDELETED(user) || QDELETED(src) || !user.can_perform_action(src, FORBID_TELEKINESIS_REACH) || loc != user) return FALSE var/desired_y = tgui_input_number(user, "How high do you want the camera to shoot", "Zoom", picture_size_y, picture_size_y_max, picture_size_y_min) - if(!desired_y || QDELETED(user) || QDELETED(src) || !user.canUseTopic(src, be_close = TRUE, no_dexterity = FALSE, no_tk = TRUE) || loc != user) + if(!desired_y || QDELETED(user) || QDELETED(src) || !user.can_perform_action(src, FORBID_TELEKINESIS_REACH) || loc != user) return FALSE picture_size_x = min(clamp(desired_x, picture_size_x_min, picture_size_x_max), CAMERA_PICTURE_SIZE_HARD_LIMIT) picture_size_y = min(clamp(desired_y, picture_size_y_min, picture_size_y_max), CAMERA_PICTURE_SIZE_HARD_LIMIT) return TRUE /obj/item/camera/AltClick(mob/user) - if(!user.canUseTopic(src, be_close = TRUE)) + if(!user.can_perform_action(src)) return adjust_zoom(user) diff --git a/code/modules/photography/photos/photo.dm b/code/modules/photography/photos/photo.dm index 95b071c7dc6..dba86c6ae01 100644 --- a/code/modules/photography/photos/photo.dm +++ b/code/modules/photography/photos/photo.dm @@ -71,7 +71,7 @@ if(!user.can_write(P)) return var/txt = tgui_input_text(user, "What would you like to write on the back?", "Photo Writing", max_length = 128) - if(txt && user.canUseTopic(src, be_close = TRUE)) + if(txt && user.can_perform_action(src)) scribble = txt else return ..() diff --git a/code/modules/plumbing/plumbers/bottler.dm b/code/modules/plumbing/plumbers/bottler.dm index 933f89a0eff..5e5ffaab8cc 100644 --- a/code/modules/plumbing/plumbers/bottler.dm +++ b/code/modules/plumbing/plumbers/bottler.dm @@ -66,7 +66,7 @@ to_chat(user, span_warning("A flashing notification on the screen reads: \"Output location error!\"")) return . var/new_amount = tgui_input_number(user, "Set Amount to Fill", "Desired Amount", max_value = 100) - if(!new_amount || QDELETED(user) || QDELETED(src) || !user.canUseTopic(src, be_close = TRUE, no_dexterity = FALSE, no_tk = TRUE)) + if(!new_amount || QDELETED(user) || QDELETED(src) || !user.can_perform_action(src, FORBID_TELEKINESIS_REACH)) return . wanted_amount = new_amount to_chat(user, span_notice(" The [src] will now fill for [wanted_amount]u.")) diff --git a/code/modules/plumbing/plumbers/plumbing_buffer.dm b/code/modules/plumbing/plumbers/plumbing_buffer.dm index 9a48407d4ad..2cb5dab2b8a 100644 --- a/code/modules/plumbing/plumbers/plumbing_buffer.dm +++ b/code/modules/plumbing/plumbers/plumbing_buffer.dm @@ -80,7 +80,7 @@ . = SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN var/new_volume = tgui_input_number(user, "Enter new activation threshold", "Beepityboop", activation_volume, buffer) - if(!new_volume || QDELETED(user) || QDELETED(src) || !user.canUseTopic(src, be_close = TRUE, no_dexterity = FALSE, no_tk = TRUE)) + if(!new_volume || QDELETED(user) || QDELETED(src) || !user.can_perform_action(src, FORBID_TELEKINESIS_REACH)) return activation_volume = new_volume to_chat(user, span_notice("New activation threshold is now [activation_volume].")) diff --git a/code/modules/power/apc/apc_attack.dm b/code/modules/power/apc/apc_attack.dm index 87329410815..ef413ae1a2d 100644 --- a/code/modules/power/apc/apc_attack.dm +++ b/code/modules/power/apc/apc_attack.dm @@ -173,7 +173,7 @@ . = ..() if(!can_interact(user)) return - if(!user.canUseTopic(src, !issilicon(user)) || !isturf(loc)) + if(!user.can_perform_action(src, ALLOW_SILICON_REACH) || !isturf(loc)) return if(!ishuman(user)) return diff --git a/code/modules/power/pipecleaners.dm b/code/modules/power/pipecleaners.dm index 926982601df..8ead56c9fda 100644 --- a/code/modules/power/pipecleaners.dm +++ b/code/modules/power/pipecleaners.dm @@ -172,7 +172,7 @@ By design, d1 is the smallest direction and d2 is the highest stored.update_appearance() /obj/structure/pipe_cleaner/AltClick(mob/living/user) - if(!user.canUseTopic(src, be_close = TRUE)) + if(!user.can_perform_action(src)) return cut_pipe_cleaner(user) diff --git a/code/modules/projectiles/gun.dm b/code/modules/projectiles/gun.dm index 6b7c90aeb77..c203c2fc1a9 100644 --- a/code/modules/projectiles/gun.dm +++ b/code/modules/projectiles/gun.dm @@ -445,7 +445,7 @@ . = ..() if(.) return - if(!user.canUseTopic(src, be_close = TRUE, no_dexterity = FALSE, no_tk = TRUE)) + if(!user.can_perform_action(src, FORBID_TELEKINESIS_REACH)) return if(bayonet && can_bayonet) //if it has a bayonet, and the bayonet can be removed @@ -466,7 +466,7 @@ . = ..() if(.) return - if(!user.canUseTopic(src, be_close = TRUE, no_dexterity = FALSE, no_tk = TRUE)) + if(!user.can_perform_action(src, FORBID_TELEKINESIS_REACH)) return if(pin && user.is_holding(src)) user.visible_message(span_warning("[user] attempts to remove [pin] from [src] with [I]."), @@ -483,7 +483,7 @@ . = ..() if(.) return - if(!user.canUseTopic(src, be_close = TRUE, no_dexterity = FALSE, no_tk = TRUE)) + if(!user.can_perform_action(src, FORBID_TELEKINESIS_REACH)) return if(pin && user.is_holding(src)) user.visible_message(span_warning("[user] attempts to remove [pin] from [src] with [I]."), diff --git a/code/modules/projectiles/guns/ballistic.dm b/code/modules/projectiles/guns/ballistic.dm index d2d692d1e58..817c4592735 100644 --- a/code/modules/projectiles/guns/ballistic.dm +++ b/code/modules/projectiles/guns/ballistic.dm @@ -424,7 +424,7 @@ return ..() /obj/item/gun/ballistic/AltClick(mob/user) - if (unique_reskin && !current_skin && user.canUseTopic(src, be_close = TRUE, no_dexterity = TRUE)) + if (unique_reskin && !current_skin && user.can_perform_action(src, NEED_DEXTERITY)) reskin_obj(user) return if(loc == user) diff --git a/code/modules/projectiles/guns/ballistic/automatic.dm b/code/modules/projectiles/guns/ballistic/automatic.dm index 1e3870b063e..73ca274dff4 100644 --- a/code/modules/projectiles/guns/ballistic/automatic.dm +++ b/code/modules/projectiles/guns/ballistic/automatic.dm @@ -274,7 +274,7 @@ /obj/item/gun/ballistic/automatic/l6_saw/AltClick(mob/user) - if(!user.canUseTopic(src)) + if(!user.can_perform_action(src)) return cover_open = !cover_open balloon_alert(user, "cover [cover_open ? "opened" : "closed"]") diff --git a/code/modules/projectiles/guns/ballistic/shotgun.dm b/code/modules/projectiles/guns/ballistic/shotgun.dm index 971b0fc6227..8d3da34c4d6 100644 --- a/code/modules/projectiles/guns/ballistic/shotgun.dm +++ b/code/modules/projectiles/guns/ballistic/shotgun.dm @@ -119,7 +119,7 @@ balloon_alert(user, "switched to tube A") /obj/item/gun/ballistic/shotgun/automatic/dual_tube/AltClick(mob/living/user) - if(!user.canUseTopic(src, be_close = TRUE, no_dexterity = TRUE, no_tk = FALSE, need_hands = TRUE)) + if(!user.can_perform_action(src, NEED_DEXTERITY|NEED_HANDS)) return rack() @@ -275,7 +275,7 @@ /obj/item/gun/ballistic/shotgun/doublebarrel/AltClick(mob/user) . = ..() - if(unique_reskin && !current_skin && user.canUseTopic(src, be_close = TRUE, no_dexterity = TRUE)) + if(unique_reskin && !current_skin && user.can_perform_action(src, NEED_DEXTERITY)) reskin_obj(user) /obj/item/gun/ballistic/shotgun/doublebarrel/sawoff(mob/user) diff --git a/code/modules/projectiles/pins.dm b/code/modules/projectiles/pins.dm index 3564bd09f41..2f3b21c76d8 100644 --- a/code/modules/projectiles/pins.dm +++ b/code/modules/projectiles/pins.dm @@ -265,7 +265,7 @@ owned = FALSE return var/transaction_amount = tgui_input_number(user, "Insert valid deposit amount for gun purchase", "Money Deposit") - if(!transaction_amount || QDELETED(user) || QDELETED(src) || !user.canUseTopic(src, be_close = TRUE, no_dexterity = FALSE, no_tk = TRUE)) + if(!transaction_amount || QDELETED(user) || QDELETED(src) || !user.can_perform_action(src, FORBID_TELEKINESIS_REACH)) return pin_owner = id owned = TRUE @@ -289,7 +289,7 @@ if(credit_card_details && !active_prompt) var/license_request = tgui_alert(user, "Do you wish to pay [payment_amount] credit[( payment_amount > 1 ) ? "s" : ""] for [( multi_payment ) ? "each shot of [gun.name]" : "usage license of [gun.name]"]?", "Weapon Purchase", list("Yes", "No")) active_prompt = TRUE - if(!user.canUseTopic(src, be_close = TRUE)) + if(!user.can_perform_action(src)) active_prompt = FALSE return FALSE switch(license_request) diff --git a/code/modules/reagents/chemistry/machinery/chem_dispenser.dm b/code/modules/reagents/chemistry/machinery/chem_dispenser.dm index 9cd5a119bd5..4b4f8c18a8d 100644 --- a/code/modules/reagents/chemistry/machinery/chem_dispenser.dm +++ b/code/modules/reagents/chemistry/machinery/chem_dispenser.dm @@ -338,7 +338,7 @@ if(!is_operational) return var/name = tgui_input_text(usr, "What do you want to name this recipe?", "Recipe Name", MAX_NAME_LEN) - if(!usr.canUseTopic(src, !issilicon(usr))) + if(!usr.can_perform_action(src, ALLOW_SILICON_REACH)) return if(saved_recipes[name] && tgui_alert(usr, "\"[name]\" already exists, do you want to overwrite it?",, list("Yes", "No")) == "No") return @@ -453,7 +453,7 @@ . = ..() if(. == SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN) return - if(!can_interact(user) || !user.canUseTopic(src, !issilicon(user), FALSE, no_tk = TRUE)) + if(!can_interact(user) || !user.can_perform_action(src, ALLOW_SILICON_REACH|FORBID_TELEKINESIS_REACH)) return replace_beaker(user) return SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN diff --git a/code/modules/reagents/chemistry/machinery/chem_heater.dm b/code/modules/reagents/chemistry/machinery/chem_heater.dm index a7e3276be16..c221951a3d9 100644 --- a/code/modules/reagents/chemistry/machinery/chem_heater.dm +++ b/code/modules/reagents/chemistry/machinery/chem_heater.dm @@ -64,7 +64,7 @@ . = ..() if(. == SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN) return - if(!can_interact(user) || !user.canUseTopic(src, !issilicon(user), FALSE, no_tk = TRUE)) + if(!can_interact(user) || !user.can_perform_action(src, ALLOW_SILICON_REACH|FORBID_TELEKINESIS_REACH)) return replace_beaker(user) return SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN diff --git a/code/modules/reagents/chemistry/machinery/chem_mass_spec.dm b/code/modules/reagents/chemistry/machinery/chem_mass_spec.dm index 43e811588c7..df477ac631f 100644 --- a/code/modules/reagents/chemistry/machinery/chem_mass_spec.dm +++ b/code/modules/reagents/chemistry/machinery/chem_mass_spec.dm @@ -125,7 +125,7 @@ This will not clean any inverted reagents. Inverted reagents will still be corre if(processing_reagents) to_chat(user, " The [src] is currently processing a batch!") return - if(!can_interact(user) || !user.canUseTopic(src, be_close = TRUE, no_dexterity = FALSE, no_tk = TRUE)) + if(!can_interact(user) || !user.can_perform_action(src, FORBID_TELEKINESIS_REACH)) return ..() replace_beaker(user, BEAKER1) @@ -134,7 +134,7 @@ This will not clean any inverted reagents. Inverted reagents will still be corre if(processing_reagents) to_chat(user, " The [src] is currently processing a batch!") return - if(!can_interact(user) || !user.canUseTopic(src, be_close = TRUE, no_dexterity = FALSE, no_tk = TRUE)) + if(!can_interact(user) || !user.can_perform_action(src, FORBID_TELEKINESIS_REACH)) return replace_beaker(user, BEAKER2) diff --git a/code/modules/reagents/chemistry/machinery/chem_master.dm b/code/modules/reagents/chemistry/machinery/chem_master.dm index c1273603567..ef98ede897e 100644 --- a/code/modules/reagents/chemistry/machinery/chem_master.dm +++ b/code/modules/reagents/chemistry/machinery/chem_master.dm @@ -143,7 +143,7 @@ . = ..() if(. == SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN) return - if(!can_interact(user) || !user.canUseTopic(src, !issilicon(user), FALSE, no_tk = TRUE)) + if(!can_interact(user) || !user.can_perform_action(src, ALLOW_SILICON_REACH|FORBID_TELEKINESIS_REACH)) return replace_beaker(user) return SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN @@ -379,7 +379,7 @@ "Name", name_default, MAX_NAME_LEN) - if(!name || !reagents.total_volume || !src || QDELETED(src) || !usr.canUseTopic(src, !issilicon(usr))) + if(!name || !reagents.total_volume || !src || QDELETED(src) || !usr.can_perform_action(src, ALLOW_SILICON_REACH)) return FALSE // Start filling if(item_type == "pill") diff --git a/code/modules/reagents/chemistry/machinery/pandemic.dm b/code/modules/reagents/chemistry/machinery/pandemic.dm index 4290d364c7a..57cfeedaa67 100644 --- a/code/modules/reagents/chemistry/machinery/pandemic.dm +++ b/code/modules/reagents/chemistry/machinery/pandemic.dm @@ -61,7 +61,7 @@ . = ..() if(. == SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN) return - if(!can_interact(user) || !user.canUseTopic(src, !issilicon(user), FALSE, no_tk = TRUE)) + if(!can_interact(user) || !user.can_perform_action(src, ALLOW_SILICON_REACH|FORBID_TELEKINESIS_REACH)) return eject_beaker() return SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN diff --git a/code/modules/reagents/chemistry/machinery/reagentgrinder.dm b/code/modules/reagents/chemistry/machinery/reagentgrinder.dm index 866fade0d65..db5baba7435 100644 --- a/code/modules/reagents/chemistry/machinery/reagentgrinder.dm +++ b/code/modules/reagents/chemistry/machinery/reagentgrinder.dm @@ -99,7 +99,7 @@ . = ..() if(. == SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN) return - if(!can_interact(user) || !user.canUseTopic(src, !issilicon(user), FALSE, no_tk = TRUE)) + if(!can_interact(user) || !user.can_perform_action(src, ALLOW_SILICON_REACH|FORBID_TELEKINESIS_REACH)) return if(operating) return @@ -201,7 +201,7 @@ /obj/machinery/reagentgrinder/ui_interact(mob/user) // The microwave Menu //I am reasonably certain that this is not a microwave . = ..() - if(operating || !user.canUseTopic(src, !issilicon(user))) + if(operating || !user.can_perform_action(src, ALLOW_SILICON_REACH)) return var/list/options = list() @@ -232,7 +232,7 @@ choice = show_radial_menu(user, src, options, require_near = !issilicon(user)) // post choice verification - if(operating || (isAI(user) && machine_stat & NOPOWER) || !user.canUseTopic(src, !issilicon(user))) + if(operating || (isAI(user) && machine_stat & NOPOWER) || !user.can_perform_action(src, ALLOW_SILICON_REACH)) return switch(choice) diff --git a/code/modules/reagents/reagent_containers/blood_pack.dm b/code/modules/reagents/reagent_containers/blood_pack.dm index 6c059cdaffc..f0e8b915bce 100644 --- a/code/modules/reagents/reagent_containers/blood_pack.dm +++ b/code/modules/reagents/reagent_containers/blood_pack.dm @@ -73,7 +73,7 @@ if(!user.can_write(tool)) return var/custom_label = tgui_input_text(user, "What would you like to label the blood pack?", "Blood Pack", name, MAX_NAME_LEN) - if(!user.canUseTopic(src, be_close = TRUE)) + if(!user.can_perform_action(src)) return if(user.get_active_held_item() != tool) return diff --git a/code/modules/reagents/reagent_containers/chem_pack.dm b/code/modules/reagents/reagent_containers/chem_pack.dm index 484fc83661a..7e6df4a0b4a 100644 --- a/code/modules/reagents/reagent_containers/chem_pack.dm +++ b/code/modules/reagents/reagent_containers/chem_pack.dm @@ -13,7 +13,7 @@ possible_transfer_amounts = list() /obj/item/reagent_containers/chem_pack/AltClick(mob/living/user) - if(user.canUseTopic(src, be_close = TRUE, no_dexterity = TRUE) && !sealed) + if(user.can_perform_action(src, NEED_DEXTERITY) && !sealed) if(iscarbon(user) && (HAS_TRAIT(user, TRAIT_CLUMSY) && prob(50))) to_chat(user, span_warning("Uh... whoops! You accidentally spill the content of the bag onto yourself.")) SplashReagents(user) diff --git a/code/modules/reagents/reagent_containers/cups/bottle.dm b/code/modules/reagents/reagent_containers/cups/bottle.dm index 027ae611aca..d2e0957e2fd 100644 --- a/code/modules/reagents/reagent_containers/cups/bottle.dm +++ b/code/modules/reagents/reagent_containers/cups/bottle.dm @@ -533,7 +533,7 @@ if(!inputvalue) return - if(user.canUseTopic(src, be_close = TRUE)) + if(user.can_perform_action(src)) name = "[(inputvalue ? "[inputvalue]" : null)] bottle" //types of syrups diff --git a/code/modules/reagents/reagent_containers/hypospray.dm b/code/modules/reagents/reagent_containers/hypospray.dm index ce972b88e27..c0e0f5194f8 100644 --- a/code/modules/reagents/reagent_containers/hypospray.dm +++ b/code/modules/reagents/reagent_containers/hypospray.dm @@ -134,7 +134,7 @@ update_appearance() /obj/item/reagent_containers/hypospray/medipen/attack_self(mob/user) - if(user.canUseTopic(src, be_close = TRUE, no_dexterity = FALSE, no_tk = TRUE, need_hands = FALSE, floor_okay = TRUE)) + if(user.can_perform_action(src, FORBID_TELEKINESIS_REACH|ALLOW_RESTING)) inject(user, user) /obj/item/reagent_containers/hypospray/medipen/update_icon_state() diff --git a/code/modules/reagents/reagent_containers/spray.dm b/code/modules/reagents/reagent_containers/spray.dm index d349489880a..fddb4e856e4 100644 --- a/code/modules/reagents/reagent_containers/spray.dm +++ b/code/modules/reagents/reagent_containers/spray.dm @@ -401,7 +401,7 @@ "Blue" = "sprayer_med_blue") /obj/item/reagent_containers/spray/medical/AltClick(mob/user) - if(unique_reskin && !current_skin && user.canUseTopic(src, be_close = TRUE, no_dexterity = TRUE)) + if(unique_reskin && !current_skin && user.can_perform_action(src, NEED_DEXTERITY)) reskin_obj(user) /obj/item/reagent_containers/spray/medical/reskin_obj(mob/M) diff --git a/code/modules/recycling/conveyor.dm b/code/modules/recycling/conveyor.dm index ed9f27b4cc0..480588b2cbd 100644 --- a/code/modules/recycling/conveyor.dm +++ b/code/modules/recycling/conveyor.dm @@ -410,7 +410,7 @@ GLOBAL_LIST_EMPTY(conveyors_by_id) /obj/machinery/conveyor_switch/multitool_act(mob/living/user, obj/item/I) var/input_speed = tgui_input_number(user, "Set the speed of the conveyor belts in seconds", "Speed", conveyor_speed, 20, 0.2, round_value = FALSE) - if(!input_speed || QDELETED(user) || QDELETED(src) || !usr.canUseTopic(src, be_close = TRUE, no_dexterity = FALSE, no_tk = TRUE)) + if(!input_speed || QDELETED(user) || QDELETED(src) || !usr.can_perform_action(src, FORBID_TELEKINESIS_REACH)) return conveyor_speed = input_speed to_chat(user, span_notice("You change the time between moves to [input_speed] seconds.")) diff --git a/code/modules/recycling/sortingmachinery.dm b/code/modules/recycling/sortingmachinery.dm index 2e48818bb10..67f67cbe5f0 100644 --- a/code/modules/recycling/sortingmachinery.dm +++ b/code/modules/recycling/sortingmachinery.dm @@ -118,7 +118,7 @@ if(!user.can_write(item)) return var/str = tgui_input_text(user, "Label text?", "Set label", max_length = MAX_NAME_LEN) - if(!user.canUseTopic(src, be_close = TRUE)) + if(!user.can_perform_action(src)) return if(!str || !length(str)) to_chat(user, span_warning("Invalid text!")) diff --git a/code/modules/research/xenobiology/crossbreeding/_misc.dm b/code/modules/research/xenobiology/crossbreeding/_misc.dm index bd6b8ffcd56..547bd9345c9 100644 --- a/code/modules/research/xenobiology/crossbreeding/_misc.dm +++ b/code/modules/research/xenobiology/crossbreeding/_misc.dm @@ -186,7 +186,7 @@ Slimecrossing Items if(M.mind) to_chat(user, span_notice("You offer the device to [M].")) if(tgui_alert(M, "Would you like to enter [user]'s capture device?", "Gold Capture Device", list("Yes", "No")) == "Yes") - if(user.canUseTopic(src, be_close = TRUE) && user.canUseTopic(M, be_close = TRUE)) + if(user.can_perform_action(src) && user.can_perform_action(M)) to_chat(user, span_notice("You store [M] in the capture device.")) to_chat(M, span_notice("The world warps around you, and you're suddenly in an endless void, with a window to the outside floating in front of you.")) store(M, user) diff --git a/code/modules/research/xenobiology/crossbreeding/charged.dm b/code/modules/research/xenobiology/crossbreeding/charged.dm index 8561ebe04af..dff26b1c0b1 100644 --- a/code/modules/research/xenobiology/crossbreeding/charged.dm +++ b/code/modules/research/xenobiology/crossbreeding/charged.dm @@ -176,7 +176,7 @@ Charged extracts: if(isnull(racechoice)) to_chat(user, span_notice("You decide not to become a slime for now.")) return - if(!user.canUseTopic(src, be_close = TRUE)) + if(!user.can_perform_action(src)) return human_user.set_species(choice_list[racechoice], icon_update=1) human_user.visible_message(span_warning("[human_user] suddenly shifts form as [src] dissolves into [human_user.p_their()] skin!")) diff --git a/code/modules/research/xenobiology/crossbreeding/stabilized.dm b/code/modules/research/xenobiology/crossbreeding/stabilized.dm index cf83ad88910..b643086a0df 100644 --- a/code/modules/research/xenobiology/crossbreeding/stabilized.dm +++ b/code/modules/research/xenobiology/crossbreeding/stabilized.dm @@ -152,7 +152,7 @@ Stabilized extracts: var/choice = tgui_input_list(user, "Which do you want to reset?", "Familiar Adjustment", sort_list(list("Familiar Location", "Familiar Species", "Familiar Sentience", "Familiar Name"))) if(isnull(choice)) return - if(!user.canUseTopic(src, be_close = TRUE)) + if(!user.can_perform_action(src)) return if(isliving(user)) var/mob/living/L = user diff --git a/code/modules/vehicles/mecha/mech_fabricator.dm b/code/modules/vehicles/mecha/mech_fabricator.dm index 5355a62ab6e..d38b1909ad3 100644 --- a/code/modules/vehicles/mecha/mech_fabricator.dm +++ b/code/modules/vehicles/mecha/mech_fabricator.dm @@ -125,7 +125,7 @@ /obj/machinery/mecha_part_fabricator/AltClick(mob/user) . = ..() - if(!user.canUseTopic(src, be_close = TRUE)) + if(!user.can_perform_action(src)) return if(panel_open) dir = turn(dir, -90) diff --git a/code/modules/vehicles/mecha/mecha_actions.dm b/code/modules/vehicles/mecha/mecha_actions.dm index 06e66e3be46..44fa761a7b8 100644 --- a/code/modules/vehicles/mecha/mecha_actions.dm +++ b/code/modules/vehicles/mecha/mecha_actions.dm @@ -89,7 +89,7 @@ chassis.toggle_strafe() /obj/vehicle/sealed/mecha/AltClick(mob/living/user) - if(!(user in occupants) || !user.canUseTopic(src)) + if(!(user in occupants) || !user.can_perform_action(src)) return if(!(user in return_controllers_with_flag(VEHICLE_CONTROL_DRIVE))) to_chat(user, span_warning("You're in the wrong seat to control movement.")) diff --git a/code/modules/vehicles/ridden.dm b/code/modules/vehicles/ridden.dm index afe15da47fd..33f81184e9a 100644 --- a/code/modules/vehicles/ridden.dm +++ b/code/modules/vehicles/ridden.dm @@ -40,7 +40,7 @@ inserted_key = I /obj/vehicle/ridden/AltClick(mob/user) - if(!inserted_key || !user.canUseTopic(src, be_close = TRUE, no_dexterity = TRUE, no_tk = FALSE, need_hands = !issilicon(user))) + if(!inserted_key || !user.can_perform_action(src, NEED_DEXTERITY)) return ..() if(!is_occupant(user)) to_chat(user, span_warning("You must be riding the [src] to remove [src]'s key!")) diff --git a/code/modules/vehicles/wheelchair.dm b/code/modules/vehicles/wheelchair.dm index 5ac8d41720d..9278d78af80 100644 --- a/code/modules/vehicles/wheelchair.dm +++ b/code/modules/vehicles/wheelchair.dm @@ -130,7 +130,7 @@ . = ..() if(over_object != usr || !Adjacent(usr) || !foldabletype) return FALSE - if(!ishuman(usr) || !usr.canUseTopic(src, be_close = TRUE)) + if(!ishuman(usr) || !usr.can_perform_action(src)) return FALSE if(has_buckled_mobs()) return FALSE diff --git a/code/modules/wiremod/components/list/list_pick.dm b/code/modules/wiremod/components/list/list_pick.dm index 422811ec423..bce3e82688f 100644 --- a/code/modules/wiremod/components/list/list_pick.dm +++ b/code/modules/wiremod/components/list/list_pick.dm @@ -68,10 +68,10 @@ return if(!message) message = "circuit input" - if(!(user.canUseTopic(src, be_close = TRUE, no_dexterity = FALSE, no_tk = TRUE))) + if(!(user.can_perform_action(src, FORBID_TELEKINESIS_REACH))) return var/picked = tgui_input_list(user, message = message, items = showed_list) - if(!(user.canUseTopic(src, be_close = TRUE, no_dexterity = FALSE, no_tk = TRUE))) + if(!(user.can_perform_action(src, FORBID_TELEKINESIS_REACH))) return choose_item(picked, showed_list)