Lootable Component
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 Lootable component, signified by the following;
"lootable": { =Content= }
Lootable components are used to add functionality of the Lootable Tile. This component includes some aesthetic and functional changes.
Contents
When and How to use
Lootable component is needed whenever you want to make an Lootable tile. Specifically, an lootable component is needed whenever a Tile has it Tile#"tileStateKind" equal to "staxel.tileState.Lootable". Otherwise Lootable component will do nothing.
To start off with first, you will need to create a Tile with Tile#"tileStateKind" equal to "staxel.tileState.Lootable". Once that is done, you can add the following below the last property of the file;
"lootable": { "isTheft": true, "petalRange": { "x": 100, "y": 200 }, "daysBeforeReset" : 1, "treasure": "staxel.treasure.whatever", "lootEffect": "staxel.effect.generic.StealPetals" },
These are the most useful properties to this, while there are more properties. #"isTheft" is used to make the game know that this is a theft and will apply penalties to buying. "petalRange" is a Vector 2, that is "x" is the minimum value, and "y" is the maximum value in petals. #"daysBeforeReset" is how many days until it resets itself. #"treasure" is the Treasure Pool that it will give the player. #"lootEffect" is the Effect that is played when looting.
With that, this component is mainly complete. Check below for more properties that are useful in some situations.
Config Options
All config options must be inside the body of;
"lootable": { =Config Here= }
"daysBeforeReset"
Valid options (Integer): A positive integer number
Default Value: If not specified, then the default value is 1.
This is the number of days before it will reset itself.
"dailyUseLimit"
Valid options (Integer): A positive integer number
Default Value: If not specified, then the default value is 1.
This is the number of times you can use this tile daily.
"isTheft"
Valid options (Bool): True or False
Default Value: If not specified, will default to false.
This is whether or not this action will count as a theft. Thieving adds penalties to buying items as the town needs to recoup the loss.
"limitDailyUse"
Valid options (Bool): True or False
Default Value: If not specified, will default to true.
This is whether or not the amount of times this tile can be looted is limited in a single day.
"lootEffect"
Valid options (String): A string containing a code to a Effect.
Default Value: If not specified, will not play any effect when looting.
This is the effect that will play when looting.
"nametagTranslation"
Valid options (String): A string that is unique to other Translation strings.
Default Value: If not specified, will go with the default tag.
This is for making unique name tags for any tile. This does not work when "isTheft" is active however.
"petalRange"/"petals"
Both of these are connected. They look like;
"petalRange": {"x" 0.0, "y" 10.0} or "petals": 10
"petalRange" is used to define a random range. (From the value specified in "x", to the value specified in "y"). While "petals" is used to specify an exact value.
It is recommended to always use "petalRange" instead of "petals" however.
"requiresTotem"
Valid options (Bool): True or False
Default Value: If not specified, will default to false.
This is whether or not this tile will require a completed totem before it can be stolen/looted.
"singleUse"
Valid options (Bool): True or False
Default Value: If not specified, will default to false.
This is whether or not this tile only has one use.
"treasure"
Valid options (String): A string containing the code to a Treasure Pool.
Default Value: If not specified, will not spawn any items.
This is the treasure pool it will use in order to give out items to the player.
"usedTile"
Valid options (String): A string containing the code to a Tile pool.
Default Value: If not specified, will spawn an air tile.
This is the tile that this tile will get replaced with when looted. This will only happen if "singleUse" is true.