Fixes
This commit is contained in:
@@ -76,19 +76,15 @@ end
|
||||
|
||||
---@param context ISContextMenu
|
||||
function CutLimbHandler:addToMenu(context)
|
||||
--local types = self:getAllItemTypes(self.items.ITEMS)
|
||||
--if #types > 0 then
|
||||
local option = context:addOption(getText("ContextMenu_Amputate"), nil)
|
||||
local subMenu = context:getNew(context)
|
||||
context:addSubMenu(option, subMenu)
|
||||
for i = 1, #StaticData.LIMBS_STRINGS do
|
||||
local limbName = StaticData.LIMBS_STRINGS[i]
|
||||
|
||||
--TOC_DEBUG.print("addToMenu running")
|
||||
local limbName = BodyPartType.ToString(self.bodyPart:getType())
|
||||
--TOC_DEBUG.print(limbName)
|
||||
if StaticData.BODYPARTSTYPES_ENUM[limbName] then
|
||||
if not ModDataHandler.GetInstance():getIsCut(limbName) then
|
||||
local limbTranslatedName = getText("ContextMenu_Limb_" .. limbName)
|
||||
subMenu:addOption(limbTranslatedName, self.onMenuOptionSelected, nil)
|
||||
context:addOption(getText("ContextMenu_Amputate"), self, self.onMenuOptionSelected)
|
||||
end
|
||||
end
|
||||
--end
|
||||
end
|
||||
|
||||
function CutLimbHandler:dropItems(items)
|
||||
@@ -101,17 +97,17 @@ function CutLimbHandler:dropItems(items)
|
||||
end
|
||||
|
||||
function CutLimbHandler:isValid(itemType)
|
||||
return self:getItemOfType(self.items.ITEMS, itemType)
|
||||
return true -- TODO Workaround for now
|
||||
end
|
||||
|
||||
function CutLimbHandler:perform(previousAction, itemType)
|
||||
TOC_DEBUG.print("perform CutLimbHandler")
|
||||
local item = self:getItemOfType(self.items.ITEMS, itemType)
|
||||
previousAction = self:toPlayerInventory(item, previousAction)
|
||||
--local item = self:getItemOfType(self.items.ITEMS, itemType)
|
||||
--previousAction = self:toPlayerInventory(item, previousAction)
|
||||
|
||||
local limbName = BodyPartType.getDisplayName(self.bodyPart:getType()) -- TODO Test this
|
||||
local limbName = BodyPartType.ToString(self.bodyPart:getType())
|
||||
TOC_DEBUG.print("perform CutLimbHandler on " .. limbName)
|
||||
local action = CutLimbAction:new(self:getPatient(), self:getDoctor(), limbName)
|
||||
ISTimedActionQueue.addAfter(previousAction, action)
|
||||
ISTimedActionQueue.add(action)
|
||||
end
|
||||
|
||||
return CutLimbHandler
|
||||
|
||||
@@ -33,7 +33,7 @@ function ISHealthPanel:doBodyPartContextMenu(bodyPart, x, y)
|
||||
local playerNum = self.otherPlayer and self.otherPlayer:getPlayerNum() or self.character:getPlayerNum()
|
||||
|
||||
-- To not recreate it but reuse the one that has been created in the original method
|
||||
local context = getPlayerContextMenu(playerNum)
|
||||
local context = getPlayerContextMenu(playerNum)
|
||||
local cutLimbHandler = CutLimbHandler:new(self, bodyPart)
|
||||
cutLimbHandler:addToMenu(context)
|
||||
end
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
local PlayerHandler = require("TOC/Handlers/PlayerHandler")
|
||||
local CachedDataHandler = require("TOC/Handlers/CachedDataHandler")
|
||||
local ModDataHandler = require("TOC/Handlers/ModDataHandler")
|
||||
---------------
|
||||
|
||||
@@ -27,7 +27,7 @@ local function AddOvenContextMenu(playerNum, context, worldObjects, test)
|
||||
local pl = getSpecificPlayer(playerNum)
|
||||
|
||||
if not ModDataHandler.GetInstance():getIsAnyLimbCut() then return end
|
||||
local amputatedLimbs = PlayerHandler.GetAmputatedLimbs()
|
||||
local amputatedLimbs = CachedDataHandler.GetAmputatedLimbs(pl:getUsername())
|
||||
|
||||
local stoveObj = nil
|
||||
for _, obj in pairs(worldObjects) do
|
||||
|
||||
Reference in New Issue
Block a user