Difference between revisions of "Items"
DeamonHunter (Talk | contribs) (Initial commit. Links subject to change.) |
(No difference)
|
Revision as of 02:16, 5 July 2017
In Staxel, *.items are just anything that can be collected and be displayed in the player's hands or in the player's inventory. This is actually a very broad category of things, which can not be simply explained on a single page. This will mainly be an explanatory page focusing on the overall item system and the couple of universal properties.
For a list of specific item types head to Category:Item Modding.
Contents
Useful information
Common Cases
Items are very broad, covering many different areas, however there generally are a couple of common use cases.
The first use case is your common item. Craft Items are your typical item and contain mostly information on how to render the item in the hand properly. This type of item is not place-able on or in anything but Docks. But as such it is useful for crafting, as the name suggests.
The second use case is tiles. Tiles do not actually need their own "*.item" files as the game can generate them. However tiles are useful to spawn in, especially when needed for other items. As such, even though you won't need to create an "*.item" file for tiles, you can head to Tile Items in order to see how to spawn them.
The third use case is Clothing. Clothing items are fairly similar to Tiles, in that you don't need to create a "*.item" file for them, but to spawn them you'll need to look at Clothing Items
All other cases, head on over to Category:Item Modding to see their specific cases.
Universal Item Properties
All items are based off a singular base item. In most cases, items will have the following base to them;
{ "code": "staxel.item.something", "kind": "staxel.item.craftItem", "categories": ["item", "category2"], "searchable": true }
As such most files will allow you to set these properties. Though some may add additional categories or may overwrite settings. The explanation to these properties are as follows;
"code"
Valid options (String): A unique string which item this object is.
Default Value: No default value is specified. Always need to provide your own.
A string containing the code of the item the blob will be referring to.
"kind"
Valid options (String): A string represented pointing to a type of object.
Default Value: No default value is specified. Always need to provide your own.
A string containing a value which tells Staxel's code how to treat the item. Each type of item has it's own kind code, which you can view over at Category:Item Modding.
"categories"
Valid options (List of strings): A list of strings that can be used to identify the object.
Default Value: Null or nothing specified.
A list of strings that will be used to identify the object. They act as additional search properties in the catalogue and creative menu. As well as a way to categorise for crafting.
"searchable"
Valid options (List of strings): True or False
Default Value: True
Determines whether or not this item can actually be searched for in the catalogue and creative menu.
Universal Spawning Rules
Object spawning is actually used a fair bit inside of both game files, such as Treasures, Animals and Villager Jobs. This helps specify what items can be used for what, for example what items to give to a player or what items to check for in crafting. You can also use object spawning ingame by using the /give command.
Most item spawns use, at the very least, the following section;
{ "code": "" "kind": "" }
There are a couple rules with item spawning that you should keep in mind though.
1. If a code is specified, then it will try to look for that item in the database of items. If the item already exists, that is a *.item acutally exists for it, it will then use that item. With this, you do not need to specify a "kind", however doing so might make it more resistent to changes in the *.item. (Specifying "kind", leads to the game checking if the item that was gotten from the code is the same specified in this file.)
2. If a code is not specified, then it will try to make an item based on the information provided in the above statement. This is especially used when creating items that do not use "*.item" files, such as tiles or clothing.
For example, the following is a valid item spawn blob which spawns an apple.
{ "code": "staxel.item.crops.Apple" }
You can test this in game by doing /spawnitem [YourName] { "code": "staxel.items.crops.Apple"}
The following spawns a set of glasses for a player.
{ "kind": "staxel.item.Clothing", "accessory": "staxel.accessories.characters.accessories.glasses.AGlass", "palette": "staxel.palette.red" }
You can test this in game by doing /spawnitem [YourName] {"kind": "staxel.item.Clothing", "accessory": "staxel.accessories.characters.accessories.glasses.AGlass", "palette": "staxel.palette.red"}
And this spawns a tile for the player to place.
{ "kind": "staxel.item.Placer", "tile": "staxel.tile.grass.GrassLayer.1" }
You can test this in game by doing /spawnitem [YourName] {"kind": "staxel.item.Placer","tile": "staxel.tile.grass.GrassLayer.1"}
For more information on how to spawn items. You can head to Category:Item Modding and look for the specific item type.