View Single Post
06/18/23, 01:15 AM   #4
IsJustaGhost
AddOn Author - Click to view addons
Join Date: May 2020
Posts: 38
I've posted the update to LibInteractionHook

I suggest registering for a specific action. Funny thing is, I can't recall what it is for a wayshrine. "Use" right?
Lua Code:
  1. local registerOnTryHandlingInteraction = LibInteractionHook.RegisterOnTryHandlingInteraction
  2. local wayshrineString = tolower(GetString(SI_DEATH_PROMPT_WAYSHRINE))
  3.  
  4. --Replace _action_ with GetString(SI_LIB_IF_GAMECAMERAACTION5) or SI_LIB_IF_GAMECAMERAACTION5 or "Use"
  5. -- All of the SI_LIB_IF_GAMECAMERAACTION can be found in the lib
  6.  
  7. registerOnTryHandlingInteraction(self.name, _action_ , function(action, interactableName, interactionBlocked, isOwned, additionalInteractInfo, context, contextLink, isCriminalInteract, currentFrameTimeSeconds)
  8.     -- There is no need to check for if interactionPossible, this will only run if it is.
  9.  
  10.     if interactableName:match(wayshrineString) then -- This is in theory
  11.         return true -- to disable it
  12.     end
  13. end)
  14.  
  15.  
  16. -- Omitting the action will register the function for any action.
  17. registerOnTryHandlingInteraction(self.name, function(action, interactableName, interactionBlocked, isOwned, additionalInteractInfo, context, contextLink, isCriminalInteract, currentFrameTimeSeconds)
  18.     -- There is no need to check for if interactionPossible, this will only run if it is.
  19.  
  20.     if interactableName:match(wayshrineString) then -- This is in theory
  21.         return true -- to disable it
  22.     end
  23. end)
Unregistering can be done using the same info used in registering.
Lua Code:
  1. local unregisterOnTryHandlingInteraction = LibInteractionHook.UnregisterOnTryHandlingInteraction
  2. unregisterOnTryHandlingInteraction(self.name, _action_ )
  3. unregisterOnTryHandlingInteraction(self.name)

Last edited by IsJustaGhost : 06/18/23 at 04:11 AM.
  Reply With Quote