Skip to content

Add haptic functions for Lua scripting

Lactozilla requested to merge Lactozilla/SRB2:gamepad-refactor-lua-rumble into next

Merge !1870 (merged) first.

Example script: rumble2.lua

Lua documentation

Functions added:

Function Parameters Description Returns
P_DoRumble player_t player, fixed_t large_motor_frequency, [fixed_t small_motor_frequency, [tic_t duration]] Changes the frequency of the player's gamepad's motors. If the small motor's frequency is nil, it'll be set to the large motor's frequency. If duration is nil or 0, the motors rotate forever, until they're stopped or their frequency changes. This does nothing and always returns false if the specified player isn't "local" to the system running the game. boolean
P_PauseRumble player_t player Pauses the current haptic effect on the player's gamepad. This does nothing if the specified player isn't "local" to the system running the game.
P_UnpauseRumble player_t player Unpauses the current haptic effect on the player's gamepad. This does nothing if the specified player isn't "local" to the system running the game.
P_IsRumbleEnabled player_t player Returns true if the player's gamepad supports haptic feedback, and has rumble enabled (console variables padrumble or padrumble2.) This always returns false if the specified player isn't "local" to the system running the game.
P_IsRumblePaused player_t player This will return true if the current haptic effect on the player's gamepad is paused, and false if it isn't. This always returns false if the specified player isn't "local" to the system running the game. boolean
P_StopRumble player_t player Stops the motors on the player's gamepad from rotating. This does nothing if the specified player isn't "local" to the system running the game.
Edited by Lactozilla

Merge request reports