mirror of
https://github.com/ineedbots/iw3_bot_warfare.git
synced 2025-04-20 17:55:42 +00:00
bot_wait_for_host
This commit is contained in:
parent
37e0fced03
commit
34698fdd39
@ -582,6 +582,8 @@ teamBots()
|
|||||||
addBots()
|
addBots()
|
||||||
{
|
{
|
||||||
level endon("game_ended");
|
level endon("game_ended");
|
||||||
|
|
||||||
|
bot_wait_for_host();
|
||||||
|
|
||||||
for(;;)
|
for(;;)
|
||||||
{
|
{
|
||||||
|
@ -661,6 +661,64 @@ waittill_notify_or_timeout(not, tim)
|
|||||||
wait tim;
|
wait tim;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Gets a player who is host
|
||||||
|
*/
|
||||||
|
GetHostPlayer()
|
||||||
|
{
|
||||||
|
for (i = 0; i < level.player.size; i++)
|
||||||
|
{
|
||||||
|
player = level.players[i];
|
||||||
|
|
||||||
|
if (!player is_host())
|
||||||
|
continue;
|
||||||
|
|
||||||
|
return player;
|
||||||
|
}
|
||||||
|
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Waits for a host player
|
||||||
|
*/
|
||||||
|
bot_wait_for_host()
|
||||||
|
{
|
||||||
|
host = undefined;
|
||||||
|
|
||||||
|
for(i = 0; i < 100; i++)
|
||||||
|
{
|
||||||
|
host = GetHostPlayer();
|
||||||
|
|
||||||
|
if(isDefined(host))
|
||||||
|
break;
|
||||||
|
|
||||||
|
wait 0.05;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!isDefined(host))
|
||||||
|
return;
|
||||||
|
|
||||||
|
for(i = 0; i < 100; i++)
|
||||||
|
{
|
||||||
|
if(IsDefined( host.pers[ "team" ] ))
|
||||||
|
break;
|
||||||
|
|
||||||
|
wait 0.05;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!IsDefined( host.pers[ "team" ] ))
|
||||||
|
return;
|
||||||
|
|
||||||
|
for(i = 0; i < 100; i++)
|
||||||
|
{
|
||||||
|
if(host.pers[ "team" ] == "allies" || host.pers[ "team" ] == "axis")
|
||||||
|
break;
|
||||||
|
|
||||||
|
wait 0.05;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Pezbot's line sphere intersection.
|
Pezbot's line sphere intersection.
|
||||||
http://paulbourke.net/geometry/circlesphere/raysphere.c
|
http://paulbourke.net/geometry/circlesphere/raysphere.c
|
||||||
|
Loading…
x
Reference in New Issue
Block a user