aligned some crap in the comments
This commit is contained in:
@@ -1,15 +1,17 @@
|
||||
local StaticData = require("TOC/StaticData")
|
||||
local ModDataHandler = require("TOC/Handlers/ModDataHandler")
|
||||
local CommonMethods = require("TOC/CommonMethods")
|
||||
---------------------------
|
||||
|
||||
---@class CachedDataHandler
|
||||
local CachedDataHandler = {}
|
||||
|
||||
|
||||
|
||||
--* Amputated Limbs caching *--
|
||||
CachedDataHandler.amputatedLimbs = {}
|
||||
|
||||
---Calcualte the currently amputated limbs for a certain player
|
||||
---@param username string
|
||||
function CachedDataHandler.CalculateAmputatedLimbs(username)
|
||||
local modDataHandler = ModDataHandler.GetInstance(username)
|
||||
for i=1, #StaticData.LIMBS_STRINGS do
|
||||
@@ -20,20 +22,26 @@ function CachedDataHandler.CalculateAmputatedLimbs(username)
|
||||
end
|
||||
end
|
||||
|
||||
---Add an amputated limb to the cached list
|
||||
---@param username string
|
||||
---@param limbName string
|
||||
function CachedDataHandler.AddAmputatedLimb(username, limbName)
|
||||
TOC_DEBUG.print("added " .. limbName .. " to known amputated limbs for " .. username)
|
||||
table.insert(CachedDataHandler.amputatedLimbs[username], limbName)
|
||||
end
|
||||
|
||||
---Returns a table containing the cached amputated limbs
|
||||
---@param username string
|
||||
---@return table
|
||||
function CachedDataHandler.GetAmputatedLimbs(username)
|
||||
return CachedDataHandler.amputatedLimbs[username]
|
||||
end
|
||||
|
||||
|
||||
--* Highest amputated limb per side caching *--
|
||||
CachedDataHandler.highestAmputatedLimbs = {}
|
||||
|
||||
|
||||
---Calcualate the highest point of amputations achieved by the player
|
||||
---@param username string
|
||||
function CachedDataHandler.CalculateHighestAmputatedLimbs(username)
|
||||
if CachedDataHandler.amputatedLimbs == nil or CachedDataHandler.amputatedLimbs[username] == nil then
|
||||
TOC_DEBUG.print("Amputated limbs weren't calculated. Trying to calculate them now for " .. username)
|
||||
@@ -60,6 +68,9 @@ function CachedDataHandler.CalculateHighestAmputatedLimbs(username)
|
||||
end
|
||||
end
|
||||
|
||||
---Get the cached highest point of amputation for each side
|
||||
---@param username string
|
||||
---@return table
|
||||
function CachedDataHandler.GetHighestAmputatedLimbs(username)
|
||||
return CachedDataHandler.highestAmputatedLimbs[username]
|
||||
end
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
local StaticData = require("TOC/StaticData")
|
||||
local CommonMethods = require("TOC/CommonMethods")
|
||||
|
||||
---------------------------
|
||||
|
||||
--- Submodule to handle spawning the correct items after certain actions (ie: cutting a hand). LOCAL ONLY!
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
local CommandsData = require("TOC/CommandsData")
|
||||
local StaticData = require("TOC/StaticData")
|
||||
|
||||
----------------
|
||||
|
||||
--- Handle all mod data related stuff
|
||||
@@ -10,8 +9,7 @@ local StaticData = require("TOC/StaticData")
|
||||
local ModDataHandler = {}
|
||||
ModDataHandler.instances = {}
|
||||
|
||||
-- Instead of requiring a player, to make it compatible in a MP env, we should require the table containing the modData for the init
|
||||
|
||||
---Setup a new Mod Data Handler
|
||||
---@param username string
|
||||
---@param isResetForced boolean?
|
||||
---@return ModDataHandler
|
||||
|
||||
@@ -1,16 +1,11 @@
|
||||
local ModDataHandler = require("TOC/Handlers/ModDataHandler")
|
||||
local CommonMethods = require("TOC/CommonMethods")
|
||||
local CachedDataHandler = require("TOC/Handlers/CachedDataHandler")
|
||||
|
||||
local StaticData = require("TOC/StaticData")
|
||||
-----------
|
||||
|
||||
-- TODO We should instantiate this anyway if we want to keep track of cut limbs here. Doing so, we would be able to handle other players too
|
||||
|
||||
|
||||
-- TODO THIS SHOULD BE LOCAL ONLY! WE'RE MANAGING EVENTS AND INITIALIZATION STUFF! MOVE ONLINE STUFF AWAY!
|
||||
|
||||
|
||||
-- LIST OF STUFF THAT THIS CLASS NEEDS TO DO
|
||||
-- Keep track of cut limbs so that we don't have to loop through all of them all the time
|
||||
-- Update current player status (infection checks)
|
||||
@@ -20,9 +15,6 @@ local StaticData = require("TOC/StaticData")
|
||||
---@field playerObj IsoPlayer
|
||||
local PlayerHandler = {}
|
||||
|
||||
PlayerHandler.amputatedLimbs = {}
|
||||
|
||||
|
||||
---Setup the Player Handler and modData, only for local client
|
||||
---@param playerObj IsoPlayer
|
||||
---@param isForced boolean?
|
||||
@@ -137,9 +129,9 @@ function ISBaseTimedAction:adjustMaxTime(maxTime)
|
||||
local modDataHandler = ModDataHandler.GetInstance()
|
||||
if time ~= -1 and modDataHandler and modDataHandler:getIsAnyLimbCut() then
|
||||
local pl = getPlayer()
|
||||
|
||||
for i=1, #PlayerHandler.amputatedLimbs do
|
||||
local limbName = PlayerHandler.amputatedLimbs[i]
|
||||
local amputatedLimbs = CachedDataHandler.GetAmputatedLimbs(pl:getUsername())
|
||||
for i=1, #amputatedLimbs do
|
||||
local limbName = amputatedLimbs[i]
|
||||
if modDataHandler:getIsCut(limbName) then
|
||||
local perk = Perks["Side_" .. CommonMethods.GetSide(limbName)]
|
||||
local perkLevel = pl:getPerkLevel(perk)
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
local CommonMethods = require("TOC/CommonMethods")
|
||||
local CachedDataHandler = require("TOC/Handlers/CachedDataHandler")
|
||||
|
||||
-------------------------
|
||||
|
||||
---@class ProsthesisHandler
|
||||
local ProsthesisHandler = {}
|
||||
|
||||
|
||||
---Cache the correct texture for the Health Panel for the currently equipped prosthesis
|
||||
function ProsthesisHandler.SetHealthPanelTexture()
|
||||
-- TODO do it
|
||||
|
||||
Reference in New Issue
Block a user