Picked up a wicked E2, possibly Spacebuild related. Any suggestions regarding the source of its functions?

It’s a pretty damn big thing I found from a simple google search I did out of a sudden urge, here’s the pastebin link:

Does anyone who knows Spacebuild and/or E2 in general know where its functions come from? I figured that it’s some sort of spaceship/vtol chip and that functions like E:sbSetDragOverride(N) are from that gamemode but even though I have SB3 installed and started up a singleplayer session on a Spacebuild map, the E2 returns errors on functions such as the one I named there, this one E:sbSetGravityOverride(N) and timer(N, N, S, S).

And it doesn’t look like that cracked up russian E2 power piece of shit addon either.


@name Garuda - Fighter Control
@inputs CanopyEnts:array CanopyToggle
@inputs PilotPod:wirelink CopilotPod:wirelink
@inputs Effects:wirelink
@outputs EngineThrottle VTOLFXToggle EngineFXToggle
@outputs Flight_State Offset:vector GroundDist LGear_InAnim Canopy_InAnim CurAng:angle TargetAng:angle 
#Ship Vars
@persist Parts:array Parent:entity LastFrame
#Input Vars
@outputs Key_Forward Key_Back Key_Up Key_Down Key_Left Key_Right Mouse_Offset:angle
#Flight Variables
@persist FLIGHT_STATE_VTOL FLIGHT_STATE_FREE FLIGHT_STATE_GROUND
@persist Ground_Accel Ground_Decel Ground_AccelKick Ground_DecelKick Ground_ForwardSpeed Ground_BackSpeed Ground_TurnRate Ground_WheelRotateRate
@persist VTOL_Accel VTOL_Decel VTOL_AngDamping VTOL_MaxSpeed VTOL_UpSpeed VTOL_DownSpeed VTOL_Gravity VTOL_MaxBank VTOL_BankSpeed VTOL_YawSpeed VTOL_LGearRestDist
@persist Flight_Accel Flight_Decel Flight_MaxSpeed Flight_PitchSpeed Flight_YawSpeed Flight_RollSpeed
#Canopy Movement
@persist Canopy_SlideDelay Canopy_MaxHeight Canopy_MaxSlide Canopy_SlideSpeed_Vert Canopy_SlideSpeed_Hori
@persist Canopy_RestartTime Canopy_CurHeight Canopy_CurSlide
@persist Canopy_ParentIndex Canopy_ParentEnt:entity
#Landing Gear
@persist LGear_Down LGear_FrontWheelAng LGear_GroundPlaneDir:vector LGear_GroundPlaneOrigin:vector
@persist LGear_Doors:array LGear_GearAnchors:array LGear_PistonShafts:array LGear_WheelDists:array
@persist LGear_Axels:array LGear_AxelLastPos:array LGear_WheelOnGround:array LGear_FrontPiston
@persist LGear_DoorSpeed LGear_DoorMaxAng LGear_DoorCurAng
@persist LGear_MinAng LGear_MaxAng LGear_Speed LGear_CurAng
@persist LGear_WheelMaxDist LGear_WheelDist LGear_WheelRadius LGear_WheelCircum
@persist LGear_SmallWheelSpring LGear_LargeWheelSpring
#Setup Vars
@persist Setup_Complete Setup_HoloIndex Setup_Index
@autoupdate

if(first()|duped()) { #--Program Header
    
runOnChat(1)

#------------------------
# EDITABLE VARS
#------------------------

Canopy_SlideDelay = 0.75
Canopy_MaxHeight = 4
Canopy_MaxSlide = 115
Canopy_SlideSpeed_Vert = 16
Canopy_SlideSpeed_Hori = 90

LGear_DoorSpeed = 150
LGear_DoorMaxAng = 130

LGear_Speed = 90
LGear_MinAng = 4
LGear_MaxAng = 90

LGear_WheelMaxDist = 43.7   #Oddly Specific, but this is how it fits in the bay
LGear_WheelRadius = 15.5/2  #Found using BoxSize on the wheel prop in use

Ground_Accel = 150
Ground_Decel = 150
Ground_AccelKick = 2
Ground_DecelKick = 3
Ground_ForwardSpeed = 75
Ground_BackSpeed = 45
Ground_TurnRate = 15
Ground_WheelRotateRate = 70

VTOL_Accel = 150
VTOL_Decel = 150
VTOL_AngDamping = 15
VTOL_MaxSpeed = 500
VTOL_UpSpeed = 150
VTOL_DownSpeed = 100
VTOL_Gravity = 35
VTOL_MaxBank = 15
VTOL_BankSpeed = 90
VTOL_YawSpeed = 65
VTOL_LGearRestDist = 21

Flight_Accel = 150
Flight_Decel = 50
Flight_MaxSpeed = 5000
Flight_PitchSpeed = 45
Flight_YawSpeed = 25
Flight_RollSpeed = 50

#--End of Editable Vars--

#Fake Enums
FLIGHT_STATE_GROUND = 0
FLIGHT_STATE_VTOL = 1
FLIGHT_STATE_FREE = 2

#Defaults
Setup_HoloIndex = 1
Setup_Index = 1

LGear_Doors = array()
LGear_GearAnchors = array()
LGear_Axels = array()
LGear_AxelLastPos = array()
LGear_WheelDists = array()
LGear_PistonShafts = array()
LGear_WheelOnGround = array()
LGear_FrontWheelAng = 0

LGear_GroundPlaneDir = vec(0, 0, 1)
LGear_GroundPlaneOrigin = vec(0, 0, 0)

LGear_WheelCircum = pi() * LGear_WheelRadius * 2

Flight_State = FLIGHT_STATE_GROUND

LastFrame = systime()


#-------------------------
# UTILITY FUNCTIONS
#-------------------------

function void generateLGearPlane(GearPoints:array)
{
    local Dir1 = GearPoints[2,vector] - GearPoints[1,vector]
    local Dir2 = GearPoints[3,vector] - GearPoints[1,vector]
    local Dir3 = GearPoints[3,vector] - GearPoints[2,vector]
    
    LGear_GroundPlaneOrigin = (GearPoints[1,vector] + GearPoints[2,vector] + GearPoints[3,vector]) / 3
    LGear_GroundPlaneNormal = (Dir2:cross(Dir1)):normalized()
}

#--End Utility Functions--


#----------------------------
# GEAR/ENGINE HOLOS
#----------------------------

#Animation Loop
function void animateGear(Open)
{
    local Finished = 0
    LGear_InAnim = 1
    
    #Opening Animation
    if(Open)
    {
        #---------
        # DOORS
        #---------
        if(LGear_DoorCurAng < LGear_DoorMaxAng)
        {
            #Play Sound and Start Anim
            if(LGear_DoorCurAng == 0)
            {
                #Play Sound
                for(Index = 1, LGear_Doors:count())
                {
                    local Holo = LGear_Doors[Index,number]
                    local HoloEnt = holoEntity(Holo)
                    HoloEnt:soundPlay("LGear Doors Unlock"+Holo, 2.4, "buttons/og_button_down_0" + randint(1,3) + ".wav")
                    soundVolume("LGear Doors Unlock"+Holo, 0.10)
                    soundPitch("LGear Doors Unlock"+Holo, randint(95, 115))
                }
            }
            
            #Rotate Doors
            local DoorSpeed = LGear_DoorSpeed * 0.05
            if(LGear_DoorCurAng + DoorSpeed > LGear_DoorMaxAng)
            {
                DoorSpeed = LGear_DoorMaxAng - LGear_DoorCurAng
            }
            
            LGear_DoorCurAng += DoorSpeed
            for(Index = 1, LGear_Doors:count())
            {
                local Holo = LGear_Doors[Index,number]
                
                holoAng(Holo, holoEntity(Holo):toWorld(ang(0, 0, -DoorSpeed)))
            }
        }
        
        #---------
        # GEAR
        #---------
        if(LGear_CurAng < LGear_MaxAng && LGear_DoorCurAng > 40)
        {
            #Play Sound and Start Gear Anim
            if(LGear_CurAng == LGear_MinAng)
            {
                #Play Sound
                for(Index = 1, LGear_GearAnchors:count())
                {
                    local Holo = LGear_GearAnchors[Index,number]
                    local HoloEnt = holoEntity(Holo)
                    HoloEnt:soundPlay("LGear Drop"+Holo, 1.5, "plats/door_round_blue_unlock_01.wav")
                    soundVolume("LGear Drop"+Holo, 2)
                    soundPitch("LGear Drop"+Holo, randint(45, 55))
                }
            }
            
            #Rotate Gear
            local GearSpeed = LGear_Speed * 0.05
            if(LGear_CurAng + GearSpeed > LGear_MaxAng)
            {
                GearSpeed = LGear_MaxAng - LGear_CurAng
            }
            
            LGear_CurAng += GearSpeed
            for(Index = 1, LGear_GearAnchors:count())
            {
                local Holo = LGear_GearAnchors[Index,number]
                
                holoAng(Holo, holoEntity(Holo):toWorld(ang(GearSpeed, 0, 0)))
            }
        }
        
        #--Final Check
        if(LGear_DoorCurAng == LGear_DoorMaxAng && LGear_CurAng == LGear_MaxAng)
        {
            Finished = 1
            LGear_InAnim = 0
        }
    }
    #Closing Animation
    else
    {
        #---------
        # DOORS
        #---------
        if(LGear_DoorCurAng > 0 && LGear_CurAng < LGear_MaxAng - 40)
        {
            #Play Sound and Start Anim
            if(LGear_DoorCurAng == LGear_DoorMaxAng)
            {
                #Play Sound
                for(Index = 1, LGear_Doors:count())
                {
                    local Holo = LGear_Doors[Index,number]
                    local HoloEnt = holoEntity(Holo)
                    HoloEnt:soundPlay("LGear Doors Close"+Holo, 2.4, "buttons/og_button_up_0" + randint(1,3) + ".wav")
                    soundVolume("LGear Doors Close"+Holo, 0.10)
                    soundPitch("LGear Doors Close"+Holo, randint(95, 115))
                }
            }
            
            #Rotate Doors
            local DoorSpeed = LGear_DoorSpeed * 0.05
            if(LGear_DoorCurAng - DoorSpeed < 0)
            {
                DoorSpeed = LGear_DoorCurAng
            }
            
            LGear_DoorCurAng -= DoorSpeed
            for(Index = 1, LGear_Doors:count())
            {
                local Holo = LGear_Doors[Index,number]
                
                holoAng(Holo, holoEntity(Holo):toWorld(ang(0, 0, DoorSpeed)))
            }
        }
        
        #---------
        # GEAR
        #---------
        if(LGear_CurAng > LGear_MinAng)
        {
            #Play Sound and Start Gear Anim
            if(LGear_CurAng == LGear_MaxAng)
            {
                #Play Sound
                for(Index = 1, LGear_GearAnchors:count())
                {
                    local Holo = LGear_GearAnchors[Index,number]
                    local HoloEnt = holoEntity(Holo)
                    HoloEnt:soundPlay("LGear Pull"+Holo, 1.4, "plats/door_round_blue_lock_01.wav")
                    soundVolume("LGear Pull"+Holo, 2)
                    soundPitch("LGear Pull"+Holo, randint(45, 55))
                }
            }
            
            #Rotate Gear
            local GearSpeed = LGear_Speed * 0.05
            if(LGear_CurAng - GearSpeed < LGear_MinAng)
            {
                GearSpeed = LGear_CurAng - LGear_MinAng
            }
            
            LGear_CurAng -= GearSpeed
            for(Index = 1, LGear_GearAnchors:count())
            {
                local Holo = LGear_GearAnchors[Index,number]
                
                holoAng(Holo, holoEntity(Holo):toWorld(ang(-GearSpeed, 0, 0)))
            }
        }
        
        #Final Check
        if(LGear_DoorCurAng == 0 && LGear_CurAng == LGear_MinAng)
        {
            Finished = 1
            LGear_InAnim = 0
        }
    }
    
    if(!Finished)
    {
        timer(50, 1, "Landing Gear Animation", "animateGear(n)", Open)
    }
}

#Toggle Landing Gear
function void toggleGear(Toggle)
{
    if(Toggle != LGear_Down)
    {
        LGear_Down = Toggle
        animateGear(Toggle)
    }
}

function void createSmallGear(Offset:vector)
{
    #Base Assembly
    holoCreate(Setup_HoloIndex)
    holoModel(Setup_HoloIndex, "models/lt_c/sci_fi/support_beam_48.mdl")
    holoPos(Setup_HoloIndex, entity():toWorld(Offset + vec(-12, 0, -24)))
    holoAng(Setup_HoloIndex, entity():toWorld(ang(0, 0, 0)))
    holoColor(Setup_HoloIndex, vec(106, 106, 106))
    holoScaleUnits(Setup_HoloIndex, vec(12, 18, 48))
    holoParent(Setup_HoloIndex, entity())
    Setup_HoloIndex++
    
    #Left Panel Rotator
    holoCreate(Setup_HoloIndex)
    holoPos(Setup_HoloIndex, entity():toWorld(Offset + vec(0, 9, 0)))
    holoAng(Setup_HoloIndex, entity():toWorld(ang(90, 0, 0)))
    holoAlpha(Setup_HoloIndex, 0)
    holoParent(Setup_HoloIndex, entity())
    LGear_Doors:pushNumber(Setup_HoloIndex)
    Setup_HoloIndex++
    
    #Left Panel
    holoCreate(Setup_HoloIndex)
    holoModel(Setup_HoloIndex, "models/sprops/rectangles/size_2_5/rect_18x48x3.mdl")
    holoMaterial(Setup_HoloIndex, "spacebuild/sblight5")
    holoPos(Setup_HoloIndex, entity():toWorld(Offset + vec(0, 4.5, 0)))
    holoAng(Setup_HoloIndex, entity():toWorld(ang(90, 0, 0)))
    holoScale(Setup_HoloIndex, vec(1, 0.5, 0.25))
    holoParent(Setup_HoloIndex, Setup_HoloIndex - 1)
    Setup_HoloIndex++
    
    #Right Panel Rotator
    holoCreate(Setup_HoloIndex)
    holoPos(Setup_HoloIndex, entity():toWorld(Offset + vec(0, -9, 0)))
    holoAng(Setup_HoloIndex, entity():toWorld(ang(-90, 0, 0)))
    holoAlpha(Setup_HoloIndex, 0)
    holoParent(Setup_HoloIndex, entity())
    LGear_Doors:pushNumber(Setup_HoloIndex)
    Setup_HoloIndex++
    
    #Right Panel
    holoCreate(Setup_HoloIndex)
    holoModel(Setup_HoloIndex, "models/sprops/rectangles/size_2_5/rect_18x48x3.mdl")
    holoMaterial(Setup_HoloIndex, "spacebuild/sblight5")
    holoPos(Setup_HoloIndex, entity():toWorld(Offset + vec(0, -4.5, 0)))
    holoAng(Setup_HoloIndex, entity():toWorld(ang(90, 0, 0)))
    holoScale(Setup_HoloIndex, vec(1, 0.5, 0.25))
    holoParent(Setup_HoloIndex, Setup_HoloIndex - 1)
    Setup_HoloIndex++
    
    #Piston Rotator
    holoCreate(Setup_HoloIndex)
    holoPos(Setup_HoloIndex, entity():toWorld(Offset + vec(-10, 0, -21)))
    holoAng(Setup_HoloIndex, entity():toWorld(ang(-90, 0, 0)))
    holoAlpha(Setup_HoloIndex, 0)
    holoParent(Setup_HoloIndex, entity())
    LGear_GearAnchors:pushNumber(Setup_HoloIndex)
    LGear_WheelDists:pushNumber(LGear_WheelMaxDist)
    LGear_WheelOnGround:pushNumber(0)
    Setup_HoloIndex++
    
    #Main Piston Housing
    holoCreate(Setup_HoloIndex)
    holoModel(Setup_HoloIndex, "hqcylinder")
    holoMaterial(Setup_HoloIndex, "models/props_vents/borealis_vent001")
    holoPos(Setup_HoloIndex, entity():toWorld(Offset + vec(-10, 0, -8)))
    holoAng(Setup_HoloIndex, entity():toWorld(ang(0, 0, 0)))
    holoScaleUnits(Setup_HoloIndex, vec(3, 3, 25))
    holoParent(Setup_HoloIndex, Setup_HoloIndex - 1) #Parent to Anchor
    Setup_HoloIndex++
    
    #Main Piston Shaft
    holoCreate(Setup_HoloIndex)
    holoModel(Setup_HoloIndex, "hqcylinder")
    holoMaterial(Setup_HoloIndex, "phoenix_storms/fender_chrome")
    holoColor(Setup_HoloIndex, vec(128, 128, 128))
    holoPos(Setup_HoloIndex, entity():toWorld(Offset + vec(-10, 0, 8)))
    holoAng(Setup_HoloIndex, entity():toWorld(ang(0, 0, 0)))
    holoScaleUnits(Setup_HoloIndex, vec(2.5, 2.5, 15))
    holoParent(Setup_HoloIndex, Setup_HoloIndex - 2) #Parent to Anchor
    LGear_PistonShafts:pushNumber(Setup_HoloIndex)
    Setup_HoloIndex++
    
    #Axel
    holoCreate(Setup_HoloIndex)
    holoModel(Setup_HoloIndex, "hqcylinder")
    holoColor(Setup_HoloIndex, vec(128, 128, 128))
    holoMaterial(Setup_HoloIndex, "phoenix_storms/fender_chrome")
    holoPos(Setup_HoloIndex, entity():toWorld(Offset + vec(-10, 0, 16)))
    holoAng(Setup_HoloIndex, entity():toWorld(ang(0, 0, -90)))
    holoScaleUnits(Setup_HoloIndex, vec(2.5, 2.5, 8))
    holoParent(Setup_HoloIndex, Setup_HoloIndex - 1) #Parent to Shaft
    LGear_Axels:pushNumber(Setup_HoloIndex)
    Setup_HoloIndex++
    
    #Left Wheel
    holoCreate(Setup_HoloIndex)
    holoModel(Setup_HoloIndex, "models/sprops/trans/wheel_a/t_wheel15.mdl")
    holoPos(Setup_HoloIndex, entity():toWorld(Offset + vec(-10, 4, 16)))
    holoAng(Setup_HoloIndex, entity():toWorld(ang(0, 0, 0)))
    holoScale(Setup_HoloIndex, vec(1, 1, 1))
    holoParent(Setup_HoloIndex, Setup_HoloIndex - 1) #Parent to Axel
    Setup_HoloIndex++
    
    #Right Wheel
    holoCreate(Setup_HoloIndex)
    holoModel(Setup_HoloIndex, "models/sprops/trans/wheel_a/t_wheel15.mdl")
    holoPos(Setup_HoloIndex, entity():toWorld(Offset + vec(-10, -4, 16)))
    holoAng(Setup_HoloIndex, entity():toWorld(ang(0, 0, 0)))
    holoScale(Setup_HoloIndex, vec(1, 1, 1))
    holoParent(Setup_HoloIndex, Setup_HoloIndex - 2) #Parent to Axel
    Setup_HoloIndex++
}

function void createLargeGear(Offset:vector)
{
    #Base Assembly
    holoCreate(Setup_HoloIndex)
    holoModel(Setup_HoloIndex, "models/lt_c/sci_fi/support_beam_48.mdl")
    holoPos(Setup_HoloIndex, entity():toWorld(Offset + vec(-12, 0, 24)))
    holoAng(Setup_HoloIndex, entity():toWorld(ang(0, 0, 180)))
    holoColor(Setup_HoloIndex, vec(106, 106, 106))
    holoScaleUnits(Setup_HoloIndex, vec(12, 24, 48))
    holoParent(Setup_HoloIndex, entity())
    Setup_HoloIndex++
    
    #Left Panel Rotator
    holoCreate(Setup_HoloIndex)
    holoPos(Setup_HoloIndex, entity():toWorld(Offset + vec(0, 12, 0)))
    holoAng(Setup_HoloIndex, entity():toWorld(ang(90, 0, 0)))
    holoAlpha(Setup_HoloIndex, 0)
    holoParent(Setup_HoloIndex, entity())
    LGear_Doors:pushNumber(Setup_HoloIndex)
    LGear_WheelDists:pushNumber(LGear_WheelMaxDist)
    Setup_HoloIndex++
    
    #Left Panel
    holoCreate(Setup_HoloIndex)
    holoModel(Setup_HoloIndex, "models/sprops/rectangles/size_2/rect_12x48x3.mdl")
    holoMaterial(Setup_HoloIndex, "spacebuild/sblight5")
    holoPos(Setup_HoloIndex, entity():toWorld(Offset + vec(0, 6, 0)))
    holoAng(Setup_HoloIndex, entity():toWorld(ang(90, 0, 0)))
    holoScale(Setup_HoloIndex, vec(0.95, 1, 0.25))
    holoParent(Setup_HoloIndex, Setup_HoloIndex - 1)
    Setup_HoloIndex++
    
    #Right Panel Rotator
    holoCreate(Setup_HoloIndex)
    holoPos(Setup_HoloIndex, entity():toWorld(Offset + vec(0, -12, 0)))
    holoAng(Setup_HoloIndex, entity():toWorld(ang(-90, 0, 0)))
    holoAlpha(Setup_HoloIndex, 0)
    holoParent(Setup_HoloIndex, entity())
    LGear_Doors:pushNumber(Setup_HoloIndex)
    Setup_HoloIndex++
    
    #Right Panel
    holoCreate(Setup_HoloIndex)
    holoModel(Setup_HoloIndex, "models/sprops/rectangles/size_2/rect_12x48x3.mdl")
    holoMaterial(Setup_HoloIndex, "spacebuild/sblight5")
    holoPos(Setup_HoloIndex, entity():toWorld(Offset + vec(0, -6, 0)))
    holoAng(Setup_HoloIndex, entity():toWorld(ang(90, 0, 0)))
    holoScale(Setup_HoloIndex, vec(0.95, 1, 0.25))
    holoParent(Setup_HoloIndex, Setup_HoloIndex - 1)
    Setup_HoloIndex++
    
    #Piston Rotator
    holoCreate(Setup_HoloIndex)
    holoPos(Setup_HoloIndex, entity():toWorld(Offset + vec(-10, 0, 21)))
    holoAng(Setup_HoloIndex, entity():toWorld(ang(90, 0, 180)))
    holoAlpha(Setup_HoloIndex, 0)
    holoParent(Setup_HoloIndex, entity())
    LGear_GearAnchors:pushNumber(Setup_HoloIndex)
    Setup_HoloIndex++
    
    #Main Piston Housing
    holoCreate(Setup_HoloIndex)
    holoModel(Setup_HoloIndex, "hqcylinder")
    holoMaterial(Setup_HoloIndex, "models/props_vents/borealis_vent001")
    holoPos(Setup_HoloIndex, entity():toWorld(Offset + vec(-10, 0, 8)))
    holoAng(Setup_HoloIndex, entity():toWorld(ang(0, 0, 0)))
    holoScaleUnits(Setup_HoloIndex, vec(3, 3, 25))
    holoParent(Setup_HoloIndex, Setup_HoloIndex - 1) #Parent to Anchor
    Setup_HoloIndex++
    
    #Main Piston Shaft
    holoCreate(Setup_HoloIndex)
    holoModel(Setup_HoloIndex, "hqcylinder")
    holoMaterial(Setup_HoloIndex, "phoenix_storms/fender_chrome")
    holoColor(Setup_HoloIndex, vec(128, 128, 128))
    holoPos(Setup_HoloIndex, entity():toWorld(Offset + vec(-10, 0, -8)))
    holoAng(Setup_HoloIndex, entity():toWorld(ang(180, 0, 0)))
    holoScaleUnits(Setup_HoloIndex, vec(2.5, 2.5, 15))
    holoParent(Setup_HoloIndex, Setup_HoloIndex - 2) #Parent to Anchor
    LGear_PistonShafts:pushNumber(Setup_HoloIndex)
    LGear_FrontPiston = Setup_HoloIndex
    Setup_HoloIndex++
    
    #Axel
    holoCreate(Setup_HoloIndex)
    holoModel(Setup_HoloIndex, "hqcylinder")
    holoColor(Setup_HoloIndex, vec(128, 128, 128))
    holoMaterial(Setup_HoloIndex, "phoenix_storms/fender_chrome")
    holoPos(Setup_HoloIndex, entity():toWorld(Offset + vec(-10, 0, -16)))
    holoAng(Setup_HoloIndex, entity():toWorld(ang(0, 0, -90)))
    holoScaleUnits(Setup_HoloIndex, vec(2.5, 2.5, 8))
    holoParent(Setup_HoloIndex, Setup_HoloIndex - 1) #Parent to Shaft
    LGear_Axels:pushNumber(Setup_HoloIndex)
    Setup_HoloIndex++
    
    #Left Wheel
    holoCreate(Setup_HoloIndex)
    holoModel(Setup_HoloIndex, "models/sprops/trans/wheel_a/t_wheel15.mdl")
    holoPos(Setup_HoloIndex, entity():toWorld(Offset + vec(-10, 4, -16)))
    holoAng(Setup_HoloIndex, entity():toWorld(ang(0, 0, 0)))
    holoScale(Setup_HoloIndex, vec(1, 1, 1))
    holoParent(Setup_HoloIndex, Setup_HoloIndex - 1) #Parent to Axel
    Setup_HoloIndex++
    
    #Right Wheel
    holoCreate(Setup_HoloIndex)
    holoModel(Setup_HoloIndex, "models/sprops/trans/wheel_a/t_wheel15.mdl")
    holoPos(Setup_HoloIndex, entity():toWorld(Offset + vec(-10, -4, -16)))
    holoAng(Setup_HoloIndex, entity():toWorld(ang(0, 0, 0)))
    holoScale(Setup_HoloIndex, vec(1, 1, 1))
    holoParent(Setup_HoloIndex, Setup_HoloIndex - 2) #Parent to Axel
    Setup_HoloIndex++
}

function void setupHullHolos()
{
    #Front Intake Vent
    holoCreate(Setup_HoloIndex)
    holoModel(Setup_HoloIndex, "models/slyfo_2/protorover_eng_sf2m.mdl")
    holoPos(Setup_HoloIndex, entity():toWorld(vec(0, 0, 42)))
    holoAng(Setup_HoloIndex, entity():toWorld(ang(-90, 0, 0)))
    holoScale(Setup_HoloIndex, vec(0.65, 0.85, 0.65))
    holoParent(Setup_HoloIndex, entity())
    Setup_HoloIndex++
    
    #Front Right VTOL Thruster
    holoCreate(Setup_HoloIndex)
    holoModel(Setup_HoloIndex, "models/slyfo_2/protorover_eng_sf2m.mdl")
    holoPos(Setup_HoloIndex, entity():toWorld(vec(6, -40, -120)))
    holoAng(Setup_HoloIndex, entity():toWorld(ang(0, -15, 90)))
    holoScale(Setup_HoloIndex, vec(0.35, 2, 0.8))
    holoParent(Setup_HoloIndex, entity())
    Setup_HoloIndex++
    
    #Front Left VTOL Thruster
    holoCreate(Setup_HoloIndex)
    holoModel(Setup_HoloIndex, "models/slyfo_2/protorover_eng_sf2m.mdl")
    holoPos(Setup_HoloIndex, entity():toWorld(vec(6, 40, -120)))
    holoAng(Setup_HoloIndex, entity():toWorld(ang(0, 15, -90)))
    holoScale(Setup_HoloIndex, vec(0.35, 2, 0.8))
    holoParent(Setup_HoloIndex, entity())
    Setup_HoloIndex++
    
    #Back Right VTOL Thruster
    holoCreate(Setup_HoloIndex)
    holoModel(Setup_HoloIndex, "models/slyfo_2/protorover_eng_sf2m.mdl")
    holoPos(Setup_HoloIndex, entity():toWorld(vec(0, -32, -405)))
    holoAng(Setup_HoloIndex, entity():toWorld(ang(0, -30, 90)))
    holoScale(Setup_HoloIndex, vec(0.5, 1.5, 0.8))
    holoParent(Setup_HoloIndex, entity())
    Setup_HoloIndex++
    
    #Back Left VTOL Thruster
    holoCreate(Setup_HoloIndex)
    holoModel(Setup_HoloIndex, "models/slyfo_2/protorover_eng_sf2m.mdl")
    holoPos(Setup_HoloIndex, entity():toWorld(vec(0, 32, -405)))
    holoAng(Setup_HoloIndex, entity():toWorld(ang(0, 30, -90)))
    holoScale(Setup_HoloIndex, vec(0.5, 1.5, 0.8))
    holoParent(Setup_HoloIndex, entity())
    Setup_HoloIndex++
    
    print("Hull Holos Created.")
    print("Setup Complete!")
    Setup_Complete = 1
}

function void setupLandingGear()
{
    #Landing Gear
    createSmallGear(vec(29.3, -15, -337.2))
    createSmallGear(vec(29.3, 15, -337.2))
    createLargeGear(vec(29.3, 0, -98.5))
    
    print("Landing Gear Created.")
    
    timer(1000, 1, "Setup Hull Holos", "setupHullHolos()")
}

function void landingGearThink(Delta)
{
    local GearPoints = array()
    
    #Animate Landing Gear
    for(Index = 1, LGear_GearAnchors:count())
    {
        #Do gear hydraulics
        local AnchorEnt = holoEntity(LGear_GearAnchors[Index,number])
        local DownTrace = rangerOffset(LGear_WheelMaxDist, AnchorEnt:pos(), AnchorEnt:forward())
        local Dist = clamp(DownTrace:distance() - 0.5, 0, LGear_WheelMaxDist)
        local Diff = Dist - LGear_WheelDists[Index,number]
        local Shaft = LGear_PistonShafts[Index,number]
        holoPos(Shaft, holoEntity(Shaft):toWorld(vec(0, 0, Diff)))
        LGear_WheelDists[Index,number] = Dist
        
        #Wheel Rolling
        if(DownTrace:hit())
        {
            if(DownTrace:distance() < LGear_WheelMaxDist)
            {
                local Piston = LGear_PistonShafts[Index,number]
                local Axel = LGear_Axels[Index,number]
                local PistonEnt = holoEntity(Piston)
                local AxelEnt = holoEntity(Axel)
                
                #Just contacted?
                if(!LGear_WheelOnGround[Index,number])
                {
                    LGear_WheelOnGround[Index,number] = 1
                    LGear_AxelLastPos[Index,vector] = AxelEnt:pos()
                }
                
                local PosDiff = PistonEnt:toLocal(LGear_AxelLastPos[Index,vector]) - PistonEnt:toLocal(AxelEnt:pos())
                local Vel = PosDiff:x() / Delta
                local AngVel = (Vel / LGear_WheelCircum) / 2
                
                LGear_AxelLastPos[Index,vector] = AxelEnt:pos()
                
                holoAng(Axel, AxelEnt:toWorld(ang(0, toDeg(AngVel), 0)))
            }
        }
        else
        {
            LGear_WheelOnGround[Index,number] = 0
        }
            
        GearPoints:pushVector(DownTrace:pos())
    }
    
    generateLGearPlane(GearPoints)
}

#--End of Gear/Engine Holos--


#------------------------
# CANOPY FUNCTIONS
#------------------------

#Animation Loop
function void animateCanopy(Open)
{
    local Finished = 0
    Canopy_InAnim = 1
    
    #Opening Animation
    if(Open)
    {
        #Play Sound and Start Anim
        if(Canopy_CurHeight == 0)
        {
            #Play Sound
            Canopy_ParentEnt:soundPlay("Pressure Release Up", 2.4, "ambient/machines/steam_release_2.wav")
            soundPitch("Pressure Release Up", 150)
        }
        
        #Slide Up
        if(Canopy_CurHeight < Canopy_MaxHeight)
        {
            local SlideSpeed = Canopy_SlideSpeed_Vert * 0.05
            if(Canopy_CurHeight + SlideSpeed > Canopy_MaxHeight)
            {
                SlideSpeed = Canopy_MaxHeight - Canopy_CurHeight
            }
            
            holoPos(Canopy_ParentIndex, holoEntity(Canopy_ParentIndex):toWorld(vec(-SlideSpeed, 0, 0)))
            Canopy_CurHeight += SlideSpeed
            
            #Finished Sliding
            if(Canopy_CurHeight == Canopy_MaxHeight)
            {
                Canopy_RestartTime = curtime() + Canopy_SlideDelay
            }
        }
        #Slide Forward After Delay
        elseif(curtime() > Canopy_RestartTime)
        {
            #Play Sound
            if(Canopy_CurSlide == 0)
            {
                #Play Sound
                Canopy_ParentEnt:soundPlay("Canopy Slide Forward", 2.5, "plats/elevator_door_open_01.wav")
            }
            
            local SlideSpeed = Canopy_SlideSpeed_Hori * 0.05
            if(Canopy_CurSlide + SlideSpeed > Canopy_MaxSlide)
            {
                SlideSpeed = Canopy_MaxSlide - Canopy_CurSlide
            }
            
            holoPos(Canopy_ParentIndex, holoEntity(Canopy_ParentIndex):toWorld(vec(0, 0, SlideSpeed)))
            Canopy_CurSlide += SlideSpeed
        }
        
        if(Canopy_CurSlide == Canopy_MaxSlide && Canopy_CurHeight == Canopy_MaxHeight)
        {
            Finished = 1
            Canopy_InAnim = 0
        }
    }
    #Closing Animation
    else
    {
        #Play Sound and Start Anim
        if(Canopy_CurSlide == Canopy_MaxSlide)
        {
            #Play Sound
            Canopy_ParentEnt:soundPlay("Canopy Slide Back", 2.75, "plats/elevator_door_close_01.wav")
            soundPitch("Canopy Slide Back", 85)
        }
        
        #Slide Back
        if(Canopy_CurSlide > 0)
        {
            local SlideSpeed = Canopy_SlideSpeed_Hori * 0.05
            if(Canopy_CurSlide - SlideSpeed < 0)
            {
                SlideSpeed = Canopy_CurSlide
            }
            
            holoPos(Canopy_ParentIndex, holoEntity(Canopy_ParentIndex):toWorld(vec(0, 0, -SlideSpeed)))
            Canopy_CurSlide -= SlideSpeed
            
            #Finished Sliding
            if(Canopy_CurSlide == 0)
            {
                Canopy_RestartTime = curtime() + Canopy_SlideDelay
            }
        }
        #Slide back Down after Delay
        elseif(curtime() > Canopy_RestartTime)
        {
            #Play Sound
            if(Canopy_CurHeight == Canopy_MaxHeight)
            {
                #Play Sound
                Canopy_ParentEnt:soundPlay("Pressure Seal", 1.1, "plats/door_round_blue_close_01.wav")
            }
            
            local SlideSpeed = Canopy_SlideSpeed_Vert * 0.05
            if(Canopy_CurHeight - SlideSpeed < 0)
            {
                SlideSpeed = Canopy_CurHeight
            }
            
            holoPos(Canopy_ParentIndex, holoEntity(Canopy_ParentIndex):toWorld(vec(SlideSpeed, 0, 0)))
            Canopy_CurHeight -= SlideSpeed
        }
        
        if(Canopy_CurSlide == 0 && Canopy_CurHeight == 0)
        {
            Finished = 1
            Canopy_InAnim = 0
        }
    }
    
    if(!Finished)
    {
        timer(50, 1, "Cockpit Animation", "animateCanopy(n)", Open)
    }
}

#Toggle Canopy Solidity/Animation
function void toggleCanopy(Toggle)
{
    for(Index = 1, CanopyEnts:count())
    {
        local Ent = CanopyEnts[Index,entity]
        
        if(Ent:type() != "detail_prop") #Detail props have weird physics when solid, ignore
        {
            Ent:setSolid(!Toggle)
        }
    }
    
    animateCanopy(Toggle)
}

#Create Canopy Holos
function void constructCanopy()
{
    local Finished = 0
    while(perf(70) && holoCanCreate() && !Finished)
    {
        local Part = CanopyEnts[Setup_Index, entity]
        
        holoCreate(Setup_HoloIndex)
        holoModel(Setup_HoloIndex, Part:model())
        holoMaterial(Setup_HoloIndex, Part:getMaterial())
        holoColor(Setup_HoloIndex, Part:getColor())
        holoPos(Setup_HoloIndex, Part:pos())
        holoAng(Setup_HoloIndex, Part:angles())
        holoParent(Setup_HoloIndex, Canopy_ParentEnt)
        
        #Window?
        if(Part:getMaterial() == "models/debug/debugwhite" && Part:getColor() == vec(0, 0, 0))
        {
            holoAlpha(Setup_HoloIndex, 192)
            holoEntity(Setup_HoloIndex):setRenderMode(9) #9 = WorldGlow
            
            #Scale to flat
            if(Part:model():find("rtri"))
            {
                holoScale(Setup_HoloIndex, vec(1, 0.01, 1))
            }
            else
            {
                holoScale(Setup_HoloIndex, vec(1, 1, 0.01))
            }
        }
        
        Setup_HoloIndex++
        
        Part:setAlpha(0)
        
        Setup_Index++
        if(Setup_Index > CanopyEnts:count())
        {
            Finished = 1
            break
        }
    }
    
    if(!Finished)
    {
        timer(5, 1, "Construct Canopy", "constructCanopy()")
    }
    else
    {
        print("Canopy Constructed")
        
        timer(1000, 1, "Construct Landing Gear", "setupLandingGear()")
    }
}

#Create parent holo and start creation loop for canopy
function void initCanopy()
{
    Setup_HoloIndex = 1
    
    holoCreate(Setup_HoloIndex)
    holoPos(Setup_HoloIndex, entity():pos())
    holoParent(Setup_HoloIndex, entity())
    holoAlpha(Setup_HoloIndex, 0)
    
    Canopy_ParentIndex = Setup_HoloIndex
    Canopy_ParentEnt = holoEntity(Setup_HoloIndex)
    
    Setup_HoloIndex++
    
    timer(5, 1, "Construct Canopy", "constructCanopy()")
}

#Glass Worldglow-ify
function void worldglowGlass()
{
    local Finished = 0
    while(perf(70) && !Finished)
    {
        local Part = Parts[Setup_Index, entity]
        
        #Check if this is a window (DebugWhite + Transparent)
        if(Part:getMaterial() == "models/debug/debugwhite" && Part:getColor() == vec(0, 0, 0))
        {
            Part:setRenderMode(9) #9 = Worldglow
        }
        
        Setup_Index++
        if(Setup_Index > Parts:count())
        {
            Finished = 1
            break
        }
    }
    
    if(!Finished)
    {
        timer(5, 1, "Worldglow Glass", "worldglowGlass()")
    }
    else
    {
        print("Glass Worldglowed.")
        
        Setup_Index = 1
        initCanopy()
    }
}

#--End Canopy Functions--


#------------------------
# FLIGHT FUNCTIONS
#------------------------

function void toggleGravity(Toggle)
{
    for(Index = 1, Parts:count())
    {
        local Part = Parts[Index,entity]
        Part:sbSetDragOverride(!Toggle)
        Part:sbSetGravityOverride(!Toggle)
        Part:propGravity(Toggle)
        Part:propDrag(Toggle)
    }
}

function void toggleFreeze(Freeze)
{
    #--Block unparented ship from unfreezing
    if(!Freeze && !entity():parent())
    {
        print("Cannot unfreeze! Ship not parented!")
        return
    }
    
    for(Index = 1, Parts:count())
    {
        Parts[Index,entity]:propFreeze(Freeze)
    }
}

function void toggleEngine(Toggle)
{
    
}

function void toggleVTOL(VTOL)
{
    
}

function void applyFlightForce(Force:vector, Torque:vector)
{
    Parent:applyForce(Force * Parent:mass())
    Parent:applyTorque(Torque * Parent:inertia())
}

function void applyFlightCalcs(Force:vector, AngVel:angle)
{
    Parent:applyForce(Force * Parent:mass())
    Parent:setAngVel(ang(AngVel:roll(), AngVel:pitch(), AngVel:yaw())) #What the fuck even...
}

#Movement calcs go here
function void flightThink(Delta)
{
    #Check to Ground
    local TracePos = Parent:toWorld(vec(0, 0, -Parent:boxSize():z() * 0.6))
    local GroundTrace = rangerOffset(1000, TracePos, vec(0, 0, -1))
    GroundDist = GroundTrace:distance()
    
    #Toggle Gear and enter VTOL if near the ground
    if(GroundTrace:hit() && GroundTrace:entity():getCoreEnt() != entity():getCoreEnt())
    {
        toggleGear(1)
    }
    else
    {
        toggleGear(0)
    }
    
    #------------------------------
    # FLIGHT CALCULATIONS
    #------------------------------
    local ForceVec = vec()
    local TorqueVec = vec()
    local CurSpeed = Parent:vel()
    local CurSpeedLocal = Parent:velL()
    local CurAngSpeed = Parent:angVelVector()
    
    local CurQuat = quat(Parent)
    local TargetQuat = quat(Parent)
    local PitchQuat = quat(1)
    local YawQuat = quat(1)
    local RollQuat = quat(1)
    
    local CurAng = Parent:angles()
    local TargetAng = ang(0, Parent:angles():yaw(), 0)
    
    #--Shared Behavior between Ground and VTOL modes
    if(Flight_State == FLIGHT_STATE_GROUND || Flight_State == FLIGHT_STATE_VTOL)
    {
        #Make sure engine effects are on
        if(!VTOLFXToggle) { VTOLFXToggle = 1 }
        
        #--Up
        if(Key_Up)
        {
            if(CurSpeedLocal:z() < VTOL_UpSpeed)
            {
                ForceVec += Parent:up() * (VTOL_Accel + VTOL_Decel) * Delta
            }
            
            Effects["VTOLThrottle", number] = 1.0
        }
        #--Let Gravity take us Down
        elseif(CurSpeed:z() > -VTOL_Gravity && GroundDist < 350)
        {
            #Landing Gear Piston Check
            local MaxDist = LGear_WheelMaxDist - 17
            if(GroundDist < MaxDist)
            {
                local Fraction = max(MaxDist - GroundDist, 0)
                local PistonForce = VTOL_Gravity - (VTOL_Gravity * Fraction)
                ForceVec -= vec(0, 0, PistonForce * Delta)
            }
            #Drop Normally
            else
            {
                ForceVec -= vec(0, 0, (VTOL_Gravity + VTOL_Decel) * Delta)
            }
        }
    }
    
    #--Taxi
    if(Flight_State == FLIGHT_STATE_GROUND)
    {
        if(!Key_Up) { Effects["VTOLThrottle", number] = 0 }
        
        #--Decelerate
        local Vel = CurSpeed:length()
        local Dir = CurSpeed:normalized()
        ForceVec += -Dir * clamp(Vel, -Ground_Decel * Delta, Ground_Decel * Delta)
        
        #--Angle to Ground
        local GroundNrm = LGear_GroundPlaneNormal:cross(Parent:forward()):normalized():cross(LGear_GroundPlaneNormal)
        local GroundQuat = quat(GroundNrm, LGear_GroundPlaneNormal)
        local GroundAng = GroundQuat:toAngle()
        TargetAng = TargetAng:setPitch(GroundAng:pitch()):setRoll(GroundAng:roll())
        
        #--State Switch
        if(GroundDist > LGear_WheelMaxDist)
        {
            Flight_State = FLIGHT_STATE_VTOL
        }
        
        #--Forward
        if(Key_Forward)
        {
            if(CurSpeedLocal:x() < Ground_ForwardSpeed)
            {
                ForceVec += Parent:forward() * (Ground_Accel + VTOL_Decel) * Delta
            }
        }
        
        #--Back
        elseif(Key_Back)
        {
            if(CurSpeedLocal:x() > -Ground_BackSpeed)
            {
                ForceVec -= Parent:forward() * (Ground_Accel + VTOL_Decel) * Delta
            }
        }
        
        #--Braking anims
        else
        {
            #Forward Brake
            if(CurSpeedLocal:x() > 1)
            {
                TargetAng = TargetAng:setPitch(TargetAng:pitch() + Ground_DecelKick)
            }
            #Reverse Brake
            elseif(CurSpeedLocal:x() < -1)
            {
                TargetAng = TargetAng:setPitch(TargetAng:pitch() - Ground_AccelKick)
            }
        }
        
        
        #---------
        # TURNING
        #---------
        local Offset = 0
        #--Left
        if(Key_Left)
        {
            Offset = -35 - LGear_FrontWheelAng
        }
        #--Right
        elseif(Key_Right)
        {
            Offset = 35 - LGear_FrontWheelAng
        }
        #--Return
        else
        {
            Offset = -LGear_FrontWheelAng
        }
        Offset = clamp(Offset, -Ground_WheelRotateRate, Ground_WheelRotateRate) * Delta
        
        local YawSpeed = -Ground_TurnRate * (LGear_FrontWheelAng / 35)
        YawSpeed *= CurSpeedLocal:x() / Ground_ForwardSpeed
        
        TargetAng = TargetAng:setYaw(TargetAng:yaw() + YawSpeed)
        
        #Angle Front Gear
        holoAng(LGear_FrontPiston, holoEntity(LGear_FrontPiston):toWorld(ang(0, Offset, 0)))
        
        LGear_FrontWheelAng += Offset
    }
    
    
    #--VTOL Mode
    elseif(Flight_State == FLIGHT_STATE_VTOL)
    {
        #--Decelerate
        local Vel = CurSpeed:length()
        local Dir = CurSpeed:normalized()
        ForceVec += -Dir * clamp(Vel, -VTOL_Decel * Delta, VTOL_Decel * Delta)
        
        #--State Switch
        if(GroundDist < LGear_WheelMaxDist)
        {
            Flight_State = FLIGHT_STATE_GROUND
        }
            
        #Reset Front Gear
        holoAng(LGear_FrontPiston, holoEntity(LGear_FrontPiston):toWorld(ang(0, -LGear_FrontWheelAng, 0)))
        LGear_FrontWheelAng = 0
        
        #--Up (Up-force calculated in shared, this is just for effects)
        if(Key_Up)
        {
            Effects["VTOLThrottle", number] = 1.0
        }
        
        #--Down
        elseif(Key_Down)
        {
            if(CurSpeedLocal:z() > -VTOL_DownSpeed)
            {
                ForceVec -= Parent:up() * (VTOL_Accel + VTOL_Decel) * Delta
            }
            
            Effects["VTOLThrottle", number] = 0.35
        }
        else
        {
            Effects["VTOLThrottle", number] = 0.5
        }
        
        #--Forward
        if(Key_Forward)
        {
            if(CurSpeedLocal:x() < VTOL_MaxSpeed)
            {
                ForceVec += Parent:forward() * (VTOL_Accel + VTOL_Decel) * Delta
            }
            
            TargetAng = TargetAng:setPitch(VTOL_MaxBank)
        }
        
        #--Back
        elseif(Key_Back)
        {
            if(CurSpeedLocal:x() > -VTOL_MaxSpeed)
            {
                ForceVec -= Parent:forward() * (VTOL_Accel + VTOL_Decel) * Delta
            }
            
            TargetAng = TargetAng:setPitch(-VTOL_MaxBank)
        }
        
        #--Pan Right
        if(Key_Right)
        {
            if(CurSpeedLocal:y() > -VTOL_MaxSpeed)
            {
                ForceVec += Parent:right() * (VTOL_Accel + VTOL_Decel) * Delta
            }
            
            TargetAng = TargetAng:setRoll(VTOL_MaxBank)
        }
        
        #--Pan Left
        elseif(Key_Left)
        {
            if(CurSpeedLocal:y() < VTOL_MaxSpeed)
            {
                ForceVec -= Parent:right() * (VTOL_Accel + VTOL_Decel) * Delta
            }
            
            TargetAng = TargetAng:setRoll(-VTOL_MaxBank)
        }
        
        #--Mouse Yaw
        YawMult = clamp(Mouse_Offset:yaw() / 45, -1, 1)
        YawSpeed = VTOL_YawSpeed * YawMult
        
        TargetAng = TargetAng:setYaw(TargetAng:yaw() + YawSpeed)
    }
    
    
    #--Flight Mode
    elseif(Flight_State == FLIGHT_STATE_FREE)
    {
        #--Decelerate
        local Vel = CurSpeed:length()
        local Dir = CurSpeed:normalized()
        ForceVec += -Dir * clamp(Vel, -Flight_Decel * Delta, Flight_Decel * Delta)
    }
    
    
    #Apply Calculations
    PitchQuat = qRotation(quat(1):right(), CurAng:pitch() - TargetAng:pitch())
    YawQuat = qRotation(quat(1):up(), TargetAng:yaw() - CurAng:yaw())
    RollQuat = qRotation(quat(1):forward(), TargetAng:roll() - CurAng:roll())
    
    TargetQuat = (PitchQuat * YawQuat * RollQuat) * TargetQuat
    
    DiffQuat = TargetQuat/CurQuat
    DiffQuatAng = DiffQuat:toAngle()
    applyFlightCalcs(ForceVec, DiffQuat:toAngle())
    
    #--End of Flight Calculations--
}

#--End Flight Functions--

#---------------------
# THINK LOOP
#---------------------
function void think()
{
    Offset = entity():toLocal(owner():pos())
    local Delta = systime() - LastFrame
    
    #Resync Ranger Filters
    local Filter = players()
    Filter:pushEntity(Parent)
    rangerFilter(Filter)
    rangerPersist(1)
    
    if(Setup_Complete)
    {
        #Update Input
        Key_Forward = PilotPod["W",number]
        Key_Back = PilotPod["S",number]
        Key_Left = PilotPod["A",number]
        Key_Right = PilotPod["D",number]
        Key_Up = PilotPod["Space",number]
        Key_Down = PilotPod["Shift",number]
        
        local Pod = PilotPod["Entity",entity]
        local Driver = Pod:driver()
        if(Driver:isValid())
        {
            Mouse_Offset = Pod:toLocal(Driver:eyeAngles())
        }
        else
        {
            Mouse_Offset = ang()
        }
        
        landingGearThink(Delta)
        flightThink(Delta)
    }
    
    LastFrame = systime()
}
#--End of Think Loop--

} #--End of Program Header


#------------------------
# WIRE TRIGGERS
#------------------------
if(inputClk())
{
    if(~CanopyToggle)
    {
        toggleCanopy(CanopyToggle)
    }
}
#--End of Wire Triggers--


#--REMOVEME: Temporary chat commands for testing.
if(chatClk(owner()))
{
    if(lastSaid():lower() == "!reset")
    {
        hideChat(1)
        entity():remoteUpload("garuda_-_fighter_control.txt")
    }
    
    if(lastSaid():lower() == "!freeze")
    {
        hideChat(1)
        toggleFreeze(1)
    }
    
    if(lastSaid():lower() == "!unfreeze")
    {
        hideChat(1)
        toggleFreeze(0)
    }
    
    if(lastSaid():lower() == "!gravityon")
    {
        hideChat(1)
        toggleGravity(1)
    }
    
    if(lastSaid():lower() == "!gravityoff")
    {
        hideChat(1)
        toggleGravity(0)
    }
}


#-----------------------
# PROGRAM ENTRY POINT
#-----------------------
if(dupefinished()) { reset() }
elseif(first())
{
    holoDeleteAll() #For resets
    Parts = entity():getConstraints()
    Parent = entity():isConstrainedTo()
    
    #Setup
    PilotPod["Crosshairs",number] = 1
    CopilotPod["Crosshairs",number] = 1
    PilotPod["Allow Buttons",number] = 1
    CopilotPod["Allow Buttons",number] = 1
    worldglowGlass()
    
    timer("Think", 50)
}

if(clk("Think"))
{
    think()
    timer("Think", 50)
}

It’s just functions. It can probably create some holos or what not.
But the created stuff won’t function.
Don’t know m8. Why even ask