Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rewrite stukabat NPC to support optional fly nav, divebomb telegraphing, ragdolling, unique stukapup model, etc. #262

Merged

Conversation

Blixibon
Copy link
Collaborator

@Blixibon Blixibon commented Mar 8, 2024

This PR makes several changes to the stukabat (or "flying predator") NPC. The highlights of these changes include:

  • Stukabats will now have the ability to use air nodes through a new CanUseFlyNav keyvalue. This allows them to fly around in a similar fashion to crows, dive bombing from different heights and locations around the enemy. This behavior will be disabled by default and must be enabled manually in Hammer or through npc_create KV.
  • The dive bomb animation will now have an approximately ⅔-second "warning" phase before the stukabat actually dive bombs, in an effort to telegraph the attack and make it less abrupt.
  • When killed with minimal damage (e.g. with SMG bullets), stukabats will now ragdoll.
  • Stukapups now have their own model.
  • The field of view of stukabats is now 216 degrees (-0.2, which is relatively common) instead of 45 degrees (0.75). The 45-degree viewcone seems to have been an oversight, as a comment mentions increasing the FOV to prevent tunnel vision, yet the viewcone is smaller than nearly any other NPC. This new FOV also fits in better with the positions of the stukabat's eyes.
  • Stukabats will now have audible wing flapping.

@Blixibon Blixibon requested a review from 1upD March 8, 2024 04:47
Copy link

@1upD 1upD left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left a few questions on the PR, but I don't think any of them are blockers. I'd like to talk about them before I merge this ideally, but either way I am approving this for the next release

@@ -37,6 +37,10 @@ class CNPC_FlyingPredator : public CNPC_BasePredator

virtual int RangeAttack1Conditions( float flDot, float flDist );

// Used by base LOS functions
virtual float InnateRange1MinRange( void ) { return 64.0f; }
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does innate range attack 1 need a minimum range? Why can't they dive bomb from any range?

Copy link
Collaborator Author

@Blixibon Blixibon Mar 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function is used by base LOS tasks such as TASK_GET_PATH_TO_ENEMY_LOS or TASK_GET_FLANK_ARC_PATH_TO_ENEMY_LOS, which are used by the new stukabat schedules. This does not actually prevent stukabats from attacking at this range (or at least not non-flying stukabats).


if ( IsFlying() )
{
// HACKHACK: Slam velocity and pitch/roll to 0
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why? What's the use case for this?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since most NPC functions only compensate for yaw and limited movetypes, this prevents flying stukabats from being caught at an incorrect pitch/roll or velocity when entering scripted sequences (i.e. dynamic interactions).

This is something which probably would've belonged in the PR for predator dynamic interaction fixes.

return true;

// Stukabats gib for any non-crush, non-blast damage greater than 15 (TODO: cvar?)
if ( info.GetDamage() > 15.0f || (info.GetDamageType() & (DMG_CRUSH | DMG_BLAST) ) )
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I want to revisit this later. Perhaps we can implement the exploding ragdolls concept from way back

m_flNextSpitTime = gpGlobals->curtime + GetMinSpitWaitTime();
if ( CapableOfFlyNav() )
{
if (flDist <= InnateRange1MinRange())
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this case specifically for when the stukabat has the capability to use flying navigation?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIRC this is related to flying-capable stukabats being able to go directly back to flying after dive bombing at certain heights. This condition prevents them from getting caught in a loop. Non-flying stukabats don't have this problem because they always fall to the ground after a dive bomb.

@1upD 1upD merged commit 3ac80e3 into entropy-zero:ez2/mapbase Mar 8, 2024
5 checks passed
met-nikita pushed a commit to met-nikita/source-sdk-2013 that referenced this pull request May 9, 2024
…-pistol-upwards-viewkick

weapon_pistol upwards view kick cvar
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants