@name Advanced Tripwire Turret
#@inputs SteamID:string
@outputs Fire Laser:entity
@persist Safe:array
@trigger 
interval(100)


##Laser Sight
Turret=entity():isConstrainedTo()
Object = Turret:pos() + Turret:forward()
Aim = Turret:forward()
Ranger = rangerOffset(600,Object,Aim)
Laser=Ranger:entity()
SteamID = Ranger:entity():steamID()
#End Laser sight

if(first()&!->Fire){
    #ifdef entity:createWire(entity,string,string)
       Turret:createWire(entity(),"Fire","Fire") 
        
    #endif
}
runOnChat(1)
K=chatClk()
Chat=entity():owner():lastSaid()
Trip="TWM"
Add="add"
Display="disp"
Brk="<"
Clear="clear"

Trip1=Chat:find(Trip)
Add1=Chat:find(Add)
Disp=Chat:find(Display)
Break=Chat:find(Brk)
Clear1=Chat:find(Clear)


if(first()|dupefinished()){
    entity():setAlpha(0)
    Turret:setAlpha(0)
    S=" "
    Safe=array() 
    C=1
    Safe[C,string]="STEAM_0:1:8017844" C++ #Captain Maim
    Safe[C,string]="STEAM_0:0:19519871" C++ #Polymorph
    Safe[C,string]="STEAM_0:1:19091184" C++ #TurtleMadness
    Safe[C,string]="STEAM_0:0:5365442" C++ #Ronox
    Safe[C,string]="STEAM_0:0:18045151" C++ #Rexen
    Safe[C,string]="STEAM_0:0:20300913" C++ #Infested
print("Advanced Tripwire Turret Commands:")
print(Trip+S+Add+S+"Steam ID without STEAM_0: in front") 
print(Trip+S+Display+": this prints the current safe steam ID's")
print(Trip+S+Clear+": this resets all Tripwire turrets safe steam list")

}

if(K&Trip1){
    if(Add1&Break){
        Added="STEAM_0:"+Chat:explode(Brk):string(2)
        Safe:pushString(Added)
        print(Added+" has been added")
        }
    if(Clear1){print("All turrets reset") reset()}
    if(Disp){print("current friends are: "+Safe:concat("<>"))}
}

if(SteamID==""|Safe:concat():find(SteamID)){Fire=0}else{Fire=1}

