Fixed picking up broken glass with item in off hand
This commit is contained in:
@@ -74,7 +74,7 @@ function ISBaseTimedAction:perform()
|
||||
if not dcInst:getIsAnyLimbCut() then return end
|
||||
|
||||
local amputatedLimbs = CachedDataHandler.GetAmputatedLimbs(LocalPlayerController.username)
|
||||
local xp = self.maxTime/100
|
||||
local xp = self.maxTime / 100
|
||||
for k, _ in pairs(amputatedLimbs) do
|
||||
local limbName = k
|
||||
|
||||
@@ -92,7 +92,6 @@ function ISBaseTimedAction:perform()
|
||||
if dcInst:getIsProstEquipped(limbName) then
|
||||
LocalPlayerController.playerObj:getXp():AddXP(Perks["ProstFamiliarity"], xp)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -124,7 +123,6 @@ end
|
||||
|
||||
---A recreation of the original method, but with amputations in mind
|
||||
function ISEquipWeaponAction:performWithAmputation()
|
||||
|
||||
TOC_DEBUG.print("running ISEquipWeaponAction performWithAmputation")
|
||||
local hand = nil
|
||||
local otherHand = nil
|
||||
@@ -203,12 +201,15 @@ local og_ISEquipWeaponAction_perform = ISEquipWeaponAction.perform
|
||||
function ISEquipWeaponAction:perform()
|
||||
og_ISEquipWeaponAction_perform(self)
|
||||
|
||||
-- TODO Can we do it earlier?
|
||||
|
||||
--if self.character == getPlayer() then
|
||||
local dcInst = DataController.GetInstance(self.character:getUsername())
|
||||
-- Just check it any limb has been cut. If not, we can just return from here
|
||||
if dcInst:getIsAnyLimbCut() == true then
|
||||
if dcInst:getIsAnyLimbCut() then
|
||||
self:performWithAmputation()
|
||||
end
|
||||
|
||||
--end
|
||||
end
|
||||
|
||||
function ISInventoryPaneContextMenu.doEquipOption(context, playerObj, isWeapon, items, player)
|
||||
@@ -268,6 +269,23 @@ function ISWorldObjectContextMenu.createMenu(player, worldobjects, x, y, test)
|
||||
---@type ISContextMenu
|
||||
local ogContext = og_ISWorldObjectContextMenu_createMenu(player, worldobjects, x, y, test)
|
||||
|
||||
|
||||
-- The vanilla game doesn't count an item in the off hand as "equipped" for picking up glass. Let's fix that here
|
||||
local brokenGlassOption = ogContext:getOptionFromName(getText("ContextMenu_RemoveBrokenGlass"))
|
||||
|
||||
if brokenGlassOption then
|
||||
local playerObj = getSpecificPlayer(player)
|
||||
if (CachedDataHandler.GetHandFeasibility(StaticData.SIDES_IND_STR.R) and playerObj:getPrimaryHandItem()) or
|
||||
(CachedDataHandler.GetHandFeasibility(StaticData.SIDES_IND_STR.L) and playerObj:getSecondaryHandItem())
|
||||
then
|
||||
brokenGlassOption.notAvailable = false
|
||||
brokenGlassOption.toolTip = nil -- This is active only when you can't do the action.
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
-- check if no hands, disable various interactions
|
||||
if not CachedDataHandler.GetBothHandsFeasibility() then
|
||||
TOC_DEBUG.print("NO hands :((")
|
||||
@@ -282,7 +300,6 @@ function ISWorldObjectContextMenu.createMenu(player, worldobjects, x, y, test)
|
||||
return ogContext
|
||||
end
|
||||
|
||||
|
||||
--* DISABLE WEARING CERTAIN ITEMS WHEN NO LIMB
|
||||
|
||||
local function CheckLimbFeasibility(limbName)
|
||||
|
||||
@@ -123,7 +123,8 @@ function CachedDataHandler.CalculateHandFeasibility(limbName)
|
||||
CachedDataHandler.handFeasibility[side] = not dcInst:getIsCut(limbName) or dcInst:getIsProstEquipped(limbName)
|
||||
end
|
||||
|
||||
|
||||
---@param side string Either "L" or "R"
|
||||
---@return boolean
|
||||
function CachedDataHandler.GetHandFeasibility(side)
|
||||
return CachedDataHandler.handFeasibility[side]
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user