From 8ed348e4fc48e44d787fd800c9148a604b412bd3 Mon Sep 17 00:00:00 2001 From: SyncIt21 <110812394+SyncIt21@users.noreply.github.com> Date: Sun, 7 Sep 2025 13:29:53 +0530 Subject: [PATCH] Fixes ore silo id check being enforced too strictly (#92666) ## About The Pull Request - Fixes #92515 - Fixes #92660 The Ore Silo ID requirement is now only enabled for the station map loaded ore silo which means ore silos constructed by the player/off station silos etc have this requirement disabled so golems & other roles can use it as normal. There is no urgency for this to be enforced always. The ID restriction button also now changes colour & text correctly when toggling it ## Changelog :cl: fix: ore silo id restriction button in the UI now changes text & colour correctly fix: ore silo id restriction is now only enforced for station loaded silo and is optional in other cases /:cl: --- code/modules/mining/machine_silo.dm | 41 +++++++++++++---------- tgui/packages/tgui/interfaces/OreSilo.tsx | 30 +++++++++-------- 2 files changed, 40 insertions(+), 31 deletions(-) diff --git a/code/modules/mining/machine_silo.dm b/code/modules/mining/machine_silo.dm index 743f3eec6f7..82b87421d29 100644 --- a/code/modules/mining/machine_silo.dm +++ b/code/modules/mining/machine_silo.dm @@ -33,8 +33,8 @@ interaction_flags_machine = INTERACT_MACHINE_WIRES_IF_OPEN|INTERACT_MACHINE_ALLOW_SILICON|INTERACT_MACHINE_OPEN_SILICON processing_flags = NONE - /// By default, an ore silo requires you to be wearing an ID to pull materials from it. - var/ID_required = TRUE + /// Only the station loaded ore silo starts out with ID restrictions, else its optional + var/ID_required = FALSE /// List of all connected components that are on hold from accessing materials. var/list/holds = list() /// List of all components that are sharing ores with this silo. @@ -52,6 +52,7 @@ RADIO_CHANNEL_SUPPLY = NONE, RADIO_CHANNEL_SECURITY = NONE, ) + ///List of announcement messages for silo restrictions var/static/alist/announcement_messages = alist( BAN_ATTEMPT_FAILURE_NO_ACCESS = "ACCESS ENFORCEMENT FAILURE: $SILO_USER_NAME lacks supply command authority.", BAN_ATTEMPT_FAILURE_CHALLENGING_DA_CHIEF = "ACCESS ENFORCEMENT FAILURE: $SILO_USER_NAME attempting subversion of supply command authority.", @@ -69,6 +70,7 @@ /obj/machinery/ore_silo/Initialize(mapload) . = ..() + materials = AddComponent( \ /datum/component/material_container, \ SSmaterials.materials_by_category[MAT_CATEGORY_SILO], \ @@ -80,12 +82,28 @@ ), \ allowed_items = /obj/item/stack \ ) + if (!GLOB.ore_silo_default && mapload && is_station_level(z)) GLOB.ore_silo_default = src + ID_required = TRUE + register_context() setup_radio() configure_default_announcements_policy() +/obj/machinery/ore_silo/Destroy() + if (GLOB.ore_silo_default == src) + GLOB.ore_silo_default = null + + for(var/datum/component/remote_materials/mats as anything in ore_connected_machines) + mats.disconnect() + + ore_connected_machines = null + materials = null + QDEL_NULL(radio) + + return ..() + /obj/machinery/ore_silo/emag_act(mob/living/user) if(obj_flags & EMAGGED) return FALSE @@ -104,19 +122,6 @@ radio.keyslot.channels[RADIO_CHANNEL_SECURITY] = TRUE radio.recalculateChannels() -/obj/machinery/ore_silo/Destroy() - if (GLOB.ore_silo_default == src) - GLOB.ore_silo_default = null - - for(var/datum/component/remote_materials/mats as anything in ore_connected_machines) - mats.disconnect() - - ore_connected_machines = null - materials = null - QDEL_NULL(radio) - - return ..() - /obj/machinery/ore_silo/examine(mob/user) . = ..() . += span_notice("It can be linked to techfabs, circuit printers and protolathes with a multitool.") @@ -330,11 +335,12 @@ if("toggle_ban") var/list/banned_user_data = params["user_data"] - attempt_ban_toggle(usr, banned_user_data) + attempt_ban_toggle(ui.user, banned_user_data) return TRUE if("toggle_restrict") - attempt_toggle_restrict(usr) + attempt_toggle_restrict(ui.user) + return TRUE /** * Called from the ore silo's UI, when someone attempts to (un)ban a user from using the ore silo. * The person doing the banning should have at least QM access. Unless this is emagged. Not modifiable by silicons unless emagged. @@ -558,6 +564,7 @@ var/amount ///List of individual materials used in the action var/list/materials + ///User data of the player doing material operations var/alist/user_data /datum/ore_silo_log/New(obj/machinery/M, _action, _amount, _noun, list/mats=list(), alist/user_data) diff --git a/tgui/packages/tgui/interfaces/OreSilo.tsx b/tgui/packages/tgui/interfaces/OreSilo.tsx index 9e48a87c0ae..0a40cb223f7 100644 --- a/tgui/packages/tgui/interfaces/OreSilo.tsx +++ b/tgui/packages/tgui/interfaces/OreSilo.tsx @@ -68,7 +68,7 @@ type Data = { logs: Log[]; // Banned users is a list of bank account datum IDs banned_users: number[]; - id_required: BooleanLike; + ID_required: BooleanLike; }; const actionToColor = { @@ -238,20 +238,22 @@ type LogsListProps = { const RestrictButton = () => { const { act, data } = useBackend(); - const { id_required } = data; + const { ID_required } = data; return ( - + + + ); };