Goal 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 Goal component, signified by the following;
"goal": { =Content= }
Goal components are used to add customisation to the functionality of the Goal Tile. This component includes some aesthetic and functional changes.
Contents
When and How to use
Goal component is needed whenever you want to make an Goal. Specifically, an Goal component is needed whenever a Tile has it Tile#"tileStateKind" equal to "staxel.tileState.FireworksLauncher". Otherwise Fireworks Launcher component will do nothing.
To start off with first, you will need to create a Tile with Tile#"tileStateKind" equal to "staxel.tileState.Goal". Once that is done, you can add the following below the last property of the file;
"goals": { "goalFireworkItem": { "kind": "staxel.item.CraftItem", "code": "staxel.item.generic.GoalFirework" }, "fireworkItemQuantity": 3, "fireworkLaunchVelocity": {"x": 0.0, "y": 17.5, "z": 0.0}, "fireworkLaunchVelocitySpread": {"x": 5.0, "y": 0.0, "z": 5.0}, "fireworkFlightSeconds": 0.7, "fireworkFlightSecondsSpread": 0.0 "scoreWithItemCategories": [ "ball" ], "hitBoxScale": 0.5 }, },
This component will look somewhat similar to Fireworks Launcher Component but it is greatly simplified.
The "goalFireworkItem" is the item is should spawn when a goal is scored. Look at Items#Universal Spawning Rules for more information. "fireworkItemQuantity" is how many fireworks it should launch. "fireworkLaunchVelocity" is how much base speed the firework should launch at. "fireworkLaunchVelocitySpread" is the additional random speed that the firework can have. "fireworkFlightSeconds" is how long these fireworks can fly for. "fireworkFlightSecondsSpread" is the amount of additional time that these fireworks can launch for. "scoreWithItemCategories", is the item categories it will look for in order to declare a goal. "hitBoxScale" is how much the hitbox of the goal will be scaled by.
With that, this component is complete.
Config Options
All config options must be inside the body of;
"goal": { =Config Here= }
"flightSeconds"
Valid options (Float): A positive decimal number
Default Value: If not specified, will last 0.7 seconds.
This is the amount of seconds that the item will fly upwards. Will only work if the item has a Fireworks Component.
"flightSecondsSpread"
Valid options (Float): A positive decimal number
Default Value: If not specified, will not have any variance.
This is the maximum amount of seconds that can be randomly added to "flightSeconds". Will only work if the item has a Fireworks Component
"fireworkLaunchVelocity"
Valid options (Int): A positive integer number
Default Value: If not specified, will spawn 1 firework.
This is the number of fireworks that will spawn.
"fireworkLaunchVelocity"
Valid options (Vector 3 - Double): {"x": 0.0, "y": 0.0, "z": 0.0}
Default Value: If not specified, will be {"x": 0.0, "y": 17.5, "z": 0.0}.
This is the amount of speed the item will be given when spawned.
"fireworkLaunchVelocitySpread"
Valid options (Vector 3 - Double): {"x": 0.0, "y": 0.0, "z": 0.0}
Default Value: If not specified, will just have a zero vector (No variance).
This is the additional amount of random speed that will be added to the launch velocity.
"goalFireworkItem"
Valid options (Spawn Item): See Items#Universal Spawning Rules for more information
Default Value: No default value is specified. Always need to provide your own.
This is the item that will be spawned in. If the item has a Fireworks component, it will do extra things but it is not needed.
"hitBoxScale"
Valid options (Float): A positive decimal number
Default Value: If not specified, will be scaled by 0.5.
This is how much the hitbox of the goal will be scaled by.
"scoreWithItemCategories"
Valid options (List of Strings): A list of strings that are categories on items.
Default Value: No default value is specified. Always need to provide your own.
This is the list of categories it will look for in order to declare a goal.