Entities now bail out of ticks if destroyed (#3363)
This commit is contained in:
@@ -180,6 +180,11 @@ void cArrowEntity::CollectedBy(cPlayer & a_Dest)
|
||||
void cArrowEntity::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
|
||||
{
|
||||
super::Tick(a_Dt, a_Chunk);
|
||||
if (!IsTicking())
|
||||
{
|
||||
// The base class tick destroyed us
|
||||
return;
|
||||
}
|
||||
m_Timer += a_Dt;
|
||||
|
||||
if (m_bIsCollected)
|
||||
|
||||
@@ -102,6 +102,11 @@ void cBoat::OnRightClicked(cPlayer & a_Player)
|
||||
void cBoat::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
|
||||
{
|
||||
super::Tick(a_Dt, a_Chunk);
|
||||
if (!IsTicking())
|
||||
{
|
||||
// The base class tick destroyed us
|
||||
return;
|
||||
}
|
||||
BroadcastMovementUpdate();
|
||||
|
||||
SetSpeed(GetSpeed() * 0.97); // Slowly decrease the speed
|
||||
|
||||
@@ -65,6 +65,11 @@ void cFireworkEntity::HandlePhysics(std::chrono::milliseconds a_Dt, cChunk & a_C
|
||||
void cFireworkEntity::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
|
||||
{
|
||||
super::Tick(a_Dt, a_Chunk);
|
||||
if (!IsTicking())
|
||||
{
|
||||
// The base class tick destroyed us
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_TicksToExplosion <= 0)
|
||||
{
|
||||
|
||||
@@ -1264,6 +1264,11 @@ void cMinecartWithFurnace::OnRightClicked(cPlayer & a_Player)
|
||||
void cMinecartWithFurnace::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
|
||||
{
|
||||
super::Tick(a_Dt, a_Chunk);
|
||||
if (!IsTicking())
|
||||
{
|
||||
// The base class tick destroyed us
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_IsFueled)
|
||||
{
|
||||
|
||||
@@ -111,7 +111,11 @@ void cPawn::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
|
||||
m_World->ForEachEntityInBox(cBoundingBox(GetPosition(), GetWidth(), GetHeight()), Callback);
|
||||
|
||||
super::Tick(a_Dt, a_Chunk);
|
||||
|
||||
if (!IsTicking())
|
||||
{
|
||||
// The base class tick destroyed us
|
||||
return;
|
||||
}
|
||||
HandleFalling();
|
||||
}
|
||||
|
||||
|
||||
@@ -116,6 +116,11 @@ void cPickup::SpawnOn(cClientHandle & a_Client)
|
||||
void cPickup::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
|
||||
{
|
||||
super::Tick(a_Dt, a_Chunk);
|
||||
if (!IsTicking())
|
||||
{
|
||||
// The base class tick destroyed us
|
||||
return;
|
||||
}
|
||||
BroadcastMovementUpdate(); // Notify clients of position
|
||||
|
||||
m_Timer += a_Dt;
|
||||
|
||||
@@ -369,6 +369,11 @@ AString cProjectileEntity::GetMCAClassName(void) const
|
||||
void cProjectileEntity::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
|
||||
{
|
||||
super::Tick(a_Dt, a_Chunk);
|
||||
if (!IsTicking())
|
||||
{
|
||||
// The base class tick destroyed us
|
||||
return;
|
||||
}
|
||||
BroadcastMovementUpdate();
|
||||
}
|
||||
|
||||
|
||||
@@ -57,6 +57,11 @@ void cTNTEntity::Explode(void)
|
||||
void cTNTEntity::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
|
||||
{
|
||||
super::Tick(a_Dt, a_Chunk);
|
||||
if (!IsTicking())
|
||||
{
|
||||
// The base class tick destroyed us
|
||||
return;
|
||||
}
|
||||
BroadcastMovementUpdate();
|
||||
|
||||
m_FuseTicks -= 1;
|
||||
|
||||
Reference in New Issue
Block a user