Fireworks Launcher Component

From wiki
Jump to: navigation, search

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 Fireworks Launcher Component, signified by the following;

"fireworksLauncher": {
  =Content=
}

Fireworks Launcher Components are used to add customisation to the functionality of the Launcher Tile. This component includes some aesthetic and functional changes. This component also complements the Firework Component, which provides information for items to explode, but is not required.

When and How to use

Fireworks Launcher Component is needed whenever you want to make an Firework Launcher. Specifically, an Fireworks Launcher 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.FireworksLauncher". Once that is done, you can add the following below the last property of the file;

"fireworksLauncher": {
  "fuseOffset": {"x": 0.5, "y": 0.0, "z": 0.5},
  "fuseEffect": "staxel.effect.generic.FireworkActivate",
  "countdownOffset": {"x": 0.5, "y": 1.25, "z": 0.5},
  "interactCountdown": true,
  "fireworks": [
    {
      "item": {
        "kind": "staxel.item.CraftItem",
        "code": "staxel.item.generic.FireworkRed"
      },
      "quantity": 3,
      "countdownSeconds": 3.0,
      "countdownSecondsSpread": 0.5,
      "launchVelocity": {"x": 0.0, "y": 50.0, "z": 0.0},
      "launchVelocitySpread": {"x": 13.0, "y": 0.0, "z": 13.0},
      "launchOffset": {"x": 0.5, "y": 1.5, "z": 0.5},
      "flightSeconds": 1.5,
      "flightSecondsSpread": 0.1
    },
  ]
},

This file can end up looking large, but it is basically two parts.

The first part is customisation of the tile itself. "fuseOffset" is the offset that the fuse effect will appear at. "fuseEffect" is the code to the Effects that plays for the fuse. "countdownOffset" is the offset that the countdown number will appear at. "interactCountdown" is whether or not the countdown will start on interacting with the tile or whether it will start when placed. (True for interact, false for placing.)

The second part is contained within "fireworks". Fireworks is essentially a list of items that have additional properties for launching them. Inside one of the list items, "item" is a blob that is meant to choose an item to spawn. Look at Items#How to Spawn an Item for more information. "quantity" is how many of these items you want to spawn. "countdownSeconds" is how many seconds before the item is spawned. "countdownSecondsSpread" is the additional time randomly added, not subtracted, from "countdownSeconds". "launchVelocity", is the direction you want to launch the item in. "launchVelocitySpread" is the random amount of additional speed to be added. "launchOffset" is the offset for where the item will be initially spawned. "flightSeconds" is how much time the item should be flying up into the air. "flightSecondsSpread" is the additional amount of random time added or subtracted from "flightSeconds".

With that, this component is complete. You may want to also look into Firework Component for making items/tiles go into the Firework.


Config Options

All config options must be inside the body of;

"fireworksLauncher": {
  =Config Here=
}

"countdownOffset"

Valid options (Vector 3 - Double): {"x": 0.0, "y": 0.0, "z": 0.0}

Default Value: No default value is specified. Always need to provide your own.


This is the offset of the countdown display before the first item fires off.


"fuseOffset"

Valid options (Vector 3 - Double): {"x": 0.0, "y": 0.0, "z": 0.0}

Default Value: No default value is specified. Always need to provide your own.


This is the offset of the fuse effect before the first item fires off.


"fuseEffect"

Valid options (String): A string that is pointing to the code of an Effect

Default Value: No default value is specified. Always need to provide your own.


This is the effect that will get played as the fuse.


"interactCountdown"

Valid options (Bool): True or False.

Default Value: If not specified, will default to False.


This is whether or not the countdown will start on interact. If false, countdown will immediately start on place.


"fireworks"

This is a list of items that contain a bunch of special properties. THis will commonly look like;

"fireworks": [
  {
    "item": {
      "kind": "staxel.item.CraftItem",
      "code": "staxel.item.generic.FireworkRed"
    },
    "quantity": 3,
    "countdownSeconds": 3.0,
    "countdownSecondsSpread": 0.5,
    "launchVelocity": {"x": 0.0, "y": 50.0, "z": 0.0},
    "launchVelocitySpread": {"x": 13.0, "y": 0.0, "z": 13.0},
    "launchOffset": {"x": 0.5, "y": 1.5, "z": 0.5},
    "flightSeconds": 1.5,
    "flightSecondsSpread": 0.1
  },
  {
    =Content=
  }
]

"countdownSeconds"

Valid options (Float): A positive decimal number.

Default Value: If not specified, will not have a countdown. (Spawn Immediately)


This is the amount of seconds before spawning the item to launch.


"countdownSecondsSpread"

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 "countdownSeconds".


"flightSeconds"

Valid options (Float): A positive decimal number.

Default Value: No default value is specified. Always need to provide your own.


This is the amount of seconds that the item will fly upwards. Will only work if the item has a Firework 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 Firework Component


"item"

Valid options (Spawn Item): See Items#How to Spawn an Item 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.

"launchEffect"

Valid options (String): A string that is pointing to the code of an Effect.

Default Value: If not specified, will play no effect.


This is the effect that will get played as the item is launched.


"launchEffectOffset"

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.


This is the offset of the launch effect as the item is launched.


"launchOffset"

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.


This is the offset of the launch where the item will be spawned.


"launchVelocity"

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.


This is the amount of speed the item will be given when spawned.


"launchVelocitySpread"

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.


"quantity"

Valid options (Integer): A positive integer number.

Default Value: If not specified, will spawn 1 item.


This is the number of items, of this type, that the launcher will spawn.