Nucleus handler tools โบ Docs โบ Game.ProtoInput โบ OnInputLocked
Game.ProtoInput.OnInputLocked
Open in the workbench (search, and try it in a handler)
Game.ProtoInput.OnInputLocked: () => void
Function Nucleus calls each time input is locked (the lock key, the gamepad lock shortcut or Game.LockInputAtStart), and once after all instances are set up if input is locked by then. It sees the last player's Context.
In practice
Runs once when the player locks the input (the lock key, End by default), with no arguments, so handlers loop over PlayerList and act on each player.ProtoInputInstanceHandle. They use it to switch Proto Input on only while input is locked: ProtoInput.InstallHook, ProtoInput.EnableMessageFilter, ProtoInput.SetDrawFakeCursor(โฆ, true), ProtoInput.StartFocusMessageLoop, undone in Game.ProtoInput.OnInputUnlocked. Context in it is the last player's.
Example
Game.ProtoInput.OnInputLocked = function () {
for (var i = 0; i < PlayerList.Count; i++) {
var handle = PlayerList[i].ProtoInputInstanceHandle;
ProtoInput.InstallHook(
handle,
ProtoInput.Values.GetCursorPosHookID
);
ProtoInput.EnableMessageFilter(
handle,
ProtoInput.Values.RawInputFilterID
);
ProtoInput.SetDrawFakeCursor(handle, true);
}
};