summaryrefslogtreecommitdiffstats
path: root/source/Mobs
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2013-10-18 12:41:43 +0200
committerMattes D <github@xoft.cz>2013-10-18 12:41:43 +0200
commit8bba2b02a132d236703835d93ab18e09e0ea7230 (patch)
treee637945c6eb845e82c4f2790c07c6fd82a1f79ef /source/Mobs
parentAPIDump: Renamed output for helper stuff. (diff)
parentRemoved reading default values from settings.ini for worlds. (diff)
downloadcuberite-8bba2b02a132d236703835d93ab18e09e0ea7230.tar
cuberite-8bba2b02a132d236703835d93ab18e09e0ea7230.tar.gz
cuberite-8bba2b02a132d236703835d93ab18e09e0ea7230.tar.bz2
cuberite-8bba2b02a132d236703835d93ab18e09e0ea7230.tar.lz
cuberite-8bba2b02a132d236703835d93ab18e09e0ea7230.tar.xz
cuberite-8bba2b02a132d236703835d93ab18e09e0ea7230.tar.zst
cuberite-8bba2b02a132d236703835d93ab18e09e0ea7230.zip
Diffstat (limited to 'source/Mobs')
-rw-r--r--source/Mobs/AggressiveMonster.cpp2
-rw-r--r--source/Mobs/AggressiveMonster.h1
-rw-r--r--source/Mobs/Bat.cpp15
-rw-r--r--source/Mobs/Bat.h7
-rw-r--r--source/Mobs/IncludeAllMonsters.h29
-rw-r--r--source/Mobs/Monster.cpp6
-rw-r--r--source/Mobs/Monster.h15
-rw-r--r--source/Mobs/PassiveMonster.cpp1
-rw-r--r--source/Mobs/PassiveMonster.h1
-rw-r--r--source/Mobs/Squid.cpp1
-rw-r--r--source/Mobs/Squid.h1
11 files changed, 70 insertions, 9 deletions
diff --git a/source/Mobs/AggressiveMonster.cpp b/source/Mobs/AggressiveMonster.cpp
index 2eae772d7..93dba6d7b 100644
--- a/source/Mobs/AggressiveMonster.cpp
+++ b/source/Mobs/AggressiveMonster.cpp
@@ -95,5 +95,3 @@ void cAggressiveMonster::Tick(float a_Dt, cChunk & a_Chunk)
}
-
-
diff --git a/source/Mobs/AggressiveMonster.h b/source/Mobs/AggressiveMonster.h
index 1eff1831e..f22ed5b89 100644
--- a/source/Mobs/AggressiveMonster.h
+++ b/source/Mobs/AggressiveMonster.h
@@ -19,6 +19,7 @@ public:
virtual void InStateChasing(float a_Dt) override;
virtual void EventSeePlayer(cEntity *) override;
+
protected:
float m_ChaseTime;
diff --git a/source/Mobs/Bat.cpp b/source/Mobs/Bat.cpp
new file mode 100644
index 000000000..715f25483
--- /dev/null
+++ b/source/Mobs/Bat.cpp
@@ -0,0 +1,15 @@
+
+#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
+
+#include "Bat.h"
+#include "../Vector3d.h"
+#include "../Chunk.h"
+
+
+cBat::cBat(void) :
+ // TODO: The size is only a guesstimate, measure in vanilla and fix the size values here
+ super("Bat", 65, "mob.bat.hurt", "mob.bat.death", 0.7, 0.7)
+{
+}
+
+
diff --git a/source/Mobs/Bat.h b/source/Mobs/Bat.h
index 0b50e06cd..e878d0ee8 100644
--- a/source/Mobs/Bat.h
+++ b/source/Mobs/Bat.h
@@ -13,13 +13,10 @@ class cBat :
typedef cPassiveMonster super;
public:
- cBat(void) :
- super("Bat", 65, "mob.bat.hurt", "mob.bat.death", 0.5, 0.9)
- {
- }
+ cBat(void);
CLASS_PROTODEF(cBat);
-
+
bool IsHanging(void) const {return false; }
} ;
diff --git a/source/Mobs/IncludeAllMonsters.h b/source/Mobs/IncludeAllMonsters.h
new file mode 100644
index 000000000..1b436a11f
--- /dev/null
+++ b/source/Mobs/IncludeAllMonsters.h
@@ -0,0 +1,29 @@
+#include "Bat.h"
+#include "Blaze.h"
+#include "Cavespider.h"
+#include "Chicken.h"
+#include "Cow.h"
+#include "Creeper.h"
+#include "Enderman.h"
+#include "EnderDragon.h"
+#include "Ghast.h"
+#include "Giant.h"
+#include "Horse.h"
+#include "IronGolem.h"
+#include "Magmacube.h"
+#include "Mooshroom.h"
+#include "Ocelot.h"
+#include "Pig.h"
+#include "Sheep.h"
+#include "Silverfish.h"
+#include "Skeleton.h"
+#include "Slime.h"
+#include "SnowGolem.h"
+#include "Spider.h"
+#include "Squid.h"
+#include "Villager.h"
+#include "Witch.h"
+#include "Wither.h"
+#include "Wolf.h"
+#include "Zombie.h"
+#include "Zombiepigman.h"
diff --git a/source/Mobs/Monster.cpp b/source/Mobs/Monster.cpp
index 334229a42..51ea644d3 100644
--- a/source/Mobs/Monster.cpp
+++ b/source/Mobs/Monster.cpp
@@ -9,6 +9,7 @@
#include "../Entities/Player.h"
#include "../Defines.h"
#include "../MonsterConfig.h"
+#include "../MobTypesManager.h"
#include "../MersenneTwister.h"
#include "../Vector3f.h"
@@ -17,6 +18,7 @@
#include "../Tracer.h"
#include "../Chunk.h"
+
// #include "../../iniFile/iniFile.h"
@@ -510,3 +512,7 @@ void cMonster::HandleDaylightBurning(cChunk & a_Chunk)
+cMonster::eFamily cMonster::GetMobFamily(void) const
+{
+ return cMobTypesManager::getFamilyFromType(GetMobTypeAsEnum());
+}
diff --git a/source/Mobs/Monster.h b/source/Mobs/Monster.h
index d784f2eec..be60d9e00 100644
--- a/source/Mobs/Monster.h
+++ b/source/Mobs/Monster.h
@@ -55,7 +55,17 @@ public:
mtWolf = E_META_SPAWN_EGG_WOLF,
mtZombie = E_META_SPAWN_EGG_ZOMBIE,
mtZombiePigman = E_META_SPAWN_EGG_ZOMBIE_PIGMAN,
+ mtInvalidType
+ } ;
+
+ enum eFamily
+ {
+ mfHostile = 0, // Spider, Zombies ...
+ mfPassive = 1, // Cows, Pigs
+ mfAmbient = 2, // Bats
+ mfWater = 3, // Squid
+ mfMaxplusone, // Nothing. Be sure this is the last and the others are in order
} ;
// tolua_end
@@ -82,7 +92,10 @@ public:
virtual void MoveToPosition(const Vector3f & a_Position);
virtual bool ReachedDestination(void);
- char GetMobType(void) const {return m_MobType; }
+ char GetMobType(void) const {return m_MobType; } // MG TODO : see if we can delete this one.
+ eType GetMobTypeAsEnum(void) const {return (eType)m_MobType; } // MG TODO : see if we should store m_MobType as enum instead of char.
+ eFamily GetMobFamily(void) const;
+
const char * GetState();
void SetState(const AString & str);
diff --git a/source/Mobs/PassiveMonster.cpp b/source/Mobs/PassiveMonster.cpp
index 7a6140c04..8c69c8059 100644
--- a/source/Mobs/PassiveMonster.cpp
+++ b/source/Mobs/PassiveMonster.cpp
@@ -56,3 +56,4 @@ void cPassiveMonster::Tick(float a_Dt, cChunk & a_Chunk)
+
diff --git a/source/Mobs/PassiveMonster.h b/source/Mobs/PassiveMonster.h
index ae0bea3fb..908bb0ce6 100644
--- a/source/Mobs/PassiveMonster.h
+++ b/source/Mobs/PassiveMonster.h
@@ -19,6 +19,7 @@ public:
/// When hit by someone, run away
virtual void DoTakeDamage(TakeDamageInfo & a_TDI) override;
+
} ;
diff --git a/source/Mobs/Squid.cpp b/source/Mobs/Squid.cpp
index cb796f5ec..e6a44079a 100644
--- a/source/Mobs/Squid.cpp
+++ b/source/Mobs/Squid.cpp
@@ -54,4 +54,3 @@ void cSquid::Tick(float a_Dt, cChunk & a_Chunk)
-
diff --git a/source/Mobs/Squid.h b/source/Mobs/Squid.h
index 35d7295b3..ad299b95c 100644
--- a/source/Mobs/Squid.h
+++ b/source/Mobs/Squid.h
@@ -20,6 +20,7 @@ public:
CLASS_PROTODEF(cSquid);
virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override;
+
} ;