@name MiniShip v2
@inputs Pod:wirelink Seat:entity
@outputs CamPos:vector CamAng:angle
@persist E:entity
@trigger 
if(first()) {
    runOnTick(1)
    
    E = entity()

    holoCreate(-1)
    holoAlpha(-1, 0)
    
    holoCreate(1)
    holoModel(1, "hqcylinder2")
    holoScale(1, vec(0.1,0.1,0.5))
    holoPos(1, E:toWorld(vec(-2,-1.5,0)))
    holoAng(1, E:toWorld(ang(90,0,0)))
    holoParent(1, -1)
    
    holoCreate(2)
    holoModel(2, "hqcylinder2")
    holoScale(2, vec(0.1,0.1,0.5))
    holoPos(2, E:toWorld(vec(-2,1.5,0)))
    holoAng(2, E:toWorld(ang(90,0,0)))
    holoParent(2, -1)
    
    holoCreate(3)
    holoModel(3, "prism")
    holoScale(3, vec(0.36,0.1,0.5))
    holoPos(3, E:toWorld(vec(4,0,0)))
    holoAng(3, E:toWorld(ang(0,90,90)))
    holoParent(3, -1)
    
    holoCreate(4)
    holoModel(4, "hqtorus2")
    holoScale(4, vec(0.12,0.12,0.2))
    holoPos(4, E:toWorld(vec(0.7,1.5,0)))
    holoAng(4, E:toWorld(ang(90,0,0)))
    holoParent(4, -1)
    
    holoCreate(5)
    holoModel(5, "hqtorus2")
    holoScale(5, vec(0.12,0.12,0.2))
    holoPos(5, E:toWorld(vec(0.7,-1.5,0)))
    holoAng(5, E:toWorld(ang(90,0,0)))
    holoParent(5, -1)
    
    holoCreate(6)
    holoModel(6, "hqtorus2")
    holoScale(6, vec(0.12,0.12,0.2))
    holoPos(6, E:toWorld(vec(-2,1.5,0)))
    holoAng(6, E:toWorld(ang(90,0,0)))
    holoParent(6, -1)
    
    holoCreate(7)
    holoModel(7, "hqtorus2")
    holoScale(7, vec(0.12,0.12,0.2))
    holoPos(7, E:toWorld(vec(-2,-1.5,0)))
    holoAng(7, E:toWorld(ang(90,0,0)))
    holoParent(7, -1)
    
    holoCreate(8)
    holoScale(8, vec(0.035,0.22,0.08))
    holoPos(8, E:toWorld(vec(-2,0,0)))
    holoParent(8, -1)
    
    holoCreate(9)
    holoModel(9, "prism")
    holoScale(9, vec(0.1,0.18,0.5))
    holoPos(9, E:toWorld(vec(1,0,0.65)))
    holoAng(9, E:toWorld(ang(94,0,0)))
    holoParent(9, -1)
    
    holoCreate(10)
    holoModel(10, "prism")
    holoScale(10, vec(0.3,0.06,0.43))
    holoPos(10, E:toWorld(vec(-2,2.3,0)))
    holoAng(10, E:toWorld(ang(0,80,90)))
    holoParent(10, -1)
    
    holoCreate(11)
    holoModel(11, "prism")
    holoScale(11, vec(0.3,0.06,0.43))
    holoPos(11, E:toWorld(vec(-2,-2.3,0)))
    holoAng(11, E:toWorld(ang(0,100,90)))
    holoParent(11, -1)
    
    holoCreate(12)
    holoScale(12, vec(0.035,0.22,0.08))
    holoPos(12, E:toWorld(vec(-4.4,0,0)))
    holoParent(12, -1)
    
    holoCreate(13)
    holoModel(13, "hqtorus2")
    holoScale(13, vec(0.12,0.12,0.2))
    holoPos(13, E:toWorld(vec(-4.4,-1.5,0)))
    holoAng(13, E:toWorld(ang(90,0,0)))
    holoParent(13, -1)
    
    holoCreate(14)
    holoModel(14, "hqtorus2")
    holoScale(14, vec(0.12,0.12,0.2))
    holoPos(14, E:toWorld(vec(-4.4,1.5,0)))
    holoAng(14, E:toWorld(ang(90,0,0)))
    holoParent(14, -1)
    
    holoCreate(15)
    holoModel(15, "hqtorus2")
    holoScale(15, vec(0.07,0.07,0.06))
    holoMaterial(15, "models/alyx/emptool_glow")
    holoColor(15, vec(255,48,0))
    holoPos(15, E:toWorld(vec(-5,-1.5,0)))
    holoAng(15, E:toWorld(ang(90,0,0)))
    holoParent(15, -1)
    
    holoCreate(16)
    holoModel(16, "hqtorus2")
    holoScale(16, vec(0.07,0.07,0.06))
    holoMaterial(16, "models/alyx/emptool_glow")
    holoColor(16, vec(255,48,0))
    holoPos(16, E:toWorld(vec(-5,1.5,0)))
    holoAng(16, E:toWorld(ang(90,0,0)))
    holoParent(16, -1)
    
    holoCreate(17)
    holoScale(17, vec(0.2,0.07,0.06))
    holoPos(17, E:toWorld(vec(-3.2,0,0)))
    holoParent(17, -1)
    
    holoEntity(15):setTrails(10,50,6,"trails/laser",vec(255,0,0),(125))
    holoEntity(16):setTrails(10,50,6,"trails/laser",vec(255,0,0),(125))
}
W = Pod:number("W")
A = Pod:number("A")
S = Pod:number("S")
D = Pod:number("D")
Space = Pod:number("Space")
Alt = Pod:number("Alt")
Shift = Pod:number("Shift")

if(W) {holoPos(-1, holoEntity(-1):toWorld(vec(W*3,0,0)))}
if(A) {holoPos(-1, holoEntity(-1):toWorld(vec(0,A*2,0)))}
if(S) {holoPos(-1, holoEntity(-1):toWorld(vec(S*-2,0,0)))}
if(D) {holoPos(-1, holoEntity(-1):toWorld(vec(0,D*-2,0)))}
if(Space) {holoPos(-1, holoEntity(-1):toWorld(vec(0,0,Space*2)))}
if(Alt) {holoPos(-1, holoEntity(-1):toWorld(vec(0,0,Space*-2)))}
if(W&Shift) {holoPos(-1, holoEntity(-1):toWorld(vec(Shift*8,0,0)))}

holoAng(-1, Seat:driver():eyeAngles())


if(first()){
    holoCreate(0)
    holoPos(0, holoEntity(-1):toWorld(vec(-30,0,7)))
    holoParent(0, -1)
    holoAlpha(0, 0)
}
holoAng(0,Seat:driver():eyeAngles())
CamAng = holoEntity(0):angles()
CamPos = holoEntity(0):pos()+holoEntity(-1):forward()*-1
