summaryrefslogtreecommitdiffstats
path: root/src/Mobs/Monster.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Mobs/Monster.cpp')
-rw-r--r--src/Mobs/Monster.cpp87
1 files changed, 0 insertions, 87 deletions
diff --git a/src/Mobs/Monster.cpp b/src/Mobs/Monster.cpp
index 9afdce562..757a0d700 100644
--- a/src/Mobs/Monster.cpp
+++ b/src/Mobs/Monster.cpp
@@ -748,93 +748,6 @@ void cMonster::EventSeePlayer(cPlayer * a_SeenPlayer, cChunk & a_Chunk)
void cMonster::EventLosePlayer(void)
{
SetTarget(nullptr);
- m_EMState = IDLE;
-}
-
-
-
-
-
-void cMonster::InStateIdle(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
-{
- if (m_PathfinderActivated)
- {
- return; // Still getting there
- }
-
- m_IdleInterval += a_Dt;
-
- if (m_IdleInterval > std::chrono::seconds(1))
- {
- auto & Random = GetRandomProvider();
-
- // At this interval the results are predictable
- int rem = Random.RandInt(1, 7);
- m_IdleInterval -= std::chrono::seconds(1); // So nothing gets dropped when the server hangs for a few seconds
-
- Vector3d Dist;
- Dist.x = static_cast<double>(Random.RandInt(-5, 5));
- Dist.z = static_cast<double>(Random.RandInt(-5, 5));
-
- if ((Dist.SqrLength() > 2) && (rem >= 3))
- {
-
- Vector3d Destination(GetPosX() + Dist.x, GetPosition().y, GetPosZ() + Dist.z);
-
- cChunk * Chunk = a_Chunk.GetNeighborChunk(static_cast<int>(Destination.x), static_cast<int>(Destination.z));
- if ((Chunk == nullptr) || !Chunk->IsValid())
- {
- return;
- }
-
- BLOCKTYPE BlockType;
- NIBBLETYPE BlockMeta;
- int RelX = static_cast<int>(Destination.x) - Chunk->GetPosX() * cChunkDef::Width;
- int RelZ = static_cast<int>(Destination.z) - Chunk->GetPosZ() * cChunkDef::Width;
- int YBelowUs = static_cast<int>(Destination.y) - 1;
- if (YBelowUs >= 0)
- {
- Chunk->GetBlockTypeMeta(RelX, YBelowUs, RelZ, BlockType, BlockMeta);
- if (BlockType != E_BLOCK_STATIONARY_WATER) // Idle mobs shouldn't enter water on purpose
- {
- MoveToPosition(Destination);
- }
- }
- }
- }
-}
-
-
-
-
-
-// What to do if in Chasing State
-// This state should always be defined in each child class
-void cMonster::InStateChasing(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
-{
- UNUSED(a_Dt);
-}
-
-
-
-
-
-// What to do if in Escaping State
-void cMonster::InStateEscaping(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
-{
- UNUSED(a_Dt);
-
- if (GetTarget() != nullptr)
- {
- Vector3d newloc = GetPosition();
- newloc.x = (GetTarget()->GetPosition().x < newloc.x)? (newloc.x + m_SightDistance): (newloc.x - m_SightDistance);
- newloc.z = (GetTarget()->GetPosition().z < newloc.z)? (newloc.z + m_SightDistance): (newloc.z - m_SightDistance);
- MoveToPosition(newloc);
- }
- else
- {
- m_EMState = IDLE; // This shouldnt be required but just to be safe
- }
}