@name Combine Helicopter
@persist [Pos Accel AimPos]:vector [Ang AngAccel]:angle
@persist Target:entity MaxSpeed A
@model models/hunter/tubes/circle4x4.mdl

interval(1)
if (first()) {
    entity():setMaterial("models/props_combine/metal_combinebridge001")
    holoCreate(1)
    holoModel(1,"models/combine_helicopter.mdl")
    holoEntity(1):soundPlay(1,0,"npc/attack_helicopter/aheli_rotor_loop1.wav")
    holoEntity(2):soundPlay(2,0,"npc/attack_helicopter/aheli_wash_loop3.wav")
    soundVolume(1,500)
    holoAnim(1,"ACT_HELICOPTER_CRASHING")
    Pos=entity():pos()+vec(0,0,100)
    MaxSpeed=50
}

A++
holoPos(1,Pos)
local DownCast=rangerOffset(Pos,vec(0,0,-500))
soundVolume(2,clamp(DownCast:distance(),0,1000))

# Rotate Gun
AimPos=owner():attachmentPos("eyes")
local GunBase=entity():attachmentPos(A)
local Ang=(-AimPos):toAngle()
local Pitch=Ang:pitch()
local Yaw=Ang:yaw()
local Roll=Ang:roll()
print(_HUD_PRINTCENTER,toString(GunBase)+"\n"+Pitch+"\n"+Yaw+"\n"+Roll+"\n"+A)
holoSetPose(1,"gun_pitch",Pitch)
holoSetPose(1,"gun_yaw",Yaw)
holoSetPose(1,"gun_roll",Roll)
