diff options
author | Tiger Wang <ziwei.tiger@hotmail.co.uk> | 2014-04-24 19:57:25 +0200 |
---|---|---|
committer | Tiger Wang <ziwei.tiger@hotmail.co.uk> | 2014-04-24 19:57:25 +0200 |
commit | 48904ae201a38c4b6e018567976c00c40c2829c9 (patch) | |
tree | dfba8600b7f48e09c3c1d752b1cce1b4a45c8ea8 /src/Entities/Entity.cpp | |
parent | Some change to Entity.cpp (diff) | |
parent | The new leaves don't decay anymore. (diff) | |
download | cuberite-48904ae201a38c4b6e018567976c00c40c2829c9.tar cuberite-48904ae201a38c4b6e018567976c00c40c2829c9.tar.gz cuberite-48904ae201a38c4b6e018567976c00c40c2829c9.tar.bz2 cuberite-48904ae201a38c4b6e018567976c00c40c2829c9.tar.lz cuberite-48904ae201a38c4b6e018567976c00c40c2829c9.tar.xz cuberite-48904ae201a38c4b6e018567976c00c40c2829c9.tar.zst cuberite-48904ae201a38c4b6e018567976c00c40c2829c9.zip |
Diffstat (limited to '')
-rw-r--r-- | src/Entities/Entity.cpp | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/src/Entities/Entity.cpp b/src/Entities/Entity.cpp index 25ae4c7d8..5c7c9c95a 100644 --- a/src/Entities/Entity.cpp +++ b/src/Entities/Entity.cpp @@ -38,6 +38,7 @@ cEntity::cEntity(eEntityType a_EntityType, double a_X, double a_Y, double a_Z, d , m_IsInitialized(false) , m_EntityType(a_EntityType) , m_World(NULL) + , m_IsFireproof(false) , m_TicksSinceLastBurnDamage(0) , m_TicksSinceLastLavaDamage(0) , m_TicksSinceLastFireDamage(0) @@ -796,7 +797,10 @@ void cEntity::TickBurning(cChunk & a_Chunk) m_TicksSinceLastBurnDamage++; if (m_TicksSinceLastBurnDamage >= BURN_TICKS_PER_DAMAGE) { - TakeDamage(dtOnFire, NULL, BURN_DAMAGE, 0); + if (!m_IsFireproof) + { + TakeDamage(dtOnFire, NULL, BURN_DAMAGE, 0); + } m_TicksSinceLastBurnDamage = 0; } m_TicksLeftBurning--; @@ -864,7 +868,10 @@ void cEntity::TickBurning(cChunk & a_Chunk) m_TicksSinceLastLavaDamage++; if (m_TicksSinceLastLavaDamage >= LAVA_TICKS_PER_DAMAGE) { - TakeDamage(dtLavaContact, NULL, LAVA_DAMAGE, 0); + if (!m_IsFireproof) + { + TakeDamage(dtLavaContact, NULL, LAVA_DAMAGE, 0); + } m_TicksSinceLastLavaDamage = 0; } } @@ -882,7 +889,10 @@ void cEntity::TickBurning(cChunk & a_Chunk) m_TicksSinceLastFireDamage++; if (m_TicksSinceLastFireDamage >= FIRE_TICKS_PER_DAMAGE) { - TakeDamage(dtFireContact, NULL, FIRE_DAMAGE, 0); + if (!m_IsFireproof) + { + TakeDamage(dtFireContact, NULL, FIRE_DAMAGE, 0); + } m_TicksSinceLastFireDamage = 0; } } @@ -1041,6 +1051,16 @@ void cEntity::SetMaxHealth(int a_MaxHealth) +/// Sets whether the entity is fireproof +void cEntity::SetIsFireproof(bool a_IsFireproof) +{ + m_IsFireproof = a_IsFireproof; +} + + + + + /// Puts the entity on fire for the specified amount of ticks void cEntity::StartBurning(int a_TicksLeftBurning) { |