summaryrefslogtreecommitdiffstats
path: root/src/Mobs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Mobs')
-rw-r--r--src/Mobs/MagmaCube.cpp14
-rw-r--r--src/Mobs/MagmaCube.h6
-rw-r--r--src/Mobs/Monster.cpp8
-rw-r--r--src/Mobs/Monster.h2
-rw-r--r--src/Mobs/Path.cpp2
-rw-r--r--src/Mobs/Path.h2
-rw-r--r--src/Mobs/Slime.cpp2
-rw-r--r--src/Mobs/Slime.h2
8 files changed, 27 insertions, 11 deletions
diff --git a/src/Mobs/MagmaCube.cpp b/src/Mobs/MagmaCube.cpp
index 3e9abc108..c5dd0def0 100644
--- a/src/Mobs/MagmaCube.cpp
+++ b/src/Mobs/MagmaCube.cpp
@@ -7,7 +7,7 @@
cMagmaCube::cMagmaCube(int a_Size) :
- super("MagmaCube", mtMagmaCube, "mob.MagmaCube.big", "mob.MagmaCube.big", 0.6 * a_Size, 0.6 * a_Size),
+ super("MagmaCube", mtMagmaCube, Printf("mob.magmacube.%s", GetSizeName(a_Size).c_str()), Printf("mob.magmacube.%s", GetSizeName(a_Size).c_str()), 0.6 * a_Size, 0.6 * a_Size),
m_Size(a_Size)
{
}
@@ -27,4 +27,14 @@ void cMagmaCube::GetDrops(cItems & a_Drops, cEntity * a_Killer)
-
+AString cMagmaCube::GetSizeName(int a_Size)
+{
+ if (a_Size > 1)
+ {
+ return "big";
+ }
+ else
+ {
+ return "small";
+ }
+}
diff --git a/src/Mobs/MagmaCube.h b/src/Mobs/MagmaCube.h
index d66ea423a..b914dc867 100644
--- a/src/Mobs/MagmaCube.h
+++ b/src/Mobs/MagmaCube.h
@@ -19,10 +19,14 @@ public:
virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = nullptr) override;
int GetSize(void) const { return m_Size; }
+
+ /** Returns the text describing the slime's size, as used by the client's resource subsystem for sounds.
+ Returns either "big" or "small". */
+ static AString GetSizeName(int a_Size);
protected:
- /// Size of the MagmaCube, 1 .. 3, with 1 being the smallest
+ /// Size of the MagmaCube, 1, 2 and 4, with 1 being the smallest
int m_Size;
} ;
diff --git a/src/Mobs/Monster.cpp b/src/Mobs/Monster.cpp
index 1cc6e7391..f3f8c6b24 100644
--- a/src/Mobs/Monster.cpp
+++ b/src/Mobs/Monster.cpp
@@ -264,12 +264,14 @@ bool cMonster::EnsureProperDestination(cChunk & a_Chunk)
cChunk * Chunk = a_Chunk.GetNeighborChunk(FloorC(m_FinalDestination.x), FloorC(m_FinalDestination.z));
BLOCKTYPE BlockType;
NIBBLETYPE BlockMeta;
- int RelX = FloorC(m_FinalDestination.x) - Chunk->GetPosX() * cChunkDef::Width;
- int RelZ = FloorC(m_FinalDestination.z) - Chunk->GetPosZ() * cChunkDef::Width;
+
if ((Chunk == nullptr) || !Chunk->IsValid())
{
return false;
}
+
+ int RelX = FloorC(m_FinalDestination.x) - Chunk->GetPosX() * cChunkDef::Width;
+ int RelZ = FloorC(m_FinalDestination.z) - Chunk->GetPosZ() * cChunkDef::Width;
// If destination in the air, go down to the lowest air block.
while (m_FinalDestination.y > 0)
@@ -958,7 +960,7 @@ cMonster * cMonster::NewMonsterFromType(eMonsterType a_MobType)
{
case mtMagmaCube:
{
- toReturn = new cMagmaCube(Random.NextInt(2) + 1);
+ toReturn = new cMagmaCube(1 << Random.NextInt(3)); // Size 1, 2 or 4
break;
}
case mtSlime:
diff --git a/src/Mobs/Monster.h b/src/Mobs/Monster.h
index a2295777a..5d20ba810 100644
--- a/src/Mobs/Monster.h
+++ b/src/Mobs/Monster.h
@@ -224,7 +224,7 @@ protected:
Calls ResetPathFinding and sets m_IsFollowingPath to false */
void StopMovingToPosition();
- /** Sets the body yaw and head yaw/pitch based on next/ultimate destinations */
+ /** Sets the body yaw and head yaw / pitch based on next / ultimate destinations */
void SetPitchAndYawFromDestination(void);
virtual void HandleFalling(void);
diff --git a/src/Mobs/Path.cpp b/src/Mobs/Path.cpp
index 8abbc4cac..ba7d615ae 100644
--- a/src/Mobs/Path.cpp
+++ b/src/Mobs/Path.cpp
@@ -8,7 +8,7 @@
#define DISTANCE_MANHATTAN 0 // 1: More speed, a bit less accuracy 0: Max accuracy, less speed.
#define HEURISTICS_ONLY 0 // 1: Much more speed, much less accurate.
-#define CALCULATIONS_PER_STEP 60 // Higher means more CPU load but faster path calculations.
+#define CALCULATIONS_PER_STEP 5 // Higher means more CPU load but faster path calculations.
// The only version which guarantees the shortest path is 0, 0.
enum class eCellStatus {OPENLIST, CLOSEDLIST, NOLIST};
diff --git a/src/Mobs/Path.h b/src/Mobs/Path.h
index 0d903adb6..adae77984 100644
--- a/src/Mobs/Path.h
+++ b/src/Mobs/Path.h
@@ -12,7 +12,7 @@ Put this in your .cpp:
*/
#ifdef COMPILING_PATHFIND_DEBUGGER
- /* Note: the COMPILING_PATHFIND_DEBUGGER flag is used by Native/WiseOldMan95 to debug
+ /* Note: the COMPILING_PATHFIND_DEBUGGER flag is used by Native / WiseOldMan95 to debug
this class outside of MCServer. This preprocessor flag is never set when compiling MCServer. */
#include "PathFinderIrrlicht_Head.h"
#endif
diff --git a/src/Mobs/Slime.cpp b/src/Mobs/Slime.cpp
index e42501e47..7fc4821d8 100644
--- a/src/Mobs/Slime.cpp
+++ b/src/Mobs/Slime.cpp
@@ -89,7 +89,7 @@ void cSlime::KilledBy(TakeDamageInfo & a_TDI)
-const AString cSlime::GetSizeName(int a_Size) const
+AString cSlime::GetSizeName(int a_Size)
{
if (a_Size > 1)
{
diff --git a/src/Mobs/Slime.h b/src/Mobs/Slime.h
index 29605992d..40131b101 100644
--- a/src/Mobs/Slime.h
+++ b/src/Mobs/Slime.h
@@ -27,7 +27,7 @@ public:
/** Returns the text describing the slime's size, as used by the client's resource subsystem for sounds.
Returns either "big" or "small". */
- const AString GetSizeName(int a_Size) const;
+ static AString GetSizeName(int a_Size);
protected: