Mostly refactoring this chaos
This commit is contained in:
@@ -39,30 +39,30 @@ end
|
||||
local function getImageName(partName, modData)
|
||||
local partData = modData[partName];
|
||||
local name = "";
|
||||
if partData.IsCut and partData.IsCicatrized and partData.IsEquiped then -- Cut and equip
|
||||
if partData.is_cut and partData.is_cicatrized and partData.has_prothesis_equipped then -- Cut and equip
|
||||
if partName == "RightHand" or partName == "LeftHand" then
|
||||
name = "media/ui/TOC/" .. partName .. "/Hook.png";
|
||||
else
|
||||
name = "media/ui/TOC/" .. partName .. "/Prothesis.png";
|
||||
end
|
||||
elseif partData.IsCut and partData.IsCicatrized and not partData.IsEquiped and partData.ToDisplay then -- Cut and heal
|
||||
elseif partData.is_cut and partData.is_cicatrized and not partData.has_prothesis_equipped and partData.ToDisplay then -- Cut and heal
|
||||
name = "media/ui/TOC/" .. partName .. "/Cut.png";
|
||||
elseif partData.IsCut and not partData.IsCicatrized and partData.ToDisplay and not partData.IsOperated then -- Cut not heal
|
||||
elseif partData.is_cut and not partData.is_cicatrized and partData.ToDisplay and not partData.IsOperated then -- Cut not heal
|
||||
name = "media/ui/TOC/" .. partName .. "/Bleed.png";
|
||||
elseif partData.IsCut and not partData.IsCicatrized and partData.ToDisplay and partData.IsOperated then -- Cut not heal
|
||||
elseif partData.is_cut and not partData.is_cicatrized and partData.ToDisplay and partData.IsOperated then -- Cut not heal
|
||||
name = "media/ui/TOC/" .. partName .. "/Operate.png";
|
||||
elseif partData.IsCut and not partData.ToDisplay then -- Empty (like hand if forearm cut)
|
||||
elseif partData.is_cut and not partData.ToDisplay then -- Empty (like hand if forearm cut)
|
||||
name = "media/ui/TOC/Empty.png";
|
||||
elseif not partData.IsCut 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";
|
||||
else -- Not cut
|
||||
name = "media/ui/TOC/" .. partName .. "/Base.png";
|
||||
end
|
||||
|
||||
-- If foreaerm equip, change hand
|
||||
if partName == "RightHand" and modData["RightForearm"].IsEquiped then
|
||||
if partName == "RightHand" and modData["RightForearm"].has_prothesis_equipped then
|
||||
name = "media/ui/TOC/" .. partName .. "/Hook.png";
|
||||
elseif partName == "LeftHand" and modData["LeftForearm"].IsEquiped then
|
||||
elseif partName == "LeftHand" and modData["LeftForearm"].has_prothesis_equipped then
|
||||
name = "media/ui/TOC/" .. partName .. "/Hook.png";
|
||||
end
|
||||
return name;
|
||||
@@ -133,7 +133,7 @@ local function setDescUI(partName)
|
||||
descUI.partNameAct = partName;
|
||||
|
||||
-- Cut and equip
|
||||
if partData.IsCut and partData.IsCicatrized and partData.IsEquiped then
|
||||
if partData.is_cut and partData.is_cicatrized and partData.has_prothesis_equipped then
|
||||
descUI["textEtat"]:setText("Cut and healed");
|
||||
descUI["textEtat"]:setColor(1, 0, 1, 0);
|
||||
descUI["b1"]:setText("Unequip");
|
||||
@@ -141,7 +141,7 @@ local function setDescUI(partName)
|
||||
descUI["b1"]:setVisible(true);
|
||||
|
||||
-- Cut and healed
|
||||
elseif partData.IsCut and partData.IsCicatrized and not partData.IsEquiped and partData.ToDisplay then
|
||||
elseif partData.is_cut and partData.is_cicatrized and not partData.has_prothesis_equipped and partData.ToDisplay 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.IsCut and not partData.IsCicatrized and partData.ToDisplay then
|
||||
elseif partData.is_cut and not partData.is_cicatrized and partData.ToDisplay then
|
||||
if partData.IsOperated then
|
||||
if partData.CicaTimeLeft > 1000 then
|
||||
descUI["textEtat"]:setText("Still a long way to go")
|
||||
@@ -188,11 +188,11 @@ local function setDescUI(partName)
|
||||
descUI["b1"]:addArg("option", "Operate");
|
||||
descUI["b1"]:setVisible(true);
|
||||
end
|
||||
elseif partData.IsCut and not partData.ToDisplay then -- Empty (hand if forearm cut)
|
||||
elseif partData.is_cut and not partData.ToDisplay then -- Empty (hand if forearm cut)
|
||||
descUI["textEtat"]:setText("Nothing here...");
|
||||
descUI["textEtat"]:setColor(1, 1, 1, 1);
|
||||
descUI["b1"]:setVisible(false);
|
||||
elseif not partData.IsCut and getPlayer():getBodyDamage():getBodyPart(TOC_getBodyPart(partName)):bitten() then
|
||||
elseif not partData.is_cut and getPlayer():getBodyDamage():getBodyPart(TOC_getBodyPart(partName)):bitten() then
|
||||
descUI["textEtat"]:setText("Bitten...");
|
||||
descUI["textEtat"]:setColor(1, 1, 0, 0);
|
||||
if isPlayerHaveSaw() then
|
||||
@@ -202,7 +202,7 @@ local function setDescUI(partName)
|
||||
else
|
||||
descUI["b1"]:setVisible(false);
|
||||
end
|
||||
elseif not partData.IsCut then -- Not cut
|
||||
elseif not partData.is_cut then -- Not cut
|
||||
descUI["textEtat"]:setText("Not cut");
|
||||
descUI["textEtat"]:setColor(1, 1, 1, 1);
|
||||
if isPlayerHaveSaw() then
|
||||
@@ -328,7 +328,7 @@ local function confirmPress(button, args)
|
||||
local player = getPlayer();
|
||||
if confirmUI.actionAct == "Cut" then
|
||||
if args.option == "yes" then
|
||||
ISTimedActionQueue.add(IsCutArm:new(player, player, descUI.partNameAct));
|
||||
ISTimedActionQueue.add(is_cutArm:new(player, player, descUI.partNameAct));
|
||||
else
|
||||
getPlayer():Say("Never mind");
|
||||
end
|
||||
@@ -353,10 +353,10 @@ local function confirmPressMP(button, args)
|
||||
local player = getPlayer();
|
||||
if confirmUIMP.actionAct == "Cut" then
|
||||
if args.option == "yes" then
|
||||
getPlayer():Say("Ok let's begging, courage !");
|
||||
ISTimedActionQueue.add(IsCutArm:new(confirmUIMP.patient, player, confirmUIMP.partNameAct));
|
||||
getPlayer():Say("Hold on, I believe in you!");
|
||||
ISTimedActionQueue.add(is_cutArm:new(confirmUIMP.patient, player, confirmUIMP.partNameAct));
|
||||
else
|
||||
getPlayer():Say("Never mind");
|
||||
getPlayer():Say("Alright...");
|
||||
end
|
||||
end
|
||||
if confirmUIMP.actionAct == "Operate" then
|
||||
@@ -389,8 +389,8 @@ local function descPress(button, args)
|
||||
if args.option == "Cut" then
|
||||
local modData = player:getModData().TOC;
|
||||
-- Do not cut if prothesis equip
|
||||
if (string.find(descUI.partNameAct, "Right") and (modData["RightHand"].IsEquiped or modData["RightForearm"].IsEquiped))
|
||||
or (string.find(descUI.partNameAct, "Left") and (modData["LeftHand"].IsEquiped or modData["LeftForearm"].IsEquiped)) then
|
||||
if (string.find(descUI.partNameAct, "Right") and (modData["RightHand"].has_prothesis_equipped or modData["RightForearm"].has_prothesis_equipped))
|
||||
or (string.find(descUI.partNameAct, "Left") and (modData["LeftHand"].has_prothesis_equipped or modData["LeftForearm"].has_prothesis_equipped)) then
|
||||
player:Say("I need to remove my prothesis first");
|
||||
mainUI:close();
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user