aligned some crap in the comments
This commit is contained in:
@@ -1,15 +1,17 @@
|
|||||||
local StaticData = require("TOC/StaticData")
|
local StaticData = require("TOC/StaticData")
|
||||||
local ModDataHandler = require("TOC/Handlers/ModDataHandler")
|
local ModDataHandler = require("TOC/Handlers/ModDataHandler")
|
||||||
local CommonMethods = require("TOC/CommonMethods")
|
local CommonMethods = require("TOC/CommonMethods")
|
||||||
|
---------------------------
|
||||||
|
|
||||||
---@class CachedDataHandler
|
---@class CachedDataHandler
|
||||||
local CachedDataHandler = {}
|
local CachedDataHandler = {}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
--* Amputated Limbs caching *--
|
--* Amputated Limbs caching *--
|
||||||
CachedDataHandler.amputatedLimbs = {}
|
CachedDataHandler.amputatedLimbs = {}
|
||||||
|
|
||||||
|
---Calcualte the currently amputated limbs for a certain player
|
||||||
|
---@param username string
|
||||||
function CachedDataHandler.CalculateAmputatedLimbs(username)
|
function CachedDataHandler.CalculateAmputatedLimbs(username)
|
||||||
local modDataHandler = ModDataHandler.GetInstance(username)
|
local modDataHandler = ModDataHandler.GetInstance(username)
|
||||||
for i=1, #StaticData.LIMBS_STRINGS do
|
for i=1, #StaticData.LIMBS_STRINGS do
|
||||||
@@ -20,20 +22,26 @@ function CachedDataHandler.CalculateAmputatedLimbs(username)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
---Add an amputated limb to the cached list
|
||||||
|
---@param username string
|
||||||
|
---@param limbName string
|
||||||
function CachedDataHandler.AddAmputatedLimb(username, limbName)
|
function CachedDataHandler.AddAmputatedLimb(username, limbName)
|
||||||
TOC_DEBUG.print("added " .. limbName .. " to known amputated limbs for " .. username)
|
TOC_DEBUG.print("added " .. limbName .. " to known amputated limbs for " .. username)
|
||||||
table.insert(CachedDataHandler.amputatedLimbs[username], limbName)
|
table.insert(CachedDataHandler.amputatedLimbs[username], limbName)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
---Returns a table containing the cached amputated limbs
|
||||||
|
---@param username string
|
||||||
|
---@return table
|
||||||
function CachedDataHandler.GetAmputatedLimbs(username)
|
function CachedDataHandler.GetAmputatedLimbs(username)
|
||||||
return CachedDataHandler.amputatedLimbs[username]
|
return CachedDataHandler.amputatedLimbs[username]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--* Highest amputated limb per side caching *--
|
--* Highest amputated limb per side caching *--
|
||||||
CachedDataHandler.highestAmputatedLimbs = {}
|
CachedDataHandler.highestAmputatedLimbs = {}
|
||||||
|
|
||||||
|
---Calcualate the highest point of amputations achieved by the player
|
||||||
|
---@param username string
|
||||||
function CachedDataHandler.CalculateHighestAmputatedLimbs(username)
|
function CachedDataHandler.CalculateHighestAmputatedLimbs(username)
|
||||||
if CachedDataHandler.amputatedLimbs == nil or CachedDataHandler.amputatedLimbs[username] == nil then
|
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)
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
---Get the cached highest point of amputation for each side
|
||||||
|
---@param username string
|
||||||
|
---@return table
|
||||||
function CachedDataHandler.GetHighestAmputatedLimbs(username)
|
function CachedDataHandler.GetHighestAmputatedLimbs(username)
|
||||||
return CachedDataHandler.highestAmputatedLimbs[username]
|
return CachedDataHandler.highestAmputatedLimbs[username]
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
local StaticData = require("TOC/StaticData")
|
local StaticData = require("TOC/StaticData")
|
||||||
local CommonMethods = require("TOC/CommonMethods")
|
local CommonMethods = require("TOC/CommonMethods")
|
||||||
|
|
||||||
---------------------------
|
---------------------------
|
||||||
|
|
||||||
--- Submodule to handle spawning the correct items after certain actions (ie: cutting a hand). LOCAL ONLY!
|
--- 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 CommandsData = require("TOC/CommandsData")
|
||||||
local StaticData = require("TOC/StaticData")
|
local StaticData = require("TOC/StaticData")
|
||||||
|
|
||||||
----------------
|
----------------
|
||||||
|
|
||||||
--- Handle all mod data related stuff
|
--- Handle all mod data related stuff
|
||||||
@@ -10,8 +9,7 @@ local StaticData = require("TOC/StaticData")
|
|||||||
local ModDataHandler = {}
|
local ModDataHandler = {}
|
||||||
ModDataHandler.instances = {}
|
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 username string
|
||||||
---@param isResetForced boolean?
|
---@param isResetForced boolean?
|
||||||
---@return ModDataHandler
|
---@return ModDataHandler
|
||||||
|
|||||||
@@ -1,16 +1,11 @@
|
|||||||
local ModDataHandler = require("TOC/Handlers/ModDataHandler")
|
local ModDataHandler = require("TOC/Handlers/ModDataHandler")
|
||||||
local CommonMethods = require("TOC/CommonMethods")
|
local CommonMethods = require("TOC/CommonMethods")
|
||||||
local CachedDataHandler = require("TOC/Handlers/CachedDataHandler")
|
local CachedDataHandler = require("TOC/Handlers/CachedDataHandler")
|
||||||
|
|
||||||
local StaticData = require("TOC/StaticData")
|
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!
|
-- 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
|
-- 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
|
-- 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)
|
-- Update current player status (infection checks)
|
||||||
@@ -20,9 +15,6 @@ local StaticData = require("TOC/StaticData")
|
|||||||
---@field playerObj IsoPlayer
|
---@field playerObj IsoPlayer
|
||||||
local PlayerHandler = {}
|
local PlayerHandler = {}
|
||||||
|
|
||||||
PlayerHandler.amputatedLimbs = {}
|
|
||||||
|
|
||||||
|
|
||||||
---Setup the Player Handler and modData, only for local client
|
---Setup the Player Handler and modData, only for local client
|
||||||
---@param playerObj IsoPlayer
|
---@param playerObj IsoPlayer
|
||||||
---@param isForced boolean?
|
---@param isForced boolean?
|
||||||
@@ -137,9 +129,9 @@ function ISBaseTimedAction:adjustMaxTime(maxTime)
|
|||||||
local modDataHandler = ModDataHandler.GetInstance()
|
local modDataHandler = ModDataHandler.GetInstance()
|
||||||
if time ~= -1 and modDataHandler and modDataHandler:getIsAnyLimbCut() then
|
if time ~= -1 and modDataHandler and modDataHandler:getIsAnyLimbCut() then
|
||||||
local pl = getPlayer()
|
local pl = getPlayer()
|
||||||
|
local amputatedLimbs = CachedDataHandler.GetAmputatedLimbs(pl:getUsername())
|
||||||
for i=1, #PlayerHandler.amputatedLimbs do
|
for i=1, #amputatedLimbs do
|
||||||
local limbName = PlayerHandler.amputatedLimbs[i]
|
local limbName = amputatedLimbs[i]
|
||||||
if modDataHandler:getIsCut(limbName) then
|
if modDataHandler:getIsCut(limbName) then
|
||||||
local perk = Perks["Side_" .. CommonMethods.GetSide(limbName)]
|
local perk = Perks["Side_" .. CommonMethods.GetSide(limbName)]
|
||||||
local perkLevel = pl:getPerkLevel(perk)
|
local perkLevel = pl:getPerkLevel(perk)
|
||||||
|
|||||||
@@ -1,12 +1,10 @@
|
|||||||
local CommonMethods = require("TOC/CommonMethods")
|
local CommonMethods = require("TOC/CommonMethods")
|
||||||
local CachedDataHandler = require("TOC/Handlers/CachedDataHandler")
|
local CachedDataHandler = require("TOC/Handlers/CachedDataHandler")
|
||||||
|
|
||||||
-------------------------
|
-------------------------
|
||||||
|
|
||||||
---@class ProsthesisHandler
|
---@class ProsthesisHandler
|
||||||
local ProsthesisHandler = {}
|
local ProsthesisHandler = {}
|
||||||
|
|
||||||
|
|
||||||
---Cache the correct texture for the Health Panel for the currently equipped prosthesis
|
---Cache the correct texture for the Health Panel for the currently equipped prosthesis
|
||||||
function ProsthesisHandler.SetHealthPanelTexture()
|
function ProsthesisHandler.SetHealthPanelTexture()
|
||||||
-- TODO do it
|
-- TODO do it
|
||||||
|
|||||||
@@ -1,11 +1,9 @@
|
|||||||
local PlayerHandler = require("TOC/Handlers/PlayerHandler")
|
local PlayerHandler = require("TOC/Handlers/PlayerHandler")
|
||||||
|
|
||||||
|
|
||||||
------------------
|
------------------
|
||||||
|
|
||||||
---@class Main
|
---@class Main
|
||||||
local Main = {}
|
local Main = {}
|
||||||
|
|
||||||
|
|
||||||
---Setups the custom traits
|
---Setups the custom traits
|
||||||
function Main.SetupTraits()
|
function Main.SetupTraits()
|
||||||
-- Perks.Left_Hand is defined in perks.txt
|
-- Perks.Left_Hand is defined in perks.txt
|
||||||
@@ -35,7 +33,6 @@ function Main.SetupTraits()
|
|||||||
TraitFactory.setMutualExclusive("Amputee_LowerArm", "Amputee_UpperArm")
|
TraitFactory.setMutualExclusive("Amputee_LowerArm", "Amputee_UpperArm")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function Main.Start()
|
function Main.Start()
|
||||||
Main.SetupTraits()
|
Main.SetupTraits()
|
||||||
|
|
||||||
@@ -44,7 +41,6 @@ function Main.Start()
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function Main.Initialize()
|
function Main.Initialize()
|
||||||
local pl = getPlayer()
|
local pl = getPlayer()
|
||||||
PlayerHandler.InitializePlayer(pl, false)
|
PlayerHandler.InitializePlayer(pl, false)
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
require "TimedActions/ISBaseTimedAction"
|
require "TimedActions/ISBaseTimedAction"
|
||||||
local AmputationHandler = require("TOC/Handlers/AmputationHandler")
|
local AmputationHandler = require("TOC/Handlers/AmputationHandler")
|
||||||
|
|
||||||
|
|
||||||
-----------------------------
|
-----------------------------
|
||||||
|
|
||||||
---@class CutLimbAction : ISBaseTimedAction
|
---@class CutLimbAction : ISBaseTimedAction
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ local BaseHandler = require("TOC/UI/HealthPanelBaseHandler")
|
|||||||
local CutLimbAction = require("TOC/TimedActions/CutLimbAction")
|
local CutLimbAction = require("TOC/TimedActions/CutLimbAction")
|
||||||
local StaticData = require("TOC/StaticData")
|
local StaticData = require("TOC/StaticData")
|
||||||
local ModDataHandler = require("TOC/Handlers/ModDataHandler")
|
local ModDataHandler = require("TOC/Handlers/ModDataHandler")
|
||||||
|
|
||||||
---------------------
|
---------------------
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,8 @@
|
|||||||
local StaticData = require("TOC/StaticData")
|
local StaticData = require("TOC/StaticData")
|
||||||
local ModDataHandler = require("TOC/Handlers/ModDataHandler")
|
local ModDataHandler = require("TOC/Handlers/ModDataHandler")
|
||||||
local CachedDataHandler = require("TOC/Handlers/CachedDataHandler")
|
local CachedDataHandler = require("TOC/Handlers/CachedDataHandler")
|
||||||
|
|
||||||
---@diagnostic disable: duplicate-set-field
|
---@diagnostic disable: duplicate-set-field
|
||||||
local CutLimbHandler = require("TOC/UI/CutLimbInteractions")
|
local CutLimbHandler = require("TOC/UI/CutLimbInteractions")
|
||||||
|
|
||||||
---------------------------------
|
---------------------------------
|
||||||
|
|
||||||
-- We're overriding ISHealthPanel to add custom textures to the body panel.
|
-- We're overriding ISHealthPanel to add custom textures to the body panel.
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
local PlayerHandler = require("TOC/Handlers/PlayerHandler")
|
local PlayerHandler = require("TOC/Handlers/PlayerHandler")
|
||||||
local ModDataHandler = require("TOC/Handlers/ModDataHandler")
|
local ModDataHandler = require("TOC/Handlers/ModDataHandler")
|
||||||
|
|
||||||
---------------
|
---------------
|
||||||
|
|
||||||
-- TODO Surgery Kits
|
-- TODO Surgery Kits
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
local CommandsData = require("TOC/CommandsData")
|
local CommandsData = require("TOC/CommandsData")
|
||||||
local ServerDataHandler = require("TOC/ServerDataHandler")
|
local ServerDataHandler = require("TOC/ServerDataHandler")
|
||||||
|
|
||||||
----------------------------
|
----------------------------
|
||||||
|
|
||||||
local DebugCommands = {}
|
local DebugCommands = {}
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
local StaticData = require("TOC/StaticData")
|
local StaticData = require("TOC/StaticData")
|
||||||
|
|
||||||
------------------------
|
------------------------
|
||||||
|
|
||||||
local CommandsData = {}
|
local CommandsData = {}
|
||||||
@@ -8,8 +7,9 @@ CommandsData.modules = {
|
|||||||
TOC_DEBUG = "TOC_DEBUG"
|
TOC_DEBUG = "TOC_DEBUG"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CommandsData.client = {
|
||||||
|
|
||||||
CommandsData.client = {}
|
}
|
||||||
|
|
||||||
CommandsData.server = {
|
CommandsData.server = {
|
||||||
Debug = {
|
Debug = {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
---@alias partData { isCut : boolean?, isInfected : boolean?, isOperated : boolean?, isCicatrized : boolean?, isCauterized : boolean?, isVisible : boolean?, cicatrizationTime : number }
|
---@alias partData { isCut : boolean?, isInfected : boolean?, isOperated : boolean?, isCicatrized : boolean?, isCauterized : boolean?, isVisible : boolean?, cicatrizationTime : number }
|
||||||
---@alias tocModData {Hand_L : partData, ForeArm_L : partData, UpperArm_L : partData, Hand_R : partData, ForeArm_R : partData, UpperArm_R : partData, isIgnoredPartInfected : boolean, isAnyLimbCut : boolean}
|
---@alias tocModData {Hand_L : partData, ForeArm_L : partData, UpperArm_L : partData, Hand_R : partData, ForeArm_R : partData, UpperArm_R : partData, isIgnoredPartInfected : boolean, isAnyLimbCut : boolean}
|
||||||
|
---------------------------
|
||||||
|
|
||||||
local StaticData = {}
|
local StaticData = {}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user