Lay foundation for fireproof entities.
Prevent any entities with the m_Fireproof flag from taking fire or lava damage.
This commit is contained in:
parent
e3ec857264
commit
bca7f29490
@ -787,8 +787,11 @@ void cEntity::TickBurning(cChunk & a_Chunk)
|
|||||||
{
|
{
|
||||||
m_TicksSinceLastBurnDamage++;
|
m_TicksSinceLastBurnDamage++;
|
||||||
if (m_TicksSinceLastBurnDamage >= BURN_TICKS_PER_DAMAGE)
|
if (m_TicksSinceLastBurnDamage >= BURN_TICKS_PER_DAMAGE)
|
||||||
|
{
|
||||||
|
if (!m_Fireproof)
|
||||||
{
|
{
|
||||||
TakeDamage(dtOnFire, NULL, BURN_DAMAGE, 0);
|
TakeDamage(dtOnFire, NULL, BURN_DAMAGE, 0);
|
||||||
|
}
|
||||||
m_TicksSinceLastBurnDamage = 0;
|
m_TicksSinceLastBurnDamage = 0;
|
||||||
}
|
}
|
||||||
m_TicksLeftBurning--;
|
m_TicksLeftBurning--;
|
||||||
@ -855,8 +858,11 @@ void cEntity::TickBurning(cChunk & a_Chunk)
|
|||||||
// Periodically damage:
|
// Periodically damage:
|
||||||
m_TicksSinceLastLavaDamage++;
|
m_TicksSinceLastLavaDamage++;
|
||||||
if (m_TicksSinceLastLavaDamage >= LAVA_TICKS_PER_DAMAGE)
|
if (m_TicksSinceLastLavaDamage >= LAVA_TICKS_PER_DAMAGE)
|
||||||
|
{
|
||||||
|
if (!m_Fireproof)
|
||||||
{
|
{
|
||||||
TakeDamage(dtLavaContact, NULL, LAVA_DAMAGE, 0);
|
TakeDamage(dtLavaContact, NULL, LAVA_DAMAGE, 0);
|
||||||
|
}
|
||||||
m_TicksSinceLastLavaDamage = 0;
|
m_TicksSinceLastLavaDamage = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -873,8 +879,11 @@ void cEntity::TickBurning(cChunk & a_Chunk)
|
|||||||
// Periodically damage:
|
// Periodically damage:
|
||||||
m_TicksSinceLastFireDamage++;
|
m_TicksSinceLastFireDamage++;
|
||||||
if (m_TicksSinceLastFireDamage >= FIRE_TICKS_PER_DAMAGE)
|
if (m_TicksSinceLastFireDamage >= FIRE_TICKS_PER_DAMAGE)
|
||||||
|
{
|
||||||
|
if (!m_Fireproof)
|
||||||
{
|
{
|
||||||
TakeDamage(dtFireContact, NULL, FIRE_DAMAGE, 0);
|
TakeDamage(dtFireContact, NULL, FIRE_DAMAGE, 0);
|
||||||
|
}
|
||||||
m_TicksSinceLastFireDamage = 0;
|
m_TicksSinceLastFireDamage = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -435,6 +435,9 @@ protected:
|
|||||||
|
|
||||||
cWorld * m_World;
|
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())
|
/// Time, in ticks, since the last damage dealt by being on fire. Valid only if on fire (IsOnFire())
|
||||||
int m_TicksSinceLastBurnDamage;
|
int m_TicksSinceLastBurnDamage;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user