void cEntity::Tick(float a_Dt, cChunk & a_Chunk) { if (m_AttachedTo != NULL) { if ((m_Pos - m_AttachedTo->GetPosition()).Length() > 0.5) { SetPosition(m_AttachedTo->GetPosition()); } } else { if (a_Chunk.IsValid()) { HandlePhysics(a_Dt, a_Chunk); } } if (a_Chunk.IsValid()) { TickBurning(a_Chunk); } if ((a_Chunk.IsValid()) && (GetPosY() < -46)) { TickInVoid(a_Chunk); } else { m_TicksSinceLastVoidDamage = 0; } }
void cEntity::Tick(float a_Dt, cChunk & a_Chunk) { if (m_InvulnerableTicks > 0) { m_InvulnerableTicks--; } if (m_AttachedTo != NULL) { Vector3d DeltaPos = m_Pos - m_AttachedTo->GetPosition(); if (DeltaPos.Length() > 0.5) { SetPosition(m_AttachedTo->GetPosition()); if (IsPlayer()) { cPlayer * Player = (cPlayer *)this; Player->UpdateMovementStats(DeltaPos); } } } else { if (!a_Chunk.IsValid()) { return; } // Position changed -> super::Tick() called GET_AND_VERIFY_CURRENT_CHUNK(NextChunk, POSX_TOINT, POSZ_TOINT) TickBurning(*NextChunk); if (GetPosY() < VOID_BOUNDARY) { TickInVoid(*NextChunk); } else { m_TicksSinceLastVoidDamage = 0; } if (IsMob() || IsPlayer() || IsPickup() || IsExpOrb()) { DetectCacti(); } if (IsMob() || IsPlayer()) { // Set swimming state SetSwimState(*NextChunk); // Handle drowning HandleAir(); } // None of the above functions change position, we remain in the chunk of NextChunk HandlePhysics(a_Dt, *NextChunk); } }