More cleaning, first stuff to implement mp compatibile prosthesis equipping

This commit is contained in:
Pao
2023-01-15 01:36:55 +01:00
parent 483d163f43
commit d0abaed732
12 changed files with 216 additions and 143 deletions
+3 -1
View File
@@ -35,6 +35,8 @@
"ISEquipWeaponAction", "ISEquipWeaponAction",
"triggerEvent", "triggerEvent",
"forceDropHeavyItems", "forceDropHeavyItems",
"getPlayerHotbar" "getPlayerHotbar",
"isServer",
"BodyLocations"
] ]
} }
+9 -3
View File
@@ -4,15 +4,21 @@ if TheOnlyCure == nil then
TheOnlyCure = {} TheOnlyCure = {}
end end
function TheOnlyCure.CheckIfCanBeCut(toc_data, part_name) function CheckIfCanBeCut(part_name)
return not toc_data[part_name].is_cut return not getPlayer():getModData().TOC[part_name].is_cut
end end
function TheOnlyCure.CheckIfCanBeOperated(toc_data, part_name) function CheckIfCanBeOperated(part_name)
local toc_data = getPlayer():getModData().TOC
return toc_data[part_name].is_operated == false and toc_data[part_name].is_amputation_shown return toc_data[part_name].is_operated == false and toc_data[part_name].is_amputation_shown
end
function CheckIfProsthesisCanBeEquipped(part_name)
end end
+38 -17
View File
@@ -9,7 +9,7 @@ Commands["ResponseCanAct"] = function(arg)
ui.responsePartName = arg["toSend"][1] ui.responsePartName = arg["toSend"][1]
ui.responseCan = arg["toSend"][3] ui.responseCan = arg["toSend"][3]
ui.responseUserName = getPlayerByOnlineID(arg["From"]):getUsername() ui.responseUserName = getPlayerByOnlineID(arg["From"]):getUsername()
ui.responseActionIsBitten = getPlayerByOnlineID(arg["From"]):getBodyDamage():getBodyPart(TOC_getBodyPart(ui.responsePartName)):bitten() ui.responseActionIsBitten = getPlayerByOnlineID(arg["From"]):getBodyDamage():getBodyPart(TocGetBodyPartTypeFromBodyPart(ui.responsePartName)):bitten()
end end
@@ -32,23 +32,33 @@ function SendOperateLimb(player, part_name, surgeon_factor, use_oven)
end end
function AskCanCutLimb(player, part_name) function AskCanCutLimb(player, part_name)
GetConfirmUIMP().responseReceive = false; GetConfirmUIMP().responseReceive = false
local arg = {}; local arg = {}
arg["From"] = getPlayer():getOnlineID(); arg["From"] = getPlayer():getOnlineID()
arg["To"] = player:getOnlineID(); arg["To"] = player:getOnlineID()
arg["command"] = "CanCutLimb"; arg["command"] = "CanCutLimb"
arg["toSend"] = part_name; arg["toSend"] = part_name
sendClientCommand("TOC", "SendServer", arg); sendClientCommand("TOC", "SendServer", arg)
end end
function AskCanOperateLimb(player, part_name) function AskCanOperateLimb(player, part_name)
GetConfirmUIMP().responseReceive = false; GetConfirmUIMP().responseReceive = false
local arg = {}; local arg = {}
arg["From"] = getPlayer():getOnlineID(); arg["From"] = getPlayer():getOnlineID()
arg["To"] = player:getOnlineID(); arg["To"] = player:getOnlineID()
arg["command"] = "CanOperateLimb"; arg["command"] = "CanOperateLimb"
arg["toSend"] = part_name; arg["toSend"] = part_name
sendClientCommand("TOC", "SendServer", arg); sendClientCommand("TOC", "SendServer", arg)
end
function AskCanEquipProsthesis(player, part_name)
GetConfirmUIMP().responseReceive = false
local arg = {}
arg["From"] = getPlayer():getOnlineID()
arg["To"] = player:getOnlineID()
arg["command"] = "CanEquipProsthesis"
arg["toSend"] = part_name
sendClientCommand("TOC", "SendServer", arg)
end end
@@ -69,7 +79,7 @@ Commands["CanCutLimb"] = function(arg)
arg["To"] = arg["From"] arg["To"] = arg["From"]
arg["From"] = getPlayer():getOnlineID() arg["From"] = getPlayer():getOnlineID()
arg["command"] = "ResponseCanAct" arg["command"] = "ResponseCanAct"
arg["toSend"] = {part_name, "Cut", CanBeCut(part_name)} arg["toSend"] = {part_name, "Cut", CheckIfCanBeCut(part_name)}
sendClientCommand("TOC", "SendServer", arg) sendClientCommand("TOC", "SendServer", arg)
end end
@@ -79,10 +89,21 @@ Commands["CanOperateLimb"] = function(arg)
arg["To"] = arg["From"] arg["To"] = arg["From"]
arg["From"] = getPlayer():getOnlineID() arg["From"] = getPlayer():getOnlineID()
arg["command"] = "ResponseCanAct" arg["command"] = "ResponseCanAct"
arg["toSend"] = {part_name, "Operate", CanBeOperate(part_name)} arg["toSend"] = {part_name, "Operate", CheckIfCanBeOperated(part_name)}
sendClientCommand("TOC", "SendServer", arg) sendClientCommand("TOC", "SendServer", arg)
end end
Commands["CanEquipProsthesis"] = function(arg)
local part_name = arg["toSend"]
arg["To"] = arg["From"]
arg["From"] = getPlayer():getOnlineID()
arg["command"] = "ResponseCanAct"
arg["toSend"] = {part_name, "Equip", CheckIfProsthesisCanBeEquipped(part_name)}
end
Commands["CanResetEverything"] = function(arg) Commands["CanResetEverything"] = function(arg)
local part_name = "RightHand" --useless local part_name = "RightHand" --useless
+43 -42
View File
@@ -1,55 +1,56 @@
-- TODO rewrite this mess
function TocCutLocal(_, patient, surgeon, part_name)
if GetSawInInventory(surgeon) ~= nil then
ISTimedActionQueue.add(ISCutLimb:new(patient, surgeon, part_name));
else
surgeon:Say("I don't have a saw on me")
end
end
function TocOperateLocal(_, patient, surgeon, part_name, use_oven)
--local player = getPlayer();
-- todo add a check if the player has already been amputated or somethin
if use_oven then
ISTimedActionQueue.add(ISOperateLimb:new(patient, surgeon, _, part_name, use_oven));
else
local kit = GetKitInInventory(surgeon)
if kit ~= nil then
ISTimedActionQueue.add(ISOperateLimb:new(patient, surgeon, kit, part_name, false))
else
surgeon:Say("I don't have a kit on me")
end
end
end
function TryToToResetEverythingOtherPlayer(_, patient, surgeon) function TryToToResetEverythingOtherPlayer(_, patient, surgeon)
sendClientCommand(surgeon, "TOC", "AskToResetEverything", {patient:getOnlineID()}) sendClientCommand(surgeon, "TOC", "AskToResetEverything", {patient:getOnlineID()})
end end
-- TODO Rename this
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
local ui = GetConfirmUIMP()
if not ui then
CreateTocConfirmUIMP()
ui = GetConfirmUIMP()
end
if action == "Cut" then -- Check if SinglePlayer
AskCanCutLimb(patient, part_name) if not isServer() and not isClient() then
elseif action == "Operate" then
AskCanOperateLimb(patient, part_name) if action == "Cut" then
TocCutLocal(_, patient, patient, part_name)
elseif action == "Operate" then
TocOperateLocal(_, patient, patient, part_name, false)
elseif action == "Equip" then
-- TODO finish this
local item
TocEquipProsthesisLocal(_, patient, surgeon, part_name)
elseif action == "Unequip" then
-- TODO finish this
local item
TocUnequipProsthesisLocal(_, patient, part_name)
end
else
local ui = GetConfirmUIMP()
if not ui then
CreateTocConfirmUIMP()
ui = GetConfirmUIMP()
end
if action == "Cut" then
AskCanCutLimb(patient, part_name)
elseif action == "Operate" then
AskCanOperateLimb(patient, part_name)
elseif action == "Equip" then
--AskCanEquipProsthesis(patient, part_name, item)
elseif action == "Unequip" then
--AskCanUnequipProsthesis(patient, part_name)
end
ui.actionAct = action
ui.partNameAct = part_name
ui.patient = patient
SendCommandToConfirmUIMP("Wait server")
end end
ui.actionAct = action
ui.partNameAct = part_name
ui.patient = patient
SendCommandToConfirmUIMP("Wait server")
end end
@@ -214,11 +215,11 @@ TocContextMenus.FillCutAndOperateMenus = function(local_player, clicked_player,
if local_player == clicked_player then -- Local player if local_player == clicked_player then -- Local player
if TheOnlyCure.CheckIfCanBeCut(local_toc_data, v) then if CheckIfCanBeCut(v) then
cut_menu:addOption(getText('UI_ContextMenu_' .. v), _, TryTocAction, v, "Cut", local_player, local_player) cut_menu:addOption(getText('UI_ContextMenu_' .. v), _, TryTocAction, v, "Cut", local_player, local_player)
--cut_menu:addOption(getText('UI_ContextMenu_' .. v), _, TocCutLocal, local_player, local_player, v) --cut_menu:addOption(getText('UI_ContextMenu_' .. v), _, TocCutLocal, local_player, local_player, v)
elseif TheOnlyCure.CheckIfCanBeOperated(local_toc_data, v) then elseif CheckIfCanBeOperated(v) then
operate_menu:addOption(getText('UI_ContextMenu_' .. v), _, TryTocAction, v, "Operate", local_player, local_player) operate_menu:addOption(getText('UI_ContextMenu_' .. v), _, TryTocAction, v, "Operate", local_player, local_player)
end end
+2 -2
View File
@@ -44,11 +44,11 @@ function SetBodyPartsStatusAfterOperation(player, toc_data, part_name, use_oven)
--for _, v in ipairs(GetBodyParts()) do --for _, v in ipairs(GetBodyParts()) do
local body_part_type = player:getBodyDamage():getBodyPart(TheOnlyCure.GetBodyPartTypeFromBodyPart(part_name)) local body_part_type = player:getBodyDamage():getBodyPart(TocGetBodyPartTypeFromBodyPart(part_name))
FixSingleBodyPartType(body_part_type, use_oven) FixSingleBodyPartType(body_part_type, use_oven)
for _, v in ipairs(toc_data[part_name].depends_on) do for _, v in ipairs(toc_data[part_name].depends_on) do
local depended_body_part_type = player:getBodyDamage():getBodyPart(TheOnlyCure.GetBodyPartTypeFromBodyPart(v)) local depended_body_part_type = player:getBodyDamage():getBodyPart(TocGetBodyPartTypeFromBodyPart(v))
FixSingleBodyPartType(depended_body_part_type, use_oven) FixSingleBodyPartType(depended_body_part_type, use_oven)
end end
+41
View File
@@ -0,0 +1,41 @@
function TocCutLocal(_, patient, surgeon, part_name)
if GetSawInInventory(surgeon) ~= nil then
ISTimedActionQueue.add(ISCutLimb:new(patient, surgeon, part_name));
else
surgeon:Say("I don't have a saw on me")
end
end
function TocOperateLocal(_, patient, surgeon, part_name, use_oven)
--local player = getPlayer();
-- todo add a check if the player has already been amputated or somethin
if use_oven then
ISTimedActionQueue.add(ISOperateLimb:new(patient, surgeon, _, part_name, use_oven));
else
local kit = GetKitInInventory(surgeon)
if kit ~= nil then
ISTimedActionQueue.add(ISOperateLimb:new(patient, surgeon, kit, part_name, false))
else
surgeon:Say("I don't have a kit on me")
end
end
end
function TocEquipProsthesisLocal(_, patient, surgeon, part_name)
-- TODO probably completely broken for MP
-- 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(part_name))))
else
surgeon:Say("I need a prosthesis")
end
end
function TocUnequipProsthesisLocal(_, patient, part_name)
local equipped_prosthesis = FindTocItemWorn(part_name, patient)
ISTimedActionQueue.add(ISUninstallProsthesis:new(patient, equipped_prosthesis, patient:getBodyDamage():getBodyPart(TocGetBodyPartTypeFromBodyPart(part_name))))
end
+32 -36
View File
@@ -53,7 +53,7 @@ local function GetImageName(part_name, toc_data)
name = "media/ui/TOC/" .. part_name .. "/Operate.png" 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) 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" 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 elseif not part_data.is_cut and getPlayer():getBodyDamage():getBodyPart(TocGetBodyPartTypeFromBodyPart(part_name)):bitten() then -- Not cut but bitten
name = "media/ui/TOC/" .. part_name .. "/Bite.png" name = "media/ui/TOC/" .. part_name .. "/Bite.png"
else -- Not cut else -- Not cut
name = "media/ui/TOC/" .. part_name .. "/Base.png" name = "media/ui/TOC/" .. part_name .. "/Base.png"
@@ -96,7 +96,7 @@ end
local function IsPartBitten(part_data, part_name) local function IsPartBitten(part_data, part_name)
return not part_data.is_cut and getPlayer():getBodyDamage():getBodyPart(TOC_getBodyPart(part_name)):bitten() return not part_data.is_cut and getPlayer():getBodyDamage():getBodyPart(TocGetBodyPartTypeFromBodyPart(part_name)):bitten()
end end
local function CanLimbBeAmputated(toc_data, part_name) local function CanLimbBeAmputated(toc_data, part_name)
@@ -167,33 +167,30 @@ local function OnClickTocDescUI(button, args)
local patient = args.patient local patient = args.patient
local surgeon = args.surgeon local surgeon = args.surgeon
local surgeon_inventory = surgeon:getInventory()
-- 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(_, patient, surgeon, desc_ui.part_name, false)
-- if patient == surgeon then
-- TocOperateLocal(_, patient, surgeon, desc_ui.part_name, false)
-- else
-- TryTocAction(_, desc_ui.part, "Operate", surgeon, patient)
-- end
elseif args.option == "Equip" then elseif args.option == "Equip" then
-- TODO probably completely broken for MP -- TODO probably completely broken for MP
-- TODO this is really janky -- TODO this is really janky
local item = surgeon_inventory:getItemFromType('TOC.MetalHand') or surgeon_inventory:getItemFromType('TOC.MetalHook') or surgeon_inventory:getItemFromType('TOC.WoodenHook') local surgeon_inventory = surgeon:getInventory()
if item then local prosthesis_to_equip = surgeon_inventory:getItemFromType('TOC.MetalHand') or
ISTimedActionQueue.add(ISInstallProsthesis:new(patient, item, patient:getBodyDamage():getBodyPart(TOC_getBodyPart(desc_ui.part_name)))) 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 else
surgeon:Say("I need a prosthesis") surgeon:Say("I need a prosthesis")
end end
main_ui:close() main_ui:close()
elseif args.option == "Unequip" then elseif args.option == "Unequip" then
ISTimedActionQueue.add(ISUninstallProsthesis:new(patient, find_itemWorn_TOC(desc_ui.part_name), patient:getBodyDamage():getBodyPart(TOC_getBodyPart(desc_ui.part_name)))); local equipped_prosthesis = FindTocItemWorn(desc_ui.part_name, patient)
ISTimedActionQueue.add(ISUninstallProsthesis:new(patient, equipped_prosthesis, patient:getBodyDamage():getBodyPart(TocGetBodyPartTypeFromBodyPart(desc_ui.part_name))))
main_ui:close() main_ui:close()
end end
@@ -201,29 +198,28 @@ end
function OnClickTocConfirmUIMP(button, args) function OnClickTocConfirmUIMP(button, args)
local player = getPlayer(); local player = getPlayer()
if confirm_ui_mp.actionAct == "Cut" then if confirm_ui_mp.actionAct == "Cut" and args.option == "yes" then
if args.option == "yes" then ISTimedActionQueue.add(ISCutLimb:new(confirm_ui_mp.patient, player, confirm_ui_mp.partNameAct))
getPlayer():Say("Hold on, I believe in you!"); elseif confirm_ui_mp.actionAct == "Operate" and args.option == "yes" then
ISTimedActionQueue.add(ISCutLimb:new(confirm_ui_mp.patient, player, confirm_ui_mp.partNameAct)); 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
ISTimedActionQueue.add(ISOperateLimb:new(confirm_ui_mp.patient, player, item, confirm_ui_mp.partNameAct, false))
else else
getPlayer():Say("Alright..."); player:Say("I need a kit")
end
end
if confirm_ui_mp.actionAct == "Operate" then
if args.option == "yes" then
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("Don't move! Ok?");
ISTimedActionQueue.add(ISOperateLimb:new(confirm_ui_mp.patient, player, item, confirm_ui_mp.partNameAct, false));
else
player:Say("I need a kit");
end
else
getPlayer():Say("Never mind");
end end
elseif confirm_ui.actionAct == "Equip" and args.option == "yes" then
print("Equip mp comp")
elseif confirm_ui.actionAct == "Unequip" and args.option == "yes" then
print("Unequip mp comp")
end end
confirm_ui_mp:close() confirm_ui_mp:close()
confirm_ui_mp.responseReceive = false confirm_ui_mp.responseReceive = false
@@ -388,7 +384,7 @@ end
function SetupTocDescUI(surgeon, patient, toc_data, part_name) 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(getDisplayText_TOC(part_name)) desc_ui["textTitle"]:setText(TocGetDisplayText(part_name))
desc_ui.part_name = part_name desc_ui.part_name = part_name
if IsProsthesisInstalled(part_data) then if IsProsthesisInstalled(part_data) then
@@ -505,7 +501,7 @@ function SendCommandToConfirmUIMP(action, isBitten, userName, partName)
confirm_ui_mp:open() confirm_ui_mp:open()
if action == "Cut" or action == "Operate" then if action == "Cut" or action == "Operate" then
confirm_ui_mp["text4"]:setText("You're gonna " .. action .. " the " .. getDisplayText_TOC(partName) .. " of " .. userName) confirm_ui_mp["text4"]:setText("You're gonna " .. action .. " the " .. TocGetDisplayText(partName) .. " of " .. userName)
confirm_ui_mp["text2"]:setText("Are you sure?") confirm_ui_mp["text2"]:setText("Are you sure?")
confirm_ui_mp["text2"]:setColor(1, 0, 0, 0) confirm_ui_mp["text2"]:setColor(1, 0, 0, 0)
confirm_ui_mp["b1"]:setVisible(true); confirm_ui_mp["b1"]:setVisible(true);
+1 -1
View File
@@ -76,7 +76,7 @@ function TheOnlyCure.HealSpecificPart(toc_data, part_name, player)
local body_damage = player:getBodyDamage() local body_damage = player:getBodyDamage()
local body_part_type = body_damage:getBodyPart(TOC_getBodyPart(part_name)) local body_part_type = body_damage:getBodyPart(TocGetBodyPartTypeFromBodyPart(part_name))
if not body_part_type then if not body_part_type then
print("TOC ERROR : Can't update health of " .. part_name); print("TOC ERROR : Can't update health of " .. part_name);
return false return false
+2 -10
View File
@@ -3,15 +3,7 @@ if not TheOnlyCure then
end end
-- TODO this is gonna break a lot of stuff, don't do this you ass -- TODO remove this crap
-- GLOBAL STRINGS
-- TODO Unify Context Menus check with TOC Menu UI
Left = "Left" Left = "Left"
Right = "Right" Right = "Right"
@@ -132,7 +124,7 @@ function TheOnlyCure.CutLimb(part_name, surgeon_factor, bandage_table, painkille
-- TODO Check if this works in MP through MENU UI -- TODO Check if this works in MP through MENU UI
local player = getPlayer() local player = getPlayer()
local toc_data = player:getModData().TOC local toc_data = player:getModData().TOC
local body_part_type = player:getBodyDamage():getBodyPart(TheOnlyCure.GetBodyPartTypeFromBodyPart(part_name)) local body_part_type = player:getBodyDamage():getBodyPart(TocGetBodyPartTypeFromBodyPart(part_name))
local stats = player:getStats(); local stats = player:getStats();
-- Set damage, stress, and low endurance after amputation -- Set damage, stress, and low endurance after amputation
+1 -1
View File
@@ -34,7 +34,7 @@ function ISCutLimb:start()
-- TODO this doesn't work when doing it online -- TODO this doesn't work when doing it online
local body_part_type = TheOnlyCure.GetBodyPartTypeFromBodyPart(self.part_name) local body_part_type = TocGetBodyPartTypeFromBodyPart(self.part_name)
local body_damage = self.patient:getBodyDamage() local body_damage = self.patient:getBodyDamage()
local body_damage_part = body_damage:getBodyPart(body_part_type) local body_damage_part = body_damage:getBodyPart(body_part_type)
@@ -106,3 +106,5 @@ function ISUninstallProsthesis:new(character, item, bodyPart)
if o.character:isTimedActionInstant() then o.maxTime = 1; end if o.character:isTimedActionInstant() then o.maxTime = 1; end
return o; return o;
end end
+42 -30
View File
@@ -30,6 +30,40 @@ function GetAcceptingProsthesisBodyParts()
end end
local function PartNameToBodyLocation(name)
if name == "RightHand" then return "ArmRight_Prot" end
if name == "RightForearm" then return "ArmRight_Prot" end
if name == "RightArm" then return "ArmRight_Prot" end
if name == "LeftHand" then return "ArmLeft_Prot" end
if name == "LeftForearm" then return "ArmLeft_Prot" end
if name == "LeftArm" then return "ArmLeft_Prot" end
end
-- TODO find a better name, this doesnt check for amputation only for prosthetics
function FindTocItemWorn(part_name, patient)
local worn_items = patient:getWornItems()
for _, v in ipairs(worn_items) do
local item = v.getItem()
if item:getBodyLocation() == PartNameToBodyLocation(part_name) then
return item
end
end
end
-- TODO ew -- TODO ew
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"
@@ -42,18 +76,17 @@ function find_clothName_TOC(bodyPart)
end end
end end
function getDisplayText_TOC(name) function TocGetDisplayText(part_name)
if name == "RightHand" then return getText("UI_ContextMenu_RightHand") end if part_name == "RightHand" then return getText("UI_ContextMenu_RightHand") end
if name == "RightForearm" then return getText("UI_ContextMenu_RightForearm") end if part_name == "RightForearm" then return getText("UI_ContextMenu_RightForearm") end
if name == "RightArm" then return getText("UI_ContextMenu_RightArm") end if part_name == "RightArm" then return getText("UI_ContextMenu_RightArm") end
if name == "LeftHand" then return getText("UI_ContextMenu_LeftHand") end if part_name == "LeftHand" then return getText("UI_ContextMenu_LeftHand") end
if name == "LeftForearm" then return getText("UI_ContextMenu_LeftForearm") end if part_name == "LeftForearm" then return getText("UI_ContextMenu_LeftForearm") end
if name == "LeftArm" then return getText("UI_ContextMenu_LeftArm") end if part_name == "LeftArm" then return getText("UI_ContextMenu_LeftArm") end
end end
function TocGetBodyPartTypeFromBodyPart(part_name)
function TheOnlyCure.GetBodyPartTypeFromBodyPart(part_name)
if part_name == "RightHand" then return BodyPartType.Hand_R end if part_name == "RightHand" then return BodyPartType.Hand_R end
if part_name == "RightForearm" then return BodyPartType.ForeArm_R end if part_name == "RightForearm" then return BodyPartType.ForeArm_R end
if part_name == "RightArm" then return BodyPartType.UpperArm_R end if part_name == "RightArm" then return BodyPartType.UpperArm_R end
@@ -63,17 +96,6 @@ function TheOnlyCure.GetBodyPartTypeFromBodyPart(part_name)
end end
function TOC_getBodyPart(name)
--TODO Delete this
if name == "RightHand" then return BodyPartType.Hand_R end
if name == "RightForearm" then return BodyPartType.ForeArm_R end
if name == "RightArm" then return BodyPartType.UpperArm_R end
if name == "LeftHand" then return BodyPartType.Hand_L end
if name == "LeftForearm" then return BodyPartType.ForeArm_L end
if name == "LeftArm" then return BodyPartType.UpperArm_L end
end
function find_clothName2_TOC(name) function find_clothName2_TOC(name)
if name == "RightHand" then return "TOC.ArmRight_noHand" end if name == "RightHand" then return "TOC.ArmRight_noHand" end
if name == "RightForearm" then return "TOC.ArmRight_noForearm" end if name == "RightForearm" then return "TOC.ArmRight_noForearm" end
@@ -101,14 +123,4 @@ function find_protheseFact_TOC(item)
elseif string.find(itemType, "MetalHand") and string.find(itemType, "noHand") then return 1.1 elseif string.find(itemType, "MetalHand") and string.find(itemType, "noHand") then return 1.1
elseif string.find(itemType, "MetalHand") and string.find(itemType, "noForearm") then return 1.25 elseif string.find(itemType, "MetalHand") and string.find(itemType, "noForearm") then return 1.25
end end
end
function CanBeCut(partName)
return not getPlayer():getModData().TOC[partName].is_cut
end
function CanBeOperate(partName)
return getPlayer():getModData().TOC[partName].is_cut
and not getPlayer():getModData().TOC[partName].is_operated
and not getPlayer():getModData().TOC[partName].is_cicatrized
end end