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