@name BLACK HOLE
@inputs [FG]:entity
@outputs A Force Velocity OF
@persist E:entity I [Ar AAr]:array
@model models/hunter/misc/sphere2x2.mdl
interval(100)
if(first())
{
    runOnChat(1)
    
    E = entity()
    E:setColor(0,0,0,0)
    
    holoCreate(1)
    holoCreate(2)
    holoCreate(3)
    
    holoModel(1,"models/effects/combineball.mdl")
    holoModel(2,"models/effects/combineball.mdl")
    holoModel(3,"models/effects/combineball.mdl")
    
    holoAng(1,ang())
    holoAng(2,ang(90,0,0))
    holoAng(3,ang(0,90,0))
    
    holoParent(1,E)
    holoParent(2,E)
    holoParent(3,E)
    
    holoScale(1,vec(250))
    holoScale(2,vec(250))
    holoScale(3,vec(250))
    
    Ar = array(owner(),findPlayerByName("cyber"))
    
    setName("NICE EMEM!")
}

holoAng(1,ang())
holoAng(2,ang(90,0,0))
holoAng(3,ang(0,90,0))

if(changed(FG:isValid())&FG:isValid())
{
    #FG:setColor(0,0,0,0)
    FG:createWire(E,"Force","Force")
    FG:createWire(E,"Velocity","Velocity")
    FG:createWire(E,"Offset Force", "OF")
    FG:propNotSolid(1)
}

if(chatClk(owner()))
{
    if(owner():lastSaid():lower()=="-a")
    {
        hideChat(1)
        A = !A
        
        Velocity = 10000000 * A
        OF = Velocity
        Force = Velocity
        
        hint("Activation toggled to "+toString(A):replace("1","ON"):replace("0","OFF"),1)
    }
}

if(A)
{
    if(changed(numPlayers()) | changed(A))
    {
        #[
        
        ]#
        
        AAr = array(owner())
    }
    
    if(perf())
    {
        I = (I >= AAr:count()) ? 1 : I + 1
        
        local Ply = AAr[I, entity]
        local Pos = Ply:boxCenterW()
        
        FG:setPos(Pos + ((Pos - E:pos()):normalized() * (max(5, Ply:vel():length() / 10))))
        FG:setAng(ang(90, 0, 0) + (E:pos() - Pos):toAngle())
    }
}

if(duped()|dupefinished())
{
    reset()
}
