fix kill count management in CopyFriendliness when used on corpses.

This commit is contained in:
Christoph Oelckers 2024-10-04 18:33:53 +02:00
parent 5b1f0fdc86
commit ccbebfcf34

View file

@ -803,7 +803,7 @@ DEFINE_ACTION_FUNCTION(AActor, GiveInventoryType)
void AActor::CopyFriendliness (AActor *other, bool changeTarget, bool resetHealth) void AActor::CopyFriendliness (AActor *other, bool changeTarget, bool resetHealth)
{ {
Level->total_monsters -= CountsAsKill(); if (health > 0) Level->total_monsters -= CountsAsKill();
TIDtoHate = other->TIDtoHate; TIDtoHate = other->TIDtoHate;
LastLookActor = other->LastLookActor; LastLookActor = other->LastLookActor;
LastLookPlayerNumber = other->LastLookPlayerNumber; LastLookPlayerNumber = other->LastLookPlayerNumber;
@ -818,7 +818,7 @@ void AActor::CopyFriendliness (AActor *other, bool changeTarget, bool resetHealt
LastHeard = target = other->target; LastHeard = target = other->target;
} }
if (resetHealth) health = SpawnHealth(); if (resetHealth) health = SpawnHealth();
Level->total_monsters += CountsAsKill(); if (health > 0) Level->total_monsters += CountsAsKill();
} }
DEFINE_ACTION_FUNCTION(AActor, CopyFriendliness) DEFINE_ACTION_FUNCTION(AActor, CopyFriendliness)