From 34928378b8e3464326de38787bfada9adc0bfb11 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Sun, 20 Oct 2013 10:23:30 +0200 Subject: Fixed loading allowed mobs in world. --- source/Mobs/Chicken.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source/Mobs/Chicken.cpp') diff --git a/source/Mobs/Chicken.cpp b/source/Mobs/Chicken.cpp index 3da9781d3..434a32f94 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", 0.3, 0.4) + super("Chicken", mtChicken, "mob.chicken.hurt", "mob.chicken.hurt", 0.3, 0.4) { } -- cgit v1.2.3 From 4d7695549a8f22e0f83472e6e131275dabb8f362 Mon Sep 17 00:00:00 2001 From: tonibm19 Date: Fri, 8 Nov 2013 14:04:00 +0100 Subject: Now chickens can drop eggs. They drop an egg every 5 or 10 minutes. --- source/Mobs/Chicken.cpp | 36 +++++++++++++++++++++++++++++++++--- 1 file changed, 33 insertions(+), 3 deletions(-) (limited to 'source/Mobs/Chicken.cpp') diff --git a/source/Mobs/Chicken.cpp b/source/Mobs/Chicken.cpp index 434a32f94..ec9edb961 100644 --- a/source/Mobs/Chicken.cpp +++ b/source/Mobs/Chicken.cpp @@ -2,20 +2,46 @@ #include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules #include "Chicken.h" +#include "../World.h" -// TODO: Drop egg every 5-10 minutes +cChicken::cChicken(void) : + super("Chicken", mtChicken, "mob.chicken.hurt", "mob.chicken.hurt", 0.3, 0.4), + m_DropEggCount(0) +{ +} -cChicken::cChicken(void) : - super("Chicken", mtChicken, "mob.chicken.hurt", "mob.chicken.hurt", 0.3, 0.4) + + +void cChicken::Tick(float a_Dt, cChunk & a_Chunk) { + super::Tick(a_Dt, a_Chunk); + + if (m_DropEggCount == 6000 && m_World->GetTickRandomNumber(1) == 0) + { + cItems Drops; + m_DropEggCount = 0; + Drops.push_back(cItem(E_ITEM_EGG, 1)); + m_World->SpawnItemPickups(Drops, GetPosX(), GetPosY(), GetPosZ(), 10); + } + else if (m_DropEggCount == 12000) + { + cItems Drops; + m_DropEggCount = 0; + Drops.push_back(cItem(E_ITEM_EGG, 1)); + m_World->SpawnItemPickups(Drops, GetPosX(), GetPosY(), GetPosZ(), 10); + } + else + { + m_DropEggCount++; + } } @@ -31,3 +57,7 @@ void cChicken::GetDrops(cItems & a_Drops, cEntity * a_Killer) + + + + -- cgit v1.2.3 From 705e6c13016cc00952ccba9f537dd71b7c666c74 Mon Sep 17 00:00:00 2001 From: tonibm19 Date: Fri, 8 Nov 2013 17:16:36 +0100 Subject: Changed variable name --- source/Mobs/Chicken.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'source/Mobs/Chicken.cpp') diff --git a/source/Mobs/Chicken.cpp b/source/Mobs/Chicken.cpp index ec9edb961..318f8a813 100644 --- a/source/Mobs/Chicken.cpp +++ b/source/Mobs/Chicken.cpp @@ -1,4 +1,3 @@ - #include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules #include "Chicken.h" @@ -13,7 +12,7 @@ cChicken::cChicken(void) : super("Chicken", mtChicken, "mob.chicken.hurt", "mob.chicken.hurt", 0.3, 0.4), - m_DropEggCount(0) + m_EggDropTimer(0) { } @@ -24,23 +23,23 @@ void cChicken::Tick(float a_Dt, cChunk & a_Chunk) { super::Tick(a_Dt, a_Chunk); - if (m_DropEggCount == 6000 && m_World->GetTickRandomNumber(1) == 0) + if (m_EggDropTimer == 6000 && m_World->GetTickRandomNumber(1) == 0) { cItems Drops; - m_DropEggCount = 0; + m_EggDropTimer = 0; Drops.push_back(cItem(E_ITEM_EGG, 1)); m_World->SpawnItemPickups(Drops, GetPosX(), GetPosY(), GetPosZ(), 10); } - else if (m_DropEggCount == 12000) + else if (m_EggDropTimer == 12000) { cItems Drops; - m_DropEggCount = 0; + m_EggDropTimer = 0; Drops.push_back(cItem(E_ITEM_EGG, 1)); m_World->SpawnItemPickups(Drops, GetPosX(), GetPosY(), GetPosZ(), 10); } else { - m_DropEggCount++; + m_EggDropTimer++; } } -- cgit v1.2.3 From b24bdff308e6a2c35bef1a1ae3ea497a978c84c8 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Fri, 8 Nov 2013 21:06:31 +0100 Subject: Fixed code style. --- source/Mobs/Chicken.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source/Mobs/Chicken.cpp') diff --git a/source/Mobs/Chicken.cpp b/source/Mobs/Chicken.cpp index 318f8a813..087fd088a 100644 --- a/source/Mobs/Chicken.cpp +++ b/source/Mobs/Chicken.cpp @@ -23,14 +23,14 @@ void cChicken::Tick(float a_Dt, cChunk & a_Chunk) { super::Tick(a_Dt, a_Chunk); - if (m_EggDropTimer == 6000 && m_World->GetTickRandomNumber(1) == 0) + if ((m_EggDropTimer == 6000) && (m_World->GetTickRandomNumber(1) == 0)) { cItems Drops; m_EggDropTimer = 0; Drops.push_back(cItem(E_ITEM_EGG, 1)); m_World->SpawnItemPickups(Drops, GetPosX(), GetPosY(), GetPosZ(), 10); } - else if (m_EggDropTimer == 12000) + else if (m_EggDropTimer == 12000) { cItems Drops; m_EggDropTimer = 0; -- cgit v1.2.3 From 675b4aa878f16291ce33fced48a2bc7425f635ae Mon Sep 17 00:00:00 2001 From: Alexander Harkness Date: Sun, 24 Nov 2013 14:19:41 +0000 Subject: Moved source to src --- source/Mobs/Chicken.cpp | 62 ------------------------------------------------- 1 file changed, 62 deletions(-) delete mode 100644 source/Mobs/Chicken.cpp (limited to 'source/Mobs/Chicken.cpp') diff --git a/source/Mobs/Chicken.cpp b/source/Mobs/Chicken.cpp deleted file mode 100644 index 087fd088a..000000000 --- a/source/Mobs/Chicken.cpp +++ /dev/null @@ -1,62 +0,0 @@ -#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules - -#include "Chicken.h" -#include "../World.h" - - - - - - - - -cChicken::cChicken(void) : - super("Chicken", mtChicken, "mob.chicken.hurt", "mob.chicken.hurt", 0.3, 0.4), - m_EggDropTimer(0) -{ -} - - - - -void cChicken::Tick(float a_Dt, cChunk & a_Chunk) -{ - super::Tick(a_Dt, a_Chunk); - - if ((m_EggDropTimer == 6000) && (m_World->GetTickRandomNumber(1) == 0)) - { - cItems Drops; - m_EggDropTimer = 0; - Drops.push_back(cItem(E_ITEM_EGG, 1)); - m_World->SpawnItemPickups(Drops, GetPosX(), GetPosY(), GetPosZ(), 10); - } - else if (m_EggDropTimer == 12000) - { - cItems Drops; - m_EggDropTimer = 0; - Drops.push_back(cItem(E_ITEM_EGG, 1)); - m_World->SpawnItemPickups(Drops, GetPosX(), GetPosY(), GetPosZ(), 10); - } - else - { - m_EggDropTimer++; - } -} - - - - - -void cChicken::GetDrops(cItems & a_Drops, cEntity * a_Killer) -{ - AddRandomDropItem(a_Drops, 0, 2, E_ITEM_FEATHER); - a_Drops.push_back(cItem(IsOnFire() ? E_ITEM_COOKED_CHICKEN : E_ITEM_RAW_CHICKEN, 1)); -} - - - - - - - - -- cgit v1.2.3