summaryrefslogtreecommitdiff
path: root/src/scripting/lua.cpp
diff options
context:
space:
mode:
authorPhilipp Sehmisch <crush@themanaworld.org>2009-01-31 21:49:58 +0100
committerPhilipp Sehmisch <crush@themanaworld.org>2009-01-31 22:01:39 +0100
commit393d066045fda5beee4748dc66754d70b4c82d36 (patch)
tree2ed309a5dba7595bc976762f9f625edebfcc4680 /src/scripting/lua.cpp
parentc423c02890cfb4520da0ac75e00d1bd9f1663ce0 (diff)
downloadmanaserv-393d066045fda5beee4748dc66754d70b4c82d36.tar.gz
manaserv-393d066045fda5beee4748dc66754d70b4c82d36.tar.bz2
manaserv-393d066045fda5beee4748dc66754d70b4c82d36.tar.xz
manaserv-393d066045fda5beee4748dc66754d70b4c82d36.zip
Added on_remove callback to lua API
Diffstat (limited to 'src/scripting/lua.cpp')
-rw-r--r--src/scripting/lua.cpp18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/scripting/lua.cpp b/src/scripting/lua.cpp
index b9f30f4e..f9d2021d 100644
--- a/src/scripting/lua.cpp
+++ b/src/scripting/lua.cpp
@@ -768,15 +768,16 @@ static int chr_get_post(lua_State *s)
}
/**
- * Makes the server call the lua function deathEvent
- * with the being ID when the being dies.
- * tmw.note_on_death (being)
+ * Makes the server call the lua functions deathEvent
+ * and removeEvent when the being dies or is removed
+ * from the map.
+ * tmw.being_register (being)
*/
-static int note_on_death(lua_State *s)
+static int being_register(lua_State *s)
{
if (!lua_islightuserdata(s, 1) || lua_gettop(s) != 1)
{
- raiseScriptError(s, "lua_noteOnDeath called with incorrect parameters.");
+ raiseScriptError(s, "being_register called with incorrect parameters.");
return 0;
}
@@ -786,14 +787,15 @@ static int note_on_death(lua_State *s)
Being *being = getBeing(s, 1);
if (!being)
{
- raiseScriptError(s, "lua_noteOnDeath called for nonexistent being.");
+ raiseScriptError(s, "being_register called for nonexistent being.");
return 0;
}
- being->addListener(t->getScriptDeathListener());
+ being->addListener(t->getScriptListener());
return 0;
}
+
/**
* Triggers a special effect from the clients effects.xml
* tmw.effect_create (id, x, y)
@@ -1006,7 +1008,7 @@ LuaScript::LuaScript():
{ "trigger_create", &trigger_create },
{ "chatmessage", &chatmessage },
{ "get_beings_in_circle", &get_beings_in_circle },
- { "note_on_death", &note_on_death },
+ { "being_register", &being_register },
{ "effect_create", &effect_create },
{ "test_tableget", &test_tableget },
{ "get_map_id", &get_map_id },