fixed logic bug with HitFriend and Refire functions.

The old code was essentially ineffective and useless, this is how MBF had it and how it was supposed to be.
This commit is contained in:
Christoph Oelckers 2024-10-03 22:30:09 +02:00
parent 3798fd815f
commit b667b930a3
3 changed files with 15 additions and 3 deletions

View file

@ -342,12 +342,16 @@ extend class Actor
void A_CPosRefire()
{
if (HitFriend())
{
SetState(SeeState);
return;
}
// keep firing unless target got out of sight
A_FaceTarget();
if (Random[CPosRefire](0, 255) >= 40)
{
if (!target
|| HitFriend()
|| target.health <= 0
|| !CheckSight(target, SF_SEEPASTBLOCKEVERYTHING|SF_SEEPASTSHOOTABLELINES))
{

View file

@ -73,12 +73,16 @@ extend class Actor
{
void A_SpidRefire()
{
if (HitFriend())
{
SetState(SeeState);
return;
}
// keep firing unless target got out of sight
A_FaceTarget();
if (Random[CPosRefire](0, 255) >= 10)
{
if (!target
|| HitFriend()
|| target.health <= 0
|| !CheckSight(target, SF_SEEPASTBLOCKEVERYTHING|SF_SEEPASTSHOOTABLELINES))
{

View file

@ -164,13 +164,17 @@ extend class Actor
void A_SentinelRefire()
{
A_FaceTarget ();
if (HitFriend())
{
SetState(SeeState);
return;
}
if (random[SentinelRefire]() >= 30)
{
if (target == NULL ||
target.health <= 0 ||
!CheckSight (target, SF_SEEPASTBLOCKEVERYTHING|SF_SEEPASTSHOOTABLELINES) ||
HitFriend() ||
(MissileState == NULL && !CheckMeleeRange()) ||
random[SentinelRefire]() < 40)
{