summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJonathan Kolberg <bulldog98@freenet.de>2010-03-13 11:05:14 +0100
committerThorbjørn Lindeijer <thorbjorn@lindeijer.nl>2010-03-13 20:39:41 +0100
commitfe9287be4daa9a4f9c38e5d835f6e16c31545ae4 (patch)
tree3dfa1ec1865a2f2381feaa8917a3792d39700cb5 /src
parent4a0a0952e706417111e5e10d3b0c3585cea6b455 (diff)
downloadmanaserv-fe9287be4daa9a4f9c38e5d835f6e16c31545ae4.tar.gz
manaserv-fe9287be4daa9a4f9c38e5d835f6e16c31545ae4.tar.bz2
manaserv-fe9287be4daa9a4f9c38e5d835f6e16c31545ae4.tar.xz
manaserv-fe9287be4daa9a4f9c38e5d835f6e16c31545ae4.zip
Add methods to get and set being speed
Signed-off-by: Thorbjørn Lindeijer <thorbjorn@lindeijer.nl>
Diffstat (limited to 'src')
-rw-r--r--src/scripting/lua.cpp36
1 files changed, 35 insertions, 1 deletions
diff --git a/src/scripting/lua.cpp b/src/scripting/lua.cpp
index c386c35d..dbd50776 100644
--- a/src/scripting/lua.cpp
+++ b/src/scripting/lua.cpp
@@ -564,6 +564,38 @@ static int being_set_status_time(lua_State *s)
return 1;
}
+/**
+* Returns the current speed of the being
+* mana.being_get_speed(Being *being, int id)
+*/
+static int being_get_speed(lua_State *s)
+{
+ if (!lua_isuserdata(s, 1) || !lua_isnumber(s, 2))
+ {
+ raiseScriptError(s, "being_get_speed called with incorrect parameters.");
+ return 0;
+ }
+ Being *being = getBeing(s, 1);
+ lua_pushnumber(s, being->getSpeed());
+ return 1;
+}
+
+/**
+* Sets the speed of the being
+* mana.being_set_speed(Being *being)
+*/
+static int being_set_speed(lua_State *s)
+{
+ if (!lua_isuserdata(s, 1) || !lua_isnumber(s, 2))
+ {
+ raiseScriptError(s, "being_set_speed called with incorrect parameters.");
+ return 0;
+ }
+ Being *being = getBeing(s, 1);
+ being->setSpeed(lua_tonumber(s, 2));
+ return 1;
+}
+
/**
* Returns the Thing type of the given Being
@@ -571,7 +603,7 @@ static int being_set_status_time(lua_State *s)
*/
static int being_type(lua_State *s)
{
- if (!lua_isuserdata(s, 1) )
+ if (!lua_isuserdata(s, 1))
{
raiseScriptError(s, "being_type called with incorrect parameters.");
return 0;
@@ -1540,6 +1572,8 @@ LuaScript::LuaScript():
{ "being_has_status", &being_has_status },
{ "being_set_status_time", &being_set_status_time},
{ "being_get_status_time", &being_get_status_time},
+ { "being_set_speed", &being_set_speed },
+ { "being_get_speed", &being_get_speed },
{ "being_type", &being_type },
{ "being_walk", &being_walk },
{ "being_say", &being_say },