@name Auto Wiring Dispenser
@inputs Spawner:wirelink 
@outputs Spawn Undo ID LeftClick Pl:array
@persist Paster:entity Self:entity 
@trigger all
interval(300)
if(first()&0) {
    Self=entity()
    
    Color=vec(255,255,255)
    Material="arrowire2"
    Width=0.5
    Paster=Self:isConstrainedTo()
    Paster:createWire(Self,"LeftClick","LeftClick",Width,Color,Material)
    #Paster:createWire(Self,"Undo","Undo",Width,Color,Material)
    
}

#ID=Paster:id()
#findInSphere(Self:pos(),300)
#findIncludeClass("player")
#findIncludeClass("npc")
#findSortByDistance(Self:pos())
#Pl=findClosest(entity():pos())
Pl=array()
for(C=1,players():count()){
       Pl:pushNumber(players()[C,entity]:pos():distance(entity():pos()))
}
Go=150>Pl:min()

if (Go) {LeftClick=1 Undo=0}else{Undo=1 LeftClick=0}
Spawner:setNumber("LeftClick",LeftClick)
#Spawner:setNumber("Undo",Undo)
