From a3a26141241d963e4b45c20521dfa45c71ca6842 Mon Sep 17 00:00:00 2001 From: ZioPao Date: Sat, 4 May 2024 16:27:46 +0200 Subject: [PATCH] Fixed traits --- .../TOC/Controllers/LocalPlayerController.lua | 3 ++ media/lua/client/TOC/Main.lua | 34 ++---------- media/lua/shared/TOC/StaticData.lua | 6 +-- media/lua/shared/TOC/Traits.lua | 49 ++++++++++++++++++ media/lua/shared/Translate/DE/UI_DE.txt | 4 +- media/lua/shared/Translate/EN/UI_EN.txt | 4 +- media/ui/Traits/trait_Amputee_ForeArm.png | Bin 0 -> 1298 bytes media/ui/Traits/trait_Amputee_Hand.png | Bin 0 -> 1296 bytes media/ui/Traits/trait_Amputee_UpperArm.png | Bin 0 -> 1327 bytes media/ui/Traits/trait_insensitive.png | Bin 0 -> 237 bytes 10 files changed, 63 insertions(+), 37 deletions(-) create mode 100644 media/lua/shared/TOC/Traits.lua create mode 100644 media/ui/Traits/trait_Amputee_ForeArm.png create mode 100644 media/ui/Traits/trait_Amputee_Hand.png create mode 100644 media/ui/Traits/trait_Amputee_UpperArm.png create mode 100644 media/ui/Traits/trait_insensitive.png 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 0000000000000000000000000000000000000000..c250059955e748f9032ae61426aab04c3e1aa12e GIT binary patch literal 1298 zcmah}eTdU$7*9FR>D@Y9(L=OCmODRSwn^G1m&R6?Hdn7;?|Qwm)_-nGlh-y}lQ$;m zTJJBBv7y|#KQ?4=u)&6+vbiZc!6_(i(}C`Epdw?kF~-I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cNWQ~gHmd8v5_?LL3_vE#aD{>akC=$)(1wyTRKs80^HUBkBSS@uuQqLELdt*54s zUFqh2h(9>@+nNLGMqe&;o{fC{_s*HwN3O*V<{x(7+ut;2e8%bQO+|n76;E~_xby0C z@49`5$DXZxb-&4J{2XpQI<+_>Ex-TKiC@3p!(RTX@#xf&R-ioEIQ#Cc*Eg4C8j7I{ zPj637PdxsmzdiHf+o!?&zwCxE>vuf)V~k&MW_Yw^$IOwnf2}^d n_sOm4-H-NeDI9+}ogC2{F8C@*cu1gt literal 0 HcmV?d00001 diff --git a/media/ui/Traits/trait_Amputee_UpperArm.png b/media/ui/Traits/trait_Amputee_UpperArm.png new file mode 100644 index 0000000000000000000000000000000000000000..7bf5666f139d68e2e8e07a9bea1886ad8fc8983f GIT binary patch literal 1327 zcmeAS@N?(olHy`uVBq!ia0vp^LLkh+1|-AI^@Rf|#^NA%Cx&(BWL^R}Ea{HEjtmSN z`?>!lvI6;>1s;*b3=DjSL74G){)!X^2IkY5ArU1JzCKpT`MG+DDfvmMdKI|^K-CNk zHue<-iOJciB??KY>6v-9O7C~?S5nAKu~iB;^)>J+ zYH@N=WDyQhn-5>P}hB{Rj!(8SQ$$kD{Y2}l_lx>{ITni*S| znwmPgnK(LHn7YFBdgc|EB<3Zj!t`b$^qS+y1jQo=P;*9(P z1?ONhh49S0l>G8ySWE!p0_xn2NV zl_n+T=cU@{gVGL=4@#a801-mgXQPi{K12~x8Uz~v5d|i2AkRi0p1VLicn(d?17^!2 zVE(%puDTSMci(!tIEGmGubq65_mF`AORk8bBX>;(>#PQL-2leB0URXFQ(ZJiH2V71pX~9A7H=&Qtx&EjQdyjQ@usxxi33w(oCQBSZkpn< zS5hnJ`uCTD50$6pQaFeV{wqX6T`Z5GB1G~mUKs7M+SzC z{oH>NS%G}c0G|-o5C+p73|>H9$hIgxAjMn~anMpkSP*i(`mJaBrWZP=f&nGxPuYEuI|LE_VCOo>rRL^>2!RL8d^6kBG3S3fpJH zmLI_A{H^Hk Zta=L>uT5jTpa-;x!PC{xWt~$(69B-LOilm* literal 0 HcmV?d00001