Advertisement
Guest User

Cuberite Mob AI superman fix.

a guest
Dec 11th, 2020
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.93 KB | None | 0 0
  1. diff --git a/src/Mobs/AggressiveMonster.cpp b/src/Mobs/AggressiveMonster.cpp
  2. index a904ac2da..1bf392e1a 100644
  3. --- a/src/Mobs/AggressiveMonster.cpp
  4. +++ b/src/Mobs/AggressiveMonster.cpp
  5. @@ -38,13 +38,23 @@ void cAggressiveMonster::InStateChasing(std::chrono::milliseconds a_Dt, cChunk &
  6.  
  7.  void cAggressiveMonster::EventSeePlayer(cPlayer * a_Player, cChunk & a_Chunk)
  8.  {
  9. +
  10.     if (!a_Player->CanMobsTarget())
  11.     {
  12.         return;
  13.     }
  14.  
  15. -   Super::EventSeePlayer(a_Player, a_Chunk);
  16. -   m_EMState = CHASING;
  17. +   Vector3d MyHeadPosition1 = GetPosition() + Vector3d(0, GetHeight(), 0);
  18. +   Vector3d TargetPosition1 = a_Player->GetPosition() + Vector3d(0, a_Player->GetHeight(), 0);
  19. +   if (cLineBlockTracer::LineOfSightTrace(*GetWorld(), MyHeadPosition1, TargetPosition1, cLineBlockTracer::losAirWaterLava))
  20. +   {
  21. +       //LOGINFO("Mob Saw Player!");
  22. +       Super::EventSeePlayer(a_Player, a_Chunk);
  23. +       m_EMState = CHASING;
  24. +   }   else{
  25. +       return;
  26. +   }
  27. +
  28.  }
  29.  
  30.  
  31.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement