From 9f77572fb0d045229556314ba9d7aa0f52ad5635 Mon Sep 17 00:00:00 2001 From: "lapayo94@gmail.com" Date: Mon, 26 Dec 2011 20:57:12 +0000 Subject: - improved Simulator system -> Manager handles all ticks -> advantage: Much easier to add new simulators, because you only have to register them in the manager MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - moved sand and gravel simulation to a Simulator-class (cSandSimulator) - Made Squid a little bit more funny and realistic, because it dies now when it´s not in water -Escaping mobs run now faster than normal (They just walked away before :D) git-svn-id: http://mc-server.googlecode.com/svn/trunk@125 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/cSquid.cpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'source/cSquid.cpp') diff --git a/source/cSquid.cpp b/source/cSquid.cpp index b2baf462b..af4b167f2 100644 --- a/source/cSquid.cpp +++ b/source/cSquid.cpp @@ -1,13 +1,16 @@ #include "cSquid.h" +#include "Vector3d.h" cSquid::cSquid() { m_MobType = 94; GetMonsterConfig("Squid"); + m_NoWater = 0.f; } cSquid::~cSquid() { + } bool cSquid::IsA( const char* a_EntityType ) @@ -23,3 +26,25 @@ void cSquid::KilledBy( cEntity* a_Killer ) cMonster::KilledBy( a_Killer ); } + +void cSquid::Tick(float a_Dt) +{ + cPassiveMonster::Tick(a_Dt); + + Vector3d Pos = GetPosition(); + + + //TODO Not a real behavior, but cool :D + if(!IsBlockWater(GetWorld()->GetBlock(Pos.x, Pos.y, Pos.z))) + { + //Die slowly Muhahaha :D (To prevent all this squids on the land :D) + m_NoWater += a_Dt; + + if(m_NoWater > 1000.f) + { + m_NoWater -= 1000.f; + TakeDamage(1, this); + } + } + +} \ No newline at end of file -- cgit v1.2.3