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 17: | Line 17: | ||
user.Inventory.Clothing | user.Inventory.Clothing | ||
user.Inventory.Toolbar | user.Inventory.Toolbar | ||
The items in these inventories can be accessed in a couple different ways as discussed in the | The items in these inventories can be accessed in a couple different ways as discussed in the Inventory Section. Each of these is an instance of [https://docs.play.eco/api/server/eco.gameplay/Eco.Gameplay.Items.Inventory.html Inventory]. | ||
[[File:ActionBarScreenshot.png|thumb|user.Inventory.ActionBar]] | |||
<code>user.Inventory.ActionBar</code> represents all the standard buttons used to open the backpack, economy viewer, etc. located next to the minimap. | <code>user.Inventory.ActionBar</code> represents all the standard buttons used to open the backpack, economy viewer, etc. located next to the minimap. | ||
Line 26: | Line 26: | ||
<code>user.Inventory.Clothing</code> represents the items of clothing the player is wearing. | <code>user.Inventory.Clothing</code> represents the items of clothing the player is wearing. | ||
[[File:ToolbarScreenshot.png|thumb|user.Inventory.Toolbar]] | |||
<code>user.Inventory.Toolbar</code> represents the items on the player's toolbar where they put tools and other items they want quick access to. | <code>user.Inventory.Toolbar</code> represents the items on the player's toolbar where they put tools and other items they want quick access to. | ||
== Inventory == | == Inventory == | ||
An [https://docs.play.eco/api/server/eco.gameplay/Eco.Gameplay.Items.Inventory.html Inventory] is a collection of item stacks and is used to represent the items inside various things in Eco including the player's backpack, vehicles, storage chests, stockpiles, and even fuel slots. Each instance of Inventory has a common interface for getting access to the items and stacks inside it. Inventories are also a hierarchy of inventories. For example, the player has a root level inventory <code>user.Inventory</code> which represents all the inventories of the player's character (their backpack, toolbar and clothing). To access child inventories you can use <code>inventory.AllInventories</code> or just by accessing the same stacks <code>IEnumerable</code> properties mentioned below. | An [https://docs.play.eco/api/server/eco.gameplay/Eco.Gameplay.Items.Inventory.html Inventory] is a collection of item stacks and is used to represent the items inside various things in Eco including the player's backpack, vehicles, storage chests, stockpiles, and even fuel slots. Each instance of Inventory has a common interface for getting access to the items and stacks inside it. Inventories are also a hierarchy of inventories. For example, the player has a root level inventory <code>user.Inventory</code> which represents all the inventories of the player's character (their backpack, toolbar and clothing). To access child inventories you can use <code>inventory.AllInventories</code> or just by accessing the same stacks <code>IEnumerable</code> properties mentioned below. | ||
=== Items/Stacks === | === Items/Stacks === | ||
Each slot of the inventory is represented by the [https://docs.play.eco/api/server/eco.gameplay/Eco.Gameplay.Items.ItemStack.html ItemStack] class whether it is empty or not. You can access the individual items through the inventory's stacks. Use <code>inventory.Stacks</code> to access all the stacks or <code>inventory.NonEmptyStacks</code> to access just the slots with any items in them. Both of these are <code>IEnumberable<ItemStack></code> so they can be used with [https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/concepts/linq/ Linq] or iterated through in a for-each loop: | Each slot of the inventory is represented by the [https://docs.play.eco/api/server/eco.gameplay/Eco.Gameplay.Items.ItemStack.html ItemStack] class whether it is empty or not. You can access the individual items through the inventory's stacks. Use <code>inventory.Stacks</code> to access all the stacks or <code>inventory.NonEmptyStacks</code> to access just the slots with any items in them. Both of these are <code>IEnumberable<ItemStack></code> so they can be used with [https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/concepts/linq/ Linq] or iterated through in a for-each loop: |