mirror of
https://github.com/JezuzLizard/t4sp_bot_warfare.git
synced 2025-04-20 21:45:44 +00:00
better bot kick logic
This commit is contained in:
parent
7458491ac1
commit
532eb70a47
@ -483,7 +483,7 @@ addBots_loop()
|
||||
setDvar( "bots_manage_add", 1 );
|
||||
else if ( amount > fillAmount && getDvarInt( "bots_manage_fill_kick" ) )
|
||||
{
|
||||
tempBot = PickRandom( getBotArray() );
|
||||
tempBot = getBotToKick();
|
||||
|
||||
if ( isDefined( tempBot ) )
|
||||
BotBuiltinCmdExec( "clientkick " + tempBot getEntityNumber() );
|
||||
|
@ -1168,6 +1168,38 @@ getMapName( map )
|
||||
return map;
|
||||
}
|
||||
|
||||
/*
|
||||
Returns a bot to be kicked
|
||||
*/
|
||||
getBotToKick()
|
||||
{
|
||||
bots = getBotArray();
|
||||
|
||||
if ( !isDefined( bots ) || !isDefined( bots.size ) || bots.size <= 0 || !isDefined( bots[0] ) )
|
||||
return undefined;
|
||||
|
||||
tokick = undefined;
|
||||
|
||||
// just kick lowest skill
|
||||
for ( i = 0; i < bots.size; i++ )
|
||||
{
|
||||
bot = bots[i];
|
||||
|
||||
if ( !isDefined( bot ) )
|
||||
continue;
|
||||
|
||||
if ( !isDefined( bot.pers ) || !isDefined( bot.pers["bots"] ) || !isDefined( bot.pers["bots"]["skill"] ) || !isDefined( bot.pers["bots"]["skill"]["base"] ) )
|
||||
continue;
|
||||
|
||||
if ( isDefined( tokick ) && bot.pers["bots"]["skill"]["base"] > tokick.pers["bots"]["skill"]["base"] )
|
||||
continue;
|
||||
|
||||
tokick = bot;
|
||||
}
|
||||
|
||||
return tokick;
|
||||
}
|
||||
|
||||
/*
|
||||
Returns an array of all the bots in the game.
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user