Added some descriptions to the oven operation

This commit is contained in:
ZioPao
2023-11-11 04:15:25 +01:00
parent e8269899b0
commit 78942d2e78
4 changed files with 37 additions and 12 deletions

View File

@@ -22,7 +22,7 @@ end
---Adds the actions to the inventory context menu ---Adds the actions to the inventory context menu
---@param surgeonNum number ---@param surgeonNum number
---@param context ISUIElement ---@param context ISContextMenu
local function AddInventoryAmputationOptions(surgeonNum, context) local function AddInventoryAmputationOptions(surgeonNum, context)
local surgeonObj = getSpecificPlayer(surgeonNum) local surgeonObj = getSpecificPlayer(surgeonNum)
local option = context:addOption(getText("ContextMenu_Amputate"), nil) local option = context:addOption(getText("ContextMenu_Amputate"), nil)

View File

@@ -20,33 +20,54 @@ local function Cauterize(limbName)
end end
---comment
---@param playerNum any
---@param context ISContextMenu
---@param worldObjects any
---@param test any
local function AddOvenContextMenu(playerNum, context, worldObjects, test) local function AddOvenContextMenu(playerNum, context, worldObjects, test)
local pl = getSpecificPlayer(playerNum) local pl = getSpecificPlayer(playerNum)
if not ModDataHandler.GetInstance():getIsAnyLimbCut() then return end if not ModDataHandler.GetInstance():getIsAnyLimbCut() then return end
local amputatedLimbs = PlayerHandler.GetAmputatedLimbs() local amputatedLimbs = PlayerHandler.GetAmputatedLimbs()
local foundStove = false local stoveObj = nil
for _, obj in pairs(worldObjects) do for _, obj in pairs(worldObjects) do
if instanceof(obj, "IsoStove") and obj:getCurrentTemperature() > 250 then if instanceof(obj, "IsoStove") then
foundStove = true stoveObj = obj
break break
end end
end end
if stoveObj == nil then return end
if foundStove == false then return end
local option = context:addOption(getText("ContextMenu_Cauterize"), nil)
--if pl:HasTrait("Brave") or pl:getPerkLevel(Perks.Strength) > 5 then
local isTempLow = stoveObj:getCurrentTemperature() < 250
local tempTooltip = ISToolTip:new()
tempTooltip:initialise()
tempTooltip:setName("ContextMenu_Cauterize_TempTooLow_tooltip")
tempTooltip.description = getText("Tooltip_Surgery_TempTooLow")
tempTooltip:setVisible(false)
local optionMain = context:addOption(getText("ContextMenu_Cauterize"), nil)
local subMenu = context:getNew(context) local subMenu = context:getNew(context)
context:addSubMenu(option, subMenu) --subMenu.toolTip = tempTooltip
-- if isTempLow then
-- print("TOC: show tooltip")
-- subMenu:showTooltip(subMenu) -- Thank you TIS for this awful overriding you did
-- end
if pl:HasTrait("Brave") or pl:getPerkLevel(Perks.Strength) > 5 then context:addSubMenu(optionMain, subMenu)
for i=1, #amputatedLimbs do for i=1, #amputatedLimbs do
local limbName = amputatedLimbs[i] local limbName = amputatedLimbs[i]
subMenu:addOption(getText("ContextMenu_Limb_" .. limbName), limbName, Cauterize) local option = subMenu:addOption(getText("ContextMenu_Limb_" .. limbName), limbName, Cauterize)
option.notAvailable = isTempLow
if isTempLow then
option.toolTip = tempTooltip
end end
end end
--end
end end

View File

@@ -2,6 +2,7 @@ ContextMenu_EN = {
ContextMenu_Amputate = "Amputate", ContextMenu_Amputate = "Amputate",
ContextMenu_Cauterize = "Cauterize", ContextMenu_Cauterize = "Cauterize",
ContextMenu_Cauterize_TempTooLow_tooltip = "Temperature too low",
ContextMenu_Limb_Hand_L = "Left Hand", ContextMenu_Limb_Hand_L = "Left Hand",
ContextMenu_Limb_ForeArm_L = "Left forearm", ContextMenu_Limb_ForeArm_L = "Left forearm",

View File

@@ -0,0 +1,3 @@
Tooltip_EN = {
Tooltip_Surgery_TempTooLow = "Turn on the oven and wait for it to heat up before cauterizing your wound.",
}