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