- Added A_JumpIfTargetOutsideMeleeRange and A_JumpIfTargetInsideMeleeRange because I thought

I could be clever and have the beggar chase after you some after you attack him, with a
  random chance to cease pursuit. However, that didn't look much different from his normal
  wandering animation, and he usually gave up before getting anywhere near you, so it was
  kind of pointless. I kept the action functions around anyway, since they're simple things that
  somebody else might find useful.
- Added a melee range check to A_SentinelRefire for actors without missile states. This fixes
  Strife's Beggar trying to attack you when you're nowhere near him.

SVN r3863 (trunk)
This commit is contained in:
Randy Heit 2012-09-06 03:36:25 +00:00
parent ef55ce8684
commit a77705e04e
3 changed files with 36 additions and 0 deletions

View file

@ -81,6 +81,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SentinelRefire)
self->target->health <= 0 ||
!P_CheckSight (self, self->target, SF_SEEPASTBLOCKEVERYTHING|SF_SEEPASTSHOOTABLELINES) ||
P_HitFriend(self) ||
(self->MissileState == NULL && !self->CheckMeleeRange()) ||
pr_sentinelrefire() < 40)
{
self->SetState (self->SeeState);

View file

@ -607,6 +607,39 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_JumpIfHealthLower)
ACTION_SET_RESULT(false); // Jumps should never set the result for inventory state chains!
}
//==========================================================================
//
// State jump function
//
//==========================================================================
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_JumpIfTargetOutsideMeleeRange)
{
ACTION_PARAM_START(1);
ACTION_PARAM_STATE(jump, 0);
if (!self->CheckMeleeRange())
{
ACTION_JUMP(jump);
}
ACTION_SET_RESULT(false); // Jumps should never set the result for inventory state chains!
}
//==========================================================================
//
// State jump function
//
//==========================================================================
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_JumpIfTargetInsideMeleeRange)
{
ACTION_PARAM_START(1);
ACTION_PARAM_STATE(jump, 0);
if (self->CheckMeleeRange())
{
ACTION_JUMP(jump);
}
ACTION_SET_RESULT(false); // Jumps should never set the result for inventory state chains!
}
//==========================================================================
//
// State jump function

View file

@ -201,6 +201,8 @@ ACTOR Actor native //: Thinker
action native A_JumpIfCloser(float distance, state label);
action native A_JumpIfTracerCloser(float distance, state label);
action native A_JumpIfMasterCloser(float distance, state label);
action native A_JumpIfTargetOutsideMeleeRange(state label);
action native A_JumpIfTargetInsideMeleeRange(state label);
action native A_JumpIfInventory(class<Inventory> itemtype, int itemamount, state label, int owner = AAPTR_DEFAULT);
action native A_JumpIfArmorType(string Type, state label, int amount = 1);
action native A_GiveInventory(class<Inventory> itemtype, int amount = 0, int giveto = AAPTR_DEFAULT);