From fb2b268a2616617800b92330e09278042e50e7d7 Mon Sep 17 00:00:00 2001 From: Philipp Sehmisch Date: Mon, 27 Oct 2008 16:53:13 +0000 Subject: Script binding for spawning effets from scripts. --- src/scripting/lua.cpp | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'src/scripting/lua.cpp') diff --git a/src/scripting/lua.cpp b/src/scripting/lua.cpp index 7f421c67..c0c7a95c 100644 --- a/src/scripting/lua.cpp +++ b/src/scripting/lua.cpp @@ -33,6 +33,7 @@ extern "C" { #include "game-server/buysell.hpp" #include "game-server/character.hpp" #include "game-server/collisiondetection.hpp" +#include "game-server/effect.hpp" #include "game-server/gamehandler.hpp" #include "game-server/inventory.hpp" #include "game-server/item.hpp" @@ -874,6 +875,34 @@ static int LuaNoteOnDeath(lua_State *s) return 0; } +/** + * Triggers a special effect from the clients effects.xml + * tmw.effect_create (id, x, y) + */ +static int LuaEffect_Create(lua_State *s) +{ + if (!lua_isnumber(s, 1) || + !lua_isnumber(s, 2) || + !lua_isnumber(s, 3)) + { + raiseScriptError(s, "effect_create called with incorrect parameters."); + return 0; + } + lua_pushlightuserdata(s, (void *)®istryKey); + lua_gettable(s, LUA_REGISTRYINDEX); + Script *t = static_cast