From b52ce868bc3000cec4f7488f0fcee5f2dbec028f Mon Sep 17 00:00:00 2001 From: John Willard <53777086+JohnFulpWillard@users.noreply.github.com> Date: Thu, 9 Nov 2023 18:13:09 -0500 Subject: [PATCH] Cuts down on unnecessary non-TGUI stuff (#79590) ## About The Pull Request Removes INTERACT_MACHINE_SET_MACHINE on machines that don't use a non-TGUI UI. Removes set_machine from TGUI things that forgot to remove them previously. Decouples advanced camera consoles from UI procs since it doesn't actually use one. ## Why It's Good For The Game TGUI machines don't need to be using these procs and vars, and this makes it more clear what does and doesn't use a TGUI menu from a glance. I explain it a bit better [here](https://hackmd.io/XLt5MoRvRxuhFbwtk4VAUA) if you're interested. ## Changelog No player-facing changes. --- code/__DEFINES/interaction_flags.dm | 3 +-- code/game/machinery/_machinery.dm | 2 +- code/game/machinery/computer/_computer.dm | 2 +- code/game/machinery/computer/arcade/arcade.dm | 4 +++- code/game/machinery/computer/arena.dm | 3 +++ code/game/machinery/computer/camera.dm | 2 +- .../machinery/computer/camera_advanced.dm | 20 +++++++++---------- code/game/machinery/computer/dna_console.dm | 1 - .../machinery/computer/prisoner/_prisoner.dm | 1 + .../embedded_controller/access_controller.dm | 1 + .../newscaster/newscaster_machine.dm | 2 +- .../objects/items/devices/radio/headset.dm | 3 --- .../fugitive/hunters/hunter_gear.dm | 2 +- code/modules/assembly/assembly.dm | 10 ---------- .../components/binary_devices/passive_gate.dm | 2 +- .../food_and_drinks/machinery/icecream_vat.dm | 1 + .../food_and_drinks/machinery/microwave.dm | 1 - code/modules/mining/machine_processing.dm | 1 + code/modules/mining/machine_silo.dm | 1 + code/modules/mining/satchel_ore_boxdm.dm | 2 -- code/modules/pai/card.dm | 2 -- code/modules/research/experimentor.dm | 1 + .../modules/research/machinery/_production.dm | 3 --- code/modules/shuttle/computer.dm | 2 +- .../modules/vehicles/mecha/mech_fabricator.dm | 3 --- 25 files changed, 29 insertions(+), 46 deletions(-) diff --git a/code/__DEFINES/interaction_flags.dm b/code/__DEFINES/interaction_flags.dm index 0b4e9588729..55732f2364b 100644 --- a/code/__DEFINES/interaction_flags.dm +++ b/code/__DEFINES/interaction_flags.dm @@ -36,9 +36,8 @@ #define INTERACT_MACHINE_OPEN_SILICON (1<<4) /// must be silicon to interact #define INTERACT_MACHINE_REQUIRES_SILICON (1<<5) -/// MACHINES HAVE THIS BY DEFAULT, SOMEONE SHOULD RUN THROUGH MACHINES AND REMOVE IT FROM THINGS LIKE LIGHT SWITCHES WHEN POSSIBLE!!-------------------------- /// This flag determines if a machine set_machine's the user when the user uses it, making updateUsrDialog make the user re-call interact() on it. -/// THIS FLAG IS ON ALL MACHINES BY DEFAULT, NEEDS TO BE RE-EVALUATED LATER!! +/// This is exclusively used for non-TGUI UIs, and its instances should be removed when moved to TGUI. #define INTERACT_MACHINE_SET_MACHINE (1<<6) /// the user must have vision to interact (blind people need not apply) #define INTERACT_MACHINE_REQUIRES_SIGHT (1<<7) diff --git a/code/game/machinery/_machinery.dm b/code/game/machinery/_machinery.dm index 73cb9405126..90cb2b9e665 100644 --- a/code/game/machinery/_machinery.dm +++ b/code/game/machinery/_machinery.dm @@ -131,7 +131,7 @@ var/subsystem_type = /datum/controller/subsystem/machines var/obj/item/circuitboard/circuit // Circuit to be created and inserted when the machinery is created - var/interaction_flags_machine = INTERACT_MACHINE_WIRES_IF_OPEN|INTERACT_MACHINE_ALLOW_SILICON|INTERACT_MACHINE_OPEN_SILICON|INTERACT_MACHINE_SET_MACHINE + var/interaction_flags_machine = INTERACT_MACHINE_WIRES_IF_OPEN|INTERACT_MACHINE_ALLOW_SILICON|INTERACT_MACHINE_OPEN_SILICON var/fair_market_price = 69 var/market_verb = "Customer" var/payment_department = ACCOUNT_ENG diff --git a/code/game/machinery/computer/_computer.dm b/code/game/machinery/computer/_computer.dm index 1b10a7f2264..33e5ce26234 100644 --- a/code/game/machinery/computer/_computer.dm +++ b/code/game/machinery/computer/_computer.dm @@ -6,7 +6,7 @@ max_integrity = 200 integrity_failure = 0.5 armor_type = /datum/armor/machinery_computer - interaction_flags_machine = INTERACT_MACHINE_ALLOW_SILICON|INTERACT_MACHINE_SET_MACHINE|INTERACT_MACHINE_REQUIRES_LITERACY + interaction_flags_machine = INTERACT_MACHINE_ALLOW_SILICON|INTERACT_MACHINE_REQUIRES_LITERACY /// How bright we are when turned on. var/brightness_on = 1 /// Icon_state of the keyboard overlay. diff --git a/code/game/machinery/computer/arcade/arcade.dm b/code/game/machinery/computer/arcade/arcade.dm index 58a7280e864..9ff935a9165 100644 --- a/code/game/machinery/computer/arcade/arcade.dm +++ b/code/game/machinery/computer/arcade/arcade.dm @@ -77,7 +77,7 @@ GLOBAL_LIST_INIT(arcade_prize_pool, list( icon_keyboard = null icon_screen = "invaders" light_color = LIGHT_COLOR_GREEN - interaction_flags_machine = INTERACT_MACHINE_ALLOW_SILICON|INTERACT_MACHINE_SET_MACHINE // we don't need to be literate to play video games fam + interaction_flags_machine = INTERACT_MACHINE_ALLOW_SILICON var/list/prize_override /obj/machinery/computer/arcade/proc/Reset() @@ -157,6 +157,8 @@ GLOBAL_LIST_INIT(arcade_prize_pool, list( icon_state = "arcade" circuit = /obj/item/circuitboard/computer/arcade/battle + interaction_flags_machine = INTERACT_MACHINE_ALLOW_SILICON|INTERACT_MACHINE_SET_MACHINE // we don't need to be literate to play video games fam + var/enemy_name = "Space Villain" ///Enemy health/attack points var/enemy_hp = 100 diff --git a/code/game/machinery/computer/arena.dm b/code/game/machinery/computer/arena.dm index 39b39af197b..1ba000fa5da 100644 --- a/code/game/machinery/computer/arena.dm +++ b/code/game/machinery/computer/arena.dm @@ -21,6 +21,9 @@ /// Controller for admin event arenas /obj/machinery/computer/arena name = "arena controller" + + interaction_flags_machine = INTERACT_MACHINE_ALLOW_SILICON|INTERACT_MACHINE_SET_MACHINE|INTERACT_MACHINE_REQUIRES_LITERACY + /// Arena ID var/arena_id = ARENA_DEFAULT_ID /// Enables/disables spawning diff --git a/code/game/machinery/computer/camera.dm b/code/game/machinery/computer/camera.dm index 6bc5c6f60d2..a1a1fe0ada2 100644 --- a/code/game/machinery/computer/camera.dm +++ b/code/game/machinery/computer/camera.dm @@ -19,7 +19,7 @@ /// All the plane masters that need to be applied. var/atom/movable/screen/background/cam_background - interaction_flags_machine = INTERACT_MACHINE_ALLOW_SILICON|INTERACT_MACHINE_SET_MACHINE|INTERACT_MACHINE_REQUIRES_SIGHT + interaction_flags_machine = INTERACT_MACHINE_ALLOW_SILICON|INTERACT_MACHINE_REQUIRES_SIGHT /obj/machinery/computer/security/Initialize(mapload) . = ..() diff --git a/code/game/machinery/computer/camera_advanced.dm b/code/game/machinery/computer/camera_advanced.dm index 870f64dd575..4750feb3b9b 100644 --- a/code/game/machinery/computer/camera_advanced.dm +++ b/code/game/machinery/computer/camera_advanced.dm @@ -24,7 +24,7 @@ ///Should we supress any view changes? var/should_supress_view_changes = TRUE - interaction_flags_machine = INTERACT_MACHINE_ALLOW_SILICON | INTERACT_MACHINE_SET_MACHINE | INTERACT_MACHINE_REQUIRES_SIGHT + interaction_flags_machine = INTERACT_MACHINE_ALLOW_SILICON | INTERACT_MACHINE_REQUIRES_SIGHT /obj/machinery/computer/camera_advanced/Initialize(mapload) . = ..() @@ -76,12 +76,10 @@ /obj/machinery/computer/camera_advanced/remove_eye_control(mob/living/user) if(!user) return - for(var/V in actions) - var/datum/action/A = V - A.Remove(user) - for(var/V in eyeobj.visibleCameraChunks) - var/datum/camerachunk/C = V - C.remove(eyeobj) + for(var/datum/action/actions_removed as anything in actions) + actions_removed.Remove(user) + for(var/datum/camerachunk/camerachunks_gone as anything in eyeobj.visibleCameraChunks) + camerachunks_gone.remove(eyeobj) if(user.client) user.reset_perspective(null) if(eyeobj.visible_icon && user.client) @@ -91,12 +89,12 @@ eyeobj.eye_user = null user.remote_control = null current_user = null - user.unset_machine() + unset_machine(user) playsound(src, 'sound/machines/terminal_off.ogg', 25, FALSE) /obj/machinery/computer/camera_advanced/check_eye(mob/user) if(!can_use(user) || (issilicon(user) && !user.has_unlimited_silicon_privilege)) - user.unset_machine() + unset_machine(user) /obj/machinery/computer/camera_advanced/Destroy() if(eyeobj) @@ -105,7 +103,7 @@ current_user = null return ..() -/obj/machinery/computer/camera_advanced/on_unset_machine(mob/M) +/obj/machinery/computer/camera_advanced/proc/unset_machine(mob/M) if(M == current_user) remove_eye_control(M) @@ -155,7 +153,7 @@ give_eye_control(L) eyeobj.setLoc(camera_location) else - user.unset_machine() + unset_machine(user) else give_eye_control(L) eyeobj.setLoc(eyeobj.loc) diff --git a/code/game/machinery/computer/dna_console.dm b/code/game/machinery/computer/dna_console.dm index 47a202ae242..72bdb8a7a5c 100644 --- a/code/game/machinery/computer/dna_console.dm +++ b/code/game/machinery/computer/dna_console.dm @@ -400,7 +400,6 @@ . = TRUE add_fingerprint(usr) - usr.set_machine(src) switch(action) // Connect this DNA Console to a nearby DNA Scanner diff --git a/code/game/machinery/computer/prisoner/_prisoner.dm b/code/game/machinery/computer/prisoner/_prisoner.dm index 05bb4042c8b..970b5f4f9be 100644 --- a/code/game/machinery/computer/prisoner/_prisoner.dm +++ b/code/game/machinery/computer/prisoner/_prisoner.dm @@ -1,4 +1,5 @@ /obj/machinery/computer/prisoner + interaction_flags_machine = INTERACT_MACHINE_ALLOW_SILICON|INTERACT_MACHINE_SET_MACHINE|INTERACT_MACHINE_REQUIRES_LITERACY var/obj/item/card/id/advanced/prisoner/contained_id /obj/machinery/computer/prisoner/Destroy() diff --git a/code/game/machinery/embedded_controller/access_controller.dm b/code/game/machinery/embedded_controller/access_controller.dm index 7a92b1bbfaa..75ddb360633 100644 --- a/code/game/machinery/embedded_controller/access_controller.dm +++ b/code/game/machinery/embedded_controller/access_controller.dm @@ -106,6 +106,7 @@ base_icon_state = "access_control" name = "access console" desc = "A small console that can cycle opening between two airlocks." + interaction_flags_machine = INTERACT_MACHINE_WIRES_IF_OPEN|INTERACT_MACHINE_ALLOW_SILICON|INTERACT_MACHINE_OPEN_SILICON|INTERACT_MACHINE_SET_MACHINE var/obj/machinery/door/airlock/interiorAirlock var/obj/machinery/door/airlock/exteriorAirlock var/idInterior diff --git a/code/game/machinery/newscaster/newscaster_machine.dm b/code/game/machinery/newscaster/newscaster_machine.dm index 1ae08c066f0..fc908a98840 100644 --- a/code/game/machinery/newscaster/newscaster_machine.dm +++ b/code/game/machinery/newscaster/newscaster_machine.dm @@ -12,7 +12,7 @@ armor_type = /datum/armor/machinery_newscaster max_integrity = 200 integrity_failure = 0.25 - interaction_flags_machine = INTERACT_MACHINE_ALLOW_SILICON|INTERACT_MACHINE_SET_MACHINE|INTERACT_MACHINE_REQUIRES_LITERACY + interaction_flags_machine = INTERACT_MACHINE_ALLOW_SILICON|INTERACT_MACHINE_REQUIRES_LITERACY ///Reference to the currently logged in user. var/datum/bank_account/current_user ///Name of the logged in user. diff --git a/code/game/objects/items/devices/radio/headset.dm b/code/game/objects/items/devices/radio/headset.dm index 7455f9567cb..ae96f60fea0 100644 --- a/code/game/objects/items/devices/radio/headset.dm +++ b/code/game/objects/items/devices/radio/headset.dm @@ -351,7 +351,6 @@ GLOBAL_LIST_INIT(channel_tokens, list( make_syndie() /obj/item/radio/headset/screwdriver_act(mob/living/user, obj/item/tool) - user.set_machine(src) if(keyslot || keyslot2) for(var/ch_name in channels) SSradio.remove_object(src, GLOB.radiochannels[ch_name]) @@ -373,8 +372,6 @@ GLOBAL_LIST_INIT(channel_tokens, list( return TRUE /obj/item/radio/headset/attackby(obj/item/W, mob/user, params) - user.set_machine(src) - if(istype(W, /obj/item/encryptionkey)) if(keyslot && keyslot2) to_chat(user, span_warning("The headset can't hold another key!")) diff --git a/code/modules/antagonists/fugitive/hunters/hunter_gear.dm b/code/modules/antagonists/fugitive/hunters/hunter_gear.dm index acb31c08ac0..364a5165f1b 100644 --- a/code/modules/antagonists/fugitive/hunters/hunter_gear.dm +++ b/code/modules/antagonists/fugitive/hunters/hunter_gear.dm @@ -69,7 +69,7 @@ name = "psyker navigation warper" desc = "Uses amplified brainwaves to designate and map a precise transit location for the psyker shuttle." icon_screen = "recharge_comp_on" - interaction_flags_machine = INTERACT_MACHINE_ALLOW_SILICON | INTERACT_MACHINE_SET_MACHINE //blind friendly + interaction_flags_machine = INTERACT_MACHINE_ALLOW_SILICON //blind friendly x_offset = 0 y_offset = 11 diff --git a/code/modules/assembly/assembly.dm b/code/modules/assembly/assembly.dm index f981ab60af7..266b61e2d50 100644 --- a/code/modules/assembly/assembly.dm +++ b/code/modules/assembly/assembly.dm @@ -151,16 +151,6 @@ . = ..() . += span_notice("\The [src] [secured? "is secured and ready to be used!" : "can be attached to other things."]") -/obj/item/assembly/attack_self(mob/user) - if(!user) - return FALSE - user.set_machine(src) - interact(user) - return TRUE - -/obj/item/assembly/interact(mob/user) - return ui_interact(user) - /obj/item/assembly/ui_host(mob/user) // In order, return: // - The conencted wiring datum's owner, or 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 2550c37a8cd..c06863ba092 100644 --- a/code/modules/atmospherics/machinery/components/binary_devices/passive_gate.dm +++ b/code/modules/atmospherics/machinery/components/binary_devices/passive_gate.dm @@ -13,7 +13,7 @@ Passive gate is similar to the regular pump except: desc = "A one-way air valve that does not require power. Passes gas when the output pressure is lower than the target pressure." can_unwrench = TRUE shift_underlay_only = FALSE - interaction_flags_machine = INTERACT_MACHINE_OFFLINE | INTERACT_MACHINE_WIRES_IF_OPEN | INTERACT_MACHINE_ALLOW_SILICON | INTERACT_MACHINE_OPEN_SILICON | INTERACT_MACHINE_SET_MACHINE + interaction_flags_machine = INTERACT_MACHINE_OFFLINE | INTERACT_MACHINE_WIRES_IF_OPEN | INTERACT_MACHINE_ALLOW_SILICON | INTERACT_MACHINE_OPEN_SILICON construction_type = /obj/item/pipe/directional pipe_state = "passivegate" use_power = NO_POWER_USE diff --git a/code/modules/food_and_drinks/machinery/icecream_vat.dm b/code/modules/food_and_drinks/machinery/icecream_vat.dm index 607c54e6ff1..5c860c57a92 100644 --- a/code/modules/food_and_drinks/machinery/icecream_vat.dm +++ b/code/modules/food_and_drinks/machinery/icecream_vat.dm @@ -10,6 +10,7 @@ use_power = NO_POWER_USE layer = BELOW_OBJ_LAYER max_integrity = 300 + interaction_flags_machine = INTERACT_MACHINE_WIRES_IF_OPEN|INTERACT_MACHINE_ALLOW_SILICON|INTERACT_MACHINE_OPEN_SILICON|INTERACT_MACHINE_SET_MACHINE var/list/product_types = list() var/selected_flavour = ICE_CREAM_VANILLA var/obj/item/reagent_containers/beaker diff --git a/code/modules/food_and_drinks/machinery/microwave.dm b/code/modules/food_and_drinks/machinery/microwave.dm index 10520e8f6c1..a95357ef2f0 100644 --- a/code/modules/food_and_drinks/machinery/microwave.dm +++ b/code/modules/food_and_drinks/machinery/microwave.dm @@ -516,7 +516,6 @@ if(isAI(user) && (machine_stat & NOPOWER)) return - user.set_machine(src) switch(choice) if("eject") eject() diff --git a/code/modules/mining/machine_processing.dm b/code/modules/mining/machine_processing.dm index 4f28db93bc6..848ecac0fa3 100644 --- a/code/modules/mining/machine_processing.dm +++ b/code/modules/mining/machine_processing.dm @@ -70,6 +70,7 @@ icon = 'icons/obj/machines/mining_machines.dmi' icon_state = "console" density = TRUE + interaction_flags_machine = INTERACT_MACHINE_WIRES_IF_OPEN|INTERACT_MACHINE_ALLOW_SILICON|INTERACT_MACHINE_OPEN_SILICON|INTERACT_MACHINE_SET_MACHINE /// Connected ore processing machine. var/obj/machinery/mineral/processing_unit/processing_machine diff --git a/code/modules/mining/machine_silo.dm b/code/modules/mining/machine_silo.dm index 840c8e92900..7661549a77d 100644 --- a/code/modules/mining/machine_silo.dm +++ b/code/modules/mining/machine_silo.dm @@ -8,6 +8,7 @@ GLOBAL_LIST_EMPTY(silo_access_logs) icon_state = "silo" density = TRUE circuit = /obj/item/circuitboard/machine/ore_silo + interaction_flags_machine = INTERACT_MACHINE_WIRES_IF_OPEN|INTERACT_MACHINE_ALLOW_SILICON|INTERACT_MACHINE_OPEN_SILICON|INTERACT_MACHINE_SET_MACHINE /// The machine UI's page of logs showing ore history. var/log_page = 1 diff --git a/code/modules/mining/satchel_ore_boxdm.dm b/code/modules/mining/satchel_ore_boxdm.dm index 564ec2e92b0..607bbcd9f06 100644 --- a/code/modules/mining/satchel_ore_boxdm.dm +++ b/code/modules/mining/satchel_ore_boxdm.dm @@ -83,8 +83,6 @@ return if(!Adjacent(usr)) return - add_fingerprint(usr) - usr.set_machine(src) switch(action) if("removeall") dump_box_contents() diff --git a/code/modules/pai/card.dm b/code/modules/pai/card.dm index 086e188b431..2fc3d2d0ca4 100644 --- a/code/modules/pai/card.dm +++ b/code/modules/pai/card.dm @@ -26,7 +26,6 @@ if(!pai.encrypt_mod) to_chat(user, span_alert("Encryption Key ports not configured.")) return - user.set_machine(src) pai.radio.attackby(used, user, params) to_chat(user, span_notice("You insert [used] into the [src].")) return @@ -35,7 +34,6 @@ /obj/item/pai_card/attack_self(mob/user) if(!in_range(src, user)) return - user.set_machine(src) ui_interact(user) /obj/item/pai_card/Destroy() diff --git a/code/modules/research/experimentor.dm b/code/modules/research/experimentor.dm index c4983ad6c81..9ffd5448a5d 100644 --- a/code/modules/research/experimentor.dm +++ b/code/modules/research/experimentor.dm @@ -26,6 +26,7 @@ density = TRUE use_power = IDLE_POWER_USE circuit = /obj/item/circuitboard/machine/experimentor + interaction_flags_machine = INTERACT_MACHINE_WIRES_IF_OPEN|INTERACT_MACHINE_ALLOW_SILICON|INTERACT_MACHINE_OPEN_SILICON|INTERACT_MACHINE_SET_MACHINE var/recentlyExperimented = 0 /// Weakref to the first ian we can find at init var/datum/weakref/tracked_ian_ref diff --git a/code/modules/research/machinery/_production.dm b/code/modules/research/machinery/_production.dm index 4668753f048..b71bc1d025f 100644 --- a/code/modules/research/machinery/_production.dm +++ b/code/modules/research/machinery/_production.dm @@ -107,10 +107,7 @@ ) /obj/machinery/rnd/production/ui_interact(mob/user, datum/tgui/ui) - user.set_machine(src) - ui = SStgui.try_update_ui(user, src, ui) - if(!ui) ui = new(user, src, "Fabricator") ui.open() diff --git a/code/modules/shuttle/computer.dm b/code/modules/shuttle/computer.dm index 4065591582e..cf53fef368c 100644 --- a/code/modules/shuttle/computer.dm +++ b/code/modules/shuttle/computer.dm @@ -13,7 +13,7 @@ icon_keyboard = "tech_key" light_color = LIGHT_COLOR_CYAN req_access = list() - interaction_flags_machine = INTERACT_MACHINE_ALLOW_SILICON|INTERACT_MACHINE_SET_MACHINE + interaction_flags_machine = INTERACT_MACHINE_ALLOW_SILICON /// ID of the attached shuttle var/shuttleId /// Possible destinations of the attached shuttle diff --git a/code/modules/vehicles/mecha/mech_fabricator.dm b/code/modules/vehicles/mecha/mech_fabricator.dm index 56b3cd2138c..a840f75ad86 100644 --- a/code/modules/vehicles/mecha/mech_fabricator.dm +++ b/code/modules/vehicles/mecha/mech_fabricator.dm @@ -403,9 +403,6 @@ . = TRUE - add_fingerprint(usr) - usr.set_machine(src) - switch(action) if("build") var/designs = params["designs"]