From 4e4d7752f29e746a5e454af98a005130c398ee87 Mon Sep 17 00:00:00 2001 From: Pao Date: Mon, 9 Jan 2023 23:04:54 +0100 Subject: [PATCH] Fixed a stupid mistake that broke the ovens --- media/lua/client/HealthStuff/HealthUpdate.lua | 14 ++--- media/lua/client/TOC_GlobalFunctions.lua | 54 +++++++------------ media/lua/client/TOC_UI.lua | 33 +++++++----- media/lua/client/TOC_main.lua | 9 +--- media/lua/shared/translate/EN/UI_EN.txt | 12 ++--- 5 files changed, 48 insertions(+), 74 deletions(-) diff --git a/media/lua/client/HealthStuff/HealthUpdate.lua b/media/lua/client/HealthStuff/HealthUpdate.lua index 6fce385..f562cec 100644 --- a/media/lua/client/HealthStuff/HealthUpdate.lua +++ b/media/lua/client/HealthStuff/HealthUpdate.lua @@ -46,15 +46,9 @@ local function healUpdatePart(partName, modData, player) if bodyPart:getFractureTime()>0 then bodyPart:setFractureTime(0) end -- During healing - -- this will not happen every 10 sec or some shit like that. - -- We will allow stitching. Surgery is needed only to have a faster cicatrization - - - if modData_part.IsCut and not modData_part.IsCicatrized then - - if modData_part.CicaTimeLeft < 0 then - player:Say(getText('UI_ContextMenu_My') .. partName .. getText('UI_ContextMenu_Now_cut')) -- dunno if this works. + if modData_part.CicaTimeLeft < 0 then + player:Say(getText('UI_ContextMenu_My') .. partName .. getText('UI_ContextMenu_Now_cut')) modData_part.IsCicatrized = true; player:getTraits():add("Brave") player:getTraits():add("Insensitive") @@ -63,9 +57,7 @@ local function healUpdatePart(partName, modData, player) bodyPart:setBleedingTime(0); bodyPart:setDeepWoundTime(0); player:transmitModData() - end - - + end end --Phantom pain diff --git a/media/lua/client/TOC_GlobalFunctions.lua b/media/lua/client/TOC_GlobalFunctions.lua index 3fe6dc0..a345312 100644 --- a/media/lua/client/TOC_GlobalFunctions.lua +++ b/media/lua/client/TOC_GlobalFunctions.lua @@ -26,19 +26,12 @@ function CutArm(partName, surgeonFact, useBandage, bandageAlcool, usePainkiller, stats:setEndurance(0 + surgeonFact); stats:setStress(100 - surgeonFact); - - --TODO this is broken -- Bandage - - - if useBandage then - bodyPart:setBandaged(true, 10) - - --if useBandage and bandageAlcool then - -- bodyPart:setBandaged(true, 10, true, bandage:getType()); - --elseif useBandage and not bandageAlcool then - -- bodyPart:setBandaged(true, 10, false, bandage:getType()); - --end + if useBandage and bandageAlcool then + bodyPart:setBandaged(true, 10, true, bandage:getType()); + elseif useBandage and not bandageAlcool then + bodyPart:setBandaged(true, 10, false, bandage:getType()); + end -- Painkiller if usePainkiller then @@ -143,13 +136,6 @@ function CutArm(partName, surgeonFact, useBandage, bandageAlcool, usePainkiller, --Equip cloth local cloth = player:getInventory():AddItem(find_clothName2_TOC(partName)); player:setWornItem(cloth:getBodyLocation(), cloth); - - -- Set the correct stats for the injury - bodyPart:setBleeding(true); - bodyPart:setDeepWounded(true); - bodyPart:setBleedingTime(100); - bodyPart:setDeepWoundTime(100); - player:transmitModData(); end @@ -157,7 +143,7 @@ function OperateArm(partName, surgeonFact, useOven) local player = getPlayer(); local modData = player:getModData().TOC; - if UseOven then + if useOven then local stats = character:getStats(); bodyPart:AddDamage(100); bodyPart:setAdditionalPain(100); @@ -168,13 +154,13 @@ function OperateArm(partName, surgeonFact, useOven) if partName == "RightHand" and not modData.RightHand.IsOperated then modData.RightHand.IsOperated = true; modData.RightHand.CicaTimeLeft = modData.RightHand.CicaTimeLeft - (surgeonFact * 200); - if UseOven then modData.RightHand.IsBurn = true end + if useOven then modData.RightHand.IsBurn = true end elseif partName == "RightForearm" and not modData.RightForearm.IsOperated then modData.RightForearm.IsOperated = true; modData.RightHand.IsOperated = true; modData.RightForearm.CicaTimeLeft = modData.RightForearm.CicaTimeLeft - (surgeonFact * 200); modData.RightHand.CicaTimeLeft = modData.RightHand.CicaTimeLeft - (surgeonFact * 200); - if UseOven then + if useOven then modData.TOC.RightHand.IsBurn = true; modData.TOC.RightForearm.IsBurn = true; end @@ -185,7 +171,7 @@ function OperateArm(partName, surgeonFact, useOven) modData.RightArm.CicaTimeLeft = modData.RightArm.CicaTimeLeft - (surgeonFact * 200); modData.RightForearm.CicaTimeLeft = modData.RightForearm.CicaTimeLeft - (surgeonFact * 200); modData.RightHand.CicaTimeLeft = modData.RightHand.CicaTimeLeft - (surgeonFact * 200); - if UseOven then + if useOven then modData.RightHand.IsBurn = true; modData.RightForearm.IsBurn = true; modData.RightArm.IsBurn = true; @@ -193,13 +179,13 @@ function OperateArm(partName, surgeonFact, useOven) elseif partName == "LeftHand" and not modData.LeftHand.IsOperated then modData.LeftHand.IsOperated = true; modData.LeftHand.CicaTimeLeft = modData.LeftHand.CicaTimeLeft - (surgeonFact * 200); - if UseOven then modData.LeftHand.IsBurn = true end + if useOven then modData.LeftHand.IsBurn = true end elseif partName == "LeftForearm" and not modData.LeftForearm.IsOperated then modData.LeftForearm.IsOperated = true; modData.LeftHand.IsOperated = true; modData.LeftForearm.CicaTimeLeft = modData.LeftForearm.CicaTimeLeft - (surgeonFact * 200); modData.LeftHand.CicaTimeLeft = modData.LeftHand.CicaTimeLeft - (surgeonFact * 200); - if UseOven then + if useOven then modData.LeftHand.IsBurn = true; modData.LeftForearm.IsBurn = true; end @@ -210,7 +196,7 @@ function OperateArm(partName, surgeonFact, useOven) modData.LeftArm.CicaTimeLeft = modData.LeftArm.CicaTimeLeft - (surgeonFact * 200); modData.LeftForearm.CicaTimeLeft = modData.LeftForearm.CicaTimeLeft - (surgeonFact * 200); modData.LeftHand.CicaTimeLeft = modData.LeftHand.CicaTimeLeft - (surgeonFact * 200); - if UseOven then + if useOven then modData.LeftHand.IsBurn = true; modData.LeftForearm.IsBurn = true; modData.LeftArm.IsBurn = true; @@ -218,23 +204,21 @@ function OperateArm(partName, surgeonFact, useOven) end FixDeepWound(partName) - - player:transmitModData(); end function FixDeepWound(partName) - a_rightArm = {"RightArm", "RightForearm", "RightHand"} - a_rightForearm = {"RightForearm", "RightHand"} - a_rightHand = {"RightHand"} + local a_rightArm = {"RightArm", "RightForearm", "RightHand"} + local a_rightForearm = {"RightForearm", "RightHand"} + local a_rightHand = {"RightHand"} - a_leftArm = {"LeftArm", "LeftForearm", "LeftHand"} - a_leftForearm = {"LeftForearm", "LeftHand"} - a_leftHand = {"LeftHand"} + local a_leftArm = {"LeftArm", "LeftForearm", "LeftHand"} + local a_leftForearm = {"LeftForearm", "LeftHand"} + local a_leftHand = {"LeftHand"} - + local chosen_array = {} if partName == "RightArm" then chosen_array = a_rightArm diff --git a/media/lua/client/TOC_UI.lua b/media/lua/client/TOC_UI.lua index 9fed46c..a1d0678 100644 --- a/media/lua/client/TOC_UI.lua +++ b/media/lua/client/TOC_UI.lua @@ -132,15 +132,16 @@ local function setDescUI(partName) descUI["textTitle"]:setText(getDisplayText_TOC(partName)); descUI.partNameAct = partName; - - - if partData.IsCut and partData.IsCicatrized and partData.IsEquiped then -- Cut and equip + -- Cut and equip + if partData.IsCut and partData.IsCicatrized and partData.IsEquiped then descUI["textEtat"]:setText("Cut and healed"); descUI["textEtat"]:setColor(1, 0, 1, 0); descUI["b1"]:setText("Unequip"); descUI["b1"]:addArg("option", "Unequip"); descUI["b1"]:setVisible(true); - elseif partData.IsCut and partData.IsCicatrized and not partData.IsEquiped and partData.ToDisplay then -- Cut and healed + + -- Cut and healed + elseif partData.IsCut and partData.IsCicatrized and not partData.IsEquiped and partData.ToDisplay then descUI["textEtat"]:setText("Cut and healed"); descUI["textEtat"]:setColor(1, 0, 1, 0); if partName == "RightArm" or partName == "LeftArm" then @@ -151,10 +152,9 @@ local function setDescUI(partName) descUI["b1"]:setVisible(true); end - - elseif partData.IsCut and not partData.IsCicatrized and partData.ToDisplay then -- Cut not healed - - if partData.IsOperated then: + -- Cut but not healed + elseif partData.IsCut and not partData.IsCicatrized and partData.ToDisplay then + if partData.IsOperated then if partData.CicaTimeLeft > 1000 then descUI["textEtat"]:setText("Still a long way to go") descUI["textEtat"]:setColor(1, 0.8, 1, 0.2); @@ -162,12 +162,13 @@ local function setDescUI(partName) descUI["textEtat"]:setText("Starting to get better") descUI["textEtat"]:setColor(1, 0.8, 1, 0.2) - elseif partData.CicaTime > 100 + elseif partData.CicaTimeLeft > 100 then descUI["textEtat"]:setText("Almost cicatrized"); descUI["textEtat"]:setColor(1, 0.8, 1, 0.2); + end else if partData.CicaTimeLeft > 1000 then - descUI["textEtat"]:setText("It hurts so much..." .. partData.CicaTimeLeft) + descUI["textEtat"]:setText("It hurts so much...") descUI["textEtat"]:setColor(1, 1, 0, 0) elseif partData.CicaTimeLeft > 500 then descUI["textEtat"]:setText("It still hurts a lot") @@ -175,13 +176,17 @@ local function setDescUI(partName) elseif partData.CicaTimeLeft > 500 then descUI["textEtat"]:setText("I think it's almost over...") descUI["textEtat"]:setColor(1, 0.8, 1, 0.2) + end + end + + -- Set visibility if partData.IsOperated then - descUI["b1"]:setVisible(false) + descUI["b1"]:setVisible(false); else - descUI["b1"]:setText("Operate") - descUI["b1"]:addArg("option", "Operate") - descUI["b1"]:setVisible(true) + descUI["b1"]:setText("Operate"); + descUI["b1"]:addArg("option", "Operate"); + descUI["b1"]:setVisible(true); end elseif partData.IsCut and not partData.ToDisplay then -- Empty (hand if forearm cut) descUI["textEtat"]:setText("Nothing here..."); diff --git a/media/lua/client/TOC_main.lua b/media/lua/client/TOC_main.lua index a28f112..2fa1f2f 100644 --- a/media/lua/client/TOC_main.lua +++ b/media/lua/client/TOC_main.lua @@ -24,7 +24,6 @@ end local function everyTenMinutes() local player = getPlayer() local modData = player:getModData() - if modData.TOC ~= nil then local names = {"RightHand", "RightForearm", "RightArm", "LeftHand", "LeftForearm", "LeftArm"} @@ -34,14 +33,8 @@ local function everyTenMinutes() --Reduit le temps de cicatri restant for i,name in pairs(names) do - if modData.TOC[name].IsCut and not modData.TOC[name].IsCicatrized then - - if modData.TOC[name].IsOperated then - modData.TOC[name].CicaTimeLeft = modData.TOC[name].CicaTimeLeft - 1; - else - modData.TOC[name].CicaTimeLeft = modData.TOC[name].CicaTimeLeft - 10; - + modData.TOC[name].CicaTimeLeft = modData.TOC[name].CicaTimeLeft - 1; player:transmitModData() end end diff --git a/media/lua/shared/translate/EN/UI_EN.txt b/media/lua/shared/translate/EN/UI_EN.txt index ad3bdc5..06d593d 100644 --- a/media/lua/shared/translate/EN/UI_EN.txt +++ b/media/lua/shared/translate/EN/UI_EN.txt @@ -6,14 +6,14 @@ UI_EN = { UI_ContextMenu_CutArm = "Cut arm", UI_prof_surgeon = "Surgeon", - UI_profdesc_surgeon = "You are a surgeon ! Start with all recipe of the mod the only cure.
You are also better to cut and operate.", + UI_profdesc_surgeon = "You are a surgeon! Start with all recipe of the mod the only cure.
You are also better to cut and operate.", UI_trait_Amputee1 = "Amputee hand", - UI_trait_Amputee1desc = "Begin the game a hand cut and heal but also a metal hook.", + UI_trait_Amputee1desc = "Begin the game without a hand but also a metal hook.", UI_trait_Amputee2 = "Amputee forearm", - UI_trait_Amputee2desc = "Begin the game a forearm cut and heal but also a metal hook.", + UI_trait_Amputee2desc = "Begin the game without a forearm but also a metal hook.", UI_trait_Amputee3 = "Amputee arm", - UI_trait_Amputee3desc = "Begin the game an arm cut and heal, good luck.", + UI_trait_Amputee3desc = "Begin the game without an arm, good luck.", UI_trait_Insensitive = "Insensitive to pain", UI_trait_Insensitivedesc = "Reduces maximum pain.", @@ -25,8 +25,8 @@ UI_EN = { UI_ContextMenu_LeftArm = "Left arm", UI_ContextMenu_My = "My ", - UI_ContextMenu_Now_cut = " is now heal !", + UI_ContextMenu_Now_cut = " is now healed!", UI_ContextMenu_Heal_from_zomb = "I heal from zombification !", - UI_ContextMenu_Cut_for_nothing = "I cut for nothing..." + UI_ContextMenu_Cut_for_nothing = "I did it for nothing..." } \ No newline at end of file