Missed some stuff after previous refactoring
This commit is contained in:
@@ -18,12 +18,12 @@ local StaticData = require("TOC/StaticData")
|
|||||||
local LocalPlayerController = {}
|
local LocalPlayerController = {}
|
||||||
|
|
||||||
---Setup the Player Handler and modData, only for local client
|
---Setup the Player Handler and modData, only for local client
|
||||||
---@param playerObj IsoPlayer
|
|
||||||
---@param isForced boolean?
|
---@param isForced boolean?
|
||||||
function LocalPlayerController.InitializePlayer(playerObj, isForced)
|
function LocalPlayerController.InitializePlayer(isForced)
|
||||||
|
local playerObj = getPlayer()
|
||||||
local username = playerObj:getUsername()
|
local username = playerObj:getUsername()
|
||||||
|
|
||||||
TOC_DEBUG.print("[PlayerHandler] Initializing local player: " .. username)
|
TOC_DEBUG.print("[LocalPlayerController] Initializing local player: " .. username)
|
||||||
|
|
||||||
DataController:new(username, isForced)
|
DataController:new(username, isForced)
|
||||||
LocalPlayerController.playerObj = playerObj
|
LocalPlayerController.playerObj = playerObj
|
||||||
@@ -281,7 +281,7 @@ end
|
|||||||
|
|
||||||
---Starts safely the loop to update cicatrzation
|
---Starts safely the loop to update cicatrzation
|
||||||
function LocalPlayerController.ToggleUpdateAmputations()
|
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)
|
CommonMethods.SafeStartEvent("EveryHours", LocalPlayerController.UpdateAmputations)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -139,7 +139,7 @@ function AmputationHandler:execute(damagePlayer)
|
|||||||
-- Heal the area, we're gonna re-set the damage after (if it's enabled)
|
-- Heal the area, we're gonna re-set the damage after (if it's enabled)
|
||||||
local bd = self.patientPl:getBodyDamage()
|
local bd = self.patientPl:getBodyDamage()
|
||||||
local bodyPart = bd:getBodyPart(self.bodyPartType)
|
local bodyPart = bd:getBodyPart(self.bodyPartType)
|
||||||
PlayerHandler.HealArea(bodyPart)
|
LocalPlayerController.HealArea(bodyPart)
|
||||||
|
|
||||||
-- Give the player the correct amputation item
|
-- Give the player the correct amputation item
|
||||||
ItemsController.Player.DeleteOldAmputationItem(self.patientPl, self.limbName)
|
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 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
|
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
|
end
|
||||||
|
|
||||||
-- The last part is to handle the damage that the player will receive after the amputation
|
-- The last part is to handle the damage that the player will receive after the amputation
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ function Main.Initialize()
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
PlayerHandler.InitializePlayer(pl, false)
|
LocalPlayerController.InitializePlayer(false)
|
||||||
Events.OnTick.Remove(TryToInitialize)
|
Events.OnTick.Remove(TryToInitialize)
|
||||||
end
|
end
|
||||||
CommonMethods.SafeStartEvent("OnTick", TryToInitialize)
|
CommonMethods.SafeStartEvent("OnTick", TryToInitialize)
|
||||||
|
|||||||
@@ -8,16 +8,16 @@ local DataController = require("TOC/Controllers/DataController")
|
|||||||
local StaticData = require("TOC/StaticData")
|
local StaticData = require("TOC/StaticData")
|
||||||
|
|
||||||
|
|
||||||
TestFramework.registerTestModule("PlayerHandler", "Setup", function()
|
TestFramework.registerTestModule("LocalPlayerController", "Setup", function()
|
||||||
local Tests = {}
|
local Tests = {}
|
||||||
function Tests.InitializePlayer()
|
function Tests.InitializePlayer()
|
||||||
local pl = getPlayer()
|
local pl = getPlayer()
|
||||||
PlayerHandler.InitializePlayer(pl, true)
|
LocalPlayerController.InitializePlayer(true)
|
||||||
end
|
end
|
||||||
return Tests
|
return Tests
|
||||||
end)
|
end)
|
||||||
|
|
||||||
TestFramework.registerTestModule("PlayerHandler", "Perks", function()
|
TestFramework.registerTestModule("LocalPlayerController", "Perks", function()
|
||||||
local Tests = {}
|
local Tests = {}
|
||||||
|
|
||||||
function Tests.SetMaxPerks()
|
function Tests.SetMaxPerks()
|
||||||
@@ -46,7 +46,7 @@ TestFramework.registerTestModule("PlayerHandler", "Perks", function()
|
|||||||
return Tests
|
return Tests
|
||||||
end)
|
end)
|
||||||
|
|
||||||
TestFramework.registerTestModule("PlayerHandler", "Cicatrization", function()
|
TestFramework.registerTestModule("LocalPlayerController", "Cicatrization", function()
|
||||||
local Tests = {}
|
local Tests = {}
|
||||||
|
|
||||||
function Tests.SetCicatrizationTimeToOne()
|
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 PerfTest = require("PerfTest/main") -- SHould be global anyway
|
||||||
local CachedDataHandler = require("TOC/Handlers/CachedDataHandler")
|
local CachedDataHandler = require("TOC/Handlers/CachedDataHandler")
|
||||||
|
|
||||||
PerfTest.RegisterMethod("PlayerHandler", PlayerHandler, "InitializePlayer")
|
PerfTest.RegisterMethod("LocalPlayerController", LocalPlayerController, "InitializePlayer")
|
||||||
PerfTest.RegisterMethod("PlayerHandler", PlayerHandler, "UpdateAmputations")
|
PerfTest.RegisterMethod("LocalPlayerController", LocalPlayerController, "UpdateAmputations")
|
||||||
PerfTest.RegisterMethod("CachedDataHandler", CachedDataHandler, "CalculateHighestAmputatedLimbs")
|
PerfTest.RegisterMethod("CachedDataHandler", CachedDataHandler, "CalculateHighestAmputatedLimbs")
|
||||||
PerfTest.RegisterMethod("ISHealthPanel", ISHealthPanel, "render")
|
PerfTest.RegisterMethod("ISHealthPanel", ISHealthPanel, "render")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user