aboutsummaryrefslogtreecommitdiff
path: root/src
Commit message (Expand)AuthorAge
* Disable autoforward if player is deadANAND2019-08-20
* Restore intended functionality to minimap markers (#8819)theviper1212019-08-19
* ClientInterface: Use recursive mutex to prevent freeze in on_newplayer() (#8808)SmallJoker2019-08-17
* Remove unused function in ReliablePacketBuffersfan52019-08-16
* Minor refactor of IncomingSplitBuffersfan52019-08-16
* Drop m_list_size from ReliablePacketBuffersfan52019-08-16
* Mapgen v6: Fix mudflow iteration and iterate twice (#8795)Paramat2019-08-15
* network: Stricter handling of split packetssfan52019-08-15
* network: Fix crash in ReliablePacketBuffer on mismatching packetssfan52019-08-15
* Add function `minetest.read_schematic`upsilon2019-08-14
* Fix unnecessary exception use in 3 more methods (#8791)Jozef Behran2019-08-13
* Fix unnecessary exception use in Map::getSectorXXX (#8792)Jozef Behran2019-08-13
* Better F6 profiler (#8750)SmallJoker2019-08-13
* Fix unnecessary exception use in Map::isNodeUndergroundJozef Behran2019-08-13
* Fix compare between pointer and 0 in unittestsJozef Behran2019-08-13
* Clear old item groups when they are overridden. (#8753)Beha2019-08-12
* Add support for set_formspec_prepend in main menu (#8611)rubenwardy2019-08-12
* Handle multiple deserialization of a block's entitiesRogier2019-08-12
* Fix breakage of non-GLES2 setups (#8774)Jozef Behran2019-08-10
* Fix some issues with minetest.clear_craft (#8712)Paul Ouellette2019-08-10
* Merge pull request #8776 from osjc/FixGetNodeJozef Behran2019-08-10
* Implement adding velocity to player from Luasfan52019-08-10
* Allow customizing chat message format (#8529)ANAND2019-08-08
* guiVolumeChange: Fix child not being removedANAND2019-08-08
* Avoid crash caused by, and improve, 'findSpawnPos()' (#8728)Paramat2019-08-07
* Game: Fix double BS multiplicationSmallJoker2019-08-07
* Client::Interact: Use InteractAction enum instead of numeric constantsANAND2019-08-07
* Unify wield item handling (#8677)SmallJoker2019-08-07
* guiConfirmRegistration: Set focus to text field (#8761)ANAND2019-08-07
* Hide chat when console is open (#8656)ANAND2019-08-07
* Fix inventory_overlay for nodes without inventory_image (#8433)DS2019-08-07
* Optimize usage of TOSERVER_GOTBLOCKS packetsfan52019-08-07
* Do not add group values of zero to group lists. (#8751)Beha2019-08-07
* Clean up and fix freetype=false crashes (#8641)SmallJoker2019-08-06
* Mapgen Flat: Fix and improve getSpawnLevelAtPoint() (#8756)Paramat2019-08-06
* Fix binary-string confusion in client network codesfan52019-08-04
* Unify GLES support in gui scaling filtersfan52019-08-04
* Unify OpenGL ES supportsfan52019-08-04
* Let ENABLE_GLES appear in cmake_config.h and change its functionalitysfan52019-08-04
* Add formspec testing to test mod in minimalrubenwardy2019-08-03
* Add styles to most elementsrubenwardy2019-08-03
* Add style[] tag with button supportrubenwardy2019-08-03
* Add custom colorable GUIButton implementationrubenwardy2019-08-03
* Fix negative offsets not being supported by container[]rubenwardy2019-08-03
* Correct ServerActiveObject's virtual getArmorGroups() to be const.Beha2019-08-01
* Mainmenu: Use textarea in error formspecsSmallJoker2019-08-01
* Group "immortal" also protects players from damageWuzzy2019-08-01
* Allow toolcaps to override the built-in times for dig_immediatesfan52019-07-31
* Sky: Refactor of moon and sun drawing (#8683)Methacrylon2019-07-30
* Move the clamping of hp/breath when their maximums change to read_object_prop...Beha2019-07-30
pan class="hl opt">); // player PCALL_RES(lua_pcall(L, 7, 1, error_handler)); if(!lua_isnumber(L, -1)) throw LuaError("allow_move should return a number. name=" + name); int ret = luaL_checkinteger(L, -1); lua_pop(L, 2); // Pop integer and error handler return ret; } // Return number of accepted items to be put int ScriptApiDetached::detached_inventory_AllowPut( const std::string &name, const std::string &listname, int index, ItemStack &stack, ServerActiveObject *player) { SCRIPTAPI_PRECHECKHEADER int error_handler = PUSH_ERROR_HANDLER(L); // Push callback function on stack if (!getDetachedInventoryCallback(name, "allow_put")) return stack.count; // All will be accepted // Call function(inv, listname, index, stack, player) InventoryLocation loc; loc.setDetached(name); InvRef::create(L, loc); // inv lua_pushstring(L, listname.c_str()); // listname lua_pushinteger(L, index + 1); // index LuaItemStack::create(L, stack); // stack objectrefGetOrCreate(L, player); // player PCALL_RES(lua_pcall(L, 5, 1, error_handler)); if (!lua_isnumber(L, -1)) throw LuaError("allow_put should return a number. name=" + name); int ret = luaL_checkinteger(L, -1); lua_pop(L, 2); // Pop integer and error handler return ret; } // Return number of accepted items to be taken int ScriptApiDetached::detached_inventory_AllowTake( const std::string &name, const std::string &listname, int index, ItemStack &stack, ServerActiveObject *player) { SCRIPTAPI_PRECHECKHEADER int error_handler = PUSH_ERROR_HANDLER(L); // Push callback function on stack if (!getDetachedInventoryCallback(name, "allow_take")) return stack.count; // All will be accepted // Call function(inv, listname, index, stack, player) InventoryLocation loc; loc.setDetached(name); InvRef::create(L, loc); // inv lua_pushstring(L, listname.c_str()); // listname lua_pushinteger(L, index + 1); // index LuaItemStack::create(L, stack); // stack objectrefGetOrCreate(L, player); // player PCALL_RES(lua_pcall(L, 5, 1, error_handler)); if (!lua_isnumber(L, -1)) throw LuaError("allow_take should return a number. name=" + name); int ret = luaL_checkinteger(L, -1); lua_pop(L, 2); // Pop integer and error handler return ret; } // Report moved items void ScriptApiDetached::detached_inventory_OnMove( const std::string &name, const std::string &from_list, int from_index, const std::string &to_list, int to_index, int count, ServerActiveObject *player) { SCRIPTAPI_PRECHECKHEADER int error_handler = PUSH_ERROR_HANDLER(L); // Push callback function on stack if (!getDetachedInventoryCallback(name, "on_move")) return; // function(inv, from_list, from_index, to_list, to_index, count, player) // inv InventoryLocation loc; loc.setDetached(name); InvRef::create(L, loc); lua_pushstring(L, from_list.c_str()); // from_list lua_pushinteger(L, from_index + 1); // from_index lua_pushstring(L, to_list.c_str()); // to_list lua_pushinteger(L, to_index + 1); // to_index lua_pushinteger(L, count); // count objectrefGetOrCreate(L, player); // player PCALL_RES(lua_pcall(L, 7, 0, error_handler)); lua_pop(L, 1); // Pop error handler } // Report put items void ScriptApiDetached::detached_inventory_OnPut( const std::string &name, const std::string &listname, int index, ItemStack &stack, ServerActiveObject *player) { SCRIPTAPI_PRECHECKHEADER int error_handler = PUSH_ERROR_HANDLER(L); // Push callback function on stack if (!getDetachedInventoryCallback(name, "on_put")) return; // Call function(inv, listname, index, stack, player) // inv InventoryLocation loc; loc.setDetached(name); InvRef::create(L, loc); lua_pushstring(L, listname.c_str()); // listname lua_pushinteger(L, index + 1); // index LuaItemStack::create(L, stack); // stack objectrefGetOrCreate(L, player); // player PCALL_RES(lua_pcall(L, 5, 0, error_handler)); lua_pop(L, 1); // Pop error handler } // Report taken items void ScriptApiDetached::detached_inventory_OnTake( const std::string &name, const std::string &listname, int index, ItemStack &stack, ServerActiveObject *player) { SCRIPTAPI_PRECHECKHEADER int error_handler = PUSH_ERROR_HANDLER(L); // Push callback function on stack if (!getDetachedInventoryCallback(name, "on_take")) return; // Call function(inv, listname, index, stack, player) // inv InventoryLocation loc; loc.setDetached(name); InvRef::create(L, loc); lua_pushstring(L, listname.c_str()); // listname lua_pushinteger(L, index + 1); // index LuaItemStack::create(L, stack); // stack objectrefGetOrCreate(L, player); // player PCALL_RES(lua_pcall(L, 5, 0, error_handler)); lua_pop(L, 1); // Pop error handler } // Retrieves core.detached_inventories[name][callbackname] // If that is nil or on error, return false and stack is unchanged // If that is a function, returns true and pushes the // function onto the stack bool ScriptApiDetached::getDetachedInventoryCallback( const std::string &name, const char *callbackname) { lua_State *L = getStack(); lua_getglobal(L, "core"); lua_getfield(L, -1, "detached_inventories"); lua_remove(L, -2); luaL_checktype(L, -1, LUA_TTABLE); lua_getfield(L, -1, name.c_str()); lua_remove(L, -2); // Should be a table if(lua_type(L, -1) != LUA_TTABLE) { errorstream<<"Detached inventory \""<<name<<"\" not defined"<<std::endl; lua_pop(L, 1); return false; } setOriginFromTable(-1); lua_getfield(L, -1, callbackname); lua_remove(L, -2); // Should be a function or nil if(lua_type(L, -1) == LUA_TFUNCTION) { return true; } else if(lua_isnil(L, -1)) { lua_pop(L, 1); return false; } else { errorstream<<"Detached inventory \""<<name<<"\" callback \"" <<callbackname<<"\" is not a function"<<std::endl; lua_pop(L, 1); return false; } }