@name Space ship
@inputs Cam:wirelink Pod:wirelink
@outputs HUD Speed
@persist Pos:vector Ang:angle Speed MaxSpeed
@trigger 

runOnTick(1)

O = owner()
E = holoEntity(9991)
MaxSpeed = 1
HUD = !Pod["Active",number]
DA = vec(50,0,0)

if(first())
{
    holoCreate(9991):setTrails(0,5,1,"trails/smoke",vec(255,255,255),255)
    Pos = vec(1500,4000,14000)
}

if(Pod["W",number])
{
    if(Speed < MaxSpeed)
    {
        Speed = Speed + 0.01
    }
    else
    {
    }
}
if(Pod["S",number] | !Pod["Active",number])
{
    if(Speed > 0)
    {
        Speed = Speed - 0.01
    }
    else
    {
    }
}
if(Pod["A",number])
{
    Ang = Ang + ang(0,1,0)
}
if(Pod["D",number])
{
    Ang = Ang - ang(0,1,0)
}
if(Pod["Space",number])
{
    Ang = Ang + ang(1,0,0)
}
if(Pod["Shift",number])
{
    Ang = Ang - ang(1,0,0)
}

Pos = Pos + (E:forward() * Speed)

holoPos(9991,Pos)
holoAng(9991,Ang)
holoScaleUnits(9991,vec(32,8,8))

Cam["Activated",number] = Pod["Active",number]
Cam["Direction",vector] = -O:eye()
Cam["Position",vector] = E:pos() + DA:x()*O:eye() + DA:y()*E:right() + DA:z()*-E:up()
Cam["Parent",entity] = E
