@name VTOLY Holos
@inputs Pod:wirelink [Base BfinL BfinR]:entity
@outputs 
@persist Yaw Pitch T 
@trigger 
interval(100)

if (first() | dupefinished()) {
    holoCreate(1)
    holoScale(1,vec(0.2,0.2,0.2))
    holoAlpha(1,0)
    holoPos(1,BfinL:toWorld(vec(0,3.0000045,0)))
    holoAng(1,BfinL:toWorld(ang(0,0,0)))
    holoParent(1,BfinL)
    
    holoCreate(2)
    holoModel(2,"models/sprops/rectangles_thin/size_2/rect_12x24x1_5.mdl")
    holoMaterial(2,"wtp/metal_5")
    holoColor(2,vec(127,0,0))
    holoPos(2,BfinL:toWorld(vec(0,9.0000135,0)))
    holoAng(2,BfinL:toWorld(ang(0,0,0)))
    holoParent(2,1)
    
    holoCreate(3)
    holoScale(3,vec(0.2,0.2,0.2))
    holoAlpha(3,0)
    holoPos(3,BfinR:toWorld(vec(0,-3.0000045,0)))
    holoAng(3,BfinR:toWorld(ang(0,0,0)))
    holoParent(3,BfinR)
    
    holoCreate(4)
    holoModel(4,"models/sprops/rectangles_thin/size_2/rect_12x24x1_5.mdl")
    holoMaterial(4,"wtp/metal_5")
    holoColor(4,vec(127,0,0))
    holoPos(4,BfinR:toWorld(vec(0,-9.0000135,0)))
    holoAng(4,BfinR:toWorld(ang(0,0,0)))
    holoParent(4,3)

    holoCreate(5)
    holoPos(5,Base:toWorld(vec(-125,10,42)))
    holoParent(5,Base)
    holoScale(5,vec(0.2))

    holoCreate(6)
    holoPos(6,Base:toWorld(vec(-155,10,42)))
    holoColor(6,vec(72))
    holoParent(6,5)
    holoScale(6,vec(4.8,4.8,18.8))
    holoModel(6,"hq_torus_thin")
    holoAng(6,Base:toWorld(ang(0,0,0)))

    holoCreate(7)
    holoPos(7,Base:toWorld(vec(-155,10,38)))
    holoColor(7,vec(72))
    holoParent(7,5)
    holoScale(7,vec(1))
    holoModel(7,"models/cheeze/wires/speaker.mdl")
    holoAng(7,Base:toWorld(ang(0,0,0)))

    holoCreate(8)
    holoPos(8,Base:toWorld(vec(-155,10,46)))
    holoColor(8,vec(72))
    holoParent(8,5)
    holoScale(8,vec(1))
    holoModel(8,"models/cheeze/wires/speaker.mdl")
    holoAng(8,Base:toWorld(ang(180,0,0)))
    
    holoCreate(9)
    holoPos(9,Base:toWorld(vec(-155,10,42)))
    holoColor(9,vec(72))
    holoParent(9,5)
    holoScale(9,vec(0.75,0.75,0.3))
    holoModel(9,"rcylinder")
    
    holoCreate(10)
    holoPos(10,Base:toWorld(vec(-159,10,42)))
    holoParent(10,9)
    holoScale(10,vec(0.15,0.15,0.05))
    holoModel(10,"models/mechanics/robotics/claw_guide.mdl")
    holoAng(10,Base:toWorld(ang(0,0,0)))
    
    holoCreate(11)
    holoPos(11,Base:toWorld(vec(-151,10,42)))
    holoParent(11,9)
    holoScale(11,vec(0.15,0.15,0.05))
    holoModel(11,"models/mechanics/robotics/claw_guide.mdl")
    holoAng(11,Base:toWorld(ang(0,180,0)))
    
    holoCreate(12)
    holoPos(12,Base:toWorld(vec(-155,6,42)))
    holoParent(12,9)
    holoScale(12,vec(0.15,0.15,0.05))
    holoModel(12,"models/mechanics/robotics/claw_guide.mdl")
    holoAng(12,Base:toWorld(ang(0,90,0)))
    
    holoCreate(13)
    holoPos(13,Base:toWorld(vec(-155,14,42)))
    holoParent(13,9)
    holoScale(13,vec(0.15,0.15,0.05))
    holoModel(13,"models/mechanics/robotics/claw_guide.mdl")
    holoAng(13,Base:toWorld(ang(0,-90,0)))
    
    holoCreate(14)
    holoPos(14,Base:toWorld(vec(-155,31,42)))
    holoParent(14,9)
    holoScale(14,vec(0.15,0.15,0.05))
    holoModel(14,"models/mechanics/robotics/claw_guide.mdl")
    holoAng(14,Base:toWorld(ang(0,90,0)))
    
    holoCreate(15)
    holoPos(15,Base:toWorld(vec(-155,-11,42)))
    holoParent(15,9)
    holoScale(15,vec(0.15,0.15,0.05))
    holoModel(15,"models/mechanics/robotics/claw_guide.mdl")
    holoAng(15,Base:toWorld(ang(0,-90,0)))
    
    holoCreate(16)
    holoPos(16,Base:toWorld(vec(-134,10,42)))
    holoParent(16,9)
    holoScale(16,vec(0.15,0.15,0.05))
    holoModel(16,"models/mechanics/robotics/claw_guide.mdl")
    holoAng(16,Base:toWorld(ang(0,0,0)))
    
    holoCreate(17)
    holoPos(17,Base:toWorld(vec(-176,10,42)))
    holoParent(17,9)
    holoScale(17,vec(0.15,0.15,0.05))
    holoModel(17,"models/mechanics/robotics/claw_guide.mdl")
    holoAng(17,Base:toWorld(ang(0,180,0)))
    
    holoCreate(18)
    holoPos(18,Base:toWorld(vec(-170,25,42)))
    holoParent(18,9)
    holoScale(18,vec(0.15,0.15,0.05))
    holoModel(18,"models/mechanics/robotics/claw_guide.mdl")
    holoAng(18,Base:toWorld(ang(0,-225,0)))
    
    holoCreate(19)
    holoPos(19,Base:toWorld(vec(-140,25,42)))
    holoParent(19,9)
    holoScale(19,vec(0.15,0.15,0.05))
    holoModel(19,"models/mechanics/robotics/claw_guide.mdl")
    holoAng(19,Base:toWorld(ang(0,45,0)))
    
    holoCreate(20)
    holoPos(20,Base:toWorld(vec(-170,-5,42)))
    holoParent(20,9)
    holoScale(20,vec(0.15,0.15,0.05))
    holoModel(20,"models/mechanics/robotics/claw_guide.mdl")
    holoAng(20,Base:toWorld(ang(0,225,0)))
    
    holoCreate(21)
    holoPos(21,Base:toWorld(vec(-140,-5,42)))
    holoParent(21,9)
    holoScale(21,vec(0.15,0.15,0.05))
    holoModel(21,"models/mechanics/robotics/claw_guide.mdl")
    holoAng(21,Base:toWorld(ang(0,-45,0)))
    
    holoCreate(22)
    holoPos(22,Base:toWorld(vec(-127,10,42)))
    holoParent(22,Base)
    holoScale(22,vec(1,1,1.5))
    holoModel(22,"models/jaanus/wiretool/wiretool_beamcaster.mdl")
    holoAng(22,Base:toWorld(ang(90,0,0)))
    holoColor(22,vec(127,0,0))
    
    holoCreate(23)
    holoPos(23,Base:toWorld(vec(-155,10,46)))
    holoParent(23,5)
    holoScale(23,vec(0.8,0.8,0.2))
    holoModel(23,"models/mechanics/wheels/wheel_smooth_72.mdl")
    holoAng(23,Base:toWorld(ang(0,0,0)))
    holoColor(23,vec(72))
    
    holoCreate(24)
    holoPos(24,Base:toWorld(vec(-155,10,38)))
    holoParent(24,5)
    holoScale(24,vec(0.8,0.8,0.2))
    holoModel(24,"models/mechanics/wheels/wheel_smooth_72.mdl")
    holoAng(24,Base:toWorld(ang(0,0,0)))
    holoColor(24,vec(72))
    
    for (M = 6,24) {holoMaterial(M,"WTP/metal_5")}
    for (C = 10,22) {holoColor(C,vec(127,0,0))}
    
    holoCreate(25)
    holoPos(25,Base:toWorld(vec(125,10,42)))
    holoParent(25,Base)
    holoScale(25,vec(0.2))

    holoCreate(26)
    holoPos(26,Base:toWorld(vec(155,10,42)))
    holoColor(26,vec(72))
    holoParent(26,25)
    holoScale(26,vec(4.8,4.8,18.8))
    holoModel(26,"hq_torus_thin")
    holoAng(26,Base:toWorld(ang(0,0,0)))

    holoCreate(27)
    holoPos(27,Base:toWorld(vec(155,10,38)))
    holoColor(27,vec(72))
    holoParent(27,25)
    holoScale(27,vec(1))
    holoModel(27,"models/cheeze/wires/speaker.mdl")
    holoAng(27,Base:toWorld(ang(0,0,0)))

    holoCreate(28)
    holoPos(28,Base:toWorld(vec(155,10,46)))
    holoColor(28,vec(72))
    holoParent(28,25)
    holoScale(28,vec(1))
    holoModel(28,"models/cheeze/wires/speaker.mdl")
    holoAng(28,Base:toWorld(ang(180,0,0)))
    
    holoCreate(29)
    holoPos(29,Base:toWorld(vec(155,10,42)))
    holoColor(29,vec(72))
    holoParent(29,25)
    holoScale(29,vec(0.75,0.75,0.3))
    holoModel(29,"rcylinder")
    
    holoCreate(30)
    holoPos(30,Base:toWorld(vec(159,10,42)))
    holoParent(30,29)
    holoScale(30,vec(0.15,0.15,0.05))
    holoModel(30,"models/mechanics/robotics/claw_guide.mdl")
    holoAng(30,Base:toWorld(ang(0,180,0)))
    
    holoCreate(31)
    holoPos(31,Base:toWorld(vec(151,10,42)))
    holoParent(31,29)
    holoScale(31,vec(0.15,0.15,0.05))
    holoModel(31,"models/mechanics/robotics/claw_guide.mdl")
    holoAng(31,Base:toWorld(ang(0,0,0)))
    
    holoCreate(32)
    holoPos(32,Base:toWorld(vec(155,6,42)))
    holoParent(32,29)
    holoScale(32,vec(0.15,0.15,0.05))
    holoModel(32,"models/mechanics/robotics/claw_guide.mdl")
    holoAng(32,Base:toWorld(ang(0,90,0)))
    
    holoCreate(33)
    holoPos(33,Base:toWorld(vec(155,14,42)))
    holoParent(33,29)
    holoScale(33,vec(0.15,0.15,0.05))
    holoModel(33,"models/mechanics/robotics/claw_guide.mdl")
    holoAng(33,Base:toWorld(ang(0,-90,0)))
    
    holoCreate(34)
    holoPos(34,Base:toWorld(vec(155,31,42)))
    holoParent(34,29)
    holoScale(34,vec(0.15,0.15,0.05))
    holoModel(34,"models/mechanics/robotics/claw_guide.mdl")
    holoAng(34,Base:toWorld(ang(0,90,0)))
    
    holoCreate(35)
    holoPos(35,Base:toWorld(vec(155,-11,42)))
    holoParent(35,29)
    holoScale(35,vec(0.15,0.15,0.05))
    holoModel(35,"models/mechanics/robotics/claw_guide.mdl")
    holoAng(35,Base:toWorld(ang(0,-90,0)))
    
    holoCreate(36)
    holoPos(36,Base:toWorld(vec(134,10,42)))
    holoParent(36,29)
    holoScale(36,vec(0.15,0.15,0.05))
    holoModel(36,"models/mechanics/robotics/claw_guide.mdl")
    holoAng(36,Base:toWorld(ang(0,180,0)))
    
    holoCreate(37)
    holoPos(37,Base:toWorld(vec(176,10,42)))
    holoParent(37,29)
    holoScale(37,vec(0.15,0.15,0.05))
    holoModel(37,"models/mechanics/robotics/claw_guide.mdl")
    holoAng(37,Base:toWorld(ang(0,0,0)))
    
    holoCreate(38)
    holoPos(38,Base:toWorld(vec(170,25,42)))
    holoParent(38,29)
    holoScale(38,vec(0.15,0.15,0.05))
    holoModel(38,"models/mechanics/robotics/claw_guide.mdl")
    holoAng(38,Base:toWorld(ang(0,45,0)))
    
    holoCreate(39)
    holoPos(39,Base:toWorld(vec(140,25,42)))
    holoParent(39,29)
    holoScale(39,vec(0.15,0.15,0.05))
    holoModel(39,"models/mechanics/robotics/claw_guide.mdl")
    holoAng(39,Base:toWorld(ang(0,-225,0)))
    
    holoCreate(40)
    holoPos(40,Base:toWorld(vec(170,-5,42)))
    holoParent(40,29)
    holoScale(40,vec(0.15,0.15,0.05))
    holoModel(40,"models/mechanics/robotics/claw_guide.mdl")
    holoAng(40,Base:toWorld(ang(0,-45,0)))
    
    holoCreate(41)
    holoPos(41,Base:toWorld(vec(140,-5,42)))
    holoParent(41,29)
    holoScale(41,vec(0.15,0.15,0.05))
    holoModel(41,"models/mechanics/robotics/claw_guide.mdl")
    holoAng(41,Base:toWorld(ang(0,225,0)))
    
    holoCreate(42)
    holoPos(42,Base:toWorld(vec(127,10,42)))
    holoParent(42,Base)
    holoScale(42,vec(1,1,1.5))
    holoModel(42,"models/jaanus/wiretool/wiretool_beamcaster.mdl")
    holoAng(42,Base:toWorld(ang(-90,0,0)))
    holoColor(42,vec(127,0,0))
    
    holoCreate(43)
    holoPos(43,Base:toWorld(vec(155,10,46)))
    holoParent(43,25)
    holoScale(43,vec(0.8,0.8,0.2))
    holoModel(43,"models/mechanics/wheels/wheel_smooth_72.mdl")
    holoAng(43,Base:toWorld(ang(0,0,0)))
    holoColor(43,vec(72))
    
    holoCreate(44)
    holoPos(44,Base:toWorld(vec(155,10,38)))
    holoParent(44,25)
    holoScale(44,vec(0.8,0.8,0.2))
    holoModel(44,"models/mechanics/wheels/wheel_smooth_72.mdl")
    holoAng(44,Base:toWorld(ang(0,0,0)))
    holoColor(44,vec(72))
    
    for (M = 26,44) {holoMaterial(M,"WTP/metal_5")}
    for (C = 30,42) {holoColor(C,vec(127,0,0))}
}

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()

T = T+1*25

Yaw += clamp((A - D)*25 - Yaw,-5,5)
Pitch += clamp((S - W)*25 - Pitch,-5,5)

holoAng(1,holoEntity(1):parent():toWorld(ang(0,0,Yaw)))
holoAng(3,holoEntity(3):parent():toWorld(ang(0,0,Yaw)))

holoAng(5,holoEntity(5):parent():toWorld(ang(Yaw-Pitch,-90,0)))
holoAng(25,holoEntity(25):parent():toWorld(ang(-Yaw-Pitch,-90,0)))

holoAng(9,holoEntity(5):toWorld(ang(0,T,0)))
holoAng(29,holoEntity(25):toWorld(ang(0,T,0)))
