ViolLua.Bots = { 
    Client = ViolLua.Client
}

ViolLua:LoadFile( 'lua/ViolLua/modules/miscellaneous/bots/other/handler.lua' )
ViolLua:LoadFile( 'lua/ViolLua/modules/miscellaneous/bots/spawnbots/handler.lua' )

ViolLua:LoadFile( 'lua/ViolLua/modules/miscellaneous/bots/walkbots/simple/handler.lua' )
ViolLua:LoadFile( 'lua/ViolLua/modules/miscellaneous/bots/walkbots/point/handler.lua' )

function ViolLua.Bots:Update( Stage, CUserCMD )
    if ( Stage != MOVE_LATE_PREDICTED ) then 
        return
    end

    if ( not self.Client.Local or not self.Client.Alive ) then 
        return
    end
    
    if ( CUserCMD:CommandNumber( ) == 0 ) then 
        return
    end

    self.Spawnbot:Handler( CUserCMD )
    self.Otherbot:Handler( CUserCMD )

    if ( self.Client.Movetype == MOVETYPE_NOCLIP or self.Client.Movetype == MOVETYPE_LADDER ) then 
        return
    end
    
    if ( CUserCMD:KeyDown( IN_ATTACK ) or CUserCMD:KeyDown( IN_USE ) ) then 
        return
    end
    
    self.Simple:Handler( CUserCMD )
    self.Point:Handler( CUserCMD )
end

ViolLua.Hooks:New( 'CreateMoveEx', ViolLua.Bots.Update, ViolLua.Bots )