Lightning

consoledoc.h

An emitter for lightning bolts.

More...

Strikes

int

Number of lightning strikes to perform per minute.

float

Width of a lightning bolt.

float

Horizontal size (XY plane) of the search box used to find and damage Player or Vehicle objects within range of the strike.

Colors

LinearColorF

Color to blend the strike texture with.

LinearColorF

Color to blend the strike texture with when the bolt is fading away.

Bolts

float

Percentage chance (0-1) that a given lightning bolt will hit something.

float

Radial distance from the center of the Lightning object for the start point of the bolt.

bool

Controls whether lightning bolts are affected by fog when they are rendered.

Callbacks

void
applyDamage(Point3F hitPosition, Point3F hitNormal, SceneObject hitObject)

Informs an object that it was hit by a lightning bolt and needs to take damage.

Public Static Attributes

bool

Disables rendering of all instances of this type.

bool

Disables selection of all instances of this type.

Public Functions

void

Creates a LightningStrikeEvent which strikes a specific object.

void

Creates a LightningStrikeEvent which attempts to strike and damage a random object in range of the Lightning object.

void

Creates a LightningStrikeEvent that triggers harmless lightning bolts on all clients. No objects will be damaged by these bolts.

Detailed Description

An emitter for lightning bolts.

Lightning strike events are created on the server and transmitted to all clients to render the bolt. The strike may be followed by a random thunder sound. Player or Vehicle objects within the Lightning strike range can be hit and damaged by bolts.

Strikes

int strikesPerMinute 

Number of lightning strikes to perform per minute.

Automatically invokes strikeRandomPoint() at regular intervals.

float strikeWidth 

Width of a lightning bolt.

float strikeRadius 

Horizontal size (XY plane) of the search box used to find and damage Player or Vehicle objects within range of the strike.

Only the object at highest altitude with a clear line of sight to the bolt will be hit.

Colors

LinearColorF color 

Color to blend the strike texture with.

LinearColorF fadeColor 

Color to blend the strike texture with when the bolt is fading away.

Bolts fade away automatically shortly after the strike occurs.

Bolts

float chanceToHitTarget 

Percentage chance (0-1) that a given lightning bolt will hit something.

float boltStartRadius 

Radial distance from the center of the Lightning object for the start point of the bolt.

The actual start point will be a random point within this radius.

bool useFog 

Controls whether lightning bolts are affected by fog when they are rendered.

Callbacks

applyDamage(Point3F hitPosition, Point3F hitNormal, SceneObject hitObject)

Informs an object that it was hit by a lightning bolt and needs to take damage.

Parameters:

hitPosition

World position hit by the lightning bolt.

hitNormal

Surface normal at hitPosition.

hitObject

Player or Vehicle object that was hit.

function Lightning::applyDamage( %this, %hitPosition, %hitNormal, %hitObject )
{
   // apply damage to the player
   %hitObject.applyDamage( 25 );
}

Public Static Attributes

bool isRenderable 

Disables rendering of all instances of this type.

bool isSelectable 

Disables selection of all instances of this type.

Public Functions

strikeObject(ShapeBase pSB)

Creates a LightningStrikeEvent which strikes a specific object.

note:

This method is currently unimplemented.

strikeRandomPoint()

Creates a LightningStrikeEvent which attempts to strike and damage a random object in range of the Lightning object.

// Generate a damaging lightning strike effect on all clients
%lightning.strikeRandomPoint();

warningFlashes()

Creates a LightningStrikeEvent that triggers harmless lightning bolts on all clients. No objects will be damaged by these bolts.

// Generate a harmless lightning strike effect on all clients
%lightning.warningFlashes();