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"
|
2020-04-03 02:57:01 -04:00
|
|
|
#include "../BlockInfo.h"
|
2013-12-22 14:40:07 -05:00
|
|
|
#include "../World.h"
|
2013-09-18 17:17:43 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cSnowGolem::cSnowGolem(void) :
|
2020-04-13 12:38:06 -04:00
|
|
|
Super("SnowGolem", mtSnowGolem, "entity.snowman.hurt", "entity.snowman.death", "entity.snowman.ambient", 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
|
|
|
{
|
2020-04-13 12:38:06 -04: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
|
|
|
{
|
2020-09-17 14:06:41 -04:00
|
|
|
TakeDamage(dtEnvironment, nullptr, GetRawDamageAgainst(*this), GetKnockbackAmountAgainst(*this));
|
2013-12-22 14:40:07 -05:00
|
|
|
}
|
|
|
|
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
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|