Fix to cicatrization visuals with traits
This commit is contained in:
@@ -50,13 +50,16 @@ end
|
|||||||
---Handles the traits
|
---Handles the traits
|
||||||
---@param playerObj IsoPlayer
|
---@param playerObj IsoPlayer
|
||||||
function LocalPlayerController.ManageTraits(playerObj)
|
function LocalPlayerController.ManageTraits(playerObj)
|
||||||
local AmputationHandler = require("Handlers/TOC_AmputationHandler")
|
local AmputationHandler = require("TOC/Handlers/AmputationHandler")
|
||||||
for k, v in pairs(StaticData.TRAITS_BP) do
|
for k, v in pairs(StaticData.TRAITS_BP) do
|
||||||
if playerObj:HasTrait(k) then
|
if playerObj:HasTrait(k) then
|
||||||
-- Once we find one, we should be done.
|
-- Once we find one, we should be done since they're exclusive
|
||||||
local tempHandler = AmputationHandler:new(v)
|
local tempHandler = AmputationHandler:new(v, playerObj)
|
||||||
tempHandler:execute(false) -- No damage
|
tempHandler:execute(false) -- No damage
|
||||||
tempHandler:close()
|
tempHandler:close()
|
||||||
|
|
||||||
|
-- The wound should be already cicatrized
|
||||||
|
LocalPlayerController.HandleSetCicatrization(DataController.GetInstance(), playerObj, v)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -260,14 +263,11 @@ function LocalPlayerController.UpdateAmputations()
|
|||||||
cicTime = cicTime - cicDec
|
cicTime = cicTime - cicDec
|
||||||
|
|
||||||
|
|
||||||
dcInst:setCicatrizationTime(limbName, cicTime)
|
|
||||||
TOC_DEBUG.print("New cicatrization time: " .. tostring(cicTime))
|
TOC_DEBUG.print("New cicatrization time: " .. tostring(cicTime))
|
||||||
if cicTime <= 0 then
|
if cicTime <= 0 then
|
||||||
TOC_DEBUG.print(tostring(limbName) .. " is cicatrized")
|
LocalPlayerController.HandleSetCicatrization(dcInst, pl, limbName)
|
||||||
dcInst:setIsCicatrized(limbName, true)
|
else
|
||||||
-- Set visual
|
dcInst:setCicatrizationTime(limbName, cicTime)
|
||||||
local ItemsController = require("TOC/Controllers/ItemsController")
|
|
||||||
ItemsController.Player.OverrideAmputationItemVisuals(pl, limbName, true)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -288,6 +288,23 @@ function LocalPlayerController.ToggleUpdateAmputations()
|
|||||||
CommonMethods.SafeStartEvent("EveryHours", LocalPlayerController.UpdateAmputations)
|
CommonMethods.SafeStartEvent("EveryHours", LocalPlayerController.UpdateAmputations)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
--* Cicatrization and cicatrization visuals *--
|
||||||
|
|
||||||
|
---Set the boolean and cicTime in DCINST and the visuals for the amputated limb
|
||||||
|
---@param dcInst DataController
|
||||||
|
---@param playerObj IsoPlayer
|
||||||
|
---@param limbName string
|
||||||
|
function LocalPlayerController.HandleSetCicatrization(dcInst, playerObj, limbName)
|
||||||
|
TOC_DEBUG.print(tostring(limbName) .. " is cicatrized")
|
||||||
|
dcInst:setIsCicatrized(limbName, true)
|
||||||
|
dcInst:setCicatrizationTime(limbName, 0)
|
||||||
|
|
||||||
|
-- Set visuals for the amputation
|
||||||
|
local ItemsController = require("TOC/Controllers/ItemsController")
|
||||||
|
ItemsController.Player.OverrideAmputationItemVisuals(playerObj, limbName, true)
|
||||||
|
end
|
||||||
|
|
||||||
--* Object drop handling when amputation occurs
|
--* Object drop handling when amputation occurs
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
require "TimedActions/ISBaseTimedAction"
|
require "TimedActions/ISBaseTimedAction"
|
||||||
local DataController = require("TOC/Controllers/DataController")
|
local DataController = require("TOC/Controllers/DataController")
|
||||||
|
local LocalPlayerController = require("TOC/Controllers/LocalPlayerController")
|
||||||
---------------
|
---------------
|
||||||
|
|
||||||
---@class CauterizeAction : ISBaseTimedAction
|
---@class CauterizeAction : ISBaseTimedAction
|
||||||
@@ -72,11 +73,14 @@ function CauterizeAction:perform()
|
|||||||
|
|
||||||
local dcInst = DataController.GetInstance()
|
local dcInst = DataController.GetInstance()
|
||||||
dcInst:setCicatrizationTime(self.limbName, 0)
|
dcInst:setCicatrizationTime(self.limbName, 0)
|
||||||
dcInst:setIsCicatrized(self.limbName, true)
|
|
||||||
dcInst:setIsCauterized(self.limbName, true)
|
dcInst:setIsCauterized(self.limbName, true)
|
||||||
|
|
||||||
-- we don't care about the depended limbs, since they're alread "cicatrized"
|
-- Set isCicatrized and the visuals in one go, since this action is gonna be run only on a single client
|
||||||
|
LocalPlayerController.HandleSetCicatrization(dcInst, self.character, self.limbName)
|
||||||
|
|
||||||
|
-- TODO Add specific visuals for cauterization
|
||||||
|
|
||||||
|
-- we don't care about the depended limbs, since they're alread "cicatrized"
|
||||||
dcInst:apply()
|
dcInst:apply()
|
||||||
|
|
||||||
ISBaseTimedAction.perform(self)
|
ISBaseTimedAction.perform(self)
|
||||||
|
|||||||
Reference in New Issue
Block a user