2014-04-26 20:35:31 -04:00
|
|
|
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
|
|
|
|
|
2014-04-27 20:03:06 -04:00
|
|
|
#include "FireChargeEntity.h"
|
2014-04-26 20:35:31 -04:00
|
|
|
#include "../World.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-09-29 08:59:24 -04:00
|
|
|
cFireChargeEntity::cFireChargeEntity(cEntity * a_Creator, Vector3d a_Pos, Vector3d a_Speed):
|
|
|
|
super(pkFireCharge, a_Creator, a_Pos, 0.3125, 0.3125)
|
2014-04-26 20:35:31 -04:00
|
|
|
{
|
|
|
|
SetSpeed(a_Speed);
|
|
|
|
SetGravity(0);
|
2015-03-30 19:42:32 -04:00
|
|
|
SetAirDrag(0);
|
2014-04-26 20:35:31 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-05-24 07:56:56 -04:00
|
|
|
void cFireChargeEntity::Explode(Vector3i a_Block)
|
2014-04-26 20:35:31 -04:00
|
|
|
{
|
2015-05-24 07:56:56 -04:00
|
|
|
if (m_World->GetBlock(a_Block) == E_BLOCK_AIR)
|
2014-04-26 20:35:31 -04:00
|
|
|
{
|
2015-05-24 07:56:56 -04:00
|
|
|
m_World->SetBlock(a_Block.x, a_Block.y, a_Block.z, E_BLOCK_FIRE, 1);
|
2014-04-26 20:35:31 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-09-07 04:25:34 -04:00
|
|
|
void cFireChargeEntity::OnHitSolidBlock(Vector3d a_HitPos, eBlockFace a_HitFace)
|
2014-04-26 20:35:31 -04:00
|
|
|
{
|
|
|
|
Destroy();
|
2015-05-24 07:56:56 -04:00
|
|
|
Explode(a_HitPos.Floor());
|
2014-04-26 20:35:31 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-09-07 04:25:34 -04:00
|
|
|
void cFireChargeEntity::OnHitEntity(cEntity & a_EntityHit, Vector3d a_HitPos)
|
2014-04-26 20:35:31 -04:00
|
|
|
{
|
2016-01-11 14:34:41 -05:00
|
|
|
super::OnHitEntity(a_EntityHit, a_HitPos);
|
|
|
|
|
2014-04-26 20:35:31 -04:00
|
|
|
Destroy();
|
2015-05-24 07:56:56 -04:00
|
|
|
Explode(a_HitPos.Floor());
|
2016-01-11 14:34:41 -05:00
|
|
|
|
2015-10-31 11:24:45 -04:00
|
|
|
if (!a_EntityHit.IsFireproof())
|
|
|
|
{
|
2017-08-24 05:19:40 -04:00
|
|
|
// TODO Damage Entity with 5 damage(from https://minecraft.gamepedia.com/Blaze#Blaze_fireball)
|
2015-10-31 11:24:45 -04:00
|
|
|
a_EntityHit.StartBurning(5 * 20); // 5 seconds of burning
|
|
|
|
}
|
2014-04-27 12:42:31 -04:00
|
|
|
}
|