X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=src%2Fscript%2Flua_api%2Fl_particles.cpp;h=340903ebf69b69d26f0d0213d4be497858a6b829;hb=aa8df112ff42d94b6dc59a0153d989bd8c0b115e;hp=7f415844a4b9ac99e4ebe12d0f14aaa2841295a4;hpb=7279f0b37335396c85f6bdd7dc67ff56e53df0f9;p=dragonfireclient.git diff --git a/src/script/lua_api/l_particles.cpp b/src/script/lua_api/l_particles.cpp index 7f415844a..340903ebf 100644 --- a/src/script/lua_api/l_particles.cpp +++ b/src/script/lua_api/l_particles.cpp @@ -23,16 +23,17 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "common/c_converter.h" #include "common/c_content.h" #include "server.h" -#include "particles.h" +#include "client/particles.h" // add_particle({pos=, velocity=, acceleration=, expirationtime=, -// size=, collisiondetection=, collision_removal=, vertical=, -// texture=, player=}) +// size=, collisiondetection=, collision_removal=, object_collision=, +// vertical=, texture=, player=}) // pos/velocity/acceleration = {x=num, y=num, z=num} // expirationtime = num (seconds) // size = num // collisiondetection = bool // collision_removal = bool +// object_collision = bool // vertical = bool // texture = e.g."default_wood.png" // animation = TileAnimation definition @@ -43,18 +44,14 @@ int ModApiParticles::l_add_particle(lua_State *L) // Get parameters v3f pos, vel, acc; - pos = vel = acc = v3f(0, 0, 0); - float expirationtime, size; expirationtime = size = 1; - - bool collisiondetection, vertical, collision_removal; - collisiondetection = vertical = collision_removal = false; + bool collisiondetection, vertical, collision_removal, object_collision; + collisiondetection = vertical = collision_removal = object_collision = false; struct TileAnimationParams animation; - - std::string texture = ""; - std::string playername = ""; - + animation.type = TAT_NONE; + std::string texture; + std::string playername; u8 glow = 0; if (lua_gettop(L) > 1) // deprecated @@ -65,7 +62,7 @@ int ModApiParticles::l_add_particle(lua_State *L) acc = check_v3f(L, 3); expirationtime = luaL_checknumber(L, 4); size = luaL_checknumber(L, 5); - collisiondetection = lua_toboolean(L, 6); + collisiondetection = readParam(L, 6); texture = luaL_checkstring(L, 7); if (lua_gettop(L) == 8) // only spawn for a single player playername = luaL_checkstring(L, 8); @@ -106,6 +103,8 @@ int ModApiParticles::l_add_particle(lua_State *L) "collisiondetection", collisiondetection); collision_removal = getboolfield_default(L, 1, "collision_removal", collision_removal); + object_collision = getboolfield_default(L, 1, + "object_collision", object_collision); vertical = getboolfield_default(L, 1, "vertical", vertical); lua_getfield(L, 1, "animation"); @@ -118,7 +117,8 @@ int ModApiParticles::l_add_particle(lua_State *L) glow = getintfield_default(L, 1, "glow", 0); } getServer(L)->spawnParticle(playername, pos, vel, acc, expirationtime, size, - collisiondetection, collision_removal, vertical, texture, animation, glow); + collisiondetection, collision_removal, object_collision, vertical, + texture, animation, glow); return 1; } @@ -130,6 +130,7 @@ int ModApiParticles::l_add_particle(lua_State *L) // minsize=, maxsize=, // collisiondetection=, // collision_removal=, +// object_collision=, // vertical=, // texture=, // player=}) @@ -138,6 +139,7 @@ int ModApiParticles::l_add_particle(lua_State *L) // minsize/maxsize = num // collisiondetection = bool // collision_removal = bool +// object_collision = bool // vertical = bool // texture = e.g."default_wood.png" // animation = TileAnimation definition @@ -149,15 +151,15 @@ int ModApiParticles::l_add_particlespawner(lua_State *L) // Get parameters u16 amount = 1; v3f minpos, maxpos, minvel, maxvel, minacc, maxacc; - minpos= maxpos= minvel= maxvel= minacc= maxacc= v3f(0, 0, 0); float time, minexptime, maxexptime, minsize, maxsize; - time= minexptime= maxexptime= minsize= maxsize= 1; - bool collisiondetection, vertical, collision_removal; - collisiondetection = vertical = collision_removal = false; + time = minexptime = maxexptime = minsize = maxsize = 1; + bool collisiondetection, vertical, collision_removal, object_collision; + collisiondetection = vertical = collision_removal = object_collision = false; struct TileAnimationParams animation; + animation.type = TAT_NONE; ServerActiveObject *attached = NULL; - std::string texture = ""; - std::string playername = ""; + std::string texture; + std::string playername; u8 glow = 0; if (lua_gettop(L) > 1) //deprecated @@ -175,7 +177,7 @@ int ModApiParticles::l_add_particlespawner(lua_State *L) maxexptime = luaL_checknumber(L, 10); minsize = luaL_checknumber(L, 11); maxsize = luaL_checknumber(L, 12); - collisiondetection = lua_toboolean(L, 13); + collisiondetection = readParam(L, 13); texture = luaL_checkstring(L, 14); if (lua_gettop(L) == 15) // only spawn for a single player playername = luaL_checkstring(L, 15); @@ -217,6 +219,8 @@ int ModApiParticles::l_add_particlespawner(lua_State *L) "collisiondetection", collisiondetection); collision_removal = getboolfield_default(L, 1, "collision_removal", collision_removal); + object_collision = getboolfield_default(L, 1, + "object_collision", object_collision); lua_getfield(L, 1, "animation"); animation = read_animation_definition(L, -1); @@ -243,6 +247,7 @@ int ModApiParticles::l_add_particlespawner(lua_State *L) minsize, maxsize, collisiondetection, collision_removal, + object_collision, attached, vertical, texture, playername, @@ -260,7 +265,7 @@ int ModApiParticles::l_delete_particlespawner(lua_State *L) // Get parameters u32 id = luaL_checknumber(L, 1); - std::string playername = ""; + std::string playername; if (lua_gettop(L) == 2) { playername = luaL_checkstring(L, 2); }