help
This commit is contained in:
@@ -12,7 +12,7 @@ function SendCutArm(player, partName, surgeonFact, useBandage, bandageAlcool, us
|
||||
end
|
||||
|
||||
|
||||
function TheOnlyCure.SendCutLimb(player, part_name, surgeon_factor, bandage_table, painkiller_table)
|
||||
function SendCutLimb(player, part_name, surgeon_factor, bandage_table, painkiller_table)
|
||||
local arg = {}
|
||||
arg["From"] = getPlayer():getOnlineID()
|
||||
arg["To"] = player:getOnlineID()
|
||||
|
||||
@@ -25,83 +25,83 @@ local function CureInfection(bodyDamage)
|
||||
end
|
||||
end
|
||||
|
||||
-- TODO change it to CutLimb or CutBodyPart
|
||||
function CutArm(partName, surgeonFact, useBandage, bandageAlcool, usePainkiller, painkillerCount)
|
||||
-- -- TODO change it to CutLimb or CutBodyPart
|
||||
-- function CutArm(partName, surgeonFact, useBandage, bandageAlcool, usePainkiller, painkillerCount)
|
||||
|
||||
|
||||
|
||||
local player = getPlayer();
|
||||
local toc_data = player:getModData().TOC;
|
||||
local bodyPart = player:getBodyDamage():getBodyPart(TOC_getBodyPart(partName)); -- why the fuck do we we need this
|
||||
-- local player = getPlayer();
|
||||
-- local toc_data = player:getModData().TOC;
|
||||
-- local bodyPart = player:getBodyDamage():getBodyPart(TOC_getBodyPart(partName)); -- why the fuck do we we need this
|
||||
|
||||
--Set damage of body part & stress & endurance
|
||||
local stats = player:getStats();
|
||||
bodyPart:AddDamage(100 - surgeonFact);
|
||||
bodyPart:setAdditionalPain(100 - surgeonFact);
|
||||
bodyPart:setBleeding(true);
|
||||
bodyPart:setBleedingTime(100 - surgeonFact);
|
||||
bodyPart:setDeepWounded(true)
|
||||
bodyPart:setDeepWoundTime(100 - surgeonFact);
|
||||
stats:setEndurance(0 + surgeonFact);
|
||||
stats:setStress(100 - surgeonFact);
|
||||
-- --Set damage of body part & stress & endurance
|
||||
-- local stats = player:getStats();
|
||||
-- bodyPart:AddDamage(100 - surgeonFact);
|
||||
-- bodyPart:setAdditionalPain(100 - surgeonFact);
|
||||
-- bodyPart:setBleeding(true);
|
||||
-- bodyPart:setBleedingTime(100 - surgeonFact);
|
||||
-- bodyPart:setDeepWounded(true)
|
||||
-- bodyPart:setDeepWoundTime(100 - surgeonFact);
|
||||
-- stats:setEndurance(0 + surgeonFact);
|
||||
-- stats:setStress(100 - surgeonFact);
|
||||
|
||||
-- Bandage
|
||||
--if useBandage and bandageAlcool then
|
||||
-- bodyPart:setBandaged(true, 10, true, bandage:getType());
|
||||
--elseif useBandage and not bandageAlcool then
|
||||
-- bodyPart:setBandaged(true, 10, false, bandage:getType());
|
||||
-- -- Bandage
|
||||
-- --if useBandage and bandageAlcool then
|
||||
-- -- bodyPart:setBandaged(true, 10, true, bandage:getType());
|
||||
-- --elseif useBandage and not bandageAlcool then
|
||||
-- -- bodyPart:setBandaged(true, 10, false, bandage:getType());
|
||||
-- --end
|
||||
|
||||
-- -- Painkiller
|
||||
-- --if usePainkiller then
|
||||
-- -- for _ = 1,painkillerCount+1 do
|
||||
-- -- player:getBodyDamage():JustTookPill(painkiller);
|
||||
-- -- end
|
||||
-- -- if painkillerCount < 10 then addSound(player, player:getX(), player:getY(), player:getZ(), 50-painkillerCount*5, 50-painkillerCount*5) end
|
||||
-- --else
|
||||
-- -- addSound(player, player:getX(), player:getY(), player:getZ(), 50, 50)
|
||||
-- --end
|
||||
|
||||
-- -- Change modData
|
||||
|
||||
-- local current_bodypart = bodyPart:getType()
|
||||
-- local body_damage = player:getBodyDamage()
|
||||
|
||||
-- for k,v in pairs(GetBodyParts()) do
|
||||
|
||||
-- if v == partName then
|
||||
-- toc_data[v].is_cut = true
|
||||
-- toc_data[v].is_amputation_shown = true
|
||||
-- toc_data[v].cicatrization_time = toc_data[v].cicatrization_base_time - surgeonFact * 50
|
||||
|
||||
|
||||
-- -- Heal the infection here
|
||||
-- if toc_data[v].is_infected and body_damage.getInfectionLevel() < 20 then
|
||||
-- toc_data[v].is_infected = false
|
||||
-- current_bodypart:SetBitten(false)
|
||||
|
||||
-- -- Second check, let's see if there is any other infected limb.
|
||||
-- if CheckIfStillInfected(toc_data) == false then
|
||||
-- CureInfection(body_damage)
|
||||
-- end
|
||||
|
||||
-- Painkiller
|
||||
--if usePainkiller then
|
||||
-- for _ = 1,painkillerCount+1 do
|
||||
-- player:getBodyDamage():JustTookPill(painkiller);
|
||||
-- end
|
||||
-- if painkillerCount < 10 then addSound(player, player:getX(), player:getY(), player:getZ(), 50-painkillerCount*5, 50-painkillerCount*5) end
|
||||
--else
|
||||
-- addSound(player, player:getX(), player:getY(), player:getZ(), 50, 50)
|
||||
-- end
|
||||
|
||||
-- Change modData
|
||||
|
||||
local current_bodypart = bodyPart:getType()
|
||||
local body_damage = player:getBodyDamage()
|
||||
|
||||
for k,v in pairs(GetBodyParts()) do
|
||||
|
||||
if v == partName then
|
||||
toc_data[v].is_cut = true
|
||||
toc_data[v].is_amputation_shown = true
|
||||
toc_data[v].cicatrization_time = toc_data[v].cicatrization_base_time - surgeonFact * 50
|
||||
|
||||
|
||||
-- Heal the infection here
|
||||
if toc_data[v].is_infected and body_damage.getInfectionLevel() < 20 then
|
||||
toc_data[v].is_infected = false
|
||||
current_bodypart:SetBitten(false)
|
||||
|
||||
-- Second check, let's see if there is any other infected limb.
|
||||
if CheckIfStillInfected(toc_data) == false then
|
||||
CureInfection(body_damage)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
for depended_k, depended_v in pairs(toc_data[v].depends_on) do
|
||||
toc_data[depended_v].is_cut = true
|
||||
toc_data[depended_v].is_amputation_shown = true
|
||||
toc_data[depended_v].cicatrization_time = toc_data[v].cicatrization_base_time - surgeonFact * 50
|
||||
end
|
||||
end
|
||||
end
|
||||
-- for depended_k, depended_v in pairs(toc_data[v].depends_on) do
|
||||
-- toc_data[depended_v].is_cut = true
|
||||
-- toc_data[depended_v].is_amputation_shown = true
|
||||
-- toc_data[depended_v].cicatrization_time = toc_data[v].cicatrization_base_time - surgeonFact * 50
|
||||
-- end
|
||||
-- end
|
||||
-- end
|
||||
|
||||
|
||||
|
||||
--Equip cloth
|
||||
local cloth = player:getInventory():AddItem(find_clothName2_TOC(partName));
|
||||
player:setWornItem(cloth:getBodyLocation(), cloth);
|
||||
player:transmitModData();
|
||||
end
|
||||
-- --Equip cloth
|
||||
-- local cloth = player:getInventory():AddItem(find_clothName2_TOC(partName));
|
||||
-- player:setWornItem(cloth:getBodyLocation(), cloth);
|
||||
-- player:transmitModData();
|
||||
-- end
|
||||
|
||||
function OperateArm(partName, surgeonFact, useOven)
|
||||
local player = getPlayer();
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
-- CutLimb
|
||||
function TheOnlyCure.CheckIfStillInfected(toc_data)
|
||||
|
||||
if toc_data == nil then
|
||||
return
|
||||
end
|
||||
-- Check ALL body part types to check if the player is still gonna die
|
||||
local check = false
|
||||
|
||||
|
||||
for _, v in ipairs(GetBodyParts()) do
|
||||
if toc_data[v].is_infected then
|
||||
check = true
|
||||
|
||||
@@ -40,34 +40,35 @@ end
|
||||
return item;
|
||||
end
|
||||
|
||||
local function getImageName(partName, modData)
|
||||
local partData = modData[partName];
|
||||
local name = "";
|
||||
if partData.is_cut and partData.is_cicatrized and partData.has_prosthesis_equipped then -- Cut and equip
|
||||
if partName == "RightHand" or partName == "LeftHand" then
|
||||
name = "media/ui/TOC/" .. partName .. "/Hook.png";
|
||||
local function getImageName(part_name, toc_data)
|
||||
local part_data = toc_data[part_name];
|
||||
local name = ""
|
||||
|
||||
if part_data.is_cut and part_data.is_cicatrized and part_data.has_prosthesis_equipped then -- Cut and equip
|
||||
if part_name == "RightHand" or part_name == "LeftHand" then
|
||||
name = "media/ui/TOC/" .. part_name .. "/Hook.png"
|
||||
else
|
||||
name = "media/ui/TOC/" .. partName .. "/Prothesis.png";
|
||||
name = "media/ui/TOC/" .. part_name .. "/Prothesis.png"
|
||||
end
|
||||
elseif partData.is_cut and partData.is_cicatrized and not partData.has_prosthesis_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.is_amputation_shown and not partData.is_operated then -- Cut not heal
|
||||
name = "media/ui/TOC/" .. partName .. "/Bleed.png";
|
||||
elseif partData.is_cut and not partData.is_cicatrized and partData.is_amputation_shown and partData.is_operated then -- Cut not heal
|
||||
name = "media/ui/TOC/" .. partName .. "/Operate.png";
|
||||
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";
|
||||
elseif part_data.is_cut and part_data.is_cicatrized and not part_data.has_prosthesis_equipped and part_data.is_amputation_shown then -- Cut and heal
|
||||
name = "media/ui/TOC/" .. part_name .. "/Cut.png"
|
||||
elseif part_data.is_cut and not part_data.is_cicatrized and part_data.is_amputation_shown and not part_data.is_operated then -- Cut not heal
|
||||
name = "media/ui/TOC/" .. part_name .. "/Bleed.png"
|
||||
elseif part_data.is_cut and not part_data.is_cicatrized and part_data.is_amputation_shown and part_data.is_operated then -- Cut not heal
|
||||
name = "media/ui/TOC/" .. part_name .. "/Operate.png"
|
||||
elseif part_data.is_cut and not part_data.is_amputation_shown then -- Empty (like hand if forearm cut)
|
||||
name = "media/ui/TOC/Empty.png"
|
||||
elseif not part_data.is_cut and getPlayer():getBodyDamage():getBodyPart(TheOnlyCure.GetBodyPartTypeFromBodyPart(part_name)):bitten() then -- Not cut but bitten
|
||||
name = "media/ui/TOC/" .. part_name .. "/Bite.png"
|
||||
else -- Not cut
|
||||
name = "media/ui/TOC/" .. partName .. "/Base.png";
|
||||
name = "media/ui/TOC/" .. part_name .. "/Base.png"
|
||||
end
|
||||
|
||||
-- If foreaerm equip, change hand
|
||||
if partName == "RightHand" and modData["RightForearm"].has_prosthesis_equipped then
|
||||
name = "media/ui/TOC/" .. partName .. "/Hook.png";
|
||||
elseif partName == "LeftHand" and modData["LeftForearm"].has_prosthesis_equipped then
|
||||
name = "media/ui/TOC/" .. partName .. "/Hook.png";
|
||||
if part_name == "RightHand" and toc_data["RightForearm"].has_prosthesis_equipped then
|
||||
name = "media/ui/TOC/" .. part_name .. "/Hook.png"
|
||||
elseif part_name == "LeftHand" and toc_data["LeftForearm"].has_prosthesis_equipped then
|
||||
name = "media/ui/TOC/" .. part_name .. "/Hook.png"
|
||||
end
|
||||
return name;
|
||||
end
|
||||
@@ -130,7 +131,7 @@ end
|
||||
-- end Usefull
|
||||
|
||||
-- Function to update text/button of UIs
|
||||
local function setDescUI(toc_data, partName)
|
||||
local function setDescUI(toc_data, part_name)
|
||||
|
||||
--we can easily fix this crap from here for MP compat
|
||||
-- forces sync?
|
||||
@@ -141,12 +142,12 @@ local function setDescUI(toc_data, partName)
|
||||
--local testModData = player:getModData()
|
||||
|
||||
|
||||
local partData = toc_data[partName]
|
||||
descUI["textTitle"]:setText(getDisplayText_TOC(partName))
|
||||
descUI.partNameAct = partName
|
||||
local part_data = toc_data[part_name]
|
||||
descUI["textTitle"]:setText(getDisplayText_TOC(part_name))
|
||||
descUI.partNameAct = part_name
|
||||
|
||||
-- Cut and equip
|
||||
if partData.is_cut and partData.is_cicatrized and partData.has_prosthesis_equipped then
|
||||
if part_data.is_cut and part_data.is_cicatrized and part_data.has_prosthesis_equipped then
|
||||
descUI["textEtat"]:setText("Cut and healed")
|
||||
descUI["textEtat"]:setColor(1, 0, 1, 0)
|
||||
descUI["b1"]:setText("Unequip")
|
||||
@@ -154,10 +155,10 @@ local function setDescUI(toc_data, partName)
|
||||
descUI["b1"]:setVisible(true)
|
||||
|
||||
-- Cut and healed
|
||||
elseif partData.is_cut and partData.is_cicatrized and not partData.has_prosthesis_equipped and partData.is_amputation_shown then
|
||||
elseif part_data.is_cut and part_data.is_cicatrized and not part_data.has_prosthesis_equipped and part_data.is_amputation_shown then
|
||||
descUI["textEtat"]:setText("Cut and healed");
|
||||
descUI["textEtat"]:setColor(1, 0, 1, 0);
|
||||
if partName == "RightArm" or partName == "LeftArm" then
|
||||
if part_name == "RightArm" or part_name == "LeftArm" then
|
||||
descUI["b1"]:setVisible(false);
|
||||
else
|
||||
descUI["b1"]:setText("Equip");
|
||||
@@ -166,27 +167,27 @@ local function setDescUI(toc_data, partName)
|
||||
end
|
||||
|
||||
-- Cut but not healed
|
||||
elseif partData.is_cut and not partData.is_cicatrized and partData.is_amputation_shown then
|
||||
if partData.is_operated then
|
||||
if partData.cicatrization_time > 1000 then
|
||||
elseif part_data.is_cut and not part_data.is_cicatrized and part_data.is_amputation_shown then
|
||||
if part_data.is_operated then
|
||||
if part_data.cicatrization_time > 1000 then
|
||||
descUI["textEtat"]:setText("Still a long way to go")
|
||||
descUI["textEtat"]:setColor(1, 0.8, 1, 0.2);
|
||||
elseif partData.cicatrization_time > 500 then
|
||||
elseif part_data.cicatrization_time > 500 then
|
||||
descUI["textEtat"]:setText("Starting to get better")
|
||||
descUI["textEtat"]:setColor(1, 0.8, 1, 0.2)
|
||||
|
||||
elseif partData.cicatrization_time > 100 then
|
||||
elseif part_data.cicatrization_time > 100 then
|
||||
descUI["textEtat"]:setText("Almost cicatrized");
|
||||
descUI["textEtat"]:setColor(1, 0.8, 1, 0.2);
|
||||
end
|
||||
else
|
||||
if partData.cicatrization_time > 1000 then
|
||||
if part_data.cicatrization_time > 1000 then
|
||||
descUI["textEtat"]:setText("It hurts so much...")
|
||||
descUI["textEtat"]:setColor(1, 1, 0, 0)
|
||||
elseif partData.cicatrization_time > 500 then
|
||||
elseif part_data.cicatrization_time > 500 then
|
||||
descUI["textEtat"]:setText("It still hurts a lot")
|
||||
descUI["textEtat"]:setColor(1, 0.8, 1, 0.2)
|
||||
elseif partData.cicatrization_time > 500 then
|
||||
elseif part_data.cicatrization_time > 500 then
|
||||
descUI["textEtat"]:setText("I think it's almost over...")
|
||||
descUI["textEtat"]:setColor(1, 0.8, 1, 0.2)
|
||||
end
|
||||
@@ -194,18 +195,18 @@ local function setDescUI(toc_data, partName)
|
||||
|
||||
|
||||
-- Set visibility
|
||||
if partData.is_operated then
|
||||
if part_data.is_operated then
|
||||
descUI["b1"]:setVisible(false);
|
||||
else
|
||||
descUI["b1"]:setText("Operate");
|
||||
descUI["b1"]:addArg("option", "Operate");
|
||||
descUI["b1"]:setVisible(true);
|
||||
end
|
||||
elseif partData.is_cut and not partData.is_amputation_shown then -- Empty (hand if forearm cut)
|
||||
elseif part_data.is_cut and not part_data.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);
|
||||
elseif not partData.is_cut and getPlayer():getBodyDamage():getBodyPart(TOC_getBodyPart(partName)):bitten() then --TODO fix for MP
|
||||
elseif not part_data.is_cut and getPlayer():getBodyDamage():getBodyPart(TOC_getBodyPart(part_name)):bitten() then --TODO fix for MP
|
||||
descUI["textEtat"]:setText("Bitten...");
|
||||
descUI["textEtat"]:setColor(1, 1, 0, 0);
|
||||
if isPlayerHaveSaw() then
|
||||
@@ -215,7 +216,7 @@ local function setDescUI(toc_data, partName)
|
||||
else
|
||||
descUI["b1"]:setVisible(false);
|
||||
end
|
||||
elseif not partData.is_cut then -- Not cut
|
||||
elseif not part_data.is_cut then -- Not cut
|
||||
descUI["textEtat"]:setText("Not cut");
|
||||
descUI["textEtat"]:setColor(1, 1, 1, 1);
|
||||
if isPlayerHaveSaw() then
|
||||
@@ -229,7 +230,7 @@ local function setDescUI(toc_data, partName)
|
||||
|
||||
-- Set text for level
|
||||
local player = getPlayer()
|
||||
if string.find(partName, "Right") then
|
||||
if string.find(part_name, "Right") then
|
||||
local lv = player:getPerkLevel(Perks.RightHand) + 1;
|
||||
descUI["textLV2"]:setText("Level: " .. lv .. " / 10");
|
||||
|
||||
@@ -251,8 +252,8 @@ end
|
||||
local function setConfirmUI(action)
|
||||
confirmUI.actionAct = action;
|
||||
confirmUI:setInCenterOfScreen();
|
||||
confirmUI:bringToTop();
|
||||
confirmUI:open();
|
||||
confirmUI:bringToTop()
|
||||
confirmUI:open()
|
||||
if action == "Cut" then
|
||||
if isPlayerHaveBandage() and isPlayerHavePainkiller() then
|
||||
confirmUI["text2"]:setText("You have bandage and painkiller");
|
||||
@@ -261,10 +262,14 @@ local function setConfirmUI(action)
|
||||
confirmUI["text2"]:setText("You miss bandage or painkiller");
|
||||
confirmUI["text2"]:setColor(1, 1, 0, 0);
|
||||
end
|
||||
if isPlayerHaveSaw() and getPlayer():getBodyDamage():getBodyPart(TOC_getBodyPart(descUI.partNameAct)):bitten() then
|
||||
confirmUI["text3"]:setText("You are well bitten and you have a saw... it's time");
|
||||
|
||||
|
||||
local bitten_status = getPlayer():getBodyDamage():getBodyPart(TheOnlyCure.GetBodyPartTypeFromBodyPart(descUI.partNameAct)):bitten()
|
||||
|
||||
if isPlayerHaveSaw() and bitten_status then
|
||||
confirmUI["text3"]:setText("You are bitten and you have a saw... it's time");
|
||||
confirmUI["text3"]:setColor(1, 0, 1, 0);
|
||||
elseif isPlayerHaveSaw() and not getPlayer():getBodyDamage():getBodyPart(TOC_getBodyPart(descUI.partNameAct)):bitten() then
|
||||
elseif isPlayerHaveSaw() and not bitten_status then
|
||||
confirmUI["text3"]:setText("What are you doing? You're okay!");
|
||||
confirmUI["text3"]:setColor(1, 1, 0, 0);
|
||||
else
|
||||
@@ -340,7 +345,7 @@ local function confirmPress(button, args)
|
||||
local player = getPlayer();
|
||||
if confirmUI.actionAct == "Cut" then
|
||||
if args.option == "yes" then
|
||||
ISTimedActionQueue.add(ISCutLimb:new(player, player, descUI.partNameAct));
|
||||
ISTimedActionQueue.add(ISCutLimb:new(player, player, descUI.partNameAct))
|
||||
else
|
||||
getPlayer():Say("Never mind");
|
||||
end
|
||||
@@ -376,7 +381,7 @@ local function confirmPressMP(button, args)
|
||||
local playerInv = player:getInventory();
|
||||
local item = playerInv:getItemFromType('TOC.Real_surgeon_kit') or playerInv:getItemFromType('TOC.Surgeon_kit') or playerInv:getItemFromType('TOC.Improvised_surgeon_kit');
|
||||
if item then
|
||||
getPlayer():Say("Not moving ! Ok ?");
|
||||
getPlayer():Say("Don't move! Ok?");
|
||||
ISTimedActionQueue.add(ISOperateArm:new(confirmUIMP.patient, player, item, confirmUIMP.partNameAct, false));
|
||||
else
|
||||
player:Say("I need a kit");
|
||||
@@ -406,7 +411,7 @@ local function descPress(button, args)
|
||||
-- Do not cut if prothesis equip
|
||||
if (string.find(descUI.partNameAct, "Right") and (modData["RightHand"].has_prosthesis_equipped or modData["RightForearm"].has_prosthesis_equipped))
|
||||
or (string.find(descUI.partNameAct, "Left") and (modData["LeftHand"].has_prosthesis_equipped or modData["LeftForearm"].has_prosthesis_equipped)) then
|
||||
player:Say("I need to remove my prothesis first");
|
||||
player:Say("I need to remove my prosthesis first");
|
||||
mainUI:close();
|
||||
return false;
|
||||
end
|
||||
|
||||
@@ -126,7 +126,7 @@ function TheOnlyCure.CutLimb(part_name, surgeon_factor, bandage_table, painkille
|
||||
|
||||
-- TODO Check if this works in MP through MENU UI
|
||||
local player = getPlayer()
|
||||
local toc_data = player:getModDare().TOC
|
||||
local toc_data = player:getModData().TOC
|
||||
local body_part_type = player:getBodyDamage():getBodyPart(TheOnlyCure.GetBodyPartTypeFromBodyPart(part_name))
|
||||
local stats = player:getStats();
|
||||
|
||||
@@ -171,7 +171,7 @@ function TheOnlyCure.CutLimb(part_name, surgeon_factor, bandage_table, painkille
|
||||
-- Cut the depended part
|
||||
for _, depended_v in pairs(toc_data[part_name].depends_on) do
|
||||
toc_data[depended_v].is_cut = true
|
||||
toc_data[depended_v].is_amputation_shown = true
|
||||
toc_data[depended_v].is_amputation_shown = false -- TODO why was it true before?
|
||||
toc_data[depended_v].cicatrization_time = toc_data[part_name].cicatrization_base_time - surgeon_factor * 50
|
||||
end
|
||||
|
||||
|
||||
@@ -80,8 +80,8 @@ end
|
||||
function ISCutLimb:perform()
|
||||
local surgeon_factor, bandage_table, painkiller_table = self:findArgs()
|
||||
|
||||
if self.patient ~= self.surgoen and isClient() then
|
||||
SendCutLimb()
|
||||
if self.patient ~= self.surgeon and isClient() then
|
||||
SendCutLimb(self.patient, self.part_name, surgeon_factor, bandage_table, painkiller_table)
|
||||
else
|
||||
TheOnlyCure.CutLimb(self.part_name, surgeon_factor, bandage_table, painkiller_table)
|
||||
end
|
||||
@@ -101,8 +101,8 @@ function ISCutLimb:new(patient, surgeon, part_name)
|
||||
local o = {}
|
||||
setmetatable(o, self)
|
||||
self.__index = self
|
||||
o.partName = part_name
|
||||
o.bodyPart = TheOnlyCure.GetBodyPartTypeFromBodyPart(part_name)
|
||||
o.part_name = part_name
|
||||
o.bodyPart = TheOnlyCure.GetBodyPartTypeFromBodyPart(part_name) -- TODO I don't think I need this
|
||||
o.character = surgeon -- For anim
|
||||
|
||||
o.surgeon = surgeon; -- Surgeon or player that make the operation
|
||||
0
media/lua/client/TimedActions/ISOperateLimb.lua
Normal file
0
media/lua/client/TimedActions/ISOperateLimb.lua
Normal file
@@ -1,96 +0,0 @@
|
||||
require "TimedActions/ISBaseTimedAction"
|
||||
|
||||
IsCutArm = ISBaseTimedAction:derive("IsCutArm");
|
||||
|
||||
function IsCutArm:isValid()
|
||||
return self.patientX == self.patient:getX() and self.patientY == self.patient:getY();
|
||||
end
|
||||
|
||||
function IsCutArm:waitToStart()
|
||||
if self.patient == self.surgeon then
|
||||
return false
|
||||
end
|
||||
self.surgeon:faceThisObject(self.patient)
|
||||
return self.surgeon:shouldBeTurning()
|
||||
end
|
||||
|
||||
function IsCutArm:update()
|
||||
if self.patient ~= self.surgeon then
|
||||
self.surgeon:faceThisObject(self.patient)
|
||||
end
|
||||
end
|
||||
|
||||
function IsCutArm:start()
|
||||
if self.patient == self.surgeon then
|
||||
self:setActionAnim("WearClothing");
|
||||
self:setAnimVariable("WearClothingLocation", "Jacket")
|
||||
else
|
||||
self:setActionAnim("Loot")
|
||||
self.patient:SetVariable("LootPosition", "Mid")
|
||||
end
|
||||
end
|
||||
|
||||
function IsCutArm:findArgs()
|
||||
local useBandage, bandageAlcool, usePainkiller, painkillerCount
|
||||
local surgeonFact = self.surgeon:getPerkLevel(Perks.Doctor);
|
||||
if self.surgeon:getDescriptor():getProfession() == "surgeon" then surgeonFact = surgeonFact + 15 end
|
||||
if self.surgeon:getDescriptor():getProfession() == "doctor" then surgeonFact = surgeonFact + 9 end
|
||||
if self.surgeon:getDescriptor():getProfession() == "nurse" then surgeonFact = surgeonFact + 4 end
|
||||
|
||||
local bandage = self.surgeon:getInventory():FindAndReturn('Bandage');
|
||||
local albandage = self.surgeon:getInventory():FindAndReturn('AlcoholBandage');
|
||||
if albandage then
|
||||
useBandage = true;
|
||||
bandageAlcool = true;
|
||||
self.patient:getInventory():Remove(albandage);
|
||||
surgeonFact = surgeonFact + 4
|
||||
elseif bandage then
|
||||
useBandage = true;
|
||||
self.patient:getInventory():Remove(bandage);
|
||||
surgeonFact = surgeonFact + 2
|
||||
end
|
||||
|
||||
local painkiller = self.surgeon:getInventory():FindAndReturn('Pills');
|
||||
if painkiller then
|
||||
usePainkiller = true;
|
||||
painkillerCount = painkiller:getRemainingUses();
|
||||
end
|
||||
|
||||
return surgeonFact, useBandage, bandageAlcool, usePainkiller, painkillerCount;
|
||||
end
|
||||
|
||||
function IsCutArm:perform()
|
||||
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);
|
||||
else
|
||||
CutArm(self.partName, surgeonFact, useBandage, bandageAlcool, usePainkiller, painkillerCount);
|
||||
end
|
||||
self.surgeon:getXp():AddXP(Perks.Doctor, 400);
|
||||
|
||||
ISBaseTimedAction.perform(self);
|
||||
end
|
||||
|
||||
function IsCutArm:new(patient, surgeon, partName)
|
||||
local o = {}
|
||||
setmetatable(o, self)
|
||||
self.__index = self
|
||||
o.partName = partName;
|
||||
o.bodyPart = TOC_getBodyPart(partName);
|
||||
o.character = surgeon; -- For anim
|
||||
|
||||
o.surgeon = surgeon; -- Surgeon or player that make the operation
|
||||
o.patient = patient; -- Player to cut
|
||||
|
||||
o.patientX = patient:getX();
|
||||
o.patientY = patient:getY();
|
||||
|
||||
o.maxTime = 1000 - (surgeon:getPerkLevel(Perks.Doctor) * 50);
|
||||
o.stopOnWalk = true;
|
||||
o.stopOnRun = true;
|
||||
o.ignoreHandsWounds = false;
|
||||
o.fromHotbar = true;
|
||||
if o.patient:isTimedActionInstant() then o.maxTime = 1; end
|
||||
return o;
|
||||
end
|
||||
96
media/lua/client/TimedActions/NewOnCut_old.lua
Normal file
96
media/lua/client/TimedActions/NewOnCut_old.lua
Normal file
@@ -0,0 +1,96 @@
|
||||
-- require "TimedActions/ISBaseTimedAction"
|
||||
|
||||
-- IsCutArm = ISBaseTimedAction:derive("IsCutArm");
|
||||
|
||||
-- function IsCutArm:isValid()
|
||||
-- return self.patientX == self.patient:getX() and self.patientY == self.patient:getY();
|
||||
-- end
|
||||
|
||||
-- function IsCutArm:waitToStart()
|
||||
-- if self.patient == self.surgeon then
|
||||
-- return false
|
||||
-- end
|
||||
-- self.surgeon:faceThisObject(self.patient)
|
||||
-- return self.surgeon:shouldBeTurning()
|
||||
-- end
|
||||
|
||||
-- function IsCutArm:update()
|
||||
-- if self.patient ~= self.surgeon then
|
||||
-- self.surgeon:faceThisObject(self.patient)
|
||||
-- end
|
||||
-- end
|
||||
|
||||
-- function IsCutArm:start()
|
||||
-- if self.patient == self.surgeon then
|
||||
-- self:setActionAnim("WearClothing");
|
||||
-- self:setAnimVariable("WearClothingLocation", "Jacket")
|
||||
-- else
|
||||
-- self:setActionAnim("Loot")
|
||||
-- self.patient:SetVariable("LootPosition", "Mid")
|
||||
-- end
|
||||
-- end
|
||||
|
||||
-- function IsCutArm:findArgs()
|
||||
-- local useBandage, bandageAlcool, usePainkiller, painkillerCount
|
||||
-- local surgeonFact = self.surgeon:getPerkLevel(Perks.Doctor);
|
||||
-- if self.surgeon:getDescriptor():getProfession() == "surgeon" then surgeonFact = surgeonFact + 15 end
|
||||
-- if self.surgeon:getDescriptor():getProfession() == "doctor" then surgeonFact = surgeonFact + 9 end
|
||||
-- if self.surgeon:getDescriptor():getProfession() == "nurse" then surgeonFact = surgeonFact + 4 end
|
||||
|
||||
-- local bandage = self.surgeon:getInventory():FindAndReturn('Bandage');
|
||||
-- local albandage = self.surgeon:getInventory():FindAndReturn('AlcoholBandage');
|
||||
-- if albandage then
|
||||
-- useBandage = true;
|
||||
-- bandageAlcool = true;
|
||||
-- self.patient:getInventory():Remove(albandage);
|
||||
-- surgeonFact = surgeonFact + 4
|
||||
-- elseif bandage then
|
||||
-- useBandage = true;
|
||||
-- self.patient:getInventory():Remove(bandage);
|
||||
-- surgeonFact = surgeonFact + 2
|
||||
-- end
|
||||
|
||||
-- local painkiller = self.surgeon:getInventory():FindAndReturn('Pills');
|
||||
-- if painkiller then
|
||||
-- usePainkiller = true;
|
||||
-- painkillerCount = painkiller:getRemainingUses();
|
||||
-- end
|
||||
|
||||
-- return surgeonFact, useBandage, bandageAlcool, usePainkiller, painkillerCount;
|
||||
-- end
|
||||
|
||||
-- function IsCutArm:perform()
|
||||
-- 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);
|
||||
-- else
|
||||
-- CutArm(self.partName, surgeonFact, useBandage, bandageAlcool, usePainkiller, painkillerCount);
|
||||
-- end
|
||||
-- self.surgeon:getXp():AddXP(Perks.Doctor, 400);
|
||||
|
||||
-- ISBaseTimedAction.perform(self);
|
||||
-- end
|
||||
|
||||
-- function IsCutArm:new(patient, surgeon, partName)
|
||||
-- local o = {}
|
||||
-- setmetatable(o, self)
|
||||
-- self.__index = self
|
||||
-- o.partName = partName;
|
||||
-- o.bodyPart = TOC_getBodyPart(partName);
|
||||
-- o.character = surgeon; -- For anim
|
||||
|
||||
-- o.surgeon = surgeon; -- Surgeon or player that make the operation
|
||||
-- o.patient = patient; -- Player to cut
|
||||
|
||||
-- o.patientX = patient:getX();
|
||||
-- o.patientY = patient:getY();
|
||||
|
||||
-- o.maxTime = 1000 - (surgeon:getPerkLevel(Perks.Doctor) * 50);
|
||||
-- o.stopOnWalk = true;
|
||||
-- o.stopOnRun = true;
|
||||
-- o.ignoreHandsWounds = false;
|
||||
-- o.fromHotbar = true;
|
||||
-- if o.patient:isTimedActionInstant() then o.maxTime = 1; end
|
||||
-- return o;
|
||||
-- end
|
||||
Reference in New Issue
Block a user