summaryrefslogtreecommitdiffstats
path: root/source/Mobs
diff options
context:
space:
mode:
authorSamuel Barney <samjbarney@gmail.com>2013-10-28 23:40:13 +0100
committerSamuel Barney <samjbarney@gmail.com>2013-10-28 23:40:13 +0100
commitd7a490a99205d69abce52c77854fafee52b4e82b (patch)
tree92e68ff622fc89bd94e11c7ed7fc548ed3129047 /source/Mobs
parentGot spiders and other mobs respecting night and day for spawning (diff)
parentProtoProxy: Implemented 1.7.2 status request / response / ping. (diff)
downloadcuberite-d7a490a99205d69abce52c77854fafee52b4e82b.tar
cuberite-d7a490a99205d69abce52c77854fafee52b4e82b.tar.gz
cuberite-d7a490a99205d69abce52c77854fafee52b4e82b.tar.bz2
cuberite-d7a490a99205d69abce52c77854fafee52b4e82b.tar.lz
cuberite-d7a490a99205d69abce52c77854fafee52b4e82b.tar.xz
cuberite-d7a490a99205d69abce52c77854fafee52b4e82b.tar.zst
cuberite-d7a490a99205d69abce52c77854fafee52b4e82b.zip
Diffstat (limited to 'source/Mobs')
-rw-r--r--source/Mobs/Monster.cpp2
-rw-r--r--source/Mobs/Monster.h8
-rw-r--r--source/Mobs/Sheep.cpp5
3 files changed, 9 insertions, 6 deletions
diff --git a/source/Mobs/Monster.cpp b/source/Mobs/Monster.cpp
index 7e35b97f1..9b1f2fc4c 100644
--- a/source/Mobs/Monster.cpp
+++ b/source/Mobs/Monster.cpp
@@ -605,7 +605,7 @@ cMonster::eFamily cMonster::FamilyFromType(eType a_Type)
-int cMonster::GetSpawnRate(cMonster::eFamily a_MobFamily)
+int cMonster::GetSpawnDelay(cMonster::eFamily a_MobFamily)
{
switch (a_MobFamily)
{
diff --git a/source/Mobs/Monster.h b/source/Mobs/Monster.h
index 14c72ed73..a0002bf4f 100644
--- a/source/Mobs/Monster.h
+++ b/source/Mobs/Monster.h
@@ -137,17 +137,17 @@ public:
// tolua_begin
- /// Translates MobType enum to a string
+ /// Translates MobType enum to a string, empty string if unknown
static AString MobTypeToString(eType a_MobType);
- /// Translates MobType string to the enum
+ /// Translates MobType string to the enum, mtInvalidType if not recognized
static eType StringToMobType(const AString & a_MobTypeName);
/// Returns the mob family based on the type
static eFamily FamilyFromType(eType a_MobType);
- /// Returns the spawn rate (number of game ticks between spawn attempts) for the given mob family
- static int GetSpawnRate(cMonster::eFamily a_MobFamily);
+ /// Returns the spawn delay (number of game ticks between spawn attempts) for the given mob family
+ static int GetSpawnDelay(cMonster::eFamily a_MobFamily);
// tolua_end
diff --git a/source/Mobs/Sheep.cpp b/source/Mobs/Sheep.cpp
index 0d7d43e27..703482ddb 100644
--- a/source/Mobs/Sheep.cpp
+++ b/source/Mobs/Sheep.cpp
@@ -33,6 +33,7 @@ void cSheep::GetDrops(cItems & a_Drops, cEntity * a_Killer)
+
void cSheep::OnRightClicked(cPlayer & a_Player)
{
if ((a_Player.GetEquippedItem().m_ItemType == E_ITEM_SHEARS) && (!m_IsSheared))
@@ -46,7 +47,8 @@ void cSheep::OnRightClicked(cPlayer & a_Player)
}
cItems Drops;
- Drops.push_back(cItem(E_BLOCK_WOOL, 4, m_WoolColor));
+ int NumDrops = m_World->GetTickRandomNumber(2) + 1;
+ Drops.push_back(cItem(E_BLOCK_WOOL, NumDrops, m_WoolColor));
m_World->SpawnItemPickups(Drops, GetPosX(), GetPosY(), GetPosZ(), 10);
}
}
@@ -54,3 +56,4 @@ void cSheep::OnRightClicked(cPlayer & a_Player)
+