Module Vehicle
Star Wars Vehicles Flight Base
Info:
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? |
-
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:
-
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?
-
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
-
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
-
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
-
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.
-
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:
-
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
-
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
-
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:
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)
-
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
-
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:
-
bool
If the event was stopped by a hook
-
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