Toggleable player following. (#1583)

* Added MF8_DONTFOLLOWPLAYERS.

Added the MF8_DONTFOLLOWPLAYERS flag, which allows friendly monsters to not follow their FriendPlayer when they have no target or goal left to head to.

* Changed the order that the DONTFOLLOWPLAYERS check runs in.

This is done to not produce unnecessary overhead on hostile monsters.
This commit is contained in:
inkoalawetrust 2022-04-08 06:32:16 +03:00 committed by GitHub
commit 3d1ddbc80e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 1 deletions

View file

@ -1092,7 +1092,7 @@ void P_RandomChaseDir (AActor *actor)
int turndir;
// Friendly monsters like to head toward a player
if (actor->flags & MF_FRIENDLY)
if (actor->flags & MF_FRIENDLY && !(actor->flags8 & MF8_DONTFOLLOWPLAYERS))
{
AActor *player;
DVector2 delta;