Instance Properties: Difference between revisions

From APICO Wiki
Jump to navigation Jump to search
Content added Content deleted
No edit summary
No edit summary
Line 4: Line 4:


<div class="aw-panel--left">
<div class="aw-panel--left">
<p>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! </p>
<p>Every single instance in the game falls under a specific category of instance class. The main ones you will interact with are the Player, Mouse, Items, Objects, Trees, Flowers, Menu Objects, Menus, and Slots! </p>
<p>Each instance has a set of built-in properties that you can get/set with <span class="aw-inline--code">[https://wiki.apico.buzz/wiki/Modding_API#api_get_property() api_get_property()]</span> and <span class="aw-inline--code">[https://wiki.apico.buzz/wiki/Modding_API#api_set_property() api_set_property()]</span>. This page aims to list all the properties you may find useful.</p>
<p>Each instance has a set of built-in properties that you can get/set with <span class="aw-inline--code">[https://wiki.apico.buzz/wiki/Modding_API#api_get_property() api_get_property()]</span> and <span class="aw-inline--code">[https://wiki.apico.buzz/wiki/Modding_API#api_set_property() api_set_property()]</span>. This page aims to list all the properties you may find useful.</p>
</div>
</div>
Line 78: Line 78:


<h2>Mouse (ob_mouse)</h2>
<h2>Mouse (ob_mouse)</h2>
<p>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.</p>
<p>The Mouse is a special instance that follows the mouse position and handles interaction. For all intents and purposes the Mouse is just a fancy Slot, and has a lot of the same properties as slots.</p>
{| class="wikitable
{| class="wikitable
! Property Key !! Datatype !! Description
! Property Key !! Datatype !! Description
Line 101: Line 101:
|}
|}


<br/>


<h2>Items (ob_item)</h2>
<h2>Items (ob_item)</h2>
<p>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.</p>
<p>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.</p>
{| class="wikitable
! Property Key !! Datatype !! Description
|-
| x || {{D|i=integer}} || current item x position
|-
| y || {{D|i=integer}} || current item y position
|-
| item || {{D|i=integer}} || the [[OID Reference|OID]] of the item
|-
| count || {{D|i=integer}} || the number of the item, if any
|-
| current_health || {{D|i=decimal}} || the current health of the item, if any
|-
| total_health || {{D|i=decimal}} || the total health of the item, if any
|-
| stats || {{D|i=table}} || the <span class="aw-inline--code">[https://wiki.apico.buzz/wiki/Modding_API#stats stats]</span> table of the item, if any (i.e. bee properties, frame stats etc)
|}


<br/>


<h2>Objects (ob_generic)</h2>
<p>Objects are any generic object that doesn't have a menu, i.e. shrubs, rocks, boats, benches etc. Trees and Flowers are not part of this instance class because they have other special properties, listed below.</p>
{| class="wikitable
! Property Key !! Datatype !! Description
|-
| x || {{D|i=integer}} || current object x position
|-
| y || {{D|i=integer}} || current object y position
|-
| oid || {{D|i=string}} || the [[OID Reference|OID]] of the object
|-
| current_health || {{D|i=decimal}} || the current health of the object, if any
|-
| total_health || {{D|i=decimal}} || the total health of the object, if any
|-
| biome || {{D|i=string}} || current biome the object is in, values are "forest", "swamp", "snow", and "hallow"
|-
| paint || {{D|i=integer}} || index of any paint used on this object, if any
|-
| script_draw || {{D|i=string}} || mod draw script if this is a custom modded object (if this is a standard object, changing this value does nothing)
|}

<br/>

<h2>Trees (ob_tree)</h2>
<p>Trees are like objects, but separated out for efficiency in the game. They pretty much have the same properties as objects.</p>
{| class="wikitable
! Property Key !! Datatype !! Description
|-
| x || {{D|i=integer}} || current tree x position
|-
| y || {{D|i=integer}} || current tree y position
|-
| oid || {{D|i=string}} || the [[OID Reference|OID]] of the tree (always "tree" lol)
|-
| current_health || {{D|i=decimal}} || the current health of the tree
|-
| total_health || {{D|i=decimal}} || the total health of the tree
|-
| biome || {{D|i=string}} || current biome the tree is in, values are "forest", "swamp", "snow", and "hallow". Trees in the "hallow" biome cannot be cut down without Grandpa's Axe
|-
| paint || {{D|i=integer}} || index of any paint used on this tree, if any. This can't be set on trees without modding
|-
| variant || {{D|i=string}} || the variant index for the tree. All trees have 8 variants, picked randomly when the tree is created
|}


<br/>

<h2>Flowers (ob_flower)</h2>
<p>Flowers are also like objects, but again separated out for efficiency in the game. They pretty much have the same properties as objects.</p>
{| class="wikitable
! Property Key !! Datatype !! Description
|-
| x || {{D|i=integer}} || current flower x position
|-
| y || {{D|i=integer}} || current flower y position
|-
| oid || {{D|i=string}} || the [[OID Reference|OID]] of the flower
|-
| biome || {{D|i=string}} || current biome the flower is in, values are "forest", "swamp", "snow", and "hallow"
|-
| paint || {{D|i=integer}} || index of any paint used on this flower, if any. This can't be set on flower without modding
|-
| variant || {{D|i=string}} || the variant index for the flower. All flowers have 6 variants, picked randomly when the flower is created
|-
| flowering || {{D|i=boolean}} || whether this flower is "flowering" which causes the bobbing movement when bees visit that specific flower
|-
| potted || {{D|i=boolean}} || whether this is a potted flower. When you put a flower in a pot it actually creates a flower behind the pot that is destroyed when the flower is either removed from the pot or the pot is picked up
|-
| pot || {{D|i=integer}} || the pot instance the flower is current "in", if any
|}
</div>
</div>



Revision as of 14:06, 6 November 2021

Every single instance in the game falls under a specific category of instance class. The main ones you will interact with are the Player, Mouse, Items, Objects, Trees, Flowers, 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. 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.

Property Key Datatype Description
x integer current item x position
y integer current item y position
item integer the OID of the item
count integer the number of the item, if any
current_health decimal the current health of the item, if any
total_health decimal the total health of the item, if any
stats table the stats table of the item, if any (i.e. bee properties, frame stats etc)



Objects (ob_generic)

Objects are any generic object that doesn't have a menu, i.e. shrubs, rocks, boats, benches etc. Trees and Flowers are not part of this instance class because they have other special properties, listed below.

Property Key Datatype Description
x integer current object x position
y integer current object y position
oid string the OID of the object
current_health decimal the current health of the object, if any
total_health decimal the total health of the object, if any
biome string current biome the object is in, values are "forest", "swamp", "snow", and "hallow"
paint integer index of any paint used on this object, if any
script_draw string mod draw script if this is a custom modded object (if this is a standard object, changing this value does nothing)


Trees (ob_tree)

Trees are like objects, but separated out for efficiency in the game. They pretty much have the same properties as objects.

Property Key Datatype Description
x integer current tree x position
y integer current tree y position
oid string the OID of the tree (always "tree" lol)
current_health decimal the current health of the tree
total_health decimal the total health of the tree
biome string current biome the tree is in, values are "forest", "swamp", "snow", and "hallow". Trees in the "hallow" biome cannot be cut down without Grandpa's Axe
paint integer index of any paint used on this tree, if any. This can't be set on trees without modding
variant string the variant index for the tree. All trees have 8 variants, picked randomly when the tree is created



Flowers (ob_flower)

Flowers are also like objects, but again separated out for efficiency in the game. They pretty much have the same properties as objects.

Property Key Datatype Description
x integer current flower x position
y integer current flower y position
oid string the OID of the flower
biome string current biome the flower is in, values are "forest", "swamp", "snow", and "hallow"
paint integer index of any paint used on this flower, if any. This can't be set on flower without modding
variant string the variant index for the flower. All flowers have 6 variants, picked randomly when the flower is created
flowering boolean whether this flower is "flowering" which causes the bobbing movement when bees visit that specific flower
potted boolean whether this is a potted flower. When you put a flower in a pot it actually creates a flower behind the pot that is destroyed when the flower is either removed from the pot or the pot is picked up
pot integer the pot instance the flower is current "in", if any