-
Notifications
You must be signed in to change notification settings - Fork 31
API Globals
This page lists all constants and functions that are accessible from the Glide global table.
Returns the max. amount of seats that Vehicle:CreateSeat will allow.
When explosions happen, the network event will only be transmitted to clients that are nearby (closer than this constant). This does not apply to the attacker, who will always see explostions that they are responsible for.
Used on 
Glide.CreateExplosion and 
Glide.CreateExplosion.
| Key | Value | Description |
|---|---|---|
Glide.EXPLOSION_TYPE.MISSILE |
0 | Default explosion, can be heard from very far away. |
Glide.EXPLOSION_TYPE.VEHICLE |
1 | A larger version of Glide.EXPLOSION_TYPE.MISSILE, plays a metalic-like sound. |
Glide.EXPLOSION_TYPE.TURRET |
2 | A small explosion, plays a very short sound, meant to happen in quick succession. |
These are values returned from Vehicle.VehicleType. It hints the type of vehicle that you're dealing with.
| Key | Value | Description |
|---|---|---|
Glide.VEHICLE_TYPE.UNDEFINED |
0 | This vehicle uses base_glide as the base class, or has not defined a type. |
Glide.VEHICLE_TYPE.CAR |
1 | This vehicle uses base_glide_car as the base, or has defined itself as a car. |
Glide.VEHICLE_TYPE.MOTORCYCLE |
2 | This vehicle uses base_glide_motorcycle as the base, or has defined itself as a motorcycle. |
Glide.VEHICLE_TYPE.HELICOPTER |
3 | This vehicle uses base_glide_heli as the base, or has defined itself as a helicopter. |
Glide.VEHICLE_TYPE.PLANE |
4 | This vehicle uses base_glide_plane as the base, or has defined itself as a plane. |
Glide.VEHICLE_TYPE.TANK |
5 | This vehicle uses base_glide_tank as the base, or has defined itself as a tank. |
Used on
Glide.SendMissileDanger to notify clients about incoming lock-on/missiles.
| Key | Value | Description |
|---|---|---|
Glide.DANGER_TYPE.LOCK_ON |
1 | The target player just got locked-on, plays 3 short bleeps. |
Glide.DANGER_TYPE.MISSILE |
2 | The target player tracks the incoming missile, bleeps get shorter and shorter as the missile approaches. |
A table containing class names as keys and true as values. Used by
Glide.FindLockOnTarget to filter which entities can be locked-on.
Used by the input system to handle mouse input while flying aircraft.
| Key | Value | Description |
|---|---|---|
Glide.MOUSE_FLY_MODE.AIM |
0 | Point-to-aim |
Glide.MOUSE_FLY_MODE.DIRECT |
1 | Control movement directly |
Glide.MOUSE_FLY_MODE.CAMERA |
2 | Free camera (Use keyboard only) |
A table containing surface material numbers as keys and numbers as values. These values are used by wheels to change the grip multiplier depending on which surface they are in contact with.
A table containing surface material numbers as keys and numbers as values. These values are used by wheels to slow down the vehicle depending on which surface they are in contact with.
Default color for headlights. Used by some of the default cars included in the base, on their Vehicle.LightSprites and Vehicle.Headlights entity variables.
Vehicle camera types. Used to return a value on
Vehicle:GetCameraType.
| Key | Value | Description |
|---|---|---|
Glide.CAMERA_TYPE.CAR |
0 | Orbit camera. Always stays upright. Shakes on high speeds. |
Glide.CAMERA_TYPE.TURRET |
1 | Orbit camera. Always stays upright. Does not auto-center. |
Glide.CAMERA_TYPE.AIRCRAFT |
2 | Orbit camera. Will rotate with the vehicle when using Glide.MOUSE_FLY_MODE.CAMERA. |
A table containing surface material numbers as keys and true as values. Used by wheels to do tire roll marks on certain surfaces.
A table of tables, containing data about sound file paths for each surface material, for different situations (slipping sideways, slipping forwards, rolling slowly, and rolling fast).
A value containing the main theme color for Glide.
⚠ Warning: Some UI panels may modify the alpha value of this color. If you use it directly to draw things, they might appear transparent or invisible. Change the color's alpha value before using it, or copy the RGB values to a separate
Colorinstance if necessary.
For the purposes of organization, functions are grouped into these categories:
Prints a message to console, prefixed by a blue [Glide] tag. Allows for formatting strings as well.
Glide.Print( "I've got %i items from the %s marketplace.", 3, "Steam" )Same as
Glide.Print, but only prints if the developer console variable is set to 1 or greater.
This is a convenience function to check if the developer console variable is greater than 0.
This is a wrapper for language.GetPhrase, adding glide. at the start of the phrase you want to lookup.
Get the cached position/angle of the local player's last rendered view. Unlike calling EyePos or EyeAngles, this can be called at any point without being affected by render.RenderView. It will always return what the local player sees on their screen.
Checks if a position is under water.
Checks if a certain entity is a children of another entity class, no matter how deep it sits on the inheritance chain.
Checks the vehicle's VehicleType, returns true if it's an plane or helicopter.
Hides an entity without using SetNoDraw. SetNoDraw can cause the entity to not exist on Entity:GetChildren clientside, so use this when you need to hide wheels, seats, or other parts of the vehicle.
If you ever need Gmod's Lerp function, use this instead. Lerp is not consistent on different framerates/tickrates.
Same as Glide.ExpDecay, but works with numbers between 0 and 360, wrapping when necessary.
Ensures that the force is within the range of a float and engine limits, to prevent crashes when applying it.
Returns nothing since it modifies the force Vector instance itself.
Filters keys from a EntityCopyData table that was given by 
ENTITY:OnEntityCopyTableFinish.
Only the required key-values, desired network variables (using the nwFields) and desired entity variables (using entFields) will be kept on the data table.
Used by many dupeable Glide entities on 
ENTITY:PreEntityCopy, to allow saving Wiremod connections to other entities.
⚠ Warning: This function is used internally. Although you can use it, only do so if you know what you're doing.
Used by many dupeable Glide entities on 
ENTITY:PostEntityPaste, to allow restoring Wiremod connections to other entities.
⚠ Warning: This function is used internally. Although you can use it, only do so if you know what you're doing.
traction = Glide.TractionRamp( number slipAngle, number sideTractionMaxAng, number sideTractionMax, number sideTractionMin )
Used by Glide wheels to calculate the sideways traction force depending on the slipAngle.
For more details, see the this page.
Checks if the target ply has not reached the Glide vehicle limit yet.
Used by Glide vehicles on 
duplicator.RegisterEntityClass.
It makes sure the duplicator system (or just spawning vehicles via the Spawn Menu) follows the limits from 
Glide.CanSpawnVehicle before creating a vehicle entity and returning
it.
Check if a player can lock the vehicle's doors by either being it's creator or being a CPPI friend of the creator.
Check if a player can lock the vehicle's doors by either being it's creator or being a CPPI friend (prop protection buddy) of the creator.
Checks if a player can enter a locked vehicle.
If ply is in a Glide vehicle, switch them to the target seatIndex, if it's empty.
Finds and returns all human players near a certain position.
Returns the position where the local player's Glide camera is aiming at.
Caches and returns a material created from the given image file path.
Draw a weapon crosshair. icon is a path to a image file. size is relative to the screen resolution.
Draw a "weapon selection" indicator on the screen. icon is a path to a image file.
Given a vehicle type, returns the icon image file path for it.
Draw a health bar, as can be seen when aiming at a Glide vehicle.
health is a value between 0 and 1.
icon is a optional path to a image file.
Glide.DrawVehicleHealth( number x, number y, number w, number h, Glide.VEHICLE_TYPE vehicleType, number chassisHealth, number engineHealth )
Draw chassis and engine health bars, as can be seen when using the Vehicle Repair SWEP.
chassisHealth and engineHealth are values between 0 and 1.
Draw a sprite meant to represent lights.
Creates and returns a new EngineStream.
Creates and returns a new RangedFeature.
⚠ Warning: This function is used internally. Although you can use it, only do so if you know what you're doing.
Recreates all fonts used by Glide. This is called automatically when the screen resolution changes.
Shows a notification using Glide's notification system. Check this page for more information.
Shows a one-time notification using Glide's notification system.
icon is a path to a image file.
Note: One-time means that, if you call this function with the same text, it will only show once until the player rejoins the server/reloads the map.
Shows a one-time key bind notification using Glide's notification system. Converts the key code to a friendly name.
text must contain a %s so this function can tell where to put the key.
key must be a KEY or MOUSE code.
icon is a path to a image file.
Note: One-time means that, if you call this function with the same text and key, it will only show once until the player rejoins the server/reloads the map.
⚠ Warning: This function is used internally. Although you can use it, only do so if you know what you're doing.
Validate and set the input action binds for a specific player.
⚠ Warning: This function is used internally. Although you can use it, only do so if you know what you're doing.
Starts listening to input events from this player, then forward those inputs to the specified vehicle as long as it exists.
⚠ Warning: This function is used internally. Although you can use it, only do so if you know what you're doing.
Stop listening to input events from this player.
Try to find the closest flare entity ahead of dir, within the specified radius. This is faster than finding flares manually with ents.FindByClass( "glide_flare" ).
Creates a glide_vehicle_turret with the relative offset and angles, and add that weapon to the vehicle's turretCount.
For more details about vehicle turrets, see this page.
Entity = Glide.FireMissile( Vector origin, Angle angle, Player attacker, Entity parent, Entity target )
Creates a glide_missile, and sets the specified attacker as the player who fired it.
The missile will ignore collisions with parent.
The target is a optional entity for the missile to follow.
Creates a glide_projectile, and sets the specified attacker as the player who fired it.
The projectile will ignore collisions with parent.
Fires a bullet given the specified values on the params table.
traceFilter is a optional table (similar to the filter parameter from the trace structure) that will be used to ignore entities on the bullet's trace.
| Name | Type | Description |
|---|---|---|
| pos | Vector | Origin of the bullet |
| ang | Angle | Angle representing the direction of the bullet |
| attacker | Player | The player who fired the bullet |
| Name | Type | Description |
|---|---|---|
| inflictor | Entity | The entity that fired the bullet |
| spread | number | How much can the bullet randomly stray away from ang? |
| length | number | Max. distance the bullet can travel |
| damage | number | Bullet damage |
| isExplosive | boolean | Is the bullet going to explode when it hits? |
| explosionRadius | number | If isExplosive is true, this sets the blast radius |
| scale | number | Size of the tracer effect |
| tracerColor | Color | Color of the tracer effect |
| shellDirection | Vector | If set, throw a shell towards this direction |
Fires a explosive bullet, from the eye position of the first player to join the server.
local ply = Entity( 1 )
Glide.FireBullet( {
pos = ply:EyePos(),
ang = ply:EyeAngles(),
attacker = ply,
isExplosive = true
}, {
filter = ply -- Don't let the bullet trace hit this player
} )
Glide.CreateExplosion( Entity inflictor, Player attacker, Vector origin, number radius, number damage, Vector normal, Glide.EXPLOSION_TYPE explosionType )
Utility function to deal damage and send a explosion event to nearby players.
inflictor is required. If attacker is not set or invalid, inflictor will be used as the attacker instead.
You can find a list of types for explosionType here.
Creates all the necessary particle and sound effects for an explosion, depending on the type.
boolean, number = Glide.CanLockOnEntity( Entity ent, Vector origin, Vector normal, number threshold, number maxDistance, Player attacker, boolean includeEmpty, table traceFilter )
Returns true if the target entity can be locked on from a starting position (origin) and direction (normal).
Part of that includes checking if the dot product between normal and the direction towards the target entity is larger than threshold. That dot product is also returned by this function.
attacker is the player who is trying to lock-on.
Set includeEmpty to true to include vehicles without a driver.
traceFilter is a optional table (similar to the filter parameter from the trace structure) that will be used to ignore entities when performing visibility checks.
boolean, number = Glide.FindLockOnTarget( Vector origin, Vector normal, number threshold, number maxDistance, Player attacker, table traceFilter, table entFilter )
Finds all entities that we can lock on with 
Glide.CanLockOnEntity, then returns which one has the largest dot product between normal and the direction towards it.
traceFilter is a optional table (similar to the filter parameter from the trace structure) that will be used to ignore entities when performing visibility checks.
entFilter is a optional array of entities to not consider as possible targets.
Sends and shows a notification message to the target(s). target can be either a player entity or a table of player entities.
data is a key-value table for properties of the notification (such as text, icon, sound, etc). You can find a list here.
Let the target(s) know about a incoming lock-on. This currently has the effect of playing plays 3 short bleeps.
Let the target(s) know about a incoming missile. This makes the target player(s) track the missile entity and play shorter beeps as that missile gets closer.
Note: Although you can use any entity as the
missile, that entity has to have aGetHasTargetfunction, then it will be tracked as long as that function returnstrue.
Apply a camera view punch to the target's Glide camera, if it is active.
Stores necessary data to respawn a player later, so it can restore health, armor and inventory.
Restores health, armor and inventory previously stored with 
Glide.StoreSpawnInfo. Does nothing if there is no data from that function.
restoreCallback is an optional function that will run after the player has "finished" respawning/restoring weapons.
Creates a ragdoll at ply's position that matches the player's pose, makes the player spectate that ragdoll, and applies a velocity to the ragdoll.
unragdollTime is a optional number of seconds to automatically call 
Glide.UnRagdollPlayer after that time has passed.
If the player is still ragdolled, stops spectating the ragdoll, removes it, respawns the player and then calls 
Glide.RestoreSpawnInfo.
restoreCallback is an optional function that will run after the player has "finished" respawning/restoring weapons.