@name Build protection
@persist On Slay
@outputs Find:entity On
runOnTick(1)

HoloScale = 50

if (first()) {
    entity():setColor(0,0,0,100)
    
    holoCreate(1)
    holoModel(1,"icosphere3")
    holoScale(1,vec(-HoloScale))
    holoMaterial(1,"models/wireframe")
    holoColor(1,vec(80,80,80))
    holoAlpha(1,100)
    
    holoCreate(2)
    holoModel(2,"icosphere3")
    holoScale(2,vec(HoloScale))
    holoMaterial(2,"models/debug/debugwhite")
    holoDisableShading(2,1)
    holoColor(2,vec(80,80,80))
    
    runOnChat(1)
    #findExcludePlayer(owner())
    findIncludeClass("player")
}

LS = lastSaid()

if (LS:left(1) == "!" & chatClk(owner())) {
    LSO = LS:lower()
    
    hideChat(1)
    if (LSO == "!on") {On = 1,print("BuildSphere activated!")}
    if (LSO == "!off") {On = 0,print("BuildSphere deactivated!")}
    if (LSO == "!color") {holoColor(1,vec(random(255),random(255),random(255))),holoColor(2,holoEntity(1):getColor())}
}

if (On) {
    interval(10)
    findInSphere(entity():pos(),HoloScale*6)
    
    Slay = findToArray():count()
    Name = find():name()
    Find = find()
    
    if (Slay & $Slay) {concmd("say !slay " + Name)}
}
