Fixed some stuff that I broke
This commit is contained in:
@@ -63,13 +63,14 @@ local function healUpdatePart(partName, modData, player)
|
|||||||
--Phantom pain
|
--Phantom pain
|
||||||
if modData_part.is_amputation_shown and ZombRand(1, 100) < 10 then
|
if modData_part.is_amputation_shown and ZombRand(1, 100) < 10 then
|
||||||
|
|
||||||
|
local added_pain = 0
|
||||||
if modData_part.is_cauterized then
|
if modData_part.is_cauterized then
|
||||||
local added_pain = 60
|
added_pain = 60
|
||||||
else
|
else
|
||||||
local added_pain = 30
|
added_pain = 30
|
||||||
end
|
end
|
||||||
|
|
||||||
bodyPart:setAdditionalPain(ZombRand(1,added_pain))
|
bodyPart:setAdditionalPain(ZombRand(1, added_pain))
|
||||||
end
|
end
|
||||||
if isBand then bodyPart:setBandaged(true, bandLife, false, bandType) end
|
if isBand then bodyPart:setBandaged(true, bandLife, false, bandType) end
|
||||||
end
|
end
|
||||||
@@ -90,7 +91,7 @@ function UpdatePlayerHealth(player, modData)
|
|||||||
|
|
||||||
if player:HasTrait("Insensitive") then bodyDamage:setPainReduction(49) end
|
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
|
if modData.TOC[name].is_cut then
|
||||||
healUpdatePart(name, modData, player)
|
healUpdatePart(name, modData, player)
|
||||||
|
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ local function TOC_onFillWorldObjectContextMenu(playerId, context, worldobjects,
|
|||||||
local subMenu = context:getNew(context);
|
local subMenu = context:getNew(context);
|
||||||
context:addSubMenu(rootMenu, subMenu)
|
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
|
-- todo this is awful but it should work
|
||||||
if modData.TOC[v].is_cut and not modData.TOC[v].is_operated then
|
if modData.TOC[v].is_cut and not modData.TOC[v].is_operated then
|
||||||
subMenu:addOption(getText('UI_ContextMenu_' .. v), worldobjects, operateLocal, v);
|
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(cutOption, cutMenu);
|
||||||
context:addSubMenu(operateOption, operateMenu);
|
context:addSubMenu(operateOption, operateMenu);
|
||||||
-- todo add checks so that we don't show these menus if a player has already beeen operated or amputated
|
-- 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)
|
cutMenu:addOption(getText('UI_ContextMenu_' .. v), worldobjects, otherPlayerLocal, v, "Cut", clickedPlayer)
|
||||||
operateMenu:addOption(getText('UI_ContextMenu_' .. v), worldobjects, otherPlayerLocal, v, "Operate", clickedPlayer);
|
operateMenu:addOption(getText('UI_ContextMenu_' .. v), worldobjects, otherPlayerLocal, v, "Operate", clickedPlayer);
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
local function CheckIfStillInfected(toc_data)
|
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
|
if toc_data[v].is_infected == true then
|
||||||
getPlayer().Say("I'm still infected...")
|
getPlayer().Say("I'm still infected...")
|
||||||
return true
|
return true
|
||||||
@@ -69,7 +69,7 @@ function CutArm(partName, surgeonFact, useBandage, bandageAlcool, usePainkiller,
|
|||||||
local current_bodypart = bodyPart:getType()
|
local current_bodypart = bodyPart:getType()
|
||||||
local body_damage = player:getBodyDamage()
|
local body_damage = player:getBodyDamage()
|
||||||
|
|
||||||
for k,v in pairs(Bodyparts) do
|
for k,v in pairs(GetBodyParts()) do
|
||||||
|
|
||||||
if v == partName then
|
if v == partName then
|
||||||
toc_data[v].is_cut = true
|
toc_data[v].is_cut = true
|
||||||
@@ -116,7 +116,7 @@ function OperateArm(partName, surgeonFact, useOven)
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
for k,v in pairs(Bodyparts) do
|
for k,v in pairs(GetBodyParts()) do
|
||||||
|
|
||||||
if not toc_data[v].is_operated then
|
if not toc_data[v].is_operated then
|
||||||
toc_data[v].is_operated = true
|
toc_data[v].is_operated = true
|
||||||
|
|||||||
@@ -45,13 +45,13 @@ end
|
|||||||
else
|
else
|
||||||
name = "media/ui/TOC/" .. partName .. "/Prothesis.png";
|
name = "media/ui/TOC/" .. partName .. "/Prothesis.png";
|
||||||
end
|
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";
|
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";
|
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";
|
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";
|
name = "media/ui/TOC/Empty.png";
|
||||||
elseif not partData.is_cut and getPlayer():getBodyDamage():getBodyPart(TOC_getBodyPart(partName)):bitten() then -- Not cut but bitten
|
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";
|
name = "media/ui/TOC/" .. partName .. "/Bite.png";
|
||||||
@@ -141,7 +141,7 @@ local function setDescUI(partName)
|
|||||||
descUI["b1"]:setVisible(true);
|
descUI["b1"]:setVisible(true);
|
||||||
|
|
||||||
-- Cut and healed
|
-- 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"]:setText("Cut and healed");
|
||||||
descUI["textEtat"]:setColor(1, 0, 1, 0);
|
descUI["textEtat"]:setColor(1, 0, 1, 0);
|
||||||
if partName == "RightArm" or partName == "LeftArm" then
|
if partName == "RightArm" or partName == "LeftArm" then
|
||||||
@@ -153,7 +153,7 @@ local function setDescUI(partName)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Cut but not healed
|
-- 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.IsOperated then
|
||||||
if partData.cicatrization_time > 1000 then
|
if partData.cicatrization_time > 1000 then
|
||||||
descUI["textEtat"]:setText("Still a long way to go")
|
descUI["textEtat"]:setText("Still a long way to go")
|
||||||
@@ -188,7 +188,7 @@ local function setDescUI(partName)
|
|||||||
descUI["b1"]:addArg("option", "Operate");
|
descUI["b1"]:addArg("option", "Operate");
|
||||||
descUI["b1"]:setVisible(true);
|
descUI["b1"]:setVisible(true);
|
||||||
end
|
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"]:setText("Nothing here...");
|
||||||
descUI["textEtat"]:setColor(1, 1, 1, 1);
|
descUI["textEtat"]:setColor(1, 1, 1, 1);
|
||||||
descUI["b1"]:setVisible(false);
|
descUI["b1"]:setVisible(false);
|
||||||
@@ -328,7 +328,7 @@ local function confirmPress(button, args)
|
|||||||
local player = getPlayer();
|
local player = getPlayer();
|
||||||
if confirmUI.actionAct == "Cut" then
|
if confirmUI.actionAct == "Cut" then
|
||||||
if args.option == "yes" then
|
if args.option == "yes" then
|
||||||
ISTimedActionQueue.add(is_cutArm:new(player, player, descUI.partNameAct));
|
ISTimedActionQueue.add(IsCutArm:new(player, player, descUI.partNameAct));
|
||||||
else
|
else
|
||||||
getPlayer():Say("Never mind");
|
getPlayer():Say("Never mind");
|
||||||
end
|
end
|
||||||
@@ -354,7 +354,7 @@ local function confirmPressMP(button, args)
|
|||||||
if confirmUIMP.actionAct == "Cut" then
|
if confirmUIMP.actionAct == "Cut" then
|
||||||
if args.option == "yes" then
|
if args.option == "yes" then
|
||||||
getPlayer():Say("Hold on, I believe in you!");
|
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
|
else
|
||||||
getPlayer():Say("Alright...");
|
getPlayer():Say("Alright...");
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -58,7 +58,6 @@ local function initVariable(_, player)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
Bodyparts = { "RightHand", "RightForearm", "RightArm", "LeftHand", "LeftForearm", "LeftArm"}
|
|
||||||
|
|
||||||
modData.TOC = {
|
modData.TOC = {
|
||||||
RightHand = {},
|
RightHand = {},
|
||||||
@@ -70,7 +69,7 @@ local function initVariable(_, player)
|
|||||||
LeftArm = {}
|
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_cut = false
|
||||||
modData.TOC[v].is_infected = false
|
modData.TOC[v].is_infected = false
|
||||||
modData.TOC[v].is_operated = false
|
modData.TOC[v].is_operated = false
|
||||||
|
|||||||
@@ -1,3 +1,10 @@
|
|||||||
|
function GetBodyParts()
|
||||||
|
local bodyparts = { "RightHand", "RightForearm", "RightArm", "LeftHand", "LeftForearm", "LeftArm"}
|
||||||
|
return bodyparts
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function find_clothName_TOC(bodyPart)
|
function find_clothName_TOC(bodyPart)
|
||||||
if bodyPart:getType() == BodyPartType.Hand_R then return "TOC.ArmRight_noHand"
|
if bodyPart:getType() == BodyPartType.Hand_R then return "TOC.ArmRight_noHand"
|
||||||
elseif bodyPart:getType() == BodyPartType.ForeArm_R then return "TOC.ArmRight_noForearm"
|
elseif bodyPart:getType() == BodyPartType.ForeArm_R then return "TOC.ArmRight_noForearm"
|
||||||
|
|||||||
Reference in New Issue
Block a user