Skip to content

Commit 5e5e597

Browse files
authored
Update input.lua (#2235)
1 parent 031b4b9 commit 5e5e597

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

lua/starfall/libs_sh/input.lua

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,23 @@ function input_library.selectWeapon(weapon)
358358
input.SelectWeapon( ent )
359359
end
360360

361+
--- Sets the position of your cursor. Your cursor must be enabled.
362+
-- @client
363+
-- @param number X
364+
-- @param number Y
365+
function input_library.setCursorPos(x, y)
366+
checkpermission(instance, nil, "input.emulate")
367+
368+
if not vgui.CursorVisible() then
369+
SF.Throw("Your cursor is not visible", 2)
370+
end
371+
372+
checkluatype(x, TYPE_NUMBER)
373+
checkluatype(y, TYPE_NUMBER)
374+
375+
input.SetCursorPos(x, y)
376+
end
377+
361378
--- Locks game controls for typing purposes. Alt will unlock the controls. Has a 10 second cooldown.
362379
-- @client
363380
-- @param boolean enabled Whether to lock or unlock the controls

0 commit comments

Comments
 (0)