summaryrefslogtreecommitdiffstats
path: root/src/MonsterConfig.cpp
diff options
context:
space:
mode:
authorAngus <anguslmm@gmail.com>2024-11-10 12:28:39 +0100
committerGitHub <noreply@github.com>2024-11-10 12:28:39 +0100
commit5e258c6d95a22664e1f9bfa8e778e007e69b4ef2 (patch)
treeea9e9a5dbc28af2607223cba64e5762d80c7669b /src/MonsterConfig.cpp
parentFix Block Entity Placement in Generation (#5060) (diff)
downloadcuberite-5e258c6d95a22664e1f9bfa8e778e007e69b4ef2.tar
cuberite-5e258c6d95a22664e1f9bfa8e778e007e69b4ef2.tar.gz
cuberite-5e258c6d95a22664e1f9bfa8e778e007e69b4ef2.tar.bz2
cuberite-5e258c6d95a22664e1f9bfa8e778e007e69b4ef2.tar.lz
cuberite-5e258c6d95a22664e1f9bfa8e778e007e69b4ef2.tar.xz
cuberite-5e258c6d95a22664e1f9bfa8e778e007e69b4ef2.tar.zst
cuberite-5e258c6d95a22664e1f9bfa8e778e007e69b4ef2.zip
Diffstat (limited to 'src/MonsterConfig.cpp')
-rw-r--r--src/MonsterConfig.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/MonsterConfig.cpp b/src/MonsterConfig.cpp
index 271a72a7f..2ee7e7393 100644
--- a/src/MonsterConfig.cpp
+++ b/src/MonsterConfig.cpp
@@ -17,6 +17,8 @@ struct cMonsterConfig::sAttributesStruct
double m_AttackRange;
double m_AttackRate;
double m_MaxHealth;
+ double m_BaseWalkSpeed;
+ double m_BaseRunSpeed;
bool m_IsFireproof;
bool m_BurnsInDaylight;
};
@@ -71,10 +73,12 @@ void cMonsterConfig::Initialize()
AString Name = MonstersIniFile.GetKeyName(i);
Attributes.m_Name = Name;
Attributes.m_AttackDamage = MonstersIniFile.GetValueI(Name, "AttackDamage", 0);
- Attributes.m_AttackRange = MonstersIniFile.GetValueF(Name, "AttackRange", 0);
+ Attributes.m_AttackRange = MonstersIniFile.GetValueI(Name, "AttackRange", 0);
Attributes.m_SightDistance = MonstersIniFile.GetValueI(Name, "SightDistance", 0);
Attributes.m_AttackRate = MonstersIniFile.GetValueF(Name, "AttackRate", 0);
Attributes.m_MaxHealth = MonstersIniFile.GetValueF(Name, "MaxHealth", 1);
+ Attributes.m_BaseWalkSpeed = MonstersIniFile.GetValueF(Name, "WalkSpeed", 1);
+ Attributes.m_BaseRunSpeed = MonstersIniFile.GetValueF(Name, "RunSpeed", Attributes.m_BaseWalkSpeed);
Attributes.m_IsFireproof = MonstersIniFile.GetValueB(Name, "IsFireproof", false);
Attributes.m_BurnsInDaylight = MonstersIniFile.GetValueB(Name, "BurnsInDaylight", false);
m_pState->AttributesList.push_front(Attributes);
@@ -97,6 +101,8 @@ void cMonsterConfig::AssignAttributes(cMonster * a_Monster, const AString & a_Na
a_Monster->SetSightDistance (itr->m_SightDistance);
a_Monster->SetAttackRate (static_cast<float>(itr->m_AttackRate));
a_Monster->SetMaxHealth (static_cast<float>(itr->m_MaxHealth));
+ a_Monster->SetBaseWalkSpeed (itr->m_BaseWalkSpeed);
+ a_Monster->SetBaseRunSpeed (itr->m_BaseRunSpeed);
a_Monster->SetIsFireproof (itr->m_IsFireproof);
a_Monster->SetBurnsInDaylight(itr->m_BurnsInDaylight);
return;
@@ -107,4 +113,3 @@ void cMonsterConfig::AssignAttributes(cMonster * a_Monster, const AString & a_Na
-