@name Trial
@inputs Pod:wirelink 
@outputs 
@persist TurningSpeed Speed 
@trigger 
interval(100)

if(first()){
    holoCreate(1)
    holoModel(1,"models/props_vehicles/apc001.mdl")
    holoPos(1,entity():toWorld(vec(0,0,10)))
    holoAng(1,ang(0,180,0))
    holoScale(1,vec(0.09,0.09,0.09))
        
    Speed = 4
    TurningSpeed = 5
}

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 Shift = Driver:keySprint()
local M1 = Driver:keyAttack1()
local Active = Driver:isPlayer()

if (W) {holoPos(1,holoEntity(1):toWorld(vec(0,Speed,0)))}
if (S) {holoPos(1,holoEntity(1):toWorld(vec(0,-Speed,0)))}

if (W & Shift) {holoPos(1,holoEntity(1):toWorld(vec(0,Speed*2,0)))}
if (S & Shift) {holoPos(1,holoEntity(1):toWorld(vec(0,-Speed*2,0)))}

if (A) {holoAng(1,holoEntity(1):angles()+ang(0,TurningSpeed,0))}
if (D) {holoAng(1,holoEntity(1):angles()+ang(0,-TurningSpeed,0))}

if (A & W) {holoAng(1,holoEntity(1):angles()+ang(0,TurningSpeed,0))}
if (D & W) {holoAng(1,holoEntity(1):angles()+ang(0,-TurningSpeed,0))}

if (A & S) {holoAng(1,holoEntity(1):angles()+ang(0,TurningSpeed,0))}
if (D & S) {holoAng(1,holoEntity(1):angles()+ang(0,-TurningSpeed,0))}

if (changed(Active) & Active) {
    holoEntity(1):soundPlay(1,0,"vehicles/apc/apc_idle1.wav")
    soundVolume(1,0.3)
} elseif (!Active) { soundStop(1) }

if (M1) {
    holoCreate(2)
    holoModel(2,"hq_sphere")
    holoPos(2,holoEntity(1):toWorld(vec(0,0,2)))
}
