#@name Brony's Turret
@inputs 
@outputs 
@persist Prop:entity
@trigger 

interval(1)
E=entity()
if(first()){
    holoCreate(1,E:toWorld(vec(0,0,0)),vec(10,10,0.1),E:angles(),vec(255,255,255),"hq_cylinder")
    holoParent(1,E)
    holoCreate(2,E:toWorld(vec(0,0,0)),vec(0.5,0.5,10),E:angles(),vec(255,255,255),"hq_cylinder")
    holoParent(2,E)
    holoCreate(3)
    holoModel(3,"hq_sphere")
    holoPos(3,E:toWorld(vec(0,0,60)))
    holoCreate(4,holoEntity(3):toWorld(vec(-60,0,0)),vec(0.5,0.5,10),holoEntity(3):angles()+ang(90,0,0),vec(255,255,255),"hq_cylinder")
    holoParent(4,holoEntity(3))
    holoCreate(5,holoEntity(3):toWorld(vec(-120,0,0)),vec(1,1,1),holoEntity(3):angles()+ang(90,0,0),vec(255,255,255),"cube")
    holoParent(5,holoEntity(3))
}
holoAng(3,(holoEntity(3):pos()-owner():aimPos()):toAngle())


TrailStart=300 #starting size of the trails
TrailEnd=0 #end size of the trails
TrailLength=3 #length of each trail
TrailModel="trails/physbeam" #model of the trails
TrailColor=vec(255,0,0) #color of each trail
TrailAlpha=255 #alpha of each trail

TrailStart1=300 #starting size of the trails
TrailEnd1=0 #end size of the trails
TrailLength1=3 #length of each trail
TrailModel1="trails/physbeam" #model of the trails
TrailColor1=vec(110,0,200) #color of each trail
TrailAlpha1=255 #alpha of each trail

A=owner():keyReload()
if (changed(A)&A) {
    Prop:propDelete()
    holoDelete(100)
    Prop = propSpawn("models/hunter/misc/sphere075x075.mdl",0)
    Prop:setColor(vec(0,0,0))
    Prop:setPos(holoEntity(5):pos())
    Prop:setAng(E:angles())
    Prop:propGravity(0)
    Prop:setMass(50000)

    holoCreate(100,E:toWorld(vec(0,0,210)),vec(5,5,5),E:toWorld(ang(0,0,0)),vec(255,0,0),"hq_sphere")
    holoEntity(100):setTrails(TrailStart,TrailEnd,TrailLength,TrailModel,TrailColor,TrailAlpha)
    holoMaterial(100,"models/alyx/emptool_glow")
    holoPos(100,Prop:pos())
    holoParent(100,Prop)
    
    holoCreate(101,E:toWorld(vec(0,0,210)),vec(6,6,6),E:toWorld(ang(0,0,0)),vec(110,0,200),"hq_sphere")
    holoEntity(101):setTrails(TrailStart1,TrailEnd1,TrailLength1,TrailModel1,TrailColor1,TrailAlpha1)
    holoMaterial(101,"models/alyx/emptool_glow")
    holoPos(101,Prop:pos())
    holoParent(101,Prop)
    
    Prop:applyForce(holoEntity(5):up()*Prop:mass()*-99999999999)
}
