Difference between revisions of "Tile Replacer Component"

From wiki
Jump to: navigation, search
(Created page with "Category:Component Modding Category:Component Modding are all optional Items are fairly broad in their types. Each type has it's own p...")
 
(Update Page.)
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
[[Category:Component Modding]]
 
[[Category:Component Modding]]
[[:Category:Component Modding]] are all optional  
+
[[:Category:Component Modding]] are all optional properties that can be added to any file. Components are useful in extending the original files with even more information, such as the cost of the item or whether the block can be broken by a weapon.
[[Items]] are fairly broad in their types. Each [[:Category:Item Modding|type]] has it's own properties and uses. This page is for items that when activated, they will replace a tile with another tile. For example, the game has seed packets which replace dirt with the grass of the respective type.
+
  
Replacer Items are all items that have the following line;
+
On this page, we go over the "Tile Replacer" component, signified by the following;
 
<pre>
 
<pre>
"kind": "staxel.item.TileReplacer",
+
"tileReplacer": {
 +
  =Content=
 +
}
 
</pre>
 
</pre>
 +
Tile Replacer components are specifically for the item type, [[Replacers(Tile Transforming Items)]], providing all of the information needed to swap around weapons.
  
And also must include a [[Tile Replacer Component]] in order to actually do anything.
 
  
Replacer items actually act as normal [[Craft Items]] but have the ability to interact with a block. Most of the information required is kept in the component listed below.
+
= When and How to use =
 +
Tile Replacer components are, in most cases, only used to complement the [[Replacers(Tile_Transforming_Items)|Replacers]]. In other cases, this component is not used at all.
  
  
= Creating a Replacer Item =
+
As this component is only ever used in one case, the information needed to create a Tile Replacer and this component is over at [[Replacers(Tile_Transforming_Items)#Creating a Replacer Item|this page]].
Replacers are created in much the same way as [[Craft Items]]. In fact you should follow the guide, [[Craft Items#Creating a Craft Item]], until you finish all of the steps there.
+
  
Once you have gone through that guide, there are two more steps you will need to do. First, change the "kind" from "staxel.item.CraftItem" to "staxel.item.TileReplacer". Secondly add the following to the end of the file;
+
 
 +
= Config Options =
 +
All config options must be inside the body of;
 
<pre>
 
<pre>
 +
"replacerTile": {
 +
  =Config Here=
 +
}
 +
</pre>
  
  "replacerItem": {
+
== "notificationTile" ==
    "tiles": [
+
'''Valid options ([[Modding_Key_Terms#String|String]]): <code>A string which contains the code of the [[Tile]] used in the error [[Notification]]</code>'''
      {
+
 
        "toReplaceTile": "staxel.tile.dirt.Dirt",
+
'''Default Value:''' Can be omitted. But when omitted, the error will be "Try placing on ".
        "replaceWithTile": "staxel.tile.fairyVillage.FairyGrassLayer.2",
+
 
        "applyColouration": true
+
 
      },
+
A string containing the Tile which the error will use. Specifically it will print out this tile's name in the error.
      {
+
 
        "toReplaceTile": "staxel.tile.dirt.Dirt.tilled",
+
== "tiles" ==
        "replaceWithTile": "staxel.tile.fairyVillage.FairyGrassLayer.2",
+
This property actually contains a list of blobs. A common input to the property will look like the following;
        "applyColouration": true
+
<pre>
      }
+
"tiles": [
    ],
+
  {
    "notificationTile": "staxel.tile.dirt.Dirt"
+
    "toReplaceTile": "staxel.tile.dirt.Dirt",
 +
    "replaceWithTile": "staxel.tile.fairyVillage.FairyGrassLayer.1",
 +
    "applyColouration": true
 
   },
 
   },
 +
  {
 +
    "toReplaceTile": "staxel.tile.dirt.Dirt.tilled",
 +
    "replaceWithTile": "staxel.tile.fairyVillage.FairyGrassLayer.1",
 +
    "applyColouration": true
 +
  }
 +
],
 
</pre>
 
</pre>
  
This looks complicated but it is not. The outermost property "replacerItem" is a component that holds all the information. (Specifically the [[Tile Replacer Component]]). Inside of that it includes two properties. The simpler property is "notificationTile", a property in which says what tile should be printed out onto the error message. The other property "tiles" is a list of blobs that contain 3 individual properties. Inside of tiles you have, "toReplaceTile" for the code of the [[Tile]] you want to replace, "replaceWithTile" for the code of the tile you want to replace with and "applyColouration". "applyColouration" should be true if the replacing tile has the property [[Tile#"palette"]] non-blank and/or [[Tile#"smoothRecolorationOnPlace"]] to true. This allows it to recolour when placed.
 
  
 +
=== "toReplaceTile" ===
 +
'''Valid options ([[Modding_Key_Terms#String|String]]): <code>The code to an [[Tile]] file</code>'''
  
= Spawning in a Replacer Item =
+
'''Default Value:''' No default value is specified. Always need to provide your own.
Follow the guide at [[Craft Items#Spawning in a Craft Item]]. When that guide mentions "kind", make sure to use "staxel.item.TileReplacer" instead of "staxel.item.CraftItem" else you won't be able to spawn the item.
+
  
  
= Config Options =
+
A string containing which tile you want to replace.
The list of basic properties is included at [[Craft Items#Config Options]].  
+
 
 +
 
 +
=== "replaceWithTile" ===
 +
'''Valid options ([[Modding_Key_Terms#String|String]]): <code>The code to an [[Tile]] file</code>'''
 +
 
 +
'''Default Value:''' No default value is specified. Always need to provide your own.
 +
 
 +
 
 +
A string containing which tile you want to replace with.
 +
 
 +
 
 +
=== "applyColouration" ===
 +
'''Valid options ([[Modding_Key_Terms#Bool|Bool]]): <code>True or False</code>'''
 +
 
 +
'''Default Value:''' If not specified, will default to False.
 +
 
  
All additional information being included at [[Tile Replacer Component#Config Options]].
+
This should be true if the replacing tile has the property [[Tile#"palette"]] non-blank and/or [[Tile#"smoothRecolorationOnPlace"]] to true. This allows it to recolour when placed. In all other cases it should be false.

Latest revision as of 07:13, 14 December 2017

Category:Component Modding are all optional properties that can be added to any file. Components are useful in extending the original files with even more information, such as the cost of the item or whether the block can be broken by a weapon.

On this page, we go over the "Tile Replacer" component, signified by the following;

"tileReplacer": {
  =Content=
}

Tile Replacer components are specifically for the item type, Replacers(Tile Transforming Items), providing all of the information needed to swap around weapons.


When and How to use

Tile Replacer components are, in most cases, only used to complement the Replacers. In other cases, this component is not used at all.


As this component is only ever used in one case, the information needed to create a Tile Replacer and this component is over at this page.


Config Options

All config options must be inside the body of;

"replacerTile": {
  =Config Here=
}

"notificationTile"

Valid options (String): A string which contains the code of the Tile used in the error Notification

Default Value: Can be omitted. But when omitted, the error will be "Try placing on ".


A string containing the Tile which the error will use. Specifically it will print out this tile's name in the error.

"tiles"

This property actually contains a list of blobs. A common input to the property will look like the following;

"tiles": [
  {
    "toReplaceTile": "staxel.tile.dirt.Dirt",
    "replaceWithTile": "staxel.tile.fairyVillage.FairyGrassLayer.1",
    "applyColouration": true
  },
  {
    "toReplaceTile": "staxel.tile.dirt.Dirt.tilled",
    "replaceWithTile": "staxel.tile.fairyVillage.FairyGrassLayer.1",
    "applyColouration": true
  }
],


"toReplaceTile"

Valid options (String): The code to an Tile file

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


A string containing which tile you want to replace.


"replaceWithTile"

Valid options (String): The code to an Tile file

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


A string containing which tile you want to replace with.


"applyColouration"

Valid options (Bool): True or False

Default Value: If not specified, will default to False.


This should be true if the replacing tile has the property Tile#"palette" non-blank and/or Tile#"smoothRecolorationOnPlace" to true. This allows it to recolour when placed. In all other cases it should be false.