diff options
author | LogicParrot <LogicParrot@users.noreply.github.com> | 2016-01-11 20:34:41 +0100 |
---|---|---|
committer | LogicParrot <LogicParrot@users.noreply.github.com> | 2016-01-12 10:47:59 +0100 |
commit | 359e772dee0ef4595c8ad982f17e13725f255219 (patch) | |
tree | 4c784bee23613af41e0dda909b90c1c2fd7140a6 /src/Entities/ArrowEntity.cpp | |
parent | Merge pull request #2848 from Nakkar/master (diff) | |
download | cuberite-359e772dee0ef4595c8ad982f17e13725f255219.tar cuberite-359e772dee0ef4595c8ad982f17e13725f255219.tar.gz cuberite-359e772dee0ef4595c8ad982f17e13725f255219.tar.bz2 cuberite-359e772dee0ef4595c8ad982f17e13725f255219.tar.lz cuberite-359e772dee0ef4595c8ad982f17e13725f255219.tar.xz cuberite-359e772dee0ef4595c8ad982f17e13725f255219.tar.zst cuberite-359e772dee0ef4595c8ad982f17e13725f255219.zip |
Diffstat (limited to 'src/Entities/ArrowEntity.cpp')
-rw-r--r-- | src/Entities/ArrowEntity.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/Entities/ArrowEntity.cpp b/src/Entities/ArrowEntity.cpp index 76b4c9758..47789992c 100644 --- a/src/Entities/ArrowEntity.cpp +++ b/src/Entities/ArrowEntity.cpp @@ -102,6 +102,8 @@ void cArrowEntity::OnHitSolidBlock(const Vector3d & a_HitPos, eBlockFace a_HitFa void cArrowEntity::OnHitEntity(cEntity & a_EntityHit, const Vector3d & a_HitPos) { + super::OnHitEntity(a_EntityHit, a_HitPos); + int Damage = static_cast<int>(GetSpeed().Length() / 20 * m_DamageCoeff + 0.5); if (m_IsCritical) { @@ -140,7 +142,7 @@ void cArrowEntity::OnHitEntity(cEntity & a_EntityHit, const Vector3d & a_HitPos) // Broadcast successful hit sound GetWorld()->BroadcastSoundEffect("random.successful_hit", GetPosX(), GetPosY(), GetPosZ(), 0.5, static_cast<float>(0.75 + (static_cast<float>((GetUniqueID() * 23) % 32)) / 64)); - + Destroy(); } @@ -177,7 +179,7 @@ void cArrowEntity::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) { super::Tick(a_Dt, a_Chunk); m_Timer += a_Dt; - + if (m_bIsCollected) { if (m_Timer > std::chrono::milliseconds(500)) @@ -191,7 +193,7 @@ void cArrowEntity::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) Destroy(); return; } - + if (m_IsInGround) { if (!m_HasTeleported) // Sent a teleport already, don't do again @@ -206,17 +208,17 @@ void cArrowEntity::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) m_HitGroundTimer += a_Dt; } } - + int RelPosX = m_HitBlockPos.x - a_Chunk.GetPosX() * cChunkDef::Width; int RelPosZ = m_HitBlockPos.z - a_Chunk.GetPosZ() * cChunkDef::Width; cChunk * Chunk = a_Chunk.GetRelNeighborChunkAdjustCoords(RelPosX, RelPosZ); - + if (Chunk == nullptr) { // Inside an unloaded chunk, abort return; } - + if (Chunk->GetBlock(RelPosX, m_HitBlockPos.y, RelPosZ) == E_BLOCK_AIR) // Block attached to was destroyed? { m_IsInGround = false; // Yes, begin simulating physics again |