fix: override for both hands interaction for b42 and cheat prevention
This commit is contained in:
@@ -36,6 +36,12 @@ end
|
||||
|
||||
|
||||
|
||||
-- We need to override when the player changes key binds manually to be sure that TOC changes are re-applied
|
||||
local og_MainOptions_apply = MainOptions.apply
|
||||
function MainOptions:apply()
|
||||
og_MainOptions_apply(self)
|
||||
CachedDataHandler.OverrideBothHandsFeasibility()
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ end
|
||||
function CachedDataHandler.CalculateCacheableValues(username)
|
||||
CachedDataHandler.CalculateHighestAmputatedLimbs(username)
|
||||
if getPlayer():getUsername() == username then
|
||||
CachedDataHandler.CalculateBothHandsFeasibility()
|
||||
CachedDataHandler.OverrideBothHandsFeasibility()
|
||||
end
|
||||
end
|
||||
|
||||
@@ -130,14 +130,13 @@ function CachedDataHandler.GetHandFeasibility(side)
|
||||
|
||||
-- FIX horrendous workaround, but with a forced init we run the caching too early and it breaks this, setting it to nil.
|
||||
if CachedDataHandler.handFeasibility[side] == nil then
|
||||
CachedDataHandler.CalculateBothHandsFeasibility()
|
||||
CachedDataHandler.OverrideBothHandsFeasibility()
|
||||
end
|
||||
|
||||
return CachedDataHandler.handFeasibility[side]
|
||||
end
|
||||
|
||||
|
||||
function CachedDataHandler.CalculateBothHandsFeasibility()
|
||||
function CachedDataHandler.OverrideBothHandsFeasibility()
|
||||
CachedDataHandler.CalculateHandFeasibility("Hand_L")
|
||||
CachedDataHandler.CalculateHandFeasibility("Hand_R")
|
||||
local interactStr = "Interact"
|
||||
@@ -151,17 +150,28 @@ function CachedDataHandler.CalculateBothHandsFeasibility()
|
||||
if not CachedDataHandler.GetBothHandsFeasibility() then
|
||||
TOC_DEBUG.print("Disabling interact key")
|
||||
TOC_DEBUG.print("Cached current key for interact: " .. tostring(CachedDataHandler.interactKey))
|
||||
getCore():addKeyBinding(interactStr, Keyboard.KEY_NONE)
|
||||
else
|
||||
TOC_DEBUG.print("Re-enabling interact key")
|
||||
TOC_DEBUG.print("Cached current key for interact: " .. tostring(CachedDataHandler.interactKey))
|
||||
|
||||
if StaticData.COMPAT_42 then
|
||||
getCore():addKeyBinding(interactStr, Keyboard.KEY_NONE, 0, false, false, false)
|
||||
else
|
||||
getCore():addKeyBinding(interactStr, Keyboard.KEY_NONE)
|
||||
|
||||
end
|
||||
else
|
||||
--TOC_DEBUG.print("Re-enabling interact key")
|
||||
--TOC_DEBUG.print("Cached current key for interact: " .. tostring(CachedDataHandler.interactKey))
|
||||
|
||||
if StaticData.COMPAT_42 then
|
||||
getCore():addKeyBinding(interactStr, CachedDataHandler.interactKey, 0, false, false, false)
|
||||
else
|
||||
getCore():addKeyBinding(interactStr, CachedDataHandler.interactKey)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function CachedDataHandler.GetBothHandsFeasibility()
|
||||
return CachedDataHandler.handFeasibility["L"] or CachedDataHandler.handFeasibility["R"]
|
||||
end
|
||||
|
||||
return CachedDataHandler
|
||||
|
||||
|
||||
@@ -86,7 +86,7 @@ function ProsthesisHandler.SearchAndSetupProsthesis(item, isEquipping)
|
||||
dcInst:apply()
|
||||
|
||||
-- Calculates hands feasibility once again
|
||||
CachedDataHandler.CalculateBothHandsFeasibility()
|
||||
CachedDataHandler.OverrideBothHandsFeasibility()
|
||||
return true
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user