Fixed Uninstall prost in sp
This commit is contained in:
@@ -1,3 +1,6 @@
|
|||||||
|
-- TODO patient and surgeon will always be the same if we're local... dumb cock
|
||||||
|
|
||||||
|
|
||||||
function TocCutLocal(_, patient, surgeon, part_name)
|
function TocCutLocal(_, patient, surgeon, part_name)
|
||||||
if TocGetSawInInventory(surgeon) ~= nil then
|
if TocGetSawInInventory(surgeon) ~= nil then
|
||||||
ISTimedActionQueue.add(ISCutLimb:new(patient, surgeon, part_name));
|
ISTimedActionQueue.add(ISCutLimb:new(patient, surgeon, part_name));
|
||||||
@@ -22,8 +25,6 @@ function TocOperateLocal(_, patient, surgeon, part_name, use_oven)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function TocEquipProsthesisLocal(_, patient, surgeon, part_name)
|
function TocEquipProsthesisLocal(_, patient, surgeon, part_name)
|
||||||
-- TODO probably completely broken for MP
|
|
||||||
-- TODO this is really janky
|
|
||||||
local surgeon_inventory = surgeon:getInventory()
|
local surgeon_inventory = surgeon:getInventory()
|
||||||
local prosthesis_to_equip = surgeon_inventory:getItemFromType('TOC.MetalHand') or
|
local prosthesis_to_equip = surgeon_inventory:getItemFromType('TOC.MetalHand') or
|
||||||
surgeon_inventory:getItemFromType('TOC.MetalHook') or
|
surgeon_inventory:getItemFromType('TOC.MetalHook') or
|
||||||
@@ -36,7 +37,10 @@ function TocEquipProsthesisLocal(_, patient, surgeon, part_name)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function TocUnequipProsthesisLocal(_, patient, part_name)
|
function TocUnequipProsthesisLocal(_, patient, part_name)
|
||||||
local equipped_prosthesis = TocFindItemInProstBodyLocation(part_name, patient)
|
--local equipped_prosthesis = TocFindItemInProstBodyLocation(part_name, patient)
|
||||||
ISTimedActionQueue.add(ISUninstallProsthesis:new(patient, equipped_prosthesis,
|
|
||||||
patient:getBodyDamage():getBodyPart(TocGetBodyPartTypeFromPartName(part_name))))
|
ISTimedActionQueue.add(ISUninstallProsthesis:new(patient, patient, part_name))
|
||||||
|
|
||||||
|
--ISTimedActionQueue.add(ISUninstallProsthesis:new(patient, equipped_prosthesis,
|
||||||
|
-- patient:getBodyDamage():getBodyPart(TocGetBodyPartTypeFromPartName(part_name))))
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -192,7 +192,8 @@ function OnClickTocConfirmUIMP(button, args)
|
|||||||
surgeon_inventory:getItemFromType('TOC.WoodenHook')
|
surgeon_inventory:getItemFromType('TOC.WoodenHook')
|
||||||
|
|
||||||
if prosthesis_to_equip then
|
if prosthesis_to_equip then
|
||||||
ISTimedActionQueue.add(ISInstallProsthesis:new(player, confirm_ui_mp.patient, prosthesis_to_equip, confirm_ui_mp.partNameAct))
|
ISTimedActionQueue.add(ISInstallProsthesis:new(player, confirm_ui_mp.patient, prosthesis_to_equip,
|
||||||
|
confirm_ui_mp.partNameAct))
|
||||||
else
|
else
|
||||||
player:Say("I don't have a prosthesis right now")
|
player:Say("I don't have a prosthesis right now")
|
||||||
end
|
end
|
||||||
@@ -352,6 +353,8 @@ end
|
|||||||
|
|
||||||
function SetupTocMainUI(surgeon, patient, toc_data)
|
function SetupTocMainUI(surgeon, patient, toc_data)
|
||||||
|
|
||||||
|
-- TODO add a ontick to update it regularly
|
||||||
|
|
||||||
main_ui.surgeon = surgeon -- we shouldn't need an arg for this
|
main_ui.surgeon = surgeon -- we shouldn't need an arg for this
|
||||||
main_ui.patient = patient
|
main_ui.patient = patient
|
||||||
|
|
||||||
@@ -565,7 +568,6 @@ function ISNewHealthPanel.onClick_TOC(button)
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function TocWaitForOnlinePlayerData(numberTicks)
|
function TocWaitForOnlinePlayerData(numberTicks)
|
||||||
if MP_other_player_toc_data ~= nil then
|
if MP_other_player_toc_data ~= nil then
|
||||||
SetupTocMainUI(TocTempTable.TempSurgeon, TocTempTable.TempPatient, MP_other_player_toc_data)
|
SetupTocMainUI(TocTempTable.TempSurgeon, TocTempTable.TempPatient, MP_other_player_toc_data)
|
||||||
@@ -582,7 +584,6 @@ function TocWaitForOnlinePlayerData(numberTicks)
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function ISHealthPanel:createChildren()
|
function ISHealthPanel:createChildren()
|
||||||
ISHealthPanel_createChildren(self)
|
ISHealthPanel_createChildren(self)
|
||||||
|
|
||||||
|
|||||||
@@ -341,7 +341,6 @@ function TheOnlyCure.OperateLimb(part_name, surgeon_factor, use_oven)
|
|||||||
player:transmitModData()
|
player:transmitModData()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function TheOnlyCure.EquipProsthesis(part_name, prosthesis_base_name)
|
function TheOnlyCure.EquipProsthesis(part_name, prosthesis_base_name)
|
||||||
local player = getPlayer()
|
local player = getPlayer()
|
||||||
|
|
||||||
@@ -353,7 +352,7 @@ function TheOnlyCure.EquipProsthesis(part_name, prosthesis_base_name)
|
|||||||
if part_name ~= nil then
|
if part_name ~= nil then
|
||||||
|
|
||||||
if added_prosthesis ~= nil then
|
if added_prosthesis ~= nil then
|
||||||
toc_data.Limbs[part_name].is_prosthesis_equipped = true -- TODO should we show that the hand has a prost too if it's installed in the forearm?
|
toc_data.Limbs[part_name].is_prosthesis_equipped = true
|
||||||
toc_data.Limbs[part_name].equipped_prosthesis = toc_data.Prosthesis[prosthesis_base_name][part_name]
|
toc_data.Limbs[part_name].equipped_prosthesis = toc_data.Prosthesis[prosthesis_base_name][part_name]
|
||||||
|
|
||||||
player:setWornItem(added_prosthesis:getBodyLocation(), added_prosthesis)
|
player:setWornItem(added_prosthesis:getBodyLocation(), added_prosthesis)
|
||||||
@@ -368,21 +367,17 @@ function TheOnlyCure.EquipProsthesis(part_name, prosthesis_base_name)
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function TheOnlyCure.UnequipProsthesis(part_name, equipped_prosthesis)
|
function TheOnlyCure.UnequipProsthesis(part_name, equipped_prosthesis)
|
||||||
local player = getPlayer()
|
local player = getPlayer()
|
||||||
|
|
||||||
local toc_data = player:getModData().TOC
|
local toc_data = player:getModData().TOC
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-- we've got equipped_prosthesis, so we should be able to get it directly
|
-- we've got equipped_prosthesis, so we should be able to get it directly
|
||||||
toc_data.Limbs[part_name].is_prosthesis_equipped = false
|
toc_data.Limbs[part_name].is_prosthesis_equipped = false
|
||||||
local equipped_prosthesis_full_type = equipped_prosthesis:getFullType()
|
local equipped_prosthesis_full_type = equipped_prosthesis:getFullType()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
for _, prost_v in ipairs(GetProsthesisList()) do
|
for _, prost_v in ipairs(GetProsthesisList()) do
|
||||||
local prosthesis_name = string.match(equipped_prosthesis_full_type, prost_v)
|
local prosthesis_name = string.match(equipped_prosthesis_full_type, prost_v)
|
||||||
if prosthesis_name then
|
if prosthesis_name then
|
||||||
@@ -392,7 +387,6 @@ function TheOnlyCure.UnequipProsthesis(part_name, equipped_prosthesis)
|
|||||||
player:getInventory():Remove(equipped_prosthesis)
|
player:getInventory():Remove(equipped_prosthesis)
|
||||||
player:transmitModData()
|
player:transmitModData()
|
||||||
|
|
||||||
-- needed to remove from queue / start next.
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
@@ -400,9 +394,6 @@ function TheOnlyCure.UnequipProsthesis(part_name, equipped_prosthesis)
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function TryTocAction(_, part_name, action, surgeon, patient)
|
function TryTocAction(_, part_name, action, surgeon, patient)
|
||||||
-- 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
|
||||||
-- TODO at this point surgeon doesnt do anything. We'll fix this later
|
-- TODO at this point surgeon doesnt do anything. We'll fix this later
|
||||||
@@ -415,12 +406,8 @@ function TryTocAction(_, part_name, action, surgeon, patient)
|
|||||||
elseif action == "Operate" then
|
elseif action == "Operate" then
|
||||||
TocOperateLocal(_, surgeon, surgeon, part_name, false)
|
TocOperateLocal(_, surgeon, surgeon, part_name, false)
|
||||||
elseif action == "Equip" then
|
elseif action == "Equip" then
|
||||||
-- TODO finish this
|
|
||||||
local item
|
|
||||||
TocEquipProsthesisLocal(_, surgeon, surgeon, part_name)
|
TocEquipProsthesisLocal(_, surgeon, surgeon, part_name)
|
||||||
elseif action == "Unequip" then
|
elseif action == "Unequip" then
|
||||||
-- TODO finish this
|
|
||||||
local item
|
|
||||||
TocUnequipProsthesisLocal(_, surgeon, part_name)
|
TocUnequipProsthesisLocal(_, surgeon, part_name)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
@@ -441,37 +428,9 @@ function TryTocAction(_, part_name, action, surgeon, patient)
|
|||||||
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.MetalHook')
|
|
||||||
--local prosthesis_to_equip = surgeon_inventory:getItemFromType('TOC.MetalHand') or
|
|
||||||
-- surgeon_inventory:getItemFromType('TOC.MetalHook') or
|
|
||||||
-- surgeon_inventory:getItemFromType('TOC.WoodenHook')
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
AskCanEquipProsthesis(patient, part_name)
|
AskCanEquipProsthesis(patient, part_name)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-- if prosthesis_to_equip then
|
|
||||||
-- ISTimedActionQueue.add(ISInstallProsthesis:new(patient, prosthesis_to_equip,
|
|
||||||
-- patient:getBodyDamage():getBodyPart(TocGetBodyPartTypeFromPartName(part_name))))
|
|
||||||
-- else
|
|
||||||
-- surgeon:Say("I need a prosthesis")
|
|
||||||
-- end
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
--AskCanEquipProsthesis(patient, part_name, item)
|
|
||||||
|
|
||||||
elseif action == "Unequip" then
|
elseif action == "Unequip" then
|
||||||
AskCanUnequipProsthesis(patient, part_name)
|
AskCanUnequipProsthesis(patient, part_name)
|
||||||
-- local equipped_prosthesis = TocFindItemInProstBodyLocation(part_name, patient)
|
|
||||||
-- ISTimedActionQueue.add(ISUninstallProsthesis:new(patient, equipped_prosthesis,
|
|
||||||
-- patient:getBodyDamage():getBodyPart(TocGetBodyPartTypeFromPartName(part_name))))
|
|
||||||
end
|
end
|
||||||
ui.actionAct = action
|
ui.actionAct = action
|
||||||
ui.partNameAct = part_name
|
ui.partNameAct = part_name
|
||||||
|
|||||||
Reference in New Issue
Block a user