diff --git a/media/lua/client/TOC/Handlers/ModDataHandler.lua b/media/lua/client/TOC/Handlers/ModDataHandler.lua index 6d6f772..84729bf 100644 --- a/media/lua/client/TOC/Handlers/ModDataHandler.lua +++ b/media/lua/client/TOC/Handlers/ModDataHandler.lua @@ -178,6 +178,7 @@ end ---Set a generic boolean that toggles varies function of the mod ---@return boolean function ModDataHandler:getIsAnyLimbCut() + --if self.isDataReady == false then return false end return self.tocData.isAnyLimbCut end @@ -318,7 +319,7 @@ function ModDataHandler:apply() ModData.transmit(CommandsData.GetKey(self.username)) end -function ModDataHandler.ReceiveData(key, table) +function ModDataHandler.ReceiveData(key, data) if not isClient() then TOC_DEBUG.print("SP, skipping ModDataHandler.ReceiveData") end @@ -326,23 +327,21 @@ function ModDataHandler.ReceiveData(key, table) if key == "TOC_Bob" then return end TOC_DEBUG.print("[ModDataHandler] ReceiveData for " .. key) - if table == {} or table == nil then + if data == {} or data == nil then TOC_DEBUG.print("table is nil... returning") return end - -- Create ModDataHandler instance if there was none for that user and reapply the correct ModData table as a reference + -- Get ModDataHandler instance if there was none for that user and reapply the correct ModData table as a reference local username = key:sub(5) - - -- FIXME Triggers an error at startup during initialization - local handler = ModDataHandler.GetInstance(username) - - if handler.isResetForced then + if handler.isResetForced or data == nil or data == {} or data == false then + TOC_DEBUG.print("[ModDataHandler] Setup") handler:setup(key) handler.isResetForced = false else - handler:reapplyTocData(table) + TOC_DEBUG.print("[ModDataHandler] Reapply") + handler:reapplyTocData(data) end diff --git a/media/lua/client/TOC/UI/HealthPanel.lua b/media/lua/client/TOC/UI/HealthPanel.lua index 2bb6b62..bc8853e 100644 --- a/media/lua/client/TOC/UI/HealthPanel.lua +++ b/media/lua/client/TOC/UI/HealthPanel.lua @@ -98,7 +98,7 @@ function OverrideHealthPanelForTOC() else if highestAmputations[side] == nil then return end local limbName = highestAmputations[side] - TOC_DEBUG.print("Drawing " .. tostring(limbName) .. " for " .. username) + --TOC_DEBUG.print("Drawing " .. tostring(limbName) .. " for " .. username) local cicTime = ModDataHandler.GetInstance(username):getCicatrizationTime(limbName) redColor = GetColorFromCicatrizationTime(cicTime, limbName) diff --git a/media/lua/client/TOC/UI/SurgeryInteractions.lua b/media/lua/client/TOC/UI/SurgeryInteractions.lua index b9d63d6..002a438 100644 --- a/media/lua/client/TOC/UI/SurgeryInteractions.lua +++ b/media/lua/client/TOC/UI/SurgeryInteractions.lua @@ -71,7 +71,7 @@ local function AddOvenContextMenu(playerNum, context, worldObjects, test) context:addSubMenu(optionMain, subMenu) addMainOption = true end - + local option = subMenu:addOption(getText("ContextMenu_Limb_" .. limbName), limbName, Cauterize) option.notAvailable = isTempLow if isTempLow then