@name Sticky Bomb Launcher - By Croco
@inputs 
@outputs 
@persist X Y Ent:entity Ents:array Limit Array:array

@persist Head:string 

runOnTick(200)
if (first()) {Y = 1 Limit = 1}



if (owner():keyAttack1()) {
if (Y <= Limit) {
Ent = propSpawn("models/weapons/w_models/w_stickybomb.mdl",1)



Y++
}
Ent:setMass(50)
Ents[Y,entity] = Ent
Ent:setPos(owner():pos() + vec(0,25,75) + entity():forward()*24)
Ent:setAng(ang(90,0,80) + owner():angles())
Ent:applyForce(owner():eyeAngles():forward()*1000*Ent:mass())
Ent:applyAngForce(-Ent:angles() + ang(0,curtime()*1000,900)*Ent:mass())
#Ent:parentTo(owner())

}


if (owner():keyAttack2()) {
Ents:propDelete()
Y = 1
}


   if (owner():weapon():type()=="weapon_physcannon"){
    Head="anim_attachment_RH"
    
    for(I=1,1){
        holoCreate(I)
        holoPos(I,owner():attachmentPos(Head))
        holoAng(I,owner():attachmentAng(Head))
        holoPos(I,holoEntity(I):toWorld(vec(0,0,-2+(-I*0))))
        holoAng(I,holoEntity(I):toWorld(ang(0,10,(-I*10)-0)))
        holoParentAttachment(I,owner(),Head)
        holoModel(I,"models/weapons/w_models/w_stickybomb_launcher.mdl")
        holoMaterial(I,"models/weapons/w_models/w_stickybomb_launcher.mdl")
        holoScale(I,vec(1,1,1))
        holoAlpha(I,255)
    }
}
else{holoAlpha(1,0)}
owner():weapon():setColor(0,0,0,0)



timer("check",160)
Distance = 120
interval(2000)
if (clk("check")) {
    findInSphere(Ent:pos(), Distance)
    Array = findToArray()
    for(I=1,Array:count()) {
        if(Array[I,entity]:isWorld()) {
Ent:propFreeze(1)
}}}
