Difference between revisions of "Replacers(Tile Transforming Items)"
DeamonHunter (Talk | contribs) (Initial commit.) |
(No difference)
|
Revision as of 04:54, 10 July 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",
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.
Creating a Replacer Item
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;
"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" },
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.
Spawning in a Replacer Item
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
The list of basic properties is included at Craft Items#Config Options.
All additional information being included at Tile Replacer Component#Config Options.