aboutsummaryrefslogtreecommitdiff
path: root/games/minimal/mods/default/init.lua
Commit message (Collapse)AuthorAge
* Add different place sound for nodesPilzAdam2013-03-29
|
* 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.
* 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
|
* Move /give, /giveme, /spawnentity and /pulverize to builtin/chatcommands.luaPerttu Ahola2012-07-23
|
* Implement formspecdarkrose2012-07-22
|
* Custom boxy nodes (stairs, slabs) and collision changesKahrl2012-06-17
|
* 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 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
|
* Make the minimal development test somewhat playable by adding ore generation ↵Perttu Ahola2012-04-05
| | | | and removing the player visual switch test
* Rework tool_capabilities a bit (maxwear->uses, scale dig time according to ↵Perttu Ahola2012-03-29
| | | | leveldiff)
* Make mapgen use mapgen_* node aliases rather than the LEGN macroPerttu Ahola2012-03-28
|
* Move games/minetest to games/minimal and update README.txtPerttu Ahola2012-03-26
ings:get("devtest_infplace") if s_infplace == "true" then infplace = true elseif s_infplace == "false" then infplace = false else infplace = minetest.is_creative_enabled("") end minetest.register_chatcommand("infplace", { params = "", description = "Toggle infinite node placement", func = function(name, param) infplace = not infplace if infplace then minetest.chat_send_all("Infinite node placement enabled!") minetest.log("action", "Infinite node placement enabled") else minetest.chat_send_all("Infinite node placement disabled!") minetest.log("action", "Infinite node placement disabled") end return true end, }) minetest.register_chatcommand("detach", { params = "[<radius>]", description = "Detach all objects nearby", func = function(name, param) local radius = tonumber(param) if type(radius) ~= "number" then radius = 8 end if radius < 1 then radius = 1 end local player = minetest.get_player_by_name(name) if not player then return false, "No player." end local objs = minetest.get_objects_inside_radius(player:get_pos(), radius) local num = 0 for o=1, #objs do if objs[o]:get_attach() then objs[o]:set_detach() num = num + 1 end end return true, string.format("%d object(s) detached.", num) end, }) minetest.register_chatcommand("use_tool", { params = "(dig <group> <leveldiff>) | (hit <damage_group> <time_from_last_punch>) [<uses>]", description = "Apply tool wear a number of times, as if it were used for digging", func = function(name, param) local player = minetest.get_player_by_name(name) if not player then return false, "No player." end local mode, group, level, uses = string.match(param, "([a-z]+) ([a-z0-9]+) (-?%d+) (%d+)") if not mode then mode, group, level = string.match(param, "([a-z]+) ([a-z0-9]+) (-?%d+)") uses = 1 end if not mode or not group or not level then return false end if mode ~= "dig" and mode ~= "hit" then return false end local tool = player:get_wielded_item() local caps = tool:get_tool_capabilities() if not caps or tool:get_count() == 0 then return false, "No tool in hand." end local actual_uses = 0 for u=1, uses do local wear = tool:get_wear() local dp if mode == "dig" then dp = minetest.get_dig_params({[group]=3, level=level}, caps, wear) else dp = minetest.get_hit_params({[group]=100}, caps, level, wear) end tool:add_wear(dp.wear) actual_uses = actual_uses + 1 if tool:get_count() == 0 then break end end player:set_wielded_item(tool) if tool:get_count() == 0 then return true, string.format("Tool used %d time(s). ".. "The tool broke after %d use(s).", uses, actual_uses) else local wear = tool:get_wear() return true, string.format("Tool used %d time(s). ".. "Final wear=%d", uses, wear) end end, }) -- Use this to test waypoint capabilities minetest.register_chatcommand("test_waypoints", { params = "[change_immediate]", description = "tests waypoint capabilities", func = function(name, params) local player = minetest.get_player_by_name(name) local regular = player:hud_add { hud_elem_type = "waypoint", name = "regular waypoint", text = "m", number = 0xFF0000, world_pos = vector.add(player:get_pos(), {x = 0, y = 1.5, z = 0}) } local reduced_precision = player:hud_add { hud_elem_type = "waypoint", name = "better waypoint", text = "m (0.5 steps, precision = 2)", precision = 10, number = 0xFFFF00, world_pos = vector.add(player:get_pos(), {x = 0, y = 1, z = 0}) } local function change() if regular then player:hud_change(regular, "world_pos", vector.add(player:get_pos(), {x = 0, y = 3, z = 0})) end if reduced_precision then player:hud_change(reduced_precision, "precision", 2) end end if params ~= "" then -- change immediate change() else minetest.after(0.5, change) end regular = regular or "error" reduced_precision = reduced_precision or "error" local hidden_distance = player:hud_add { hud_elem_type = "waypoint", name = "waypoint with hidden distance", text = "this text is hidden as well (precision = 0)", precision = 0, number = 0x0000FF, world_pos = vector.add(player:get_pos(), {x = 0, y = 0.5, z = 0}) } or "error" local image_waypoint = player:hud_add { hud_elem_type = "image_waypoint", text = "wieldhand.png", world_pos = player:get_pos(), scale = {x = 10, y = 10}, offset = {x = 0, y = -32} } or "error" minetest.chat_send_player(name, "Waypoint IDs: regular: " .. regular .. ", reduced precision: " .. reduced_precision .. ", hidden distance: " .. hidden_distance .. ", image waypoint: " .. image_waypoint) end }) -- Unlimited node placement minetest.register_on_placenode(function(pos, newnode, placer, oldnode, itemstack) if placer and placer:is_player() then return infplace end end) -- Don't pick up if the item is already in the inventory local old_handle_node_drops = minetest.handle_node_drops function minetest.handle_node_drops(pos, drops, digger) if not digger or not digger:is_player() or not infplace then return old_handle_node_drops(pos, drops, digger) end local inv = digger:get_inventory() if inv then for _, item in ipairs(drops) do if not inv:contains_item("main", item, true) then inv:add_item("main", item) end end end end minetest.register_chatcommand("set_displayed_itemcount", { params = "(-s \"<string>\" [-c <color>]) | -a <alignment_num>", description = "Set the displayed itemcount of the wielded item", func = function(name, param) local player = minetest.get_player_by_name(name) local item = player:get_wielded_item() local meta = item:get_meta() local flag1 = param:sub(1, 2) if flag1 == "-s" then if param:sub(3, 4) ~= " \"" then return false, "Error: Space and string with \"s expected after -s." end local se = param:find("\"", 5, true) if not se then return false, "Error: String with two \"s expected after -s." end local s = param:sub(5, se - 1) if param:sub(se + 1, se + 4) == " -c " then s = minetest.colorize(param:sub(se + 5), s) end meta:set_string("count_meta", s) elseif flag1 == "-a" then local num = tonumber(param:sub(4)) if not num then return false, "Error: Invalid number: "..param:sub(4) end meta:set_int("count_alignment", num) else return false end player:set_wielded_item(item) return true, "Displayed itemcount set." end, }) minetest.register_chatcommand("dump_item", { params = "", description = "Prints a dump of the wielded item in table form", func = function(name, param) local player = minetest.get_player_by_name(name) local item = player:get_wielded_item() local str = dump(item:to_table()) print(str) return true, str end, }) -- shadow control minetest.register_on_joinplayer(function (player) player:set_lighting({shadows={intensity = 0.33}}) end) core.register_chatcommand("set_shadow", { params = "<shadow_intensity>", description = "Set shadow parameters of current player.", func = function(player_name, param) local shadow_intensity = tonumber(param) minetest.get_player_by_name(player_name):set_lighting({shadows = { intensity = shadow_intensity} }) end })