From 6e9ac75074a0ad2b8fa0645563f26bd68c6434a1 Mon Sep 17 00:00:00 2001 From: Mikhail Dzianishchyts Date: Sun, 10 Mar 2024 23:22:00 +0300 Subject: [PATCH] Machinery changes (#24518) --- code/game/gamemodes/nuclear/nuclearbomb.dm | 2 +- code/game/machinery/machinery.dm | 27 +++++++------------ code/game/machinery/portable_turret.dm | 4 +-- code/game/objects/items/devices/camera_bug.dm | 2 +- .../kitchen_machinery/smartfridge.dm | 4 +-- 5 files changed, 16 insertions(+), 23 deletions(-) diff --git a/code/game/gamemodes/nuclear/nuclearbomb.dm b/code/game/gamemodes/nuclear/nuclearbomb.dm index 8f664e7b9d6..a3410fa61f0 100644 --- a/code/game/gamemodes/nuclear/nuclearbomb.dm +++ b/code/game/gamemodes/nuclear/nuclearbomb.dm @@ -21,7 +21,7 @@ GLOBAL_VAR(bomb_set) flags_2 = NO_MALF_EFFECT_2 | CRITICAL_ATOM_2 anchored = TRUE power_state = NO_POWER_USE - requires_power = FALSE + interact_offline = TRUE /// Are our bolts *supposed* to be in the floor, may not actually cause anchoring if the bolts are cut var/extended = TRUE diff --git a/code/game/machinery/machinery.dm b/code/game/machinery/machinery.dm index e97ceb0bad6..67fc6aa0aab 100644 --- a/code/game/machinery/machinery.dm +++ b/code/game/machinery/machinery.dm @@ -11,8 +11,6 @@ /// How is this machine currently passively consuming power? var/power_state = IDLE_POWER_USE - /// Does this machine require power? - var/requires_power = TRUE /// How much power does this machine consume when it is idling var/idle_power_consumption = 0 /// How much power does this machine consume when it is in use @@ -94,7 +92,7 @@ // returns true if the area has power on given channel (or doesn't require power). // defaults to power_channel /obj/machinery/proc/has_power(channel = power_channel) // defaults to power_channel - if(!requires_power) + if(interact_offline) return TRUE if(!machine_powernet) return FALSE @@ -125,7 +123,7 @@ */ /obj/machinery/proc/power_change() var/old_stat = stat - if(has_power(power_channel) || !requires_power) //if we don't require power, we don't give a shit about the power channel! + if(has_power(power_channel) || interact_offline) //if we don't require power, we don't give a shit about the power channel! stat &= ~NOPOWER else stat |= NOPOWER @@ -185,16 +183,10 @@ return !inoperable(additional_flags) /obj/machinery/proc/inoperable(additional_flags = 0) - return (stat & (NOPOWER|BROKEN|additional_flags)) + return ((!interact_offline && (stat & NOPOWER)) || (stat & (BROKEN|additional_flags))) /obj/machinery/ui_status(mob/user, datum/ui_state/state) - if(!interact_offline && (stat & (NOPOWER|BROKEN))) - return UI_CLOSE - - return ..() - -/obj/machinery/ui_status(mob/user, datum/ui_state/state) - if(!interact_offline && (stat & (NOPOWER|BROKEN))) + if(!is_operational()) return UI_CLOSE return ..() @@ -241,10 +233,10 @@ * * user - the mob interacting with this machinery */ /obj/machinery/proc/try_attack_hand(mob/user) - if(user.incapacitated()) + if(user.incapacitated() && !isobserver(user)) return TRUE - if(!user.IsAdvancedToolUser()) + if(!user.IsAdvancedToolUser() && !isobserver(user)) to_chat(user, "You don't have the dexterity to do this!") return TRUE @@ -258,16 +250,17 @@ return TRUE if(panel_open) - add_fingerprint(user) + if(!isobserver(user)) + add_fingerprint(user) return FALSE - if(!interact_offline && stat & (NOPOWER|BROKEN|MAINT)) + if(!is_operational()) return TRUE return FALSE /obj/machinery/proc/is_operational() - return !(stat & (NOPOWER|BROKEN|MAINT)) + return !inoperable(MAINT) /obj/machinery/CheckParts(list/parts_list) ..() diff --git a/code/game/machinery/portable_turret.dm b/code/game/machinery/portable_turret.dm index 831207d4878..f1deafa2262 100644 --- a/code/game/machinery/portable_turret.dm +++ b/code/game/machinery/portable_turret.dm @@ -1060,7 +1060,7 @@ GLOBAL_LIST_EMPTY(turret_icons) syndicate = TRUE installation = null always_up = TRUE - requires_power = FALSE + interact_offline = TRUE power_state = NO_POWER_USE has_cover = FALSE raised = TRUE @@ -1164,7 +1164,7 @@ GLOBAL_LIST_EMPTY(turret_icons) syndicate = TRUE installation = null always_up = TRUE - requires_power = FALSE + interact_offline = TRUE power_state = NO_POWER_USE has_cover = FALSE raised = TRUE diff --git a/code/game/objects/items/devices/camera_bug.dm b/code/game/objects/items/devices/camera_bug.dm index 9e456005815..439830e01b3 100644 --- a/code/game/objects/items/devices/camera_bug.dm +++ b/code/game/objects/items/devices/camera_bug.dm @@ -17,7 +17,7 @@ name = "invasive camera utility" desc = "How did this get here?! Please report this as a bug to github" power_state = NO_POWER_USE - requires_power = FALSE + interact_offline = TRUE silent_console = TRUE /obj/item/camera_bug/Initialize(mapload) diff --git a/code/modules/food_and_drinks/kitchen_machinery/smartfridge.dm b/code/modules/food_and_drinks/kitchen_machinery/smartfridge.dm index 047fc0ce6bb..09918ab43ed 100644 --- a/code/modules/food_and_drinks/kitchen_machinery/smartfridge.dm +++ b/code/modules/food_and_drinks/kitchen_machinery/smartfridge.dm @@ -465,7 +465,7 @@ icon = 'icons/obj/kitchen.dmi' icon_state = "foodcart" anchored = FALSE - requires_power = FALSE + interact_offline = TRUE power_state = NO_POWER_USE visible_contents = FALSE face_while_pulling = FALSE @@ -821,7 +821,7 @@ desc = "A wooden contraption, used to dry plant products, food and leather." icon = 'icons/obj/hydroponics/equipment.dmi' icon_state = "drying_rack" - requires_power = FALSE + interact_offline = TRUE can_dry = TRUE visible_contents = FALSE light_range_on = null