rocket_util¶
Source: base/tealdef/game_mechanics/fun_elements/rocket_util.d.tl
Notes
Rockets for the fireworks and for the rocket launch in campaign mission 8.
Globals¶
Types
| Name | Definition | Description |
|---|---|---|
VecCol |
{number, number, number, number} |
Four numbers of one matrix row in a MatCols table. |
MatCols |
{VecCol, VecCol, VecCol, VecCol} |
4x4 matrix as a plain Lua table, as made by CustomEntityUtil.convertMatrixToTable. |
RocketParams¶
record global base/tealdef/game_mechanics/fun_elements/rocket_util.d.tl:6
global record RocketParams
Notes
Flight parameters of a rocket.
Example
Fields
| Name | Type | Description |
|---|---|---|
thrust |
number |
Thrust force; divided by mass for the acceleration along the rocket axis. |
mass |
number |
Mass of the rocket. |
gravity |
Vec3f |
Gravity acceleration, e.g. (0, 0, -9.81). |
timeOnGround |
number |
Seconds after spawning before the rocket starts to move. |
animationStartDelay |
number |
Seconds after spawning when the launch animation starts (sent to the model as launchAnimationGameTime). |
totalFlightTime |
number |
Seconds after spawning when the rocket is removed. |
finalPitchAngle |
number |
Pitch (radians) reached at the end of the flight; the rocket tilts linearly after the vertical phase. |
verticalPhaseTime |
number |
Seconds of vertical flight after timeOnGround. |
maxAltitude |
number |
Height above the launch point (metres) at which the rocket stops and explodes. Optional; the fireworks use 200 plus up to 100. |
rotZ |
number |
Heading (radians) of the pitch-over. |
RocketUtil¶
record global base/tealdef/game_mechanics/fun_elements/rocket_util.d.tl:19
global record RocketUtil
Load: local rocket_util = ug_require "::/game_mechanics/fun_elements/rocket_util.tl"
Notes
Spawning and flight of rockets.
Functions
spawnNew(model : string, transf : MatCols, rocketParams : RocketParams, callback : function(RocketData)) base/tealdef/game_mechanics/fun_elements/rocket_util.d.tl:33
Call as rocket_util.spawnNew
Notes
Spawns a rocket model and sends its launch time, colour and size to the entity as custom state.
| Parameter | Type | Description |
|---|---|---|
model |
string |
Model res name, e.g. ::/game_mechanics/fun_elements/firework/firework1.mdl. |
transf |
MatCols |
Launch transformation. |
rocketParams |
RocketParams |
Flight parameters. |
callback |
function(RocketData) |
Receives the new rocket's data once the entity exists. |
Used in the base game: 2 times in 2 files
base/content/game_mechanics/game_mechanics/fun_elements/fireworks.script.tl:74
rocket_util.spawnNew(models[math.random(1, #models)], transf, copy, function(rocketData : RocketUtil.RocketData)
mods/release/urbangames_campaign_mission_08/content/mission/mission/rocket/rocket.script.tl:48
update(rocketData : RocketData, dt : number, rocketParams : RocketParams) : boolean base/tealdef/game_mechanics/fun_elements/rocket_util.d.tl:34
Call as rocket_util.update
Notes
Advances the rocket's flight by one step.
| Parameter | Type | Description |
|---|---|---|
rocketData |
RocketData |
Rocket to update; changed in place. |
dt |
number |
Time step in seconds. |
rocketParams |
RocketParams |
Flight parameters; pass the same ones as to spawnNew. |
Returns boolean: True when the flight time is over and the rocket was removed.
Used in the base game: 2 times in 2 files
base/content/game_mechanics/game_mechanics/fun_elements/fireworks.script.tl:137
mods/release/urbangames_campaign_mission_08/content/mission/mission/rocket/rocket.script.tl:77
RocketUtil.RocketData¶
record base/tealdef/game_mechanics/fun_elements/rocket_util.d.tl:20
record RocketData
Notes
Saved state of one rocket.
Used in the base game: 12 times in 3 files
base/content/game_mechanics/game_mechanics/fun_elements/fireworks.script.tl:21
base/content/game_mechanics/game_mechanics/fun_elements/rocket_util.tl:4
mods/release/urbangames_campaign_mission_08/content/mission/mission/rocket/rocket.script.tl:14
Fields
| Name | Type | Description |
|---|---|---|
rocketEntity |
EntityUtil.EntityAndRevision |
Rocket entity. |
initialTransf |
MatCols |
Launch transformation. |
velocity |
{number} |
Velocity as {x, y, z}. |
position |
{number} |
Offset from the launch point as {x, y, z}. |
flightTime |
number |
Seconds since spawning. |
spawnTime |
number |
Game time (ms) of spawning. |
atMaxAltitude |
boolean |
True once the rocket reached maxAltitude; the model then plays the explosion. |
rotZ |
number |
Heading (radians) copied from the params. |
color |
{number, number, number} |
Random normalised RGB colour of the explosion. |
size |
number |
Random value from 0 to 1 that sets the velocity damping of the explosion particles. |
RocketState¶
record global base/tealdef/game_mechanics/fun_elements/rocket_util.d.tl:37
global record RocketState
Notes
Saved state of the rocket game script of campaign mission 8.
Fields
| Name | Type | Description |
|---|---|---|
rockets |
{RocketUtil.RocketData} |
Rockets in flight. |
spawnTime |
integer |