From 9659fbd0f8e3493f2f2d9510a13d6a1c5c131741 Mon Sep 17 00:00:00 2001 From: SteelSlayer Date: Sun, 31 Jan 2021 10:12:14 -0600 Subject: [PATCH 1/3] atmos-alt-control-click --- code/game/machinery/machinery.dm | 16 +++++++ .../atmospherics/machinery/atmospherics.dm | 35 +++++++++++++++- .../components/binary_devices/dp_vent_pump.dm | 1 - .../components/binary_devices/passive_gate.dm | 8 +--- .../components/binary_devices/pump.dm | 41 +++++------------- .../components/binary_devices/volume_pump.dm | 39 +++++------------ .../components/trinary_devices/filter.dm | 42 ++++++------------- .../components/trinary_devices/mixer.dm | 42 ++++++------------- .../trinary_devices/trinary_base.dm | 1 - .../components/unary_devices/cryo.dm | 1 - .../unary_devices/outlet_injector.dm | 1 - .../unary_devices/oxygen_generator.dm | 2 - .../unary_devices/portables_connector.dm | 2 - .../components/unary_devices/thermomachine.dm | 3 -- .../components/unary_devices/vent_pump.dm | 1 - .../components/unary_devices/vent_scrubber.dm | 1 - 16 files changed, 96 insertions(+), 140 deletions(-) diff --git a/code/game/machinery/machinery.dm b/code/game/machinery/machinery.dm index 901844c0c14..0d1c6ada2d0 100644 --- a/code/game/machinery/machinery.dm +++ b/code/game/machinery/machinery.dm @@ -650,3 +650,19 @@ Class Procs: . = . % 9 AM.pixel_x = -8 + ((.%3)*8) AM.pixel_y = -8 + (round( . / 3)*8) + +/** + * Makes sure the user is allowed to interact with the machine when they use a shortcut, like Control or Alt-clicking. + * + * Arguments: + * * user - the mob who is trying to interact with the machine. + */ +/obj/machinery/proc/can_use_shortcut(mob/living/user) + if(!ishuman(user) && !issilicon(user)) + return FALSE + if(!in_range(src, user) && !issilicon(user)) + return FALSE + if(user.incapacitated()) + to_chat(user, "You can't do that right now!") + return FALSE + return TRUE diff --git a/code/modules/atmospherics/machinery/atmospherics.dm b/code/modules/atmospherics/machinery/atmospherics.dm index 8a77e3908f1..1a877ce857a 100644 --- a/code/modules/atmospherics/machinery/atmospherics.dm +++ b/code/modules/atmospherics/machinery/atmospherics.dm @@ -20,7 +20,10 @@ Pipelines + Other Objects -> Pipe network on_blueprints = TRUE var/nodealert = 0 var/can_unwrench = 0 - + /// If the machine is currently operating or not. + var/on = FALSE + /// The amount of pressure the machine wants to operate at. + var/target_pressure = 0 var/connect_types[] = list(1) //1=regular, 2=supply, 3=scrubber var/connected_to = 1 //same as above, currently not used for anything var/icon_connect_type = "" //"-supply" or "-scrubbers" @@ -353,3 +356,33 @@ Pipelines + Other Objects -> Pipe network //Used for certain children of obj/machinery/atmospherics to not show pipe vision when mob is inside it. /obj/machinery/atmospherics/proc/can_see_pipes() return TRUE + +/** + * Turns the machine either on, or off. If this is done by a user, display a message to them. + * + * NOTE: Only applies to atmospherics machines which can be toggled on or off, such as pumps, or other devices. + * + * Arguments: + * * user - the mob who is toggling the machine. + */ +/obj/machinery/atmospherics/proc/toggle(mob/living/user) + if(powered()) + on = !on + update_icon() + if(user) + to_chat(user, "You toggle [src] [on ? "on" : "off"].") + +/** + * Maxes the output pressure of the machine. If this is done by a user, display a message to them. + * + * NOTE: Only applies to atmospherics machines which allow a `target_pressure` to be set, such as pumps, or other devices. + * + * Arguments: + * * user - the mob who is setting the output pressure to maximum. + */ +/obj/machinery/atmospherics/proc/set_max(mob/living/user) + if(powered()) + target_pressure = MAX_OUTPUT_PRESSURE + update_icon() + if(user) + to_chat(user, "You set the target pressure of [src] to maximum.") diff --git a/code/modules/atmospherics/machinery/components/binary_devices/dp_vent_pump.dm b/code/modules/atmospherics/machinery/components/binary_devices/dp_vent_pump.dm index 7f2cae91027..b81fb88ee67 100644 --- a/code/modules/atmospherics/machinery/components/binary_devices/dp_vent_pump.dm +++ b/code/modules/atmospherics/machinery/components/binary_devices/dp_vent_pump.dm @@ -16,7 +16,6 @@ connect_types = list(1,2,3) //connects to regular, supply and scrubbers pipes - var/on = 0 var/pump_direction = 1 //0 = siphoning, 1 = releasing var/external_pressure_bound = ONE_ATMOSPHERE diff --git a/code/modules/atmospherics/machinery/components/binary_devices/passive_gate.dm b/code/modules/atmospherics/machinery/components/binary_devices/passive_gate.dm index 087172d74e9..1b1443f7853 100644 --- a/code/modules/atmospherics/machinery/components/binary_devices/passive_gate.dm +++ b/code/modules/atmospherics/machinery/components/binary_devices/passive_gate.dm @@ -9,8 +9,7 @@ can_unwrench = 1 - var/on = 0 - var/target_pressure = ONE_ATMOSPHERE + target_pressure = ONE_ATMOSPHERE var/id = null @@ -174,11 +173,6 @@ if(.) investigate_log("was set to [target_pressure] kPa by [key_name(usr)]", "atmos") -/obj/machinery/atmospherics/binary/passive_gate/proc/toggle() - if(powered()) - on = !on - update_icon() - /obj/machinery/atmospherics/binary/passive_gate/attackby(obj/item/W, mob/user, params) if(!istype(W, /obj/item/wrench)) return ..() diff --git a/code/modules/atmospherics/machinery/components/binary_devices/pump.dm b/code/modules/atmospherics/machinery/components/binary_devices/pump.dm index 2527bec07da..9303dee01d9 100644 --- a/code/modules/atmospherics/machinery/components/binary_devices/pump.dm +++ b/code/modules/atmospherics/machinery/components/binary_devices/pump.dm @@ -21,54 +21,35 @@ Thus, the two variables affect pump operation are set in New(): can_unwrench = 1 - var/on = 0 - var/target_pressure = ONE_ATMOSPHERE + target_pressure = ONE_ATMOSPHERE var/id = null /obj/machinery/atmospherics/binary/pump/detailed_examine() return "This moves gas from one pipe to another. A higher target pressure demands more energy. The side with the red end is the output." +// So we can CtrlClick without triggering the anchored message. +/obj/machinery/atmospherics/binary/pump/can_be_pulled(user, grab_state, force, show_message) + return FALSE + /obj/machinery/atmospherics/binary/pump/CtrlClick(mob/living/user) - if(!istype(user) || user.incapacitated()) - to_chat(user, "You can't do that right now!") - return - if(!in_range(src, user) && !issilicon(usr)) - return - if(!ishuman(usr) && !issilicon(usr)) - return - toggle() + if(can_use_shortcut(user)) + toggle(user) return ..() -/obj/machinery/atmospherics/binary/pump/AICtrlClick() - toggle() +/obj/machinery/atmospherics/binary/pump/AICtrlClick(mob/living/silicon/user) + toggle(user) return ..() /obj/machinery/atmospherics/binary/pump/AltClick(mob/living/user) - if(!istype(user) || user.incapacitated()) - to_chat(user, "You can't do that right now!") - return - if(!in_range(src, user) && !issilicon(usr)) - return - if(!ishuman(usr) && !issilicon(usr)) - return - set_max() + if(can_use_shortcut(user)) + set_max(user) return /obj/machinery/atmospherics/binary/pump/AIAltClick() set_max() return ..() -/obj/machinery/atmospherics/binary/pump/proc/toggle() - if(powered()) - on = !on - update_icon() - -/obj/machinery/atmospherics/binary/pump/proc/set_max() - if(powered()) - target_pressure = MAX_OUTPUT_PRESSURE - update_icon() - /obj/machinery/atmospherics/binary/pump/Destroy() if(SSradio) SSradio.remove_object(src, frequency) diff --git a/code/modules/atmospherics/machinery/components/binary_devices/volume_pump.dm b/code/modules/atmospherics/machinery/components/binary_devices/volume_pump.dm index 05918fa1226..21225229738 100644 --- a/code/modules/atmospherics/machinery/components/binary_devices/volume_pump.dm +++ b/code/modules/atmospherics/machinery/components/binary_devices/volume_pump.dm @@ -21,51 +21,32 @@ Thus, the two variables affect pump operation are set in New(): can_unwrench = 1 - var/on = 0 var/transfer_rate = 200 var/id = null +// So we can CtrlClick without triggering the anchored message. +/obj/machinery/atmospherics/binary/volume_pump/can_be_pulled(user, grab_state, force, show_message) + return FALSE + /obj/machinery/atmospherics/binary/volume_pump/CtrlClick(mob/living/user) - if(!istype(user) || user.incapacitated()) - to_chat(user, "You can't do that right now!") - return - if(!in_range(src, user) && !issilicon(usr)) - return - if(!ishuman(usr) && !issilicon(usr)) - return - toggle() + if(can_use_shortcut(user)) + toggle(user) return ..() -/obj/machinery/atmospherics/binary/volume_pump/AICtrlClick() - toggle() +/obj/machinery/atmospherics/binary/volume_pump/AICtrlClick(mob/living/silicon/user) + toggle(user) return ..() /obj/machinery/atmospherics/binary/volume_pump/AltClick(mob/living/user) - if(!istype(user) || user.incapacitated()) - to_chat(user, "You can't do that right now!") - return - if(!in_range(src, user) && !issilicon(usr)) - return - if(!ishuman(usr) && !issilicon(usr)) - return - set_max() + if(can_use_shortcut(user)) + set_max(user) return /obj/machinery/atmospherics/binary/volume_pump/AIAltClick() set_max() return ..() -/obj/machinery/atmospherics/binary/volume_pump/proc/toggle() - if(powered()) - on = !on - update_icon() - -/obj/machinery/atmospherics/binary/volume_pump/proc/set_max() - if(powered()) - transfer_rate = MAX_TRANSFER_RATE - update_icon() - /obj/machinery/atmospherics/binary/volume_pump/Destroy() if(SSradio) SSradio.remove_object(src, frequency) diff --git a/code/modules/atmospherics/machinery/components/trinary_devices/filter.dm b/code/modules/atmospherics/machinery/components/trinary_devices/filter.dm index ff2b3a485a4..2043220ef77 100644 --- a/code/modules/atmospherics/machinery/components/trinary_devices/filter.dm +++ b/code/modules/atmospherics/machinery/components/trinary_devices/filter.dm @@ -17,8 +17,8 @@ icon = 'icons/atmos/filter.dmi' icon_state = "map" can_unwrench = TRUE - /// The amount of pressure the filter wants to operate at. - var/target_pressure = ONE_ATMOSPHERE + + target_pressure = ONE_ATMOSPHERE /// The type of gas we want to filter. Valid values that go here are from the `FILTER` defines at the top of the file. var/filter_type = FILTER_TOXINS /// A list of available filter options. Used with `ui_data`. @@ -31,46 +31,28 @@ "N2O" = FILTER_N2O ) +// So we can CtrlClick without triggering the anchored message. +/obj/machinery/atmospherics/trinary/filter/can_be_pulled(user, grab_state, force, show_message) + return FALSE + /obj/machinery/atmospherics/trinary/filter/CtrlClick(mob/living/user) - if(!istype(user) || user.incapacitated()) - to_chat(user, "You can't do that right now!") - return - if(!in_range(src, user) && !issilicon(usr)) - return - if(!ishuman(usr) && !issilicon(usr)) - return - toggle() + if(can_use_shortcut(user)) + toggle(user) return ..() -/obj/machinery/atmospherics/trinary/filter/AICtrlClick() - toggle() +/obj/machinery/atmospherics/trinary/filter/AICtrlClick(mob/living/silicon/user) + toggle(user) return ..() /obj/machinery/atmospherics/trinary/filter/AltClick(mob/living/user) - if(!istype(user) || user.incapacitated()) - to_chat(user, "You can't do that right now!") - return - if(!in_range(src, user) && !issilicon(usr)) - return - if(!ishuman(usr) && !issilicon(usr)) - return - set_max() + if(can_use_shortcut(user)) + set_max(user) return /obj/machinery/atmospherics/trinary/filter/AIAltClick() set_max() return ..() -/obj/machinery/atmospherics/trinary/filter/proc/toggle() - if(powered()) - on = !on - update_icon() - -/obj/machinery/atmospherics/trinary/filter/proc/set_max() - if(powered()) - target_pressure = MAX_OUTPUT_PRESSURE - update_icon() - /obj/machinery/atmospherics/trinary/filter/Destroy() if(SSradio) SSradio.remove_object(src, frequency) diff --git a/code/modules/atmospherics/machinery/components/trinary_devices/mixer.dm b/code/modules/atmospherics/machinery/components/trinary_devices/mixer.dm index 5db62c29b7f..39c7c73aba1 100644 --- a/code/modules/atmospherics/machinery/components/trinary_devices/mixer.dm +++ b/code/modules/atmospherics/machinery/components/trinary_devices/mixer.dm @@ -6,37 +6,29 @@ name = "gas mixer" - var/target_pressure = ONE_ATMOSPHERE + target_pressure = ONE_ATMOSPHERE var/node1_concentration = 0.5 var/node2_concentration = 0.5 //node 3 is the outlet, nodes 1 & 2 are intakes +// So we can CtrlClick without triggering the anchored message. +/obj/machinery/atmospherics/trinary/mixer/can_be_pulled(user, grab_state, force, show_message) + return FALSE + /obj/machinery/atmospherics/trinary/mixer/CtrlClick(mob/living/user) - if(!istype(user) || user.incapacitated()) - to_chat(user, "You can't do that right now!") - return - if(!in_range(src, user) && !issilicon(usr)) - return - if(!ishuman(usr) && !issilicon(usr)) - return - toggle() + if(can_use_shortcut(user)) + toggle(user) return ..() -/obj/machinery/atmospherics/trinary/mixer/AICtrlClick() - toggle() +/obj/machinery/atmospherics/trinary/mixer/AICtrlClick(mob/living/silicon/user) + toggle(user) return ..() /obj/machinery/atmospherics/trinary/mixer/AltClick(mob/living/user) - if(!istype(user) || user.incapacitated()) - to_chat(user, "You can't do that right now!") - return - if(!in_range(src, user) && !issilicon(usr)) - return - if(!ishuman(usr) && !issilicon(usr)) - return - set_max() - return + if(can_use_shortcut(user)) + set_max(user) + return ..() /obj/machinery/atmospherics/trinary/mixer/AIAltClick() set_max() @@ -46,16 +38,6 @@ icon_state = "mmap" flipped = 1 -/obj/machinery/atmospherics/trinary/mixer/proc/toggle() - if(powered()) - on = !on - update_icon() - -/obj/machinery/atmospherics/trinary/mixer/proc/set_max() - if(powered()) - target_pressure = MAX_OUTPUT_PRESSURE - update_icon() - /obj/machinery/atmospherics/trinary/mixer/update_icon(safety = 0) ..() diff --git a/code/modules/atmospherics/machinery/components/trinary_devices/trinary_base.dm b/code/modules/atmospherics/machinery/components/trinary_devices/trinary_base.dm index 5b54f0ff91c..86b1aa74699 100644 --- a/code/modules/atmospherics/machinery/components/trinary_devices/trinary_base.dm +++ b/code/modules/atmospherics/machinery/components/trinary_devices/trinary_base.dm @@ -3,7 +3,6 @@ initialize_directions = SOUTH|NORTH|WEST use_power = IDLE_POWER_USE - var/on = 0 layer = GAS_FILTER_LAYER var/datum/gas_mixture/air1 diff --git a/code/modules/atmospherics/machinery/components/unary_devices/cryo.dm b/code/modules/atmospherics/machinery/components/unary_devices/cryo.dm index 1452ab48b2f..b227fc64c70 100644 --- a/code/modules/atmospherics/machinery/components/unary_devices/cryo.dm +++ b/code/modules/atmospherics/machinery/components/unary_devices/cryo.dm @@ -13,7 +13,6 @@ interact_offline = 1 max_integrity = 350 armor = list("melee" = 0, "bullet" = 0, "laser" = 0, "energy" = 100, "bomb" = 0, "bio" = 100, "rad" = 100, "fire" = 30, "acid" = 30) - var/on = FALSE var/temperature_archived var/mob/living/carbon/occupant = null var/obj/item/reagent_containers/glass/beaker = null diff --git a/code/modules/atmospherics/machinery/components/unary_devices/outlet_injector.dm b/code/modules/atmospherics/machinery/components/unary_devices/outlet_injector.dm index 29e3db67ca2..f1bf25957d8 100644 --- a/code/modules/atmospherics/machinery/components/unary_devices/outlet_injector.dm +++ b/code/modules/atmospherics/machinery/components/unary_devices/outlet_injector.dm @@ -13,7 +13,6 @@ req_one_access_txt = "24;10" - var/on = 0 var/injecting = 0 var/volume_rate = 50 diff --git a/code/modules/atmospherics/machinery/components/unary_devices/oxygen_generator.dm b/code/modules/atmospherics/machinery/components/unary_devices/oxygen_generator.dm index 9b06019e49e..fdeb02b7b83 100644 --- a/code/modules/atmospherics/machinery/components/unary_devices/oxygen_generator.dm +++ b/code/modules/atmospherics/machinery/components/unary_devices/oxygen_generator.dm @@ -9,8 +9,6 @@ dir = SOUTH initialize_directions = SOUTH - var/on = 0 - var/oxygen_content = 10 /obj/machinery/atmospherics/unary/oxygen_generator/update_icon() diff --git a/code/modules/atmospherics/machinery/components/unary_devices/portables_connector.dm b/code/modules/atmospherics/machinery/components/unary_devices/portables_connector.dm index eadd1bac280..64aaa045c8f 100644 --- a/code/modules/atmospherics/machinery/components/unary_devices/portables_connector.dm +++ b/code/modules/atmospherics/machinery/components/unary_devices/portables_connector.dm @@ -10,8 +10,6 @@ var/obj/machinery/portable_atmospherics/connected_device - var/on = 0 - /obj/machinery/atmospherics/unary/portables_connector/Destroy() if(connected_device) connected_device.disconnect() diff --git a/code/modules/atmospherics/machinery/components/unary_devices/thermomachine.dm b/code/modules/atmospherics/machinery/components/unary_devices/thermomachine.dm index 7a3bedf9271..aca2e02aff0 100644 --- a/code/modules/atmospherics/machinery/components/unary_devices/thermomachine.dm +++ b/code/modules/atmospherics/machinery/components/unary_devices/thermomachine.dm @@ -10,9 +10,6 @@ armor = list("melee" = 0, "bullet" = 0, "laser" = 0, "energy" = 100, "bomb" = 0, "bio" = 100, "rad" = 100, "fire" = 80, "acid" = 30) layer = OBJ_LAYER - ///Check if the device should be on or off - var/on = FALSE - var/icon_state_off = "freezer" var/icon_state_on = "freezer_1" var/icon_state_open = "freezer-o" diff --git a/code/modules/atmospherics/machinery/components/unary_devices/vent_pump.dm b/code/modules/atmospherics/machinery/components/unary_devices/vent_pump.dm index 74c8be45b1b..35e9a84e932 100644 --- a/code/modules/atmospherics/machinery/components/unary_devices/vent_pump.dm +++ b/code/modules/atmospherics/machinery/components/unary_devices/vent_pump.dm @@ -20,7 +20,6 @@ req_one_access_txt = "24;10" - var/on = 0 var/pump_direction = 1 //0 = siphoning, 1 = releasing var/external_pressure_bound = EXTERNAL_PRESSURE_BOUND diff --git a/code/modules/atmospherics/machinery/components/unary_devices/vent_scrubber.dm b/code/modules/atmospherics/machinery/components/unary_devices/vent_scrubber.dm index 618dd1bc355..d006ae874f3 100644 --- a/code/modules/atmospherics/machinery/components/unary_devices/vent_scrubber.dm +++ b/code/modules/atmospherics/machinery/components/unary_devices/vent_scrubber.dm @@ -20,7 +20,6 @@ var/list/turf/simulated/adjacent_turfs = list() - var/on = 0 var/scrubbing = 1 //0 = siphoning, 1 = scrubbing var/scrub_O2 = 0 var/scrub_N2 = 0 From c18c177002c174e54b1c2b4fea60020b41f0d767 Mon Sep 17 00:00:00 2001 From: SteelSlayer Date: Sun, 31 Jan 2021 17:21:49 -0600 Subject: [PATCH 2/3] remove useless returns --- .../atmospherics/machinery/components/binary_devices/pump.dm | 1 - .../machinery/components/binary_devices/volume_pump.dm | 1 - .../atmospherics/machinery/components/trinary_devices/filter.dm | 1 - .../atmospherics/machinery/components/trinary_devices/mixer.dm | 1 - 4 files changed, 4 deletions(-) diff --git a/code/modules/atmospherics/machinery/components/binary_devices/pump.dm b/code/modules/atmospherics/machinery/components/binary_devices/pump.dm index 9303dee01d9..63cc657dfb6 100644 --- a/code/modules/atmospherics/machinery/components/binary_devices/pump.dm +++ b/code/modules/atmospherics/machinery/components/binary_devices/pump.dm @@ -44,7 +44,6 @@ Thus, the two variables affect pump operation are set in New(): /obj/machinery/atmospherics/binary/pump/AltClick(mob/living/user) if(can_use_shortcut(user)) set_max(user) - return /obj/machinery/atmospherics/binary/pump/AIAltClick() set_max() diff --git a/code/modules/atmospherics/machinery/components/binary_devices/volume_pump.dm b/code/modules/atmospherics/machinery/components/binary_devices/volume_pump.dm index 21225229738..641b492f009 100644 --- a/code/modules/atmospherics/machinery/components/binary_devices/volume_pump.dm +++ b/code/modules/atmospherics/machinery/components/binary_devices/volume_pump.dm @@ -41,7 +41,6 @@ Thus, the two variables affect pump operation are set in New(): /obj/machinery/atmospherics/binary/volume_pump/AltClick(mob/living/user) if(can_use_shortcut(user)) set_max(user) - return /obj/machinery/atmospherics/binary/volume_pump/AIAltClick() set_max() diff --git a/code/modules/atmospherics/machinery/components/trinary_devices/filter.dm b/code/modules/atmospherics/machinery/components/trinary_devices/filter.dm index 2043220ef77..14b802ec19c 100644 --- a/code/modules/atmospherics/machinery/components/trinary_devices/filter.dm +++ b/code/modules/atmospherics/machinery/components/trinary_devices/filter.dm @@ -47,7 +47,6 @@ /obj/machinery/atmospherics/trinary/filter/AltClick(mob/living/user) if(can_use_shortcut(user)) set_max(user) - return /obj/machinery/atmospherics/trinary/filter/AIAltClick() set_max() diff --git a/code/modules/atmospherics/machinery/components/trinary_devices/mixer.dm b/code/modules/atmospherics/machinery/components/trinary_devices/mixer.dm index 39c7c73aba1..3e42cf411cd 100644 --- a/code/modules/atmospherics/machinery/components/trinary_devices/mixer.dm +++ b/code/modules/atmospherics/machinery/components/trinary_devices/mixer.dm @@ -28,7 +28,6 @@ /obj/machinery/atmospherics/trinary/mixer/AltClick(mob/living/user) if(can_use_shortcut(user)) set_max(user) - return ..() /obj/machinery/atmospherics/trinary/mixer/AIAltClick() set_max() From d5ecfc3ae4dcd252e639fe3383dbe4ad72d66ead Mon Sep 17 00:00:00 2001 From: SteelSlayer Date: Sat, 24 Jul 2021 14:59:19 -0500 Subject: [PATCH 3/3] sabre changes --- code/game/machinery/machinery.dm | 10 +++++----- .../modules/atmospherics/machinery/atmospherics.dm | 14 ++++++++------ .../machinery/components/binary_devices/pump.dm | 6 ++---- .../components/binary_devices/volume_pump.dm | 6 ++---- .../machinery/components/trinary_devices/filter.dm | 6 ++---- .../machinery/components/trinary_devices/mixer.dm | 6 ++---- 6 files changed, 21 insertions(+), 27 deletions(-) diff --git a/code/game/machinery/machinery.dm b/code/game/machinery/machinery.dm index 0d1c6ada2d0..154f094d941 100644 --- a/code/game/machinery/machinery.dm +++ b/code/game/machinery/machinery.dm @@ -658,11 +658,11 @@ Class Procs: * * user - the mob who is trying to interact with the machine. */ /obj/machinery/proc/can_use_shortcut(mob/living/user) - if(!ishuman(user) && !issilicon(user)) - return FALSE - if(!in_range(src, user) && !issilicon(user)) - return FALSE if(user.incapacitated()) to_chat(user, "You can't do that right now!") return FALSE - return TRUE + if(ishuman(user) && in_range(src, user)) + return TRUE + if(issilicon(user)) + return TRUE + return FALSE diff --git a/code/modules/atmospherics/machinery/atmospherics.dm b/code/modules/atmospherics/machinery/atmospherics.dm index 1a877ce857a..bb255692633 100644 --- a/code/modules/atmospherics/machinery/atmospherics.dm +++ b/code/modules/atmospherics/machinery/atmospherics.dm @@ -366,9 +366,10 @@ Pipelines + Other Objects -> Pipe network * * user - the mob who is toggling the machine. */ /obj/machinery/atmospherics/proc/toggle(mob/living/user) - if(powered()) - on = !on - update_icon() + if(!powered()) + return + on = !on + update_icon() if(user) to_chat(user, "You toggle [src] [on ? "on" : "off"].") @@ -381,8 +382,9 @@ Pipelines + Other Objects -> Pipe network * * user - the mob who is setting the output pressure to maximum. */ /obj/machinery/atmospherics/proc/set_max(mob/living/user) - if(powered()) - target_pressure = MAX_OUTPUT_PRESSURE - update_icon() + if(!powered()) + return + target_pressure = MAX_OUTPUT_PRESSURE + update_icon() if(user) to_chat(user, "You set the target pressure of [src] to maximum.") diff --git a/code/modules/atmospherics/machinery/components/binary_devices/pump.dm b/code/modules/atmospherics/machinery/components/binary_devices/pump.dm index 63cc657dfb6..e6fb4f66f8c 100644 --- a/code/modules/atmospherics/machinery/components/binary_devices/pump.dm +++ b/code/modules/atmospherics/machinery/components/binary_devices/pump.dm @@ -39,15 +39,13 @@ Thus, the two variables affect pump operation are set in New(): /obj/machinery/atmospherics/binary/pump/AICtrlClick(mob/living/silicon/user) toggle(user) - return ..() /obj/machinery/atmospherics/binary/pump/AltClick(mob/living/user) if(can_use_shortcut(user)) set_max(user) -/obj/machinery/atmospherics/binary/pump/AIAltClick() - set_max() - return ..() +/obj/machinery/atmospherics/binary/pump/AIAltClick(mob/living/silicon/user) + set_max(user) /obj/machinery/atmospherics/binary/pump/Destroy() if(SSradio) diff --git a/code/modules/atmospherics/machinery/components/binary_devices/volume_pump.dm b/code/modules/atmospherics/machinery/components/binary_devices/volume_pump.dm index 641b492f009..f7e50707cdb 100644 --- a/code/modules/atmospherics/machinery/components/binary_devices/volume_pump.dm +++ b/code/modules/atmospherics/machinery/components/binary_devices/volume_pump.dm @@ -36,15 +36,13 @@ Thus, the two variables affect pump operation are set in New(): /obj/machinery/atmospherics/binary/volume_pump/AICtrlClick(mob/living/silicon/user) toggle(user) - return ..() /obj/machinery/atmospherics/binary/volume_pump/AltClick(mob/living/user) if(can_use_shortcut(user)) set_max(user) -/obj/machinery/atmospherics/binary/volume_pump/AIAltClick() - set_max() - return ..() +/obj/machinery/atmospherics/binary/volume_pump/AIAltClick(mob/living/silicon/user) + set_max(user) /obj/machinery/atmospherics/binary/volume_pump/Destroy() if(SSradio) diff --git a/code/modules/atmospherics/machinery/components/trinary_devices/filter.dm b/code/modules/atmospherics/machinery/components/trinary_devices/filter.dm index 14b802ec19c..f40ecda9147 100644 --- a/code/modules/atmospherics/machinery/components/trinary_devices/filter.dm +++ b/code/modules/atmospherics/machinery/components/trinary_devices/filter.dm @@ -42,15 +42,13 @@ /obj/machinery/atmospherics/trinary/filter/AICtrlClick(mob/living/silicon/user) toggle(user) - return ..() /obj/machinery/atmospherics/trinary/filter/AltClick(mob/living/user) if(can_use_shortcut(user)) set_max(user) -/obj/machinery/atmospherics/trinary/filter/AIAltClick() - set_max() - return ..() +/obj/machinery/atmospherics/trinary/filter/AIAltClick(mob/living/silicon/user) + set_max(user) /obj/machinery/atmospherics/trinary/filter/Destroy() if(SSradio) diff --git a/code/modules/atmospherics/machinery/components/trinary_devices/mixer.dm b/code/modules/atmospherics/machinery/components/trinary_devices/mixer.dm index 3e42cf411cd..3b34a95c1ba 100644 --- a/code/modules/atmospherics/machinery/components/trinary_devices/mixer.dm +++ b/code/modules/atmospherics/machinery/components/trinary_devices/mixer.dm @@ -23,15 +23,13 @@ /obj/machinery/atmospherics/trinary/mixer/AICtrlClick(mob/living/silicon/user) toggle(user) - return ..() /obj/machinery/atmospherics/trinary/mixer/AltClick(mob/living/user) if(can_use_shortcut(user)) set_max(user) -/obj/machinery/atmospherics/trinary/mixer/AIAltClick() - set_max() - return ..() +/obj/machinery/atmospherics/trinary/mixer/AIAltClick(mob/living/silicon/user) + set_max(user) /obj/machinery/atmospherics/trinary/mixer/flipped icon_state = "mmap"