diff --git a/dev_stuff/logos/TOC_LOGOv2_ByChuck_169_with_title.png b/dev_stuff/logos/TOC_LOGOv2_ByChuck_169_with_title.png new file mode 100644 index 0000000..e88ca0d Binary files /dev/null and b/dev_stuff/logos/TOC_LOGOv2_ByChuck_169_with_title.png differ diff --git a/media/lua/client/TOC/Controllers/DataController.lua b/media/lua/client/TOC/Controllers/DataController.lua index 3e92de4..9157b43 100644 --- a/media/lua/client/TOC/Controllers/DataController.lua +++ b/media/lua/client/TOC/Controllers/DataController.lua @@ -368,6 +368,8 @@ end function DataController.ReceiveData(key, data) -- During startup the game can return Bob as the player username, adding a useless ModData table if key == "TOC_Bob" then return end + if not luautils.stringStarts(key, StaticData.MOD_NAME .. "_") then return end + TOC_DEBUG.print("ReceiveData for " .. key) if data == {} or data == nil then diff --git a/media/lua/client/TOC/Controllers/LocalPlayerController.lua b/media/lua/client/TOC/Controllers/LocalPlayerController.lua index dd18409..24bdc65 100644 --- a/media/lua/client/TOC/Controllers/LocalPlayerController.lua +++ b/media/lua/client/TOC/Controllers/LocalPlayerController.lua @@ -33,6 +33,9 @@ function LocalPlayerController.InitializePlayer(isForced) Events.OnAmputatedLimb.Add(LocalPlayerController.ToggleUpdateAmputations) LocalPlayerController.ToggleUpdateAmputations() + -- Manage their traits + LocalPlayerController.ManageTraits(playerObj) + -- Since isForced is used to reset an existing player data, we're gonna clean their ISHealthPanel table too if isForced then local ItemsController = require("TOC/Controllers/ItemsController") @@ -47,13 +50,16 @@ end ---Handles the traits ---@param playerObj IsoPlayer 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 if playerObj:HasTrait(k) then - -- Once we find one, we should be done. - local tempHandler = AmputationHandler:new(v) + -- Once we find one, we should be done since they're exclusive + local tempHandler = AmputationHandler:new(v, playerObj) tempHandler:execute(false) -- No damage tempHandler:close() + + -- The wound should be already cicatrized + LocalPlayerController.HandleSetCicatrization(DataController.GetInstance(), playerObj, v) return end end @@ -257,14 +263,11 @@ function LocalPlayerController.UpdateAmputations() cicTime = cicTime - cicDec - dcInst:setCicatrizationTime(limbName, cicTime) TOC_DEBUG.print("New cicatrization time: " .. tostring(cicTime)) if cicTime <= 0 then - TOC_DEBUG.print(tostring(limbName) .. " is cicatrized") - dcInst:setIsCicatrized(limbName, true) - -- Set visual - local ItemsController = require("TOC/Controllers/ItemsController") - ItemsController.Player.OverrideAmputationItemVisuals(pl, limbName, true) + LocalPlayerController.HandleSetCicatrization(dcInst, pl, limbName) + else + dcInst:setCicatrizationTime(limbName, cicTime) end end end @@ -285,6 +288,23 @@ function LocalPlayerController.ToggleUpdateAmputations() CommonMethods.SafeStartEvent("EveryHours", LocalPlayerController.UpdateAmputations) 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 diff --git a/media/lua/client/TOC/Main.lua b/media/lua/client/TOC/Main.lua index 4b8bc46..b2af52d 100644 --- a/media/lua/client/TOC/Main.lua +++ b/media/lua/client/TOC/Main.lua @@ -6,39 +6,12 @@ require("TOC/Events") ---@class Main local Main = { - _version = 2.0 + _version = "2.0.2" } ----Setups the custom traits -function Main.SetupTraits() - -- Perks.Left_Hand is defined in perks.txt - - local traitsTable = { - [1] = TraitFactory.addTrait("Amputee_Hand", getText("UI_trait_Amputee_Hand"), -8, getText("UI_trait_Amputee_Hand_desc"), false, false), - [2] = TraitFactory.addTrait("Amputee_LowerArm", getText("UI_trait_Amputee_LowerArm"), -10, getText("UI_trait_Amputee_LowerArm_desc"), false, false), - [3] = TraitFactory.addTrait("Amputee_UpperArm", getText("UI_trait_Amputee_UpperArm"), -20, getText("UI_trait_Amputee_UpperArm_desc"), false, false) - } - - for i=1, #traitsTable do - - ---@type Trait - local t = traitsTable[i] - ---@diagnostic disable-next-line: undefined-field - t:addXPBoost(Perks.Left_Hand, 4) - t:addXPBoost(Perks.Fitness, -1) - t:addXPBoost(Perks.Strength, -1) - end - - TraitFactory.addTrait("Insensitive", getText("UI_trait_Insensitive"), 6, getText("UI_trait_Insensitive_desc"), false, false) - - TraitFactory.setMutualExclusive("Amputee_Hand", "Amputee_LowerArm") - TraitFactory.setMutualExclusive("Amputee_Hand", "Amputee_UpperArm") - TraitFactory.setMutualExclusive("Amputee_LowerArm", "Amputee_UpperArm") -end - function Main.Start() - TOC_DEBUG.print("running Start method") - Main.SetupTraits() + TOC_DEBUG.print("Starting The Only Cure version " .. tostring(Main._version)) + --Main.SetupTraits() Main.SetupEvents() end @@ -47,6 +20,7 @@ function Main.SetupEvents() Events.OnReceivedTocData.Add(CachedDataHandler.CalculateCacheableValues) end + function Main.InitializePlayer() ---Looop until we've successfully initialized the mod local function TryToInitialize() diff --git a/media/lua/client/TOC/TimedActions/CauterizeAction.lua b/media/lua/client/TOC/TimedActions/CauterizeAction.lua index a27333b..5b1b454 100644 --- a/media/lua/client/TOC/TimedActions/CauterizeAction.lua +++ b/media/lua/client/TOC/TimedActions/CauterizeAction.lua @@ -1,5 +1,6 @@ require "TimedActions/ISBaseTimedAction" local DataController = require("TOC/Controllers/DataController") +local LocalPlayerController = require("TOC/Controllers/LocalPlayerController") --------------- ---@class CauterizeAction : ISBaseTimedAction @@ -72,11 +73,14 @@ function CauterizeAction:perform() local dcInst = DataController.GetInstance() dcInst:setCicatrizationTime(self.limbName, 0) - dcInst:setIsCicatrized(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() ISBaseTimedAction.perform(self) diff --git a/media/lua/shared/TOC/StaticData.lua b/media/lua/shared/TOC/StaticData.lua index 3eccec5..7d8d168 100644 --- a/media/lua/shared/TOC/StaticData.lua +++ b/media/lua/shared/TOC/StaticData.lua @@ -232,9 +232,9 @@ end -- Link a trait to a specific body part StaticData.TRAITS_BP = { - AmputeeHand = "Hand_L", - AmputeeLowerArm = "ForeArm_L", - AmputeeUpeerArm = "UpperArm_L" + Amputee_Hand = "Hand_L", + Amputee_ForeArm = "ForeArm_L", + Amputee_UpperArm = "UpperArm_L" } ----------------- diff --git a/media/lua/shared/TOC/Traits.lua b/media/lua/shared/TOC/Traits.lua new file mode 100644 index 0000000..3567bc6 --- /dev/null +++ b/media/lua/shared/TOC/Traits.lua @@ -0,0 +1,49 @@ + +---Setups the custom TOC traits + +local TRAITS = { + Amputee_Hand = "Amputee_Hand", + Amputee_ForeArm = "Amputee_ForeArm", + Amputee_UpperArm = "Amputee_UpperArm", + Insensitive = "Insensitive" +} + + +local function GetTraitText(trait) + return getText("UI_trait_" .. trait) +end + +local function GetTraitDesc(trait) + return getText("UI_trait_" .. trait .. "_desc") +end + + +local function SetupTraits() + -- Perks.Left_Hand is defined in perks.txt + + local traitsTable = { + [1] = TraitFactory.addTrait(TRAITS.Amputee_Hand, GetTraitText(TRAITS.Amputee_Hand), -8, GetTraitDesc(TRAITS.Amputee_Hand), false, false), + [2] = TraitFactory.addTrait(TRAITS.Amputee_ForeArm, GetTraitText(TRAITS.Amputee_ForeArm), -10, GetTraitDesc(TRAITS.Amputee_ForeArm), false, false), + [3] = TraitFactory.addTrait(TRAITS.Amputee_UpperArm, GetTraitText(TRAITS.Amputee_UpperArm), -20, GetTraitDesc(TRAITS.Amputee_UpperArm), false, false) + } + + for i=1, #traitsTable do + + ---@type Trait + local t = traitsTable[i] + ---@diagnostic disable-next-line: undefined-field + t:addXPBoost(Perks.Left_Hand, 4) + t:addXPBoost(Perks.Fitness, -1) + t:addXPBoost(Perks.Strength, -1) + end + + TraitFactory.addTrait(TRAITS.Insensitive, GetTraitText(TRAITS.Insensitive), 6, GetTraitDesc(TRAITS.Insensitive), false, false) + + TraitFactory.setMutualExclusive(TRAITS.Amputee_Hand, TRAITS.Amputee_ForeArm) + TraitFactory.setMutualExclusive(TRAITS.Amputee_Hand, TRAITS.Amputee_UpperArm) + TraitFactory.setMutualExclusive(TRAITS.Amputee_ForeArm, TRAITS.Amputee_UpperArm) +end + + + +Events.OnGameBoot.Add(SetupTraits) diff --git a/media/lua/shared/Translate/DE/UI_DE.txt b/media/lua/shared/Translate/DE/UI_DE.txt index d8ca09f..90e41b8 100644 --- a/media/lua/shared/Translate/DE/UI_DE.txt +++ b/media/lua/shared/Translate/DE/UI_DE.txt @@ -1,8 +1,8 @@ UI_DE = { UI_trait_Amputee_Hand = "Amputierte linke Hand", UI_trait_Amputee_Hand_desc = "", - UI_trait_Amputee_LowerArm = "Amputierter linker Unterarm", - UI_trait_Amputee_LowerArm_desc = "", + UI_trait_Amputee_ForeArm = "Amputierter linker Unterarm", + UI_trait_Amputee_ForeArm_desc = "", UI_trait_Amputee_UpperArm = "Amputierter linker Oberarm", UI_trait_Amputee_UpperArm_desc = "", UI_trait_Insensitive = "Unempfindlich", diff --git a/media/lua/shared/Translate/EN/UI_EN.txt b/media/lua/shared/Translate/EN/UI_EN.txt index 9c1ae70..3830283 100644 --- a/media/lua/shared/Translate/EN/UI_EN.txt +++ b/media/lua/shared/Translate/EN/UI_EN.txt @@ -2,8 +2,8 @@ UI_EN = { UI_trait_Amputee_Hand = "Amputated Left Hand", UI_trait_Amputee_Hand_desc = "", - UI_trait_Amputee_LowerArm = "Amputated Left Forearm", - UI_trait_Amputee_LowerArm_desc = "", + UI_trait_Amputee_ForeArm = "Amputated Left Forearm", + UI_trait_Amputee_ForeArm_desc = "", UI_trait_Amputee_UpperArm = "Amputated Left Upper arm", UI_trait_Amputee_UpperArm_desc = "", diff --git a/media/lua/shared/Translate/IT/ContextMenu_IT.txt b/media/lua/shared/Translate/IT/ContextMenu_IT.txt new file mode 100644 index 0000000..a97af70 --- /dev/null +++ b/media/lua/shared/Translate/IT/ContextMenu_IT.txt @@ -0,0 +1,33 @@ +ContextMenu_IT = { + ContextMenu_Amputate = "Amputa", + ContextMenu_Amputate_Bandage = "Amputa e fascia", + ContextMenu_Amputate_Stitch = "Amputa e metti i punti", + ContextMenu_Amputate_Stitch_Bandage = "Amputate, metti i punti e fascia", + + ContextMenu_Cauterize = "Cauterizza", + + ContextMenu_Limb_Hand_L = "Mano Sinistra", + ContextMenu_Limb_ForeArm_L = "Avambraccio Sinistro", + ContextMenu_Limb_UpperArm_L = "Braccio Superiore Sinistro", + ContextMenu_Limb_Hand_R = "Mano Destra", + ContextMenu_Limb_ForeArm_R = "Avambraccio Destro", + ContextMenu_Limb_UpperArm_R = "Braccio Superiore Destro", + + ContextMenu_InstallProstRight = "Installa protesi sul braccio destro", + ContextMenu_InstallProstLeft = "Installa protesi sul braccio sinistro", + + ContextMenu_PutTourniquetArmLeft = "Metti laccio emostatico sul braccio sinistro", + ContextMenu_PutTourniquetLegL = "Metti laccio emostatico sulla gamba sinistra", + ContextMenu_PutTourniquetArmRight = "Metti laccio emostatico sul braccio destro", + ContextMenu_PutTourniquetLegR = "Metti laccio emostatico sulla gamba destra", + + + ContextMenu_CleanWound = "Pulisci ferita", + + + + ContextMenu_Admin_TOC = "TOC", + ContextMenu_Admin_ResetTOC = "Reset Amputations", + ContextMenu_Admin_ForceAmputation = "Force Amputation", + +} diff --git a/media/lua/shared/Translate/IT/IG_UI_IT.txt b/media/lua/shared/Translate/IT/IG_UI_IT.txt new file mode 100644 index 0000000..61e43fd --- /dev/null +++ b/media/lua/shared/Translate/IT/IG_UI_IT.txt @@ -0,0 +1,18 @@ +IG_UI_IT = { + IGUI_perks_Amputations = "Amputazioni", + IGUI_perks_Side_R = "Parte destra", + IGUI_perks_Side_L = "Parte sinistra", + IGUI_perks_Prosthesis = "Protesi", + IGUI_perks_ProstFamiliarity= "Familiarità", + + IGUI_ItemCat_Prosthesis = "Protesi", + IGUI_ItemCat_Surgery = "Operazioni mediche", + IGUI_ItemCat_Amputation = "Amputazione" + + IGUI_HealthPanel_Cicatrization = "Cicatrizzazione", + IGUI_HealthPanel_Cicatrized = "Cicatrizzata", + IGUI_HealthPanel_Cauterized = "Cauterizzata", + IGUI_HealthPanel_WoundDirtyness = "Sporcizia della ferita", + IGUI_HealthPanel_ProstEquipped = "Protesi installata", + +} \ No newline at end of file diff --git a/media/lua/shared/Translate/IT/ItemName_IT.txt b/media/lua/shared/Translate/IT/ItemName_IT.txt new file mode 100644 index 0000000..cb70b25 --- /dev/null +++ b/media/lua/shared/Translate/IT/ItemName_IT.txt @@ -0,0 +1,11 @@ +ItemName_IT = { + + ItemName_TOC.Surg_Arm_Tourniquet_L = "Laccio emostatico", + ItemName_TOC.Surg_Arm_Tourniquet_R = "Laccio emostatico", + + ItemName_TOC.Prost_NormalArm_L = "Braccio Prostetico", + ItemName_TOC.Prost_NormalArm_R = "Braccio Prostetico", + + ItemName_TOC.Prost_HookArm_L = "Braccio prostetico - Uncino", + ItemName_TOC.Prost_HookArm_R = "Braccio prostetico - Uncino", +} \ No newline at end of file diff --git a/media/lua/shared/Translate/IT/Recipes_IT.txt b/media/lua/shared/Translate/IT/Recipes_IT.txt new file mode 100644 index 0000000..2a4350a --- /dev/null +++ b/media/lua/shared/Translate/IT/Recipes_IT.txt @@ -0,0 +1,4 @@ +Recipes_IT = { + Recipe_Craft_Prosthetic_Arm = "Costruisci un braccio prostetico", + Recipe_Craft_Prosthetic_Hook = "Costruisci un braccio prostetico con uncino", +} \ No newline at end of file diff --git a/media/lua/shared/Translate/IT/Sandbox_IT.txt b/media/lua/shared/Translate/IT/Sandbox_IT.txt new file mode 100644 index 0000000..502c36d --- /dev/null +++ b/media/lua/shared/Translate/IT/Sandbox_IT.txt @@ -0,0 +1,7 @@ +Sandbox_IT = { + Sandbox_TOC = "The Only Cure", + Sandbox_TOC_CicatrizationSpeed = "Velocità cicatrizzazione", + Sandbox_TOC_WoundDirtynessMultiplier = "Moltiplicatore sporcizia ferita", + Sandbox_TOC_SurgeonAbilityImportance = "Importanza abilità medico", + +} \ No newline at end of file diff --git a/media/lua/shared/Translate/IT/Tooltip_IT.txt b/media/lua/shared/Translate/IT/Tooltip_IT.txt new file mode 100644 index 0000000..fe59084 --- /dev/null +++ b/media/lua/shared/Translate/IT/Tooltip_IT.txt @@ -0,0 +1,10 @@ +Tooltip_IT = { + + Tooltip_Surgery_CantCauterize = "Non puoi cauterizzare la ferita", + + Tooltip_Surgery_And = " e " + Tooltip_Surgery_TempTooLow = "La temperatura è troppo bassa", + Tooltip_Surgery_Coward = "Non sei abbastanza coraggioso", + Tooltip_Surgery_LimbNotFree = "Devi rimuovere la protesi", + +} \ No newline at end of file diff --git a/media/lua/shared/Translate/IT/UI_IT.txt b/media/lua/shared/Translate/IT/UI_IT.txt new file mode 100644 index 0000000..4b58490 --- /dev/null +++ b/media/lua/shared/Translate/IT/UI_IT.txt @@ -0,0 +1,16 @@ +UI_IT = { + UI_trait_Amputee_Hand = "Mano Sinistra Amputata", + UI_trait_Amputee_Hand_desc = "", + + UI_trait_Amputee_ForeArm = "Avambraccio Sinistro Amputato", + UI_trait_Amputee_ForeArm_desc = "", + + UI_trait_Amputee_UpperArm = "Parte superiore del Braccio Sinistro Amputato", + UI_trait_Amputee_UpperArm_desc = "", + + UI_trait_Insensitive = "Insensibile", + UI_trait_Insensitive_desc = "", + + + UI_Say_CantEquip = "Non posso equipaggiarlo..." +} \ No newline at end of file diff --git a/media/ui/Traits/trait_Amputee_ForeArm.png b/media/ui/Traits/trait_Amputee_ForeArm.png new file mode 100644 index 0000000..c250059 Binary files /dev/null and b/media/ui/Traits/trait_Amputee_ForeArm.png differ diff --git a/media/ui/Traits/trait_Amputee_Hand.png b/media/ui/Traits/trait_Amputee_Hand.png new file mode 100644 index 0000000..d4c6884 Binary files /dev/null and b/media/ui/Traits/trait_Amputee_Hand.png differ diff --git a/media/ui/Traits/trait_Amputee_UpperArm.png b/media/ui/Traits/trait_Amputee_UpperArm.png new file mode 100644 index 0000000..7bf5666 Binary files /dev/null and b/media/ui/Traits/trait_Amputee_UpperArm.png differ diff --git a/media/ui/Traits/trait_insensitive.png b/media/ui/Traits/trait_insensitive.png new file mode 100644 index 0000000..4e86624 Binary files /dev/null and b/media/ui/Traits/trait_insensitive.png differ diff --git a/mod.info b/mod.info index 941d198..c7fcc63 100644 --- a/mod.info +++ b/mod.info @@ -1,8 +1,8 @@ name=The Only Cure poster=poster.png -description=Bitten? Not a problem! +description=You've been bitten. You have only two choices. id=TheOnlyCure icon=icon.png url=https://github.com/ZioPao/The-Only-Cure -modversion=2.0.1 +modversion=2.0.2 pzversion=41.65