@name COMT Tool Assistance Chip
@inputs Offset:vector
@outputs 
@persist Self:entity On Active XYZ:vector Aim:entity
@trigger all

#ifdef entity:setPos(vector)
    entity():setColor(vec(0,128,255))
    runOnChat(1)
    K=chatClk()
    Own=entity():owner()
    Chat=Own:lastSaid()
    COMT=Chat:find("COMT") 
    TAC=Chat:find("TAC")
    if(COMT&K){
        if(TAC){Active=!Active print("Tool Assist Chip(TAC): "+Active)}  
    }#COMT&K
    if(Active){
    interval(1000)
    if(first()){Self=Own On=0}
    Crouch=Own:isCrouch()
    Use=Own:keyUse()
    
    if(Crouch){
    if(Use){
        On=0
        print("TAC: "+On) 
        }
    }
    if(Use&!Crouch){
        On=1 
        print("TAC: "+On)
        Aim=Own:aimEntity()
        XYZ=Aim:pos()+vec(0,0,-64)
        print("Entity: "+Aim:id())
        #print("XYZ: "+XYZ)
        }
    
    
    #Ang=(XYZ-Self:shootPos()+Offset):toAngle()
    if(On&Own:inNoclip()){
        Own:setPos(XYZ+Offset)
        print("")
        }
    
    
    #if(On){Self:setEyeAngle(Ang)}
    }#end active
#else 
    entity():setColor(vec(255,128,0))
#endif
