1
0

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
This commit is contained in:
madmaxoft@gmail.com 2013-07-01 18:37:27 +00:00
parent 3a6e9983f5
commit 2e9cf0ae28

View File

@ -631,6 +631,9 @@ void cEntity::HandlePhysics(float a_Dt, cChunk & a_Chunk)
void cEntity::TickBurning(cChunk & a_Chunk) void cEntity::TickBurning(cChunk & a_Chunk)
{ {
// Remember the current burning state:
bool HasBeenBurning = (m_TicksLeftBurning > 0);
// Do the burning damage: // Do the burning damage:
if (m_TicksLeftBurning > 0) if (m_TicksLeftBurning > 0)
{ {
@ -638,18 +641,11 @@ void cEntity::TickBurning(cChunk & a_Chunk)
if (m_TicksSinceLastBurnDamage >= BURN_TICKS_PER_DAMAGE) if (m_TicksSinceLastBurnDamage >= BURN_TICKS_PER_DAMAGE)
{ {
TakeDamage(dtOnFire, NULL, BURN_DAMAGE, 0, 0); TakeDamage(dtOnFire, NULL, BURN_DAMAGE, 0, 0);
m_TicksSinceLastFireDamage = 0; m_TicksSinceLastBurnDamage = 0;
} }
m_TicksLeftBurning--; m_TicksLeftBurning--;
if (m_TicksLeftBurning == 0)
{
OnFinishedBurning();
}
} }
// Remember the current burning state:
bool HasBeenBurning = (m_TicksLeftBurning > 0);
// Update the burning times, based on surroundings: // Update the burning times, based on surroundings:
int MinRelX = (int)floor(GetPosX() - m_Width / 2) - a_Chunk.GetPosX() * cChunkDef::Width; 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; 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: // Periodically damage:
m_TicksSinceLastLavaDamage++; m_TicksSinceLastLavaDamage++;
if (m_TicksSinceLastLavaDamage >= 10) if (m_TicksSinceLastLavaDamage >= LAVA_TICKS_PER_DAMAGE)
{ {
TakeDamage(dtLavaContact, NULL, LAVA_DAMAGE, 0); TakeDamage(dtLavaContact, NULL, LAVA_DAMAGE, 0);
m_TicksSinceLastLavaDamage = 0; m_TicksSinceLastLavaDamage = 0;
@ -732,6 +728,7 @@ void cEntity::TickBurning(cChunk & a_Chunk)
if (m_TicksSinceLastFireDamage >= FIRE_TICKS_PER_DAMAGE) if (m_TicksSinceLastFireDamage >= FIRE_TICKS_PER_DAMAGE)
{ {
TakeDamage(dtFireContact, NULL, FIRE_DAMAGE, 0); TakeDamage(dtFireContact, NULL, FIRE_DAMAGE, 0);
m_TicksSinceLastFireDamage = 0;
} }
} }
else else