This commit is contained in:
ZioPao
2023-11-11 03:04:48 +01:00
parent 9459360948
commit 2cf794552f
7 changed files with 19 additions and 52 deletions

View File

@@ -6,16 +6,23 @@ local ModDataHandler = require("Handlers/TOC_ModDataHandler")
---------------------
---comment
---Check if the item name corresponds to a compatible saw
---@param itemName string
local function CheckIfSaw(itemName)
return itemName == "Saw" or itemName == "GardenSaw" or itemName == "Chainsaw"
end
---Add the action to the queue
---@param limbName string
---@param surgeon IsoPlayer
---@param patient IsoPlayer
local function PerformAction(limbName, surgeon, patient)
ISTimedActionQueue.add(CutLimbAction:new(surgeon, patient, limbName))
end
---Adds the actions to the inventory context menu
---@param surgeonNum number
---@param context ISUIElement
local function AddInventoryAmputationOptions(surgeonNum, context)
local surgeonObj = getSpecificPlayer(surgeonNum)
local option = context:addOption(getText("ContextMenu_Amputate"), nil)
@@ -30,8 +37,12 @@ local function AddInventoryAmputationOptions(surgeonNum, context)
end
end
---Handler for OnFillInventoryObjectContextMenu
---@param player number
---@param context ISUIElement
---@param items table
local function AddInventoryAmputationMenu(player, context, items)
local item = items[1]
local item = items[1] -- Selected item
if CheckIfSaw(item.name) then
AddInventoryAmputationOptions(player, context)
end

View File

@@ -37,9 +37,7 @@ end
--* Modification to handle visible amputation on the health menu *--
function ISHealthPanel.GetHighestAmputation()
-- TODO Cache this instead of doing it here!
ISHealthPanel.highestAmputations = {}
for i=1, #PlayerHandler.amputatedLimbs do
local limbName = PlayerHandler.amputatedLimbs[i]

View File

@@ -1,4 +1,4 @@
-- Had to cop and paste this stuff from the base game since this is a local only class. Kinda shit, but eh
-- Had to copy and paste this stuff from the base game since this is a local only class. Kinda shit, but eh
---@class BaseHandler : ISBaseObject
---@field panel ISUIElement