aboutsummaryrefslogtreecommitdiff
path: root/src/script/lua_api
diff options
context:
space:
mode:
authorraymoo <uguu@installgentoo.com>2016-08-04 13:09:21 -0700
committerNer'zhul <nerzhul@users.noreply.github.com>2016-10-13 17:33:16 +0200
commitc9e7a27eeb628be78a835abadf8afe1177eb90c5 (patch)
tree119a8747a0d33f69f5e14c6a563f3e9df673f923 /src/script/lua_api
parent0b27a70b294590d7fb2bb25bf2d207a719ce8d98 (diff)
downloadminetest-c9e7a27eeb628be78a835abadf8afe1177eb90c5.tar.gz
minetest-c9e7a27eeb628be78a835abadf8afe1177eb90c5.tar.bz2
minetest-c9e7a27eeb628be78a835abadf8afe1177eb90c5.zip
Attached particle spawners
Diffstat (limited to 'src/script/lua_api')
-rw-r--r--src/script/lua_api/l_particles.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/script/lua_api/l_particles.cpp b/src/script/lua_api/l_particles.cpp
index 263e35407..667ac7272 100644
--- a/src/script/lua_api/l_particles.cpp
+++ b/src/script/lua_api/l_particles.cpp
@@ -18,6 +18,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
*/
#include "lua_api/l_particles.h"
+#include "lua_api/l_object.h"
#include "lua_api/l_internal.h"
#include "common/c_converter.h"
#include "server.h"
@@ -138,6 +139,7 @@ int ModApiParticles::l_add_particlespawner(lua_State *L)
time= minexptime= maxexptime= minsize= maxsize= 1;
bool collisiondetection, vertical, collision_removal;
collisiondetection = vertical = collision_removal = false;
+ ServerActiveObject *attached = NULL;
std::string texture = "";
std::string playername = "";
@@ -198,6 +200,14 @@ int ModApiParticles::l_add_particlespawner(lua_State *L)
"collisiondetection", collisiondetection);
collision_removal = getboolfield_default(L, 1,
"collision_removal", collision_removal);
+
+ lua_getfield(L, 1, "attached");
+ if (!lua_isnil(L, -1)) {
+ ObjectRef *ref = ObjectRef::checkobject(L, -1);
+ lua_pop(L, 1);
+ attached = ObjectRef::getobject(ref);
+ }
+
vertical = getboolfield_default(L, 1, "vertical", vertical);
texture = getstringfield_default(L, 1, "texture", "");
playername = getstringfield_default(L, 1, "playername", "");
@@ -211,6 +221,7 @@ int ModApiParticles::l_add_particlespawner(lua_State *L)
minsize, maxsize,
collisiondetection,
collision_removal,
+ attached,
vertical,
texture, playername);
lua_pushnumber(L, id);