From c8b6a8c5ed657d07d3b8e1590c387ea3d0b56866 Mon Sep 17 00:00:00 2001 From: ZioPao Date: Sun, 5 May 2024 16:58:16 +0200 Subject: [PATCH 1/3] Wash Yourself override --- media/lua/client/TOC/Tests.lua | 31 +++++++++++++- .../TOC/TimedActions/WashYourselfOverride.lua | 40 +++++++++++++++++++ 2 files changed, 70 insertions(+), 1 deletion(-) create mode 100644 media/lua/client/TOC/TimedActions/WashYourselfOverride.lua diff --git a/media/lua/client/TOC/Tests.lua b/media/lua/client/TOC/Tests.lua index 977bfc3..27a1e4d 100644 --- a/media/lua/client/TOC/Tests.lua +++ b/media/lua/client/TOC/Tests.lua @@ -11,7 +11,6 @@ local StaticData = require("TOC/StaticData") TestFramework.registerTestModule("LocalPlayerController", "Setup", function() local Tests = {} function Tests.InitializePlayer() - local pl = getPlayer() LocalPlayerController.InitializePlayer(true) end return Tests @@ -154,6 +153,36 @@ TestFramework.registerTestModule("Various", "Player", function() end) +TestFramework.registerTestModule("Various", "Visuals", function() + local Tests = {} + + function Tests.AddBloodRightForearm() + local playerObj = getPlayer() + -- local wornItems = playerObj:getWornItems() + -- local limbName = "ForeArm_R" + -- local fullType = StaticData.AMPUTATION_CLOTHING_ITEM_BASE .. limbName + + -- for i = 1, wornItems:size() do + -- local it = wornItems:get(i - 1) + -- if it then + -- local wornItem = wornItems:get(i - 1):getItem() + -- TOC_DEBUG.print(wornItem:getFullType()) + -- if wornItem:getFullType() == fullType then + -- TOC_DEBUG.print("Found amputation item for " .. limbName) + + -- -- change it here + -- wornItem:setBloodLevel + -- wornItem:getVisual():setTextureChoice(texId) + -- playerObj:resetModelNextFrame() -- necessary to update the model + -- return + -- end + -- end + -- end + end + + return Tests +end) + -------------------------------------------------------------------------------------- if not getActivatedMods():contains("PerfTestFramework") or not isDebugEnabled() then return end diff --git a/media/lua/client/TOC/TimedActions/WashYourselfOverride.lua b/media/lua/client/TOC/TimedActions/WashYourselfOverride.lua new file mode 100644 index 0000000..471d65d --- /dev/null +++ b/media/lua/client/TOC/TimedActions/WashYourselfOverride.lua @@ -0,0 +1,40 @@ +local CachedDataHandler = require("TOC/Handlers/CachedDataHandler") +local StaticData = require("TOC/StaticData") + +-- Since amputations are actually clothing items, we need to override ISWashYourself to account for that + + +local og_ISWashYourself_perform = ISWashYourself.perform +function ISWashYourself:perform() + + TOC_DEBUG.print("ISWashYourself override") + + ---@type IsoPlayer + local pl = self.character + local plInv = pl:getInventory() + -- Search for amputations and clean them here + local amputatedLimbs = CachedDataHandler.GetAmputatedLimbs(pl:getUsername()) + for limbName, _ in pairs(amputatedLimbs) do + + TOC_DEBUG.print("Checking if " .. limbName .. " is in inventory and washing it") + + -- get clothing item + local foundItem = plInv:FindAndReturn(StaticData.AMPUTATION_CLOTHING_ITEM_BASE .. limbName) + if foundItem and instanceof(foundItem, "Clothing") then + + TOC_DEBUG.print("Washing " .. limbName) + + ---@cast foundItem Clothing + foundItem:setWetness(100) + foundItem:setBloodLevel(0) + foundItem:setDirtyness(0) -- TODO Integrate with other dirtyness + + end + + end + + + og_ISWashYourself_perform(self) + + +end \ No newline at end of file From f9ad597d2b7ddc1602528e5e44be2c2d9736b166 Mon Sep 17 00:00:00 2001 From: ZioPao Date: Sun, 5 May 2024 17:01:40 +0200 Subject: [PATCH 2/3] bump to mod.info --- media/lua/client/TOC/Main.lua | 2 +- mod.info | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/media/lua/client/TOC/Main.lua b/media/lua/client/TOC/Main.lua index 6ebb998..2d6b9f5 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.4" + _version = "2.0.5" } function Main.Start() diff --git a/mod.info b/mod.info index 69a5a39..24b1a14 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.4 +modversion=2.0.5 pzversion=41.65 From 17718cbbca52b3b6e41770e63fd289b633975240 Mon Sep 17 00:00:00 2001 From: ZioPao Date: Sun, 5 May 2024 17:02:14 +0200 Subject: [PATCH 3/3] bit of cleaning --- media/lua/client/TOC/Controllers/DataController.lua | 2 +- media/lua/client/TOC/Main.lua | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/media/lua/client/TOC/Controllers/DataController.lua b/media/lua/client/TOC/Controllers/DataController.lua index eaaa512..7a96f88 100644 --- a/media/lua/client/TOC/Controllers/DataController.lua +++ b/media/lua/client/TOC/Controllers/DataController.lua @@ -362,7 +362,7 @@ end function DataController:apply() TOC_DEBUG.print("Applying data for " .. self.username) ModData.transmit(CommandsData.GetKey(self.username)) - + -- if getPlayer():getUsername() ~= self.username then -- sendClientCommand(CommandsData.modules.TOC_RELAY, CommandsData.server.Relay.RelayApplyFromOtherClient, {patientUsername = self.username} ) -- -- force request from the server for that other client... diff --git a/media/lua/client/TOC/Main.lua b/media/lua/client/TOC/Main.lua index 2d6b9f5..9da1984 100644 --- a/media/lua/client/TOC/Main.lua +++ b/media/lua/client/TOC/Main.lua @@ -11,7 +11,6 @@ local Main = { function Main.Start() TOC_DEBUG.print("Starting The Only Cure version " .. tostring(Main._version)) - --Main.SetupTraits() Main.SetupEvents() end