aligned some crap in the comments

This commit is contained in:
ZioPao
2023-11-13 03:41:14 +01:00
parent e374601402
commit 328d3c4d3a
13 changed files with 22 additions and 35 deletions

View File

@@ -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

View File

@@ -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!

View File

@@ -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

View File

@@ -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)

View File

@@ -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

View File

@@ -1,11 +1,9 @@
local PlayerHandler = require("TOC/Handlers/PlayerHandler")
------------------
---@class Main
local Main = {}
---Setups the custom traits
function Main.SetupTraits()
-- Perks.Left_Hand is defined in perks.txt
@@ -35,7 +33,6 @@ function Main.SetupTraits()
TraitFactory.setMutualExclusive("Amputee_LowerArm", "Amputee_UpperArm")
end
function Main.Start()
Main.SetupTraits()
@@ -44,7 +41,6 @@ function Main.Start()
end
function Main.Initialize()
local pl = getPlayer()
PlayerHandler.InitializePlayer(pl, false)

View File

@@ -1,7 +1,5 @@
require "TimedActions/ISBaseTimedAction"
local AmputationHandler = require("TOC/Handlers/AmputationHandler")
-----------------------------
---@class CutLimbAction : ISBaseTimedAction

View File

@@ -2,7 +2,6 @@ local BaseHandler = require("TOC/UI/HealthPanelBaseHandler")
local CutLimbAction = require("TOC/TimedActions/CutLimbAction")
local StaticData = require("TOC/StaticData")
local ModDataHandler = require("TOC/Handlers/ModDataHandler")
---------------------

View File

@@ -1,10 +1,8 @@
local StaticData = require("TOC/StaticData")
local ModDataHandler = require("TOC/Handlers/ModDataHandler")
local CachedDataHandler = require("TOC/Handlers/CachedDataHandler")
---@diagnostic disable: duplicate-set-field
local CutLimbHandler = require("TOC/UI/CutLimbInteractions")
---------------------------------
-- We're overriding ISHealthPanel to add custom textures to the body panel.

View File

@@ -1,6 +1,5 @@
local PlayerHandler = require("TOC/Handlers/PlayerHandler")
local ModDataHandler = require("TOC/Handlers/ModDataHandler")
---------------
-- TODO Surgery Kits