Deleting old stuff

This commit is contained in:
Pao
2023-01-12 19:13:06 +01:00
parent dacb22a0d1
commit 7c5e98d828
5 changed files with 12 additions and 153 deletions

11
.vscode/settings.json vendored
View File

@@ -1,6 +1,15 @@
{
"todo-tree.tree.scanMode": "workspace",
"Lua.diagnostics.globals": [
"ZombRand"
"ZombRand",
"getPlayer",
"BodyPartType",
"ProceduralDistributions",
"Events",
"getText",
"Perks",
"getPlayerByOnlineID",
"getTexture",
"ISTimedActionQueue"
]
}

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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"