@name Its a fucking gnome - Ammut
@inputs 
@outputs 
@persist 
@trigger 
@model models/props_junk/gnome.mdl
runOnTick(1)
if(first()){
    H = 0
    O=owner()
Ent = entity()

}

E = entity()
E:applyForce(vec(0,0,20))
E:propFreeze(0)
HH = findClosest(entity():pos())
          TarQ = quat(HH:angles() - ang(0,-180,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:applyForce(vec())
}}

