diff --git a/code/__DEFINES/dcs/signals.dm b/code/__DEFINES/dcs/signals.dm index 4de01402991..a22d6d2e408 100644 --- a/code/__DEFINES/dcs/signals.dm +++ b/code/__DEFINES/dcs/signals.dm @@ -523,6 +523,9 @@ #define COMPONENT_BLOCK_SWAP (1<<0) ///from base of /mob/verb/pointed: (atom/A) #define COMSIG_MOB_POINTED "mob_pointed" +///Mob is trying to open the wires of a target [/atom], from /datum/wires/interactable(): (atom/target) +#define COMSIG_TRY_WIRES_INTERACT "try_wires_interact" + #define COMPONENT_CANT_INTERACT_WIRES (1<<0) ///from /obj/structure/door/crush(): (mob/living/crushed, /obj/machinery/door/crushing_door) #define COMSIG_LIVING_DOORCRUSHED "living_doorcrush" @@ -702,7 +705,10 @@ ///from /obj/machinery/can_interact(mob/user): Called on user when attempting to interact with a machine (obj/machinery/machine) #define COMSIG_TRY_USE_MACHINE "try_use_machine" - #define COMPONENT_CANT_USE_MACHINE (1<<0) + /// Can't interact with the machine + #define COMPONENT_CANT_USE_MACHINE_INTERACT (1<<0) + /// Can't use tools on the machine + #define COMPONENT_CANT_USE_MACHINE_TOOLS (1<<1) ///from obj/machinery/iv_drip/IV_attach(target, usr) : (attachee) #define COMSIG_IV_ATTACH "iv_attach" diff --git a/code/__DEFINES/devices.dm b/code/__DEFINES/devices.dm new file mode 100644 index 00000000000..412e5d416d7 --- /dev/null +++ b/code/__DEFINES/devices.dm @@ -0,0 +1,20 @@ +// PDA defines // +#define CART_SECURITY (1<<0) +#define CART_ENGINE (1<<1) +#define CART_ATMOS (1<<2) +#define CART_MEDICAL (1<<3) +#define CART_MANIFEST (1<<4) +#define CART_CLOWN (1<<5) +#define CART_MIME (1<<6) +#define CART_JANITOR (1<<7) +#define CART_REAGENT_SCANNER (1<<8) +#define CART_NEWSCASTER (1<<9) +#define CART_REMOTE_DOOR (1<<10) +#define CART_STATUS_DISPLAY (1<<11) +#define CART_QUARTERMASTER (1<<12) +#define CART_HYDROPONICS (1<<13) +#define CART_DRONEPHONE (1<<14) +#define CART_DRONEACCESS (1<<15) + +// Used by PDA and cartridge code to reduce repetitiveness of spritesheets +#define PDAIMG(what) {""} diff --git a/code/__DEFINES/machines.dm b/code/__DEFINES/machines.dm index da2b76853da..6ec17b1d52f 100644 --- a/code/__DEFINES/machines.dm +++ b/code/__DEFINES/machines.dm @@ -190,3 +190,11 @@ #define ORION_GAMER_PAMPHLET -1 //game begins to have a chance to warn sec and med #define ORION_GAMER_REPORT_THRESHOLD 2 + +// Air alarm [/obj/machinery/airalarm/buildstage] +/// Air alarm missing circuit +#define AIRALARM_BUILD_NO_CIRCUIT 0 +/// Air alarm has circuit but is missing wires +#define AIRALARM_BUILD_NO_WIRES 1 +/// Air alarm has all components but isn't completed +#define AIRALARM_BUILD_COMPLETE 2 diff --git a/code/__DEFINES/misc.dm b/code/__DEFINES/misc.dm index 2030ba8bbe2..320ee46a68a 100644 --- a/code/__DEFINES/misc.dm +++ b/code/__DEFINES/misc.dm @@ -454,9 +454,6 @@ GLOBAL_LIST_INIT(pda_styles, sortList(list(MONO, VT, ORBITRON, SHARE))) #define EGG_LAYING_MESSAGES list("lays an egg.","squats down and croons.","begins making a huge racket.","begins clucking raucously.") -// Used by PDA and cartridge code to reduce repetitiveness of spritesheets -#define PDAIMG(what) {""} - /// Prepares a text to be used for maptext. Use this so it doesn't look hideous. #define MAPTEXT(text) {"[##text]"} diff --git a/code/__DEFINES/tools.dm b/code/__DEFINES/tools.dm index 78905562690..a1504265fa5 100644 --- a/code/__DEFINES/tools.dm +++ b/code/__DEFINES/tools.dm @@ -22,3 +22,13 @@ // If delay between the start and the end of tool operation is less than MIN_TOOL_SOUND_DELAY, // tool sound is only played when op is started. If not, it's played twice. #define MIN_TOOL_SOUND_DELAY 20 + +// tool_act chain flags + +/// When a tooltype_act proc is successful +#define TOOL_ACT_TOOLTYPE_SUCCESS (1<<0) +/// When [COMSIG_ATOM_TOOL_ACT] blocks the act +#define TOOL_ACT_SIGNAL_BLOCKING (1<<1) + +/// When [TOOL_ACT_TOOLTYPE_SUCCESS] or [TOOL_ACT_SIGNAL_BLOCKING] are set +#define TOOL_ACT_MELEE_CHAIN_BLOCKING (TOOL_ACT_TOOLTYPE_SUCCESS | TOOL_ACT_SIGNAL_BLOCKING) diff --git a/code/_globalvars/misc.dm b/code/_globalvars/misc.dm index e0e6ed945c8..f67c4f68398 100644 --- a/code/_globalvars/misc.dm +++ b/code/_globalvars/misc.dm @@ -31,3 +31,6 @@ GLOBAL_PROTECT(poll_options) GLOBAL_VAR_INIT(internal_tick_usage, 0.2 * world.tick_lag) GLOBAL_VAR_INIT(glowshrooms, 0) + +/// If drones are blacklisted from certain sensitive machines +GLOBAL_VAR_INIT(drone_machine_blacklist_enabled, TRUE) diff --git a/code/_onclick/item_attack.dm b/code/_onclick/item_attack.dm index 9e76eb3805d..d3824b7dde4 100644 --- a/code/_onclick/item_attack.dm +++ b/code/_onclick/item_attack.dm @@ -2,7 +2,7 @@ * This is the proc that handles the order of an item_attack. * * The order of procs called is: - * * [/atom/proc/tool_act] on the target. If it returns TRUE, the chain will be stopped. + * * [/atom/proc/tool_act] on the target. If it returns TOOL_ACT_TOOLTYPE_SUCCESS or TOOL_ACT_SIGNAL_BLOCKING, the chain will be stopped. * * [/obj/item/proc/pre_attack] on src. If this returns TRUE, the chain will be stopped. * * [/atom/proc/attackby] on the target. If it returns TRUE, the chain will be stopped. * * [/obj/item/proc/afterattack]. The return value does not matter. @@ -11,7 +11,7 @@ var/is_right_clicking = LAZYACCESS(params2list(params), RIGHT_CLICK) - if(tool_behaviour && target.tool_act(user, src, tool_behaviour, is_right_clicking)) + if(tool_behaviour && (target.tool_act(user, src, tool_behaviour, is_right_clicking) & TOOL_ACT_MELEE_CHAIN_BLOCKING)) return TRUE var/pre_attack_result diff --git a/code/datums/components/technointrovert.dm b/code/datums/components/technointrovert.dm index f77443c49c6..59752b70edb 100644 --- a/code/datums/components/technointrovert.dm +++ b/code/datums/components/technointrovert.dm @@ -14,10 +14,11 @@ src.message = message /datum/component/technointrovert/RegisterWithParent() - RegisterSignal(parent, COMSIG_TRY_USE_MACHINE, .proc/is_in_whitelist) + RegisterSignal(parent, COMSIG_TRY_USE_MACHINE, .proc/on_try_use_machine) + RegisterSignal(parent, COMSIG_TRY_WIRES_INTERACT, .proc/on_try_wires_interact) /datum/component/technointrovert/UnregisterFromParent() - UnregisterSignal(parent, COMSIG_TRY_USE_MACHINE) + UnregisterSignal(parent, list(COMSIG_TRY_USE_MACHINE, COMSIG_TRY_WIRES_INTERACT)) /datum/component/technointrovert/PostTransfer() if(!ismob(parent)) @@ -29,8 +30,17 @@ message = friend.message /datum/component/technointrovert/proc/is_in_whitelist(datum/source, obj/machinery/machine) - SIGNAL_HANDLER if(!is_type_in_typecache(machine, whitelist)) to_chat(source, "[replacetext(message, "%TARGET", machine)]") - return COMPONENT_CANT_USE_MACHINE + return FALSE + return TRUE +/datum/component/technointrovert/proc/on_try_use_machine(datum/source, obj/machinery/machine) + SIGNAL_HANDLER + if(!is_in_whitelist(source, machine)) + return COMPONENT_CANT_USE_MACHINE_INTERACT | COMPONENT_CANT_USE_MACHINE_TOOLS + +/datum/component/technointrovert/proc/on_try_wires_interact(datum/source, atom/machine) + SIGNAL_HANDLER + if(ismachinery(machine) && !is_in_whitelist(source, machine)) + return COMPONENT_CANT_INTERACT_WIRES diff --git a/code/datums/components/technoshy.dm b/code/datums/components/technoshy.dm new file mode 100644 index 00000000000..c46830ddcc6 --- /dev/null +++ b/code/datums/components/technoshy.dm @@ -0,0 +1,55 @@ +/// You can't use machines when they've been touched within the last [unused_duration], unless it was by a mob in [whitelist] +/datum/component/technoshy + can_transfer = TRUE + /// How long in deciseconds the machine can be untouched for + var/unused_duration = (2 MINUTES) + /// Typecache of allowed last_users + var/list/whitelist + /// Message presented if the machine was used too recently + var/message = "The %TARGET is way too fresh dude. Since we're like, super retro, we gotta wait for it to exit the mainstream." + +/datum/component/technoshy/Initialize(unused_duration, message, whitelist) + if(!ismob(parent)) + return COMPONENT_INCOMPATIBLE + if(unused_duration) + src.unused_duration = unused_duration + if(message) + src.message = message + if(!whitelist) + whitelist = typecacheof(parent.type) + src.whitelist = whitelist + +/datum/component/technoshy/RegisterWithParent() + RegisterSignal(parent, COMSIG_TRY_USE_MACHINE, .proc/on_try_use_machine) + RegisterSignal(parent, COMSIG_TRY_WIRES_INTERACT, .proc/on_try_wires_interact) + +/datum/component/technoshy/UnregisterFromParent() + UnregisterSignal(parent, list(COMSIG_TRY_USE_MACHINE, COMSIG_TRY_WIRES_INTERACT)) + +/datum/component/technoshy/PostTransfer() + if(!ismob(parent)) + return COMPONENT_INCOMPATIBLE + +/datum/component/technoshy/InheritComponent(datum/component/technoshy/friend, i_am_original, list/arguments) + if(i_am_original) + whitelist = friend.whitelist + message = friend.message + +/datum/component/technoshy/proc/is_not_touched(datum/source, obj/machinery/machine) + var/time_since = world.time - machine.last_used_time + if(time_since < unused_duration && !isnull(machine.last_user_mobtype) && !is_type_in_typecache(machine.last_user_mobtype, whitelist)) + to_chat(source, "[replacetext(message, "%TARGET", machine)]") + return TRUE + +/datum/component/technoshy/proc/on_try_use_machine(datum/source, obj/machinery/machine) + SIGNAL_HANDLER + if(is_not_touched(source, machine)) + return COMPONENT_CANT_USE_MACHINE_INTERACT | COMPONENT_CANT_USE_MACHINE_TOOLS + +/datum/component/technoshy/proc/on_try_wires_interact(datum/source, atom/machine) + SIGNAL_HANDLER + if(!ismachinery(machine)) + return + else if(is_not_touched(source, machine)) + return COMPONENT_CANT_INTERACT_WIRES + diff --git a/code/datums/wires/_wires.dm b/code/datums/wires/_wires.dm index be50c12425f..70c5fd15686 100644 --- a/code/datums/wires/_wires.dm +++ b/code/datums/wires/_wires.dm @@ -207,6 +207,9 @@ // Overridable Procs /datum/wires/proc/interactable(mob/user) + SHOULD_CALL_PARENT(TRUE) + if((SEND_SIGNAL(user, COMSIG_TRY_WIRES_INTERACT, holder) & COMPONENT_CANT_INTERACT_WIRES)) + return FALSE return TRUE /datum/wires/proc/get_status() diff --git a/code/datums/wires/airalarm.dm b/code/datums/wires/airalarm.dm index 6afccd54766..8eb66466c39 100644 --- a/code/datums/wires/airalarm.dm +++ b/code/datums/wires/airalarm.dm @@ -12,6 +12,8 @@ ..() /datum/wires/airalarm/interactable(mob/user) + if(!..()) + return FALSE var/obj/machinery/airalarm/A = holder if(A.panel_open && A.buildstage == 2) return TRUE diff --git a/code/datums/wires/airlock.dm b/code/datums/wires/airlock.dm index a8cdd6948f3..ba506987e6c 100644 --- a/code/datums/wires/airlock.dm +++ b/code/datums/wires/airlock.dm @@ -62,6 +62,8 @@ return ..() /datum/wires/airlock/interactable(mob/user) + if(!..()) + return FALSE var/obj/machinery/door/airlock/A = holder if(!issilicon(user) && A.isElectrified()) var/mob/living/carbon/carbon_user = user diff --git a/code/datums/wires/apc.dm b/code/datums/wires/apc.dm index 83c527bebdc..38020f7bb99 100644 --- a/code/datums/wires/apc.dm +++ b/code/datums/wires/apc.dm @@ -11,6 +11,8 @@ ..() /datum/wires/apc/interactable(mob/user) + if(!..()) + return FALSE var/obj/machinery/power/apc/A = holder if(A.panel_open && !A.opened) return TRUE diff --git a/code/datums/wires/autolathe.dm b/code/datums/wires/autolathe.dm index 7f3519f3947..b26627f8282 100644 --- a/code/datums/wires/autolathe.dm +++ b/code/datums/wires/autolathe.dm @@ -11,6 +11,8 @@ ..() /datum/wires/autolathe/interactable(mob/user) + if(!..()) + return FALSE var/obj/machinery/autolathe/A = holder if(A.panel_open) return TRUE diff --git a/code/datums/wires/conveyor.dm b/code/datums/wires/conveyor.dm index 6aa9ad28854..b6458037e22 100644 --- a/code/datums/wires/conveyor.dm +++ b/code/datums/wires/conveyor.dm @@ -13,5 +13,7 @@ C.interact(fingerman) /datum/wires/conveyor/interactable(mob/user) + if(!..()) + return FALSE fingerman = user return TRUE diff --git a/code/datums/wires/explosive.dm b/code/datums/wires/explosive.dm index 89c6c24fef2..854791415fa 100644 --- a/code/datums/wires/explosive.dm +++ b/code/datums/wires/explosive.dm @@ -22,6 +22,8 @@ var/fingerprint /datum/wires/explosive/chem_grenade/interactable(mob/user) + if(!..()) + return FALSE var/obj/item/grenade/chem_grenade/G = holder if(G.stage == GRENADE_WIRED) return TRUE @@ -77,9 +79,6 @@ /datum/wires/explosive/c4 // Also includes X4 holder_type = /obj/item/grenade/c4 -/datum/wires/explosive/c4/interactable(mob/user) // No need to unscrew wire panels on plastic explosives - return TRUE - /datum/wires/explosive/c4/explode() var/obj/item/grenade/c4/P = holder P.detonate() @@ -95,6 +94,8 @@ ..() /datum/wires/explosive/pizza/interactable(mob/user) + if(!..()) + return FALSE var/obj/item/pizzabox/P = holder if(P.open && P.bomb) return TRUE diff --git a/code/datums/wires/microwave.dm b/code/datums/wires/microwave.dm index 8c74abfa46c..b89aef6f8c9 100644 --- a/code/datums/wires/microwave.dm +++ b/code/datums/wires/microwave.dm @@ -9,6 +9,8 @@ ..() /datum/wires/microwave/interactable(mob/user) + if(!..()) + return FALSE . = FALSE var/obj/machinery/microwave/M = holder if(M.panel_open) diff --git a/code/datums/wires/mulebot.dm b/code/datums/wires/mulebot.dm index 60721e9c449..ebb6273000e 100644 --- a/code/datums/wires/mulebot.dm +++ b/code/datums/wires/mulebot.dm @@ -13,6 +13,8 @@ ..() /datum/wires/mulebot/interactable(mob/user) + if(!..()) + return FALSE var/mob/living/simple_animal/bot/mulebot/M = holder if(M.open) return TRUE diff --git a/code/datums/wires/r_n_d.dm b/code/datums/wires/r_n_d.dm index eda9a2776e9..9e483b397c9 100644 --- a/code/datums/wires/r_n_d.dm +++ b/code/datums/wires/r_n_d.dm @@ -12,6 +12,8 @@ ..() /datum/wires/rnd/interactable(mob/user) + if(!..()) + return FALSE var/obj/machinery/rnd/R = holder if(R.panel_open) return TRUE diff --git a/code/datums/wires/radio.dm b/code/datums/wires/radio.dm index a1118da6d73..538685aca3a 100644 --- a/code/datums/wires/radio.dm +++ b/code/datums/wires/radio.dm @@ -10,6 +10,8 @@ ..() /datum/wires/radio/interactable(mob/user) + if(!..()) + return FALSE var/obj/item/radio/R = holder return R.unscrewed diff --git a/code/datums/wires/robot.dm b/code/datums/wires/robot.dm index fdb6cf97c38..1768f361274 100644 --- a/code/datums/wires/robot.dm +++ b/code/datums/wires/robot.dm @@ -13,6 +13,8 @@ ..() /datum/wires/robot/interactable(mob/user) + if(!..()) + return FALSE var/mob/living/silicon/robot/R = holder if(R.wiresexposed) return TRUE diff --git a/code/datums/wires/roulette.dm b/code/datums/wires/roulette.dm index 657d19d5846..4d0b08e6bf6 100644 --- a/code/datums/wires/roulette.dm +++ b/code/datums/wires/roulette.dm @@ -13,6 +13,8 @@ ..() /datum/wires/roulette/interactable(mob/user) + if(!..()) + return FALSE . = FALSE var/obj/machinery/roulette/R = holder if(R.machine_stat & MAINT) diff --git a/code/datums/wires/suit_storage_unit.dm b/code/datums/wires/suit_storage_unit.dm index eb7781203b2..be313dca17c 100644 --- a/code/datums/wires/suit_storage_unit.dm +++ b/code/datums/wires/suit_storage_unit.dm @@ -11,6 +11,8 @@ ..() /datum/wires/suit_storage_unit/interactable(mob/user) + if(!..()) + return FALSE var/obj/machinery/suit_storage_unit/SSU = holder if(SSU.panel_open) return TRUE diff --git a/code/datums/wires/syndicatebomb.dm b/code/datums/wires/syndicatebomb.dm index b5147a3c760..72d903e5b11 100644 --- a/code/datums/wires/syndicatebomb.dm +++ b/code/datums/wires/syndicatebomb.dm @@ -11,6 +11,8 @@ ..() /datum/wires/syndicatebomb/interactable(mob/user) + if(!..()) + return FALSE var/obj/machinery/syndicatebomb/P = holder if(P.open_panel) return TRUE diff --git a/code/datums/wires/vending.dm b/code/datums/wires/vending.dm index 6113eaaf307..ce10cf9d500 100644 --- a/code/datums/wires/vending.dm +++ b/code/datums/wires/vending.dm @@ -11,6 +11,8 @@ ..() /datum/wires/vending/interactable(mob/user) + if(!..()) + return FALSE var/obj/machinery/vending/V = holder if(!issilicon(user) && V.seconds_electrified && V.shock(user, 100)) return FALSE diff --git a/code/game/atoms.dm b/code/game/atoms.dm index 7debaf962e6..4c0d3f13608 100644 --- a/code/game/atoms.dm +++ b/code/game/atoms.dm @@ -1354,48 +1354,53 @@ * Must return parent proc ..() in the end if overridden */ /atom/proc/tool_act(mob/living/user, obj/item/I, tool_type, is_right_clicking) + var/act_result var/signal_result if(!is_right_clicking) // Left click first for sensibility var/list/processing_recipes = list() //List of recipes that can be mutated by sending the signal signal_result = SEND_SIGNAL(src, COMSIG_ATOM_TOOL_ACT(tool_type), user, I, processing_recipes) + if(signal_result & COMPONENT_BLOCK_TOOL_ATTACK) // The COMSIG_ATOM_TOOL_ACT signal is blocking the act + return TOOL_ACT_SIGNAL_BLOCKING if(processing_recipes.len) process_recipes(user, I, processing_recipes) if(QDELETED(I)) return TRUE switch(tool_type) if(TOOL_CROWBAR) - . = crowbar_act(user, I,) + act_result = crowbar_act(user, I,) if(TOOL_MULTITOOL) - . = multitool_act(user, I) + act_result = multitool_act(user, I) if(TOOL_SCREWDRIVER) - . = screwdriver_act(user, I) + act_result = screwdriver_act(user, I) if(TOOL_WRENCH) - . = wrench_act(user, I) + act_result = wrench_act(user, I) if(TOOL_WIRECUTTER) - . = wirecutter_act(user, I) + act_result = wirecutter_act(user, I) if(TOOL_WELDER) - . = welder_act(user, I) + act_result = welder_act(user, I) if(TOOL_ANALYZER) - . = analyzer_act(user, I) + act_result = analyzer_act(user, I) else signal_result = SEND_SIGNAL(src, COMSIG_ATOM_SECONDARY_TOOL_ACT(tool_type), user, I) + if(signal_result & COMPONENT_BLOCK_TOOL_ATTACK) // The COMSIG_ATOM_TOOL_ACT signal is blocking the act + return TOOL_ACT_SIGNAL_BLOCKING switch(tool_type) if(TOOL_CROWBAR) - . = crowbar_act_secondary(user, I,) + act_result = crowbar_act_secondary(user, I,) if(TOOL_MULTITOOL) - . = multitool_act_secondary(user, I) + act_result = multitool_act_secondary(user, I) if(TOOL_SCREWDRIVER) - . = screwdriver_act_secondary(user, I) + act_result = screwdriver_act_secondary(user, I) if(TOOL_WRENCH) - . = wrench_act_secondary(user, I) + act_result = wrench_act_secondary(user, I) if(TOOL_WIRECUTTER) - . = wirecutter_act_secondary(user, I) + act_result = wirecutter_act_secondary(user, I) if(TOOL_WELDER) - . = welder_act_secondary(user, I) + act_result = welder_act_secondary(user, I) if(TOOL_ANALYZER) - . = analyzer_act_secondary(user, I) - if(. || signal_result & COMPONENT_BLOCK_TOOL_ATTACK) //Either the proc or the signal handled the tool's events in some way. - return TRUE + act_result = analyzer_act_secondary(user, I) + if(act_result) // A tooltype_act has completed successfully + return TOOL_ACT_TOOLTYPE_SUCCESS /atom/proc/process_recipes(mob/living/user, obj/item/I, list/processing_recipes) diff --git a/code/game/machinery/_machinery.dm b/code/game/machinery/_machinery.dm index 57b98f95871..f5c16b40763 100644 --- a/code/game/machinery/_machinery.dm +++ b/code/game/machinery/_machinery.dm @@ -130,6 +130,10 @@ var/tgui_id // ID of TGUI interface ///Is this machine currently in the atmos machinery queue? var/atmos_processing = FALSE + /// world.time of last use by [/mob/living] + var/last_used_time = 0 + /// Mobtype of last user. Typecast to [/mob/living] for initial() usage + var/mob/living/last_user_mobtype /obj/machinery/Initialize() if(!armor) @@ -344,7 +348,7 @@ if(!isliving(user)) return FALSE //no ghosts in the machine allowed, sorry - if(SEND_SIGNAL(user, COMSIG_TRY_USE_MACHINE, src) & COMPONENT_CANT_USE_MACHINE) + if(SEND_SIGNAL(user, COMSIG_TRY_USE_MACHINE, src) & COMPONENT_CANT_USE_MACHINE_INTERACT) return FALSE var/mob/living/living_user = user @@ -422,10 +426,12 @@ /obj/machinery/interact(mob/user, special_state) if(interaction_flags_machine & INTERACT_MACHINE_SET_MACHINE) user.set_machine(src) + update_last_used(user) . = ..() /obj/machinery/ui_act(action, list/params) add_fingerprint(usr) + update_last_used(usr) return ..() /obj/machinery/Topic(href, href_list) @@ -435,6 +441,7 @@ if(!usr.canUseTopic(src)) return TRUE add_fingerprint(usr) + update_last_used(usr) return FALSE //////////////////////////////////////////////////////////////////////////////////////////// @@ -479,10 +486,30 @@ else return _try_interact(user) +/obj/machinery/attackby(obj/item/weapon, mob/user, params) + . = ..() + if(.) + return + update_last_used(user) + +/obj/machinery/attackby_secondary(obj/item/weapon, mob/user, params) + . = ..() + if(.) + return + update_last_used(user) + +/obj/machinery/tool_act(mob/living/user, obj/item/tool, tool_type) + if(SEND_SIGNAL(user, COMSIG_TRY_USE_MACHINE, src) & COMPONENT_CANT_USE_MACHINE_TOOLS) + return TOOL_ACT_MELEE_CHAIN_BLOCKING + . = ..() + if(. & TOOL_ACT_SIGNAL_BLOCKING) + return + update_last_used(user) + /obj/machinery/_try_interact(mob/user) if((interaction_flags_machine & INTERACT_MACHINE_WIRES_IF_OPEN) && panel_open && (attempt_wire_interaction(user) == WIRE_INTERACTION_BLOCK)) return TRUE - if(SEND_SIGNAL(user, COMSIG_TRY_USE_MACHINE, src) & COMPONENT_CANT_USE_MACHINE) + if(SEND_SIGNAL(user, COMSIG_TRY_USE_MACHINE, src) & COMPONENT_CANT_USE_MACHINE_INTERACT) return TRUE return ..() @@ -779,3 +806,8 @@ var/alertstr = "Network Alert: Hacking attempt detected[get_area(src)?" in [get_area_name(src, TRUE)]":". Unable to pinpoint location"]." for(var/mob/living/silicon/ai/AI in GLOB.player_list) to_chat(AI, alertstr) + +/obj/machinery/proc/update_last_used(mob/user) + if(isliving(user)) + last_used_time = world.time + last_user_mobtype = user.type diff --git a/code/game/objects/items/devices/PDA/PDA.dm b/code/game/objects/items/devices/PDA/PDA.dm index 7996183ede3..a49dd97338d 100644 --- a/code/game/objects/items/devices/PDA/PDA.dm +++ b/code/game/objects/items/devices/PDA/PDA.dm @@ -325,6 +325,9 @@ GLOBAL_LIST_EMPTY(PDAs) dat += "