aboutsummaryrefslogtreecommitdiff
path: root/src/client
Commit message (Expand)AuthorAge
* Remove remote media compatibility mode. (#8044)sofar2019-01-04
* Proselytize the network. Use IEEE F32 (#8030)SmallJoker2019-01-03
* CSM restrictions: Make 'LOAD_CLIENT_MODS' disable loading of 'builtin' (#8000)Paramat2019-01-03
* Extend pitch fly mode to swimming (#7943)random-geek2018-12-31
* Fix more transparency issues with ogles2 driver (#8005)stujones112018-12-20
* Add command line option to load password from file (#7832)Kevin Abrams2018-12-18
* Add an activeobject manager to hold active objects (#7939)Loïc Blot2018-12-13
* Network: Send IEEE floats (#7768)SmallJoker2018-12-13
* Make showOverlayMessage strings translatable (#7964)Wuzzy2018-12-13
* Add object visual type 'item' (#7870)Alex2018-12-11
* Fix crash if display resolution is not set (#7950)Martin Renold2018-12-08
* Draw all horizons and sky base, in front of stars (#7932)Paramat2018-12-06
* Send only changed node metadata to clients instead of whole mapblock (#5268)SmallJoker2018-12-04
* Raise hotbar limit to 32 slots, add associated keybinding options (#7916)Vanessa Dannenberg2018-12-02
* Draw stars behind the moon (#7928)Paramat2018-12-02
* Slightly alter star appearence time and full brightness time (#7921)Paramat2018-12-02
* Added pitch fly mode (#7817)Gaël C2018-12-01
* Fix sky bugs when using sun or moon textures (#7918)Paramat2018-12-01
* Move client-specific files to 'src/client' (#7902)Quentin Bazin2018-11-28
* Android: Improve UI scaling on smaller high-density displays (#7834)stujones112018-11-18
* Disable HW stereo for IrrLicht 1.9 (not supported anymore)number Zero2018-11-11
* F5 debug info: Use full words for NSEW directions for readability (#7461)Paramat2018-10-06
* Software inventorycube (#7651)Vitaliy2018-09-29
* Particles: Make collision with objects optional (#7682)Paramat2018-09-08
* Some minor Fastface optimizations. (#7628)lhofhansl2018-08-08
* Provide Xorg/net wm process ID (#7445)thoughtjigs2018-06-17
* Add crossview support (#7361)otdav332018-05-29
* Fix GameUI flag value regression introduced by a78659ed0529226ad937f5e241ad72...Loic Blot2018-05-29
* Fix more GCC 8.1 warnings ...Loïc Blot2018-05-28
* Fix last clang-tidy reported problems for performance-type-promotion-in-math-fnLoic Blot2018-04-03
* Client eventmanager refactor (#7179)Loïc Blot2018-03-30
* Sound: fix static initialization order dependency by not having one (#7168)nOOb31672018-03-29
* Make sounds stop playing when entering game or mainmenunOOb31672018-03-24
* Cleanup sound manager class (#7158)Loïc Blot2018-03-24
* Fix some gcc 7.3 reported warningsLoic Blot2018-03-23
* Global initialization of sound using SoundManagerGlobal (#7063)nOOb31672018-03-23
* Update mesh collector and move it to a separate file (#6904)Vitaliy2018-03-22
* Android build fixes for c++11stujones112018-03-11
* Drop texture file list cache (#6660)Vitaliy2018-03-10
* Render copyright notice: Fix name spelling (#7042)Vitaliy2018-02-15
* Node definition manager refactor (#7016)Dániel Juhász2018-02-10
* Switch F3 to use 'enable_fog' settingThomasMonroe3142018-02-08
* Include alpha channel reference in MaterialTypeParamstujones112018-02-08
* Fix issues with earlier CSM HUD commit (#6940)red-0012018-01-26
* Game refactor [4/X]: keycache is now owned by InputHandlerLoic Blot2018-01-20
* Game refactor [3/X]: Move keycache to inputhandlerLoic Blot2018-01-20
* Game/Input refactor [1/X]: make RealInputHandler handle joystick inputs with ...Loic Blot2018-01-20
* [CSM] Add basic HUD manipulation. (#6067)red-0012018-01-20
* Add confirmation on new player registration (#6849)Muhammad Rifqi Priyo Susanto2018-01-13
* Don't recalculate statustext initial color everytime & review fixesLoic Blot2018-01-05
uastack, LUA_REGISTRYINDEX, "scriptapi"); // If we are using LuaJIT add a C++ wrapper function to catch // exceptions thrown in Lua -> C++ calls #if USE_LUAJIT lua_pushlightuserdata(m_luastack, (void*) script_exception_wrapper); luaJIT_setmode(m_luastack, -1, LUAJIT_MODE_WRAPCFUNC | LUAJIT_MODE_ON); lua_pop(m_luastack, 1); #endif m_server = 0; m_environment = 0; m_guiengine = 0; } ScriptApiBase::~ScriptApiBase() { lua_close(m_luastack); } bool ScriptApiBase::loadMod(const std::string &scriptpath, const std::string &modname) { ModNameStorer modnamestorer(getStack(), modname); if(!string_allowed(modname, MODNAME_ALLOWED_CHARS)){ errorstream<<"Error loading mod \""<<modname <<"\": modname does not follow naming conventions: " <<"Only chararacters [a-z0-9_] are allowed."<<std::endl; return false; } bool success = false; try{ success = loadScript(scriptpath); } catch(LuaError &e){ errorstream<<"Error loading mod \""<<modname <<"\": "<<e.what()<<std::endl; } return success; } bool ScriptApiBase::loadScript(const std::string &scriptpath) { verbosestream<<"Loading and running script from "<<scriptpath<<std::endl; lua_State *L = getStack(); lua_pushcfunction(L, script_error_handler); int errorhandler = lua_gettop(L); int ret = luaL_loadfile(L, scriptpath.c_str()) || lua_pcall(L, 0, 0, errorhandler); if(ret){ errorstream<<"========== ERROR FROM LUA ==========="<<std::endl; errorstream<<"Failed to load and run script from "<<std::endl; errorstream<<scriptpath<<":"<<std::endl; errorstream<<std::endl; errorstream<<lua_tostring(L, -1)<<std::endl; errorstream<<std::endl; errorstream<<"======= END OF ERROR FROM LUA ========"<<std::endl; lua_pop(L, 1); // Pop error message from stack lua_pop(L, 1); // Pop the error handler from stack return false; } lua_pop(L, 1); // Pop the error handler from stack return true; } void ScriptApiBase::realityCheck() { int top = lua_gettop(m_luastack); if(top >= 30){ dstream<<"Stack is over 30:"<<std::endl; stackDump(dstream); throw LuaError(m_luastack, "Stack is over 30 (reality check)"); } } void ScriptApiBase::scriptError() { throw LuaError(NULL, lua_tostring(m_luastack, -1)); } void ScriptApiBase::stackDump(std::ostream &o) { int i; int top = lua_gettop(m_luastack); for (i = 1; i <= top; i++) { /* repeat for each level */ int t = lua_type(m_luastack, i); switch (t) { case LUA_TSTRING: /* strings */ o<<"\""<<lua_tostring(m_luastack, i)<<"\""; break; case LUA_TBOOLEAN: /* booleans */ o<<(lua_toboolean(m_luastack, i) ? "true" : "false"); break; case LUA_TNUMBER: /* numbers */ { char buf[10]; snprintf(buf, 10, "%g", lua_tonumber(m_luastack, i)); o<<buf; break; } default: /* other values */ o<<lua_typename(m_luastack, t); break; } o<<" "; } o<<std::endl; } void ScriptApiBase::addObjectReference(ServerActiveObject *cobj) { SCRIPTAPI_PRECHECKHEADER //infostream<<"scriptapi_add_object_reference: id="<<cobj->getId()<<std::endl; // Create object on stack ObjectRef::create(L, cobj); // Puts ObjectRef (as userdata) on stack int object = lua_gettop(L); // Get minetest.object_refs table lua_getglobal(L, "minetest"); lua_getfield(L, -1, "object_refs"); luaL_checktype(L, -1, LUA_TTABLE); int objectstable = lua_gettop(L); // object_refs[id] = object lua_pushnumber(L, cobj->getId()); // Push id lua_pushvalue(L, object); // Copy object to top of stack lua_settable(L, objectstable); } void ScriptApiBase::removeObjectReference(ServerActiveObject *cobj) { SCRIPTAPI_PRECHECKHEADER //infostream<<"scriptapi_rm_object_reference: id="<<cobj->getId()<<std::endl; // Get minetest.object_refs table lua_getglobal(L, "minetest"); lua_getfield(L, -1, "object_refs"); luaL_checktype(L, -1, LUA_TTABLE); int objectstable = lua_gettop(L); // Get object_refs[id] lua_pushnumber(L, cobj->getId()); // Push id lua_gettable(L, objectstable); // Set object reference to NULL ObjectRef::set_null(L); lua_pop(L, 1); // pop object // Set object_refs[id] = nil lua_pushnumber(L, cobj->getId()); // Push id lua_pushnil(L); lua_settable(L, objectstable); } // Creates a new anonymous reference if cobj=NULL or id=0 void ScriptApiBase::objectrefGetOrCreate( ServerActiveObject *cobj) { lua_State *L = getStack(); if(cobj == NULL || cobj->getId() == 0){ ObjectRef::create(L, cobj); } else { objectrefGet(cobj->getId()); } } void ScriptApiBase::objectrefGet(u16 id) { lua_State *L = getStack(); // Get minetest.object_refs[i] lua_getglobal(L, "minetest"); lua_getfield(L, -1, "object_refs"); luaL_checktype(L, -1, LUA_TTABLE); lua_pushnumber(L, id); lua_gettable(L, -2); lua_remove(L, -2); // object_refs lua_remove(L, -2); // minetest }