diff options
author | Erik Schilling <ablu.erikschilling@googlemail.com> | 2012-03-13 19:15:00 +0100 |
---|---|---|
committer | Erik Schilling <ablu.erikschilling@googlemail.com> | 2012-03-14 17:51:53 +0100 |
commit | d74fa36fb69737ac14af4e360a428da747c88e78 (patch) | |
tree | 6a47440d182cb32eab8476fb5cdca5b581472c36 /src | |
parent | ba66fbeda8ef9afb6c33eba66d109bac85ebf628 (diff) | |
download | manaserv-d74fa36fb69737ac14af4e360a428da747c88e78.tar.gz manaserv-d74fa36fb69737ac14af4e360a428da747c88e78.tar.bz2 manaserv-d74fa36fb69737ac14af4e360a428da747c88e78.tar.xz manaserv-d74fa36fb69737ac14af4e360a428da747c88e78.zip |
Added being_get_mapid lua bind
Another step for being able to make @commands scriptable
Reviewed-by: bjorn.
Diffstat (limited to 'src')
-rw-r--r-- | src/scripting/lua.cpp | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/src/scripting/lua.cpp b/src/scripting/lua.cpp index 0087672f..30b6ace8 100644 --- a/src/scripting/lua.cpp +++ b/src/scripting/lua.cpp @@ -1160,7 +1160,7 @@ static int being_set_direction(lua_State *s) return 0; } -/* +/** * being_set_walkmask(Being*, string mask) * Sets the walkmask of a being */ @@ -1181,7 +1181,7 @@ static int being_set_walkmask(lua_State *s) /** * being_get_walkmask(Being*): string - * Returns the walkmask of a being + * Returns the walkmask of a being. */ static int being_get_walkmask(lua_State *s) { @@ -1200,6 +1200,21 @@ static int being_get_walkmask(lua_State *s) } /** + * being_get_mapid(Being*): int + * Returns the id of the map where the being is located or nil if there is none. + */ +static int being_get_mapid(lua_State *s) +{ + Being *being = checkBeing(s, 1); + if (MapComposite *map = being->getMap()) + lua_pushinteger(s, map->getID()); + else + lua_pushnil(s); + + return 1; +} + +/** * posX(Being*): int xcoord * Function for getting the x-coordinate of the position of a being. */ @@ -2271,6 +2286,7 @@ LuaScript::LuaScript(): { "being_get_base_attribute", &being_get_base_attribute }, { "being_set_walkmask", &being_set_walkmask }, { "being_get_walkmask", &being_get_walkmask }, + { "being_get_mapid", &being_get_mapid }, { "posX", &posX }, { "posY", &posY }, { "trigger_create", &trigger_create }, |