summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJared Adams <jaxad0127@gmail.com>2009-10-13 15:33:32 -0600
committerJared Adams <jaxad0127@gmail.com>2009-10-13 15:33:32 -0600
commit8993816ef862c7a74bcc411d33ac03fc8ae47b05 (patch)
tree4a44d80b71b6157629cf6b4026d0bbcd6d691627
parentb9869eef99429c122d64b2b815f96573f119b3c8 (diff)
downloadmanaserv-8993816ef862c7a74bcc411d33ac03fc8ae47b05.tar.gz
manaserv-8993816ef862c7a74bcc411d33ac03fc8ae47b05.tar.bz2
manaserv-8993816ef862c7a74bcc411d33ac03fc8ae47b05.tar.xz
manaserv-8993816ef862c7a74bcc411d33ac03fc8ae47b05.zip
Add being action getter and setter
-rw-r--r--src/scripting/lua.cpp42
1 files changed, 42 insertions, 0 deletions
diff --git a/src/scripting/lua.cpp b/src/scripting/lua.cpp
index 6505a727..b3f9ce38 100644
--- a/src/scripting/lua.cpp
+++ b/src/scripting/lua.cpp
@@ -705,6 +705,46 @@ static int being_get_name(lua_State *s)
}
/**
+ * Gets the being's name
+ * tmw.being_get_action(being)
+ */
+static int being_get_action(lua_State *s)
+{
+ lua_pushlightuserdata(s, (void *)&registryKey);
+ lua_gettable(s, LUA_REGISTRYINDEX);
+
+ Being *being = getBeing(s, 1);
+
+ if (being)
+ {
+ lua_pushinteger(s, being->getAction());
+ }
+
+ return 1;
+}
+
+/**
+ * Gets the being's name
+ * tmw.being_set_action(being, action)
+ */
+static int being_set_action(lua_State *s)
+{
+ lua_pushlightuserdata(s, (void *)&registryKey);
+ lua_gettable(s, LUA_REGISTRYINDEX);
+
+ Being *being = getBeing(s, 1);
+
+ int act = lua_tointeger(s, 2);
+
+ if (being)
+ {
+ being->setAction((Being::Action) act);
+ }
+
+ return 1;
+}
+
+/**
* Function for getting the x-coordinate of the position of a being
*/
static int posX(lua_State *s)
@@ -1391,6 +1431,8 @@ LuaScript::LuaScript():
{ "being_damage", &being_damage },
{ "being_get_attribute", &being_get_attribute },
{ "being_get_name", &being_get_name },
+ { "being_get_action", &being_get_action },
+ { "being_set_action", &being_set_action },
{ "posX", &posX },
{ "posY", &posY },
{ "trigger_create", &trigger_create },