@name Burst Laser
@inputs Fire
@outputs E:entity R:ranger
@persist I L St
@trigger 
runOnTick(1)

entity():setColor(vec(),0)

if(first()){
    soundPlay(2,1,"weapons/ar2/ar2_reload_rotate.wav")
    I=100
    
    holoCreate(1)
    #holoCreate(2)
    holoCreate(3)
    holoCreate(4)
    holoCreate(5)
    
    holoModel(1,"square")
    holoModel(2,"models/props_combine/combine_mortar01a.mdl")
    holoModel(3,"models/props_combine/combine_lock01.mdl")
    holoModel(4,"models/props_combine/combine_mortar01a.mdl")
    holoModel(5,"models/props_combine/combine_mortar01a.mdl")
    
    holoScale(1,vec(2,0.08,0.2))
    holoScale(2,vec(0.075,0.075,0.2))
    holoScale(3,vec(0.5,0.5,1))
    holoScale(4,vec(0.075,0.075,0.2))
    holoScale(5,vec(0.075,0.075,0.2))
    
    holoPos(3,entity():toWorld(vec(0,0,2)))
    
    holoAng(2,entity():toWorld(ang(0,90,90)))
    holoAng(3,entity():toWorld(ang(-90,90,-90)))
    holoAng(4,entity():toWorld(ang(-90,180,0)))
    holoAng(5,entity():toWorld(ang(90,0,0)))
    
    holoPos(4,entity():toWorld(vec(0,-1,0)))
    
    holoColor(1,vec(255,191,0))
    
    holoParent(1,entity())
    holoParent(2,entity())
    holoParent(3,entity())
    holoParent(4,entity())
    holoParent(5,entity())
    }

R=rangerOffset(50000,entity():pos(),entity():forward()+vec(0,random(0.035,-0.035),random(0.035,-0.035)))
if(changed(Fire)&Fire==1){timer("fire",0)}

if(clk("fire")&Fire==1){
    holoPos(1,entity():toWorld(vec(0,0,-2)))
    St=0
    holoDelete(I-1)
    I+=1
    holoCreate(I)
    holoAlpha(I,0)
    holoEntity(I):setTrails(75,75,0.2,"trails/laser",vec(150,150,255),255)
    timer("ex",55)
}

if(clk("ex")){holoPos(I,R:pos())
    St=-1
    L+=0.25
    soundPlay(I,0.08,"weapons/cow_mangler_main_shot.wav")
    soundPitch(I,random(200,255))
    soundVolume(I,0.75)
    E=propSpawn("models/props_phx/amraam.mdl",R:pos(),1) E:propBreak()
    holoPos(I,R:pos())
    timer("fire",16)
    }
if(changed(Fire)&Fire==0){
    holoDelete(I)
    soundStop(I)
    I=100
}
holoPos(1,entity():toWorld(vec(-8+St,-0.27,1.2)))
holoPos(5,entity():toWorld(vec(-4+St,0,0)))

if(Fire==0){L-=0.08}
if(Fire==1){L-=0.01}
if(L<=0){L=0}
if(L>=3){L=3}
