aboutsummaryrefslogtreecommitdiff
path: root/src/script/lua_api/l_vmanip.cpp
Commit message (Expand)AuthorAge
* LuaVoxelManip: Throw warning or error instead of silently doing nothing (#7567)HybridDog2018-08-02
* Modernize lua read (part 2 & 3): C++ templating assurance (#7410)Loïc Blot2018-06-30
* Node definition manager refactor (#7016)Dániel Juhász2018-02-10
* Move files to subdirectories (#6599)Vitaliy2017-11-08
* Code modernization: subfolders (#6283)Loïc Blot2017-08-19
* Optimize headers (part 2) (#6272)Loïc Blot2017-08-18
* Fix 2 warnings reported by GCCLoic Blot2017-06-20
* C++11 cleanup on constructors (#6000)Vincent Glize2017-06-19
* Light update for map blocksDániel Juhász2017-04-20
* Replace luaL_reg with luaL_Reg as recent LuaJIT dropped the Lua 5.0 compat (#...Loïc Blot2017-04-08
* Light calculation: New bulk node lighting codeDániel Juhász2017-03-11
* Lua voxelmanip: Add optional buffer param for 'get param2 data'paramat2016-10-31
* Add MapSettingsManager and new mapgen setting script API functionskwolekr2016-07-03
* Mapgen: Add propagate_shadow bool to calcLightingparamat2015-12-07
* SAPI: Mark all Lua API functions requiring envlockkwolekr2015-10-25
* Add optional buffer param for bulk data array writes in Luakwolekr2015-05-17
* Switch to check_v3s16 in l_mapgen.cpp and l_vmanip.cpp for type safetykwolekr2015-04-17
* Shorten ManualMapVoxelManipulator to MMVManipkwolekr2015-01-05
* Optionally specify propagateSunlight area in calcLightingkwolekr2015-01-05
* Exclude vertical mapblock borders when setting lightkwolekr2015-01-04
* LuaVoxelManip: Error when given out-of-bounds areakwolekr2015-01-04
* Lighting: Fix nearly all issueskwolekr2015-01-04
* LuaVoxelManip: Remove blank allocatorkwolekr2014-12-29
* LuaVoxelManip: Add option to allocate blank datakwolekr2014-12-27
* Add LuaVoxelManip methods: get_node_at() and set_node_at()kwolekr2014-09-01
* Update Mapgen VoxelManipulator on buffer invalidationkwolekr2014-09-01
* Fix issue 1527Craig Robbins2014-07-29
* Huge overhaul of the entire MapgenParams systemkwolekr2014-02-03
* LuaVoxelManip: Add get_param2_data and set_param2_datakwolekr2014-01-19
* LuaVoxelManip: Add area parameters back to calc_lighting and set_lighting, ma...kwolekr2013-11-30
* LuaVoxelManip: Add get_light_data() and set_light_data()kwolekr2013-11-30
* LuaVoxelManip: Update parameter index of set_lighting()kwolekr2013-11-21
* Omnicleanup: header cleanup, add ModApiUtil shared between game and mainmenuKahrl2013-08-14
* LuaVoxelManip: Allow liquid updates in non-mapgen VoxelManip objectskwolekr2013-07-06
* LuaVoxelManip: Fix minor bug with set_lighting, remove coordinate params for ...kwolekr2013-06-29
* Apply various fixes to several thingskwolekr2013-06-27
* LuaVoxelManip: Separate VoxelManip data get/set from emerging/blitting data b...kwolekr2013-06-27
* Add minetest.get_mapgen_object to APIkwolekr2013-06-27
* Add LuaVoxelManipkwolekr2013-06-27
class="hl num">0); lua_pop(L, 1); lua_getfield(L, 1, "acceleration"); acc = lua_istable(L, -1) ? check_v3f(L, -1) : v3f(0, 0, 0); lua_pop(L, 1); expirationtime = getfloatfield_default(L, 1, "expirationtime", 1); size = getfloatfield_default(L, 1, "size", 1); collisiondetection = getboolfield_default(L, 1, "collisiondetection", false); collision_removal = getboolfield_default(L, 1, "collision_removal", false); vertical = getboolfield_default(L, 1, "vertical", false); lua_getfield(L, 1, "animation"); animation = read_animation_definition(L, -1); lua_pop(L, 1); texture = getstringfield_default(L, 1, "texture", ""); glow = getintfield_default(L, 1, "glow", 0); ClientEvent *event = new ClientEvent(); event->type = CE_SPAWN_PARTICLE; event->spawn_particle.pos = new v3f (pos); event->spawn_particle.vel = new v3f (vel); event->spawn_particle.acc = new v3f (acc); event->spawn_particle.expirationtime = expirationtime; event->spawn_particle.size = size; event->spawn_particle.collisiondetection = collisiondetection; event->spawn_particle.collision_removal = collision_removal; event->spawn_particle.vertical = vertical; event->spawn_particle.texture = new std::string(texture); event->spawn_particle.animation = animation; event->spawn_particle.glow = glow; getClient(L)->pushToEventQueue(event); return 0; } int ModApiParticlesLocal::l_add_particlespawner(lua_State *L) { luaL_checktype(L, 1, LUA_TTABLE); // Get parameters u16 amount; v3f minpos, maxpos, minvel, maxvel, minacc, maxacc; float time, minexptime, maxexptime, minsize, maxsize; bool collisiondetection, vertical, collision_removal; struct TileAnimationParams animation; animation.type = TAT_NONE; // TODO: Implement this when there is a way to get an objectref. // ServerActiveObject *attached = NULL; std::string texture; u8 glow; amount = getintfield_default(L, 1, "amount", 1); time = getfloatfield_default(L, 1, "time", 1); lua_getfield(L, 1, "minpos"); minpos = lua_istable(L, -1) ? check_v3f(L, -1) : v3f(0, 0, 0); lua_pop(L, 1); lua_getfield(L, 1, "maxpos"); maxpos = lua_istable(L, -1) ? check_v3f(L, -1) : v3f(0, 0, 0); lua_pop(L, 1); lua_getfield(L, 1, "minvel"); minvel = lua_istable(L, -1) ? check_v3f(L, -1) : v3f(0, 0, 0); lua_pop(L, 1); lua_getfield(L, 1, "maxvel"); maxvel = lua_istable(L, -1) ? check_v3f(L, -1) : v3f(0, 0, 0); lua_pop(L, 1); lua_getfield(L, 1, "minacc"); minacc = lua_istable(L, -1) ? check_v3f(L, -1) : v3f(0, 0, 0); lua_pop(L, 1); lua_getfield(L, 1, "maxacc"); maxacc = lua_istable(L, -1) ? check_v3f(L, -1) : v3f(0, 0, 0); lua_pop(L, 1); minexptime = getfloatfield_default(L, 1, "minexptime", 1); maxexptime = getfloatfield_default(L, 1, "maxexptime", 1); minsize = getfloatfield_default(L, 1, "minsize", 1); maxsize = getfloatfield_default(L, 1, "maxsize", 1); collisiondetection = getboolfield_default(L, 1, "collisiondetection", false); collision_removal = getboolfield_default(L, 1, "collision_removal", false); vertical = getboolfield_default(L, 1, "vertical", false); lua_getfield(L, 1, "animation"); animation = read_animation_definition(L, -1); lua_pop(L, 1); // TODO: Implement this when a way to get an objectref on the client is added // lua_getfield(L, 1, "attached"); // if (!lua_isnil(L, -1)) { // ObjectRef *ref = ObjectRef::checkobject(L, -1); // lua_pop(L, 1); // attached = ObjectRef::getobject(ref); // } texture = getstringfield_default(L, 1, "texture", ""); glow = getintfield_default(L, 1, "glow", 0); u32 id = getClient(L)->getParticleManager()->getSpawnerId(); ClientEvent *event = new ClientEvent(); event->type = CE_ADD_PARTICLESPAWNER; event->add_particlespawner.amount = amount; event->add_particlespawner.spawntime = time; event->add_particlespawner.minpos = new v3f (minpos); event->add_particlespawner.maxpos = new v3f (maxpos); event->add_particlespawner.minvel = new v3f (minvel); event->add_particlespawner.maxvel = new v3f (maxvel); event->add_particlespawner.minacc = new v3f (minacc); event->add_particlespawner.maxacc = new v3f (maxacc); event->add_particlespawner.minexptime = minexptime; event->add_particlespawner.maxexptime = maxexptime; event->add_particlespawner.minsize = minsize; event->add_particlespawner.maxsize = maxsize; event->add_particlespawner.collisiondetection = collisiondetection; event->add_particlespawner.collision_removal = collision_removal; event->add_particlespawner.attached_id = 0; event->add_particlespawner.vertical = vertical; event->add_particlespawner.texture = new std::string(texture); event->add_particlespawner.id = id; event->add_particlespawner.animation = animation; event->add_particlespawner.glow = glow; getClient(L)->pushToEventQueue(event); lua_pushnumber(L, id); return 1; } int ModApiParticlesLocal::l_delete_particlespawner(lua_State *L) { // Get parameters u32 id = luaL_checknumber(L, 1); ClientEvent *event = new ClientEvent(); event->type = CE_DELETE_PARTICLESPAWNER; event->delete_particlespawner.id = id; getClient(L)->pushToEventQueue(event); return 0; } void ModApiParticlesLocal::Initialize(lua_State *L, int top) { API_FCT(add_particle); API_FCT(add_particlespawner); API_FCT(delete_particlespawner); }