Difference between revisions of "Auto-Tiling"

From wiki
Jump to: navigation, search
(Initial commit.)
 
(Initial commit.)
Line 1: Line 1:
This page is not complete. This is only here in order to store "autoTileInfo" for now. Will be written later.
+
There are times where you would want a tile to change it's look depending on what other tiles are around it. It could be objects like roofing tiles or fences. And there are times where you want a tile to change the tiles around it, again like roofing and fences. Auto-Tiling will allow you to do the following;
  
 +
* Change the tile you are placing.
 +
* Change tiles up to 2 blocks away from the tile.
 +
* Block placing your tile unless certain conditions are met.
  
AutoTileInfo is always a list of blobs. These blobs contain information about what block to override or what block to look for in what place. Each blob in the list is constructed like so:
+
 
 +
= How to do Simple Stairs =
 +
To start this tutorial off, you will need 3 [[Tiles]]. These tiles should look like;
 +
 
 +
[Currently Under Construction]
 +
 
 +
 
 +
 
 +
= Config Options =
 +
An important thing to note, is that Auto-tiling is not by it's own. It must be placed within a [[Tile]]. Before you continue however, there is some information about "autoTileInfo" itself.
 +
 
 +
== "autoTileInfo" ==
 +
AutoTileInfo is the property which contains all the properties listed below. However this is being mentioned, due to a special condition.
 +
 
 +
AutoTileInfo is a [[Modding_Key_Terms#List|List]] of [[Modding_Key_Terms#Blob|Blobs]]. This means you can specify multiple different groups of autoTiling in the same tile. It will commonly look like;
 
<pre>
 
<pre>
 
"autoTileInfo" : [
 
"autoTileInfo" : [
 
   {
 
   {
     "lookFromOverride" : "",
+
     //Group 1
     "DirectionsToLookIn" : [
+
  },
      {
+
  {
        "direction" : "",
+
     //Group 2
        "secondDirection" : "",
+
  },
        "tilesToLookFor" : [],
+
  {
        "tileCategoriesToLookFor" : [],
+
    //Group 3
        "rotationToLookFor": 0
+
  }
      }
+
]
    ],
+
 
    "results" : [
+
Another thing to note is that these groups are done in order, with higher groups going first. This can be taken advantage off and make simpler files, as later groups will override earlier results. Take a look at Rope Fence Corner to see this in action.
      {
+
 
        "tileToPlace" : "",
+
 
        "direction" : "",
+
== "directionsToLookIn" ==
        "secondDirection" : "",
+
This is yet another list of [[Modding_Key_Terms#List|List]] of [[Modding_Key_Terms#Blob|Blobs]]. It will commonly look like the following;
        "rotation" : ""
+
<pre>
      }
+
"DirectionsToLookIn" : [
    ],
+
  {
    "onTileRemoval" : false
+
    "direction" : "",
}
+
    "secondDirection" : "",
 +
    "tilesToLookFor" : [],
 +
    "tileCategoriesToLookFor" : [],
 +
    "rotationToLookFor": 0
 +
  },
 +
  {
 +
    //Direction 2
 +
  }
 +
],
 
</pre>
 
</pre>
  
 +
=== "direction" ===
 +
'''Valid options ([[Modding_Key_Terms#String|String]]): <code>"right", "left", "front", "back", "up", "down", "none"</code>'''
  
==== "Common Terms" ====
+
'''Default Value:''' No default value is specified. Always need to provide your own.
===== "direction" =====
+
'''Valid options (String): <code>up, down, front, back, left, right, none</code>'''
+
  
Forces the object to go look in this direction. So giving this up, makes the tile look one tile upwards.
+
This is the direction that it will check first. That is, if you say "right" it will check the tile to the right.
  
  
===== "secondDirection" =====
+
=== "rotationToLookFor" ===
'''Valid options (String): <code>up, down, front, back, left, right, none</code>'''
+
'''Valid options ([[Modding_Key_Terms#Integer|Integer]] ): <code>0,1,2 or 3</code>'''
  
Forces the object to go look in this direction after heading in "direction". So giving this up, makes the tile look one tile upwards. Therefore if both "direction" and "secondDirection" is up, then it will look for two tiles upwards.
+
'''Default Value:''' If not specified, will not care about rotation.
  
  
===== "lookFromOverride" =====
+
If the tile that is searched, the one specified with [[#"direction"]] and [[#"secondDirection"]], has this specific rotation, then proceed to [[#"results"]]. Otherwise reject it.
'''Valid options (String): <code>up, down, front, back, left, right, none</code>'''
+
 
 +
 
 +
=== "secondDirection" ===
 +
'''Valid options ([[Modding_Key_Terms#String|String]]): <code>"right", "left", "front", "back", "up", "down", "none"</code>'''
 +
 
 +
'''Default Value:''' If not specified, will default to "none".
 +
 
 +
This is the direction that will check second. This will force the checked tile to be one further That is, if you say "right" for direction, then "right" for secondDirection it will check the tile, two tiles to the right.
 +
 
 +
 
 +
=== "tileCategoriesToLookFor" ===
 +
'''Valid options ([[Modding_Key_Terms#List|List]] of [[Modding_Key_Terms#String|String]] ): <code>A list of any valid strings.</code>'''
 +
 
 +
'''Default Value:''' If not specified, will not look for categories. Should specify either "tileCategoriesToLookFor" or "tilesToLookFor".
 +
 
 +
 
 +
If the tile that is searched, the one specified with [[#"direction"]] and [[#"secondDirection"]], has any of these categories, then proceed to [[#"results"]]. (As long as it is not rejected.)
 +
 
 +
 
 +
=== "tileCategoriesToReject" ===
 +
'''Valid options ([[Modding_Key_Terms#List|List]] of [[Modding_Key_Terms#String|String]] ): <code>A list of any valid strings.</code>'''
 +
 
 +
'''Default Value:''' If not specified, will not look for categories. Should specify either "tileCategoriesToLookFor" or "tilesToLookFor".
 +
 
 +
 
 +
If the tile that is searched, the one specified with [[#"direction"]] and [[#"secondDirection"]], has any of these categories, then reject going to [[#"results"]].
 +
 
 +
 
 +
=== "tilesToLookFor" ===
 +
'''Valid options ([[Modding_Key_Terms#List|List]] of [[Modding_Key_Terms#String|String]] ): <code>A list of strings each containing the code to a [[Tile]].</code>'''
 +
 
 +
'''Default Value:''' If not specified, will not reject any tiles.
 +
 
 +
 
 +
If the tile that is searched, the one specified with [[#"direction"]] and [[#"secondDirection"]], has a code in this list, then proceed to [[#"results"]]. (As long as it is not rejected.)
 +
 
 +
 
 +
=== "tilesToReject" ===
 +
'''Valid options ([[Modding_Key_Terms#List|List]] of [[Modding_Key_Terms#String|String]] ): <code>A list of strings each containing the code to a [[Tile]].</code>'''
 +
 
 +
'''Default Value:''' If not specified, will not reject any tiles.
 +
 
 +
 
 +
If the tile that is searched, the one specified with [[#"direction"]] and [[#"secondDirection"]], has a code in this list, then reject going to [[#"results"]].
 +
 
 +
 
 +
== "lookFromOverride" ==
 +
'''Valid options ([[Modding_Key_Terms#String|String]]): <code>"right", "left", "front", "back", "up", "down", "none"</code>'''
 +
 
 +
'''Default Value:''' No default value is specified. Always need to provide your own.
 +
 
 +
This is set the central tile to work from. Both "direction" and "secondDirection" will work based off of this direction.
 +
 
 +
 
 +
== "results" ==
 +
This is yet another list of [[Modding_Key_Terms#List|List]] of [[Modding_Key_Terms#Blob|Blobs]]. It will commonly look like the following;
 +
<pre>
 +
"results" : [
 +
  {
 +
    "tileToPlace" : "",
 +
    "direction" : "",
 +
    "secondDirection" : "",
 +
    "rotation" : ""
 +
  },
 +
  {
 +
    //Group 2
 +
  }
 +
],
 +
</pre>
 +
 
 +
=== "alt" ===
 +
'''Valid options ([[Modding_Key_Terms#Integer|Integer]]): <code>0, 1, 2 or 3</code>'''
  
Sets the initial spot to be in the specified direction, rather than the tile itself.
+
'''Default Value:''' If not specified, will place in a random alt.
  
  
===== "onTileRemoval" =====
+
This will be the number of the alternative look (alt) that the tile will have.
'''Valid options (Bool): <code>Either true or false</code>'''
+
  
Updates the tiles on removing the tile?
 
  
 +
=== "tileToPlace" ===
 +
'''Valid options ([[Modding_Key_Terms#String|String]]): <code>A strings containing the code to a [[Tile]].</code>'''
  
==== "directionsToLookIn" ====
+
'''Default Value:''' If not specified, will place the the tile.
This is a list of directions that will be looked in to see if objects are in certain blocks first. Uses direction and secondDirection to navigate to the tile.
+
  
  
===== "tilesToLookFor" =====
+
This will be the tile that is placed in the place specified by [[#"direction"_2|#"direction"]] and [[#"secondDirection"_2|#"secondDirection"]].
'''Valid options (String): <code>Any valid code that points towards a tile or tileObject.</code>'''
+
  
This is a list of tiles it will look for. If it contains any of these then it will succeed and cause "results" to run.
 
  
 +
=== "direction" ===
 +
'''Valid options ([[Modding_Key_Terms#String|String]]): <code>"right", "left", "front", "back", "up", "down", "none"</code>'''
  
===== "tileCategoriesToLookFor" =====
+
'''Default Value:''' No default value is specified. Always need to provide your own.
'''Valid options (String): <code>Any valid string that points that is a category in tile or tileObject.</code>'''
+
  
This is a list of categories inside of the tile's categories that it will look for. If it contains any of these then it will succeed and cause "results" to run.
+
This is the direction that it will check first. That is, if you say "right" it will check the tile to the right.
  
  
===== "rotation" =====
+
=== "rotation" ===
'''Valid options (Int): <code>A number between 0-3 representing rotation</code>'''
+
'''Valid options ([[Modding_Key_Terms#Integer|Integer]]): <code>0, 1, 2 or 3</code>'''
  
If it finds the right tile, then it will then search for what direction it is in, if this is present. This is relative to the tile that is being placed. If this succeeds after it has found a tile, then results will run. If it fails, results won't run.
+
'''Default Value:''' If not specified, will place in a random rotation.
  
  
==== "results" ====
+
This will be the rotation that the tile is placed in.
This is a list of resulting objects that will be placed if it succeeds in looking for tiles. This uses direction and secondDirection in order to specify where the tile is placed.
+
  
===== "tileToPlace" =====
 
'''Valid options (String): <code>Any valid string that points that is a category in tile or tileObject.</code>'''
 
  
This points to the specific tile or tileObject to be placed when succeeding.
+
=== "secondDirection" ===
 +
'''Valid options ([[Modding_Key_Terms#String|String]]): <code>"right", "left", "front", "back", "up", "down", "none"</code>'''
  
===== "rotation" =====
+
'''Default Value:''' If not specified, will default to "none".
'''Valid options (Int): <code>A number between 0-3 representing rotation</code>'''
+
  
This is the rotation that the tile will be placed in. This is relative to the tile being placed.
+
This is the direction that will check second. This will force the checked tile to be one further That is, if you say "right" for direction, then "right" for secondDirection it will check the tile, two tiles to the right.

Revision as of 07:08, 29 August 2017

There are times where you would want a tile to change it's look depending on what other tiles are around it. It could be objects like roofing tiles or fences. And there are times where you want a tile to change the tiles around it, again like roofing and fences. Auto-Tiling will allow you to do the following;

  • Change the tile you are placing.
  • Change tiles up to 2 blocks away from the tile.
  • Block placing your tile unless certain conditions are met.


How to do Simple Stairs

To start this tutorial off, you will need 3 Tiles. These tiles should look like;

[Currently Under Construction]


Config Options

An important thing to note, is that Auto-tiling is not by it's own. It must be placed within a Tile. Before you continue however, there is some information about "autoTileInfo" itself.

"autoTileInfo"

AutoTileInfo is the property which contains all the properties listed below. However this is being mentioned, due to a special condition.

AutoTileInfo is a List of Blobs. This means you can specify multiple different groups of autoTiling in the same tile. It will commonly look like;

"autoTileInfo" : [
  {
    //Group 1
  },
  {
    //Group 2
  },
  {
    //Group 3
  }
]

Another thing to note is that these groups are done in order, with higher groups going first. This can be taken advantage off and make simpler files, as later groups will override earlier results. Take a look at Rope Fence Corner to see this in action.


== "directionsToLookIn" ==
This is yet another list of [[Modding_Key_Terms#List|List]] of [[Modding_Key_Terms#Blob|Blobs]]. It will commonly look like the following;
<pre>
"DirectionsToLookIn" : [
  {
    "direction" : "",
    "secondDirection" : "",
    "tilesToLookFor" : [],
    "tileCategoriesToLookFor" : [],
    "rotationToLookFor": 0
  },
  {
    //Direction 2
  }
],

"direction"

Valid options (String): "right", "left", "front", "back", "up", "down", "none"

Default Value: No default value is specified. Always need to provide your own.

This is the direction that it will check first. That is, if you say "right" it will check the tile to the right.


"rotationToLookFor"

Valid options (Integer ): 0,1,2 or 3

Default Value: If not specified, will not care about rotation.


If the tile that is searched, the one specified with #"direction" and #"secondDirection", has this specific rotation, then proceed to #"results". Otherwise reject it.


"secondDirection"

Valid options (String): "right", "left", "front", "back", "up", "down", "none"

Default Value: If not specified, will default to "none".

This is the direction that will check second. This will force the checked tile to be one further That is, if you say "right" for direction, then "right" for secondDirection it will check the tile, two tiles to the right.


"tileCategoriesToLookFor"

Valid options (List of String ): A list of any valid strings.

Default Value: If not specified, will not look for categories. Should specify either "tileCategoriesToLookFor" or "tilesToLookFor".


If the tile that is searched, the one specified with #"direction" and #"secondDirection", has any of these categories, then proceed to #"results". (As long as it is not rejected.)


"tileCategoriesToReject"

Valid options (List of String ): A list of any valid strings.

Default Value: If not specified, will not look for categories. Should specify either "tileCategoriesToLookFor" or "tilesToLookFor".


If the tile that is searched, the one specified with #"direction" and #"secondDirection", has any of these categories, then reject going to #"results".


"tilesToLookFor"

Valid options (List of String ): A list of strings each containing the code to a Tile.

Default Value: If not specified, will not reject any tiles.


If the tile that is searched, the one specified with #"direction" and #"secondDirection", has a code in this list, then proceed to #"results". (As long as it is not rejected.)


"tilesToReject"

Valid options (List of String ): A list of strings each containing the code to a Tile.

Default Value: If not specified, will not reject any tiles.


If the tile that is searched, the one specified with #"direction" and #"secondDirection", has a code in this list, then reject going to #"results".


"lookFromOverride"

Valid options (String): "right", "left", "front", "back", "up", "down", "none"

Default Value: No default value is specified. Always need to provide your own.

This is set the central tile to work from. Both "direction" and "secondDirection" will work based off of this direction.


"results"

This is yet another list of List of Blobs. It will commonly look like the following;

"results" : [
  {
    "tileToPlace" : "",
    "direction" : "",
    "secondDirection" : "",
    "rotation" : ""
  },
  {
    //Group 2
  }
],

"alt"

Valid options (Integer): 0, 1, 2 or 3

Default Value: If not specified, will place in a random alt.


This will be the number of the alternative look (alt) that the tile will have.


"tileToPlace"

Valid options (String): A strings containing the code to a Tile.

Default Value: If not specified, will place the the tile.


This will be the tile that is placed in the place specified by #"direction" and #"secondDirection".


"direction"

Valid options (String): "right", "left", "front", "back", "up", "down", "none"

Default Value: No default value is specified. Always need to provide your own.

This is the direction that it will check first. That is, if you say "right" it will check the tile to the right.


"rotation"

Valid options (Integer): 0, 1, 2 or 3

Default Value: If not specified, will place in a random rotation.


This will be the rotation that the tile is placed in.


"secondDirection"

Valid options (String): "right", "left", "front", "back", "up", "down", "none"

Default Value: If not specified, will default to "none".

This is the direction that will check second. This will force the checked tile to be one further That is, if you say "right" for direction, then "right" for secondDirection it will check the tile, two tiles to the right.