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)
|
function CachedDataHandler.CalculateCacheableValues(username)
|
||||||
CachedDataHandler.CalculateHighestAmputatedLimbs(username)
|
CachedDataHandler.CalculateHighestAmputatedLimbs(username)
|
||||||
if getPlayer():getUsername() == username then
|
if getPlayer():getUsername() == username then
|
||||||
CachedDataHandler.CalculateBothHandsFeasibility()
|
CachedDataHandler.OverrideBothHandsFeasibility()
|
||||||
end
|
end
|
||||||
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.
|
-- 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
|
if CachedDataHandler.handFeasibility[side] == nil then
|
||||||
CachedDataHandler.CalculateBothHandsFeasibility()
|
CachedDataHandler.OverrideBothHandsFeasibility()
|
||||||
end
|
end
|
||||||
|
|
||||||
return CachedDataHandler.handFeasibility[side]
|
return CachedDataHandler.handFeasibility[side]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function CachedDataHandler.OverrideBothHandsFeasibility()
|
||||||
function CachedDataHandler.CalculateBothHandsFeasibility()
|
|
||||||
CachedDataHandler.CalculateHandFeasibility("Hand_L")
|
CachedDataHandler.CalculateHandFeasibility("Hand_L")
|
||||||
CachedDataHandler.CalculateHandFeasibility("Hand_R")
|
CachedDataHandler.CalculateHandFeasibility("Hand_R")
|
||||||
local interactStr = "Interact"
|
local interactStr = "Interact"
|
||||||
@@ -151,12 +150,22 @@ function CachedDataHandler.CalculateBothHandsFeasibility()
|
|||||||
if not CachedDataHandler.GetBothHandsFeasibility() then
|
if not CachedDataHandler.GetBothHandsFeasibility() then
|
||||||
TOC_DEBUG.print("Disabling interact key")
|
TOC_DEBUG.print("Disabling interact key")
|
||||||
TOC_DEBUG.print("Cached current key for interact: " .. tostring(CachedDataHandler.interactKey))
|
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))
|
|
||||||
|
|
||||||
getCore():addKeyBinding(interactStr, 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
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -165,3 +174,4 @@ function CachedDataHandler.GetBothHandsFeasibility()
|
|||||||
end
|
end
|
||||||
|
|
||||||
return CachedDataHandler
|
return CachedDataHandler
|
||||||
|
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ function ProsthesisHandler.SearchAndSetupProsthesis(item, isEquipping)
|
|||||||
dcInst:apply()
|
dcInst:apply()
|
||||||
|
|
||||||
-- Calculates hands feasibility once again
|
-- Calculates hands feasibility once again
|
||||||
CachedDataHandler.CalculateBothHandsFeasibility()
|
CachedDataHandler.OverrideBothHandsFeasibility()
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user