summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-07-12 22:28:41 +0200
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-07-12 22:28:41 +0200
commit2fca0567bfcd7b62b8fcd05ff36a07d931e1ea9e (patch)
tree332aacfef1f1387b63b7306a0dcfcdbf80506085 /source
parentFirst implementation of movement-related hunger and API (diff)
downloadcuberite-2fca0567bfcd7b62b8fcd05ff36a07d931e1ea9e.tar
cuberite-2fca0567bfcd7b62b8fcd05ff36a07d931e1ea9e.tar.gz
cuberite-2fca0567bfcd7b62b8fcd05ff36a07d931e1ea9e.tar.bz2
cuberite-2fca0567bfcd7b62b8fcd05ff36a07d931e1ea9e.tar.lz
cuberite-2fca0567bfcd7b62b8fcd05ff36a07d931e1ea9e.tar.xz
cuberite-2fca0567bfcd7b62b8fcd05ff36a07d931e1ea9e.tar.zst
cuberite-2fca0567bfcd7b62b8fcd05ff36a07d931e1ea9e.zip
Diffstat (limited to '')
-rw-r--r--source/Bindings.cpp33
-rw-r--r--source/Bindings.h2
-rw-r--r--source/BlockID.cpp50
-rw-r--r--source/BlockID.h3
4 files changed, 86 insertions, 2 deletions
diff --git a/source/Bindings.cpp b/source/Bindings.cpp
index 9333c7d16..8963c9231 100644
--- a/source/Bindings.cpp
+++ b/source/Bindings.cpp
@@ -1,6 +1,6 @@
/*
** Lua binding: AllToLua
-** Generated automatically by tolua++-1.0.92 on 07/09/13 09:51:25.
+** Generated automatically by tolua++-1.0.92 on 07/12/13 22:26:52.
*/
#ifndef __cplusplus
@@ -2561,6 +2561,36 @@ static int tolua_AllToLua_StringToBiome00(lua_State* tolua_S)
}
#endif //#ifndef TOLUA_DISABLE
+/* function: StringToMobType */
+#ifndef TOLUA_DISABLE_tolua_AllToLua_StringToMobType00
+static int tolua_AllToLua_StringToMobType00(lua_State* tolua_S)
+{
+#ifndef TOLUA_RELEASE
+ tolua_Error tolua_err;
+ if (
+ !tolua_iscppstring(tolua_S,1,0,&tolua_err) ||
+ !tolua_isnoobj(tolua_S,2,&tolua_err)
+ )
+ goto tolua_lerror;
+ else
+#endif
+ {
+ const AString a_MobString = ((const AString) tolua_tocppstring(tolua_S,1,0));
+ {
+ int tolua_ret = (int) StringToMobType(a_MobString);
+ tolua_pushnumber(tolua_S,(lua_Number)tolua_ret);
+ tolua_pushcppstring(tolua_S,(const char*)a_MobString);
+ }
+ }
+ return 2;
+#ifndef TOLUA_RELEASE
+ tolua_lerror:
+ tolua_error(tolua_S,"#ferror in function 'StringToMobType'.",&tolua_err);
+ return 0;
+#endif
+}
+#endif //#ifndef TOLUA_DISABLE
+
/* function: StringToDimension */
#ifndef TOLUA_DISABLE_tolua_AllToLua_StringToDimension00
static int tolua_AllToLua_StringToDimension00(lua_State* tolua_S)
@@ -28538,6 +28568,7 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S)
tolua_function(tolua_S,"ItemTypeToString",tolua_AllToLua_ItemTypeToString00);
tolua_function(tolua_S,"ItemToFullString",tolua_AllToLua_ItemToFullString00);
tolua_function(tolua_S,"StringToBiome",tolua_AllToLua_StringToBiome00);
+ tolua_function(tolua_S,"StringToMobType",tolua_AllToLua_StringToMobType00);
tolua_function(tolua_S,"StringToDimension",tolua_AllToLua_StringToDimension00);
tolua_function(tolua_S,"DamageTypeToString",tolua_AllToLua_DamageTypeToString00);
tolua_function(tolua_S,"StringToDamageType",tolua_AllToLua_StringToDamageType00);
diff --git a/source/Bindings.h b/source/Bindings.h
index a3a399bbc..9685235b3 100644
--- a/source/Bindings.h
+++ b/source/Bindings.h
@@ -1,6 +1,6 @@
/*
** Lua binding: AllToLua
-** Generated automatically by tolua++-1.0.92 on 07/09/13 09:51:26.
+** Generated automatically by tolua++-1.0.92 on 07/12/13 22:26:52.
*/
/* Exported function */
diff --git a/source/BlockID.cpp b/source/BlockID.cpp
index bd2009391..ad96cfa72 100644
--- a/source/BlockID.cpp
+++ b/source/BlockID.cpp
@@ -321,6 +321,56 @@ EMCSBiome StringToBiome(const AString & a_BiomeString)
+int StringToMobType(const AString & a_MobString)
+{
+ static struct {
+ int m_MobType;
+ const char * m_String;
+ } MobMap [] =
+ {
+ {E_ENTITY_TYPE_CREEPER, "Creeper"},
+ {E_ENTITY_TYPE_SKELETON, "Skeleton"},
+ {E_ENTITY_TYPE_SPIDER, "Spider"},
+ {E_ENTITY_TYPE_GIANT, "Giant"},
+ {E_ENTITY_TYPE_ZOMBIE, "Zombie"},
+ {E_ENTITY_TYPE_SLIME, "Slime"},
+ {E_ENTITY_TYPE_GHAST, "Ghast"},
+ {E_ENTITY_TYPE_ZOMBIE_PIGMAN, "ZombiePigman"},
+ {E_ENTITY_TYPE_ENDERMAN, "Enderman"},
+ {E_ENTITY_TYPE_CAVE_SPIDER, "CaveSpider"},
+ {E_ENTITY_TYPE_SILVERFISH, "SilverFish"},
+ {E_ENTITY_TYPE_BLAZE, "Blaze"},
+ {E_ENTITY_TYPE_MAGMA_CUBE, "MagmaCube"},
+ {E_ENTITY_TYPE_ENDER_DRAGON, "EnderDragon"},
+ {E_ENTITY_TYPE_WITHER, "Wither"},
+ {E_ENTITY_TYPE_BAT, "Bat"},
+ {E_ENTITY_TYPE_WITCH, "Witch"},
+ {E_ENTITY_TYPE_PIG, "Pig"},
+ {E_ENTITY_TYPE_SHEEP, "Sheep"},
+ {E_ENTITY_TYPE_COW, "Cow"},
+ {E_ENTITY_TYPE_CHICKEN, "Chicken"},
+ {E_ENTITY_TYPE_SQUID, "Squid"},
+ {E_ENTITY_TYPE_WOLF, "Wolf"},
+ {E_ENTITY_TYPE_MOOSHROOM, "Mushroom"},
+ {E_ENTITY_TYPE_SNOW_GOLEM, "SnowGolem"},
+ {E_ENTITY_TYPE_OCELOT, "Ocelot"},
+ {E_ENTITY_TYPE_IRON_GOLEM, "IronGolem"},
+ {E_ENTITY_TYPE_VILLAGER, "Villager"},
+ };
+ for (int i = 0; i < ARRAYCOUNT(MobMap); i++)
+ {
+ if (NoCaseCompare(MobMap[i].m_String, a_MobString) == 0)
+ {
+ return MobMap[i].m_MobType;
+ }
+ } // for i - MobMap[]
+ return (int)-1;
+}
+
+
+
+
+
eDimension StringToDimension(const AString & a_DimensionString)
{
// First try decoding as a number
diff --git a/source/BlockID.h b/source/BlockID.h
index 9b2a104f3..bd2580ca9 100644
--- a/source/BlockID.h
+++ b/source/BlockID.h
@@ -688,6 +688,9 @@ extern AString ItemToFullString(const cItem & a_Item);
/// Translates a biome string to biome enum. Takes either a number or a biome alias (built-in). Returns -1 on failure.
extern EMCSBiome StringToBiome(const AString & a_BiomeString);
+/// Translates a mob string ("ocelot") to mobtype (E_ENTITY_TYPE_OCELOT)
+extern int StringToMobType(const AString & a_MobString);
+
/// Translates a dimension string to dimension enum. Takes either a number or a dimension alias (built-in). Returns -1000 on failure
extern eDimension StringToDimension(const AString & a_DimensionString);