@name Minimap
@persist [B E]:entity W:array DBR
if(first())
{
    E = entity()
    E:setColor(0,0,0,0)
    
    runOnTick(1)
    
    W = array("STEAM_0:0:0","STEAM_0:0:32759932","STEAM_0:0:33994222")
    
    DBR = 6
}

if(changed(numPlayers()))
{
    holoDeleteAll()
    
    B = holoCreate(1,E:toWorld(vec(0,0,DBR+5)))
    holoScale(1,vec(-DBR/6))
    holoColor(1,vec4(0,255,0,255))
    holoParent(1,E)
    holoDisableShading(1,1)
    
    holoCreate(2,B:toWorld(vec()))
    holoScale(2,vec((-DBR/6)-0.05))
    holoColor(2,vec())
    holoParent(2,E)
    
    holoCreate(3,E:toWorld(vec(0,0,DBR+5)))
    holoModel(3,"hq_sphere")
    holoScale(3,vec(clamp(0.05*(DBR/30),0.01,100)))
    holoColor(3,vec4(255,0,0,50))
    
    foreach(K, V:entity = players())
    {
        I = K+3
        holoCreate(I,B:toWorld(V:pos()/(16000/DBR)))
        holoModel(I,"hq_cylinder")
        holoScale(I,vec(0.05,0.05,0.1)*(DBR/30))
        holoParent(I,B)
        holoAlpha(I,150)
        foreach(J, K:string = W)
        {
            if(V:steamID() == K)
            {
                holoColor(I,vec(255,100,0))
                break
            }
        }
    }
}

foreach(K, V:entity = players())
{
    I = K+3
    holoPos(I,B:toWorld(V:pos()/(16000/DBR)))
}
