@name Jetpack
@inputs Pod:wirelink [Body Prop T1 T2]:entity 
@outputs On 
@persist State 
@trigger 
interval(50)

if (first()) {
    Body:setAlpha(0)
    
    holoCreate(1)
    holoModel(1,"models/thrusters/jetpack.mdl")
    holoPos(1,Body:toWorld(vec(-13,0,51)))
    holoAng(1,Body:toWorld(ang(0,180,0)))
    holoParent(1,Body)
    
    holoCreate(2)
    holoModel(2,"models/sprops/misc/fittings/cred_6_3_tall.mdl")
    holoPos(2,Body:toWorld(vec(-13,2,42)))
    holoAng(2,Body:toWorld(ang(0,0,180)))
    holoScale(2,vec(0.5,0.5,0.5))
    holoParent(2,Body)
    
    holoCreate(3)
    holoModel(3,"models/sprops/misc/fittings/cred_6_3_tall.mdl")
    holoPos(3,Body:toWorld(vec(-13,-3.2,42)))
    holoAng(3,Body:toWorld(ang(0,0,180)))
    holoScale(3,vec(0.5,0.5,0.5))
    holoParent(3,Body)
    
    holoCreate(4)
    holoModel(4,"models/xqm/jettailpiece1.mdl")
    holoPos(4,Body:toWorld(vec(-13,-16,48.5)))
    holoAng(4,Body:toWorld(ang(180,0,90)))
    holoScale(4,vec(0.8,0.8,1))
    holoParent(4,Body)
    
    holoCreate(5)
    holoModel(5,"models/weapons/w_missile_closed.mdl")
    holoPos(5,Body:toWorld(vec(-13,-34,39)))
    holoAng(5,Body:toWorld(ang(-90,0,0)))
    holoScale(5,vec(0.8,0.8,0.8))
    holoParent(5,4)
    
    holoCreate(6)
    holoModel(6,"models/xqm/jettailpiece1.mdl")
    holoPos(6,Body:toWorld(vec(-13,16,48)))
    holoAng(6,Body:toWorld(ang(180,180,90)))
    holoScale(6,vec(0.8,0.8,1))
    holoParent(6,Body)
    
    holoCreate(7)
    holoModel(7,"models/weapons/w_missile_closed.mdl")
    holoPos(7,Body:toWorld(vec(-13,34,39)))
    holoAng(7,Body:toWorld(ang(-90,0,0)))
    holoScale(7,vec(0.8,0.8,0.8))
    holoParent(7,6)
    
    for (I = 2,7) {holoMaterial(I,"sprops/textures/sprops_metal1")}
    
    T1:setAlpha(0)
    T2:setAlpha(0)
    
    T1:parentTo(holoEntity(5))
    T1:parentTo(holoEntity(7))
}

local Seat = Pod["Entity",entity]
local Driver = Seat:driver()
local W = Driver:keyForward()
local A = Driver:keyLeft()
local S = Driver:keyBack()
local D = Driver:keyRight()
local R = Driver:keyReload()
local Mouse1 = Driver:keyAttack1()
local Mouse2 = Driver:keyAttack2()
local Shift = Driver:keySprint()
local Active = Driver:isPlayer()

if(Active & changed(R) & R) {if(State == 0) {State = 1} else {State = 0}}

if (State == 1) {
    On = 1
    
    Body:applyForce(Prop:toWorld(Prop:up()*Body:mass()*10))
}

if (State == 0) {
    On = 0
}
