Instance Properties
Every single instance in the game falls under a specific category of instance. The main ones you will interact with are the Player, Mouse, Items, Objects, Menu Objects, Menus, and Slots!
Each instance has a set of built-in properties that you can get/set with api_get_property() and api_set_property(). This page aims to list all the properties you may find useful.
Modding
Instance Properties
Player (ob_player)
The Player is a special instance of which there is only ever one. This is the Player instance that the player moves around, and it stores a lot of key information.
Property Key | Datatype | Description |
---|---|---|
x | integer | current player x position |
y | integer | current player y position |
spawn_x | integer | current player spawn x position (player will spawn here after drowning / going to devland / finishing the game) |
spawn_y | integer | current player y position (player will spawn here after drowning / going to devland / finishing the game) |
open | boolean | whether the player's inventory is open or closed |
hotbar | integer | current "equipped" slot index in the hotbar, starting from 0 |
dir | string | current direction the player is facing, either "left" or "right" |
walking | boolean | whether the player is currently walking / moving |
wading | boolean | whether the player is currently wading in shallow water |
sitting | boolean | whether the player is sitting on a bench |
sleeping | boolean | whether the player is sleeping (on a bench or a bed) |
soaking | boolean | whether the player is standing in shallow water |
sailing | boolean | whether the player is sailing on a boat (moving or not) |
sliding | boolean | whether the player is sliding on ice |
drowning | boolean | whether the player is "drowning" (stuck in deep water) |
name | string | the player's chosen name |
money | integer | the amount of Rubees the player has |
honeycore | integer | the amount of Honeycore the player has |
current_tile | string | the current tile OID under the player, i.e. "grass1" or "water2" etc |
buff | string | the current buff applied to the player, if any. This value will be the spice OID, i.e. "spice1". Setting this value directly will not trigger the buff notification. |
buff_time | integer | the amount of time left before the buff applied expires, if any |
boat | integer | the instance ID of the boat object if the player is sailing in a boat |
palette | table | the color palette for the player, which is a set of indices keys for hair, skin, overalls, undershirt, and hair. Changing these indices will not change the player colors. |
stats | table | the stats stored for the player (the ones shown in nan's bookcase!) |
unlocked_books | table | a boolean for each book to say whether its unlocked or not (making it show in the bottom bar) |
door_opened | boolean | whether the player has opened the Hivemother Door, basically if the player has got every bee and "finished" the game (spoilers!) |
Mouse (ob_mouse)
The Mouse is a special instance that follows the mouse position and handles interaction. From a property perspective, for all intents and purposes the Mouse is just a fancy Slot, and has a lot of the same properties as slots.
Property Key | Datatype | Description |
---|---|---|
x | integer | current mouse x position |
y | integer | current mouse y position |
tx | integer | current mouse tile x position |
ty | integer | current mouse tile y position |
item | integer | the OID of the "item" if an item is picked up |
count | integer | the number of the item picked up, if any |
current_health | decimal | the current health of the item picked up, if any |
total_health | decimal | the total health of the item picked up, if any |
stats | table | the stats table of the item picked up, if any (i.e. bee properties, frame stats etc) |
Items (ob_item)
Items are instances of items you find on the floor, or that are dropped when you pick stuff up. Items are destroyed once they are picked up by the Player. Items have pretty much the same properties as Slot instances - these properties get moved to the slot when picked up.