[MIRROR] Material holding machines can't connect to ore silos on different z levels [MDB IGNORE] (#14167)

* Material holding machines can't connect to ore silos on different z levels (#66953)

The station's ore silo can't connect to machines that are off the station z-level anymore. This doesn't affect multi-z stations.
Also includes ore silo code improvement because I was unhappy with it.

* Material holding machines can't connect to ore silos on different z levels

Co-authored-by: John Willard <53777086+JohnFulpWillard@users.noreply.github.com>
This commit is contained in:
SkyratBot
2022-06-07 22:11:42 +02:00
committed by GitHub
parent f0ea5eec7b
commit 64b71f7585
2 changed files with 33 additions and 14 deletions
+11 -10
View File
@@ -9,9 +9,12 @@ GLOBAL_LIST_EMPTY(silo_access_logs)
density = TRUE
circuit = /obj/item/circuitboard/machine/ore_silo
var/list/holds = list()
var/list/datum/component/remote_materials/connected = list()
/// The machine UI's page of logs showing ore history.
var/log_page = 1
/// 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.
var/list/datum/component/remote_materials/ore_connected_machines = list()
/obj/machinery/ore_silo/Initialize(mapload)
. = ..()
@@ -36,11 +39,10 @@ GLOBAL_LIST_EMPTY(silo_access_logs)
if (GLOB.ore_silo_default == src)
GLOB.ore_silo_default = null
for(var/C in connected)
var/datum/component/remote_materials/mats = C
for(var/datum/component/remote_materials/mats as anything in ore_connected_machines)
mats.disconnect_from(src)
connected = null
ore_connected_machines = null
var/datum/component/material_container/materials = GetComponent(/datum/component/material_container)
materials.retrieve_all()
@@ -112,14 +114,13 @@ GLOBAL_LIST_EMPTY(silo_access_logs)
ui += "Nothing!"
ui += "</div><div class='statusDisplay'><h2>Connected Machines:</h2>"
for(var/C in connected)
var/datum/component/remote_materials/mats = C
for(var/datum/component/remote_materials/mats as anything in ore_connected_machines)
var/atom/parent = mats.parent
var/hold_key = "[get_area(parent)]/[mats.category]"
ui += "<a href='?src=[REF(src)];remove=[REF(mats)]'>Remove</a>"
ui += "<a href='?src=[REF(src)];hold[!holds[hold_key]]=[url_encode(hold_key)]'>[holds[hold_key] ? "Allow" : "Hold"]</a>"
ui += " <b>[parent.name]</b> in [get_area_name(parent, TRUE)]<br>"
if(!connected.len)
if(!ore_connected_machines.len)
ui += "Nothing!"
ui += "</div><div class='statusDisplay'><h2>Access Logs:</h2>"
@@ -153,10 +154,10 @@ GLOBAL_LIST_EMPTY(silo_access_logs)
usr.set_machine(src)
if(href_list["remove"])
var/datum/component/remote_materials/mats = locate(href_list["remove"]) in connected
var/datum/component/remote_materials/mats = locate(href_list["remove"]) in ore_connected_machines
if (mats)
mats.disconnect_from(src)
connected -= mats
ore_connected_machines -= mats
updateUsrDialog()
return TRUE
else if(href_list["hold1"])