@name VTOLY Cockpit
@inputs Seat:wirelink Pod:wirelink
@outputs 
@persist 
@trigger 
interval(66)

E = Seat:entity()

if(first()|dupefinished()){
    # parent holo
    holoCreate(1)
    holoParent(1,E)
    holoPos(1,E:toWorld(vec(-4,-16,-2)))
    holoAng(1,E:toWorld(ang(0,0,-30)))
    holoAlpha(1,0)
    
    #joyStick
    holoCreate(2)
    holoParent(2,1)
    holoPos(2,holoEntity(1):toWorld(vec(15,18,20)))
    holoScale(2,vec(0.3))
    holoModel(2,"hq_sphere")
    holoColor(2,vec(72))
    holoMaterial(2,"wtp/metal_2")
    
    #grip
    holoCreate(3)
    holoParent(3,2)
    holoPos(3,holoEntity(2):toWorld(vec(0,0,3)))
    holoAng(3,holoEntity(2):toWorld(ang(-75,90,0)))
    holoScale(3,vec(0.65))
    holoModel(3,"models/sprops/misc/fittings/bend_long_45_3.mdl")
    holoColor(3,vec(72))
    holoMaterial(3,"wtp/metal_2")
    
    holoCreate(4)
    holoParent(4,2)
    holoPos(4,holoEntity(2):toWorld(vec(0,2,6.4)))
    holoAng(4,holoEntity(2):toWorld(ang(220,90,0)))
    holoScale(4,vec(0.65))
    holoModel(4,"models/sprops/misc/fittings/cubinder_3_to_3.mdl")
    holoColor(4,vec(72))
    holoMaterial(4,"wtp/metal_2")

    #button base
    holoCreate(5)
    holoParent(5,2)
    holoPos(5,holoEntity(2):toWorld(vec(0,2.67,7.2)))
    holoAng(5,holoEntity(2):toWorld(ang(220,90,0)))
    holoScale(5,vec(0.165))
    holoModel(5,"hq_rcube_thin")
    holoColor(5,vec(72))
    holoMaterial(5,"wtp/metal_2")
    
    #L button
    holoCreate(6)
    holoParent(6,5)
    holoPos(6,holoEntity(5):toWorld(vec(0.95,0.65,-0.5)))
    holoAng(6,holoEntity(5):toWorld(ang(90,0,0)))
    holoScale(6,vec(0.035))
    holoModel(6,"hq_cylinder")
    holoColor(6,vec(180,0,0))
    
    #R button
    holoCreate(7)
    holoParent(7,5)
    holoPos(7,holoEntity(5):toWorld(vec(0.95,-0.65,-0.5)))
    holoAng(7,holoEntity(5):toWorld(ang(90,0,0)))
    holoScale(7,vec(0.035))
    holoModel(7,"hq_cylinder")
    holoColor(7,vec(180,0,0))
    
    #joystick board
    holoCreate(8)
    holoParent(8,1)
    holoPos(8,holoEntity(1):toWorld(vec(15,10,18)))
    holoAng(8,holoEntity(1):toWorld(ang(0,0,0)))
    holoScale(8,vec(0.45,2.0,0.25))
    holoModel(8,"hq_rcube_thin")
    holoColor(8,vec(120))
    holoMaterial(8,"wtp/metal_2")

    #joystick board leather thing
    holoCreate(9)
    holoParent(9,1)
    holoPos(9,holoEntity(1):toWorld(vec(15,8,18.1)))
    holoAng(9,holoEntity(1):toWorld(ang(0,0,0)))
    holoScale(9,vec(0.425,1.25,0.25))
    holoModel(9,"hq_rcube_thin")
    holoColor(9,vec(120,80,20))
    holoMaterial(9,"wtp/leather_2")
    
    #joystick board
    holoCreate(10)
    holoParent(10,1)
    holoPos(10,holoEntity(1):toWorld(vec(-7,10,18)))
    holoAng(10,holoEntity(1):toWorld(ang(0,0,0)))
    holoScale(10,vec(0.45,2.0,0.25))
    holoModel(10,"hq_rcube_thin")
    holoColor(10,vec(120))
    holoMaterial(10,"wtp/metal_2")
    
    #joystick board leather thing
    holoCreate(11)
    holoParent(11,1)
    holoPos(11,holoEntity(1):toWorld(vec(-7,8,18.1)))
    holoAng(11,holoEntity(1):toWorld(ang(0,0,0)))
    holoScale(11,vec(0.425,1.25,0.25))
    holoModel(11,"hq_rcube_thin")
    holoColor(11,vec(120,80,20))
    holoMaterial(11,"wtp/leather_2")
}

local Seat2 = Pod["Entity",entity]
local Driver = Seat2:driver()
local W = Driver:keyForward()
local A = Driver:keyLeft()
local S = Driver:keyBack()
local D = Driver:keyRight()
local Shift = Driver:keySprint()
local M1 = Driver:keyAttack1()
local M2 = Driver:keyAttack2()
if(D){X_Ang=15}
elseif(A)
{X_Ang=-15}else{X_Ang=0}
if(W){Z_Ang=-15}
elseif(S)
{Z_Ang=15}else{Z_Ang=0}

holoAng(2,holoEntity(1):toWorld(ang(0+X_Ang,0,0+Z_Ang)))
