From 63f5ebe0146c9f9dec79339909056a8075026b1e Mon Sep 17 00:00:00 2001 From: Marco Cawthorne Date: Mon, 25 Jul 2022 08:58:52 -0700 Subject: [PATCH] Bot and hostage fixes to work better against upstream Nuclide, as the APIs are getting standardized. --- src/server/bot.qc | 13 ++++++++----- src/server/hostage_entity.qc | 14 ++++++++++---- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/src/server/bot.qc b/src/server/bot.qc index 3e33c73..4a482bc 100644 --- a/src/server/bot.qc +++ b/src/server/bot.qc @@ -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!"); } diff --git a/src/server/hostage_entity.qc b/src/server/hostage_entity.qc index d26435b..3c32b81 100644 --- a/src/server/hostage_entity.qc +++ b/src/server/hostage_entity.qc @@ -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