void changed()

        
{ 

        void self        = getlocalvar("self");
        void direction   = getentityproperty(self, "direction");
        changeentityproperty(self, "noaicontrol", 1);


        if (direction ==0)
        {
        changeentityproperty(self, "direction", 1);
        changeentityproperty(self, "noaicontrol", 0);
        }
        
        if (direction ==1)
        {
        changeentityproperty(self, "direction", 0);
        changeentityproperty(self, "noaicontrol", 0);
        }
    
}
