From 5b197606db270d33b14ef0283032c3d05bdbde35 Mon Sep 17 00:00:00 2001 From: Mike Stump Date: Tue, 9 Jan 2024 09:51:17 -0800 Subject: [PATCH] Invalidate machines when interface is pulled. --- modules/storage/interface.lua | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/modules/storage/interface.lua b/modules/storage/interface.lua index a590298..b87301d 100644 --- a/modules/storage/interface.lua +++ b/modules/storage/interface.lua @@ -248,6 +248,25 @@ me.register_node("interface", { end end end + if net.process then + -- todo: This is a little slow, speed it up? Interface removal is infrequent. + for _, v in pairs(net.process) do + for k, ipos in pairs(v) do + if ipos.x == pos.x and ipos.y == pos.y and ipos.z == pos.z then + pos = ipos + break + end + end + end + for name, v in pairs(net.process) do + for apos, ipos in pairs(v) do + if ipos == pos then + me.log("INTERFACE: killing a mchine for "..name, "error") + net.process[name][apos] = nil + end + end + end + end end, after_destruct = function(pos) me.send_event(pos,"disconnect")