Fixed some stuff that I broke

This commit is contained in:
Pao
2023-01-10 21:03:13 +01:00
parent eb72635b6d
commit 2486442a19
6 changed files with 27 additions and 20 deletions

View File

@@ -63,13 +63,14 @@ local function healUpdatePart(partName, modData, player)
--Phantom pain
if modData_part.is_amputation_shown and ZombRand(1, 100) < 10 then
local added_pain = 0
if modData_part.is_cauterized then
local added_pain = 60
added_pain = 60
else
local added_pain = 30
added_pain = 30
end
bodyPart:setAdditionalPain(ZombRand(1,added_pain))
bodyPart:setAdditionalPain(ZombRand(1, added_pain))
end
if isBand then bodyPart:setBandaged(true, bandLife, false, bandType) end
end
@@ -90,7 +91,7 @@ function UpdatePlayerHealth(player, modData)
if player:HasTrait("Insensitive") then bodyDamage:setPainReduction(49) end
for i,name in pairs(Bodyparts) do
for i,name in pairs(GetBodyParts()) do
if modData.TOC[name].is_cut then
healUpdatePart(name, modData, player)

View File

@@ -59,7 +59,7 @@ local function TOC_onFillWorldObjectContextMenu(playerId, context, worldobjects,
local subMenu = context:getNew(context);
context:addSubMenu(rootMenu, subMenu)
for k, v in pairs(Bodyparts) do
for k, v in pairs(GetBodyParts()) do
-- todo this is awful but it should work
if modData.TOC[v].is_cut and not modData.TOC[v].is_operated then
subMenu:addOption(getText('UI_ContextMenu_' .. v), worldobjects, operateLocal, v);
@@ -99,7 +99,7 @@ local function TOC_onFillWorldObjectContextMenu(playerId, context, worldobjects,
context:addSubMenu(cutOption, cutMenu);
context:addSubMenu(operateOption, operateMenu);
-- todo add checks so that we don't show these menus if a player has already beeen operated or amputated
for k, v in pairs(Bodyparts) do
for k, v in pairs(GetBodyParts()) do
cutMenu:addOption(getText('UI_ContextMenu_' .. v), worldobjects, otherPlayerLocal, v, "Cut", clickedPlayer)
operateMenu:addOption(getText('UI_ContextMenu_' .. v), worldobjects, otherPlayerLocal, v, "Operate", clickedPlayer);

View File

@@ -1,6 +1,6 @@
local function CheckIfStillInfected(toc_data)
for k,v in pairs(Bodyparts) do
for k,v in pairs(GetBodyParts()) do
if toc_data[v].is_infected == true then
getPlayer().Say("I'm still infected...")
return true
@@ -69,7 +69,7 @@ function CutArm(partName, surgeonFact, useBandage, bandageAlcool, usePainkiller,
local current_bodypart = bodyPart:getType()
local body_damage = player:getBodyDamage()
for k,v in pairs(Bodyparts) do
for k,v in pairs(GetBodyParts()) do
if v == partName then
toc_data[v].is_cut = true
@@ -116,7 +116,7 @@ function OperateArm(partName, surgeonFact, useOven)
end
for k,v in pairs(Bodyparts) do
for k,v in pairs(GetBodyParts()) do
if not toc_data[v].is_operated then
toc_data[v].is_operated = true

View File

@@ -45,13 +45,13 @@ end
else
name = "media/ui/TOC/" .. partName .. "/Prothesis.png";
end
elseif partData.is_cut and partData.is_cicatrized and not partData.has_prothesis_equipped and partData.ToDisplay then -- Cut and heal
elseif partData.is_cut and partData.is_cicatrized and not partData.has_prothesis_equipped and partData.is_amputation_shown then -- Cut and heal
name = "media/ui/TOC/" .. partName .. "/Cut.png";
elseif partData.is_cut and not partData.is_cicatrized and partData.ToDisplay and not partData.IsOperated then -- Cut not heal
elseif partData.is_cut and not partData.is_cicatrized and partData.is_amputation_shown and not partData.IsOperated then -- Cut not heal
name = "media/ui/TOC/" .. partName .. "/Bleed.png";
elseif partData.is_cut and not partData.is_cicatrized and partData.ToDisplay and partData.IsOperated then -- Cut not heal
elseif partData.is_cut and not partData.is_cicatrized and partData.is_amputation_shown and partData.IsOperated then -- Cut not heal
name = "media/ui/TOC/" .. partName .. "/Operate.png";
elseif partData.is_cut and not partData.ToDisplay then -- Empty (like hand if forearm cut)
elseif partData.is_cut and not partData.is_amputation_shown then -- Empty (like hand if forearm cut)
name = "media/ui/TOC/Empty.png";
elseif not partData.is_cut and getPlayer():getBodyDamage():getBodyPart(TOC_getBodyPart(partName)):bitten() then -- Not cut but bitten
name = "media/ui/TOC/" .. partName .. "/Bite.png";
@@ -141,7 +141,7 @@ local function setDescUI(partName)
descUI["b1"]:setVisible(true);
-- Cut and healed
elseif partData.is_cut and partData.is_cicatrized and not partData.has_prothesis_equipped and partData.ToDisplay then
elseif partData.is_cut and partData.is_cicatrized and not partData.has_prothesis_equipped and partData.is_amputation_shown then
descUI["textEtat"]:setText("Cut and healed");
descUI["textEtat"]:setColor(1, 0, 1, 0);
if partName == "RightArm" or partName == "LeftArm" then
@@ -153,7 +153,7 @@ local function setDescUI(partName)
end
-- Cut but not healed
elseif partData.is_cut and not partData.is_cicatrized and partData.ToDisplay then
elseif partData.is_cut and not partData.is_cicatrized and partData.is_amputation_shown then
if partData.IsOperated then
if partData.cicatrization_time > 1000 then
descUI["textEtat"]:setText("Still a long way to go")
@@ -188,7 +188,7 @@ local function setDescUI(partName)
descUI["b1"]:addArg("option", "Operate");
descUI["b1"]:setVisible(true);
end
elseif partData.is_cut and not partData.ToDisplay then -- Empty (hand if forearm cut)
elseif partData.is_cut and not partData.is_amputation_shown then -- Empty (hand if forearm cut)
descUI["textEtat"]:setText("Nothing here...");
descUI["textEtat"]:setColor(1, 1, 1, 1);
descUI["b1"]:setVisible(false);
@@ -328,7 +328,7 @@ local function confirmPress(button, args)
local player = getPlayer();
if confirmUI.actionAct == "Cut" then
if args.option == "yes" then
ISTimedActionQueue.add(is_cutArm:new(player, player, descUI.partNameAct));
ISTimedActionQueue.add(IsCutArm:new(player, player, descUI.partNameAct));
else
getPlayer():Say("Never mind");
end
@@ -354,7 +354,7 @@ local function confirmPressMP(button, args)
if confirmUIMP.actionAct == "Cut" then
if args.option == "yes" then
getPlayer():Say("Hold on, I believe in you!");
ISTimedActionQueue.add(is_cutArm:new(confirmUIMP.patient, player, confirmUIMP.partNameAct));
ISTimedActionQueue.add(IsCutArm:new(confirmUIMP.patient, player, confirmUIMP.partNameAct));
else
getPlayer():Say("Alright...");
end

View File

@@ -58,7 +58,6 @@ local function initVariable(_, player)
Bodyparts = { "RightHand", "RightForearm", "RightArm", "LeftHand", "LeftForearm", "LeftArm"}
modData.TOC = {
RightHand = {},
@@ -70,7 +69,7 @@ local function initVariable(_, player)
LeftArm = {}
}
for k,v in pairs(Bodyparts) do
for k,v in pairs(GetBodyParts()) do
modData.TOC[v].is_cut = false
modData.TOC[v].is_infected = false
modData.TOC[v].is_operated = false

View File

@@ -1,3 +1,10 @@
function GetBodyParts()
local bodyparts = { "RightHand", "RightForearm", "RightArm", "LeftHand", "LeftForearm", "LeftArm"}
return bodyparts
end
function find_clothName_TOC(bodyPart)
if bodyPart:getType() == BodyPartType.Hand_R then return "TOC.ArmRight_noHand"
elseif bodyPart:getType() == BodyPartType.ForeArm_R then return "TOC.ArmRight_noForearm"