From b70dd619a4a61e9185a1c7745a5c78d9d54f3025 Mon Sep 17 00:00:00 2001 From: ZioPao Date: Tue, 28 May 2024 10:01:03 +0200 Subject: [PATCH 1/4] Disabled insensitive trait for now --- media/lua/shared/TOC/Traits.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/media/lua/shared/TOC/Traits.lua b/media/lua/shared/TOC/Traits.lua index 3567bc6..9958155 100644 --- a/media/lua/shared/TOC/Traits.lua +++ b/media/lua/shared/TOC/Traits.lua @@ -5,7 +5,7 @@ local TRAITS = { Amputee_Hand = "Amputee_Hand", Amputee_ForeArm = "Amputee_ForeArm", Amputee_UpperArm = "Amputee_UpperArm", - Insensitive = "Insensitive" + --Insensitive = "Insensitive" -- TODO Disabled for now, until we reintroduce it } @@ -37,7 +37,7 @@ local function SetupTraits() t:addXPBoost(Perks.Strength, -1) end - TraitFactory.addTrait(TRAITS.Insensitive, GetTraitText(TRAITS.Insensitive), 6, GetTraitDesc(TRAITS.Insensitive), false, false) + --TraitFactory.addTrait(TRAITS.Insensitive, GetTraitText(TRAITS.Insensitive), 6, GetTraitDesc(TRAITS.Insensitive), false, false) TraitFactory.setMutualExclusive(TRAITS.Amputee_Hand, TRAITS.Amputee_ForeArm) TraitFactory.setMutualExclusive(TRAITS.Amputee_Hand, TRAITS.Amputee_UpperArm) From 29f21decb41d0155c595df08f5eb719d60b4fba4 Mon Sep 17 00:00:00 2001 From: ZioPao Date: Fri, 31 May 2024 10:37:39 +0200 Subject: [PATCH 2/4] hotfix to traits --- media/lua/client/TOC/Controllers/DataController.lua | 10 ++++++++++ .../client/TOC/Controllers/LocalPlayerController.lua | 8 +++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/media/lua/client/TOC/Controllers/DataController.lua b/media/lua/client/TOC/Controllers/DataController.lua index 9db7f12..9c89188 100644 --- a/media/lua/client/TOC/Controllers/DataController.lua +++ b/media/lua/client/TOC/Controllers/DataController.lua @@ -97,6 +97,14 @@ function DataController:setup(key) -- self.tocData.isInitializing = false -- ModData.add(key, self.tocData) + + + -- FIX THIS THING HERE ISN'T REALLY CORRECT BUT IT'S A WORKAROUND UNTIL WE FIGURE IT OUT + -- The issue is that we need to do this once, not every single time we load data. + -- Manage their traits + local LocalPlayerController = require("TOC/Controller/LocalPlayerController") + LocalPlayerController.ManageTraits(getPlayer()) + end ---In case of desync between the table on ModData and the table here @@ -417,6 +425,8 @@ function DataController.ReceiveData(key, data) triggerEvent("OnReceivedTocData", handler.username) + -- TODO We need an event to track if initialization has been finalized + -- if username == getPlayer():getUsername() and not handler.isResetForced then diff --git a/media/lua/client/TOC/Controllers/LocalPlayerController.lua b/media/lua/client/TOC/Controllers/LocalPlayerController.lua index 5f66489..b4b8a3b 100644 --- a/media/lua/client/TOC/Controllers/LocalPlayerController.lua +++ b/media/lua/client/TOC/Controllers/LocalPlayerController.lua @@ -6,6 +6,8 @@ require("TOC/Events") ----------- + + -- Handle ONLY stuff for the local client ---@class LocalPlayerController @@ -33,9 +35,6 @@ function LocalPlayerController.InitializePlayer(isForced) Events.OnAmputatedLimb.Add(LocalPlayerController.ToggleUpdateAmputations) LocalPlayerController.ToggleUpdateAmputations() - -- Manage their traits - LocalPlayerController.ManageTraits(playerObj) - -- Since isForced is used to reset an existing player data, we're gonna clean their ISHealthPanel table too if isForced then local ItemsController = require("TOC/Controllers/ItemsController") @@ -50,6 +49,9 @@ end ---Handles the traits ---@param playerObj IsoPlayer function LocalPlayerController.ManageTraits(playerObj) + + -- FIX This can fail if we haven't initialized TOC in time` + local AmputationHandler = require("TOC/Handlers/AmputationHandler") for k, v in pairs(StaticData.TRAITS_BP) do if playerObj:HasTrait(k) then From 574526aca0972341f34065d974f59aa70c6d6ed2 Mon Sep 17 00:00:00 2001 From: ZioPao Date: Fri, 31 May 2024 10:50:51 +0200 Subject: [PATCH 3/4] Fix: traits handling --- .../lua/client/TOC/Controllers/DataController.lua | 9 +-------- .../TOC/Controllers/LocalPlayerController.lua | 15 +++++++++++---- media/lua/client/TOC/Events.lua | 1 + 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/media/lua/client/TOC/Controllers/DataController.lua b/media/lua/client/TOC/Controllers/DataController.lua index 9c89188..e996b7f 100644 --- a/media/lua/client/TOC/Controllers/DataController.lua +++ b/media/lua/client/TOC/Controllers/DataController.lua @@ -97,14 +97,7 @@ function DataController:setup(key) -- self.tocData.isInitializing = false -- ModData.add(key, self.tocData) - - - -- FIX THIS THING HERE ISN'T REALLY CORRECT BUT IT'S A WORKAROUND UNTIL WE FIGURE IT OUT - -- The issue is that we need to do this once, not every single time we load data. - -- Manage their traits - local LocalPlayerController = require("TOC/Controller/LocalPlayerController") - LocalPlayerController.ManageTraits(getPlayer()) - + triggerEvent("OnSetupTocData") end ---In case of desync between the table on ModData and the table here diff --git a/media/lua/client/TOC/Controllers/LocalPlayerController.lua b/media/lua/client/TOC/Controllers/LocalPlayerController.lua index b4b8a3b..2bed9fa 100644 --- a/media/lua/client/TOC/Controllers/LocalPlayerController.lua +++ b/media/lua/client/TOC/Controllers/LocalPlayerController.lua @@ -46,11 +46,13 @@ function LocalPlayerController.InitializePlayer(isForced) SetHealthPanelTOC() end ----Handles the traits ----@param playerObj IsoPlayer -function LocalPlayerController.ManageTraits(playerObj) - -- FIX This can fail if we haven't initialized TOC in time` + +---Handles the traits +function LocalPlayerController.ManageTraits() + + -- Local player + local playerObj = getPlayer() local AmputationHandler = require("TOC/Handlers/AmputationHandler") for k, v in pairs(StaticData.TRAITS_BP) do @@ -67,6 +69,11 @@ function LocalPlayerController.ManageTraits(playerObj) end end +-- We need to manage traits when we're done setupping everything +-- It shouldn't be done every single time we initialize the player, fetching data, etc. +Events.OnSetupTocData.Add(LocalPlayerController.ManageTraits) + + ---------------------------------------------------------- --* Health *-- diff --git a/media/lua/client/TOC/Events.lua b/media/lua/client/TOC/Events.lua index 0d3b4c9..b4e19cf 100644 --- a/media/lua/client/TOC/Events.lua +++ b/media/lua/client/TOC/Events.lua @@ -2,3 +2,4 @@ LuaEventManager.AddEvent("OnAmputatedLimb") --Triggered when a limb has been amputated LuaEventManager.AddEvent("OnProsthesisUnequipped") LuaEventManager.AddEvent("OnReceivedTocData") -- Triggered when TOC data is ready +LuaEventManager.AddEvent("OnSetupTocData") -- Triggered when TOC has been setupped \ No newline at end of file From e0e65c022f46742cd9d68b432fea7a6ea1789ba6 Mon Sep 17 00:00:00 2001 From: ZioPao Date: Fri, 31 May 2024 10:52:24 +0200 Subject: [PATCH 4/4] bump to mod.info --- changelog.txt | 56 ----------------------------------- media/lua/client/TOC/Main.lua | 2 +- mod.info | 2 +- 3 files changed, 2 insertions(+), 58 deletions(-) delete mode 100644 changelog.txt diff --git a/changelog.txt b/changelog.txt deleted file mode 100644 index e613ae7..0000000 --- a/changelog.txt +++ /dev/null @@ -1,56 +0,0 @@ -0.9.15 -- Hotfix to sound not stopping when performing an amputation on another player - -0.9.14 -- Optimizations -- New icon for the mod -- Added a dirtyness malus for cicatrization, you'll have to keep your wound clean while it's healing (wash it you animal) -- When trying to equip a prosthesis from the inventory you'll get a message to let you know that you're doing it wrong -- Added explicit support to Left Is Right, making it work a lot better when you've got an amputated right limb - - -0.9.13 -- Some little optimizations -- Fixed a bug that made Fancy Handwork compat not work as intended - -0.9.12 -- Fixed traits icons -- Some cleaning to the code - -0.9.11 -- Hotfix to cicatrization visuals - -0.9.10 -- Modified textures once again - - -0.9.9 -- Modified textures for amputations -- Fixed a bug that caused some problems when amputating an already amputated limb - -0.9.8 -- New textures for amputations -- When cicatrized, an amputation will not be bloody anymore (visual thing only) - -0.9.7 -- Now amputations should spawn in every case, damn hairs. Thanks Dev for the tip! - - -0.9.6 -- Fixed a bug when handling zombie hitting amputated limbs -- Fixed sound looping incessantly after amputating a limb -- Changed how phantom pain occurs -- Fixes to new hook models - - - - -0.9.5 -- No more Right Click menu. You'll have to use the TOC Menu from the Medical Check, except for Cheats -- Fixes to how amputations are handled - before and after -- Compatibility fixes with older versions -- Various fixes to Traits -- New heavily WIP models for metal and wooden hooks -- Readded sounds during amputations -- Fixed banages not getting applied after an amputation when they were in the player's inventory diff --git a/media/lua/client/TOC/Main.lua b/media/lua/client/TOC/Main.lua index a62a028..34bf55a 100644 --- a/media/lua/client/TOC/Main.lua +++ b/media/lua/client/TOC/Main.lua @@ -6,7 +6,7 @@ require("TOC/Events") ---@class Main local Main = { - _version = "2.0.11" + _version = "2.0.12" } function Main.Start() diff --git a/mod.info b/mod.info index f1f701f..7f258c0 100644 --- a/mod.info +++ b/mod.info @@ -4,5 +4,5 @@ description=You've been bitten. You have only two choices. id=TheOnlyCure icon=icon.png url=https://github.com/ZioPao/The-Only-Cure -modversion=2.0.11 +modversion=2.0.12 pzversion=41.65