From 70c4c50951125210e9116ef7931c66a493fa7be0 Mon Sep 17 00:00:00 2001 From: BjossiAlfreds Date: Tue, 22 Aug 2023 20:14:47 +0000 Subject: [PATCH] Fix minor AI glitches with turrets --- src/monster/turret/turret.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/monster/turret/turret.c b/src/monster/turret/turret.c index d8b0205..b0193f0 100644 --- a/src/monster/turret/turret.c +++ b/src/monster/turret/turret.c @@ -887,6 +887,7 @@ turret_wake(edict_t *self) self->monsterinfo.sight = turret_sight; self->monsterinfo.search = turret_search; self->monsterinfo.currentmove = &turret_move_stand; + self->takedamage = DAMAGE_AIM; self->movetype = MOVETYPE_NONE; self->monsterinfo.aiflags |= AI_DO_NOT_COUNT; @@ -895,6 +896,11 @@ turret_wake(edict_t *self) stationarymonster_start(self); + if (self->think) + { + self->think(self); + } + if (self->spawnflags & SPAWN_MACHINEGUN) { self->s.skinnum = 1; @@ -915,6 +921,11 @@ turret_activate(edict_t *self, edict_t *other, edict_t *activator) vec3_t forward; edict_t *base; + if (self->movetype == MOVETYPE_PUSH) + { + return; + } + self->movetype = MOVETYPE_PUSH; if (!self->speed) @@ -950,6 +961,10 @@ turret_activate(edict_t *self, edict_t *other, edict_t *activator) { VectorSet(forward, 0, -1, 0); } + else + { + VectorClear(forward); + } /* start up the turret */ VectorMA(self->s.origin, 32, forward, endpos);