From bca7f2949032ab90ee03988f560bce157a25b683 Mon Sep 17 00:00:00 2001 From: archshift Date: Tue, 22 Apr 2014 01:59:34 -1000 Subject: [PATCH 1/3] Lay foundation for fireproof entities. Prevent any entities with the m_Fireproof flag from taking fire or lava damage. --- src/Entities/Entity.cpp | 15 ++++++++++++--- src/Entities/Entity.h | 3 +++ 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/Entities/Entity.cpp b/src/Entities/Entity.cpp index 56ef36ef8..345e0054b 100644 --- a/src/Entities/Entity.cpp +++ b/src/Entities/Entity.cpp @@ -788,7 +788,10 @@ void cEntity::TickBurning(cChunk & a_Chunk) m_TicksSinceLastBurnDamage++; if (m_TicksSinceLastBurnDamage >= BURN_TICKS_PER_DAMAGE) { - TakeDamage(dtOnFire, NULL, BURN_DAMAGE, 0); + if (!m_Fireproof) + { + TakeDamage(dtOnFire, NULL, BURN_DAMAGE, 0); + } m_TicksSinceLastBurnDamage = 0; } m_TicksLeftBurning--; @@ -856,7 +859,10 @@ void cEntity::TickBurning(cChunk & a_Chunk) m_TicksSinceLastLavaDamage++; if (m_TicksSinceLastLavaDamage >= LAVA_TICKS_PER_DAMAGE) { - TakeDamage(dtLavaContact, NULL, LAVA_DAMAGE, 0); + if (!m_Fireproof) + { + TakeDamage(dtLavaContact, NULL, LAVA_DAMAGE, 0); + } m_TicksSinceLastLavaDamage = 0; } } @@ -874,7 +880,10 @@ void cEntity::TickBurning(cChunk & a_Chunk) m_TicksSinceLastFireDamage++; if (m_TicksSinceLastFireDamage >= FIRE_TICKS_PER_DAMAGE) { - TakeDamage(dtFireContact, NULL, FIRE_DAMAGE, 0); + if (!m_Fireproof) + { + TakeDamage(dtFireContact, NULL, FIRE_DAMAGE, 0); + } m_TicksSinceLastFireDamage = 0; } } diff --git a/src/Entities/Entity.h b/src/Entities/Entity.h index 8f3899e2f..ea85ac683 100644 --- a/src/Entities/Entity.h +++ b/src/Entities/Entity.h @@ -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; From 1cf396c814e2f4586f55b13130a9f7a039caed4c Mon Sep 17 00:00:00 2001 From: archshift Date: Tue, 22 Apr 2014 02:18:41 -1000 Subject: [PATCH 2/3] Fixed capitalization issues Wasn't parsing correctly before, as some items were not capitalized correctly. --- MCServer/monsters.ini | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/MCServer/monsters.ini b/MCServer/monsters.ini index 8cd956157..cd5d92b66 100644 --- a/MCServer/monsters.ini +++ b/MCServer/monsters.ini @@ -47,7 +47,7 @@ AttackDamage=4.0 SightDistance=25.0 MaxHealth=40 -[Zombiepigman] +[ZombiePigman] AttackRange=2.0 AttackRate=1 AttackDamage=7.0 @@ -145,7 +145,7 @@ AttackDamage=0.0 SightDistance=25.0 MaxHealth=10 -[Magmacube] +[MagmaCube] AttackRange=2.0 AttackRate=1 AttackDamage=6.0 From 06f41699afe27a6be1de357466f9185403baa550 Mon Sep 17 00:00:00 2001 From: archshift Date: Tue, 22 Apr 2014 02:36:39 -1000 Subject: [PATCH 3/3] Fixed indentation and changed m_Fireproof to m_IsFireproof. --- src/Entities/Entity.cpp | 24 ++++++++++++------------ src/Entities/Entity.h | 4 ++-- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/Entities/Entity.cpp b/src/Entities/Entity.cpp index 345e0054b..9a80d3e80 100644 --- a/src/Entities/Entity.cpp +++ b/src/Entities/Entity.cpp @@ -788,10 +788,10 @@ void cEntity::TickBurning(cChunk & a_Chunk) m_TicksSinceLastBurnDamage++; if (m_TicksSinceLastBurnDamage >= BURN_TICKS_PER_DAMAGE) { - if (!m_Fireproof) - { - TakeDamage(dtOnFire, NULL, BURN_DAMAGE, 0); - } + if (!m_IsFireproof) + { + TakeDamage(dtOnFire, NULL, BURN_DAMAGE, 0); + } m_TicksSinceLastBurnDamage = 0; } m_TicksLeftBurning--; @@ -859,10 +859,10 @@ void cEntity::TickBurning(cChunk & a_Chunk) m_TicksSinceLastLavaDamage++; if (m_TicksSinceLastLavaDamage >= LAVA_TICKS_PER_DAMAGE) { - if (!m_Fireproof) - { - TakeDamage(dtLavaContact, NULL, LAVA_DAMAGE, 0); - } + if (!m_IsFireproof) + { + TakeDamage(dtLavaContact, NULL, LAVA_DAMAGE, 0); + } m_TicksSinceLastLavaDamage = 0; } } @@ -880,10 +880,10 @@ void cEntity::TickBurning(cChunk & a_Chunk) m_TicksSinceLastFireDamage++; if (m_TicksSinceLastFireDamage >= FIRE_TICKS_PER_DAMAGE) { - if (!m_Fireproof) - { - TakeDamage(dtFireContact, NULL, FIRE_DAMAGE, 0); - } + if (!m_IsFireproof) + { + TakeDamage(dtFireContact, NULL, FIRE_DAMAGE, 0); + } m_TicksSinceLastFireDamage = 0; } } diff --git a/src/Entities/Entity.h b/src/Entities/Entity.h index ea85ac683..84a2003d4 100644 --- a/src/Entities/Entity.h +++ b/src/Entities/Entity.h @@ -435,8 +435,8 @@ protected: cWorld * m_World; - /// Whether the entity is capable of taking fire or lava damage. - bool m_Fireproof; + /// Whether the entity is capable of taking fire or lava damage. + bool m_IsFireproof; /// Time, in ticks, since the last damage dealt by being on fire. Valid only if on fire (IsOnFire()) int m_TicksSinceLastBurnDamage;