Fixed gunner grenade duck code running twice

This commit is contained in:
BjossiAlfreds 2023-07-24 21:42:18 +00:00
parent c78a7358d3
commit 452ad99821

View file

@ -509,14 +509,6 @@ gunner_duck_down(edict_t *self)
self->monsterinfo.aiflags |= AI_DUCKED; self->monsterinfo.aiflags |= AI_DUCKED;
if (skill->value >= SKILL_HARD)
{
if (random() > 0.5)
{
GunnerGrenade(self);
}
}
self->maxs[2] = self->monsterinfo.base_height - 32; self->maxs[2] = self->monsterinfo.base_height - 32;
self->takedamage = DAMAGE_YES; self->takedamage = DAMAGE_YES;
@ -528,8 +520,23 @@ gunner_duck_down(edict_t *self)
gi.linkentity(self); gi.linkentity(self);
} }
static void
gunner_duck_down_think(edict_t *self)
{
gunner_duck_down(self);
/* rogue code calls duck_down twice, so move this here */
if (skill->value >= SKILL_HARD)
{
if (random() > 0.5)
{
GunnerGrenade(self);
}
}
}
mframe_t gunner_frames_duck[] = { mframe_t gunner_frames_duck[] = {
{ai_move, 1, gunner_duck_down}, {ai_move, 1, gunner_duck_down_think},
{ai_move, 1, NULL}, {ai_move, 1, NULL},
{ai_move, 1, monster_duck_hold}, {ai_move, 1, monster_duck_hold},
{ai_move, 0, NULL}, {ai_move, 0, NULL},