aboutsummaryrefslogtreecommitdiff
path: root/src/script/lua_api
diff options
context:
space:
mode:
Diffstat (limited to 'src/script/lua_api')
-rw-r--r--src/script/lua_api/l_particles.cpp58
1 files changed, 18 insertions, 40 deletions
diff --git a/src/script/lua_api/l_particles.cpp b/src/script/lua_api/l_particles.cpp
index d99d8f6a9..2532b2b08 100644
--- a/src/script/lua_api/l_particles.cpp
+++ b/src/script/lua_api/l_particles.cpp
@@ -96,14 +96,8 @@ int ModApiParticles::l_add_particle(lua_State *L)
texture = getstringfield_default(L, 1, "texture", "");
playername = getstringfield_default(L, 1, "playername", "");
}
- if (playername == "") { // spawn for all players
- getServer(L)->spawnParticleAll(pos, vel, acc,
+ getServer(L)->spawnParticle(playername, pos, vel, acc,
expirationtime, size, collisiondetection, vertical, texture);
- } else {
- getServer(L)->spawnParticle(playername.c_str(),
- pos, vel, acc, expirationtime,
- size, collisiondetection, vertical, texture);
- }
return 1;
}
@@ -195,30 +189,18 @@ int ModApiParticles::l_add_particlespawner(lua_State *L)
texture = getstringfield_default(L, 1, "texture", "");
playername = getstringfield_default(L, 1, "playername", "");
}
- if (playername == "") { //spawn for all players
- u32 id = getServer(L)->addParticleSpawnerAll( amount, time,
- minpos, maxpos,
- minvel, maxvel,
- minacc, maxacc,
- minexptime, maxexptime,
- minsize, maxsize,
- collisiondetection,
- vertical,
- texture);
- lua_pushnumber(L, id);
- } else {
- u32 id = getServer(L)->addParticleSpawner(playername.c_str(),
- amount, time,
- minpos, maxpos,
- minvel, maxvel,
- minacc, maxacc,
- minexptime, maxexptime,
- minsize, maxsize,
- collisiondetection,
- vertical,
- texture);
- lua_pushnumber(L, id);
- }
+
+ u32 id = getServer(L)->addParticleSpawner(amount, time,
+ minpos, maxpos,
+ minvel, maxvel,
+ minacc, maxacc,
+ minexptime, maxexptime,
+ minsize, maxsize,
+ collisiondetection,
+ vertical,
+ texture, playername);
+ lua_pushnumber(L, id);
+
return 1;
}
@@ -228,16 +210,12 @@ int ModApiParticles::l_delete_particlespawner(lua_State *L)
{
// Get parameters
u32 id = luaL_checknumber(L, 1);
-
- if (lua_gettop(L) == 2) // only delete for one player
- {
- const char *playername = luaL_checkstring(L, 2);
- getServer(L)->deleteParticleSpawner(playername, id);
- }
- else // delete for all players
- {
- getServer(L)->deleteParticleSpawnerAll(id);
+ std::string playername = "";
+ if (lua_gettop(L) == 2) {
+ playername = luaL_checkstring(L, 2);
}
+
+ getServer(L)->deleteParticleSpawner(playername, id);
return 1;
}