-
Notifications
You must be signed in to change notification settings - Fork 0
Crafting System
This article will give an overview of the TS Crafting System, provided by the "Crafting"-module by @Adeon.
We made the decision not to stick with a conventional solution via GUI for the crafting system but introduced an intuitive and innovative in-game approach. The crafting "place" is made up of 27 smaller blocks, placed in a 3x3x3 cube. By doing this, we achieve the possibility of three dimensional crafting. The crafting process itself is similar to known systems -- one places blocks/items in the crafting grid and - based on some recipe - can receive some craft result.
The Crafting-Module is integrated in the stable builds starting from build #22. You can find the module listed in the Mods windows when you create a new world. In order to active the craft system in the game, select the module's name in the list and click the Activate button. You can now use the craft system in your fresh created worlds.
This sections explains the main usage of the crafting system, including information on how to start the crafting process, how to effectively use the available features and how to actually craft new items.
To start a crafting process, you have to hold the Q key while holding a block or item in hand so that you see the charge indicator. When right clicking during charging, the craft blocks appears in front of you, with one instance of the item hold in hand already placed in the grid.
The craft block is divided into 3 layers -- bottom, middle and top -- to make the placement of blocks/item practicable to the user. The navigation through the different layers works as follows: To go a layer up, press and hold shift and click right, that will move the interactable grid one layer up. To go one layer down respectively, press and hold shift and left click on your mouse.
To place the selected block/item in the grid, point with the crosshair on a specified cell and right click. If the cell is empty, the selected item will be inserted into the grid. If the cell does already contain an element of the selected type, the counter in the matrix is incremented by one. In the last case, if there is already an element in the cell which is different from the selected one, you will get the full amount of the placed block back to your inventory and a single instance of the selected block/item in hand is placed in the grid. If the block/item could successfully be placed, the amount of the selected block/item in the player's toolbar is decreased by one unit.
You can get placed blocks/items back by selecting them via the crosshair and left clicking on your mouse.
Furthermore, you can hold the right or left mouse button pressed to add or delete items continuously. Another way of adding a higher number of items to the grid at the same time is to hold Q to charge the number of items that will be added. The graduation is divided into 6 parts, each stands for 1/6 of the amount of items. Thus, charging to the half circle around the crosshair will place the half of the items in the grid.
You may have noticed that you only have the items in your toolbar available for crafting. This difficulty was solved by the so called mini-inventory, which allows to scroll easily through your inventory. To access the mini-inventroy, press and hold shift and use the mouse wheel to scroll through the rows of your inventory.
Now you know how to handle the crafting system, so we can start with the actual crafting. If you have arranged the blocks and items in the craft grid in a way such that the current configuration matches with some recipe, a thought cloud appears over the craft block, containing an icon hint to the craft result. In order to receive the item, press E and you will get one (or another number, specified by the recipe) of the result item to your inventory. The amount of the used items in the craft block is decreased simultaneously.
Finally, we have refinement left. Refinement is a simple form of changing an item's properties. In order to start the refinement process, selecet an item from you toolbar, press and hold Q and right click to bring up the craft block interface. The craft grid already contains an instance of the selected item. The item in the grid is called the target of the refinement process. To perform the refinement, you need to have an instigator, which will "trigger" the refinement. Selecet the instigator item or block in your toolbar, point with the crosshair to the item in the crafting grid and you will see the thought cloud with the refined item in it. Now press E to receive to add the refined item to your inventory.
The whole craft system is based on recipes. All crafting (and refinement) results are based on these recipes. New recipes are defined via a "CraftRecipe" section in the *.prefab files.
You can change the behaviour of the recipes by specifying different options. These options will be explained in detail right after the section on basic recipe definitions.
This section will explain the general structure of recipes. Therefore, the example of a pickaxe will be used. As already said, the pickaxe.prefab must contain the following section:
"CraftRecipe" : {}
The next step is to add the "recipe" subsection to the prefab file. Within this sections we will define the main recipse, i.e. specify the 3x3x3 matrix for the recipe. For convenience, you do not have to write down layers that are completely empty. Thus, our example for the pickaxe may end up like this:
"CraftRecipe" : {
"recipe" : {
"bottom" :
[
"stone", "stone", "stone",
" " , "stick", " ",
" " , "stick", " "
]
}
}
In general you will specify recipes with more than just one layer like in the following:
"CraftRecipe" : {
"recipe" : {
"bottom" : [ ],
"middle" : [ ],
"top" : [ ]
}
}
where bottom, middle and top denote the respective layers. For the content matrices, you can think of the bottom row to be closest to the player.
In addition to the simple recipe definition, you can specify several options to change the behaviour of the recipes. In the following list the options are explained in detail.
-
fullMatch : If the value is
true
(by default) then the positions of elements in the craft block will be checked for exact positions in the recipe matrix. This means given a recipe matrix A0 0 0 1 0 0 1 0 0
and a craft block matrix B
0 1 0 0 1 0 0 0 0
that these two matrices are different, and thus the placed blocks in the crafting block do not match with the recipe A. If the value of fullMatch is
false
both matrices, A and B are reduced to the more simple matrix1 1
and thus the given block configuration will match the recipe. The reduced matrices will be checked for equality by taking rotations into consideration. E.g. the following to matrices will match if *fullMatch is set to
false
.1 1 1 1 0 0 0 1 0 1 1 1 0 1 0 1 0 0
The option fullMatch still has some nuances. If you assing
false
to it, empty rows and columns may get deleted when matrices are compared. But this removal does only happen if the "space" in all cells of the row respectively column are not important to recipe. Think of some kind of recipe similar to the shoes recipe in good old Minecraft.0 0 0 1 0 1 1 0 1
You do not want to end up comparing the recipe matrix like this:
1 1 1 1
Thus, the space inbetween is preserved during the tranformation process, ending up in the simplified version
1 0 1 1 0 1
If the recipe contains more than one layer the empty columns and rows will be removed when they are empty for all the matrices and contain no "important space". For example, in the following recipe where we use all three layers with option fullMatch set to false the two rightmost colums are removed.
bottom center top bottom center top 1 0 0 1 0 0 1 0 0 1 1 1 1 0 0 1 0 0 0 0 0 ==> 1 1 0 1 0 0 0 0 0 0 0 0 1 0 0
-
recipe : The recipe option is used as described above. You may use up to three layers, each specified by its name. If a cell in the grid is empty, it is denoted by a space
" "
, if it should contain a specific item or block you denote by the block/item name:"stone"
, or"engine:sand"
for a more specific notation. -
resultCount : Via the resultCount option you can specify the output for the crafted result. The default value is 1, but you can decide on any other integer value.
To sum up the recipe definition and its options so far I want to give you the recipe for torches. Torches can be crafted out of a stick and one piece of coal, you will get four torches at once by crafting and the exact positions of blocks in the grid do not matter.
"CraftRecipe" : {
"fullMatch" : false,
"resultCount" : 4,
"recipe" : {
"bottom" :
[
" ", " ", " ",
" ", "coal", " ",
" ", "stick", " "
]
}
}