@name Entity(N) Discovery
@inputs ID
@persist NewN MaxN MinN HDif LDif
@outputs [Chips Players Props NPCs Targets]:array
#by LyingInBedMon
if(first()){
    runOnTick(1)
    
    MaxN=MinN=entity():id()
}

    #Dif alteration
if((HDif+LDif)==0){
#Wait until the previous ID has been run before changing
#In most cases this will only take a fraction of a second
    NewN=ID
}

    #Separations from the known finds
HDif=NewN-MaxN    #IDs above the Maximum found
LDif=MinN-NewN    #IDs below the Minimum found

N=0
while(N<HDif & N<=10 & (HDif+LDif)>0){
    if(HDif){
        MaxN++
        Ent=entity(MaxN)
    }
    elseif(LDif){
        MinN--
        Ent=entity(MinN)
    }
    
        Typ=Ent:type()  #Entity type
        #Expression 2 chips
    if(Typ:find("expression2")){
        Chips:pushEntity(Ent)
    }
        #NPCs
    elseif(Typ:find("npc_")){ 
        NPCs:pushEntity(Ent)
        Targets:pushEntity(Ent)
    }
        #Players
    elseif(Typ:find("player")){
        Players:pushEntity(Ent)
        Targets:pushEntity(Ent)
    }
        #Props
    elseif(Typ:find("prop")){
        Props:pushEntity(Ent)
    }
    
    N++
}
