summaryrefslogtreecommitdiffstats
path: root/src/Entities/ArrowEntity.cpp
diff options
context:
space:
mode:
authorJaume Aloy <hircine45@gmail.com>2014-08-19 17:57:32 +0200
committerJaume Aloy <hircine45@gmail.com>2014-08-19 17:57:32 +0200
commit596203e692e6322c7f989b1625cbe03dc1eb6a6c (patch)
tree3c3b53fa00e31a10f68fd96984b59114d041dac5 /src/Entities/ArrowEntity.cpp
parentChanged if for switch (diff)
downloadcuberite-596203e692e6322c7f989b1625cbe03dc1eb6a6c.tar
cuberite-596203e692e6322c7f989b1625cbe03dc1eb6a6c.tar.gz
cuberite-596203e692e6322c7f989b1625cbe03dc1eb6a6c.tar.bz2
cuberite-596203e692e6322c7f989b1625cbe03dc1eb6a6c.tar.lz
cuberite-596203e692e6322c7f989b1625cbe03dc1eb6a6c.tar.xz
cuberite-596203e692e6322c7f989b1625cbe03dc1eb6a6c.tar.zst
cuberite-596203e692e6322c7f989b1625cbe03dc1eb6a6c.zip
Diffstat (limited to '')
-rw-r--r--src/Entities/ArrowEntity.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/Entities/ArrowEntity.cpp b/src/Entities/ArrowEntity.cpp
index e71f30a66..12149b297 100644
--- a/src/Entities/ArrowEntity.cpp
+++ b/src/Entities/ArrowEntity.cpp
@@ -18,7 +18,6 @@ cArrowEntity::cArrowEntity(cEntity * a_Creator, double a_X, double a_Y, double a
m_HitGroundTimer(0),
m_HasTeleported(false),
m_bIsCollected(false),
- m_Creator(a_Creator),
m_HitBlockPos(Vector3i(0, 0, 0))
{
SetSpeed(a_Speed);
@@ -44,7 +43,6 @@ cArrowEntity::cArrowEntity(cPlayer & a_Player, double a_Force) :
m_HitGroundTimer(0),
m_HasTeleported(false),
m_bIsCollected(false),
- m_Creator(&a_Player),
m_HitBlockPos(0, 0, 0)
{
if (a_Player.IsGameModeCreative())
@@ -70,6 +68,9 @@ bool cArrowEntity::CanPickup(const cPlayer & a_Player) const
}
+
+
+
void cArrowEntity::OnHitSolidBlock(const Vector3d & a_HitPos, eBlockFace a_HitFace)
{
if (GetSpeed().EqualsEps(Vector3d(0, 0, 0), 0.0000001))
@@ -90,7 +91,7 @@ void cArrowEntity::OnHitSolidBlock(const Vector3d & a_HitPos, eBlockFace a_HitFa
// Broadcast arrow hit sound
m_World->BroadcastSoundEffect("random.bowhit", (double)X, (double)Y, (double)Z, 0.5f, (float)(0.75 + ((float)((GetUniqueID() * 23) % 32)) / 64));
- if ((m_World->GetBlock(Hit) == E_BLOCK_TNT) && (m_TicksLeftBurning > 0))
+ if ((m_World->GetBlock(Hit) == E_BLOCK_TNT) && (IsOnFire()))
{
m_World->SetBlock(X, Y, Z, E_BLOCK_AIR, 0);
m_World->SpawnPrimedTNT(X, Y, Z);
@@ -110,7 +111,7 @@ void cArrowEntity::OnHitEntity(cEntity & a_EntityHit, const Vector3d & a_HitPos)
Damage += m_World->GetTickRandomNumber(Damage / 2 + 2);
}
- int PowerLevel = m_Creator->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchPower);
+ int PowerLevel = m_CreatorData.m_Enchantments.GetLevel(cEnchantments::enchPower);
if (PowerLevel > 0)
{
int ExtraDamage = 0.25 * (PowerLevel + 1);
@@ -118,10 +119,10 @@ void cArrowEntity::OnHitEntity(cEntity & a_EntityHit, const Vector3d & a_HitPos)
}
int KnockbackAmount = 1;
- int PunchLevel = m_Creator->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchPunch);
+ int PunchLevel = m_CreatorData.m_Enchantments.GetLevel(cEnchantments::enchPunch);
if (PunchLevel > 0)
{
- Vector3f LookVector = m_Creator->GetLookVector();
+ Vector3f LookVector = Vector3d(0, 0, 0);
Vector3f FinalSpeed = Vector3f(0, 0, 0);
switch (PunchLevel)
{
@@ -134,7 +135,7 @@ void cArrowEntity::OnHitEntity(cEntity & a_EntityHit, const Vector3d & a_HitPos)
a_EntityHit.TakeDamage(dtRangedAttack, this, Damage, KnockbackAmount);
- if ((m_TicksLeftBurning > 0 && !a_EntityHit.IsSubmerged() && !a_EntityHit.IsSwimming()))
+ if ((IsOnFire() && !a_EntityHit.IsSubmerged() && !a_EntityHit.IsSwimming()))
{
a_EntityHit.StartBurning(100);
}