mirror of
https://github.com/ineedbots/iw4_bot_warfare.git
synced 2025-06-27 22:51:49 +00:00
level.bots
This commit is contained in:
@ -94,6 +94,8 @@ init()
|
||||
level.botPushOutDist = 30;
|
||||
|
||||
level.smokeRadius = 255;
|
||||
|
||||
level.bots = [];
|
||||
|
||||
level.bots_nonfullautoguns = [];
|
||||
level.bots_nonfullautoguns["barrett"] = true;
|
||||
@ -360,6 +362,16 @@ watchScrabler()
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
When a bot disconnects.
|
||||
*/
|
||||
onDisconnect()
|
||||
{
|
||||
self waittill("disconnect");
|
||||
|
||||
level.bots = array_remove(level.bots, self);
|
||||
}
|
||||
|
||||
/*
|
||||
Called when a player connects.
|
||||
*/
|
||||
@ -388,6 +400,9 @@ connected()
|
||||
self thread maps\mp\bots\_bot_internal::connected();
|
||||
self thread maps\mp\bots\_bot_script::connected();
|
||||
|
||||
level.bots[level.bots.size] = self;
|
||||
self thread onDisconnect();
|
||||
|
||||
level notify("bot_connected", self);
|
||||
}
|
||||
|
||||
|
@ -14,6 +14,9 @@ init()
|
||||
{
|
||||
if (getDvar("bots_main_menu") == "")
|
||||
setDvar("bots_main_menu", true);
|
||||
|
||||
if (!getDvarInt("bots_main_menu"))
|
||||
return;
|
||||
|
||||
thread watchPlayers();
|
||||
}
|
||||
@ -28,9 +31,6 @@ watchPlayers()
|
||||
{
|
||||
player = level.players[i];
|
||||
|
||||
if (!getDvarInt("bots_main_menu"))
|
||||
continue;
|
||||
|
||||
if (!player is_host())
|
||||
continue;
|
||||
|
||||
@ -107,8 +107,7 @@ doGreetings()
|
||||
wait 1;
|
||||
self iPrintln("Welcome to Bot Warfare "+self.name+"!");
|
||||
wait 5;
|
||||
if(getDvarInt("bots_main_menu"))
|
||||
self iPrintln("Press [{+actionslot 2}] to open menu!");
|
||||
self iPrintln("Press [{+actionslot 2}] to open menu!");
|
||||
}
|
||||
|
||||
watchPlayerOpenMenu()
|
||||
@ -122,11 +121,8 @@ watchPlayerOpenMenu()
|
||||
self waittill( "bots_open_menu" );
|
||||
if(!self.menuOpen)
|
||||
{
|
||||
if(getdvarint("bots_main_menu"))
|
||||
{
|
||||
self playLocalSound( "mouse_click" );
|
||||
self thread OpenSub(self.SubMenu);
|
||||
}
|
||||
self playLocalSound( "mouse_click" );
|
||||
self thread OpenSub(self.SubMenu);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -154,7 +150,7 @@ MenuSelect()
|
||||
for(;;)
|
||||
{
|
||||
self waittill( "bots_select" );
|
||||
if(self.MenuOpen && getdvarint("bots_main_menu"))
|
||||
if(self.MenuOpen)
|
||||
{
|
||||
self playLocalSound( "mouse_click" );
|
||||
if(self.SubMenu == "Main")
|
||||
|
Reference in New Issue
Block a user