@name Cenn's Handheld Acf Cannon
@inputs Gun:entity Ammo:entity
@outputs Reload Fire Active 
@persist
@trigger 

runOnTick(1)
if(first()){
    Head="anim_attachment_RH"
    Active = 1

        holoCreate(1)
        holoCreate(2)
        holoPos(1,owner():attachmentPos(Head))
        holoAng(2,owner():attachmentAng("anim_attachment_head"))
    holoPos(2,owner():attachmentPos("anim_attachment_head") + vec(-10,0,-15))
  #    holoAng(2,holoEntity(1):toWorld(ang(0,10,-0)))
         holoParentAttachment(2,owner(),"anim_attachment_head")
        holoParentAttachment(1,owner(),Head)
        holoScale(1,vec(1,1,1))
    
    holoAlpha(1,0)
    holoAlpha(2,0)
    
}
if(Gun){
  #  Gun:propNotSolid(1)
noCollideAll(Gun,1)
    Gun:setPos(holoEntity(1):pos())
    Gun:setAng(owner():eyeAngles())
}

if(Ammo){
   # Ammo:propNotSolid(1)
noCollideAll(Ammo,1)
    Ammo:setPos(holoEntity(2):pos())
    Ammo:setAng(holoEntity(2):angles() + ang(90,0,90))
}

if(owner():keyPressed("R")){
    Reload = 1
    timer("resetreload",2000)
   
}
if(owner():keyPressed("E")){
    
Fire = 1}
else{Fire=0}
if(clk("resetreload")){
    
Reload=0}
owner():weapon():setColor(0,0,0,0)
