diff --git a/media/lua/client/TOC/Controllers/LocalPlayerController.lua b/media/lua/client/TOC/Controllers/LocalPlayerController.lua index 88e4ba7..ea1a5ce 100644 --- a/media/lua/client/TOC/Controllers/LocalPlayerController.lua +++ b/media/lua/client/TOC/Controllers/LocalPlayerController.lua @@ -18,12 +18,12 @@ local StaticData = require("TOC/StaticData") local LocalPlayerController = {} ---Setup the Player Handler and modData, only for local client ----@param playerObj IsoPlayer ---@param isForced boolean? -function LocalPlayerController.InitializePlayer(playerObj, isForced) +function LocalPlayerController.InitializePlayer(isForced) + local playerObj = getPlayer() local username = playerObj:getUsername() - TOC_DEBUG.print("[PlayerHandler] Initializing local player: " .. username) + TOC_DEBUG.print("[LocalPlayerController] Initializing local player: " .. username) DataController:new(username, isForced) LocalPlayerController.playerObj = playerObj @@ -281,7 +281,7 @@ end ---Starts safely the loop to update cicatrzation function LocalPlayerController.ToggleUpdateAmputations() - TOC_DEBUG.print("[PlayerHandler] Activating amputation handling loop (if it wasn't active before)") + TOC_DEBUG.print("[LocalPlayerController] Activating amputation handling loop (if it wasn't active before)") CommonMethods.SafeStartEvent("EveryHours", LocalPlayerController.UpdateAmputations) end diff --git a/media/lua/client/TOC/Handlers/AmputationHandler.lua b/media/lua/client/TOC/Handlers/AmputationHandler.lua index 8dd38da..8d2b01b 100644 --- a/media/lua/client/TOC/Handlers/AmputationHandler.lua +++ b/media/lua/client/TOC/Handlers/AmputationHandler.lua @@ -139,7 +139,7 @@ function AmputationHandler:execute(damagePlayer) -- Heal the area, we're gonna re-set the damage after (if it's enabled) local bd = self.patientPl:getBodyDamage() local bodyPart = bd:getBodyPart(self.bodyPartType) - PlayerHandler.HealArea(bodyPart) + LocalPlayerController.HealArea(bodyPart) -- Give the player the correct amputation item ItemsController.Player.DeleteOldAmputationItem(self.patientPl, self.limbName) @@ -159,7 +159,7 @@ function AmputationHandler:execute(damagePlayer) -- If the part was actually infected, heal the player, if they were in time (infectionLevel < 20) if bd:getInfectionLevel() < 20 and bodyPart:IsInfected() and not dcInst:getIsIgnoredPartInfected() then - PlayerHandler.HealZombieInfection(bd, bodyPart, self.limbName, dcInst) + LocalPlayerController.HealZombieInfection(bd, bodyPart, self.limbName, dcInst) end -- The last part is to handle the damage that the player will receive after the amputation diff --git a/media/lua/client/TOC/Main.lua b/media/lua/client/TOC/Main.lua index 1dcd11d..edd3ea7 100644 --- a/media/lua/client/TOC/Main.lua +++ b/media/lua/client/TOC/Main.lua @@ -64,7 +64,7 @@ function Main.Initialize() return end - PlayerHandler.InitializePlayer(pl, false) + LocalPlayerController.InitializePlayer(false) Events.OnTick.Remove(TryToInitialize) end CommonMethods.SafeStartEvent("OnTick", TryToInitialize) diff --git a/media/lua/client/TOC/Tests.lua b/media/lua/client/TOC/Tests.lua index 069eed0..678eeb4 100644 --- a/media/lua/client/TOC/Tests.lua +++ b/media/lua/client/TOC/Tests.lua @@ -8,16 +8,16 @@ local DataController = require("TOC/Controllers/DataController") local StaticData = require("TOC/StaticData") -TestFramework.registerTestModule("PlayerHandler", "Setup", function() +TestFramework.registerTestModule("LocalPlayerController", "Setup", function() local Tests = {} function Tests.InitializePlayer() local pl = getPlayer() - PlayerHandler.InitializePlayer(pl, true) + LocalPlayerController.InitializePlayer(true) end return Tests end) -TestFramework.registerTestModule("PlayerHandler", "Perks", function() +TestFramework.registerTestModule("LocalPlayerController", "Perks", function() local Tests = {} function Tests.SetMaxPerks() @@ -46,7 +46,7 @@ TestFramework.registerTestModule("PlayerHandler", "Perks", function() return Tests end) -TestFramework.registerTestModule("PlayerHandler", "Cicatrization", function() +TestFramework.registerTestModule("LocalPlayerController", "Cicatrization", function() local Tests = {} function Tests.SetCicatrizationTimeToOne() @@ -117,8 +117,8 @@ if not getActivatedMods():contains("PerfTestFramework") or not isDebugEnabled() local PerfTest = require("PerfTest/main") -- SHould be global anyway local CachedDataHandler = require("TOC/Handlers/CachedDataHandler") -PerfTest.RegisterMethod("PlayerHandler", PlayerHandler, "InitializePlayer") -PerfTest.RegisterMethod("PlayerHandler", PlayerHandler, "UpdateAmputations") +PerfTest.RegisterMethod("LocalPlayerController", LocalPlayerController, "InitializePlayer") +PerfTest.RegisterMethod("LocalPlayerController", LocalPlayerController, "UpdateAmputations") PerfTest.RegisterMethod("CachedDataHandler", CachedDataHandler, "CalculateHighestAmputatedLimbs") PerfTest.RegisterMethod("ISHealthPanel", ISHealthPanel, "render")