From 1fcadc9ff72e330f11370662414321f0a0cd7472 Mon Sep 17 00:00:00 2001 From: Joachim Stolberg Date: Tue, 28 Mar 2023 18:34:54 +0200 Subject: [PATCH] Fix bug with reset button --- move_controller/doorcontroller2.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/move_controller/doorcontroller2.lua b/move_controller/doorcontroller2.lua index 828fd33..855108b 100644 --- a/move_controller/doorcontroller2.lua +++ b/move_controller/doorcontroller2.lua @@ -67,6 +67,7 @@ local function get_new_nodename(item) end local function get_node_name(nvm, slot) + nvm.pos_list = nvm.pos_list or {} local pos = nvm.pos_list[slot] if pos then return techage.get_node_lvm(pos).name @@ -228,6 +229,7 @@ end -- Generate a table of currently available inventory and placed nodes local function available_nodes(pos, nvm, item_list) local nodes = {} + nvm.pos_list = nvm.pos_list or {} for idx = 1, NUMSLOTS do local item = item_list[idx] @@ -252,6 +254,7 @@ local function restore_config(pos, nvm) local item_list = inv:get_list("main") local stock = available_nodes(pos, nvm, item_list) local nodes = minetest.deserialize(meta:get_string("stored_config")) or {} + nvm.pos_list = nvm.pos_list or {} inv:set_list("main", {}) item_list = inv:get_list("main") @@ -421,7 +424,7 @@ minetest.register_node("techage:ta3_doorcontroller2", { return elseif fields.record then local inv = meta:get_inventory() - nvm.pos_list = nil + nvm.pos_list = {} meta:set_string("status", S("Recording...")) local name = player:get_player_name() minetest.chat_send_player(name, S("Click on all the blocks that are part of the door/gate"))