Bot and hostage fixes to work better against upstream Nuclide, as the APIs are getting standardized.

This commit is contained in:
Marco Cawthorne 2022-07-25 08:58:52 -07:00
parent 164308a4f6
commit 63f5ebe014
Signed by: eukara
GPG key ID: CE2032F0A2882A22
2 changed files with 18 additions and 9 deletions

View file

@ -42,7 +42,7 @@ csbot::RunToConfront(void)
ChatSayTeam("Going to run to the enemy spawn!");
if (t)
route_calculate(this, t.origin, 0, Bot_RouteCB);
RouteToPosition(t.origin);
}
/* go to the planted bomb */
void
@ -50,8 +50,11 @@ csbot::RunToBomb(void)
{
entity e = world;
e = find(e, ::model, "models/w_c4bomb.mdl");
route_calculate(this, e.origin, 0, Bot_RouteCB);
ChatSayTeam("Going to run to the bomb!");
if (e) {
RouteToPosition(e.origin);
ChatSayTeam("Going to run to the bomb!");
}
}
/* go to a random bombsite */
@ -69,7 +72,7 @@ csbot::RunToBombsite(void)
vecTarget[1] = e.absmin[1] + (0.5 * (e.absmax[1] - e.absmin[1]));
vecTarget[2] = e.absmin[2] + (0.5 * (e.absmax[2] - e.absmin[2]));
route_calculate(this, vecTarget, 0, Bot_RouteCB);
RouteToPosition(vecTarget);
ChatSayTeam("Going to run to a bomb site!");
}
@ -80,7 +83,7 @@ csbot::RunToHostages(void)
e = find(e, ::classname, "hostage_entity");
route_calculate(this, e.origin, 0, Bot_RouteCB);
RouteToPosition(e.origin);
ChatSayTeam("Going to run to the hostages!");
}

View file

@ -89,8 +89,15 @@ class hostage_entity:NSTalkMonster
virtual int(void) AnimIdle;
virtual int(void) AnimWalk;
virtual int(void) AnimRun;
//virtual float(void) GetWalkSpeed;
};
float
hostage_entity::GetWalkSpeed(void)
{
return 128;
}
int
hostage_entity::AnimIdle(void)
{
@ -131,7 +138,7 @@ hostage_entity::OnPlayerUse(void)
void
hostage_entity::Pain(void)
{
if (style == MONSTER_DEAD)
if (IsAlive() == false)
return;
switch (g_dmg_iHitBody) {
@ -167,7 +174,7 @@ hostage_entity::Death(void)
{
WarnAllies();
if (style != MONSTER_DEAD) {
if (IsAlive() == true) {
switch (g_dmg_iHitBody) {
case BODY_HEAD:
SetFrame(HOSA_DIE_HEADSHOT);
@ -191,12 +198,11 @@ hostage_entity::Death(void)
}
/* HACK: don't let them gib */
health = 0;
SetHealth(0);
/* now mark our state as 'dead' */
super::Death();
SetSolid(SOLID_NOT);
health = 0;
}
void