summaryrefslogtreecommitdiffstats
path: root/src/Mobs/Monster.cpp
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@hotmail.co.uk>2014-11-04 22:53:37 +0100
committerTiger Wang <ziwei.tiger@hotmail.co.uk>2014-11-04 22:53:37 +0100
commit3d00e52d42edc69eb777c90c6e6f479a5a473598 (patch)
tree9ed2245653c77b7de86678c345254fe70342126e /src/Mobs/Monster.cpp
parentMore player speed/position overrides (diff)
downloadcuberite-3d00e52d42edc69eb777c90c6e6f479a5a473598.tar
cuberite-3d00e52d42edc69eb777c90c6e6f479a5a473598.tar.gz
cuberite-3d00e52d42edc69eb777c90c6e6f479a5a473598.tar.bz2
cuberite-3d00e52d42edc69eb777c90c6e6f479a5a473598.tar.lz
cuberite-3d00e52d42edc69eb777c90c6e6f479a5a473598.tar.xz
cuberite-3d00e52d42edc69eb777c90c6e6f479a5a473598.tar.zst
cuberite-3d00e52d42edc69eb777c90c6e6f479a5a473598.zip
Diffstat (limited to 'src/Mobs/Monster.cpp')
-rw-r--r--src/Mobs/Monster.cpp69
1 files changed, 27 insertions, 42 deletions
diff --git a/src/Mobs/Monster.cpp b/src/Mobs/Monster.cpp
index 12ca6bbbe..50692ebc2 100644
--- a/src/Mobs/Monster.cpp
+++ b/src/Mobs/Monster.cpp
@@ -2,13 +2,11 @@
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
#include "IncludeAllMonsters.h"
-#include "../Root.h"
#include "../Server.h"
#include "../ClientHandle.h"
#include "../World.h"
#include "../Entities/Player.h"
#include "../Entities/ExpOrb.h"
-#include "../MonsterConfig.h"
#include "../MersenneTwister.h"
#include "../Chunk.h"
@@ -65,38 +63,34 @@ static const struct
////////////////////////////////////////////////////////////////////////////////
// cMonster:
-cMonster::cMonster(const AString & a_ConfigName, eMonsterType a_MobType, const AString & a_SoundHurt, const AString & a_SoundDeath, double a_Width, double a_Height)
- : super(etMonster, a_Width, a_Height)
- , m_EMState(IDLE)
- , m_EMPersonality(AGGRESSIVE)
- , m_Target(NULL)
- , m_bMovingToDestination(false)
- , m_LastGroundHeight(POSY_TOINT)
- , m_IdleInterval(0)
- , m_DestroyTimer(0)
- , m_MobType(a_MobType)
- , m_CustomName("")
- , m_CustomNameAlwaysVisible(false)
- , m_SoundHurt(a_SoundHurt)
- , m_SoundDeath(a_SoundDeath)
- , m_AttackRate(3)
- , m_AttackDamage(1)
- , m_AttackRange(2)
- , m_AttackInterval(0)
- , m_SightDistance(25)
- , m_DropChanceWeapon(0.085f)
- , m_DropChanceHelmet(0.085f)
- , m_DropChanceChestplate(0.085f)
- , m_DropChanceLeggings(0.085f)
- , m_DropChanceBoots(0.085f)
- , m_CanPickUpLoot(true)
- , m_BurnsInDaylight(false)
- , m_RelativeWalkSpeed(1.0)
+cMonster::cMonster(CreateMonsterInfo a_Info, const AString & a_ConfigName, eMonsterType a_MobType, const AString & a_SoundHurt, const AString & a_SoundDeath, double a_Width, double a_Height) :
+ super(a_Info, etMonster, a_Width, a_Height),
+ m_EMState(IDLE),
+ m_EMPersonality(AGGRESSIVE),
+ m_Target(NULL),
+ m_bMovingToDestination(false),
+ m_LastGroundHeight(POSY_TOINT),
+ m_IdleInterval(0),
+ m_DestroyTimer(0),
+ m_MobType(a_MobType),
+ m_CustomName(a_Info.CustomName),
+ m_CustomNameAlwaysVisible(a_Info.CustomNameAlwaysVisible),
+ m_SoundHurt(a_SoundHurt),
+ m_SoundDeath(a_SoundDeath),
+ m_AttackRate(a_Info.MonsterInfo.m_AttackRate),
+ m_AttackDamage(a_Info.MonsterInfo.m_AttackDamage),
+ m_AttackRange(a_Info.MonsterInfo.m_AttackRange),
+ m_AttackInterval(a_Info.MonsterInfo.m_AttackRate),
+ m_SightDistance(a_Info.MonsterInfo.m_SightDistance),
+ m_DropChanceWeapon(a_Info.DropChanceWeapon),
+ m_DropChanceHelmet(a_Info.DropChanceHelmet),
+ m_DropChanceChestplate(a_Info.DropChanceChestplate),
+ m_DropChanceLeggings(a_Info.DropChanceLeggings),
+ m_DropChanceBoots(a_Info.DropChanceBoots),
+ m_CanPickUpLoot(a_Info.CanPickUpLoot),
+ m_BurnsInDaylight(false),
+ m_RelativeWalkSpeed(1.0)
{
- if (!a_ConfigName.empty())
- {
- GetMonsterConfig(a_ConfigName);
- }
}
@@ -737,15 +731,6 @@ void cMonster::SetCustomNameAlwaysVisible(bool a_CustomNameAlwaysVisible)
-void cMonster::GetMonsterConfig(const AString & a_Name)
-{
- cRoot::Get()->GetMonsterConfig()->AssignAttributes(this, a_Name);
-}
-
-
-
-
-
bool cMonster::IsUndead(void)
{
return false;