Difference between revisions of "Spreadable Component"

From wiki
Jump to: navigation, search
m (Minor fixes)
(Update Page.)
 
Line 32: Line 32:
 
</pre>
 
</pre>
  
This basically contains two properties. The first is "spreadsTo". Inside of this, there are "properties" that contain empty lists. In this specific case, the "property" names are the [[Tile|Tiles]] you want this tile to spread to. The lists themselves are kept empty as this is not needed for grass spreading. The "applyColouration" property is the second. "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.
+
This basically contains two properties. The first is [[#"spreadsTo"]]. Inside of this, there are "properties" that contain empty lists. In this specific case, the "property" names are the [[Tile|Tiles]] you want this tile to spread to. The lists themselves are kept empty as this is not needed for grass spreading. The [[#"applyColouration"]] property is the second. "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.
  
 
And this is it. This is the simpler option of the two.
 
And this is it. This is the simpler option of the two.
Line 56: Line 56:
 
</pre>
 
</pre>
  
This, again, basically contains two properties. The first is "spreadsTo". Inside of this, there are "properties" contain lists. In this specific case, the "property" names are the [[Tile|Tiles]] you want this tile to spread to, which in this case is an empty tile. The lists themselves are tiles to check below the tile you are spreading to. This enforces that, in this example, that weed always grows on top of grass and dirt. The "applyColouration" property is the second. "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. However in this case, this will likely be false, as weeds should not have colouration.
+
This, again, basically contains two properties. The first is [[#"spreadsTo"]]. Inside of this, there are "properties" contain lists. In this specific case, the "property" names are the [[Tile|Tiles]] you want this tile to spread to, which in this case is an empty tile. The lists themselves are tiles to check below the tile you are spreading to. This enforces that, in this example, that weed always grows on top of grass and dirt. The [[#"applyColouration"]] property is the second. "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. However in this case, this will likely be false, as weeds should not have colouration.
  
  
Line 81: Line 81:
  
 
== "applyColouration" ==
 
== "applyColouration" ==
'''Valid options (Bool): <code>True or False</code>'''
+
'''Valid options ([[Modding_Key_Terms#Bool|Bool]]): <code>True or False</code>'''
  
 
'''Default Value:''' False. No colouration is applied on place.
 
'''Default Value:''' False. No colouration is applied on place.

Latest revision as of 06:08, 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 Spreadable component, signified by the following;

"spreadable": {
  =Content=
}

Spreadable Components are used to spread the tile to more places across the ground. This is used to spread both the weeds and the grass seen in the game. This component is purely functional differences.


When and How to use

Spreadable Components are used on Tiles and tile objects in which you want to spread around after the day finishes. There are two main ways, of which I'm calling "Grass" and "Weeds".

In both cases, to start off with, create a Tile that you want to spread. Once that is done continue onto the section that suits your case. That being said, both styles can be used together, but usually won't be.


Grass

This section is for tiles that will replace other tiles entirely, as if it was a grass block.

Add the following lines to the end of your new file.

"spreadable" : {
  "spreadsTo" : {
    "staxel.tile.dirt.Dirt" : [],
    "staxel.tile.dirt.Dirt.tilled" : [],
    "staxel.tile.dirt.Dirt.watered" : []
  },
  "applyColouration": true
}

This basically contains two properties. The first is #"spreadsTo". Inside of this, there are "properties" that contain empty lists. In this specific case, the "property" names are the Tiles you want this tile to spread to. The lists themselves are kept empty as this is not needed for grass spreading. The #"applyColouration" property is the second. "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.

And this is it. This is the simpler option of the two.


Weed

This section is for things that grow on top of other things.

Add the following lines to the end of your new file.

"spreadable" : {
  "spreadsTo" : {
    "staxel.tile.Sky" : [
      "staxel.tile.dirt.Dirt",
      "staxel.tile.dirt.Dirt.tilled",
      "staxel.tile.dirt.Dirt.watered",
      "staxel.tile.grass.GrassLayer.1",
      "staxel.tile.grass.GrassLayer.2"
    ]
  },
  "applyColouration" : false
},

This, again, basically contains two properties. The first is #"spreadsTo". Inside of this, there are "properties" contain lists. In this specific case, the "property" names are the Tiles you want this tile to spread to, which in this case is an empty tile. The lists themselves are tiles to check below the tile you are spreading to. This enforces that, in this example, that weed always grows on top of grass and dirt. The #"applyColouration" property is the second. "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. However in this case, this will likely be false, as weeds should not have colouration.


Config Options

All config options must be inside the body of;

"spreadable": {
  =Config Here=
}

"spreadsTo"

This is where the majority of the meat of this component is. This section contains any number of properties which have a list. It will often look like;

"spreadsTo" : {
  "staxel.tile.dirt.Dirt" : [],
  "staxel.tile.dirt.Dirt.tilled" : [],
  "staxel.tile.dirt.Dirt.watered" : []
}

Each property in this, is the code of a Tile. This is the tile it will check around itself in order to spread. Each of these properties have a list inside of it as well. If this list has no values, then it will do nothing. If it has values, then it will check the tile below where it is going to spread, and see if that tile appears in the list. See #Weed for examples on this.


"applyColouration"

Valid options (Bool): True or False

Default Value: False. No colouration is applied on place.


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.