Editing Mod Server API
From Eco - English Wiki
Your changes will be displayed to readers once an authorized user accepts them. (help)
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 1: | Line 1: | ||
== Introduction == | == Introduction == | ||
This page provides some tips for how to interact with the Server API when you create mod that needs to interact with the game's runtime state or behaviour. A full comprehensive list of the entire API can be found at https://docs.play.eco/api/server/index.html. | This page provides some tips for how to interact with the Server API when you create mod that needs to interact with the game's runtime state or behaviour. A full comprehensive list of the entire API can be found at https://docs.play.eco/api/server/index.html. | ||
== Player == | == Player == | ||
The <code>User</code> and <code>Player</code> class contain references to information about a specific player. The <code>User</code> class contains references to the player's owned objects, inventories, their stats, professions, etc. While the <code>Player</code> class has references to their location, technical server properties, player name, etc. If you have a <code>User</code> and need to get a <code>Player</code> instance it's as simple as: | The <code>User</code> and <code>Player</code> class contain references to information about a specific player. The <code>User</code> class contains references to the player's owned objects, inventories, their stats, professions, etc. While the <code>Player</code> class has references to their location, technical server properties, player name, etc. If you have a <code>User</code> and need to get a <code>Player</code> instance it's as simple as: | ||
Line 11: | Line 9: | ||
All of a player's inventory is referenced by the <code>UserInventory</code> class which is accessed by the Inventory property: | All of a player's inventory is referenced by the <code>UserInventory</code> class which is accessed by the Inventory property: | ||
user.Inventory | user.Inventory | ||
The player's backpack, | The player's backpack, action bar, carried items and clothing can be accessed through this object like this: | ||
user.Inventory.Backpack | |||
user.Inventory.ActionBar | user.Inventory.ActionBar | ||
user.Inventory.Carried | user.Inventory.Carried | ||
user.Inventory.Clothing | user.Inventory.Clothing | ||
The items in these inventories can be accessed in a couple different ways as discussed here (TBD link to generic inventories section) | |||
The items in these inventories can be accessed in a couple different ways as discussed | |||
<code>user.Inventory. | <code>user.Inventory.Backpack</code> is an Inventory instance that lists all the stacks of items inside the player's backpack but not their clothes or items on their hotbar. | ||
<code>user.Inventory. | <code>user.Inventory.ActionBar</code>is an Inventory instance that lists all the standard buttons used to open the backpack, economy viewer, etc. located next to the minimap. | ||
What the action bar looks like in-game: | |||
[[File:ActionBarScreenshot.png|left|thumb|user.Inventory.ActionBar]] | |||
<code>user.Inventory.Carried</code> is an Inventory instance that represents the stack of items the player can carry around such as dirt, stone, or logs. | |||