Difference between revisions of "Replacers(Tile Transforming Items)"

From wiki
Jump to: navigation, search
(Update Page. Added more to the tutorial)
m (Oops.)
 
(One intermediate revision by the same user not shown)
Line 9: Line 9:
 
</pre>
 
</pre>
  
These items must also include a [[Tile Replacer Component]] in order to work. Replacer items have the ability to interact with a block and replace it with another block. It does this by searching for a specific tile then  
+
These items must also include a [[Tile Replacer Component]] in order to work. Replacer items have the ability to interact with a block and replace it with another block. It does this by searching for a specific tile then replacing it with another tile.
  
  
Line 53: Line 53:
 
</pre>
 
</pre>
  
With that out of the way, it is time to start editing these values. The outermost property "replacerItem" is known [[:Category:Component Modding|Component]] that holds all the information. (Specifically the [[Tile Replacer Component]]).  
+
With that out of the way, it is time to start editing these values. The outermost property "replacerItem" is known as a [[:Category:Component Modding|Component]] that holds all the information. (Specifically the [[Tile Replacer Component]]).  
  
  
Line 63: Line 63:
  
 
You can add more Tiles by following the pattern provided. Or you can remove the second entry if you only want to replace a single tile.
 
You can add more Tiles by following the pattern provided. Or you can remove the second entry if you only want to replace a single tile.
 +
 +
After you finished editing the values, rerun <code>Content Builder</code> and you are good to go.
  
  

Latest revision as of 06:41, 12 December 2017

Items are fairly broad in their types. Each 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;

"kind": "staxel.item.TileReplacer",

These items must also include a Tile Replacer Component in order to work. Replacer items have the ability to interact with a block and replace it with another block. It does this by searching for a specific tile then replacing it with another tile.


Creating a Replacer Item

Replacers are created in much the same way as Craft Items. In fact you should follow the guide, Items#How to Make a Normal 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. The first step is to change the "kind" from "staxel.item.CraftItem" to "staxel.item.TileReplacer".

The second step depends on what you are using to create items.


Asset Manager

Navigate to the item you had created before. Head to the components property and click on the [...]. When the new window pops up, click on "Add" and select "replacerItem".


Once that is done, the Asset Manager should have selected your new component. Click on "Notification Tile" and click the drop down to find the tile you want. This property gives the tile in the error message that appears when you use the item on the wrong tile.


Now onto the meat of the item, click on tiles and click on the [...]. When the new window pops up, click on "Add". A new entry will appear, you can now edit the values that just appeared. Click on these to find out what to do.


When you are done, close both windows by clicking "OK". Save the asset and continue to "Build and Validate Assets" like the normal item tutorial.


Text Files

The second step is to add the following to the end of the item file created;

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

With that out of the way, it is time to start editing these values. The outermost property "replacerItem" is known as 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 used in the error message. The error message will appear when the user attempts to replace the wrong tile.


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.


You can add more Tiles by following the pattern provided. Or you can remove the second entry if you only want to replace a single tile.

After you finished editing the values, rerun Content Builder and you are good to go.


Spawning in a Replacer Item

Follow the guide at Items#How to Spawn an 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

The list of basic properties is included at Items#Config Options.

This item does need additional information. This additional information is contained in a Tile Replacer Component which needs to be added along with the item file.