Module Vehicle

Star Wars Vehicles Flight Base

Info:

  • Author: Doctor Jew

Functions

Think()
Called every frame by the engine
OnRemove()
Called by the engine when removed
SpawnFunction(ply, tr, ClassName)
Called when a player spawns the vehicle, do not override.
Initialize()
Called by the engine to initialize the entity.
OnThink() Custom think function Override this to run custom logic.
Enter(ply) Makes a Player enter the vehicle
Exit(ply) Called when a Player exits the vehicle

Fields

PrintName Nice display name of the entity
Author Author of the Entity
Category Entity category, used to assign to a faction
Class Vehicle class (fighter, bomber, etc.)
MaxHealth Maximum health of the vehicle
MaxShield Maximum shields of the vehicle, if any
ShieldRegen Shield regen per second.
ShieldRegenTime Time after a hit that the shield starts regenerating in seconds.
ShieldColor Color of ship’s shield
Handling How fast can the vehicle pitch/yaw/roll?

Drawing Functions

Draw() Called every frame to draw the entity.
DrawExhaust()
Draw the engine exhaust
DrawDamageEffects()
Draw vehicle damage effects
DrawGlow()
Draw vehicle engine glow

HUD Functions

HUDDrawCrosshair(isPilot) Draw the vehicle crosshair
HUDDrawAltimeter(fpvX, fpvY) Draw the vehicle’s altimeter.

View functions

CalcFirstPersonView(view) Override first person view calculations
CalcThirdPersonView(view) Override third person view calculations

Engine Interaction

Land() Land the vehicle if possible
Takeoff() Takeoff the vehicle if landed
PhysicsSimulate(phys, delta)
Simulate the physics on the vehicle, called by the engine.

Damage Interactions

OnTakeDamage(dmg)
Called by the engine when the entity takes damage
ShieldDamage() Shield damage visuals
Destroy([attacker[, inflictor]]) Destroys the vehicle physically
Explode() Blows up the vehicle visually

Setup functions

SetupDataTables()
Setups the internal DTVars which creates getters/setters.
SetupDefaults(options) Setup default vehicle events.

Seat Functions

AddSeat(name, pos, ang) Add a seat to the vehicle.
GetSeat(index) Retrieve an actual seat entity.
GetSeats() Get all the seats of a vehicle.

Weapon Functions

AddWeaponGroup(name) Add a weapon to the vehicle.
GetWeaponGroup(name) Retrieve one of the vehicle’s weapon groups
GetWeaponGroups() Get all the vehicle’s weapon groups
AddWeapon(name[, pos[, callback]]) Add a weapon to the vehicle.
GetWeapon(name) Retrieve one of the vehicle’s weapons
GetWeapons(name) Get all the vehicle’s weapons
FireWeapon(name[, options]) Fire one of the vehicle’s weapons

Convenience Functions

GetPilot() Get the pilot of the vehicle.
GetPassenger(index) Get the player from a specific seat.

Networking

DispatchNWEvent(event, ...) Dispatch a networked event to all clients.
DispatchEvent(event, ...) Dispatch an event only client/server side.
AddEvent(name, callback) Add a callback to an event.
GetEvents(event) Get the callbacks for an event.


Functions

Think()
Called every frame by the engine
OnRemove()
Called by the engine when removed
SpawnFunction(ply, tr, ClassName)
Called when a player spawns the vehicle, do not override.

Parameters:

  • ply player The player that spawned the vehicle
  • tr table Trace result structure
  • ClassName string The entity class of the vehicle
Initialize()
Called by the engine to initialize the entity.
OnThink()
Custom think function Override this to run custom logic.
Enter(ply)
Makes a Player enter the vehicle

Parameters:

  • ply player The Player to enter the vehicle

See also:

Exit(ply)
Called when a Player exits the vehicle

Parameters:

  • ply player The Player that exited

See also:

Fields

PrintName
Nice display name of the entity
Author
Author of the Entity
Category
Entity category, used to assign to a faction
Class
Vehicle class (fighter, bomber, etc.)
MaxHealth
Maximum health of the vehicle
MaxShield
Maximum shields of the vehicle, if any
ShieldRegen
Shield regen per second.
ShieldRegenTime
Time after a hit that the shield starts regenerating in seconds.
ShieldColor
Color of ship’s shield
Handling
How fast can the vehicle pitch/yaw/roll?

Drawing Functions

Draw()
Called every frame to draw the entity. Do not override unless experienced.
DrawExhaust()
Draw the engine exhaust
DrawDamageEffects()
Draw vehicle damage effects
DrawGlow()
Draw vehicle engine glow

HUD Functions

HUDDrawCrosshair(isPilot)
Draw the vehicle crosshair

Parameters:

  • isPilot bool If the local player is the pilot
HUDDrawAltimeter(fpvX, fpvY)
Draw the vehicle’s altimeter.

Parameters:

  • fpvX number First person view X
  • fpvY number First person view Y

View functions

CalcFirstPersonView(view)
Override first person view calculations

Parameters:

  • view table The view information
CalcThirdPersonView(view)
Override third person view calculations

Parameters:

  • view table The view information

Engine Interaction

Land()
Land the vehicle if possible

Returns:

    bool If the vehicle was landed or not

See also:

Takeoff()
Takeoff the vehicle if landed

Returns:

    bool If the vehicle did takeoff or not
PhysicsSimulate(phys, delta)
Simulate the physics on the vehicle, called by the engine.

Parameters:

  • phys PhysObj The physics object of the vehicle.
  • delta number Time since the last call.

Damage Interactions

OnTakeDamage(dmg)
Called by the engine when the entity takes damage

Parameters:

  • dmg DamageInfo structure containing damage information
ShieldDamage()
Shield damage visuals

See also:

Destroy([attacker[, inflictor]])
Destroys the vehicle physically

Parameters:

  • attacker entity The attacker that destroyed the vehicle (optional)
  • inflictor entity The inflictor that destroyed the vehicle (optional)

See also:

Explode()
Blows up the vehicle visually

See also:

Setup functions

SetupDataTables()
Setups the internal DTVars which creates getters/setters.
SetupDefaults(options)
Setup default vehicle events. This is shared but will product different results on client/server.

Parameters:

  • options table The events to explicitly disable

Seat Functions

AddSeat(name, pos, ang)
Add a seat to the vehicle. The first seat is always the pilot.

Parameters:

  • name string The name of the seat for easy reference
  • pos vector The position of the seat in local coordinated
  • ang angle The angles of the seat in local angles

Returns:

    entity The seat Entity itself for convenience
GetSeat(index)
Retrieve an actual seat entity.

Parameters:

  • index The index of the seat. Can be a number or string.

Returns:

    entity The found Entity or NULL
GetSeats()
Get all the seats of a vehicle.

Returns:

    table Table of Entity classes of seats

Weapon Functions

AddWeaponGroup(name)
Add a weapon to the vehicle.

Parameters:

  • name string The name of the weapon group
GetWeaponGroup(name)
Retrieve one of the vehicle’s weapon groups

Parameters:

  • name string The name of the weapon group to retrieve

Returns:

    entity The found Entity or NULL
GetWeaponGroups()
Get all the vehicle’s weapon groups

Returns:

    table Table of Entity classes
AddWeapon(name[, pos[, callback]])
Add a weapon to the vehicle.

Parameters:

  • name string The name of the weapon
  • pos vector The position of the weapon (optional)
  • callback func Callback used to update entity positioning (optional)

Returns:

    entity The new weapon Entity for convenience
GetWeapon(name)
Retrieve one of the vehicle’s weapons

Parameters:

  • name string The name of the weapon to retrieve

Returns:

    entity The found Entity or NULL
GetWeapons(name)
Get all the vehicle’s weapons

Parameters:

  • name

Returns:

    table Table of Entity classes
FireWeapon(name[, options])
Fire one of the vehicle’s weapons

Parameters:

  • name string The name of the weapon to fire
  • options tab The options for the weapon (optional)

Convenience Functions

GetPilot()
Get the pilot of the vehicle.

Returns:

    player The pilot of the ship

See also:

GetPassenger(index)
Get the player from a specific seat.

Parameters:

  • index String or number index of the seat

Returns:

    player The found Player or NULL

Networking

DispatchNWEvent(event, ...)
Dispatch a networked event to all clients.

Parameters:

  • event string The event to dispatch
  • ... Any arguments to network
DispatchEvent(event, ...)
Dispatch an event only client/server side. Test.

Parameters:

  • event string The event to dispatch
  • ... Any arguments to send

Returns:

  1. bool If the event was stopped by a hook
  2. The result from the hook
AddEvent(name, callback)
Add a callback to an event.

Parameters:

  • name string The name of the event
  • callback func The callback to run on the event
GetEvents(event)
Get the callbacks for an event.

Parameters:

  • event string The name of the event

Returns:

    table Table of callback functions
generated by LDoc 1.4.6 Last updated 2019-07-16 04:36:33