aboutsummaryrefslogtreecommitdiff
path: root/src/script/lua_api
Commit message (Expand)AuthorAge
...
* Implement AreaStore serializationShadowNinja2016-03-07
* Move AreaStore container selection logic into getOptimalImplementationShadowNinja2016-03-07
* Move AreaStore to utilShadowNinja2016-03-07
* Simplify AreaStore ID managementShadowNinja2016-03-07
* Add minetest.register_lbm() to run code on block load onlyest312016-03-07
* Use LuaErrors in security check macrosShadowNinja2016-03-07
* Require minetest.request_http_api to be called from the mod's main scopeJeija2016-03-03
* Fix main menu being unable to set secure settingsShadowNinja2016-03-03
* Fix minetest.request_insecure_environment() always returning nilJeija2016-02-26
* Add Lua interface to HTTPFetchRequestJeija2016-02-22
* Ignore spaces in secure.trusted_mods settingJeija2016-02-19
* Require request_insecure_environment to be called from the mod's main scopeShadowNinja2016-02-19
* v2d & aabbox3d<f32> & sky cleanupsnerzhul2016-02-11
* Add '/clearobjects quick'Kahrl2016-02-11
* Don't print whole json data buffer to errorstream on errorest312016-01-28
* Make ItemStack:set_count(0) clear the item stacksfan52016-01-15
* Add option to give every object a nametagBlockMen2015-12-15
* Fix threshold typeest312015-12-07
* Mapgen: Add propagate_shadow bool to calcLightingparamat2015-12-07
* Fix spelling of noise_thresholdJun Zhang2015-12-06
* Add LuaSecureRandomest312015-11-08
* Add server side ncurses terminalest312015-11-06
* Schematics: Add core.place_schematic_on_vmanip APIkwolekr2015-11-05
* Add callback parameter for core.emerge_area()kwolekr2015-11-02
* SAPI: Fix seed parameter truncation for LuaPseudoRandom constructorkwolekr2015-10-26
* SAPI: Move core.get_us_time() to Util modulekwolekr2015-10-26
* SAPI: Throw runtime error instead of if l_get_mapgen_object called in incorre...kwolekr2015-10-25
* SAPI: Mark all Lua API functions requiring envlockkwolekr2015-10-25
* Correct comment in l_util.cppest312015-10-26
* ABMs: Make catch-up behaviour optionalparamat2015-10-18
* Remove wstrgettextest312015-10-18
* Rename macros with two leading underscoresShadowNinja2015-10-14
* Refactor loggingShadowNinja2015-10-14
* Allow setting chunksize in core.set_mapgen_paramskwolekr2015-10-04
* Hide mapgens from main menu not intended for end userskwolekr2015-10-04
* Add emerge completion callback mechanismkwolekr2015-10-04
* Define and use limit constants for Irrlicht fixed-width typeskwolekr2015-10-04
* Add get_biome_id(biome_name) callbackDuane Robertson2015-10-02
* Add /emergeblocks command and core.emerge_area() Lua APIkwolekr2015-09-23
* Various style cleanups + unused code removalest312015-09-19
* Ore: Add puff ore typekwolekr2015-09-17
* Ore: Add ore sheet column height range selectionkwolekr2015-09-13
* Areastore: fix "attempt to index a number value"est312015-09-03
* l_mainmenu.h: remove unused l_get_dirlist functionest312015-08-30
* Push error handler afresh each time lua_pcall is usedKahrl2015-08-27
* Use numeric indices and raw table access with LUA_REGISTRYINDEXKahrl2015-08-27
* SAPI: Disable unlockable time profilingkwolekr2015-08-18
* SEnv: Remove static_exists from ActiveObjects in deleted blockskwolekr2015-08-16
* minimap: Add ability to disable from serverkwolekr2015-08-13
* SAPI: Track last executed mod and include in error messageskwolekr2015-08-12
>getCameraMode() > CAMERA_MODE_FIRST); playercao->setChildrenVisible(camera->getCameraMode() > CAMERA_MODE_FIRST); return 0; } int LuaCamera::l_get_camera_mode(lua_State *L) { Camera *camera = getobject(L, 1); if (!camera) return 0; lua_pushnumber(L, (int)camera->getCameraMode()); return 1; } int LuaCamera::l_get_fov(lua_State *L) { Camera *camera = getobject(L, 1); if (!camera) return 0; lua_newtable(L); lua_pushnumber(L, camera->getFovX() * core::DEGTORAD); lua_setfield(L, -2, "x"); lua_pushnumber(L, camera->getFovY() * core::DEGTORAD); lua_setfield(L, -2, "y"); lua_pushnumber(L, camera->getCameraNode()->getFOV() * core::RADTODEG); lua_setfield(L, -2, "actual"); lua_pushnumber(L, camera->getFovMax() * core::RADTODEG); lua_setfield(L, -2, "max"); return 1; } int LuaCamera::l_get_pos(lua_State *L) { Camera *camera = getobject(L, 1); if (!camera) return 0; push_v3f(L, camera->getPosition()); return 1; } int LuaCamera::l_get_offset(lua_State *L) { Camera *camera = getobject(L, 1); if (!camera) return 0; push_v3s16(L, camera->getOffset()); return 1; } int LuaCamera::l_get_look_dir(lua_State *L) { LocalPlayer *player = getClient(L)->getEnv().getLocalPlayer(); sanity_check(player); float pitch = -1.0 * player->getPitch() * core::DEGTORAD; float yaw = (player->getYaw() + 90.) * core::DEGTORAD; v3f v(std::cos(pitch) * std::cos(yaw), std::sin(pitch), std::cos(pitch) * std::sin(yaw)); push_v3f(L, v); return 1; } int LuaCamera::l_get_look_horizontal(lua_State *L) { LocalPlayer *player = getClient(L)->getEnv().getLocalPlayer(); sanity_check(player); lua_pushnumber(L, (player->getYaw() + 90.) * core::DEGTORAD); return 1; } int LuaCamera::l_get_look_vertical(lua_State *L) { LocalPlayer *player = getClient(L)->getEnv().getLocalPlayer(); sanity_check(player); lua_pushnumber(L, -1.0 * player->getPitch() * core::DEGTORAD); return 1; } int LuaCamera::l_get_aspect_ratio(lua_State *L) { Camera *camera = getobject(L, 1); if (!camera) return 0; lua_pushnumber(L, camera->getCameraNode()->getAspectRatio()); return 1; } LuaCamera *LuaCamera::checkobject(lua_State *L, int narg) { luaL_checktype(L, narg, LUA_TUSERDATA); void *ud = luaL_checkudata(L, narg, className); if (!ud) luaL_typerror(L, narg, className); return *(LuaCamera **)ud; } Camera *LuaCamera::getobject(LuaCamera *ref) { return ref->m_camera; } Camera *LuaCamera::getobject(lua_State *L, int narg) { LuaCamera *ref = checkobject(L, narg); assert(ref); Camera *camera = getobject(ref); if (!camera) return NULL; return camera; } int LuaCamera::gc_object(lua_State *L) { LuaCamera *o = *(LuaCamera **)(lua_touserdata(L, 1)); delete o; return 0; } void LuaCamera::Register(lua_State *L) { lua_newtable(L); int methodtable = lua_gettop(L); luaL_newmetatable(L, className); int metatable = lua_gettop(L); lua_pushliteral(L, "__metatable"); lua_pushvalue(L, methodtable); lua_settable(L, metatable); lua_pushliteral(L, "__index"); lua_pushvalue(L, methodtable); lua_settable(L, metatable); lua_pushliteral(L, "__gc"); lua_pushcfunction(L, gc_object); lua_settable(L, metatable); lua_pop(L, 1); luaL_openlib(L, 0, methods, 0); lua_pop(L, 1); } const char LuaCamera::className[] = "Camera"; const luaL_Reg LuaCamera::methods[] = {luamethod(LuaCamera, set_camera_mode), luamethod(LuaCamera, get_camera_mode), luamethod(LuaCamera, get_fov), luamethod(LuaCamera, get_pos), luamethod(LuaCamera, get_offset), luamethod(LuaCamera, get_look_dir), luamethod(LuaCamera, get_look_vertical), luamethod(LuaCamera, get_look_horizontal), luamethod(LuaCamera, get_aspect_ratio), {0, 0}};