mirror of
https://github.com/yquake2/zaero.git
synced 2024-11-10 06:32:04 +00:00
Fixed monsters seeing players during intermissions
This commit is contained in:
parent
cbc0fa522d
commit
544c0e383a
1 changed files with 31 additions and 33 deletions
64
src/g_ai.c
64
src/g_ai.c
|
@ -541,12 +541,10 @@ qboolean FindTarget (edict_t *self)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
client = level.sight_client;
|
client = level.sight_client;
|
||||||
if (!client)
|
|
||||||
return false; // no clients to get mad at
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// if the entity went away, forget it
|
// if the entity went away, forget it
|
||||||
if (!client->inuse)
|
if (!client || !client->inuse || (client->client && level.intermissiontime))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (client == self->enemy)
|
if (client == self->enemy)
|
||||||
|
@ -907,10 +905,36 @@ Decides if we're going to attack or do something else
|
||||||
used by ai_run and ai_stand
|
used by ai_run and ai_stand
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
|
static qboolean hesDeadJim (const edict_t *self)
|
||||||
|
{
|
||||||
|
const edict_t *enemy = self->enemy;
|
||||||
|
|
||||||
|
if (!enemy || !enemy->inuse)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (self->monsterinfo.aiflags & AI_MEDIC)
|
||||||
|
{
|
||||||
|
return (enemy->health > 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (enemy->client && level.intermissiontime)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (self->monsterinfo.aiflags & AI_BRUTAL)
|
||||||
|
{
|
||||||
|
return (enemy->health <= -80);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (enemy->health <= 0);
|
||||||
|
}
|
||||||
|
|
||||||
qboolean ai_checkattack (edict_t *self, float dist)
|
qboolean ai_checkattack (edict_t *self, float dist)
|
||||||
{
|
{
|
||||||
vec3_t temp;
|
vec3_t temp;
|
||||||
qboolean hesDeadJim;
|
|
||||||
|
|
||||||
if (!self)
|
if (!self)
|
||||||
{
|
{
|
||||||
|
@ -950,37 +974,11 @@ qboolean ai_checkattack (edict_t *self, float dist)
|
||||||
enemy_vis = false;
|
enemy_vis = false;
|
||||||
|
|
||||||
// see if the enemy is dead
|
// see if the enemy is dead
|
||||||
hesDeadJim = false;
|
if (hesDeadJim (self))
|
||||||
if ((!self->enemy) || (!self->enemy->inuse))
|
|
||||||
{
|
|
||||||
hesDeadJim = true;
|
|
||||||
}
|
|
||||||
else if (self->monsterinfo.aiflags & AI_MEDIC)
|
|
||||||
{
|
|
||||||
if (self->enemy->health > 0)
|
|
||||||
{
|
|
||||||
hesDeadJim = true;
|
|
||||||
self->monsterinfo.aiflags &= ~AI_MEDIC;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (self->monsterinfo.aiflags & AI_BRUTAL)
|
|
||||||
{
|
|
||||||
if (self->enemy->health <= -80)
|
|
||||||
hesDeadJim = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (self->enemy->health <= 0)
|
|
||||||
hesDeadJim = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (hesDeadJim)
|
|
||||||
{
|
{
|
||||||
self->enemy = NULL;
|
self->enemy = NULL;
|
||||||
// FIXME: look all around for other targets
|
self->monsterinfo.aiflags &= ~AI_MEDIC;
|
||||||
|
|
||||||
if (self->oldenemy && self->oldenemy->health > 0)
|
if (self->oldenemy && self->oldenemy->health > 0)
|
||||||
{
|
{
|
||||||
self->enemy = self->oldenemy;
|
self->enemy = self->oldenemy;
|
||||||
|
|
Loading…
Reference in a new issue