MCPcopy Create free account
hub / github.com/JACoders/OpenJK / NPC_BSFollowLeader

Function NPC_BSFollowLeader

code/game/NPC_behavior.cpp:748–832  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

746}
747
748void NPC_BSFollowLeader (void)
749{
750 // If In A Jump, Return
751 //----------------------
752 if (NPC_Jumping())
753 {
754 return;
755 }
756
757 // If There Is No Leader, Return
758 //-------------------------------
759 if (!NPC_BSFollowLeader_UpdateLeader())
760 {
761 return;
762 }
763
764 // Don't Do Anything Else If In A Full Body Attack
765 //-------------------------------------------------
766 if (NPC_BSFollowLeader_InFullBodyAttack())
767 {
768 return;
769 }
770
771 // Update The Enemy
772 //------------------
773 NPC_BSFollowLeader_UpdateEnemy();
774
775
776 // Do Any Attacking
777 //------------------
778 if (NPC_BSFollowLeader_CanAttack())
779 {
780 if (NPC_BSFollowLeader_AttackEnemy())
781 {
782 return;
783 }
784 }
785 else
786 {
787 NPC_BSFollowLeader_LookAtLeader();
788 }
789
790
791
792
793
794
795 float followDist = (NPCInfo->followDist)?(NPCInfo->followDist):(110.0f);
796 bool moveSuccess;
797
798 STEER::Activate(NPC);
799 {
800 if (NPC->client->leader->client && NPC->client->leader->client->ps.groundEntityNum!=ENTITYNUM_NONE)
801 {
802 // If Too Close, Back Away Some
803 //------------------------------
804 if (STEER::Reached(NPC, NPC->client->leader, 65.0f))
805 {

Callers 4

NPC_BSDefaultFunction · 0.70
NPC_BSJedi_FollowLeaderFunction · 0.70
NPC_BehaviorSet_CharmedFunction · 0.70
NPC_BehaviorSet_DefaultFunction · 0.70

Tested by

no test coverage detected