diff options
-rw-r--r-- | CONTRIBUTORS | 1 | ||||
-rw-r--r-- | Server/Plugins/APIDump/APIDesc.lua | 4 | ||||
-rw-r--r-- | Server/monsters.ini | 3 | ||||
-rw-r--r-- | src/Mobs/Monster.cpp | 14 | ||||
-rw-r--r-- | src/Mobs/Monster.h | 7 | ||||
-rw-r--r-- | src/Mobs/Wolf.cpp | 1 | ||||
-rw-r--r-- | src/MonsterConfig.cpp | 9 |
7 files changed, 31 insertions, 8 deletions
diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 1ef873ea8..4c4e59fe4 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -9,6 +9,7 @@ as provided in the LICENSE file. 9caihezi AirOne01 Altenius +anguslmm (Angus McLean) ashquarky BasedDoge (Donated AlchemistVillage prefabs) bearbin (Alexander Harkness) diff --git a/Server/Plugins/APIDump/APIDesc.lua b/Server/Plugins/APIDump/APIDesc.lua index 54a8d4e4f..8e5e92dd1 100644 --- a/Server/Plugins/APIDump/APIDesc.lua +++ b/Server/Plugins/APIDump/APIDesc.lua @@ -9240,7 +9240,7 @@ a_Player:OpenWindow(Window); Type = "number", }, }, - Notes = "Returns the relative walk speed of this mob. Standard is 1.0", + Notes = "Returns the walk speed multiplier of this mob. Base is set in monsters.ini (will default to 1 if not set).", }, HasCustomName = { @@ -9404,7 +9404,7 @@ a_Player:OpenWindow(Window); Type = "number", }, }, - Notes = "Sets the relative walk speed of this mob. The default relative speed is 1.0.", + Notes = "Sets the walk speed multiplier of this mob. Base is set in monsters.ini (will default to 1 if not set).", }, StringToMobType = { diff --git a/Server/monsters.ini b/Server/monsters.ini index 3d6028ed8..fb42fedb0 100644 --- a/Server/monsters.ini +++ b/Server/monsters.ini @@ -175,6 +175,8 @@ AttackRange=1.0 AttackRate=1.0 MaxHealth=16 SightDistance=25.0 +WalkSpeed=1.0 +RunSpeed=1.3 [Squid] AttackDamage=0.0 @@ -211,6 +213,7 @@ AttackRange=1.0 AttackRate=1.0 MaxHealth=20 SightDistance=25.0 +WalkSpeed=2.0 [Zombie] AttackDamage=4.0 diff --git a/src/Mobs/Monster.cpp b/src/Mobs/Monster.cpp index 788d1b66f..d14746513 100644 --- a/src/Mobs/Monster.cpp +++ b/src/Mobs/Monster.cpp @@ -227,8 +227,18 @@ void cMonster::MoveToWayPoint(cChunk & a_Chunk) // Don't let the mob move too much if he's falling. Distance *= 0.25f; } - // Apply walk speed: - Distance *= m_RelativeWalkSpeed; + + if ((m_EMState == CHASING) || (m_EMState == ESCAPING)) + { + // Apply run speed: + Distance *= m_BaseRunSpeed * m_RelativeWalkSpeed; + } + else + { + // Apply walk speed: + Distance *= m_BaseWalkSpeed * m_RelativeWalkSpeed; + } + /* Reduced default speed. Close to Vanilla, easier for mobs to follow m_NextWayPointPositions, hence better pathfinding. */ diff --git a/src/Mobs/Monster.h b/src/Mobs/Monster.h index 0127ec4ce..24a1d189f 100644 --- a/src/Mobs/Monster.h +++ b/src/Mobs/Monster.h @@ -146,7 +146,10 @@ public: bool BurnsInDaylight() const { return m_BurnsInDaylight; } // tolua_export double GetRelativeWalkSpeed(void) const { return m_RelativeWalkSpeed; } // tolua_export - void SetRelativeWalkSpeed(double a_WalkSpeed) { m_RelativeWalkSpeed = a_WalkSpeed; } // tolua_export + void SetRelativeWalkSpeed(double a_Speed) { m_RelativeWalkSpeed = a_Speed; } // tolua_export + + void SetBaseWalkSpeed(double a_Speed) { m_BaseWalkSpeed = a_Speed; } + void SetBaseRunSpeed(double a_Speed) { m_BaseRunSpeed = a_Speed; } // Overridables to handle ageable mobs virtual bool IsTame (void) const { return false; } @@ -326,6 +329,8 @@ protected: bool WouldBurnAt(Vector3d a_Location, cChunk & a_Chunk); bool m_BurnsInDaylight; double m_RelativeWalkSpeed; + double m_BaseWalkSpeed; + double m_BaseRunSpeed; int m_AmbientSoundTimer; diff --git a/src/Mobs/Wolf.cpp b/src/Mobs/Wolf.cpp index 553ca1c73..edcb54075 100644 --- a/src/Mobs/Wolf.cpp +++ b/src/Mobs/Wolf.cpp @@ -20,7 +20,6 @@ cWolf::cWolf(void) : m_CollarColor(E_META_DYE_ORANGE), m_NotificationCooldown(0) { - m_RelativeWalkSpeed = 2; } 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 - |