From 7c5e98d8286d70627fa476a2b438ccf1dbf1cb8e Mon Sep 17 00:00:00 2001 From: Pao Date: Thu, 12 Jan 2023 19:13:06 +0100 Subject: [PATCH] Deleting old stuff --- .vscode/settings.json | 11 ++- media/lua/client/HealthStuff/HealthUpdate.lua | 99 ------------------- .../client/HealthStuff/InfectionUpdate.lua | 16 --- media/lua/client/TOC_UI.lua | 37 +------ media/lua/client/TOC_Update.lua | 2 +- 5 files changed, 12 insertions(+), 153 deletions(-) delete mode 100644 media/lua/client/HealthStuff/HealthUpdate.lua delete mode 100644 media/lua/client/HealthStuff/InfectionUpdate.lua diff --git a/.vscode/settings.json b/.vscode/settings.json index 2331d4d..7594ce7 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,6 +1,15 @@ { "todo-tree.tree.scanMode": "workspace", "Lua.diagnostics.globals": [ - "ZombRand" + "ZombRand", + "getPlayer", + "BodyPartType", + "ProceduralDistributions", + "Events", + "getText", + "Perks", + "getPlayerByOnlineID", + "getTexture", + "ISTimedActionQueue" ] } \ No newline at end of file diff --git a/media/lua/client/HealthStuff/HealthUpdate.lua b/media/lua/client/HealthStuff/HealthUpdate.lua deleted file mode 100644 index 44a6aa4..0000000 --- a/media/lua/client/HealthStuff/HealthUpdate.lua +++ /dev/null @@ -1,99 +0,0 @@ -local function healUpdatePart(partName, modData, player) - local modData_part = modData.TOC[partName]; - local bodyDamage = player:getBodyDamage(); - local bodyPart = bodyDamage:getBodyPart(TOC_getBodyPart(partName)); - if not bodyPart then - print("TOC ERROR : Can't update health of " .. partName); - return fasle; - end - local isBand = false; - local bandLife = 0; - local bandType = ""; - if bodyPart:bandaged() then isBand = true; bandLife = bodyPart:getBandageLife(); bandType = bodyPart:getBandageType() end - - --Set max heal - if modData_part.is_cicatrized and bodyPart:getHealth() > 80 then - bodyPart:SetHealth(80); - elseif bodyPart:getHealth() > 40 then - bodyPart:SetHealth(40); - end - - --Heal - if modData_part.is_cicatrized then - if bodyPart:deepWounded() then bodyPart:setDeepWounded(false) end - if bodyPart:bleeding() then bodyPart:setBleeding(false) end - end - if bodyPart:bitten() then - bodyPart:SetBitten(false); - if not modData.TOC.OtherBody_IsInfected and not isOtherArmInfect(modData, partName) then - bodyDamage:setInfected(false); - bodyDamage:setInfectionMortalityDuration(-1); - bodyDamage:setInfectionTime(-1); - bodyDamage:setInfectionLevel(0); - local bodyParts = bodyDamage:getBodyParts(); - for i=bodyParts:size()-1, 0, -1 do - local bodyPart = bodyParts:get(i); - bodyPart:SetInfected(false); - end - end - end - if bodyPart:scratched() then bodyPart:setScratched(false, false) end - if bodyPart:haveGlass() then bodyPart:setHaveGlass(false) end - if bodyPart:haveBullet() then bodyPart:setHaveBullet(false, 0) end - if bodyPart:isInfectedWound() then bodyPart:setInfectedWound(false) end - if bodyPart:isBurnt() then bodyPart:setBurnTime(0) end - if bodyPart:isCut() then bodyPart:setCut(false, false) end --Lacerations? - if bodyPart:getFractureTime()>0 then bodyPart:setFractureTime(0) end - - -- During healing - if modData_part.is_cut and not modData_part.is_cicatrized then - if modData_part.cicatrization_time < 0 then - player:Say(getText('UI_ContextMenu_My') .. partName .. getText('UI_ContextMenu_Now_cut')) - modData_part.is_cicatrized = true; - player:getTraits():add("Brave") - player:getTraits():add("Insensitive") - bodyPart:setBleeding(false); - bodyPart:setDeepWounded(false); - bodyPart:setBleedingTime(0); - bodyPart:setDeepWoundTime(0); - player:transmitModData() - end - end - - --Phantom pain - if modData_part.is_amputation_shown and ZombRand(1, 100) < 10 then - - local added_pain = 0 - if modData_part.is_cauterized then - added_pain = 60 - else - added_pain = 30 - end - - bodyPart:setAdditionalPain(ZombRand(1, added_pain)) - end - if isBand then bodyPart:setBandaged(true, bandLife, false, bandType) end -end - -local function isOtherArmInfect(modData, partName) - local names = {"RightHand", "RightForearm", "RightArm", "LeftHand", "LeftForearm", "LeftArm"} - names[partName] = nil; - - for i,v in pairs(names) do - if modData.TOC[v].is_infected then return true end - end - return false -end - -function UpdatePlayerHealth(player, modData) - local bodyDamage = player:getBodyDamage() - - if player:HasTrait("Insensitive") then bodyDamage:setPainReduction(49) end - - for i,name in pairs(GetBodyParts()) do - if modData.TOC[name].is_cut then - healUpdatePart(name, modData, player) - - end - end -end \ No newline at end of file diff --git a/media/lua/client/HealthStuff/InfectionUpdate.lua b/media/lua/client/HealthStuff/InfectionUpdate.lua deleted file mode 100644 index 773f061..0000000 --- a/media/lua/client/HealthStuff/InfectionUpdate.lua +++ /dev/null @@ -1,16 +0,0 @@ -function CheckIfInfect(player, modData) - local bd = player:getBodyDamage() - local Keys = {BodyPartType.Torso_Upper, BodyPartType.Torso_Lower, BodyPartType.Head, BodyPartType.Neck, BodyPartType.Groin, BodyPartType.UpperLeg_L, BodyPartType.UpperLeg_R, BodyPartType.LowerLeg_L, BodyPartType.LowerLeg_R, BodyPartType.Foot_L, BodyPartType.Foot_R, BodyPartType.Back} - - if bd:getBodyPart(BodyPartType.Hand_R):bitten() and not modData.TOC.RightHand.IsCut then modData.TOC.RightHand.IsInfected = true; player:transmitModData() - elseif bd:getBodyPart(BodyPartType.ForeArm_R):bitten() and not modData.TOC.RightForearm.IsCut then modData.TOC.RightForearm.IsInfected = true; player:transmitModData() - elseif bd:getBodyPart(BodyPartType.UpperArm_R):bitten() and not modData.TOC.RightArm.IsCut then modData.TOC.RightArm.IsInfected = true; player:transmitModData() - elseif bd:getBodyPart(BodyPartType.Hand_L):bitten() and not modData.TOC.LeftHand.IsCut then modData.TOC.LeftHand.IsInfected = true; player:transmitModData() - elseif bd:getBodyPart(BodyPartType.ForeArm_L):bitten() and not modData.TOC.LeftForearm.IsCut then modData.TOC.LeftForearm.IsInfected = true; player:transmitModData() - elseif bd:getBodyPart(BodyPartType.UpperArm_L):bitten() and not modData.TOC.LeftArm.IsCut then modData.TOC.LeftArm.IsInfected = true; player:transmitModData() - else - for index, value in ipairs(Keys) do - if bd:getBodyPart(value):bitten() then modData.TOC.OtherBody_IsInfected = true; player:transmitModData() end - end - end -end \ No newline at end of file diff --git a/media/lua/client/TOC_UI.lua b/media/lua/client/TOC_UI.lua index 3f7ef6b..b36e0f1 100644 --- a/media/lua/client/TOC_UI.lua +++ b/media/lua/client/TOC_UI.lua @@ -608,15 +608,6 @@ function OnCreateTheOnlyCureUI() mainUI:close() end - -local function onCreateUI() - makeMainUI(); - makeDescUI(); - makeConfirmUI(); - if isClient() then MakeConfirmUIMP() end - mainUI:close(); -end - Events.OnCreateUI.Add(OnCreateTheOnlyCureUI) @@ -626,17 +617,7 @@ function ISNewHealthPanel.onClick_TOC(button) -- button.character is patient -- button.otherPlayer is surgeon - - - -- if MP_other_player_toc_data ~= nil then - -- print("It works") - -- print(MP_other_player_toc_data) - -- else - -- print("Nopepppp") - -- end - - if button.otherPlayer then - + if button.otherPlayer then if button.character ~= button.otherPlayer then sendClientCommand(button.otherPlayer, "TOC", "GetPlayerData", {button.otherPlayer:getOnlineID(), button.character:getOnlineID()}) SetCorrectArgsMainUI(MP_other_player_toc_data) --other player is the surgeon @@ -698,20 +679,4 @@ local ISHealthPanel_render = ISHealthPanel.render function ISHealthPanel:render() ISHealthPanel_render(self); self.TOCButton:setY(self.fitness:getY()); -end - - -function SendOtherPlayerData() - - local mod_data = getPlayer():getModData().TOC - - -end - -function GetOtherPlayerData() - local surgeonFact, useBandage, bandageAlcool, usePainkiller, painkillerCount = self:findArgs(); - - if self.patient ~= self.surgeon and isClient() then - SendCutArm(self.patient, self.partName, surgeonFact, useBandage, bandageAlcool, usePainkiller, painkillerCount); - end end \ No newline at end of file diff --git a/media/lua/client/TOC_Update.lua b/media/lua/client/TOC_Update.lua index 4614fca..8ef27c8 100644 --- a/media/lua/client/TOC_Update.lua +++ b/media/lua/client/TOC_Update.lua @@ -174,7 +174,7 @@ function TheOnlyCure.UpdateEveryTenMinutes() -- Updates the cicatrization time for _, part_name in pairs(GetBodyParts()) do - if toc_data[part_name].is_cut and toc_data[part_naem].is_cicatrized then + if toc_data[part_name].is_cut and toc_data[part_name].is_cicatrized then toc_data[part_name].cicatrization_time = toc_data[part_name].cicatrization_time - 1 -- TODO Make it more "dynamic"