diff options
author | archshift <admin@archshift.com> | 2014-04-27 02:50:05 +0200 |
---|---|---|
committer | archshift <admin@archshift.com> | 2014-04-27 02:50:05 +0200 |
commit | e3c3795aa40e59af86d90b45b209f367563942fb (patch) | |
tree | 1b84c8e7098a2f912e15f7645d5d4b689b19cdcb /src/Entities/ProjectileEntity.cpp | |
parent | Moved cGhastFireballEntity out of ProjectileEntity.h (diff) | |
download | cuberite-e3c3795aa40e59af86d90b45b209f367563942fb.tar cuberite-e3c3795aa40e59af86d90b45b209f367563942fb.tar.gz cuberite-e3c3795aa40e59af86d90b45b209f367563942fb.tar.bz2 cuberite-e3c3795aa40e59af86d90b45b209f367563942fb.tar.lz cuberite-e3c3795aa40e59af86d90b45b209f367563942fb.tar.xz cuberite-e3c3795aa40e59af86d90b45b209f367563942fb.tar.zst cuberite-e3c3795aa40e59af86d90b45b209f367563942fb.zip |
Diffstat (limited to 'src/Entities/ProjectileEntity.cpp')
-rw-r--r-- | src/Entities/ProjectileEntity.cpp | 72 |
1 files changed, 1 insertions, 71 deletions
diff --git a/src/Entities/ProjectileEntity.cpp b/src/Entities/ProjectileEntity.cpp index 3a5ac059b..4784d4b0c 100644 --- a/src/Entities/ProjectileEntity.cpp +++ b/src/Entities/ProjectileEntity.cpp @@ -19,6 +19,7 @@ #include "ProjectileExpBottle.h" #include "ProjectileSnowball.h" #include "ProjectileFireCharge.h" +#include "ProjectileFirework.h" #include "ProjectileGhastFireball.h" @@ -408,75 +409,4 @@ void cProjectileEntity::CollectedBy(cPlayer * a_Dest) { // Overriden in arrow UNUSED(a_Dest); -} - - - - - -/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// cFireworkEntity : - -cFireworkEntity::cFireworkEntity(cEntity * a_Creator, double a_X, double a_Y, double a_Z, const cItem & a_Item) : -super(pkFirework, a_Creator, a_X, a_Y, a_Z, 0.25, 0.25), - m_ExplodeTimer(0), - m_FireworkItem(a_Item) -{ -} - - - - - -void cFireworkEntity::HandlePhysics(float a_Dt, cChunk & a_Chunk) -{ - int RelX = POSX_TOINT - a_Chunk.GetPosX() * cChunkDef::Width; - int RelZ = POSZ_TOINT - a_Chunk.GetPosZ() * cChunkDef::Width; - int PosY = POSY_TOINT; - - if ((PosY < 0) || (PosY >= cChunkDef::Height)) - { - goto setspeed; - } - - if (m_IsInGround) - { - if (a_Chunk.GetBlock(RelX, POSY_TOINT + 1, RelZ) == E_BLOCK_AIR) - { - m_IsInGround = false; - } - else - { - return; - } - } - else - { - if (a_Chunk.GetBlock(RelX, POSY_TOINT + 1, RelZ) != E_BLOCK_AIR) - { - OnHitSolidBlock(GetPosition(), BLOCK_FACE_YM); - return; - } - } - -setspeed: - AddSpeedY(1); - AddPosition(GetSpeed() * (a_Dt / 1000)); -} - - - - - -void cFireworkEntity::Tick(float a_Dt, cChunk & a_Chunk) -{ - super::Tick(a_Dt, a_Chunk); - - if (m_ExplodeTimer == m_FireworkItem.m_FireworkItem.m_FlightTimeInTicks) - { - m_World->BroadcastEntityStatus(*this, esFireworkExploding); - Destroy(); - } - - m_ExplodeTimer++; }
\ No newline at end of file |