Holy shit it's working
This commit is contained in:
@@ -34,12 +34,25 @@ function TryTocAction(_, part_name, action, surgeon, patient)
|
|||||||
ui = GetConfirmUIMP()
|
ui = GetConfirmUIMP()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
if patient == nil then
|
||||||
|
patient = surgeon
|
||||||
|
end
|
||||||
|
|
||||||
if action == "Cut" then
|
if action == "Cut" then
|
||||||
AskCanCutLimb(patient, part_name)
|
AskCanCutLimb(patient, part_name)
|
||||||
elseif action == "Operate" then
|
elseif action == "Operate" then
|
||||||
AskCanOperateLimb(patient, part_name)
|
AskCanOperateLimb(patient, part_name)
|
||||||
elseif action == "Equip" then
|
elseif action == "Equip" then
|
||||||
|
local surgeon_inventory = surgeon:getInventory()
|
||||||
|
local prosthesis_to_equip = surgeon_inventory:getItemFromType('TOC.MetalHand') or
|
||||||
|
surgeon_inventory:getItemFromType('TOC.MetalHook') or
|
||||||
|
surgeon_inventory:getItemFromType('TOC.WoodenHook')
|
||||||
|
if prosthesis_to_equip then
|
||||||
|
ISTimedActionQueue.add(ISInstallProsthesis:new(patient, prosthesis_to_equip, patient:getBodyDamage():getBodyPart(TocGetBodyPartTypeFromBodyPart(part_name))))
|
||||||
|
else
|
||||||
|
surgeon:Say("I need a prosthesis")
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -47,13 +60,17 @@ function TryTocAction(_, part_name, action, surgeon, patient)
|
|||||||
|
|
||||||
elseif action == "Unequip" then
|
elseif action == "Unequip" then
|
||||||
--AskCanUnequipProsthesis(patient, part_name)
|
--AskCanUnequipProsthesis(patient, part_name)
|
||||||
|
local equipped_prosthesis = FindTocItemWorn(part_name, patient)
|
||||||
|
ISTimedActionQueue.add(ISUninstallProsthesis:new(patient, equipped_prosthesis, patient:getBodyDamage():getBodyPart(TocGetBodyPartTypeFromBodyPart(part_name))))
|
||||||
end
|
end
|
||||||
ui.actionAct = action
|
ui.actionAct = action
|
||||||
ui.partNameAct = part_name
|
ui.partNameAct = part_name
|
||||||
ui.patient = patient
|
ui.patient = patient
|
||||||
|
|
||||||
SendCommandToConfirmUIMP("Wait server")
|
--TODO just a workaround for now
|
||||||
|
if action ~= "Equip" and action ~= "Unequip" then
|
||||||
|
SendCommandToConfirmUIMP("Wait server")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -164,37 +164,26 @@ end
|
|||||||
local function OnClickTocDescUI(button, args)
|
local function OnClickTocDescUI(button, args)
|
||||||
-- Gets every arg from main
|
-- Gets every arg from main
|
||||||
|
|
||||||
local patient = args.patient
|
local patient = desc_ui.patient
|
||||||
local surgeon = args.surgeon
|
local surgeon = desc_ui.surgeon
|
||||||
|
|
||||||
|
|
||||||
if patient == nil then
|
|
||||||
patient = surgeon
|
|
||||||
end
|
|
||||||
-- Validate action
|
-- Validate action
|
||||||
if args.option == "Cut" then
|
if args.option == "Cut" then
|
||||||
TryTocAction(_, desc_ui.part_name, "Cut", surgeon, patient)
|
TryTocAction(_, desc_ui.part_name, "Cut", surgeon, patient)
|
||||||
elseif args.option == "Operate" then
|
elseif args.option == "Operate" then
|
||||||
TryTocAction(_, desc_ui.part_name, "Operate", surgeon, patient)
|
TryTocAction(_, desc_ui.part_name, "Operate", surgeon, patient)
|
||||||
|
|
||||||
|
|
||||||
elseif args.option == "Equip" then
|
elseif args.option == "Equip" then
|
||||||
|
TryTocAction(_, desc_ui.part_name, "Equip", surgeon, patient)
|
||||||
-- TODO probably completely broken for MP
|
-- TODO probably completely broken for MP
|
||||||
-- TODO this is really janky
|
-- TODO this is really janky
|
||||||
local surgeon_inventory = surgeon:getInventory()
|
|
||||||
local prosthesis_to_equip = surgeon_inventory:getItemFromType('TOC.MetalHand') or
|
|
||||||
surgeon_inventory:getItemFromType('TOC.MetalHook') or
|
|
||||||
surgeon_inventory:getItemFromType('TOC.WoodenHook')
|
|
||||||
if prosthesis_to_equip then
|
|
||||||
ISTimedActionQueue.add(ISInstallProsthesis:new(patient, prosthesis_to_equip, patient:getBodyDamage():getBodyPart(TocGetBodyPartTypeFromBodyPart(desc_ui.part_name))))
|
|
||||||
else
|
|
||||||
surgeon:Say("I need a prosthesis")
|
|
||||||
end
|
|
||||||
main_ui:close()
|
|
||||||
elseif args.option == "Unequip" then
|
elseif args.option == "Unequip" then
|
||||||
local equipped_prosthesis = FindTocItemWorn(desc_ui.part_name, patient)
|
TryTocAction(_, desc_ui.part_name, "Unequip", surgeon, patient)
|
||||||
ISTimedActionQueue.add(ISUninstallProsthesis:new(patient, equipped_prosthesis, patient:getBodyDamage():getBodyPart(TocGetBodyPartTypeFromBodyPart(desc_ui.part_name))))
|
|
||||||
main_ui:close()
|
|
||||||
end
|
end
|
||||||
|
main_ui:close()
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -388,6 +377,8 @@ function SetupTocDescUI(surgeon, patient, toc_data, part_name)
|
|||||||
local part_data = toc_data[part_name]
|
local part_data = toc_data[part_name]
|
||||||
desc_ui["textTitle"]:setText(TocGetDisplayText(part_name))
|
desc_ui["textTitle"]:setText(TocGetDisplayText(part_name))
|
||||||
desc_ui.part_name = part_name
|
desc_ui.part_name = part_name
|
||||||
|
desc_ui.surgeon = surgeon
|
||||||
|
desc_ui.patient = patient
|
||||||
|
|
||||||
if IsProsthesisInstalled(part_data) then
|
if IsProsthesisInstalled(part_data) then
|
||||||
-- Limb cut with prosthesis
|
-- Limb cut with prosthesis
|
||||||
@@ -431,7 +422,6 @@ function SetupTocDescUI(surgeon, patient, toc_data, part_name)
|
|||||||
-- Set the operate button
|
-- Set the operate button
|
||||||
desc_ui["b1"]:setText("Operate")
|
desc_ui["b1"]:setText("Operate")
|
||||||
desc_ui["b1"]:addArg("option", "Operate")
|
desc_ui["b1"]:addArg("option", "Operate")
|
||||||
desc_ui["b1"]:addArg("surgeon", surgeon)
|
|
||||||
desc_ui["b1"]:setVisible(true)
|
desc_ui["b1"]:setVisible(true)
|
||||||
|
|
||||||
if part_data.cicatrization_time > 1000 then
|
if part_data.cicatrization_time > 1000 then
|
||||||
@@ -461,8 +451,6 @@ function SetupTocDescUI(surgeon, patient, toc_data, part_name)
|
|||||||
desc_ui["b1"]:setVisible(true)
|
desc_ui["b1"]:setVisible(true)
|
||||||
desc_ui["b1"]:setText("Cut")
|
desc_ui["b1"]:setText("Cut")
|
||||||
desc_ui["b1"]:addArg("option", "Cut")
|
desc_ui["b1"]:addArg("option", "Cut")
|
||||||
desc_ui["b1"]:addArg("surgeon", surgeon)
|
|
||||||
desc_ui["b1"]:addArg("patient", patient)
|
|
||||||
elseif GetSawInInventory(surgeon) and not CanLimbBeAmputated(toc_data, part_name) then
|
elseif GetSawInInventory(surgeon) and not CanLimbBeAmputated(toc_data, part_name) then
|
||||||
desc_ui["b1"]:setVisible(true)
|
desc_ui["b1"]:setVisible(true)
|
||||||
desc_ui["b1"]:setText("Cut")
|
desc_ui["b1"]:setText("Cut")
|
||||||
|
|||||||
@@ -142,6 +142,7 @@ function TheOnlyCure.HealSpecificPart(toc_data, part_name, player)
|
|||||||
toc_data[part_name].is_cicatrized = true
|
toc_data[part_name].is_cicatrized = true
|
||||||
|
|
||||||
-- TODO make this random if the player gets it or not
|
-- TODO make this random if the player gets it or not
|
||||||
|
--FIXME they're gonna stack!!!!
|
||||||
player:getTraits():add("Brave")
|
player:getTraits():add("Brave")
|
||||||
player:getTraits():add("Insensitive")
|
player:getTraits():add("Insensitive")
|
||||||
body_part_type:setBleeding(false);
|
body_part_type:setBleeding(false);
|
||||||
|
|||||||
@@ -21,12 +21,11 @@ end
|
|||||||
|
|
||||||
function GetAcceptingProsthesisBodyParts()
|
function GetAcceptingProsthesisBodyParts()
|
||||||
|
|
||||||
function GetLimbsBodyPartTypes()
|
|
||||||
|
|
||||||
return {BodyPartType.Hand_R, BodyPartType.ForeArm_R,
|
return {BodyPartType.Hand_R, BodyPartType.ForeArm_R,
|
||||||
BodyPartType.Hand_L, BodyPartType.ForeArm_L}
|
BodyPartType.Hand_L, BodyPartType.ForeArm_L}
|
||||||
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@@ -45,12 +44,13 @@ end
|
|||||||
function FindTocItemWorn(part_name, patient)
|
function FindTocItemWorn(part_name, patient)
|
||||||
local worn_items = patient:getWornItems()
|
local worn_items = patient:getWornItems()
|
||||||
|
|
||||||
for _, v in ipairs(worn_items) do
|
for i=1,worn_items:size()-1 do -- Maybe wornItems:size()-1
|
||||||
local item = v.getItem()
|
local item = worn_items:get(i):getItem();
|
||||||
if item:getBodyLocation() == PartNameToBodyLocation(part_name) then
|
if item:getBodyLocation() == PartNameToBodyLocation(part_name) then
|
||||||
return item
|
return item;
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user