diff --git a/media/lua/client/TOC/Controllers/LocalPlayerController.lua b/media/lua/client/TOC/Controllers/LocalPlayerController.lua index dd18409..b13b1e4 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") 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/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/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