From 2e9cf0ae28db267cc4d658d61ee3ce14813bf527 Mon Sep 17 00:00:00 2001 From: "madmaxoft@gmail.com" Date: Mon, 1 Jul 2013 18:37:27 +0000 Subject: [PATCH] Fixed burn / fire damage in each game tick. http://forum.mc-server.org/showthread.php?tid=434&pid=8798#pid8798 git-svn-id: http://mc-server.googlecode.com/svn/trunk@1638 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/Entity.cpp | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/source/Entity.cpp b/source/Entity.cpp index bb65f4358..c80977286 100644 --- a/source/Entity.cpp +++ b/source/Entity.cpp @@ -631,6 +631,9 @@ void cEntity::HandlePhysics(float a_Dt, cChunk & a_Chunk) void cEntity::TickBurning(cChunk & a_Chunk) { + // Remember the current burning state: + bool HasBeenBurning = (m_TicksLeftBurning > 0); + // Do the burning damage: if (m_TicksLeftBurning > 0) { @@ -638,18 +641,11 @@ void cEntity::TickBurning(cChunk & a_Chunk) if (m_TicksSinceLastBurnDamage >= BURN_TICKS_PER_DAMAGE) { TakeDamage(dtOnFire, NULL, BURN_DAMAGE, 0, 0); - m_TicksSinceLastFireDamage = 0; + m_TicksSinceLastBurnDamage = 0; } m_TicksLeftBurning--; - if (m_TicksLeftBurning == 0) - { - OnFinishedBurning(); - } } - // Remember the current burning state: - bool HasBeenBurning = (m_TicksLeftBurning > 0); - // Update the burning times, based on surroundings: int MinRelX = (int)floor(GetPosX() - m_Width / 2) - a_Chunk.GetPosX() * cChunkDef::Width; int MaxRelX = (int)floor(GetPosX() + m_Width / 2) - a_Chunk.GetPosX() * cChunkDef::Width; @@ -711,7 +707,7 @@ void cEntity::TickBurning(cChunk & a_Chunk) // Periodically damage: m_TicksSinceLastLavaDamage++; - if (m_TicksSinceLastLavaDamage >= 10) + if (m_TicksSinceLastLavaDamage >= LAVA_TICKS_PER_DAMAGE) { TakeDamage(dtLavaContact, NULL, LAVA_DAMAGE, 0); m_TicksSinceLastLavaDamage = 0; @@ -732,6 +728,7 @@ void cEntity::TickBurning(cChunk & a_Chunk) if (m_TicksSinceLastFireDamage >= FIRE_TICKS_PER_DAMAGE) { TakeDamage(dtFireContact, NULL, FIRE_DAMAGE, 0); + m_TicksSinceLastFireDamage = 0; } } else