1
0

Lay foundation for fireproof entities.

Prevent any entities with the m_Fireproof flag from taking fire or lava damage.
This commit is contained in:
archshift 2014-04-22 01:59:34 -10:00
parent e3ec857264
commit bca7f29490
2 changed files with 15 additions and 3 deletions

View File

@ -787,8 +787,11 @@ void cEntity::TickBurning(cChunk & a_Chunk)
{
m_TicksSinceLastBurnDamage++;
if (m_TicksSinceLastBurnDamage >= BURN_TICKS_PER_DAMAGE)
{
if (!m_Fireproof)
{
TakeDamage(dtOnFire, NULL, BURN_DAMAGE, 0);
}
m_TicksSinceLastBurnDamage = 0;
}
m_TicksLeftBurning--;
@ -855,8 +858,11 @@ void cEntity::TickBurning(cChunk & a_Chunk)
// Periodically damage:
m_TicksSinceLastLavaDamage++;
if (m_TicksSinceLastLavaDamage >= LAVA_TICKS_PER_DAMAGE)
{
if (!m_Fireproof)
{
TakeDamage(dtLavaContact, NULL, LAVA_DAMAGE, 0);
}
m_TicksSinceLastLavaDamage = 0;
}
}
@ -873,8 +879,11 @@ void cEntity::TickBurning(cChunk & a_Chunk)
// Periodically damage:
m_TicksSinceLastFireDamage++;
if (m_TicksSinceLastFireDamage >= FIRE_TICKS_PER_DAMAGE)
{
if (!m_Fireproof)
{
TakeDamage(dtFireContact, NULL, FIRE_DAMAGE, 0);
}
m_TicksSinceLastFireDamage = 0;
}
}

View File

@ -435,6 +435,9 @@ protected:
cWorld * m_World;
/// Whether the entity is capable of taking fire or lava damage.
bool m_Fireproof;
/// Time, in ticks, since the last damage dealt by being on fire. Valid only if on fire (IsOnFire())
int m_TicksSinceLastBurnDamage;