Difference between revisions of "Recipes"
DeamonHunter (Talk | contribs) m (→Config Options) |
DeamonHunter (Talk | contribs) m (→Config Options) |
||
Line 98: | Line 98: | ||
'''Valid options ([[Modding_Key_Terms#String|String]]): <code>A string containing the path to an image file.</code>''' | '''Valid options ([[Modding_Key_Terms#String|String]]): <code>A string containing the path to an image file.</code>''' | ||
− | '''Default Value:''' | + | '''Default Value:''' If not specified, will not show an image in the description. |
Revision as of 06:10, 3 October 2017
In Staxel, *.recipe files are used to specify any recipe located in the recipe tab in the game. These recipes contain several things;
- List of all steps to get the resultant item
- List of all base ingredients to get the resultant item
- The item to unlock the recipe
Recipes do not make items, but specify the process in order to make an item. If you want to add actual crafting to the game, this is done by Reactions.
Adding New Recipes to Staxel
Staxel allows you to easily add your own recipes into staxel without needing to touch any of Staxel's files.
While not as necessary for recipes, make sure to follow #Setting up for Mod Creation first. Once this is done, create a file with an ending of .recipe, and place the following into it.
{ "type" : "crafting", "code": "staxel.crafting.recipes.DoorFrame", "grouping": "wood", "ingredients": [ { "code" : "staxel.item.crafting.Glue", "quantity" : 1 }, { "code" : "staxel.item.crafting.Lumber", "quantity" : 3 }, { "code" : "staxel.item.crafting.CheapVarnish", "quantity" : 2 } ], "steps": [ "staxel.crafting.reaction.AssembleLargeWoodenFrame", "staxel.crafting.reaction.CarveDoorFrame" ], "result": { "item": { "kind" : "staxel.item.Placer", "tile" : "staxel.tileObject.serverVillage.DoorFrame" }, "count": 1 }, "icon" : "staxel/crafting/recipes/Blueprint.qb", "inHandRotation" : { "x" : 0.0, "y" : 1.54, "z" : -1.54 }, "searchable": true, "pricing": { "value": 6972.0, "sellPrice": 4183.0 } }
Feel free to edit these values however you want. These values allow you to change how this recipe will act. Each of these properties are for a separate feature of the recipe. The first property, "code", is known as the identifier of this recipe. This is basically a unique name that the game can always rely on to find this recipe. The recommendation for this property is to make it the filepath to your file but replace "\" with ".", as the file path is always guaranteed to be unique. The second "type" is which tab this crafting will be in. Currently there are two main tabs "cooking" and "crafting" both of which are found in the inventory screen. The third "grouping" is what sub tab this recipe will be in. This varies for each "type". "cooking" can be either "desserts", "mainCourses" or "starters". While "crafting" can be "wood".
Next up is the main meat of this file. The next property "ingredients" is a list of all crafting components you will need before starting. This list of items actually follows Items#Universal Spawning Rules, but in most cases you can use an item's code. There is one difference, which is that in this case it can take a value "quantity" in order to specify how many items are needed. Note that Tiles and Clothing cannot be just a "code" and "quantity". Next up is the "steps". This is a list of all crafting steps in order, with each step being a separate Reaction Code. This will make the list of steps to follow. Following that is "result", which has two properties inside of it. The first property "item" is again another Spawned Item, this time without "quantity". "count" is then the replacement for the "quantity" property.
The following properties are actually to do with the Item that will give the recipe. The next property "icon" is the path to a model file that the game will use as the icon for the game. Act like this is kinda like Tile#"voxels". "inHandRotation" which specifies how the item will be rotated in the hand. This property uses Radians and not Degrees. "searchable" is whether or not the item can be searched in the creative inventory. The final property is the Pricing Component which is an optional extra. (Though not optional if you want to sell the recipe) The first property is "value" which tells you how much the recipe can be bought for. "sellPrice" on the other hand is how much the recipe can be sold for.
With that you have created an recipe. Once you have content built, you can see this recipe in the creative menu.
Useful components
Recipes can use any components that are suited to Items however the majority are useless. There is one main component that is useful however.
Pricing Component
This component is used to specify the prices and locations that this recipe can be bought or sold for/at. This is required if you don't want the recipe to live in the creative menu.
For more information on how to use the Pricing Component, head to Pricing Component#When and How to use.
Config Options
"code"
Valid options (String): A unique string which recipe what this object is.
Default Value: No default value is specified. Always need to provide your own.
This option is required to uniquely identify any object or resource. This string must be unique to all other codes, but does not have any other requirements.
For example: Having the code "mods.testrecipe.recipe1"
creates an object that has the handle "mods.testrecipe.recipe1".
"categories"
Valid options (List of Strings): A list of valid strings.
Default Value: If not specified, will just have no defined categories.
This is a list of categories for searching. These are also used in order to check if an item can complete achievements.
"descriptionImage"
Valid options (String): A string containing the path to an image file.
Default Value: If not specified, will not show an image in the description.
This is an image that will show up in the description window.
"icon"
Valid options (String): A string which contains the path to an model file.
Default Value: No default value is specified. Always need to provide your own.
This option points to a model file. This will be the model that will be displayed for the recipe's item.
"ingredients"
Valid options (List of Spawn Item): A list of Items to be spawned. See Items#Universal Spawning Rules for more information.
Default Value: No default value is specified. Always need to provide your own.
These are the ingredients that the player should have before starting this recipe. Ingredients can be the most basic items, or items that require their own recipes. Each ingrediant can also include an optional property labelled "quantity". This property tells the game how many of that item is required before starting.
Note: If this list is getting too long for you tastes, drop a step and use that step's results instead of using only basic items.
"inHandRotation"
Valid options (Vector 3): { "x": 0, "y": 0, "z":0 }
Default Value: No default value is specified. Always need to provide your own.
This is the rotation, in Radians and not Degrees, of the object in the hand while holding the object. Useful for making sure the item is held correctly.
"priority"
Valid options (Int): An integer number.
Default Value: If not specified, will default to the largest integer value possible. (2147483647)
This specifies the position in the crafting menu that will appear. Lower numbers will be placed higher in the list. If two recipes have the same priority then it will default to sorting alphabetically.
"grouping"
Valid options (String): Depends on "type". If "cooking" then "starters", "desserts", "mainCourses". If "crafting" then "wood".
Default Value: No default value is specified. Always need to provide your own.
This practically specifies what sub tab this recipe will go under. These tabs are found under the main tabs towards the left.
"result"
This is the item that should be expected by the end of the crafting process. It will usually look like;
"result": { "item": { "kind" : "staxel.item.Placer", "tile" : "staxel.tileObject.serverVillage.DoorFrame" }, "count": 1 },
"item"
Valid options (Spawn Item): An Items to be spawned. See Items#Universal Spawning Rules for more information.
Default Value: No default value is specified. Always need to provide your own.
This is the final item that the player should expect to receive for their troubles.
"count"
Valid options (Int): A positive integer number.
Default Value: If not specified, will default to 1.
The amount of the final item that the player should expect.
"searchable"
Valid options (Bool): True or False
Default Value: If not specified, will default to False.
This is whether or not the recipe item will be allowed to be searched for in the creative menu.
"stackSizeLimit"
Valid options (Int): An integer number.
Default Value: If not specified, will default to 1.
This is the amount of items that can be placed inside of a single inventory slot or dock.
"steps"
Valid options (List of Strings): A list of strings which each contain a Reaction Code.
Default Value: No default value is specified. Always need to provide your own.
This is the list of steps needed to get the ingredients to the final result. These must be in the order that you complete them.
"type"
Valid options (String): "cooking" or "crafting"
Default Value: No default value is specified. Always need to provide your own.
This practically specifies what main tab this recipe will go under. These tabs are found in the inventory menu, near the top.