aboutsummaryrefslogtreecommitdiff
path: root/games/minimal/mods
Commit message (Collapse)AuthorAge
* Add different place sound for nodesPilzAdam2013-03-29
|
* Use minetest.register_ore() in minimalPilzAdam2013-03-24
|
* Mapgen indev: float islands, larger far biomesproller2013-03-24
|
* Liquid fine tuningproller2013-03-14
|
* new adjustable finite liquidproller2013-02-24
|
* Readded and optimized mapgen V6kwolekr2013-01-21
|
* Add initial Lua biomedef support, fixed biome selectionkwolekr2013-01-21
|
* Add the group attached_nodePilzAdam2012-12-01
| | | | Nodes in this group will be dropped as items if the node under them or the node in the wallmounted direction is not walkable.
* Swap out pixel-perfect nyan cat by request of Chris TorresPerttu Ahola2012-11-09
|
* Add functions to the default mod of minimal game to support old codePilzAdam2012-11-01
|
* Move falling to builtinPilzAdam2012-10-31
|
* Fix crash when furnace is full (minimal game)Perttu Ahola2012-08-12
|
* Deprecate minetest.add_to_creative_inventory and use group ↵Perttu Ahola2012-07-25
| | | | not_in_creative_inventory instead
* Add notice in the minimal gamePerttu Ahola2012-07-25
|
* Improve inventory callbacks a bitPerttu Ahola2012-07-25
|
* Detached inventory callbacks and reworked node metadata callbacksPerttu Ahola2012-07-25
|
* Detached inventoriesPerttu Ahola2012-07-24
|
* Add node timer test in minimal/experimentalPerttu Ahola2012-07-24
|
* Move /give, /giveme, /spawnentity and /pulverize to builtin/chatcommands.luaPerttu Ahola2012-07-23
|
* Formspec button_exit[] and image_button_exit[]Perttu Ahola2012-07-22
|
* Add /test1 command to minimal for testing a more complicated player ↵Perttu Ahola2012-07-22
| | | | inventory form
* Implement formspecdarkrose2012-07-22
|
* Actually fix facedir-rotated nodes placed using minetest.env:place_node()Perttu Ahola2012-07-21
|
* Make lava buckets work as fuel in minimal gamedarkrose2012-07-21
|
* Allow defining player's inventory form in LuaPerttu Ahola2012-07-19
|
* Custom boxy nodes (stairs, slabs) and collision changesKahrl2012-06-17
|
* Revert back proper crack texturePerttu Ahola2012-06-16
|
* Allow node cracking animations of any lengthPerttu Ahola2012-06-16
|
* Update field names to non-deprecated ones in node definition prototypePerttu Ahola2012-06-16
|
* Use new field names and reorder fields a bit in minimal gamePerttu Ahola2012-06-16
|
* Node texture animationPerttu Ahola2012-06-16
|
* Add experimental_tester_tool_1.png to minimal game (was accidentally left out)Perttu Ahola2012-06-08
|
* Allow groups in crafting recipesPerttu Ahola2012-06-06
|
* Add after_destruct and cache the existence of on_construct, on_destruct and ↵Perttu Ahola2012-06-05
| | | | after_destruct for quick skipping when a node does not have them
* place_node, dig_node and punch_node; an in-game tester tool; remove old codePerttu Ahola2012-06-05
|
* Add InvRef:is_empty(listname) and make chests/furnaces not diggable if not ↵darkrose2012-06-03
| | | | empty in minimal game
* fix locked chest to not destroy denied items (minimal game)darkrose2012-06-03
|
* Add fire visualization to minimal furnace menuPerttu Ahola2012-06-03
|
* Use proper furnace cook timePerttu Ahola2012-06-03
|
* Lua implementation of furnace with visible active statedarkrose2012-06-03
|
* Implement locked chest; add after_place_node and after_dig_node node callbacksPerttu Ahola2012-06-03
|
* minetest.get_craft_resultPerttu Ahola2012-06-03
|
* Implement sign using form field protocolPerttu Ahola2012-06-03
|
* Properly create metadata inventories in minimalPerttu Ahola2012-06-03
|
* Random node metadata thingsPerttu Ahola2012-06-03
|
* Attempt to begin to implement chests and furnace in Lua (with problems)Perttu Ahola2012-06-03
|
* Add missing mapgen.lua to games/minimalPerttu Ahola2012-04-06
|
* experimental:soundblock dig_immediate=3Perttu Ahola2012-04-06
|
* Make the minimal development test somewhat playable by adding ore generation ↵Perttu Ahola2012-04-05
| | | | and removing the player visual switch test
* Fix sound direction and add experimental:soundblock alias sb in minimal for ↵Perttu Ahola2012-04-04
| | | | testing
eet, Fifth Floor, Boston, MA 02110-1301 USA. */ #include "lua_api/l_item.h" #include "lua_api/l_itemstackmeta.h" #include "lua_api/l_internal.h" #include "common/c_converter.h" #include "common/c_content.h" #include "common/c_packer.h" #include "itemdef.h" #include "nodedef.h" #include "server.h" #include "inventory.h" #include "log.h" // garbage collector int LuaItemStack::gc_object(lua_State *L) { LuaItemStack *o = *(LuaItemStack **)(lua_touserdata(L, 1)); delete o; return 0; } // __tostring metamethod int LuaItemStack::mt_tostring(lua_State *L) { LuaItemStack *o = checkobject(L, 1); std::string itemstring = o->m_stack.getItemString(false); lua_pushfstring(L, "ItemStack(\"%s\")", itemstring.c_str()); return 1; } // is_empty(self) -> true/false int LuaItemStack::l_is_empty(lua_State *L) { NO_MAP_LOCK_REQUIRED; LuaItemStack *o = checkobject(L, 1); ItemStack &item = o->m_stack; lua_pushboolean(L, item.empty()); return 1; } // get_name(self) -> string int LuaItemStack::l_get_name(lua_State *L) { NO_MAP_LOCK_REQUIRED; LuaItemStack *o = checkobject(L, 1); ItemStack &item = o->m_stack; lua_pushstring(L, item.name.c_str()); return 1; } // set_name(self, name) int LuaItemStack::l_set_name(lua_State *L) { NO_MAP_LOCK_REQUIRED; LuaItemStack *o = checkobject(L, 1); ItemStack &item = o->m_stack; bool status = true; item.name = luaL_checkstring(L, 2); if (item.name.empty() || item.empty()) { item.clear(); status = false; } lua_pushboolean(L, status); return 1; } // get_count(self) -> number int LuaItemStack::l_get_count(lua_State *L) { NO_MAP_LOCK_REQUIRED; LuaItemStack *o = checkobject(L, 1); ItemStack &item = o->m_stack; lua_pushinteger(L, item.count); return 1; } // set_count(self, number) int LuaItemStack::l_set_count(lua_State *L) { NO_MAP_LOCK_REQUIRED; LuaItemStack *o = checkobject(L, 1); ItemStack &item = o->m_stack; bool status; lua_Integer count = luaL_checkinteger(L, 2); if (count > 0 && count <= 65535) { item.count = count; status = true; } else { item.clear(); status = false; } lua_pushboolean(L, status); return 1; } // get_wear(self) -> number int LuaItemStack::l_get_wear(lua_State *L) { NO_MAP_LOCK_REQUIRED; LuaItemStack *o = checkobject(L, 1); ItemStack &item = o->m_stack; lua_pushinteger(L, item.wear); return 1; } // set_wear(self, number) int LuaItemStack::l_set_wear(lua_State *L) { NO_MAP_LOCK_REQUIRED; LuaItemStack *o = checkobject(L, 1); ItemStack &item = o->m_stack; bool status; lua_Integer wear = luaL_checkinteger(L, 2); if (wear <= 65535) { item.wear = wear; status = true; } else { item.clear(); status = false; } lua_pushboolean(L, status); return 1; } // get_meta(self) -> string int LuaItemStack::l_get_meta(lua_State *L) { NO_MAP_LOCK_REQUIRED; LuaItemStack *o = checkobject(L, 1); ItemStackMetaRef::create(L, &o->m_stack); return 1; } // DEPRECATED // get_metadata(self) -> string int LuaItemStack::l_get_metadata(lua_State *L) { NO_MAP_LOCK_REQUIRED; LuaItemStack *o = checkobject(L, 1); ItemStack &item = o->m_stack; const std::string &value = item.metadata.getString(""); lua_pushlstring(L, value.c_str(), value.size()); return 1; } // DEPRECATED // set_metadata(self, string) int LuaItemStack::l_set_metadata(lua_State *L) { NO_MAP_LOCK_REQUIRED; LuaItemStack *o = checkobject(L, 1); ItemStack &item = o->m_stack; size_t len = 0; const char *ptr = luaL_checklstring(L, 2, &len); item.metadata.setString("", std::string(ptr, len)); lua_pushboolean(L, true); return 1; } // get_description(self) int LuaItemStack::l_get_description(lua_State *L) { NO_MAP_LOCK_REQUIRED; LuaItemStack *o = checkobject(L, 1); std::string desc = o->m_stack.getDescription(getGameDef(L)->idef()); lua_pushstring(L, desc.c_str()); return 1; } // get_short_description(self) int LuaItemStack::l_get_short_description(lua_State *L) { NO_MAP_LOCK_REQUIRED; LuaItemStack *o = checkobject(L, 1); std::string desc = o->m_stack.getShortDescription(getGameDef(L)->idef()); lua_pushstring(L, desc.c_str()); return 1; } // clear(self) -> true int LuaItemStack::l_clear(lua_State *L) { NO_MAP_LOCK_REQUIRED; LuaItemStack *o = checkobject(L, 1); o->m_stack.clear(); lua_pushboolean(L, true); return 1; } // replace(self, itemstack or itemstring or table or nil) -> true int LuaItemStack::l_replace(lua_State *L) { NO_MAP_LOCK_REQUIRED; LuaItemStack *o = checkobject(L, 1); o->m_stack = read_item(L, 2, getGameDef(L)->idef()); lua_pushboolean(L, true); return 1; } // to_string(self) -> string int LuaItemStack::l_to_string(lua_State *L) { NO_MAP_LOCK_REQUIRED; LuaItemStack *o = checkobject(L, 1); std::string itemstring = o->m_stack.getItemString(); lua_pushstring(L, itemstring.c_str()); return 1; } // to_table(self) -> table or nil int LuaItemStack::l_to_table(lua_State *L) { NO_MAP_LOCK_REQUIRED; LuaItemStack *o = checkobject(L, 1); const ItemStack &item = o->m_stack; if(item.empty()) { lua_pushnil(L); } else { lua_newtable(L); lua_pushstring(L, item.name.c_str()); lua_setfield(L, -2, "name"); lua_pushinteger(L, item.count); lua_setfield(L, -2, "count"); lua_pushinteger(L, item.wear); lua_setfield(L, -2, "wear"); const std::string &metadata_str = item.metadata.getString(""); lua_pushlstring(L, metadata_str.c_str(), metadata_str.size()); lua_setfield(L, -2, "metadata"); lua_newtable(L); const StringMap &fields = item.metadata.getStrings(); for (const auto &field : fields) { const std::string &name = field.first; if (name.empty()) continue; const std::string &value = field.second; lua_pushlstring(L, name.c_str(), name.size()); lua_pushlstring(L, value.c_str(), value.size()); lua_settable(L, -3); } lua_setfield(L, -2, "meta"); } return 1; } // get_stack_max(self) -> number int LuaItemStack::l_get_stack_max(lua_State *L) { NO_MAP_LOCK_REQUIRED; LuaItemStack *o = checkobject(L, 1); ItemStack &item = o->m_stack; lua_pushinteger(L, item.getStackMax(getGameDef(L)->idef())); return 1; } // get_free_space(self) -> number int LuaItemStack::l_get_free_space(lua_State *L) { NO_MAP_LOCK_REQUIRED; LuaItemStack *o = checkobject(L, 1); ItemStack &item = o->m_stack; lua_pushinteger(L, item.freeSpace(getGameDef(L)->idef())); return 1; } // is_known(self) -> true/false // Checks if the item is defined. int LuaItemStack::l_is_known(lua_State *L) { NO_MAP_LOCK_REQUIRED; LuaItemStack *o = checkobject(L, 1); ItemStack &item = o->m_stack; bool is_known = item.isKnown(getGameDef(L)->idef()); lua_pushboolean(L, is_known); return 1; } // get_definition(self) -> table // Returns the item definition table from registered_items, // or a fallback one (name="unknown") int LuaItemStack::l_get_definition(lua_State *L) { NO_MAP_LOCK_REQUIRED; LuaItemStack *o = checkobject(L, 1); ItemStack &item = o->m_stack; // Get registered_items[name] lua_getglobal(L, "core"); lua_getfield(L, -1, "registered_items"); luaL_checktype(L, -1, LUA_TTABLE); lua_getfield(L, -1, item.name.c_str()); if(lua_isnil(L, -1)) { lua_pop(L, 1); lua_getfield(L, -1, "unknown"); } return 1; } // get_tool_capabilities(self) -> table // Returns the effective tool digging properties. // Returns those of the hand ("") if this item has none associated. int LuaItemStack::l_get_tool_capabilities(lua_State *L) { NO_MAP_LOCK_REQUIRED; LuaItemStack *o = checkobject(L, 1);