From a37b36adab85206e025d4ca97f6e64dc7a6974b8 Mon Sep 17 00:00:00 2001 From: archshift Date: Tue, 22 Apr 2014 12:59:31 -1000 Subject: Fireproof status getter and setter. --- src/Entities/Entity.cpp | 11 +++++++++++ src/Entities/Entity.h | 5 +++++ 2 files changed, 16 insertions(+) diff --git a/src/Entities/Entity.cpp b/src/Entities/Entity.cpp index 9a80d3e80..82900ff91 100644 --- a/src/Entities/Entity.cpp +++ b/src/Entities/Entity.cpp @@ -45,6 +45,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) @@ -1042,6 +1043,16 @@ void cEntity::SetMaxHealth(int a_MaxHealth) +/// Sets whether the entity is fireproof +void cEntity::SetFireproofStatus(bool a_IsFireproof) +{ + m_IsFireproof = a_IsFireproof; +} + + + + + /// Puts the entity on fire for the specified amount of ticks void cEntity::StartBurning(int a_TicksLeftBurning) { diff --git a/src/Entities/Entity.h b/src/Entities/Entity.h index 84a2003d4..4267ed0f6 100644 --- a/src/Entities/Entity.h +++ b/src/Entities/Entity.h @@ -329,6 +329,11 @@ public: int GetMaxHealth(void) const { return m_MaxHealth; } + /// Sets whether the entity is fireproof + void SetFireproofStatus(bool a_IsFireproof); + + bool GetFireproofStatus(void) const { return m_IsFireproof; } + /// Puts the entity on fire for the specified amount of ticks void StartBurning(int a_TicksLeftBurning); -- cgit v1.2.3 From e1476ebb26a3ce0b8405feb5a530cb442abd1329 Mon Sep 17 00:00:00 2001 From: archshift Date: Tue, 22 Apr 2014 13:17:42 -1000 Subject: Added IsFireproof hook for monsters.ini --- MCServer/monsters.ini | 26 ++++++++++++++++++++++++++ src/MonsterConfig.cpp | 3 +++ 2 files changed, 29 insertions(+) diff --git a/MCServer/monsters.ini b/MCServer/monsters.ini index cd5d92b66..8da3d6d24 100644 --- a/MCServer/monsters.ini +++ b/MCServer/monsters.ini @@ -4,6 +4,7 @@ AttackRate=1 AttackDamage=2.0 SightDistance=25.0 MaxHealth=16 +IsFireproof=0 [Chicken] AttackRange=2.0 @@ -11,6 +12,7 @@ AttackRate=1 AttackDamage=1.0 SightDistance=25.0 MaxHealth=4 +IsFireproof=0 [Cow] AttackRange=2.0 @@ -18,6 +20,7 @@ AttackRate=1 AttackDamage=1.0 SightDistance=25.0 MaxHealth=10 +IsFireproof=0 [Pig] AttackRange=2.0 @@ -25,6 +28,7 @@ AttackRate=1 AttackDamage=1.0 SightDistance=25.0 MaxHealth=10 +IsFireproof=0 [Sheep] AttackRange=2.0 @@ -32,6 +36,7 @@ AttackRate=1 AttackDamage=1.0 SightDistance=25.0 MaxHealth=8 +IsFireproof=0 [Squid] AttackRange=2.0 @@ -39,6 +44,7 @@ AttackRate=1 AttackDamage=1.0 SightDistance=25.0 MaxHealth=10 +IsFireproof=0 [Enderman] AttackRange=2.0 @@ -46,6 +52,7 @@ AttackRate=1 AttackDamage=4.0 SightDistance=25.0 MaxHealth=40 +IsFireproof=0 [ZombiePigman] AttackRange=2.0 @@ -53,6 +60,7 @@ AttackRate=1 AttackDamage=7.0 SightDistance=25.0 MaxHealth=20 +IsFireproof=1 [Cavespider] AttackRange=2.0 @@ -60,6 +68,7 @@ AttackRate=1 AttackDamage=2.0 SightDistance=25.0 MaxHealth=12 +IsFireproof=0 [Creeper] AttackRange=3.0 @@ -67,6 +76,7 @@ AttackRate=1 AttackDamage=0.0 SightDistance=25.0 MaxHealth=20 +IsFireproof=0 [Ghast] AttackRange=50.0 @@ -74,6 +84,7 @@ AttackRate=1 AttackDamage=0.0 SightDistance=50.0 MaxHealth=10 +IsFireproof=1 [Silverfish] AttackRange=2.0 @@ -81,12 +92,14 @@ AttackRate=1 AttackDamage=1.0 SightDistance=25.0 MaxHealth=8 +IsFireproof=0 [Skeleton] AttackRange=15.0 AttackRate=1 SightDistance=40.0 MaxHealth=20 +IsFireproof=0 [Slime] AttackRange=2.0 @@ -94,6 +107,7 @@ AttackRate=1 AttackDamage=4.0 SightDistance=25.0 MaxHealth=16 +IsFireproof=0 [Zombie] AttackRange=2.0 @@ -101,6 +115,7 @@ AttackRate=1 AttackDamage=4.0 SightDistance=25.0 MaxHealth=20 +IsFireproof=0 [Wolf] AttackRange=2.0 @@ -108,6 +123,7 @@ AttackRate=1 AttackDamage=4.0 SightDistance=25.0 MaxHealth=20 +IsFireproof=0 [Blaze] AttackRange=15.0 @@ -115,6 +131,7 @@ AttackRate=1 AttackDamage=6.0 SightDistance=25.0 MaxHealth=20 +IsFireproof=1 [Villager] AttackRange=2.0 @@ -122,6 +139,7 @@ AttackRate=1 AttackDamage=0.0 SightDistance=25.0 MaxHealth=20 +IsFireproof=0 [Witch] AttackRange=2.0 @@ -129,6 +147,7 @@ AttackRate=1 AttackDamage=0.0 SightDistance=25.0 MaxHealth=26 +IsFireproof=0 [Ocelot] @@ -137,6 +156,7 @@ AttackRate=1 AttackDamage=0.0 SightDistance=25.0 MaxHealth=10 +IsFireproof=0 [Mooshroom] AttackRange=2.0 @@ -144,6 +164,7 @@ AttackRate=1 AttackDamage=0.0 SightDistance=25.0 MaxHealth=10 +IsFireproof=0 [MagmaCube] AttackRange=2.0 @@ -151,6 +172,7 @@ AttackRate=1 AttackDamage=6.0 SightDistance=25.0 MaxHealth=16 +IsFireproof=1 [Horse] AttackRange=2.0 @@ -158,6 +180,7 @@ AttackRate=1 AttackDamage=6.0 SightDistance=25.0 MaxHealth=30 +IsFireproof=0 [EnderDragon] AttackRange=2.0 @@ -165,6 +188,7 @@ AttackRate=1 AttackDamage=6.0 SightDistance=25.0 MaxHealth=200 +IsFireproof=0 [Giant] AttackRange=2.0 @@ -172,6 +196,7 @@ AttackRate=1 AttackDamage=6.0 SightDistance=25.0 MaxHealth=100 +IsFireproof=0 [IronGolem] AttackRange=2.0 @@ -179,5 +204,6 @@ AttackRate=1 AttackDamage=6.0 SightDistance=25.0 MaxHealth=100 +IsFireproof=0 diff --git a/src/MonsterConfig.cpp b/src/MonsterConfig.cpp index c06bd6b6f..4b0e4bce1 100644 --- a/src/MonsterConfig.cpp +++ b/src/MonsterConfig.cpp @@ -17,6 +17,7 @@ struct cMonsterConfig::sAttributesStruct int m_AttackRange; double m_AttackRate; int m_MaxHealth; + bool m_IsFireproof; }; @@ -72,6 +73,7 @@ void cMonsterConfig::Initialize() Attributes.m_SightDistance = MonstersIniFile.GetValueI(Name, "SightDistance", 0); Attributes.m_AttackRate = MonstersIniFile.GetValueF(Name, "AttackRate", 0); Attributes.m_MaxHealth = MonstersIniFile.GetValueI(Name, "MaxHealth", 1); + Attributes.m_IsFireproof = MonstersIniFile.GetValueB(Name, "IsFireproof", false); m_pState->AttributesList.push_front(Attributes); } // for i - SplitList[] } @@ -92,6 +94,7 @@ void cMonsterConfig::AssignAttributes(cMonster * a_Monster, const AString & a_Na a_Monster->SetSightDistance(itr->m_SightDistance); a_Monster->SetAttackRate ((float)itr->m_AttackRate); a_Monster->SetMaxHealth (itr->m_MaxHealth); + a_Monster->SetFireproofStatus(itr->m_IsFireproof); return; } } // for itr - m_pState->AttributesList[] -- cgit v1.2.3 From fe08a903fcf47fc7e3748d24ac6beb592908553a Mon Sep 17 00:00:00 2001 From: archshift Date: Tue, 22 Apr 2014 15:45:52 -1000 Subject: Declaration that a mob is not fireproof is implicit. Removed explicitly declaring mobs as not fireproof. --- MCServer/monsters.ini | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/MCServer/monsters.ini b/MCServer/monsters.ini index 8da3d6d24..fa376bfff 100644 --- a/MCServer/monsters.ini +++ b/MCServer/monsters.ini @@ -4,7 +4,6 @@ AttackRate=1 AttackDamage=2.0 SightDistance=25.0 MaxHealth=16 -IsFireproof=0 [Chicken] AttackRange=2.0 @@ -12,7 +11,6 @@ AttackRate=1 AttackDamage=1.0 SightDistance=25.0 MaxHealth=4 -IsFireproof=0 [Cow] AttackRange=2.0 @@ -20,7 +18,6 @@ AttackRate=1 AttackDamage=1.0 SightDistance=25.0 MaxHealth=10 -IsFireproof=0 [Pig] AttackRange=2.0 @@ -28,7 +25,6 @@ AttackRate=1 AttackDamage=1.0 SightDistance=25.0 MaxHealth=10 -IsFireproof=0 [Sheep] AttackRange=2.0 @@ -36,7 +32,6 @@ AttackRate=1 AttackDamage=1.0 SightDistance=25.0 MaxHealth=8 -IsFireproof=0 [Squid] AttackRange=2.0 @@ -44,7 +39,6 @@ AttackRate=1 AttackDamage=1.0 SightDistance=25.0 MaxHealth=10 -IsFireproof=0 [Enderman] AttackRange=2.0 @@ -52,7 +46,6 @@ AttackRate=1 AttackDamage=4.0 SightDistance=25.0 MaxHealth=40 -IsFireproof=0 [ZombiePigman] AttackRange=2.0 @@ -68,7 +61,6 @@ AttackRate=1 AttackDamage=2.0 SightDistance=25.0 MaxHealth=12 -IsFireproof=0 [Creeper] AttackRange=3.0 @@ -76,7 +68,6 @@ AttackRate=1 AttackDamage=0.0 SightDistance=25.0 MaxHealth=20 -IsFireproof=0 [Ghast] AttackRange=50.0 @@ -92,14 +83,12 @@ AttackRate=1 AttackDamage=1.0 SightDistance=25.0 MaxHealth=8 -IsFireproof=0 [Skeleton] AttackRange=15.0 AttackRate=1 SightDistance=40.0 MaxHealth=20 -IsFireproof=0 [Slime] AttackRange=2.0 @@ -107,7 +96,6 @@ AttackRate=1 AttackDamage=4.0 SightDistance=25.0 MaxHealth=16 -IsFireproof=0 [Zombie] AttackRange=2.0 @@ -115,7 +103,6 @@ AttackRate=1 AttackDamage=4.0 SightDistance=25.0 MaxHealth=20 -IsFireproof=0 [Wolf] AttackRange=2.0 @@ -123,7 +110,6 @@ AttackRate=1 AttackDamage=4.0 SightDistance=25.0 MaxHealth=20 -IsFireproof=0 [Blaze] AttackRange=15.0 @@ -147,7 +133,6 @@ AttackRate=1 AttackDamage=0.0 SightDistance=25.0 MaxHealth=26 -IsFireproof=0 [Ocelot] @@ -156,7 +141,6 @@ AttackRate=1 AttackDamage=0.0 SightDistance=25.0 MaxHealth=10 -IsFireproof=0 [Mooshroom] AttackRange=2.0 @@ -164,7 +148,6 @@ AttackRate=1 AttackDamage=0.0 SightDistance=25.0 MaxHealth=10 -IsFireproof=0 [MagmaCube] AttackRange=2.0 @@ -180,7 +163,6 @@ AttackRate=1 AttackDamage=6.0 SightDistance=25.0 MaxHealth=30 -IsFireproof=0 [EnderDragon] AttackRange=2.0 @@ -188,7 +170,6 @@ AttackRate=1 AttackDamage=6.0 SightDistance=25.0 MaxHealth=200 -IsFireproof=0 [Giant] AttackRange=2.0 @@ -196,7 +177,6 @@ AttackRate=1 AttackDamage=6.0 SightDistance=25.0 MaxHealth=100 -IsFireproof=0 [IronGolem] AttackRange=2.0 @@ -204,6 +184,5 @@ AttackRate=1 AttackDamage=6.0 SightDistance=25.0 MaxHealth=100 -IsFireproof=0 -- cgit v1.2.3 From 876866942807f823d5d7553538f562a6b081093b Mon Sep 17 00:00:00 2001 From: archshift Date: Wed, 23 Apr 2014 00:12:37 -0700 Subject: Renamed getter and setter for IsFireproof. --- src/Entities/Entity.cpp | 2 +- src/Entities/Entity.h | 4 ++-- src/MonsterConfig.cpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Entities/Entity.cpp b/src/Entities/Entity.cpp index 82900ff91..6da6da54e 100644 --- a/src/Entities/Entity.cpp +++ b/src/Entities/Entity.cpp @@ -1044,7 +1044,7 @@ void cEntity::SetMaxHealth(int a_MaxHealth) /// Sets whether the entity is fireproof -void cEntity::SetFireproofStatus(bool a_IsFireproof) +void cEntity::SetIsFireproof(bool a_IsFireproof) { m_IsFireproof = a_IsFireproof; } diff --git a/src/Entities/Entity.h b/src/Entities/Entity.h index 4267ed0f6..86efc5a98 100644 --- a/src/Entities/Entity.h +++ b/src/Entities/Entity.h @@ -330,9 +330,9 @@ public: int GetMaxHealth(void) const { return m_MaxHealth; } /// Sets whether the entity is fireproof - void SetFireproofStatus(bool a_IsFireproof); + void SetIsFireproof(bool a_IsFireproof); - bool GetFireproofStatus(void) const { return m_IsFireproof; } + bool IsFireproof(void) const { return m_IsFireproof; } /// Puts the entity on fire for the specified amount of ticks void StartBurning(int a_TicksLeftBurning); diff --git a/src/MonsterConfig.cpp b/src/MonsterConfig.cpp index 4b0e4bce1..72a3a3245 100644 --- a/src/MonsterConfig.cpp +++ b/src/MonsterConfig.cpp @@ -94,7 +94,7 @@ void cMonsterConfig::AssignAttributes(cMonster * a_Monster, const AString & a_Na a_Monster->SetSightDistance(itr->m_SightDistance); a_Monster->SetAttackRate ((float)itr->m_AttackRate); a_Monster->SetMaxHealth (itr->m_MaxHealth); - a_Monster->SetFireproofStatus(itr->m_IsFireproof); + a_Monster->SetIsFireproof (itr->m_IsFireproof); return; } } // for itr - m_pState->AttributesList[] -- cgit v1.2.3