summaryrefslogtreecommitdiffstats
path: root/source/Mobs
diff options
context:
space:
mode:
Diffstat (limited to 'source/Mobs')
-rw-r--r--source/Mobs/AggressiveMonster.cpp4
-rw-r--r--source/Mobs/AggressiveMonster.h2
-rw-r--r--source/Mobs/Bat.h3
-rw-r--r--source/Mobs/Blaze.cpp5
-rw-r--r--source/Mobs/Blaze.h2
-rw-r--r--source/Mobs/Cavespider.cpp5
-rw-r--r--source/Mobs/Cavespider.h2
-rw-r--r--source/Mobs/Chicken.cpp6
-rw-r--r--source/Mobs/Chicken.h2
-rw-r--r--source/Mobs/Cow.cpp6
-rw-r--r--source/Mobs/Cow.h2
-rw-r--r--source/Mobs/Creeper.cpp4
-rw-r--r--source/Mobs/Creeper.h2
-rw-r--r--source/Mobs/Enderman.cpp5
-rw-r--r--source/Mobs/Enderman.h2
-rw-r--r--source/Mobs/Ghast.cpp4
-rw-r--r--source/Mobs/Ghast.h2
-rw-r--r--source/Mobs/Magmacube.cpp7
-rw-r--r--source/Mobs/Magmacube.h10
-rw-r--r--source/Mobs/Monster.cpp11
-rw-r--r--source/Mobs/Monster.h4
-rw-r--r--source/Mobs/Mooshroom.cpp6
-rw-r--r--source/Mobs/Mooshroom.h2
-rw-r--r--source/Mobs/Ocelot.h3
-rw-r--r--source/Mobs/PassiveAggressiveMonster.cpp4
-rw-r--r--source/Mobs/PassiveAggressiveMonster.h2
-rw-r--r--source/Mobs/PassiveMonster.cpp4
-rw-r--r--source/Mobs/PassiveMonster.h2
-rw-r--r--source/Mobs/Pig.cpp6
-rw-r--r--source/Mobs/Pig.h2
-rw-r--r--source/Mobs/Sheep.cpp4
-rw-r--r--source/Mobs/Sheep.h2
-rw-r--r--source/Mobs/Silverfish.h3
-rw-r--r--source/Mobs/Skeleton.cpp9
-rw-r--r--source/Mobs/Skeleton.h2
-rw-r--r--source/Mobs/Slime.cpp8
-rw-r--r--source/Mobs/Slime.h10
-rw-r--r--source/Mobs/Spider.cpp4
-rw-r--r--source/Mobs/Spider.h2
-rw-r--r--source/Mobs/Squid.cpp13
-rw-r--r--source/Mobs/Squid.h2
-rw-r--r--source/Mobs/Villager.cpp2
-rw-r--r--source/Mobs/Witch.cpp4
-rw-r--r--source/Mobs/Witch.h2
-rw-r--r--source/Mobs/Wolf.h3
-rw-r--r--source/Mobs/Zombie.cpp9
-rw-r--r--source/Mobs/Zombie.h2
-rw-r--r--source/Mobs/Zombiepigman.cpp11
-rw-r--r--source/Mobs/Zombiepigman.h4
49 files changed, 124 insertions, 93 deletions
diff --git a/source/Mobs/AggressiveMonster.cpp b/source/Mobs/AggressiveMonster.cpp
index de73e6123..c6befa0ed 100644
--- a/source/Mobs/AggressiveMonster.cpp
+++ b/source/Mobs/AggressiveMonster.cpp
@@ -11,8 +11,8 @@
-cAggressiveMonster::cAggressiveMonster(const AString & a_ConfigName, char a_ProtocolMobType, const AString & a_SoundHurt, const AString & a_SoundDeath) :
- super(a_ConfigName, a_ProtocolMobType, a_SoundHurt, a_SoundDeath),
+cAggressiveMonster::cAggressiveMonster(const AString & a_ConfigName, char a_ProtocolMobType, const AString & a_SoundHurt, const AString & a_SoundDeath, double a_Width, double a_Height) :
+ super(a_ConfigName, a_ProtocolMobType, a_SoundHurt, a_SoundDeath, a_Width, a_Height),
m_ChaseTime(999999)
{
m_EMPersonality = AGGRESSIVE;
diff --git a/source/Mobs/AggressiveMonster.h b/source/Mobs/AggressiveMonster.h
index ed21c6344..1eff1831e 100644
--- a/source/Mobs/AggressiveMonster.h
+++ b/source/Mobs/AggressiveMonster.h
@@ -13,7 +13,7 @@ class cAggressiveMonster :
typedef cMonster super;
public:
- cAggressiveMonster(const AString & a_ConfigName, char a_ProtocolMobType, const AString & a_SoundHurt, const AString & a_SoundDeath);
+ cAggressiveMonster(const AString & a_ConfigName, char a_ProtocolMobType, const AString & a_SoundHurt, const AString & a_SoundDeath, double a_Width, double a_Height);
virtual void Tick (float a_Dt, cChunk & a_Chunk) override;
virtual void InStateChasing(float a_Dt) override;
diff --git a/source/Mobs/Bat.h b/source/Mobs/Bat.h
index 35c0f99a6..df6745fe5 100644
--- a/source/Mobs/Bat.h
+++ b/source/Mobs/Bat.h
@@ -14,7 +14,8 @@ class cBat :
public:
cBat(void) :
- super("Bat", 65, "mob.bat.hurt", "mob.bat.death")
+ // 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/Blaze.cpp b/source/Mobs/Blaze.cpp
index e6e2d7ec2..069ee8934 100644
--- a/source/Mobs/Blaze.cpp
+++ b/source/Mobs/Blaze.cpp
@@ -8,7 +8,8 @@
cBlaze::cBlaze(void) :
- super("Blaze", 61, "mob.blaze.hit", "mob.blaze.death")
+ // TODO: The size is only a guesstimate, measure in vanilla and fix the size values here
+ super("Blaze", 61, "mob.blaze.hit", "mob.blaze.death", 0.7, 1.8)
{
}
@@ -16,7 +17,7 @@ cBlaze::cBlaze(void) :
-void cBlaze::GetDrops(cItems & a_Drops, cPawn * a_Killer)
+void cBlaze::GetDrops(cItems & a_Drops, cEntity * a_Killer)
{
AddRandomDropItem(a_Drops, 0, 1, E_ITEM_BLAZE_ROD);
}
diff --git a/source/Mobs/Blaze.h b/source/Mobs/Blaze.h
index a897d7e8a..8b7a15848 100644
--- a/source/Mobs/Blaze.h
+++ b/source/Mobs/Blaze.h
@@ -17,7 +17,7 @@ public:
CLASS_PROTODEF(cBlaze);
- virtual void GetDrops(cItems & a_Drops, cPawn * a_Killer = NULL) override;
+ virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override;
} ;
diff --git a/source/Mobs/Cavespider.cpp b/source/Mobs/Cavespider.cpp
index e4030af57..b547362ad 100644
--- a/source/Mobs/Cavespider.cpp
+++ b/source/Mobs/Cavespider.cpp
@@ -8,7 +8,8 @@
cCavespider::cCavespider(void) :
- super("Cavespider", 59, "mob.spider.say", "mob.spider.death")
+ // TODO: The size is only a guesstimate, measure in vanilla and fix the size values here
+ super("Cavespider", 59, "mob.spider.say", "mob.spider.death", 0.9, 0.6)
{
}
@@ -28,7 +29,7 @@ void cCavespider::Tick(float a_Dt, cChunk & a_Chunk)
-void cCavespider::GetDrops(cItems & a_Drops, cPawn * a_Killer)
+void cCavespider::GetDrops(cItems & a_Drops, cEntity * a_Killer)
{
AddRandomDropItem(a_Drops, 0, 2, E_ITEM_STRING);
AddRandomDropItem(a_Drops, 0, 1, E_ITEM_SPIDER_EYE);
diff --git a/source/Mobs/Cavespider.h b/source/Mobs/Cavespider.h
index 00a4e16df..10ea03f7b 100644
--- a/source/Mobs/Cavespider.h
+++ b/source/Mobs/Cavespider.h
@@ -18,7 +18,7 @@ public:
CLASS_PROTODEF(cCaveSpider);
virtual void Tick(float a_Dt, cChunk & a_Chunk) override;
- virtual void GetDrops(cItems & a_Drops, cPawn * a_Killer = NULL) override;
+ virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override;
} ;
diff --git a/source/Mobs/Chicken.cpp b/source/Mobs/Chicken.cpp
index e506bb7a8..3da9781d3 100644
--- a/source/Mobs/Chicken.cpp
+++ b/source/Mobs/Chicken.cpp
@@ -14,7 +14,7 @@
cChicken::cChicken(void) :
- super("Chicken", 93, "mob.chicken.hurt", "mob.chicken.hurt")
+ super("Chicken", 93, "mob.chicken.hurt", "mob.chicken.hurt", 0.3, 0.4)
{
}
@@ -22,10 +22,10 @@ cChicken::cChicken(void) :
-void cChicken::GetDrops(cItems & a_Drops, cPawn * a_Killer)
+void cChicken::GetDrops(cItems & a_Drops, cEntity * a_Killer)
{
AddRandomDropItem(a_Drops, 0, 2, E_ITEM_FEATHER);
- a_Drops.push_back(cItem((GetMetaData() == BURNING) ? E_ITEM_COOKED_CHICKEN : E_ITEM_RAW_CHICKEN, 1));
+ a_Drops.push_back(cItem(IsOnFire() ? E_ITEM_COOKED_CHICKEN : E_ITEM_RAW_CHICKEN, 1));
}
diff --git a/source/Mobs/Chicken.h b/source/Mobs/Chicken.h
index ed36df4d5..2f674e908 100644
--- a/source/Mobs/Chicken.h
+++ b/source/Mobs/Chicken.h
@@ -17,7 +17,7 @@ public:
CLASS_PROTODEF(cChicken);
- virtual void GetDrops(cItems & a_Drops, cPawn * a_Killer = NULL) override;
+ virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override;
} ;
diff --git a/source/Mobs/Cow.cpp b/source/Mobs/Cow.cpp
index 31a431af4..8e9b87d27 100644
--- a/source/Mobs/Cow.cpp
+++ b/source/Mobs/Cow.cpp
@@ -14,7 +14,7 @@
cCow::cCow(void) :
- super("Cow", 92, "mob.cow.hurt", "mob.cow.hurt")
+ super("Cow", 92, "mob.cow.hurt", "mob.cow.hurt", 0.9, 1.3)
{
}
@@ -22,10 +22,10 @@ cCow::cCow(void) :
-void cCow::GetDrops(cItems & a_Drops, cPawn * a_Killer)
+void cCow::GetDrops(cItems & a_Drops, cEntity * a_Killer)
{
AddRandomDropItem(a_Drops, 0, 2, E_ITEM_LEATHER);
- AddRandomDropItem(a_Drops, 1, 3, (GetMetaData() == BURNING) ? E_ITEM_STEAK : E_ITEM_RAW_BEEF);
+ AddRandomDropItem(a_Drops, 1, 3, IsOnFire() ? E_ITEM_STEAK : E_ITEM_RAW_BEEF);
}
diff --git a/source/Mobs/Cow.h b/source/Mobs/Cow.h
index d50c8df08..b90cb170e 100644
--- a/source/Mobs/Cow.h
+++ b/source/Mobs/Cow.h
@@ -17,7 +17,7 @@ public:
CLASS_PROTODEF(cCow);
- virtual void GetDrops(cItems & a_Drops, cPawn * a_Killer = NULL) override;
+ virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override;
} ;
diff --git a/source/Mobs/Creeper.cpp b/source/Mobs/Creeper.cpp
index 44b5e76cd..9b1b68b79 100644
--- a/source/Mobs/Creeper.cpp
+++ b/source/Mobs/Creeper.cpp
@@ -8,7 +8,7 @@
cCreeper::cCreeper(void) :
- super("Creeper", 50, "mob.creeper.say", "mob.creeper.say")
+ super("Creeper", 50, "mob.creeper.say", "mob.creeper.say", 0.6, 1.8)
{
}
@@ -16,7 +16,7 @@ cCreeper::cCreeper(void) :
-void cCreeper::GetDrops(cItems & a_Drops, cPawn * a_Killer)
+void cCreeper::GetDrops(cItems & a_Drops, cEntity * a_Killer)
{
AddRandomDropItem(a_Drops, 0, 2, E_ITEM_GUNPOWDER);
diff --git a/source/Mobs/Creeper.h b/source/Mobs/Creeper.h
index 721847cb5..c1d46f462 100644
--- a/source/Mobs/Creeper.h
+++ b/source/Mobs/Creeper.h
@@ -17,7 +17,7 @@ public:
CLASS_PROTODEF(cCreeper);
- virtual void GetDrops(cItems & a_Drops, cPawn * a_Killer = NULL) override;
+ virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override;
} ;
diff --git a/source/Mobs/Enderman.cpp b/source/Mobs/Enderman.cpp
index 356815be0..1dc47876f 100644
--- a/source/Mobs/Enderman.cpp
+++ b/source/Mobs/Enderman.cpp
@@ -8,7 +8,8 @@
cEnderman::cEnderman(void) :
- super("Enderman", 58, "mob.endermen.hit", "mob.endermen.death")
+ // TODO: The size is only a guesstimate, measure in vanilla and fix the size values here
+ super("Enderman", 58, "mob.endermen.hit", "mob.endermen.death", 0.5, 2.5)
{
}
@@ -16,7 +17,7 @@ cEnderman::cEnderman(void) :
-void cEnderman::GetDrops(cItems & a_Drops, cPawn * a_Killer)
+void cEnderman::GetDrops(cItems & a_Drops, cEntity * a_Killer)
{
AddRandomDropItem(a_Drops, 0, 1, E_ITEM_ENDER_PEARL);
}
diff --git a/source/Mobs/Enderman.h b/source/Mobs/Enderman.h
index 44719ea5a..c4f4ee364 100644
--- a/source/Mobs/Enderman.h
+++ b/source/Mobs/Enderman.h
@@ -17,7 +17,7 @@ public:
CLASS_PROTODEF(cEnderman);
- virtual void GetDrops(cItems & a_Drops, cPawn * a_Killer = NULL) override;
+ virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override;
} ;
diff --git a/source/Mobs/Ghast.cpp b/source/Mobs/Ghast.cpp
index 1d0e074b8..288d0c28a 100644
--- a/source/Mobs/Ghast.cpp
+++ b/source/Mobs/Ghast.cpp
@@ -8,7 +8,7 @@
cGhast::cGhast(void) :
- super("Ghast", 56, "mob.ghast.scream", "mob.ghast.death")
+ super("Ghast", 56, "mob.ghast.scream", "mob.ghast.death", 4, 4)
{
}
@@ -16,7 +16,7 @@ cGhast::cGhast(void) :
-void cGhast::GetDrops(cItems & a_Drops, cPawn * a_Killer)
+void cGhast::GetDrops(cItems & a_Drops, cEntity * a_Killer)
{
AddRandomDropItem(a_Drops, 0, 2, E_ITEM_GUNPOWDER);
AddRandomDropItem(a_Drops, 0, 1, E_ITEM_GHAST_TEAR);
diff --git a/source/Mobs/Ghast.h b/source/Mobs/Ghast.h
index b560d6907..f9b60dfcf 100644
--- a/source/Mobs/Ghast.h
+++ b/source/Mobs/Ghast.h
@@ -17,7 +17,7 @@ public:
CLASS_PROTODEF(cGhast);
- virtual void GetDrops(cItems & a_Drops, cPawn * a_Killer = NULL) override;
+ virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override;
} ;
diff --git a/source/Mobs/Magmacube.cpp b/source/Mobs/Magmacube.cpp
index fb9228c08..156a29607 100644
--- a/source/Mobs/Magmacube.cpp
+++ b/source/Mobs/Magmacube.cpp
@@ -7,8 +7,9 @@
-cMagmacube::cMagmacube(void) :
- super("Magmacube", 62, "mob.magmacube.big", "mob.magmacube.big")
+cMagmacube::cMagmacube(int a_Size) :
+ super("Magmacube", 62, "mob.magmacube.big", "mob.magmacube.big", 0.6 * a_Size, 0.6 * a_Size),
+ m_Size(a_Size)
{
}
@@ -16,7 +17,7 @@ cMagmacube::cMagmacube(void) :
-void cMagmacube::GetDrops(cItems & a_Drops, cPawn * a_Killer)
+void cMagmacube::GetDrops(cItems & a_Drops, cEntity * a_Killer)
{
AddRandomDropItem(a_Drops, 0, 1, E_ITEM_MAGMA_CREAM);
}
diff --git a/source/Mobs/Magmacube.h b/source/Mobs/Magmacube.h
index 863ba7072..da62b9615 100644
--- a/source/Mobs/Magmacube.h
+++ b/source/Mobs/Magmacube.h
@@ -13,11 +13,17 @@ class cMagmacube :
typedef cAggressiveMonster super;
public:
- cMagmacube();
+ /// Creates a magmacube of the specified size; size is 1 .. 3, with 1 being the smallest
+ cMagmacube(int a_Size);
CLASS_PROTODEF(cMagmacube);
- virtual void GetDrops(cItems & a_Drops, cPawn * a_Killer = NULL) override;
+ virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override;
+
+protected:
+
+ /// Size of the magmacube, 1 .. 3, with 1 being the smallest
+ int m_Size;
} ;
diff --git a/source/Mobs/Monster.cpp b/source/Mobs/Monster.cpp
index 0176175e9..706649cb2 100644
--- a/source/Mobs/Monster.cpp
+++ b/source/Mobs/Monster.cpp
@@ -22,8 +22,8 @@
-cMonster::cMonster(const AString & a_ConfigName, char a_ProtocolMobType, const AString & a_SoundHurt, const AString & a_SoundDeath)
- : super(etMob)
+cMonster::cMonster(const AString & a_ConfigName, char a_ProtocolMobType, const AString & a_SoundHurt, const AString & a_SoundDeath, double a_Width, double a_Height)
+ : super(etMob, a_Width, a_Height)
, m_Target(NULL)
, m_bMovingToDestination(false)
, m_DestinationTime( 0 )
@@ -204,10 +204,13 @@ void cMonster::DoTakeDamage(TakeDamageInfo & a_TDI)
-void cMonster::KilledBy(cPawn * a_Killer)
+void cMonster::KilledBy(cEntity * a_Killer)
{
super::KilledBy(a_Killer);
- if(m_SoundHurt != "") m_World->BroadcastSoundEffect(m_SoundDeath, (int)(GetPosX() * 8), (int)(GetPosY() * 8), (int)(GetPosZ() * 8), 1.0f, 0.8f);
+ if (m_SoundHurt != "")
+ {
+ m_World->BroadcastSoundEffect(m_SoundDeath, (int)(GetPosX() * 8), (int)(GetPosY() * 8), (int)(GetPosZ() * 8), 1.0f, 0.8f);
+ }
m_DestroyTimer = 0;
}
diff --git a/source/Mobs/Monster.h b/source/Mobs/Monster.h
index ec27df38a..ea7f935ea 100644
--- a/source/Mobs/Monster.h
+++ b/source/Mobs/Monster.h
@@ -31,7 +31,7 @@ public:
* a_ProtocolMobType is the ID of the mob used in the protocol ( http://wiki.vg/Entities#Mobs , 2012_12_22)
* a_SoundHurt and a_SoundDeath are assigned into m_SoundHurt and m_SoundDeath, respectively
*/
- cMonster(const AString & a_ConfigName, char a_ProtocolMobType, const AString & a_SoundHurt, const AString & a_SoundDeath);
+ cMonster(const AString & a_ConfigName, char a_ProtocolMobType, const AString & a_SoundHurt, const AString & a_SoundDeath, double a_Width, double a_Height);
CLASS_PROTODEF(cMonster);
@@ -41,7 +41,7 @@ public:
virtual void DoTakeDamage(TakeDamageInfo & a_TDI) override;
- virtual void KilledBy(cPawn * a_Killer) override;
+ virtual void KilledBy(cEntity * a_Killer) override;
virtual void MoveToPosition(const Vector3f & a_Position);
virtual bool ReachedDestination(void);
diff --git a/source/Mobs/Mooshroom.cpp b/source/Mobs/Mooshroom.cpp
index 1ef1d600d..c85ceda3a 100644
--- a/source/Mobs/Mooshroom.cpp
+++ b/source/Mobs/Mooshroom.cpp
@@ -14,7 +14,7 @@
cMooshroom::cMooshroom(void) :
- super("Mooshroom", 96, "mob.cow.hurt", "mob.cow.hurt")
+ super("Mooshroom", 96, "mob.cow.hurt", "mob.cow.hurt", 0.9, 1.3)
{
}
@@ -22,10 +22,10 @@ cMooshroom::cMooshroom(void) :
-void cMooshroom::GetDrops(cItems & a_Drops, cPawn * a_Killer)
+void cMooshroom::GetDrops(cItems & a_Drops, cEntity * a_Killer)
{
AddRandomDropItem(a_Drops, 0, 2, E_ITEM_LEATHER);
- AddRandomDropItem(a_Drops, 1, 3, (GetMetaData() == BURNING) ? E_ITEM_STEAK : E_ITEM_RAW_BEEF);
+ AddRandomDropItem(a_Drops, 1, 3, IsOnFire() ? E_ITEM_STEAK : E_ITEM_RAW_BEEF);
}
diff --git a/source/Mobs/Mooshroom.h b/source/Mobs/Mooshroom.h
index c50c04ed8..20fc293b9 100644
--- a/source/Mobs/Mooshroom.h
+++ b/source/Mobs/Mooshroom.h
@@ -17,7 +17,7 @@ public:
CLASS_PROTODEF(cMooshroom);
- virtual void GetDrops(cItems & a_Drops, cPawn * a_Killer = NULL) override;
+ virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override;
} ;
diff --git a/source/Mobs/Ocelot.h b/source/Mobs/Ocelot.h
index 76ee6815e..4d22575f2 100644
--- a/source/Mobs/Ocelot.h
+++ b/source/Mobs/Ocelot.h
@@ -14,7 +14,8 @@ class cOcelot :
public:
cOcelot(void) :
- super("Ocelot", 98, "mob.cat.hitt", "mob.cat.hitt")
+ // TODO: The size is only a guesstimate, measure in vanilla and fix the size values here
+ super("Ocelot", 98, "mob.cat.hitt", "mob.cat.hitt", 0.9, 0.5)
{
}
diff --git a/source/Mobs/PassiveAggressiveMonster.cpp b/source/Mobs/PassiveAggressiveMonster.cpp
index 41258c788..f1e231a09 100644
--- a/source/Mobs/PassiveAggressiveMonster.cpp
+++ b/source/Mobs/PassiveAggressiveMonster.cpp
@@ -9,8 +9,8 @@
-cPassiveAggressiveMonster::cPassiveAggressiveMonster(const AString & a_ConfigName, char a_ProtocolMobType, const AString & a_SoundHurt, const AString & a_SoundDeath) :
- super(a_ConfigName, a_ProtocolMobType, a_SoundHurt, a_SoundDeath)
+cPassiveAggressiveMonster::cPassiveAggressiveMonster(const AString & a_ConfigName, char a_ProtocolMobType, const AString & a_SoundHurt, const AString & a_SoundDeath, double a_Width, double a_Height) :
+ super(a_ConfigName, a_ProtocolMobType, a_SoundHurt, a_SoundDeath, a_Width, a_Height)
{
m_EMPersonality = PASSIVE;
}
diff --git a/source/Mobs/PassiveAggressiveMonster.h b/source/Mobs/PassiveAggressiveMonster.h
index abb6a7abd..243dfff38 100644
--- a/source/Mobs/PassiveAggressiveMonster.h
+++ b/source/Mobs/PassiveAggressiveMonster.h
@@ -13,7 +13,7 @@ class cPassiveAggressiveMonster :
typedef cAggressiveMonster super;
public:
- cPassiveAggressiveMonster(const AString & a_ConfigName, char a_ProtocolMobType, const AString & a_SoundHurt, const AString & a_SoundDeath);
+ cPassiveAggressiveMonster(const AString & a_ConfigName, char a_ProtocolMobType, const AString & a_SoundHurt, const AString & a_SoundDeath, double a_Width, double a_Height);
virtual void DoTakeDamage(TakeDamageInfo & a_TDI) override;
} ;
diff --git a/source/Mobs/PassiveMonster.cpp b/source/Mobs/PassiveMonster.cpp
index 22bc17f6f..96cc1ba8f 100644
--- a/source/Mobs/PassiveMonster.cpp
+++ b/source/Mobs/PassiveMonster.cpp
@@ -8,8 +8,8 @@
-cPassiveMonster::cPassiveMonster(const AString & a_ConfigName, char a_ProtocolMobType, const AString & a_SoundHurt, const AString & a_SoundDeath) :
- super(a_ConfigName, a_ProtocolMobType, a_SoundHurt, a_SoundDeath)
+cPassiveMonster::cPassiveMonster(const AString & a_ConfigName, char a_ProtocolMobType, const AString & a_SoundHurt, const AString & a_SoundDeath, double a_Width, double a_Height) :
+ super(a_ConfigName, a_ProtocolMobType, a_SoundHurt, a_SoundDeath, a_Width, a_Height)
{
m_EMPersonality = PASSIVE;
}
diff --git a/source/Mobs/PassiveMonster.h b/source/Mobs/PassiveMonster.h
index 8abbd8687..ae0bea3fb 100644
--- a/source/Mobs/PassiveMonster.h
+++ b/source/Mobs/PassiveMonster.h
@@ -13,7 +13,7 @@ class cPassiveMonster :
typedef cMonster super;
public:
- cPassiveMonster(const AString & a_ConfigName, char a_ProtocolMobType, const AString & a_SoundHurt, const AString & a_SoundDeath);
+ cPassiveMonster(const AString & a_ConfigName, char a_ProtocolMobType, const AString & a_SoundHurt, const AString & a_SoundDeath, double a_Width, double a_Height);
virtual void Tick(float a_Dt, cChunk & a_Chunk) override;
diff --git a/source/Mobs/Pig.cpp b/source/Mobs/Pig.cpp
index a71476e00..9df2c2571 100644
--- a/source/Mobs/Pig.cpp
+++ b/source/Mobs/Pig.cpp
@@ -8,7 +8,7 @@
cPig::cPig(void) :
- super("Pig", 90, "mob.pig.say", "mob.pig.death")
+ super("Pig", 90, "mob.pig.say", "mob.pig.death", 0.9, 0.9)
{
}
@@ -16,9 +16,9 @@ cPig::cPig(void) :
-void cPig::GetDrops(cItems & a_Drops, cPawn * a_Killer)
+void cPig::GetDrops(cItems & a_Drops, cEntity * a_Killer)
{
- AddRandomDropItem(a_Drops, 1, 3, (GetMetaData() == BURNING) ? E_ITEM_COOKED_PORKCHOP : E_ITEM_RAW_PORKCHOP);
+ AddRandomDropItem(a_Drops, 1, 3, IsOnFire() ? E_ITEM_COOKED_PORKCHOP : E_ITEM_RAW_PORKCHOP);
}
diff --git a/source/Mobs/Pig.h b/source/Mobs/Pig.h
index 995f2a593..ae790ac2f 100644
--- a/source/Mobs/Pig.h
+++ b/source/Mobs/Pig.h
@@ -17,7 +17,7 @@ public:
CLASS_PROTODEF(cPig);
- virtual void GetDrops(cItems & a_Drops, cPawn * a_Killer = NULL) override;
+ virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override;
} ;
diff --git a/source/Mobs/Sheep.cpp b/source/Mobs/Sheep.cpp
index 174c8a9d3..2f371f384 100644
--- a/source/Mobs/Sheep.cpp
+++ b/source/Mobs/Sheep.cpp
@@ -9,7 +9,7 @@
cSheep::cSheep(void) :
- super("Sheep", 91, "mob.sheep.say", "mob.sheep.say"),
+ super("Sheep", 91, "mob.sheep.say", "mob.sheep.say", 0.6, 1.3),
m_IsSheared(false),
m_WoolColor(E_META_WOOL_WHITE)
{
@@ -19,7 +19,7 @@ cSheep::cSheep(void) :
-void cSheep::GetDrops(cItems & a_Drops, cPawn * a_Killer)
+void cSheep::GetDrops(cItems & a_Drops, cEntity * a_Killer)
{
if (!m_IsSheared)
{
diff --git a/source/Mobs/Sheep.h b/source/Mobs/Sheep.h
index 801cf97d7..369fc78c5 100644
--- a/source/Mobs/Sheep.h
+++ b/source/Mobs/Sheep.h
@@ -20,7 +20,7 @@ public:
CLASS_PROTODEF(cSheep);
- virtual void GetDrops(cItems & a_Drops, cPawn * a_Killer = NULL) override;
+ virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override;
} ;
diff --git a/source/Mobs/Silverfish.h b/source/Mobs/Silverfish.h
index 24a9cf38b..7d675a9c0 100644
--- a/source/Mobs/Silverfish.h
+++ b/source/Mobs/Silverfish.h
@@ -14,7 +14,8 @@ class cSilverfish :
public:
cSilverfish(void) :
- super("Silverfish", 60, "mob.silverfish.hit", "mob.silverfish.kill")
+ // TODO: The size is only a guesstimate, measure in vanilla and fix the size values here
+ super("Silverfish", 60, "mob.silverfish.hit", "mob.silverfish.kill", 0.9, 0.3)
{
}
diff --git a/source/Mobs/Skeleton.cpp b/source/Mobs/Skeleton.cpp
index b2b0c325d..8dacbece8 100644
--- a/source/Mobs/Skeleton.cpp
+++ b/source/Mobs/Skeleton.cpp
@@ -8,7 +8,7 @@
cSkeleton::cSkeleton(void) :
- super("Skeleton", 51, "mob.skeleton.hurt", "mob.skeleton.death")
+ super("Skeleton", 51, "mob.skeleton.hurt", "mob.skeleton.death", 0.6, 1.8)
{
}
@@ -22,9 +22,10 @@ void cSkeleton::Tick(float a_Dt, cChunk & a_Chunk)
// TODO Outsource
// TODO should do SkyLight check, mobs in the dark donīt burn
- if ((GetWorld()->GetTimeOfDay() < (12000 + 1000)) && !IsBurning())
+ if ((GetWorld()->GetTimeOfDay() < (12000 + 1000)) && !IsOnFire())
{
- SetMetaData(BURNING); // BURN, BABY, BURN! >:D
+ // Burn for 10 ticks, then decide again
+ StartBurning(10);
}
}
@@ -32,7 +33,7 @@ void cSkeleton::Tick(float a_Dt, cChunk & a_Chunk)
-void cSkeleton::GetDrops(cItems & a_Drops, cPawn * a_Killer)
+void cSkeleton::GetDrops(cItems & a_Drops, cEntity * a_Killer)
{
AddRandomDropItem(a_Drops, 0, 2, E_ITEM_ARROW);
AddRandomDropItem(a_Drops, 0, 2, E_ITEM_BONE);
diff --git a/source/Mobs/Skeleton.h b/source/Mobs/Skeleton.h
index e0b537cc8..bc541bac2 100644
--- a/source/Mobs/Skeleton.h
+++ b/source/Mobs/Skeleton.h
@@ -18,7 +18,7 @@ public:
CLASS_PROTODEF(cSkeleton);
virtual void Tick(float a_Dt, cChunk & a_Chunk) override;
- virtual void GetDrops(cItems & a_Drops, cPawn * a_Killer = NULL) override;
+ virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override;
} ;
diff --git a/source/Mobs/Slime.cpp b/source/Mobs/Slime.cpp
index ee7093b73..b209ac869 100644
--- a/source/Mobs/Slime.cpp
+++ b/source/Mobs/Slime.cpp
@@ -9,8 +9,10 @@
-cSlime::cSlime(void) :
- super("Slime", 55, "mob.slime.attack", "mob.slime.attack")
+/// Creates a slime of the specified size; size is 1 .. 3, with 1 being the smallest
+cSlime::cSlime(int a_Size) :
+ super("Slime", 55, "mob.slime.attack", "mob.slime.attack", 0.6 * a_Size, 0.6 * a_Size),
+ m_Size(a_Size)
{
}
@@ -18,7 +20,7 @@ cSlime::cSlime(void) :
-void cSlime::GetDrops(cItems & a_Drops, cPawn * a_Killer)
+void cSlime::GetDrops(cItems & a_Drops, cEntity * a_Killer)
{
// TODO: only when tiny
AddRandomDropItem(a_Drops, 0, 2, E_ITEM_SLIMEBALL);
diff --git a/source/Mobs/Slime.h b/source/Mobs/Slime.h
index 17bf0807a..88136ff32 100644
--- a/source/Mobs/Slime.h
+++ b/source/Mobs/Slime.h
@@ -13,11 +13,17 @@ class cSlime :
typedef cAggressiveMonster super;
public:
- cSlime(void);
+ /// Creates a slime of the specified size; size is 1 .. 3, with 1 being the smallest
+ cSlime(int a_Size);
CLASS_PROTODEF(cSlime);
- virtual void GetDrops(cItems & a_Drops, cPawn * a_Killer = NULL) override;
+ virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override;
+
+protected:
+
+ /// Size of the slime, 1 .. 3, with 1 being the smallest
+ int m_Size;
} ;
diff --git a/source/Mobs/Spider.cpp b/source/Mobs/Spider.cpp
index 4e671e7ab..2f244cdbc 100644
--- a/source/Mobs/Spider.cpp
+++ b/source/Mobs/Spider.cpp
@@ -8,7 +8,7 @@
cSpider::cSpider(void) :
- super("Spider", 52, "mob.spider.say", "mob.spider.death")
+ super("Spider", 52, "mob.spider.say", "mob.spider.death", 1.4, 0.9)
{
}
@@ -16,7 +16,7 @@ cSpider::cSpider(void) :
-void cSpider::GetDrops(cItems & a_Drops, cPawn * a_Killer)
+void cSpider::GetDrops(cItems & a_Drops, cEntity * a_Killer)
{
AddRandomDropItem(a_Drops, 0, 2, E_ITEM_STRING);
AddRandomDropItem(a_Drops, 0, 1, E_ITEM_SPIDER_EYE);
diff --git a/source/Mobs/Spider.h b/source/Mobs/Spider.h
index 17a954a02..51e65d028 100644
--- a/source/Mobs/Spider.h
+++ b/source/Mobs/Spider.h
@@ -17,7 +17,7 @@ public:
CLASS_PROTODEF(cSpider);
- virtual void GetDrops(cItems & a_Drops, cPawn * a_Killer = NULL) override;
+ virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override;
} ;
diff --git a/source/Mobs/Squid.cpp b/source/Mobs/Squid.cpp
index 78dd37393..09236f3c5 100644
--- a/source/Mobs/Squid.cpp
+++ b/source/Mobs/Squid.cpp
@@ -3,13 +3,14 @@
#include "Squid.h"
#include "../Vector3d.h"
+#include "../Chunk.h"
cSquid::cSquid(void) :
- super("Squid", 94, "", "")
+ super("Squid", 94, "", "", 0.95, 0.95)
{
}
@@ -17,7 +18,7 @@ cSquid::cSquid(void) :
-void cSquid::GetDrops(cItems & a_Drops, cPawn * a_Killer)
+void cSquid::GetDrops(cItems & a_Drops, cEntity * a_Killer)
{
// Drops 0-3 Ink Sacs
AddRandomDropItem(a_Drops, 0, 3, E_ITEM_DYE, E_META_DYE_BLACK);
@@ -29,15 +30,17 @@ void cSquid::GetDrops(cItems & a_Drops, cPawn * a_Killer)
void cSquid::Tick(float a_Dt, cChunk & a_Chunk)
{
- // TODO: Rewrite this function to use a_Chunk instead of m_World
super::Tick(a_Dt, a_Chunk);
Vector3d Pos = GetPosition();
// TODO: Not a real behavior, but cool :D
- if (!IsBlockWater(GetWorld()->GetBlock((int) Pos.x, (int) Pos.y, (int) Pos.z)) && !IsBurning())
+ int RelX = (int)floor(Pos.x + 0.5) - a_Chunk.GetPosX() * cChunkDef::Width;
+ int RelZ = (int)floor(Pos.z + 0.5) - a_Chunk.GetPosZ() * cChunkDef::Width;
+ if (!IsBlockWater(a_Chunk.GetBlock(RelX, (int)Pos.y, RelZ)) && !IsOnFire())
{
- SetMetaData(BURNING);
+ // Burn for 10 ticks, then decide again
+ StartBurning(10);
}
}
diff --git a/source/Mobs/Squid.h b/source/Mobs/Squid.h
index de205f397..35d7295b3 100644
--- a/source/Mobs/Squid.h
+++ b/source/Mobs/Squid.h
@@ -19,7 +19,7 @@ public:
CLASS_PROTODEF(cSquid);
- virtual void GetDrops(cItems & a_Drops, cPawn * a_Killer = NULL) override;
+ virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override;
} ;
diff --git a/source/Mobs/Villager.cpp b/source/Mobs/Villager.cpp
index 1bc5fb86b..0ec2cf76c 100644
--- a/source/Mobs/Villager.cpp
+++ b/source/Mobs/Villager.cpp
@@ -8,7 +8,7 @@
cVillager::cVillager(void) :
- super("Villager", 120, "", "")
+ super("Villager", 120, "", "", 0.6, 1.8)
{
}
diff --git a/source/Mobs/Witch.cpp b/source/Mobs/Witch.cpp
index ee77d066b..66295ed1b 100644
--- a/source/Mobs/Witch.cpp
+++ b/source/Mobs/Witch.cpp
@@ -8,7 +8,7 @@
cWitch::cWitch(void) :
- super("Witch", 66, "", "")
+ super("Witch", 66, "", "", 0.6, 1.8)
{
}
@@ -16,7 +16,7 @@ cWitch::cWitch(void) :
-void cWitch::GetDrops(cItems & a_Drops, cPawn * a_Killer)
+void cWitch::GetDrops(cItems & a_Drops, cEntity * a_Killer)
{
AddRandomDropItem(a_Drops, 0, 6, E_ITEM_GLASS_BOTTLE);
AddRandomDropItem(a_Drops, 0, 6, E_ITEM_GLOWSTONE_DUST);
diff --git a/source/Mobs/Witch.h b/source/Mobs/Witch.h
index 5b8c7ba4f..2ca2c081f 100644
--- a/source/Mobs/Witch.h
+++ b/source/Mobs/Witch.h
@@ -17,7 +17,7 @@ public:
CLASS_PROTODEF(cWitch);
- virtual void GetDrops(cItems & a_Drops, cPawn * a_Killer = NULL) override;
+ virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override;
} ;
diff --git a/source/Mobs/Wolf.h b/source/Mobs/Wolf.h
index 7247f823c..405df80a6 100644
--- a/source/Mobs/Wolf.h
+++ b/source/Mobs/Wolf.h
@@ -14,7 +14,8 @@ class cWolf :
public:
cWolf(void) :
- super("Wolf", 95, "mob.wolf.hurt", "mob.wolf.death")
+ // TODO: The size is only a guesstimate, measure in vanilla and fix the size values here (wiki.vg values are suspicious)
+ super("Wolf", 95, "mob.wolf.hurt", "mob.wolf.death", 0.9, 0.9)
{
}
diff --git a/source/Mobs/Zombie.cpp b/source/Mobs/Zombie.cpp
index cf0391b4c..d0a929519 100644
--- a/source/Mobs/Zombie.cpp
+++ b/source/Mobs/Zombie.cpp
@@ -8,7 +8,7 @@
cZombie::cZombie(void) :
- super("Zombie", 54, "mob.zombie.hurt", "mob.zombie.death")
+ super("Zombie", 54, "mob.zombie.hurt", "mob.zombie.death", 0.6, 1.8)
{
}
@@ -21,9 +21,10 @@ void cZombie::Tick(float a_Dt, cChunk & a_Chunk)
super::Tick(a_Dt, a_Chunk);
// TODO Same as in cSkeleton :D
- if ((GetWorld()->GetTimeOfDay() < (12000 + 1000)) && !IsBurning())
+ if ((GetWorld()->GetTimeOfDay() < (12000 + 1000)) && !IsOnFire())
{
- SetMetaData(BURNING); // BURN, BABY, BURN! >:D
+ // Burn for 10 ticks, then decide again
+ StartBurning(10);
}
}
@@ -31,7 +32,7 @@ void cZombie::Tick(float a_Dt, cChunk & a_Chunk)
-void cZombie::GetDrops(cItems & a_Drops, cPawn * a_Killer)
+void cZombie::GetDrops(cItems & a_Drops, cEntity * a_Killer)
{
AddRandomDropItem(a_Drops, 0, 2, E_ITEM_ROTTEN_FLESH);
diff --git a/source/Mobs/Zombie.h b/source/Mobs/Zombie.h
index 5813a900b..61f8e3bb8 100644
--- a/source/Mobs/Zombie.h
+++ b/source/Mobs/Zombie.h
@@ -17,7 +17,7 @@ public:
CLASS_PROTODEF(cZombie);
virtual void Tick(float a_Dt, cChunk & a_Chunk) override;
- virtual void GetDrops(cItems & a_Drops, cPawn * a_Killer = NULL) override;
+ virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override;
} ;
diff --git a/source/Mobs/Zombiepigman.cpp b/source/Mobs/Zombiepigman.cpp
index 40fb0a593..6483e58c5 100644
--- a/source/Mobs/Zombiepigman.cpp
+++ b/source/Mobs/Zombiepigman.cpp
@@ -8,7 +8,7 @@
cZombiepigman::cZombiepigman(void) :
- super("Zombiepigman", 57, "mob.zombiepig.zpighurt", "mob.zombiepig.zpigdeath")
+ super("Zombiepigman", 57, "mob.zombiepig.zpighurt", "mob.zombiepig.zpigdeath", 0.6, 1.8)
{
}
@@ -21,9 +21,10 @@ void cZombiepigman::Tick(float a_Dt, cChunk & a_Chunk)
super::Tick(a_Dt, a_Chunk);
// TODO Same as noticed in cSkeleton AND Do they really burn by sun?? :D In the neather is no sun :D
- if ((GetWorld()->GetTimeOfDay() < (12000 + 1000)) && !IsBurning())
+ if ((GetWorld()->GetTimeOfDay() < (12000 + 1000)) && !IsOnFire())
{
- SetMetaData(BURNING); // BURN, BABY, BURN! >:D
+ // Burn for 10 ticks, then decide again
+ StartBurning(10);
}
}
@@ -31,7 +32,7 @@ void cZombiepigman::Tick(float a_Dt, cChunk & a_Chunk)
-void cZombiepigman::GetDrops(cItems & a_Drops, cPawn * a_Killer)
+void cZombiepigman::GetDrops(cItems & a_Drops, cEntity * a_Killer)
{
AddRandomDropItem(a_Drops, 0, 1, E_ITEM_ROTTEN_FLESH);
AddRandomDropItem(a_Drops, 0, 1, E_ITEM_GOLD_NUGGET);
@@ -43,7 +44,7 @@ void cZombiepigman::GetDrops(cItems & a_Drops, cPawn * a_Killer)
-void cZombiepigman::KilledBy(cPawn * a_Killer)
+void cZombiepigman::KilledBy(cEntity * a_Killer)
{
super::KilledBy(a_Killer);
diff --git a/source/Mobs/Zombiepigman.h b/source/Mobs/Zombiepigman.h
index a8c2e429d..fe8c6d047 100644
--- a/source/Mobs/Zombiepigman.h
+++ b/source/Mobs/Zombiepigman.h
@@ -18,8 +18,8 @@ public:
CLASS_PROTODEF(cZombiepigman);
virtual void Tick(float a_Dt, cChunk & a_Chunk) override;
- virtual void GetDrops(cItems & a_Drops, cPawn * a_Killer = NULL) override;
- virtual void KilledBy(cPawn * a_Killer) override;
+ virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override;
+ virtual void KilledBy(cEntity * a_Killer) override;
} ;