From ab140b43731c32bd74bcc382d47a896b91006de4 Mon Sep 17 00:00:00 2001 From: Vanic Date: Sun, 17 May 2026 16:42:11 +0300 Subject: [PATCH] `PlayerInventoryUI`: fix `updateNodeForm` stuff --- mods/UI/PlayerInventoryUI/src/PlayerInventoryUI.lua | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/mods/UI/PlayerInventoryUI/src/PlayerInventoryUI.lua b/mods/UI/PlayerInventoryUI/src/PlayerInventoryUI.lua index 31eb941..c6a9b93 100644 --- a/mods/UI/PlayerInventoryUI/src/PlayerInventoryUI.lua +++ b/mods/UI/PlayerInventoryUI/src/PlayerInventoryUI.lua @@ -265,7 +265,7 @@ function PlayerInventoryUI:addActiveNodeForm(nodePos, playerName) local stringPos = core.pos_to_string(nodePos) local playerNames = self.ActiveNodeForms[stringPos] if playerNames == nil then - self.ActiveNodeForms[stringPos] = { playerNames } + self.ActiveNodeForms[stringPos] = { playerName } else tableInsert(playerNames, playerName) end @@ -295,7 +295,7 @@ function PlayerInventoryUI:removeActiveNodeForm(nodePos, playerName) return end - tableRemoveValue(playerNames, playerName) + self.ActiveNodeForms[stringPos] = tableRemoveValue(playerNames, playerName) end -- We are overriding the `BaseUI.showForm` & `BaseUI.closeForm`. @@ -306,11 +306,6 @@ function PlayerInventoryUI:showForm(playerName) local player = core.get_player_by_name(playerName) assert(player ~= nil) - local nodePos = self:getContex(playerName, 'node_tab_pos') - if nodePos ~= nil then - self:addActiveNodeForm(nodePos, playerName) - end - -- We overwrite the player's inventory definition so that the updated inventory -- is shown to the player when they press the "open inventory" key. player:set_inventory_formspec(PlayerInventoryUI:getFormSpecString(playerName)) @@ -334,7 +329,7 @@ local function closeNodeTab(player) local playerName = player:get_player_name() local nodePos = PlayerInventoryUI:getContex(playerName, 'node_tab_pos') if nodePos ~= nil then - PlayerInventoryUI:addActiveNodeForm(nodePos, playerName) + PlayerInventoryUI:removeActiveNodeForm(nodePos, playerName) end PlayerInventoryUI:setContex(playerName, 'node_tab_pos', nil)