@name Bomb-Omb - Ammut
@inputs 
@outputs 
@persist 
@trigger 
@model models/hunter/misc/sphere025x025.mdl
runOnTick(1)
if(first()){
    H = 0
    O=owner()
entity():setMaterial("models/shiny")
entity():setColor(1,1,1)
entity():setPos(entity():pos() + vec(0,0,3))
holoCreate(1)
holoModel(1,"hqicosphere")
holoParent(1,entity())
holoScale(1,vec(0.7,0.3,0.3))
holoPos(1,entity():pos() + vec(0,4,-5))
holoColor(1,vec(255,255,20))
holoCreate(2)
holoModel(2,"hqicosphere")
holoParent(2,entity())
holoScale(2,vec(0.7,0.3,0.3))
holoPos(2,entity():pos() + vec(0,-4,-5))
holoColor(2,vec(255,255,20))
holoCreate(3)
holoModel(3,"hqicosphere")
holoParent(3,entity())
holoScale(3,vec(0,0.5,0.3))
holoPos(3,entity():pos() + vec(5,-3,2))
holoAng(3,ang(30,150,90))
holoCreate(4)
holoModel(4,"hqicosphere")
holoParent(4,entity())
holoScale(4,vec(0,0.5,0.3))
holoPos(4,entity():pos() + vec(5,3,2))
holoAng(4,ang(-30,30,90))
holoCreate(5)
holoModel(5,"models/hunter/tubes/tube1x1x1.mdl")
holoParent(5,entity())
holoScale(5,vec(0.1,0.1,0.05))
holoPos(5,entity():pos() + vec(0,0,5))
holoColor(5,vec(0,0,0))
holoMaterial(5,"models/shiny")
holoCreate(6)
holoModel(6,"models/props_phx/construct/metal_angle360.mdl")
holoParent(6,entity())
holoScale(6,vec(0.06,0.06,0.05))
holoPos(6,entity():pos() + vec(0,0,6))
holoColor(6,vec(0,0,0))
holoMaterial(6,"models/shiny")
holoCreate(7)
holoModel(7,"models/hunter/tubes/tube1x1x1.mdl")
holoParent(7,entity())
holoScale(7,vec(0.05,0.05,0.08))
holoPos(7,entity():pos() + vec(0,0,5))
holoColor(7,vec(255,255,20))
holoMaterial(7,"models/shiny")
holoCreate(8)
holoModel(8,"models/hunter/tubes/tube1x1x1.mdl")
holoParent(8,entity())
holoScale(8,vec(0.05,0.05,0.1))
holoPos(8,entity():pos() + vec(1,0,7))
holoColor(8,vec(255,255,20))
holoMaterial(8,"models/shiny")
holoAng(8,ang(0,0,40))
holoCreate(9)
holoModel(9,"hqicosphere")
holoParent(9,entity())
holoScale(9,vec(0.2,0.2,0.2))
holoPos(9,entity():pos() + vec(1,0,7.5))
holoColor(9,vec(255,255,20))
holoMaterial(9,"models/shiny")}

E = entity()
E:applyForce(vec(0,0,20))
E:propFreeze(0)
          TarQ = quat(ang(0,90,0)) #Calculate quaternion for target orientation
                CurQ = quat(E) #Calculate current orientation quaternion
                Z = TarQ/CurQ
                EP=E:pos()
                TTV = E:toLocal(rotationVector(Z)+EP)
                E:applyTorque((150*TTV - 12*E:angVelVector())*E:inertia())



timer("check",300)
Distance = 200
Result = ""
Times = 100
Damage = 20
interval(2000)
if (clk("check")) {
    findInSphere(entity():pos(), Distance)
    Array = findToArray()
    for(I=1,Array:count()) {
        if(Array[I,entity]:isPlayer()) {
            if(Array[I,entity]:isAlive()) {
                if (Result != "whip") {                  
                    E:applyForce(vec(0,400,0))
                    timer("boom",3000)
                    T = Array[I,entity]:pos()
        V = (T - E:pos() + vec(0, 0, 5)) * 2
        E:applyForce(V + $V * 5)
     H = 0
     if(Array[I,entity]:pos():distance(E:pos()) > 100){H = 1}
}}}}} 


if(clk("boom")){
    if(H == 0){
    Ent = propSpawn("models/props_c17/oildrum001_explosive.mdl",E:pos(),200)
Ent:propBreak() 
Ent:setPos(entity():pos() + vec(0,25,75))
Ent:applyForce(vec())
selfDestructAll()}}

