@@ -383,11 +383,138 @@ function RegisterHook(UFunctionName, Callback) end
383383--- @param PostId integer
384384function UnregisterHook (UFunctionName , PreId , PostId ) end
385385
386- --- Execute code inside the game thread using ProcessEvent.
386+ --- Specifies which hook to use for game thread execution
387+ --- @enum EGameThreadMethod
388+ EGameThreadMethod = {
389+ --- Execute via the ProcessEvent hook. Called frequently (multiple times per frame).
390+ ProcessEvent = 0 ,
391+ --- Execute via the EngineTick hook. Called once per frame.
392+ EngineTick = 1 ,
393+ }
394+
395+ --- True if EngineTick hook is available for frame-based delays
396+ --- @type boolean
397+ EngineTickAvailable = false
398+
399+ --- True if ProcessEvent hook is available
400+ --- @type boolean
401+ ProcessEventAvailable = false
402+
403+ --- Execute code inside the game thread.
387404--- Will execute as soon as the game has time to execute.
388405--- @param Callback fun ()
389406function ExecuteInGameThread (Callback ) end
390407
408+ --- Execute code inside the game thread using a specific method.
409+ --- @param Callback fun ()
410+ --- @param Method EGameThreadMethod
411+ function ExecuteInGameThread (Callback , Method ) end
412+
413+ --- Execute callback after a delay in milliseconds. Returns a handle for control.
414+ --- @param DelayMs integer Delay in milliseconds
415+ --- @param Callback fun () Function to execute
416+ --- @return integer handle Handle to control the action
417+ function ExecuteInGameThreadWithDelay (DelayMs , Callback ) end
418+
419+ --- Execute callback after a delay, but only if the handle is not already active (UE Delay-style).
420+ --- If the handle is already active, does nothing and returns the same handle.
421+ --- @param Handle integer Existing handle to check /reuse
422+ --- @param DelayMs integer Delay in milliseconds
423+ --- @param Callback fun () Function to execute
424+ --- @return integer handle The provided handle
425+ function ExecuteInGameThreadWithDelay (Handle , DelayMs , Callback ) end
426+
427+ --- Execute callback after delay, resetting the timer if called again with the same handle.
428+ --- Useful for debouncing.
429+ --- @param Handle integer Handle to reset if active
430+ --- @param DelayMs integer Delay in milliseconds
431+ --- @param Callback fun () Function to execute
432+ --- @return integer handle The provided handle
433+ function RetriggerableExecuteInGameThreadWithDelay (Handle , DelayMs , Callback ) end
434+
435+ --- Execute callback repeatedly with a delay between each execution.
436+ --- Returns a handle that can be used to cancel the loop.
437+ --- @param DelayMs integer Delay in milliseconds between executions
438+ --- @param Callback fun () Function to execute repeatedly
439+ --- @return integer handle Handle to control the loop
440+ function LoopInGameThreadWithDelay (DelayMs , Callback ) end
441+
442+ --- Execute callback after a number of frames (requires EngineTick hook).
443+ --- @param Frames integer Number of frames to wait
444+ --- @param Callback fun () Function to execute
445+ --- @return integer handle Handle to control the action
446+ function ExecuteInGameThreadAfterFrames (Frames , Callback ) end
447+
448+ --- Execute callback repeatedly after a number of frames (requires EngineTick hook).
449+ --- @param Frames integer Number of frames between executions
450+ --- @param Callback fun () Function to execute repeatedly
451+ --- @return integer handle Handle to control the loop
452+ function LoopInGameThreadAfterFrames (Frames , Callback ) end
453+
454+ --- Generate a unique action handle for use with delay functions.
455+ --- @return integer handle A unique handle
456+ function MakeActionHandle () end
457+
458+ --- Cancel a pending delayed action.
459+ --- @param Handle integer Handle returned from a delay function
460+ --- @return boolean success True if the action was cancelled
461+ function CancelDelayedAction (Handle ) end
462+
463+ --- Pause a delayed action, preserving remaining time.
464+ --- @param Handle integer Handle returned from a delay function
465+ --- @return boolean success True if the action was paused
466+ function PauseDelayedAction (Handle ) end
467+
468+ --- Resume a paused delayed action.
469+ --- @param Handle integer Handle returned from a delay function
470+ --- @return boolean success True if the action was resumed
471+ function UnpauseDelayedAction (Handle ) end
472+
473+ --- Reset a delayed action's timer to its original delay. Also unpauses if paused.
474+ --- @param Handle integer Handle returned from a delay function
475+ --- @return boolean success True if the timer was reset
476+ function ResetDelayedActionTimer (Handle ) end
477+
478+ --- Set a new delay for a delayed action and restart the timer. Also unpauses if paused.
479+ --- @param Handle integer Handle returned from a delay function
480+ --- @param NewDelayMs integer New delay in milliseconds
481+ --- @return boolean success True if the timer was updated
482+ function SetDelayedActionTimer (Handle , NewDelayMs ) end
483+
484+ --- Cancel all delayed actions belonging to the current mod.
485+ --- @return integer count Number of actions that were cancelled
486+ function ClearAllDelayedActions () end
487+
488+ --- Check if a handle refers to a valid delayed action.
489+ --- @param Handle integer Handle to check
490+ --- @return boolean valid True if the handle exists
491+ function IsValidDelayedActionHandle (Handle ) end
492+
493+ --- Check if a delayed action is currently active (not paused, not cancelled).
494+ --- @param Handle integer Handle to check
495+ --- @return boolean active True if the action is active
496+ function IsDelayedActionActive (Handle ) end
497+
498+ --- Check if a delayed action is currently paused.
499+ --- @param Handle integer Handle to check
500+ --- @return boolean paused True if the action is paused
501+ function IsDelayedActionPaused (Handle ) end
502+
503+ --- Get the configured delay for a delayed action.
504+ --- @param Handle integer Handle to check
505+ --- @return integer delayMs Configured delay in milliseconds (or frames for frame-based ), -1 if invalid
506+ function GetDelayedActionRate (Handle ) end
507+
508+ --- Get the remaining time until a delayed action fires.
509+ --- @param Handle integer Handle to check
510+ --- @return integer remainingMs Remaining time in milliseconds (or frames for frame-based ), -1 if invalid
511+ function GetDelayedActionTimeRemaining (Handle ) end
512+
513+ --- Get the elapsed time since a delayed action was started/reset.
514+ --- @param Handle integer Handle to check
515+ --- @return integer elapsedMs Elapsed time in milliseconds (or frames for frame-based ), -1 if invalid
516+ function GetDelayedActionTimeElapsed (Handle ) end
517+
391518--- Returns a ThreadId object representing the id of the current thread.
392519--- @return ThreadId
393520function GetCurrentThreadId () end
0 commit comments