aboutsummaryrefslogtreecommitdiff
path: root/util
Commit message (Expand)AuthorAge
...
* Add translation for main menusapier2013-08-17
* Fix stored XSS vulnerability in the serverlistSfan52013-08-07
* Master server script improvementproller2013-08-05
* Masterserver bugfixproller2013-08-04
* More info in serverlistproller2013-08-03
* Masterserver mods fixproller2013-07-13
* Better masterserver htmlproller2013-07-13
* Masterserver mods announse, ipv6, better curl errorsproller2013-07-13
* Add texture bumpmapping feature.RealBadAngel2013-07-04
* Remove common from CMakeLists.txt, README.txt, lua-api.txt and buildwin.shPilzAdam2013-05-18
* Fix masterserver javascript: adjustable output idproller2013-04-11
* Fix backward compatibility for server uptime in master server web pageproller2013-03-30
* Masterserver: report gameid, uptime, cosmetic fixes on server web pageproller2013-03-30
* Update buildwin32.sh to get minetest/commonPerttu Ahola2013-03-21
* Update buildbotPilzAdam2013-02-24
* Change Minetest-c55 to MinetestPilzAdam2013-02-24
* new auto masterserverproller2013-02-22
* Tweak buildbotsfan52013-01-23
* Fixed two typos in wireshark lua file.DannyDark2012-12-23
* Update minetestmapper.py to support ver. 24 and 25Perttu Ahola2012-07-24
* Remove util/old/genmap.py, because it is uselessly oldPerttu Ahola2012-07-19
* Move genmap.py and pnoise.py to old/Perttu Ahola2012-06-08
* Update minetestmapper.py to support the current map format (and previous ones)Perttu Ahola2012-06-08
* Fix buildbotPerttu Ahola2012-04-03
* Add util/buildbotPerttu Ahola2012-04-03
* Add multiplayer test scriptPerttu Ahola2012-04-03
* Wireshark dissector: correct messed up field namesKahrl2011-12-01
* Wireshark dissector: Add TOSERVER_RESPAWN and TOCLIENT_DEATHSCREEN, plus some...Kahrl2011-12-01
* minetestmapper: Fix the way ylist is computed, use cStringIO instead of rolli...Kahrl2011-09-27
* minetestmapper speed tweaks (kahrl & JacobF)Perttu Ahola2011-09-26
* Add apple color to minetestmapper and fix cactus colorPerttu Ahola2011-09-26
* Fix minetestmapper.pyPerttu Ahola2011-09-26
* Support Python 2 and 3 in sectors2sqlite.py.Kahrl2011-09-26
* Fix processing of blocks below y=0 in sectors2sqlite.py.Kahrl2011-09-26
* update minetestmapper so it can read the database alsoJacobF2011-09-16
* Updated colors.txt (which is used by minetestmapper)Kahrl2011-09-15
* Cull empty lines...JacobF2011-09-04
* Files to database converterJacobF2011-09-04
* dissector branch: added wireshark dissector minetest.luaKahrl2011-08-25
* minetestmapper can be run from any directoryGiuseppe Bilotta2011-08-05
* updated po update script to detect wgettext and N_Constantin Wenger2011-08-05
* * honor environment variables, use utf-8Nils Dagsson Moskopp2011-07-30
* * PEP 8 complianceNils Dagsson Moskopp2011-07-30
* * support for content types extension in minetestmapperWolfgang Fellger2011-07-30
* Merge remote-tracking branch 'origin/upstream'Nils Dagsson Moskopp2011-07-30
|\
| * extended content-type rangePerttu Ahola2011-07-23
* | Bring po update out of cmake againGiuseppe Bilotta2011-07-24
|/
* added minetestmapper in utils/Perttu Ahola2011-06-25
* Reorganizing stuff (import from temporary git repo)Perttu Ahola2011-06-25
pan> 1); // Pop item return true; } bool ScriptApiItem::item_OnPlace(ItemStack &item, ServerActiveObject *placer, const PointedThing &pointed) { SCRIPTAPI_PRECHECKHEADER // Push callback function on stack if (!getItemCallback(item.name.c_str(), "on_place")) return false; // Call function LuaItemStack::create(L, item); objectrefGetOrCreate(L, placer); pushPointedThing(pointed); if (lua_pcall(L, 3, 1, m_errorhandler)) scriptError(); if (!lua_isnil(L, -1)) { try { item = read_item(L,-1, getServer()); } catch (LuaError &e) { throw LuaError(std::string(e.what()) + ". item=" + item.name); } } lua_pop(L, 1); // Pop item return true; } bool ScriptApiItem::item_OnUse(ItemStack &item, ServerActiveObject *user, const PointedThing &pointed) { SCRIPTAPI_PRECHECKHEADER // Push callback function on stack if (!getItemCallback(item.name.c_str(), "on_use")) return false; // Call function LuaItemStack::create(L, item); objectrefGetOrCreate(L, user); pushPointedThing(pointed); if (lua_pcall(L, 3, 1, m_errorhandler)) scriptError(); if(!lua_isnil(L, -1)) { try { item = read_item(L,-1, getServer()); } catch (LuaError &e) { throw LuaError(std::string(e.what()) + ". item=" + item.name); } } lua_pop(L, 1); // Pop item return true; } bool ScriptApiItem::item_OnCraft(ItemStack &item, ServerActiveObject *user, const InventoryList *old_craft_grid, const InventoryLocation &craft_inv) { SCRIPTAPI_PRECHECKHEADER lua_getglobal(L, "core"); lua_getfield(L, -1, "on_craft"); LuaItemStack::create(L, item); objectrefGetOrCreate(L, user); // Push inventory list std::vector<ItemStack> items; for (u32 i = 0; i < old_craft_grid->getSize(); i++) { items.push_back(old_craft_grid->getItem(i)); } push_items(L, items); InvRef::create(L, craft_inv); if (lua_pcall(L, 4, 1, m_errorhandler)) scriptError(); if (!lua_isnil(L, -1)) { try { item = read_item(L,-1, getServer()); } catch (LuaError &e) { throw LuaError(std::string(e.what()) + ". item=" + item.name); } } lua_pop(L, 1); // Pop item return true; } bool ScriptApiItem::item_CraftPredict(ItemStack &item, ServerActiveObject *user, const InventoryList *old_craft_grid, const InventoryLocation &craft_inv) { SCRIPTAPI_PRECHECKHEADER lua_getglobal(L, "core"); lua_getfield(L, -1, "craft_predict"); LuaItemStack::create(L, item); objectrefGetOrCreate(L, user); //Push inventory list std::vector<ItemStack> items; for (u32 i = 0; i < old_craft_grid->getSize(); i++) { items.push_back(old_craft_grid->getItem(i)); } push_items(L, items); InvRef::create(L, craft_inv); if (lua_pcall(L, 4, 1, m_errorhandler)) scriptError(); if (!lua_isnil(L, -1)) { try { item = read_item(L,-1, getServer()); } catch (LuaError &e) { throw LuaError(std::string(e.what()) + ". item=" + item.name); } } lua_pop(L, 1); // Pop item return true; } // Retrieves core.registered_items[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 // If core.registered_items[name] doesn't exist, core.nodedef_default // is tried instead so unknown items can still be manipulated to some degree bool ScriptApiItem::getItemCallback(const char *name, const char *callbackname) { lua_State* L = getStack(); lua_getglobal(L, "core"); lua_getfield(L, -1, "registered_items"); lua_remove(L, -2); // Remove core luaL_checktype(L, -1, LUA_TTABLE); lua_getfield(L, -1, name); lua_remove(L, -2); // Remove registered_items // Should be a table if(lua_type(L, -1) != LUA_TTABLE) { // Report error and clean up errorstream << "Item \"" << name << "\" not defined" << std::endl; lua_pop(L, 1); // Try core.nodedef_default instead lua_getglobal(L, "core"); lua_getfield(L, -1, "nodedef_default"); lua_remove(L, -2); luaL_checktype(L, -1, LUA_TTABLE); } lua_getfield(L, -1, callbackname); lua_remove(L, -2); // Remove item def // Should be a function or nil if (lua_type(L, -1) == LUA_TFUNCTION) { return true; } else if (!lua_isnil(L, -1)) { errorstream << "Item \"" << name << "\" callback \"" << callbackname << "\" is not a function" << std::endl; } lua_pop(L, 1); return false; } void ScriptApiItem::pushPointedThing(const PointedThing& pointed) { lua_State* L = getStack(); lua_newtable(L); if(pointed.type == POINTEDTHING_NODE) { lua_pushstring(L, "node"); lua_setfield(L, -2, "type"); push_v3s16(L, pointed.node_undersurface); lua_setfield(L, -2, "under"); push_v3s16(L, pointed.node_abovesurface); lua_setfield(L, -2, "above"); } else if(pointed.type == POINTEDTHING_OBJECT) { lua_pushstring(L, "object"); lua_setfield(L, -2, "type"); objectrefGet(L, pointed.object_id); lua_setfield(L, -2, "ref"); } else { lua_pushstring(L, "nothing"); lua_setfield(L, -2, "type"); } }