Player functions#
Functions related to the player state. They are registered when the
game::Player is constructed, which essentially means that they
are available while the in-game mode is active.
General#
- place(sector, x, y, z, a, fovH, fovV)#
Changes the player position.
- Parameters:
sector (
number) – ID of the sector.x (
number) – X-coordinate of the position.y (
number) – Y-coordinate of the position.z (
number) – Z-coordinate of the position.a (
number) – Angle of the position.fovH (
number) – Horizontal field of view.fovV (
number) – Vertical field of view.
Sanity#
The current value of player sanity is always available in the sanity variable.
The sanity value is always contained between 0 (which means absolutely insane)
and 100 (meaning full psychical strength). If a change is requested which would
break those limits, the maximum or minimum value is set instead.
- sanity_set(value)#
Sets the player sanity to an absolute value.
- Parameters:
value (
number) – Target sanity value.
- sanity_mod(delta)#
Changes the player sanity by a given amount.
- Parameters:
delta (
number) – Desired change in sanity.
Inventory#
- item_add(name, description)#
Provides player an item.
- Parameters:
name (
str) – Name of the item.description (
str) – Description of the item.
- Returns:
ID of the item.
- Return type:
number
- item_check(name)#
Check player inventory for an item.
- Parameters:
name (
str) – Name of the item to check.- Returns:
Item ID when player has the item,
-1otherwise.- Return type:
number
- item_remove(id)#
Removes item from player’s inventory.
- Parameters:
id (
number) – ID of the item to remove.