summaryrefslogtreecommitdiffstats
path: root/source/Mobs/Monster.h
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2013-10-20 13:25:56 +0200
committermadmaxoft <github@xoft.cz>2013-10-20 13:25:56 +0200
commit848d061de167be9fd802cc8a6b14a934702af81a (patch)
tree5436be82842e1883588fb07dcc634ba2381ea368 /source/Mobs/Monster.h
parentRewritten MobTypesManager not to leak memory. (diff)
downloadcuberite-848d061de167be9fd802cc8a6b14a934702af81a.tar
cuberite-848d061de167be9fd802cc8a6b14a934702af81a.tar.gz
cuberite-848d061de167be9fd802cc8a6b14a934702af81a.tar.bz2
cuberite-848d061de167be9fd802cc8a6b14a934702af81a.tar.lz
cuberite-848d061de167be9fd802cc8a6b14a934702af81a.tar.xz
cuberite-848d061de167be9fd802cc8a6b14a934702af81a.tar.zst
cuberite-848d061de167be9fd802cc8a6b14a934702af81a.zip
Diffstat (limited to 'source/Mobs/Monster.h')
-rw-r--r--source/Mobs/Monster.h26
1 files changed, 24 insertions, 2 deletions
diff --git a/source/Mobs/Monster.h b/source/Mobs/Monster.h
index c416d026c..3b7f40c00 100644
--- a/source/Mobs/Monster.h
+++ b/source/Mobs/Monster.h
@@ -71,6 +71,9 @@ public:
// tolua_end
+ enum MState{ATTACKING, IDLE, CHASING, ESCAPING} m_EMState;
+ enum MPersonality{PASSIVE,AGGRESSIVE,COWARDLY} m_EMPersonality;
+
float m_SightDistance;
/** Creates the mob object.
@@ -132,9 +135,28 @@ public:
virtual bool IsTame (void) const { return false; }
virtual bool IsSitting (void) const { return false; }
- enum MState{ATTACKING, IDLE, CHASING, ESCAPING} m_EMState;
- enum MPersonality{PASSIVE,AGGRESSIVE,COWARDLY} m_EMPersonality;
+ // tolua_begin
+
+ /// Translates MobType enum to a string
+ static AString MobTypeToString(eType a_MobType);
+ /// Translates MobType string to the enum
+ static eType StringToMobType(const AString & a_MobTypeName);
+
+ /// Returns the mob family based on the type
+ static eFamily FamilyFromType(eType a_MobType);
+
+ // tolua_end
+
+ /** Creates a new object of the specified mob.
+ a_MobType is the type of the mob to be created
+ a_Size is the size (for mobs with size)
+ if a_Size is let to -1 for entities that need size, size will be random
+ asserts and returns null if mob type is not specified
+ asserts if invalid size for mobs that need size
+ */
+ static cMonster * NewMonsterFromType(eType a_MobType, int a_Size = -1);
+
protected:
cEntity * m_Target;