2013-09-18 17:17:43 -04:00
|
|
|
|
|
|
|
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
|
|
|
|
|
|
|
|
#include "SnowGolem.h"
|
2013-12-22 14:40:07 -05:00
|
|
|
#include "../World.h"
|
2013-09-18 17:17:43 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cSnowGolem::cSnowGolem(void) :
|
2013-10-20 04:23:30 -04:00
|
|
|
super("SnowGolem", mtSnowGolem, "", "", 0.4, 1.8)
|
2013-09-18 17:17:43 -04:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void cSnowGolem::GetDrops(cItems & a_Drops, cEntity * a_Killer)
|
|
|
|
{
|
2014-02-24 09:38:38 -05:00
|
|
|
UNUSED(a_Killer);
|
2014-02-23 13:44:58 -05:00
|
|
|
AddRandomDropItem(a_Drops, 0, 15, E_ITEM_SNOWBALL);
|
2013-09-18 17:17:43 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-12-22 14:40:07 -05:00
|
|
|
|
2015-01-11 16:12:26 -05:00
|
|
|
void cSnowGolem::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
|
2013-12-22 14:40:07 -05:00
|
|
|
{
|
|
|
|
super::Tick(a_Dt, a_Chunk);
|
2016-09-03 07:31:27 -04:00
|
|
|
if (!IsTicking())
|
|
|
|
{
|
|
|
|
// The base class tick destroyed us
|
|
|
|
return;
|
|
|
|
}
|
2015-07-29 11:04:03 -04:00
|
|
|
if (IsBiomeNoDownfall(m_World->GetBiomeAt(POSX_TOINT, POSZ_TOINT)))
|
2013-12-22 14:40:07 -05:00
|
|
|
{
|
|
|
|
TakeDamage(*this);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-07-29 11:04:03 -04:00
|
|
|
BLOCKTYPE BlockBelow = m_World->GetBlock(POSX_TOINT, POSY_TOINT - 1, POSZ_TOINT);
|
|
|
|
BLOCKTYPE Block = m_World->GetBlock(POSX_TOINT, POSY_TOINT, POSZ_TOINT);
|
2014-12-05 06:56:53 -05:00
|
|
|
if ((Block == E_BLOCK_AIR) && cBlockInfo::IsSolid(BlockBelow))
|
2013-12-22 14:40:07 -05:00
|
|
|
{
|
2015-07-29 11:04:03 -04:00
|
|
|
m_World->SetBlock(POSX_TOINT, POSY_TOINT, POSZ_TOINT, E_BLOCK_SNOW, 0);
|
2013-12-22 14:40:07 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|