From 35ead001b089ba10510f6b2b2f54fb0b0e662c56 Mon Sep 17 00:00:00 2001 From: ZioPao Date: Sat, 11 Nov 2023 17:53:04 +0100 Subject: [PATCH] Reorganizing --- media/lua/client/{TOC_API.lua => TOC/API.lua} | 0 .../{TOC_Common.lua => TOC/CommonMethods.lua} | 0 media/lua/client/{TOC_Debug.lua => TOC/Debug.lua} | 0 .../Handlers/AmputationHandler.lua} | 9 ++++----- .../Handlers/ItemsHandler.lua} | 4 ++-- .../Handlers/ModDataHandler.lua} | 2 +- .../Handlers/PlayerHandler.lua} | 14 +++++++------- .../Handlers/ProsthesisHandler.lua} | 4 ++-- media/lua/client/{TOC_Main.lua => TOC/Main.lua} | 2 +- media/lua/client/{TOC_Test.lua => TOC/Test.lua} | 2 +- .../TimedActions/CutLimbAction.lua} | 0 .../UI/CutLimbInteractions.lua} | 4 ++-- .../TOC_HealthPanel.lua => TOC/UI/HealthPanel.lua} | 6 +++--- .../UI/HealthPanelBaseHandler.lua} | 0 .../UI/ProsthesisBuilderUI.lua} | 0 .../UI/SurgeryInteractions.lua} | 5 ++--- media/lua/server/TOC/ModData.lua | 8 ++++++++ .../TOC/StaticData.lua} | 0 18 files changed, 33 insertions(+), 27 deletions(-) rename media/lua/client/{TOC_API.lua => TOC/API.lua} (100%) rename media/lua/client/{TOC_Common.lua => TOC/CommonMethods.lua} (100%) rename media/lua/client/{TOC_Debug.lua => TOC/Debug.lua} (100%) rename media/lua/client/{Handlers/TOC_AmputationHandler.lua => TOC/Handlers/AmputationHandler.lua} (92%) rename media/lua/client/{Handlers/TOC_ItemsHandler.lua => TOC/Handlers/ItemsHandler.lua} (97%) rename media/lua/client/{Handlers/TOC_ModDataHandler.lua => TOC/Handlers/ModDataHandler.lua} (98%) rename media/lua/client/{Handlers/TOC_PlayerHandler.lua => TOC/Handlers/PlayerHandler.lua} (91%) rename media/lua/client/{Handlers/TOC_ProsthesisHandler.lua => TOC/Handlers/ProsthesisHandler.lua} (92%) rename media/lua/client/{TOC_Main.lua => TOC/Main.lua} (94%) rename media/lua/client/{TOC_Test.lua => TOC/Test.lua} (97%) rename media/lua/client/{TimedActions/TOC_CutLimbAction.lua => TOC/TimedActions/CutLimbAction.lua} (100%) rename media/lua/client/{UI/TOC_CutLimbInteractions.lua => TOC/UI/CutLimbInteractions.lua} (96%) rename media/lua/client/{UI/TOC_HealthPanel.lua => TOC/UI/HealthPanel.lua} (95%) rename media/lua/client/{UI/TOC_HealthPanelBaseHandler.lua => TOC/UI/HealthPanelBaseHandler.lua} (100%) rename media/lua/client/{UI/TOC_ProsthesisBuilderUI.lua => TOC/UI/ProsthesisBuilderUI.lua} (100%) rename media/lua/client/{UI/TOC_SurgeryInteractions.lua => TOC/UI/SurgeryInteractions.lua} (90%) create mode 100644 media/lua/server/TOC/ModData.lua rename media/lua/{client/TOC_StaticData.lua => shared/TOC/StaticData.lua} (100%) diff --git a/media/lua/client/TOC_API.lua b/media/lua/client/TOC/API.lua similarity index 100% rename from media/lua/client/TOC_API.lua rename to media/lua/client/TOC/API.lua diff --git a/media/lua/client/TOC_Common.lua b/media/lua/client/TOC/CommonMethods.lua similarity index 100% rename from media/lua/client/TOC_Common.lua rename to media/lua/client/TOC/CommonMethods.lua diff --git a/media/lua/client/TOC_Debug.lua b/media/lua/client/TOC/Debug.lua similarity index 100% rename from media/lua/client/TOC_Debug.lua rename to media/lua/client/TOC/Debug.lua diff --git a/media/lua/client/Handlers/TOC_AmputationHandler.lua b/media/lua/client/TOC/Handlers/AmputationHandler.lua similarity index 92% rename from media/lua/client/Handlers/TOC_AmputationHandler.lua rename to media/lua/client/TOC/Handlers/AmputationHandler.lua index 2e3d82c..2e995d0 100644 --- a/media/lua/client/Handlers/TOC_AmputationHandler.lua +++ b/media/lua/client/TOC/Handlers/AmputationHandler.lua @@ -1,8 +1,7 @@ -local ModDataHandler = require("Handlers/TOC_ModDataHandler") -local StaticData = require("TOC_StaticData") -local ItemsHandler = require("Handlers/TOC_ItemsHandler") -local PlayerHandler = require("Handlers/TOC_PlayerHandler") - +local ModDataHandler = require("TOC/Handlers/ModDataHandler") +local ItemsHandler = require("TOC/Handlers/ItemsHandler") +local PlayerHandler = require("TOC/Handlers/PlayerHandler") +local StaticData = require("TOC/StaticData") --------------------------- -- TODO Add Bandages, Torniquet, etc. diff --git a/media/lua/client/Handlers/TOC_ItemsHandler.lua b/media/lua/client/TOC/Handlers/ItemsHandler.lua similarity index 97% rename from media/lua/client/Handlers/TOC_ItemsHandler.lua rename to media/lua/client/TOC/Handlers/ItemsHandler.lua index c94cd3a..e036763 100644 --- a/media/lua/client/Handlers/TOC_ItemsHandler.lua +++ b/media/lua/client/TOC/Handlers/ItemsHandler.lua @@ -1,5 +1,5 @@ -local StaticData = require("TOC_StaticData") -local CommonMethods = require("TOC_Common") +local StaticData = require("TOC/StaticData") +local CommonMethods = require("TOC/CommonMethods") --------------------------- diff --git a/media/lua/client/Handlers/TOC_ModDataHandler.lua b/media/lua/client/TOC/Handlers/ModDataHandler.lua similarity index 98% rename from media/lua/client/Handlers/TOC_ModDataHandler.lua rename to media/lua/client/TOC/Handlers/ModDataHandler.lua index 09f428f..5ba42d4 100644 --- a/media/lua/client/Handlers/TOC_ModDataHandler.lua +++ b/media/lua/client/TOC/Handlers/ModDataHandler.lua @@ -1,4 +1,4 @@ -local StaticData = require("TOC_StaticData") +local StaticData = require("TOC/StaticData") ---------------- ---@alias partData { isCut : boolean?, isInfected : boolean?, isOperated : boolean?, isCicatrized : boolean?, isCauterized : boolean?, isVisible : boolean?, cicatrizationTime : number } diff --git a/media/lua/client/Handlers/TOC_PlayerHandler.lua b/media/lua/client/TOC/Handlers/PlayerHandler.lua similarity index 91% rename from media/lua/client/Handlers/TOC_PlayerHandler.lua rename to media/lua/client/TOC/Handlers/PlayerHandler.lua index f8f321f..f75bc44 100644 --- a/media/lua/client/Handlers/TOC_PlayerHandler.lua +++ b/media/lua/client/TOC/Handlers/PlayerHandler.lua @@ -1,6 +1,6 @@ -local ModDataHandler = require("Handlers/TOC_ModDataHandler") -local CommonMethods = require("TOC_Common") -local StaticData = require("TOC_StaticData") +local ModDataHandler = require("TOC/Handlers/ModDataHandler") +local CommonMethods = require("TOC/CommonMethods") +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 @@ -20,7 +20,7 @@ local PlayerHandler = {} ---@param playerObj IsoPlayer ---@param isForced boolean? function PlayerHandler.InitializePlayer(_, playerObj, isForced) - PlayerHandler.modDataHandler = ModDataHandler:new(playerObj) + PlayerHandler.modDataHandler = ModDataHandler:new(playerObj) -- TODO This isn't gonna work for MP purposes PlayerHandler.modDataHandler:setup(isForced) PlayerHandler.playerObj = playerObj @@ -37,7 +37,7 @@ function PlayerHandler.InitializePlayer(_, playerObj, isForced) -- Since isForced is used to reset an existing player data, we're gonna clean their ISHealthPanel table too if isForced then ISHealthPanel.highestAmputations = {} - local ItemsHandler = require("Handlers/TOC_ItemsHandler") + local ItemsHandler = require("TOC/Handlers/ItemsHandler") ItemsHandler.DeleteAllOldAmputationItems(playerObj) end end @@ -62,12 +62,12 @@ end ---@param limbName string function PlayerHandler.AddLocalAmputatedLimb(limbName) print("TOC: added " .. limbName .. " to known amputated limbs") - table.insert(PlayerHandler.amputatedLimbs, limbName) + table.insert(PlayerHandler.amputatedLimbs, limbName) -- TODO This should be player specific, not generic end --* Getters *-- ----Get a table with the strings of the amputated limbs +---Get a table with the strings of the cached amputated limbs ---@return table function PlayerHandler.GetAmputatedLimbs() return PlayerHandler.amputatedLimbs or {} diff --git a/media/lua/client/Handlers/TOC_ProsthesisHandler.lua b/media/lua/client/TOC/Handlers/ProsthesisHandler.lua similarity index 92% rename from media/lua/client/Handlers/TOC_ProsthesisHandler.lua rename to media/lua/client/TOC/Handlers/ProsthesisHandler.lua index d838f01..34af12d 100644 --- a/media/lua/client/Handlers/TOC_ProsthesisHandler.lua +++ b/media/lua/client/TOC/Handlers/ProsthesisHandler.lua @@ -1,5 +1,5 @@ -local CommonMethods = require("TOC_Common") -local PlayerHandler = require("Handlers/TOC_PlayerHandler") +local CommonMethods = require("TOC/CommonMethods") +local PlayerHandler = require("TOC/Handlers/PlayerHandler") ------------------------- diff --git a/media/lua/client/TOC_Main.lua b/media/lua/client/TOC/Main.lua similarity index 94% rename from media/lua/client/TOC_Main.lua rename to media/lua/client/TOC/Main.lua index b6c6b92..b581b25 100644 --- a/media/lua/client/TOC_Main.lua +++ b/media/lua/client/TOC/Main.lua @@ -1,4 +1,4 @@ -local PlayerHandler = require("Handlers/TOC_PlayerHandler") +local PlayerHandler = require("TOC/Handlers/PlayerHandler") ------------------ diff --git a/media/lua/client/TOC_Test.lua b/media/lua/client/TOC/Test.lua similarity index 97% rename from media/lua/client/TOC_Test.lua rename to media/lua/client/TOC/Test.lua index a3c4a7f..5e3d4dd 100644 --- a/media/lua/client/TOC_Test.lua +++ b/media/lua/client/TOC/Test.lua @@ -2,7 +2,7 @@ if not getActivatedMods():contains("TEST_FRAMEWORK") or not isDebugEnabled() the local TestFramework = require("TestFramework/TestFramework") local TestUtils = require("TestFramework/TestUtils") -local PlayerHandler = require("Handlers/TOC_PlayerHandler") +local PlayerHandler = require("TOC/Handlers/PlayerHandler") local AmputationHandler = require("Handlers/TOC_AmputationHandler") diff --git a/media/lua/client/TimedActions/TOC_CutLimbAction.lua b/media/lua/client/TOC/TimedActions/CutLimbAction.lua similarity index 100% rename from media/lua/client/TimedActions/TOC_CutLimbAction.lua rename to media/lua/client/TOC/TimedActions/CutLimbAction.lua diff --git a/media/lua/client/UI/TOC_CutLimbInteractions.lua b/media/lua/client/TOC/UI/CutLimbInteractions.lua similarity index 96% rename from media/lua/client/UI/TOC_CutLimbInteractions.lua rename to media/lua/client/TOC/UI/CutLimbInteractions.lua index 37fde7d..b85788d 100644 --- a/media/lua/client/UI/TOC_CutLimbInteractions.lua +++ b/media/lua/client/TOC/UI/CutLimbInteractions.lua @@ -1,7 +1,7 @@ local BaseHandler = require("UI/TOC_HealthPanelBaseHandler") local CutLimbAction = require("TimedActions/TOC_CutLimbAction") -local StaticData = require("TOC_StaticData") -local ModDataHandler = require("Handlers/TOC_ModDataHandler") +local StaticData = require("TOC/StaticData") +local ModDataHandler = require("TOC/Handlers/ModDataHandler") --------------------- diff --git a/media/lua/client/UI/TOC_HealthPanel.lua b/media/lua/client/TOC/UI/HealthPanel.lua similarity index 95% rename from media/lua/client/UI/TOC_HealthPanel.lua rename to media/lua/client/TOC/UI/HealthPanel.lua index 3ca7918..938c4d5 100644 --- a/media/lua/client/UI/TOC_HealthPanel.lua +++ b/media/lua/client/TOC/UI/HealthPanel.lua @@ -1,6 +1,6 @@ -local PlayerHandler = require("Handlers/TOC_PlayerHandler") -local StaticData = require("TOC_StaticData") -local CommonMethods = require("TOC_Common") +local PlayerHandler = require("TOC/Handlers/PlayerHandler") +local StaticData = require("TOC/StaticData") +local CommonMethods = require("TOC/CommonMethods") ---@diagnostic disable: duplicate-set-field local CutLimbHandler = require("UI/TOC_CutLimbInteractions") diff --git a/media/lua/client/UI/TOC_HealthPanelBaseHandler.lua b/media/lua/client/TOC/UI/HealthPanelBaseHandler.lua similarity index 100% rename from media/lua/client/UI/TOC_HealthPanelBaseHandler.lua rename to media/lua/client/TOC/UI/HealthPanelBaseHandler.lua diff --git a/media/lua/client/UI/TOC_ProsthesisBuilderUI.lua b/media/lua/client/TOC/UI/ProsthesisBuilderUI.lua similarity index 100% rename from media/lua/client/UI/TOC_ProsthesisBuilderUI.lua rename to media/lua/client/TOC/UI/ProsthesisBuilderUI.lua diff --git a/media/lua/client/UI/TOC_SurgeryInteractions.lua b/media/lua/client/TOC/UI/SurgeryInteractions.lua similarity index 90% rename from media/lua/client/UI/TOC_SurgeryInteractions.lua rename to media/lua/client/TOC/UI/SurgeryInteractions.lua index 156c277..26d004c 100644 --- a/media/lua/client/UI/TOC_SurgeryInteractions.lua +++ b/media/lua/client/TOC/UI/SurgeryInteractions.lua @@ -1,6 +1,5 @@ -local PlayerHandler = require("Handlers/TOC_PlayerHandler") -local StaticData = require("TOC_StaticData") -local ModDataHandler = require("Handlers/TOC_ModDataHandler") +local PlayerHandler = require("TOC/Handlers/PlayerHandler") +local ModDataHandler = require("TOC/Handlers/ModDataHandler") --------------- diff --git a/media/lua/server/TOC/ModData.lua b/media/lua/server/TOC/ModData.lua new file mode 100644 index 0000000..9160fb5 --- /dev/null +++ b/media/lua/server/TOC/ModData.lua @@ -0,0 +1,8 @@ +-- Mh how do I require it from another folder? + +local TOCData = {} + + +-- function TOCData.Init() +-- ModData.getOrCreate(StaticData.MOD_NAME) +-- end \ No newline at end of file diff --git a/media/lua/client/TOC_StaticData.lua b/media/lua/shared/TOC/StaticData.lua similarity index 100% rename from media/lua/client/TOC_StaticData.lua rename to media/lua/shared/TOC/StaticData.lua