summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--MCServer/monsters.ini5
-rw-r--r--src/Entities/Entity.cpp11
-rw-r--r--src/Entities/Entity.h5
-rw-r--r--src/MonsterConfig.cpp3
4 files changed, 24 insertions, 0 deletions
diff --git a/MCServer/monsters.ini b/MCServer/monsters.ini
index cd5d92b66..fa376bfff 100644
--- a/MCServer/monsters.ini
+++ b/MCServer/monsters.ini
@@ -53,6 +53,7 @@ AttackRate=1
AttackDamage=7.0
SightDistance=25.0
MaxHealth=20
+IsFireproof=1
[Cavespider]
AttackRange=2.0
@@ -74,6 +75,7 @@ AttackRate=1
AttackDamage=0.0
SightDistance=50.0
MaxHealth=10
+IsFireproof=1
[Silverfish]
AttackRange=2.0
@@ -115,6 +117,7 @@ AttackRate=1
AttackDamage=6.0
SightDistance=25.0
MaxHealth=20
+IsFireproof=1
[Villager]
AttackRange=2.0
@@ -122,6 +125,7 @@ AttackRate=1
AttackDamage=0.0
SightDistance=25.0
MaxHealth=20
+IsFireproof=0
[Witch]
AttackRange=2.0
@@ -151,6 +155,7 @@ AttackRate=1
AttackDamage=6.0
SightDistance=25.0
MaxHealth=16
+IsFireproof=1
[Horse]
AttackRange=2.0
diff --git a/src/Entities/Entity.cpp b/src/Entities/Entity.cpp
index 9a80d3e80..6da6da54e 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::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)
{
diff --git a/src/Entities/Entity.h b/src/Entities/Entity.h
index 84a2003d4..86efc5a98 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 SetIsFireproof(bool a_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 c06bd6b6f..72a3a3245 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->SetIsFireproof (itr->m_IsFireproof);
return;
}
} // for itr - m_pState->AttributesList[]