Fixed context menu in the health panel
This commit is contained in:
@@ -28,13 +28,7 @@ end
|
||||
function CutLimbHandler:addToMenu(context)
|
||||
local types = self:getAllItemTypes(self.items.ITEMS)
|
||||
if #types > 0 then
|
||||
local option = context:addOption(contextMenuCutLimb, nil)
|
||||
local subMenu = context:getNew(context)
|
||||
context:addSubMenu(option, subMenu)
|
||||
for i=1,#types do
|
||||
local item = self:getItemOfType(self.items.ITEMS, types[i])
|
||||
subMenu:addOption(item:getName(), self, self.onMenuOptionSelected, item:getFullType())
|
||||
end
|
||||
local option = context:addOption(contextMenuCutLimb, self, self.onMenuOptionSelected)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -53,4 +53,14 @@ function ISHealthPanel:dropItemsOnBodyPart(bodyPart, items)
|
||||
return
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
local og_ISHealthPanel_doBodyPartContextMenu = ISHealthPanel.doBodyPartContextMenu
|
||||
|
||||
function ISHealthPanel:doBodyPartContextMenu(bodyPart, x, y)
|
||||
og_ISHealthPanel_doBodyPartContextMenu(self, bodyPart, x, y)
|
||||
local playerNum = self.otherPlayer and self.otherPlayer:getPlayerNum() or self.character:getPlayerNum()
|
||||
local context = getPlayerContextMenu(playerNum) -- To not recreate it but reuse the one that has been created in the original method
|
||||
local cutLimbHandler = CutLimbHandler:new(self, bodyPart)
|
||||
cutLimbHandler:addToMenu(context)
|
||||
end
|
||||
Reference in New Issue
Block a user