Game
constGame:object
Defined in: client/api.d.ts:7
Client-side game utilities available to sandboxed client resources.
Type Declaration
Section titled “Type Declaration”actionScreenState()
Section titled “actionScreenState()”actionScreenState():
object
Diagnostic snapshot for the action screen hold: holders names the resources keeping it shut, and locked is whether the player’s NoEditActionBar game-logic flag, which the hold is applied through, is currently set.
Returns
Section titled “Returns”object
enabled
Section titled “enabled”enabled:
boolean
holders
Section titled “holders”holders:
string[]
locked
Section titled “locked”locked:
boolean
areControlsLocked()
Section titled “areControlsLocked()”areControlsLocked():
boolean
True while anything holds a control lock. Locks are dropped on disconnect, so a lock still held at resource start belongs to another owner — never drain one you did not take.
Returns
Section titled “Returns”boolean
isActionScreenEnabled()
Section titled “isActionScreenEnabled()”isActionScreenEnabled():
boolean
False while any resource holds the game’s action screen shut.
Returns
Section titled “Returns”boolean
isMenuPageEnabled()
Section titled “isMenuPageEnabled()”isMenuPageEnabled(
page):boolean
False while any resource holds that Field Guide page shut.
Parameters
Section titled “Parameters”"map" | "gear" | "inventory" | "talents" | "quests" | "mail" | "collections" | "challenges" | "settings"
A Field Guide page.
Returns
Section titled “Returns”boolean
isPauseMenuEnabled()
Section titled “isPauseMenuEnabled()”isPauseMenuEnabled():
boolean
False while any resource holds the game’s Field Guide shut.
Returns
Section titled “Returns”boolean
isToolWheelEnabled()
Section titled “isToolWheelEnabled()”isToolWheelEnabled():
boolean
False while any resource holds the game’s tool wheel shut.
Returns
Section titled “Returns”boolean
lockControls()
Section titled “lockControls()”lockControls(
enable):void
Shows the cursor and locks game controls so a focused web view can be clicked. Refcounted per resource: pair each lockControls(true) with exactly one lockControls(false). Stopping a resource releases its holds.
Parameters
Section titled “Parameters”enable
Section titled “enable”boolean
true shows the cursor and locks controls; false restores gameplay input.
Returns
Section titled “Returns”void
menuPageState()
Section titled “menuPageState()”menuPageState(
page):object
Diagnostic snapshot for one page’s hold: holders names the resources keeping it shut, and locked is whether the game’s own hidden-tab set currently holds the page. The game also hides a tab whose story unlock has not happened yet, so locked can be true with nobody holding it.
Parameters
Section titled “Parameters”"map" | "gear" | "inventory" | "talents" | "quests" | "mail" | "collections" | "challenges" | "settings"
A Field Guide page.
Returns
Section titled “Returns”object
enabled
Section titled “enabled”enabled:
boolean
holders
Section titled “holders”holders:
string[]
locked
Section titled “locked”locked:
boolean
notify()
Section titled “notify()”notify(
text):void
Shows a line in the local chat UI.
Parameters
Section titled “Parameters”string
Message shown in the local chat UI.
Returns
Section titled “Returns”void
pauseMenuState()
Section titled “pauseMenuState()”pauseMenuState():
object
Diagnostic snapshot: enabled mirrors isPauseMenuEnabled(), holders names the resources keeping the Field Guide shut, and locked is whether the game’s UI manager currently carries the temp pause lock the hold is applied through (the game raises it itself during cut cameras).
Returns
Section titled “Returns”object
enabled
Section titled “enabled”enabled:
boolean
holders
Section titled “holders”holders:
string[]
locked
Section titled “locked”locked:
boolean
setActionScreenEnabled()
Section titled “setActionScreenEnabled()”setActionScreenEnabled(
enabled):void
Keeps the game’s action screen (the spell-set editor behind T / d-pad right) from opening, so a resource can own spell loadouts or put its own screen on that key. Casting, the spell diamond and the tool wheel are untouched, and an action screen already open stays until the player closes it. Same contract as setPauseMenuEnabled: one idempotent hold per resource, shut while any resource holds, dropped when the resource stops or reloads and on disconnect.
Parameters
Section titled “Parameters”enabled
Section titled “enabled”boolean
false keeps the game’s action screen from opening; true gives this resource’s hold back.
Returns
Section titled “Returns”void
setKeySwallowed()
Section titled “setKeySwallowed()”setKeySwallowed(
key,swallowed):void
Takes a key the game uses away from it, so a resource can bind it with Key.bind without the game reacting too: the game never sees its presses, while Key.bind handlers and the mod’s own UI still do. The mouse wheel can’t be swallowed. One hold per resource and key, idempotent; the key stays swallowed while any resource holds it. The hold is dropped when the resource stops or reloads and on disconnect, so nothing has to be paired.
Parameters
Section titled “Parameters”string
A key name as Key.bind takes it: “h”, “mouse2”, “f5”.
swallowed
Section titled “swallowed”boolean
true takes the key from the game; false gives this resource’s hold back.
Returns
Section titled “Returns”void
setMenuPageEnabled()
Section titled “setMenuPageEnabled()”setMenuPageEnabled(
page,enabled):void
Keeps one page of the game’s Field Guide out of reach while the rest of it, the map included, keeps working: its tab is greyed out and skipped when paging, its hotkey does nothing, and its entry on the Field Guide’s first page does nothing. The page stays out through save loads and story unlocks. A page already open stays until the player leaves it. Same contract as setPauseMenuEnabled, per page: one idempotent hold per resource, shut while any resource holds, dropped when the resource stops or reloads and on disconnect. Throws on an unknown page name.
Parameters
Section titled “Parameters”"map" | "gear" | "inventory" | "talents" | "quests" | "mail" | "collections" | "challenges" | "settings"
A Field Guide page.
enabled
Section titled “enabled”boolean
false keeps the page out of the Field Guide; true gives this resource’s hold back.
Returns
Section titled “Returns”void
setPauseMenuEnabled()
Section titled “setPauseMenuEnabled()”setPauseMenuEnabled(
enabled):void
Keeps the game’s own Field Guide (the pause menu) from opening: ESC, the gamepad menu button and every page hotkey (map, inventory, character, talents, settings…) do nothing while it is held, so a resource can put its own menus behind those keys. The tool wheel, action screen and owl mail are untouched, and a Field Guide already open stays until the player closes it. One hold per resource, idempotent; the menu stays shut while any resource holds. The hold is dropped when the resource stops or reloads and on disconnect, so nothing has to be paired.
Parameters
Section titled “Parameters”enabled
Section titled “enabled”boolean
false keeps the game’s Field Guide from opening; true gives this resource’s hold back.
Returns
Section titled “Returns”void
setToolWheelEnabled()
Section titled “setToolWheelEnabled()”setToolWheelEnabled(
enabled):void
Keeps the game’s tool wheel (Tab / gamepad LB, the consumable and tool selector) from opening, so a resource that owns items or brooms can put its own wheel on that key. Also collapses the stock quick-item HUD slot while held, since it would otherwise sit there drawing an unusable diamond, and restores it on release. Quick item use, casting and the spell diamond are untouched, and a wheel already open stays until the player closes it. Same contract as setPauseMenuEnabled: one idempotent hold per resource, shut while any resource holds, dropped when the resource stops or reloads and on disconnect.
Parameters
Section titled “Parameters”enabled
Section titled “enabled”boolean
false keeps the game’s tool wheel from opening; true gives this resource’s hold back.
Returns
Section titled “Returns”void
swallowedKeys()
Section titled “swallowedKeys()”swallowedKeys():
object[]
Every key setKeySwallowed holds now, and the resources holding it.
Returns
Section titled “Returns”object[]
toolWheelState()
Section titled “toolWheelState()”toolWheelState():
object
Diagnostic snapshot for the tool wheel hold: holders names the resources keeping it shut, and locked is whether the player’s TutorialMechanics ItemMenu bit, which the hold is applied through, is currently cleared.
Returns
Section titled “Returns”object
enabled
Section titled “enabled”enabled:
boolean
holders
Section titled “holders”holders:
string[]
locked
Section titled “locked”locked:
boolean