aboutsummaryrefslogtreecommitdiff
path: root/src/script/lua_api/l_env.cpp
Commit message (Expand)AuthorAge
* Set placer to nil instead of a non-functional one in item_OnPlace (#6449)DTA72018-06-03
* ServerEnv: Clean up object lifecycle handling (#6414)sfan52018-06-03
* find_nodes_in_area: Extend maximal count to U32_MAX (#5277)SmallJoker2018-06-03
* Clean up numeric.h and split FacePositionCache from itShadowNinja2017-05-06
* Add option to also check the center to `find_node_near` (#5255)red-0012017-05-04
* Rename Scripting API files for consistencyShadowNinja2017-04-25
* Fix various points reported by cppcheck (#5656)Loïc Blot2017-04-25
* Light update for map blocksDániel Juhász2017-04-20
* [CSM] Add core.get_timeofday & core.get_day_count env calls (#5401)Loïc Blot2017-03-17
* Add `get_wielded_item`red-0012017-03-13
* [CSM] Client side moddingLoic Blot2017-03-13
* Add ItemStack key-value meta storagerubenwardy2017-02-04
* Add staticdata parameter to add_entity (#5009)Rui2017-01-09
* Emergeblocks: Fix occasional crashRogier2016-10-16
* Player/LocalPlayer/RemotePlayer inheritance cleanup (part 1 on X)Loic Blot2016-10-08
* Change internal type for seeds to s32kwolekr2016-06-04
* Pathfinder: Fix styleest312016-05-01
* Add consistent monotonic day counter - get_day_count()Auke Kok2016-03-09
* Add minetest.register_lbm() to run code on block load onlyest312016-03-07
* Add '/clearobjects quick'Kahrl2016-02-11
* Add callback parameter for core.emerge_area()kwolekr2015-11-02
* SAPI: Move core.get_us_time() to Util modulekwolekr2015-10-26
* SAPI: Mark all Lua API functions requiring envlockkwolekr2015-10-25
* Add /emergeblocks command and core.emerge_area() Lua APIkwolekr2015-09-23
* Push error handler afresh each time lua_pcall is usedKahrl2015-08-27
* SEnv: Remove static_exists from ActiveObjects in deleted blockskwolekr2015-08-16
* SAPI: Track last executed mod and include in error messageskwolekr2015-08-12
* Improve Script CPP API diagnosticskwolekr2015-08-05
* Add return list of individual counts to find_node_in_areaTeTpaAka2015-06-13
* Add core.find_nodes_with_meta() script APIkwolekr2015-05-05
* Use std::vector instead of std::set for Environment::getObjectsInsideRadiusLoic Blot2015-04-16
* For usages of assert() that are meant to persist in Release builds (when NDEB...Craig Robbins2015-03-07
* Change find_surface_nodes_in_area to find_nodes_in_area_under_airCraig Robbins2015-02-27
* Add find_surface_nodes_in_area LUA call which permit to only get the nodes wh...Loic Blot2015-02-27
* SAO work: ActiveObject types & SAO cleanup * Replace u8 types with ActiveObje...Loic Blot2015-02-17
* Performance Improvement: Use a cache which caches result for getFacePositions.Loic Blot2015-02-16
* Add ability to delete MapBlocks from mapkwolekr2015-01-15
* LuaVoxelManip: Remove blank allocatorkwolekr2014-12-29
* LuaVoxelManip: Add option to allocate blank datakwolekr2014-12-27
* Add support for NoiseParams in minetest.get_perlin() and add docs on NoisePar...kwolekr2014-12-12
* Add flags and lacunarity as new noise parameterskwolekr2014-12-07
* Remove most exceptions from getNode() (and variants)Craig Robbins2014-11-14
* Fix object reference pushing functions when called from coroutinesShadowNinja2014-10-07
* Add LuaVoxelManip methods: get_node_at() and set_node_at()kwolekr2014-09-01
* Fix seg fault if popping from empty stack (L-system trees)Craig Robbins2014-08-23
* Mod profiling supportsapier2014-08-19
* Use "core" namespace internallyShadowNinja2014-05-08
* Remove liquid_finite and weatherproller2014-04-18
* Pass pointed_thing to on_punch and minetest.register_on_punchnode callbacksShadowNinja2014-01-23
* Add forceloadingNovatux2014-01-11
="hl opt">(L, 4); size = luaL_checknumber(L, 5); collisiondetection = lua_toboolean(L, 6); texture = luaL_checkstring(L, 7); if (lua_gettop(L) == 8) // only spawn for a single player playername = luaL_checkstring(L, 8); } else if (lua_istable(L, 1)) { lua_getfield(L, 1, "pos"); pos = lua_istable(L, -1) ? check_v3f(L, -1) : v3f(); lua_pop(L, 1); lua_getfield(L, 1, "vel"); if (lua_istable(L, -1)) { vel = check_v3f(L, -1); log_deprecated(L, "The use of vel is deprecated. " "Use velocity instead"); } lua_pop(L, 1); lua_getfield(L, 1, "velocity"); vel = lua_istable(L, -1) ? check_v3f(L, -1) : vel; lua_pop(L, 1); lua_getfield(L, 1, "acc"); if (lua_istable(L, -1)) { acc = check_v3f(L, -1); log_deprecated(L, "The use of acc is deprecated. " "Use acceleration instead"); } lua_pop(L, 1); lua_getfield(L, 1, "acceleration"); acc = lua_istable(L, -1) ? check_v3f(L, -1) : acc; lua_pop(L, 1); expirationtime = getfloatfield_default(L, 1, "expirationtime", 1); size = getfloatfield_default(L, 1, "size", 1); collisiondetection = getboolfield_default(L, 1, "collisiondetection", collisiondetection); collision_removal = getboolfield_default(L, 1, "collision_removal", collision_removal); vertical = getboolfield_default(L, 1, "vertical", vertical); lua_getfield(L, 1, "animation"); animation = read_animation_definition(L, -1); lua_pop(L, 1); texture = getstringfield_default(L, 1, "texture", ""); playername = getstringfield_default(L, 1, "playername", ""); glow = getintfield_default(L, 1, "glow", 0); } getServer(L)->spawnParticle(playername, pos, vel, acc, expirationtime, size, collisiondetection, collision_removal, vertical, texture, animation, glow); return 1; } // add_particlespawner({amount=, time=, // minpos=, maxpos=, // minvel=, maxvel=, // minacc=, maxacc=, // minexptime=, maxexptime=, // minsize=, maxsize=, // collisiondetection=, // collision_removal=, // vertical=, // texture=, // player=}) // minpos/maxpos/minvel/maxvel/minacc/maxacc = {x=num, y=num, z=num} // minexptime/maxexptime = num (seconds) // minsize/maxsize = num // collisiondetection = bool // collision_removal = bool // vertical = bool // texture = e.g."default_wood.png" // animation = TileAnimation definition // glow = num int ModApiParticles::l_add_particlespawner(lua_State *L) { MAP_LOCK_REQUIRED; // 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; struct TileAnimationParams animation; animation.type = TAT_NONE; ServerActiveObject *attached = NULL; std::string texture = ""; std::string playername = ""; u8 glow = 0; if (lua_gettop(L) > 1) //deprecated { log_deprecated(L,"Deprecated add_particlespawner call with individual parameters instead of definition"); amount = luaL_checknumber(L, 1); time = luaL_checknumber(L, 2); minpos = check_v3f(L, 3); maxpos = check_v3f(L, 4); minvel = check_v3f(L, 5); maxvel = check_v3f(L, 6); minacc = check_v3f(L, 7); maxacc = check_v3f(L, 8); minexptime = luaL_checknumber(L, 9); maxexptime = luaL_checknumber(L, 10); minsize = luaL_checknumber(L, 11); maxsize = luaL_checknumber(L, 12); collisiondetection = lua_toboolean(L, 13); texture = luaL_checkstring(L, 14); if (lua_gettop(L) == 15) // only spawn for a single player playername = luaL_checkstring(L, 15); } else if (lua_istable(L, 1)) { amount = getintfield_default(L, 1, "amount", amount); time = getfloatfield_default(L, 1, "time", time); lua_getfield(L, 1, "minpos"); minpos = lua_istable(L, -1) ? check_v3f(L, -1) : minpos; lua_pop(L, 1); lua_getfield(L, 1, "maxpos"); maxpos = lua_istable(L, -1) ? check_v3f(L, -1) : maxpos; lua_pop(L, 1); lua_getfield(L, 1, "minvel"); minvel = lua_istable(L, -1) ? check_v3f(L, -1) : minvel; lua_pop(L, 1); lua_getfield(L, 1, "maxvel"); maxvel = lua_istable(L, -1) ? check_v3f(L, -1) : maxvel; lua_pop(L, 1); lua_getfield(L, 1, "minacc"); minacc = lua_istable(L, -1) ? check_v3f(L, -1) : minacc; lua_pop(L, 1); lua_getfield(L, 1, "maxacc"); maxacc = lua_istable(L, -1) ? check_v3f(L, -1) : maxacc; lua_pop(L, 1); minexptime = getfloatfield_default(L, 1, "minexptime", minexptime); maxexptime = getfloatfield_default(L, 1, "maxexptime", maxexptime); minsize = getfloatfield_default(L, 1, "minsize", minsize); maxsize = getfloatfield_default(L, 1, "maxsize", maxsize); collisiondetection = getboolfield_default(L, 1, "collisiondetection", collisiondetection); collision_removal = getboolfield_default(L, 1, "collision_removal", collision_removal); lua_getfield(L, 1, "animation"); animation = read_animation_definition(L, -1); lua_pop(L, 1); 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", ""); glow = getintfield_default(L, 1, "glow", 0); } u32 id = getServer(L)->addParticleSpawner(amount, time, minpos, maxpos, minvel, maxvel, minacc, maxacc, minexptime, maxexptime, minsize, maxsize, collisiondetection, collision_removal, attached, vertical, texture, playername, animation, glow); lua_pushnumber(L, id); return 1; } // delete_particlespawner(id, player) // player (string) is optional int ModApiParticles::l_delete_particlespawner(lua_State *L) { MAP_LOCK_REQUIRED; // Get parameters u32 id = luaL_checknumber(L, 1); std::string playername = ""; if (lua_gettop(L) == 2) { playername = luaL_checkstring(L, 2); } getServer(L)->deleteParticleSpawner(playername, id); return 1; } void ModApiParticles::Initialize(lua_State *L, int top) { API_FCT(add_particle); API_FCT(add_particlespawner); API_FCT(delete_particlespawner); }