mirror of
https://github.com/ineedbots/iw4_bot_warfare.git
synced 2025-04-21 21:45:43 +00:00
Crate stuck
This commit is contained in:
parent
cad30be47c
commit
5efef605a1
@ -1278,6 +1278,7 @@ onSpawned()
|
|||||||
self.help_time = undefined;
|
self.help_time = undefined;
|
||||||
self.bot_was_follow_script_update = undefined;
|
self.bot_was_follow_script_update = undefined;
|
||||||
self.bot_perf_switch_weapon = undefined;
|
self.bot_perf_switch_weapon = undefined;
|
||||||
|
self.bot_stuck_on_carepackage = undefined;
|
||||||
|
|
||||||
self thread bot_dom_cap_think();
|
self thread bot_dom_cap_think();
|
||||||
}
|
}
|
||||||
@ -1689,6 +1690,7 @@ start_bot_threads()
|
|||||||
self thread bot_equipment_kill_think();
|
self thread bot_equipment_kill_think();
|
||||||
self thread bot_turret_think();
|
self thread bot_turret_think();
|
||||||
|
|
||||||
|
self thread bot_watch_stuck_on_crate();
|
||||||
self thread bot_crate_think();
|
self thread bot_crate_think();
|
||||||
self thread bot_revenge_think();
|
self thread bot_revenge_think();
|
||||||
|
|
||||||
@ -3128,6 +3130,52 @@ bot_turret_think()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Checks if the bot is stuck on a carepackage
|
||||||
|
*/
|
||||||
|
bot_watch_stuck_on_crate()
|
||||||
|
{
|
||||||
|
self endon( "death" );
|
||||||
|
self endon( "disconnect" );
|
||||||
|
level endon("game_ended");
|
||||||
|
|
||||||
|
for (;;)
|
||||||
|
{
|
||||||
|
wait 3;
|
||||||
|
|
||||||
|
if (self HasThreat())
|
||||||
|
continue;
|
||||||
|
|
||||||
|
crates = getEntArray( "care_package", "targetname" );
|
||||||
|
if ( crates.size == 0 )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
crate = undefined;
|
||||||
|
for (i = crates.size - 1; i >= 0; i--)
|
||||||
|
{
|
||||||
|
tempCrate = crates[i];
|
||||||
|
|
||||||
|
if (!isDefined(tempCrate.doingPhysics) || tempCrate.doingPhysics)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (isDefined(crate) && DistanceSquared(crate.origin, self.origin) < DistanceSquared(tempCrate.origin, self.origin))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
crate = tempCrate;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isDefined(crate))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
radius = GetDvarFloat( "player_useRadius" );
|
||||||
|
if (DistanceSquared(crate.origin, self.origin) > radius * radius)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
self.bot_stuck_on_carepackage = crate;
|
||||||
|
self notify("crate_physics_done");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Bots will capture carepackages
|
Bots will capture carepackages
|
||||||
*/
|
*/
|
||||||
@ -3149,6 +3197,10 @@ bot_crate_think()
|
|||||||
else
|
else
|
||||||
ret = self waittill_any_timeout( randomintrange( 3, 5 ), "crate_physics_done" );
|
ret = self waittill_any_timeout( randomintrange( 3, 5 ), "crate_physics_done" );
|
||||||
|
|
||||||
|
crate = self.bot_stuck_on_carepackage;
|
||||||
|
self.bot_stuck_on_carepackage = undefined;
|
||||||
|
if (!isDefined(crate))
|
||||||
|
{
|
||||||
if ( RandomInt( 100 ) < 20 && ret != "crate_physics_done" )
|
if ( RandomInt( 100 ) < 20 && ret != "crate_physics_done" )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@ -3207,7 +3259,9 @@ bot_crate_think()
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
self.bot_lock_goal = true;
|
self.bot_lock_goal = true;
|
||||||
self SetScriptGoal(crate.origin, 64);
|
|
||||||
|
radius = GetDvarFloat( "player_useRadius" );
|
||||||
|
self SetScriptGoal(crate.origin, radius);
|
||||||
self thread bot_inc_bots(crate, true);
|
self thread bot_inc_bots(crate, true);
|
||||||
self thread bots_watch_touch_obj(crate);
|
self thread bots_watch_touch_obj(crate);
|
||||||
|
|
||||||
@ -3218,15 +3272,16 @@ bot_crate_think()
|
|||||||
if (path != "new_goal")
|
if (path != "new_goal")
|
||||||
self ClearScriptGoal();
|
self ClearScriptGoal();
|
||||||
|
|
||||||
if (path != "goal" || DistanceSquared(self.origin, crate.origin) > 64*64)
|
if (path != "goal" || DistanceSquared(self.origin, crate.origin) > radius*radius)
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
self _DisableWeapon();
|
self _DisableWeapon();
|
||||||
self BotFreezeControls(true);
|
self BotFreezeControls(true);
|
||||||
|
|
||||||
waitTime = 5;
|
waitTime = 3;
|
||||||
if (crate.owner == self)
|
if (crate.owner == self)
|
||||||
waitTime = 1.5;
|
waitTime = 0.5;
|
||||||
|
|
||||||
crate waittill_notify_or_timeout("captured", waitTime);
|
crate waittill_notify_or_timeout("captured", waitTime);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user