Download
(283 Kb)
Download
Updated: 06/12/24 05:03 PM
Compatibility:
Gold Road (10.0.0)
Scions of Ithelia (9.3.0)
Endless Archive (9.2.5)
base-game patch (9.1.5)
Necrom (9.0.0)
Scribes of Fate (8.3.5)
Updated:06/12/24 05:03 PM
Created:05/29/23 11:55 PM
Monthly downloads:2,260
Total downloads:21,470
Favorites:5
MD5:
10.0.0
LibInteractionHook  Popular! (More than 5000 hits)
Version: 3.2
by: IsJustaGhost [More]
Rebranded and change how to register as well as some funcitonality

This is a library meant for disabling target interactions by filters.


Filters are registered by add-on per action.
Or by addon for any action, by ommiting the action name while registering.

Lua Code:
  1. local registerOnTryHandlingInteraction = LibInteractionHook.RegisterOnTryHandlingInteraction
  2.  
  3. local function tryHandlingInteractionCallback(action, interactableName, currentFrameTimeSeconds)
  4.     if isActionDisabled(action, interactableName, currentFrameTimeSeconds) then
  5.         -- Disabled
  6.         return true
  7.     end
  8.     return false
  9. end
  10.  
  11. -- Register for specific actions
  12. registerOnTryHandlingInteraction("Addon_Name", actionName, tryHandlingInteractionCallback)
  13.  
  14. -- Register for any action by ommiting actionName
  15. registerOnTryHandlingInteraction("Addon_Name",  tryHandlingInteractionCallback)
local action, interactableName = GetGameCameraInteractableActionInfo()
The function, isActionDisabled, is the filter used in IsJusta Disable Actions While Moving.

Filters may also be unregistered.
Lua Code:
  1. local unregisterOnTryHandlingInteraction = LibInteractionHook.UnregisterOnTryHandlingInteraction
  2.     unregisterOnTryHandlingInteraction("Addon_Name", actionName)
  3.     unregisterOnTryHandlingInteraction("Addon_Name")

Can also be used to monitor Reticle target for updates.
Lua Code:
  1. local function tryHandlingInteractionCallback(action, interactableName, currentFrameTimeSeconds)
  2.     if currentFrameTimeSeconds > lastTime and tableOfNames[interactableName] then
  3.         lastTime = currentFrameTimeSeconds + 30
  4.         -- do the things
  5.     end
  6.    
  7. end

To hide an interaction
Lua Code:
  1. local hideInteraction = LibInteractionHook.HideInteraction
  2.  
  3. local function tryHandlingInteractionCallback(action, interactableName, currentFrameTimeSeconds)
  4.     if isActionDisabled(action, interactableName, currentFrameTimeSeconds) then
  5.         -- Disabled
  6.         hideInteraction()
  7.         return true
  8.     end
  9.     return false
  10. end
- - - 3.2
○ Updated P2P updating
○ fixed interaction getting stuck disabled when non-interaction prompt is visible when interaction was previously disabled. (augur)

- - - 3.1
○ did some cleaning up
○ changed SetAdditionalInfoColor and added assert
○ added assert to SetInteractKeybindButtonColor
○ added lib.HideNonInteractable()
○ added debug to getCurrentLang

- - - 3
○ rewrote much of the library
○ now supports "en", "de", "fr", "ru", "es", "zh"
○ passed params are now (action, interactableName, interactionBlocked, isOwned, additionalInteractInfo, context, contextLink, isCriminalInteract, currentFrameTimeSeconds)
-- this is done so addons do not have to run GetGameCameraInteractableActionInfo to get the information
○ moved hook to UpdateInteractText so allow hiding the interaction through a function
-- otherwise, it was not possible to effectively hide the interaction through the lib

- - - 2.1
○ fixed missed function name change.

- - - 2
○ I ended up rewriting it in order for it to be more viable to be used for any type of filtering
-- It now is good for getting the basic information from reticle interaction as well as setting it disabled by filters
○ action can now be omitted to include all actions

- - - 1.2
○ fixed not disabling interactions in keyboard mode
Optional Files (0)


Archived Files (5)
File Name
Version
Size
Uploader
Date
3
11kB
IsJustaGhost
06/18/23 12:48 AM
2.1
2kB
IsJustaGhost
06/11/23 09:05 PM
1.2
2kB
IsJustaGhost
06/06/23 01:11 AM
1.1
2kB
IsJustaGhost
06/05/23 12:18 PM
1
2kB
IsJustaGhost
05/29/23 11:55 PM


Post A Reply Comment Options
Unread 06/04/23, 08:47 PM  
NeuroticPixels
Addon Addict
 
NeuroticPixels's Avatar
Premium Member

Forum posts: 211
File comments: 879
Uploads: 0
With this installed, I get this error:
Code:
/EsoUI/Libraries/Utility/ZO_Hook.lua:35: attempt to index a nil value
stack traceback:
/EsoUI/Libraries/Utility/ZO_Hook.lua:35: in function 'ZO_PostHook'
|caaaaaa<Locals> existingFunctionName = "StartInteraction", hookFunction = user:/AddOns/LibInteractionFilters/LibInteractionFilters.lua:19 </Locals>|r
user:/AddOns/LibInteractionFilters/LibInteractionFilters.lua:19: in function '(main chunk)'
|caaaaaa<Locals> LIB_IDENTIFIER = "LibInteractionFilters", LIB_VERSION = 1, lib = [table:1]{version = 1, name = "LibInteractionFilters"}, lib_reticle = [table:2]{} </Locals>|r
Just thought you'd like to know.
Report comment to moderator  
Reply With Quote
Post A Reply



Category Jump: