commit 8ff757b99977ced65402785c968f57e87cecdea6 Author: adrido Date: Sat Jun 8 11:03:46 2013 +0200 initial diff --git a/README.txt b/README.txt new file mode 100644 index 0000000..7c5c673 --- /dev/null +++ b/README.txt @@ -0,0 +1,50 @@ +The main game for the Minetest game engine [minetest_game] +========================================================== + +To build the wholeness of the Minetest project, insert this repository as + /games/minetest_game +in the Minetest Engine. + +The Minetest Engine can be found in: + https://github.com/minetest/minetest/ + +Compatibility +-------------- +The minetest_game github master HEAD is generally compatible with the github +master HEAD of minetest. + +Additionally, when the minetest engine is tagged to be a certain version (eg. +0.4.dev-20120326), minetest_game is tagged with the version too. + +When stable releases are made, minetest_game is packaged and made available in + http://minetest.net/download.php +and in case the repository has grown too much, it may be reset. In that sense, +this is not a "real" git repository. (Package maintainers please note!) + +License of source code +---------------------- +Copyright (C) 2010-2012 celeron55, Perttu Ahola +See README.txt in each mod directory for information about other authors. + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 2.1 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +License of media (textures and sounds) +-------------------------------------- +Copyright (C) 2010-2012 celeron55, Perttu Ahola +See README.txt in each mod directory for information about other authors. + +Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) +http://creativecommons.org/licenses/by-sa/3.0/ + diff --git a/game.conf b/game.conf new file mode 100644 index 0000000..c984fb9 --- /dev/null +++ b/game.conf @@ -0,0 +1,2 @@ +name = Minetest Classic + diff --git a/menu/background.png b/menu/background.png new file mode 100644 index 0000000..da4bb6c Binary files /dev/null and b/menu/background.png differ diff --git a/menu/background.xcf b/menu/background.xcf new file mode 100644 index 0000000..c692d2a Binary files /dev/null and b/menu/background.xcf differ diff --git a/menu/doors/README.txt b/menu/doors/README.txt new file mode 100644 index 0000000..074c30f --- /dev/null +++ b/menu/doors/README.txt @@ -0,0 +1,43 @@ +Minetest 0.4 mod: doors +======================== + +License of source code: +----------------------- +Original license text: +-- (c) 2011 Fernando Zapata +-- Code licensed under GNU GPLv3 +-- Content licensed under CC BY-SA 3.0 +-- 2012-01-08 11:03:57 + +There has been unsuccesful attempts to contact the original author. Thus, +based on the intentions of the author, it is assumed that this code is +distributable and modifiable under LGPLv2+later, under which Minetest is +distributed. + +Modifications: + Copyright (C) 2012 celeron55, Perttu Ahola + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 2.1 of the License, or +(at your option) any later version. + +http://www.gnu.org/licenses/lgpl-2.1.html + +License of media (textures and sounds) +-------------------------------------- +Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) +http://creativecommons.org/licenses/by-sa/3.0/ + +Authors of media files +----------------------- +Everything not listed in here: +Copyright (C) 2010-2012 celeron55, Perttu Ahola + +From the original zlpdoors mod by Fernando Zapata: + door_wood_a.png + door_wood_a_r.png + door_wood_b.png + door_wood_b_r.png + door_wood.png + diff --git a/menu/doors/depends.txt b/menu/doors/depends.txt new file mode 100644 index 0000000..4ad96d5 --- /dev/null +++ b/menu/doors/depends.txt @@ -0,0 +1 @@ +default diff --git a/menu/doors/init.lua b/menu/doors/init.lua new file mode 100644 index 0000000..24349cb --- /dev/null +++ b/menu/doors/init.lua @@ -0,0 +1,205 @@ +-- Minetest 0.4 mod: doors +-- See README.txt for licensing and other information. +-------------------------------------------------------------------------------- + +local WALLMX = 3 +local WALLMZ = 5 +local WALLPX = 2 +local WALLPZ = 4 + +-------------------------------------------------------------------------------- + +minetest.register_alias('door', 'doors:door_wood') +minetest.register_alias('door_wood', 'doors:door_wood') + +minetest.register_node( 'doors:door_wood', { + description = 'Wooden Door', + drawtype = 'signlike', + tiles = { 'door_wood.png' }, + inventory_image = 'door_wood.png', + wield_image = 'door_wood.png', + paramtype2 = 'wallmounted', + selection_box = { type = 'wallmounted' }, + groups = { choppy=2, dig_immediate=2 }, +}) + +minetest.register_craft( { + output = 'doors:door_wood', + recipe = { + { 'default:wood', 'default:wood' }, + { 'default:wood', 'default:wood' }, + { 'default:wood', 'default:wood' }, + }, +}) + +minetest.register_craft({ + type = 'fuel', + recipe = 'doors:door_wood', + burntime = 30, +}) + +minetest.register_node( 'doors:door_wood_a_c', { + Description = 'Top Closed Door', + drawtype = 'signlike', + tiles = { 'door_wood_a.png' }, + inventory_image = 'door_wood_a.png', + paramtype = 'light', + paramtype2 = 'wallmounted', + walkable = true, + selection_box = { type = "wallmounted", }, + groups = { choppy=2, dig_immediate=2 }, + legacy_wallmounted = true, + drop = 'doors:door_wood', +}) + +minetest.register_node( 'doors:door_wood_b_c', { + Description = 'Bottom Closed Door', + drawtype = 'signlike', + tiles = { 'door_wood_b.png' }, + inventory_image = 'door_wood_b.png', + paramtype = 'light', + paramtype2 = 'wallmounted', + walkable = true, + selection_box = { type = "wallmounted", }, + groups = { choppy=2, dig_immediate=2 }, + legacy_wallmounted = true, + drop = 'doors:door_wood', +}) + +minetest.register_node( 'doors:door_wood_a_o', { + Description = 'Top Open Door', + drawtype = 'signlike', + tiles = { 'door_wood_a_r.png' }, + inventory_image = 'door_wood_a_r.png', + paramtype = 'light', + paramtype2 = 'wallmounted', + walkable = false, + selection_box = { type = "wallmounted", }, + groups = { choppy=2, dig_immediate=2 }, + legacy_wallmounted = true, + drop = 'doors:door_wood', +}) + +minetest.register_node( 'doors:door_wood_b_o', { + Description = 'Bottom Open Door', + drawtype = 'signlike', + tiles = { 'door_wood_b_r.png' }, + inventory_image = 'door_wood_b_r.png', + paramtype = 'light', + paramtype2 = 'wallmounted', + walkable = false, + selection_box = { type = "wallmounted", }, + groups = { choppy=2, dig_immediate=2 }, + legacy_wallmounted = true, + drop = 'doors:door_wood', +}) + +-------------------------------------------------------------------------------- + +local round = function( n ) + if n >= 0 then + return math.floor( n + 0.5 ) + else + return math.ceil( n - 0.5 ) + end +end + +local on_door_placed = function( pos, node, placer ) + if node.name ~= 'doors:door_wood' then return end + + local upos = { x = pos.x, y = pos.y - 1, z = pos.z } + local apos = { x = pos.x, y = pos.y + 1, z = pos.z } + local und = minetest.env:get_node( upos ) + local abv = minetest.env:get_node( apos ) + + local dir = placer:get_look_dir() + + if round( dir.x ) == 1 then + newparam = WALLMX + elseif round( dir.x ) == -1 then + newparam = WALLPX + elseif round( dir.z ) == 1 then + newparam = WALLMZ + elseif round( dir.z ) == -1 then + newparam = WALLPZ + end + + if und.name == 'air' then + minetest.env:add_node( pos, { name = 'doors:door_wood_a_c', param2 = newparam } ) + minetest.env:add_node( upos, { name = 'doors:door_wood_b_c', param2 = newparam } ) + elseif abv.name == 'air' then + minetest.env:add_node( pos, { name = 'doors:door_wood_b_c', param2 = newparam } ) + minetest.env:add_node( apos, { name = 'doors:door_wood_a_c', param2 = newparam } ) + else + minetest.env:remove_node( pos ) + placer:get_inventory():add_item( "main", 'doors:door_wood' ) + minetest.chat_send_player( placer:get_player_name(), 'not enough space' ) + end +end + +local on_door_punched = function( pos, node, puncher ) + if string.find( node.name, 'doors:door_wood' ) == nil then return end + + local upos = { x = pos.x, y = pos.y - 1, z = pos.z } + local apos = { x = pos.x, y = pos.y + 1, z = pos.z } + + if string.find( node.name, '_c', -2 ) ~= nil then + if node.param2 == WALLPX then + newparam = WALLMZ + elseif node.param2 == WALLMZ then + newparam = WALLMX + elseif node.param2 == WALLMX then + newparam = WALLPZ + elseif node.param2 == WALLPZ then + newparam = WALLPX + end + elseif string.find( node.name, '_o', -2 ) ~= nil then + if node.param2 == WALLMZ then + newparam = WALLPX + elseif node.param2 == WALLMX then + newparam = WALLMZ + elseif node.param2 == WALLPZ then + newparam = WALLMX + elseif node.param2 == WALLPX then + newparam = WALLPZ + end + end + + if ( node.name == 'doors:door_wood_a_c' ) then + minetest.env:add_node( pos, { name = 'doors:door_wood_a_o', param2 = newparam } ) + minetest.env:add_node( upos, { name = 'doors:door_wood_b_o', param2 = newparam } ) + + elseif ( node.name == 'doors:door_wood_b_c' ) then + minetest.env:add_node( pos, { name = 'doors:door_wood_b_o', param2 = newparam } ) + minetest.env:add_node( apos, { name = 'doors:door_wood_a_o', param2 = newparam } ) + + elseif ( node.name == 'doors:door_wood_a_o' ) then + minetest.env:add_node( pos, { name = 'doors:door_wood_a_c', param2 = newparam } ) + minetest.env:add_node( upos, { name = 'doors:door_wood_b_c', param2 = newparam } ) + + elseif ( node.name == 'doors:door_wood_b_o' ) then + minetest.env:add_node( pos, { name = 'doors:door_wood_b_c', param2 = newparam } ) + minetest.env:add_node( apos, { name = 'doors:door_wood_a_c', param2 = newparam } ) + + end +end + +local on_door_digged = function( pos, node, digger ) + local upos = { x = pos.x, y = pos.y - 1, z = pos.z } + local apos = { x = pos.x, y = pos.y + 1, z = pos.z } + + if ( node.name == 'doors:door_wood_a_c' ) or ( node.name == 'doors:door_wood_a_o' ) then + minetest.env:remove_node( upos ) + elseif ( node.name == 'doors:door_wood_b_c' ) or ( node.name == 'doors:door_wood_b_o' ) then + minetest.env:remove_node( apos ) + end +end + +-------------------------------------------------------------------------------- + +minetest.register_on_placenode( on_door_placed ) +minetest.register_on_punchnode( on_door_punched ) +minetest.register_on_dignode( on_door_digged ) + +-------------------------------------------------------------------------------- + diff --git a/menu/doors/textures/door_wood.png b/menu/doors/textures/door_wood.png new file mode 100644 index 0000000..120fc98 Binary files /dev/null and b/menu/doors/textures/door_wood.png differ diff --git a/menu/doors/textures/door_wood_a.png b/menu/doors/textures/door_wood_a.png new file mode 100644 index 0000000..1617b65 Binary files /dev/null and b/menu/doors/textures/door_wood_a.png differ diff --git a/menu/doors/textures/door_wood_a_r.png b/menu/doors/textures/door_wood_a_r.png new file mode 100644 index 0000000..9315b75 Binary files /dev/null and b/menu/doors/textures/door_wood_a_r.png differ diff --git a/menu/doors/textures/door_wood_b.png b/menu/doors/textures/door_wood_b.png new file mode 100644 index 0000000..80d4315 Binary files /dev/null and b/menu/doors/textures/door_wood_b.png differ diff --git a/menu/doors/textures/door_wood_b_r.png b/menu/doors/textures/door_wood_b_r.png new file mode 100644 index 0000000..9c53aa4 Binary files /dev/null and b/menu/doors/textures/door_wood_b_r.png differ diff --git a/menu/footer.png b/menu/footer.png new file mode 100644 index 0000000..0c391bc Binary files /dev/null and b/menu/footer.png differ diff --git a/menu/footer.xcf b/menu/footer.xcf new file mode 100644 index 0000000..e06f59b Binary files /dev/null and b/menu/footer.xcf differ diff --git a/menu/icon.png b/menu/icon.png new file mode 100644 index 0000000..051d01e Binary files /dev/null and b/menu/icon.png differ diff --git a/menu/icon.xcf b/menu/icon.xcf new file mode 100644 index 0000000..582d2fb Binary files /dev/null and b/menu/icon.xcf differ diff --git a/mods/bucket/README.txt b/mods/bucket/README.txt new file mode 100644 index 0000000..7dad641 --- /dev/null +++ b/mods/bucket/README.txt @@ -0,0 +1,26 @@ +Minetest 0.4 mod: bucket +========================= + +License of source code: +----------------------- +Copyright (C) 2011-2012 Kahrl +Copyright (C) 2011-2012 celeron55, Perttu Ahola + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +http://www.gnu.org/licenses/lgpl-2.1.html + +License of media (textures and sounds) +-------------------------------------- +Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) +http://creativecommons.org/licenses/by-sa/3.0/ + +Authors of media files +----------------------- +Everything not listed in here: +Copyright (C) 2010-2012 celeron55, Perttu Ahola + + diff --git a/mods/bucket/depends.txt b/mods/bucket/depends.txt new file mode 100644 index 0000000..3a7daa1 --- /dev/null +++ b/mods/bucket/depends.txt @@ -0,0 +1,2 @@ +default + diff --git a/mods/bucket/init.lua b/mods/bucket/init.lua new file mode 100644 index 0000000..82949dd --- /dev/null +++ b/mods/bucket/init.lua @@ -0,0 +1,96 @@ +-- Minetest 0.4 mod: bucket +-- See README.txt for licensing and other information. + +minetest.register_alias("bucket", "bucket:bucket_empty") +minetest.register_alias("bucket_water", "bucket:bucket_water") +minetest.register_alias("bucket_lava", "bucket:bucket_lava") + +minetest.register_craft({ + output = 'bucket:bucket_empty 1', + recipe = { + {'default:steel_ingot', '', 'default:steel_ingot'}, + {'', 'default:steel_ingot', ''}, + } +}) + +bucket = {} +bucket.liquids = {} + +-- Register a new liquid +-- source = name of the source node +-- flowing = name of the flowing node +-- itemname = name of the new bucket item (or nil if liquid is not takeable) +-- inventory_image = texture of the new bucket item (ignored if itemname == nil) +-- This function can be called from any mod (that depends on bucket). +function bucket.register_liquid(source, flowing, itemname, inventory_image) + bucket.liquids[source] = { + source = source, + flowing = flowing, + itemname = itemname, + } + bucket.liquids[flowing] = bucket.liquids[source] + + if itemname ~= nil then + minetest.register_craftitem(itemname, { + inventory_image = inventory_image, + stack_max = 1, + liquids_pointable = true, + on_use = function(itemstack, user, pointed_thing) + -- Must be pointing to node + if pointed_thing.type ~= "node" then + return + end + -- Check if pointing to a liquid + n = minetest.env:get_node(pointed_thing.under) + if bucket.liquids[n.name] == nil then + -- Not a liquid + minetest.env:add_node(pointed_thing.above, {name=source}) + elseif n.name ~= source then + -- It's a liquid + minetest.env:add_node(pointed_thing.under, {name=source}) + end + return {name="bucket:bucket_empty"} + end + }) + end +end + +minetest.register_craftitem("bucket:bucket_empty", { + description = "Emtpy bucket", + inventory_image = "bucket.png", + stack_max = 1, + liquids_pointable = true, + on_use = function(itemstack, user, pointed_thing) + -- Must be pointing to node + if pointed_thing.type ~= "node" then + return + end + -- Check if pointing to a liquid source + n = minetest.env:get_node(pointed_thing.under) + liquiddef = bucket.liquids[n.name] + if liquiddef ~= nil and liquiddef.source == n.name and liquiddef.itemname ~= nil then + minetest.env:add_node(pointed_thing.under, {name="air"}) + return {name=liquiddef.itemname} + end + end, +}) + +bucket.register_liquid( + "default:water_source", + "default:water_flowing", + "bucket:bucket_water", + "bucket_water.png" +) + +bucket.register_liquid( + "default:lava_source", + "default:lava_flowing", + "bucket:bucket_lava", + "bucket_lava.png" +) + +minetest.register_craft({ + type = "fuel", + recipe = "bucket:bucket_lava", + burntime = 60, +}) diff --git a/mods/bucket/textures/bucket.png b/mods/bucket/textures/bucket.png new file mode 100644 index 0000000..f165fd2 Binary files /dev/null and b/mods/bucket/textures/bucket.png differ diff --git a/mods/bucket/textures/bucket_lava.png b/mods/bucket/textures/bucket_lava.png new file mode 100644 index 0000000..7cf27cd Binary files /dev/null and b/mods/bucket/textures/bucket_lava.png differ diff --git a/mods/bucket/textures/bucket_water.png b/mods/bucket/textures/bucket_water.png new file mode 100644 index 0000000..f220ec5 Binary files /dev/null and b/mods/bucket/textures/bucket_water.png differ diff --git a/mods/creative/README.txt b/mods/creative/README.txt new file mode 100644 index 0000000..7d49b98 --- /dev/null +++ b/mods/creative/README.txt @@ -0,0 +1,22 @@ +Minetest 0.4 mod: creative +========================== + +Implements creative mode. + +Switch on by using the "creative_mode" setting. + +Registered items that +- have a description, and +- do not have the group not_in_creative_inventory +are added to the creative inventory. + +License of source code and media files: +--------------------------------------- +Copyright (C) 2012 Perttu Ahola (celeron55) + +This program is free software. It comes without any warranty, to +the extent permitted by applicable law. You can redistribute it +and/or modify it under the terms of the Do What The Fuck You Want +To Public License, Version 2, as published by Sam Hocevar. See +http://sam.zoy.org/wtfpl/COPYING for more details. + diff --git a/mods/creative/init.lua b/mods/creative/init.lua new file mode 100644 index 0000000..a18140b --- /dev/null +++ b/mods/creative/init.lua @@ -0,0 +1,116 @@ +-- minetest/creative/init.lua + +local creative_inventory = {} +creative_inventory.creative_inventory_size = 0 + +-- Create detached creative inventory after loading all mods +minetest.after(0, function() + local inv = minetest.create_detached_inventory("creative", { + allow_move = function(inv, from_list, from_index, to_list, to_index, count, player) + if minetest.setting_getbool("creative_mode") then + return count + else + return 0 + end + end, + allow_put = function(inv, listname, index, stack, player) + if minetest.setting_getbool("creative_mode") then + return -1 + else + return 0 + end + end, + allow_take = function(inv, listname, index, stack, player) + if minetest.setting_getbool("creative_mode") then + return -1 + else + return 0 + end + end, + on_move = function(inv, from_list, from_index, to_list, to_index, count, player) + end, + on_put = function(inv, listname, index, stack, player) + end, + on_take = function(inv, listname, index, stack, player) + print(player:get_player_name().." takes item from creative inventory; listname="..dump(listname)..", index="..dump(index)..", stack="..dump(stack)) + if stack then + print("stack:get_name()="..dump(stack:get_name())..", stack:get_count()="..dump(stack:get_count())) + end + end, + }) + local creative_list = {} + for name,def in pairs(minetest.registered_items) do + if (not def.groups.not_in_creative_inventory or def.groups.not_in_creative_inventory == 0) + and def.description and def.description ~= "" then + table.insert(creative_list, name) + end + end + table.sort(creative_list) + inv:set_size("main", #creative_list) + for _,itemstring in ipairs(creative_list) do + local stack = ItemStack(itemstring) + -- Make a stack of the right number of items + local stack2 = nil + if stack:get_stack_max() == 1 then + stack2 = ItemStack(stack:get_name()) + else + -- Insert half full so that a taken stack can be put back + stack2 = ItemStack(stack:get_name().." "..(stack:get_stack_max()/2)) + end + inv:add_item("main", stack2) + end + creative_inventory.creative_inventory_size = #creative_list + print("creative inventory size: "..dump(creative_inventory.creative_inventory_size)) +end) + +creative_inventory.set_creative_formspec = function(player, start_i, pagenum) + pagenum = math.floor(pagenum) + local pagemax = math.floor((creative_inventory.creative_inventory_size-1) / (6*4) + 1) + player:set_inventory_formspec("size[13,7.5]".. + --"image[6,0.6;1,2;player.png]".. + "list[current_player;main;5,3.5;8,4;]".. + "list[current_player;craft;8,0;3,3;]".. + "list[current_player;craftpreview;12,1;1,1;]".. + "list[detached:creative;main;0.3,0.5;4,6;"..tostring(start_i).."]".. + "label[2.0,6.55;"..tostring(pagenum).."/"..tostring(pagemax).."]".. + "button[0.3,6.5;1.6,1;creative_prev;<<]".. + "button[2.7,6.5;1.6,1;creative_next;>>]") +end +minetest.register_on_joinplayer(function(player) + -- If in creative mode, modify player's inventory forms + if not minetest.setting_getbool("creative_mode") then + return + end + creative_inventory.set_creative_formspec(player, 0, 1) +end) +minetest.register_on_player_receive_fields(function(player, formname, fields) + if not minetest.setting_getbool("creative_mode") then + return + end + -- Figure out current page from formspec + local current_page = 0 + local formspec = player:get_inventory_formspec() + local start_i = string.match(formspec, "list%[detached:creative;main;[%d.]+,[%d.]+;[%d.]+,[%d.]+;(%d+)%]") + start_i = tonumber(start_i) or 0 + + if fields.creative_prev then + start_i = start_i - 4*6 + end + if fields.creative_next then + start_i = start_i + 4*6 + end + + if start_i < 0 then + start_i = start_i + 4*6 + end + if start_i >= creative_inventory.creative_inventory_size then + start_i = start_i - 4*6 + end + + if start_i < 0 or start_i >= creative_inventory.creative_inventory_size then + start_i = 0 + end + + creative_inventory.set_creative_formspec(player, start_i, start_i / (6*4) + 1) +end) + diff --git a/mods/default/README.txt b/mods/default/README.txt new file mode 100644 index 0000000..23e6aad --- /dev/null +++ b/mods/default/README.txt @@ -0,0 +1,70 @@ +Minetest 0.4 mod: default +========================== + +License of source code: +----------------------- +Copyright (C) 2011-2012 celeron55, Perttu Ahola + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 2.1 of the License, or +(at your option) any later version. + +http://www.gnu.org/licenses/lgpl-2.1.html + +License of media (textures and sounds) +-------------------------------------- +Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) +http://creativecommons.org/licenses/by-sa/3.0/ + +Authors of media files +----------------------- +Everything not listed in here: +Copyright (C) 2010-2012 celeron55, Perttu Ahola + +Originating from work by kddekadenz/Dogers: + default_grass_footstep.{1,2,3}.ogg + default_dig_crumbly.{1,2}.ogg + +Cisoun's WTFPL texture pack: + default_chest_front.png + default_chest_lock.png + default_chest_side.png + default_chest_top.png + default_cobble.png + default_dirt.png + default_grass.png + default_grass_side.png + default_jungletree.png + default_jungletree_top.png + default_lava.png + default_leaves.png + default_mossycobble.png + default_sand.png + default_sapling.png + default_sign_wall.png + default_stone.png + default_tool_mesepick.png + default_tool_steelpick.png + default_tool_steelshovel.png + default_tool_steelsword.png + default_tool_stonepick.png + default_tool_stoneshovel.png + default_tool_woodpick.png + default_tool_woodshovel.png + default_tree.png + default_tree_top.png + default_water.png + +Originating from G4JC's Almost MC Texture Pack: + default_wood.png + default_torch.png + default_torch_on_ceiling.png + default_torch_on_floor.png + +VanessaE's animated torches (WTFPL): + default_torch_animated.png + default_torch_on_ceiling_animated.png + default_torch_on_floor_animated.png + default_torch_on_floor.png + diff --git a/mods/default/init.lua b/mods/default/init.lua new file mode 100644 index 0000000..763a039 --- /dev/null +++ b/mods/default/init.lua @@ -0,0 +1,1764 @@ +-- Minetest 0.4 mod: default +-- See README.txt for licensing and other information. + +-- The API documentation in here was moved into doc/lua_api.txt + +WATER_ALPHA = 160 +WATER_VISC = 1 +LAVA_VISC = 7 +LIGHT_MAX = 14 + +-- Definitions made by this mod that other mods can use too +default = {} + +-- Load other files +dofile(minetest.get_modpath("default").."/mapgen.lua") +dofile(minetest.get_modpath("default").."/leafdecay.lua") + +-- +-- Tool definition +-- + +-- The hand +minetest.register_item(":", { + type = "none", + wield_image = "wieldhand.png", + wield_scale = {x=1,y=1,z=2.5}, + tool_capabilities = { + full_punch_interval = 1.0, + max_drop_level = 0, + groupcaps = { + fleshy = {times={[2]=2.00, [3]=1.00}, uses=0, maxlevel=1}, + crumbly = {times={[2]=3.00, [3]=0.70}, uses=0, maxlevel=1}, + snappy = {times={[3]=0.40}, uses=0, maxlevel=1}, + oddly_breakable_by_hand = {times={[1]=7.00,[2]=4.00,[3]=1.40}, uses=0, maxlevel=3}, + } + } +}) + +minetest.register_tool("default:pick_wood", { + description = "Wooden Pickaxe", + inventory_image = "default_tool_woodpick.png", + tool_capabilities = { + max_drop_level=0, + groupcaps={ + cracky={times={[2]=2.00, [3]=1.20}, uses=10, maxlevel=1} + } + }, +}) +minetest.register_tool("default:pick_stone", { + description = "Stone Pickaxe", + inventory_image = "default_tool_stonepick.png", + tool_capabilities = { + max_drop_level=0, + groupcaps={ + cracky={times={[1]=3.00, [2]=1.20, [3]=0.80}, uses=20, maxlevel=1} + } + }, +}) +minetest.register_tool("default:pick_steel", { + description = "Steel Pickaxe", + inventory_image = "default_tool_steelpick.png", + tool_capabilities = { + max_drop_level=1, + groupcaps={ + cracky={times={[1]=4.00, [2]=1.60, [3]=1.00}, uses=30, maxlevel=2} + } + }, +}) +minetest.register_tool("default:pick_mese", { + description = "Mese Pickaxe", + inventory_image = "default_tool_mesepick.png", + tool_capabilities = { + full_punch_interval = 1.0, + max_drop_level=3, + groupcaps={ + cracky={times={[1]=2.0, [2]=1.0, [3]=0.5}, uses=20, maxlevel=3}, + crumbly={times={[1]=2.0, [2]=1.0, [3]=0.5}, uses=20, maxlevel=3}, + snappy={times={[1]=2.0, [2]=1.0, [3]=0.5}, uses=20, maxlevel=3} + } + }, +}) +minetest.register_tool("default:shovel_wood", { + description = "Wooden Shovel", + inventory_image = "default_tool_woodshovel.png", + tool_capabilities = { + max_drop_level=0, + groupcaps={ + crumbly={times={[1]=3.00, [2]=0.80, [3]=0.50}, uses=10, maxlevel=1} + } + }, +}) +minetest.register_tool("default:shovel_stone", { + description = "Stone Shovel", + inventory_image = "default_tool_stoneshovel.png", + tool_capabilities = { + max_drop_level=0, + groupcaps={ + crumbly={times={[1]=1.50, [2]=0.50, [3]=0.30}, uses=20, maxlevel=1} + } + }, +}) +minetest.register_tool("default:shovel_steel", { + description = "Steel Shovel", + inventory_image = "default_tool_steelshovel.png", + tool_capabilities = { + max_drop_level=1, + groupcaps={ + crumbly={times={[1]=1.50, [2]=0.70, [3]=0.60}, uses=30, maxlevel=2} + } + }, +}) +minetest.register_tool("default:axe_wood", { + description = "Wooden Axe", + inventory_image = "default_tool_woodaxe.png", + tool_capabilities = { + max_drop_level=0, + groupcaps={ + choppy={times={[2]=1.40, [3]=0.80}, uses=10, maxlevel=1}, + fleshy={times={[2]=1.50, [3]=0.80}, uses=10, maxlevel=1} + } + }, +}) +minetest.register_tool("default:axe_stone", { + description = "Stone Axe", + inventory_image = "default_tool_stoneaxe.png", + tool_capabilities = { + max_drop_level=0, + groupcaps={ + choppy={times={[1]=3.00, [2]=1.00, [3]=0.60}, uses=20, maxlevel=1}, + fleshy={times={[2]=1.30, [3]=0.70}, uses=20, maxlevel=1} + } + }, +}) +minetest.register_tool("default:axe_steel", { + description = "Steel Axe", + inventory_image = "default_tool_steelaxe.png", + tool_capabilities = { + max_drop_level=1, + groupcaps={ + choppy={times={[1]=3.00, [2]=1.60, [3]=1.00}, uses=30, maxlevel=2}, + fleshy={times={[2]=1.10, [3]=0.60}, uses=40, maxlevel=1} + } + }, +}) +minetest.register_tool("default:sword_wood", { + description = "Wooden Sword", + inventory_image = "default_tool_woodsword.png", + tool_capabilities = { + full_punch_interval = 1.0, + max_drop_level=0, + groupcaps={ + fleshy={times={[2]=1.10, [3]=0.60}, uses=10, maxlevel=1}, + snappy={times={[2]=1.00, [3]=0.50}, uses=10, maxlevel=1}, + choppy={times={[3]=1.00}, uses=20, maxlevel=0} + } + } +}) +minetest.register_tool("default:sword_stone", { + description = "Stone Sword", + inventory_image = "default_tool_stonesword.png", + tool_capabilities = { + full_punch_interval = 1.0, + max_drop_level=0, + groupcaps={ + fleshy={times={[2]=0.80, [3]=0.40}, uses=20, maxlevel=1}, + snappy={times={[2]=0.80, [3]=0.40}, uses=20, maxlevel=1}, + choppy={times={[3]=0.90}, uses=20, maxlevel=0} + } + } +}) +minetest.register_tool("default:sword_steel", { + description = "Steel Sword", + inventory_image = "default_tool_steelsword.png", + tool_capabilities = { + full_punch_interval = 1.0, + max_drop_level=1, + groupcaps={ + fleshy={times={[1]=2.00, [2]=0.80, [3]=0.40}, uses=10, maxlevel=2}, + snappy={times={[2]=0.70, [3]=0.30}, uses=40, maxlevel=1}, + choppy={times={[3]=0.70}, uses=40, maxlevel=0} + } + } +}) + +-- +-- Crafting definition +-- + +minetest.register_craft({ + output = 'default:wood 4', + recipe = { + {'default:tree'}, + } +}) + +minetest.register_craft({ + output = 'default:stick 4', + recipe = { + {'default:wood'}, + } +}) + +minetest.register_craft({ + output = 'default:fence_wood 2', + recipe = { + {'default:stick', 'default:stick', 'default:stick'}, + {'default:stick', 'default:stick', 'default:stick'}, + } +}) + +minetest.register_craft({ + output = 'default:sign_wall', + recipe = { + {'default:wood', 'default:wood', 'default:wood'}, + {'default:wood', 'default:wood', 'default:wood'}, + {'', 'default:stick', ''}, + } +}) + +minetest.register_craft({ + output = 'default:torch 4', + recipe = { + {'default:coal_lump'}, + {'default:stick'}, + } +}) + +minetest.register_craft({ + output = 'default:pick_wood', + recipe = { + {'default:wood', 'default:wood', 'default:wood'}, + {'', 'default:stick', ''}, + {'', 'default:stick', ''}, + } +}) + +minetest.register_craft({ + output = 'default:pick_stone', + recipe = { + {'default:cobble', 'default:cobble', 'default:cobble'}, + {'', 'default:stick', ''}, + {'', 'default:stick', ''}, + } +}) + +minetest.register_craft({ + output = 'default:pick_steel', + recipe = { + {'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot'}, + {'', 'default:stick', ''}, + {'', 'default:stick', ''}, + } +}) + +minetest.register_craft({ + output = 'default:pick_mese', + recipe = { + {'default:mese', 'default:mese', 'default:mese'}, + {'', 'default:stick', ''}, + {'', 'default:stick', ''}, + } +}) + +minetest.register_craft({ + output = 'default:shovel_wood', + recipe = { + {'default:wood'}, + {'default:stick'}, + {'default:stick'}, + } +}) + +minetest.register_craft({ + output = 'default:shovel_stone', + recipe = { + {'default:cobble'}, + {'default:stick'}, + {'default:stick'}, + } +}) + +minetest.register_craft({ + output = 'default:shovel_steel', + recipe = { + {'default:steel_ingot'}, + {'default:stick'}, + {'default:stick'}, + } +}) + +minetest.register_craft({ + output = 'default:axe_wood', + recipe = { + {'default:wood', 'default:wood'}, + {'default:wood', 'default:stick'}, + {'', 'default:stick'}, + } +}) + +minetest.register_craft({ + output = 'default:axe_stone', + recipe = { + {'default:cobble', 'default:cobble'}, + {'default:cobble', 'default:stick'}, + {'', 'default:stick'}, + } +}) + +minetest.register_craft({ + output = 'default:axe_steel', + recipe = { + {'default:steel_ingot', 'default:steel_ingot'}, + {'default:steel_ingot', 'default:stick'}, + {'', 'default:stick'}, + } +}) + +minetest.register_craft({ + output = 'default:sword_wood', + recipe = { + {'default:wood'}, + {'default:wood'}, + {'default:stick'}, + } +}) + +minetest.register_craft({ + output = 'default:sword_stone', + recipe = { + {'default:cobble'}, + {'default:cobble'}, + {'default:stick'}, + } +}) + +minetest.register_craft({ + output = 'default:sword_steel', + recipe = { + {'default:steel_ingot'}, + {'default:steel_ingot'}, + {'default:stick'}, + } +}) + +minetest.register_craft({ + output = 'default:rail 15', + recipe = { + {'default:steel_ingot', '', 'default:steel_ingot'}, + {'default:steel_ingot', 'default:stick', 'default:steel_ingot'}, + {'default:steel_ingot', '', 'default:steel_ingot'}, + } +}) + +minetest.register_craft({ + output = 'default:chest', + recipe = { + {'default:wood', 'default:wood', 'default:wood'}, + {'default:wood', '', 'default:wood'}, + {'default:wood', 'default:wood', 'default:wood'}, + } +}) + +minetest.register_craft({ + output = 'default:chest_locked', + recipe = { + {'default:wood', 'default:wood', 'default:wood'}, + {'default:wood', 'default:steel_ingot', 'default:wood'}, + {'default:wood', 'default:wood', 'default:wood'}, + } +}) + +minetest.register_craft({ + output = 'default:furnace', + recipe = { + {'default:cobble', 'default:cobble', 'default:cobble'}, + {'default:cobble', '', 'default:cobble'}, + {'default:cobble', 'default:cobble', 'default:cobble'}, + } +}) + +minetest.register_craft({ + output = 'default:steelblock', + recipe = { + {'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot'}, + {'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot'}, + {'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot'}, + } +}) + +minetest.register_craft({ + output = 'default:sandstone', + recipe = { + {'default:sand', 'default:sand'}, + {'default:sand', 'default:sand'}, + } +}) + +minetest.register_craft({ + output = 'default:clay', + recipe = { + {'default:clay_lump', 'default:clay_lump'}, + {'default:clay_lump', 'default:clay_lump'}, + } +}) + +minetest.register_craft({ + output = 'default:brick', + recipe = { + {'default:clay_brick', 'default:clay_brick'}, + {'default:clay_brick', 'default:clay_brick'}, + } +}) + +minetest.register_craft({ + output = 'default:paper', + recipe = { + {'default:papyrus', 'default:papyrus', 'default:papyrus'}, + } +}) + +minetest.register_craft({ + output = 'default:book', + recipe = { + {'default:paper'}, + {'default:paper'}, + {'default:paper'}, + } +}) + +minetest.register_craft({ + output = 'default:bookshelf', + recipe = { + {'default:wood', 'default:wood', 'default:wood'}, + {'default:book', 'default:book', 'default:book'}, + {'default:wood', 'default:wood', 'default:wood'}, + } +}) + +minetest.register_craft({ + output = 'default:ladder', + recipe = { + {'default:stick', '', 'default:stick'}, + {'default:stick', 'default:stick', 'default:stick'}, + {'default:stick', '', 'default:stick'}, + } +}) + +-- +-- Crafting (tool repair) +-- +minetest.register_craft({ + type = "toolrepair", + additional_wear = -0.02, +}) + +-- +-- Cooking recipes +-- + +minetest.register_craft({ + type = "cooking", + output = "default:glass", + recipe = "default:sand", +}) + +minetest.register_craft({ + type = "cooking", + output = "default:glass", + recipe = "default:desert_sand", +}) + +minetest.register_craft({ + type = "cooking", + output = "default:stone", + recipe = "default:cobble", +}) + +minetest.register_craft({ + type = "cooking", + output = "default:steel_ingot", + recipe = "default:iron_lump", +}) + +minetest.register_craft({ + type = "cooking", + output = "default:clay_brick", + recipe = "default:clay_lump", +}) + +-- +-- Fuels +-- + +minetest.register_craft({ + type = "fuel", + recipe = "default:tree", + burntime = 30, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:jungletree", + burntime = 30, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:junglegrass", + burntime = 2, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:leaves", + burntime = 1, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:cactus", + burntime = 15, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:papyrus", + burntime = 1, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:bookshelf", + burntime = 30, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:fence_wood", + burntime = 15, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:ladder", + burntime = 5, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:wood", + burntime = 7, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:mese", + burntime = 30, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:lava_source", + burntime = 60, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:torch", + burntime = 4, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:sign_wall", + burntime = 10, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:chest", + burntime = 30, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:chest_locked", + burntime = 30, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:nyancat", + burntime = 1, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:nyancat_rainbow", + burntime = 1, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:sapling", + burntime = 10, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:apple", + burntime = 3, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:coal_lump", + burntime = 40, +}) + +-- +-- Node definitions +-- + +-- Default node sounds + +function default.node_sound_defaults(table) + table = table or {} + table.footstep = table.footstep or + {name="", gain=1.0} + table.dug = table.dug or + {name="default_dug_node", gain=1.0} + return table +end + +function default.node_sound_stone_defaults(table) + table = table or {} + table.footstep = table.footstep or + {name="default_hard_footstep", gain=0.2} + default.node_sound_defaults(table) + return table +end + +function default.node_sound_dirt_defaults(table) + table = table or {} + table.footstep = table.footstep or + {name="", gain=0.5} + --table.dug = table.dug or + -- {name="default_dirt_break", gain=0.5} + default.node_sound_defaults(table) + return table +end + +function default.node_sound_sand_defaults(table) + table = table or {} + table.footstep = table.footstep or + {name="default_grass_footstep", gain=0.25} + --table.dug = table.dug or + -- {name="default_dirt_break", gain=0.25} + table.dug = table.dug or + {name="", gain=0.25} + default.node_sound_defaults(table) + return table +end + +function default.node_sound_wood_defaults(table) + table = table or {} + table.footstep = table.footstep or + {name="default_hard_footstep", gain=0.3} + default.node_sound_defaults(table) + return table +end + +function default.node_sound_leaves_defaults(table) + table = table or {} + table.footstep = table.footstep or + {name="default_grass_footstep", gain=0.25} + table.dig = table.dig or + {name="default_dig_crumbly", gain=0.4} + table.dug = table.dug or + {name="", gain=1.0} + default.node_sound_defaults(table) + return table +end + +function default.node_sound_glass_defaults(table) + table = table or {} + table.footstep = table.footstep or + {name="default_stone_footstep", gain=0.25} + table.dug = table.dug or + {name="default_break_glass", gain=1.0} + default.node_sound_defaults(table) + return table +end + +-- + +minetest.register_node("default:stone", { + description = "Stone", + tiles = {"default_stone.png"}, + is_ground_content = true, + groups = {cracky=3}, + drop = 'default:cobble', + legacy_mineral = true, + sounds = default.node_sound_stone_defaults(), +}) + +minetest.register_node("default:desert_stone", { + description = "Desert Stone", + tiles = {"default_desert_stone.png"}, + is_ground_content = true, + groups = {cracky=3}, + drop = 'default:desert_stone', + legacy_mineral = true, + sounds = default.node_sound_stone_defaults(), +}) + +minetest.register_node("default:stone_with_coal", { + description = "Coal Ore", + tiles = {"default_stone.png^default_mineral_coal.png"}, + is_ground_content = true, + groups = {cracky=3}, + drop = 'default:coal_lump', + sounds = default.node_sound_stone_defaults(), +}) + +minetest.register_node("default:stone_with_iron", { + description = "Iron Ore", + tiles = {"default_stone.png^default_mineral_iron.png"}, + is_ground_content = true, + groups = {cracky=3}, + drop = 'default:iron_lump', + sounds = default.node_sound_stone_defaults(), +}) + +minetest.register_node("default:dirt_with_grass", { + description = "Dirt with Grass", + tiles = {"default_grass.png", "default_dirt.png", "default_dirt.png^default_grass_side.png"}, + is_ground_content = true, + groups = {crumbly=3}, + drop = 'default:dirt', + sounds = default.node_sound_dirt_defaults({ + footstep = {name="default_grass_footstep", gain=0.4}, + }), +}) + +minetest.register_node("default:dirt_with_grass_footsteps", { + description = "Dirt with Grass and Footsteps", + tiles = {"default_grass_footsteps.png", "default_dirt.png", "default_dirt.png^default_grass_side.png"}, + is_ground_content = true, + groups = {crumbly=3, not_in_creative_inventory=1}, + drop = 'default:dirt', + sounds = default.node_sound_dirt_defaults({ + footstep = {name="default_grass_footstep", gain=0.4}, + }), +}) + +minetest.register_node("default:dirt", { + description = "Dirt", + tiles = {"default_dirt.png"}, + is_ground_content = true, + groups = {crumbly=3}, + sounds = default.node_sound_dirt_defaults(), +}) + +minetest.register_node("default:sand", { + description = "Sand", + tiles = {"default_sand.png"}, + is_ground_content = true, + groups = {crumbly=3, falling_node=1}, + sounds = default.node_sound_sand_defaults(), +}) + +minetest.register_node("default:desert_sand", { + description = "Desert Sand", + tiles = {"default_desert_sand.png"}, + is_ground_content = true, + groups = {sand=1, crumbly=3, falling_node=1}, + sounds = default.node_sound_sand_defaults(), +}) + +minetest.register_node("default:gravel", { + description = "Gravel", + tiles = {"default_gravel.png"}, + is_ground_content = true, + groups = {crumbly=2, falling_node=1}, + sounds = default.node_sound_dirt_defaults({ + footstep = {name="default_gravel_footstep", gain=0.45}, + }), +}) + +minetest.register_node("default:sandstone", { + description = "Sandstone", + tiles = {"default_sandstone.png"}, + is_ground_content = true, + groups = {crumbly=2,cracky=2}, + drop = 'default:sand', + sounds = default.node_sound_stone_defaults(), +}) + +minetest.register_node("default:clay", { + description = "Clay", + tiles = {"default_clay.png"}, + is_ground_content = true, + groups = {crumbly=3}, + drop = 'default:clay_lump 4', + sounds = default.node_sound_dirt_defaults({ + footstep = "", + }), +}) + +minetest.register_node("default:brick", { + description = "Brick Block", + tiles = {"default_brick.png"}, + is_ground_content = true, + groups = {cracky=3}, + drop = 'default:clay_brick 4', + sounds = default.node_sound_stone_defaults(), +}) + +minetest.register_node("default:tree", { + description = "Tree", + tiles = {"default_tree_top.png", "default_tree_top.png", "default_tree.png"}, + is_ground_content = true, + groups = {tree=1,snappy=1,choppy=2,oddly_breakable_by_hand=1,flammable=2}, + sounds = default.node_sound_wood_defaults(), +}) + +minetest.register_node("default:jungletree", { + description = "Jungle Tree", + tiles = {"default_jungletree_top.png", "default_jungletree_top.png", "default_jungletree.png"}, + is_ground_content = true, + groups = {tree=1,snappy=1,choppy=2,oddly_breakable_by_hand=1,flammable=2}, + sounds = default.node_sound_wood_defaults(), +}) + +minetest.register_node("default:junglegrass", { + description = "Jungle Grass", + drawtype = "plantlike", + visual_scale = 1.3, + tiles = {"default_junglegrass.png"}, + inventory_image = "default_junglegrass.png", + wield_image = "default_junglegrass.png", + paramtype = "light", + walkable = false, + groups = {snappy=3,flammable=2}, + sounds = default.node_sound_leaves_defaults(), +}) + +minetest.register_node("default:leaves", { + description = "Leaves", + drawtype = "allfaces_optional", + visual_scale = 1.3, + tiles = {"default_leaves.png"}, + paramtype = "light", + groups = {snappy=3, leafdecay=3, flammable=2}, + drop = { + max_items = 1, + items = { + { + -- player will get sapling with 1/20 chance + items = {'default:sapling'}, + rarity = 20, + }, + { + -- player will get leaves only if he get no saplings, + -- this is because max_items is 1 + items = {'default:leaves'}, + } + } + }, + sounds = default.node_sound_leaves_defaults(), +}) + +minetest.register_node("default:cactus", { + description = "Cactus", + tiles = {"default_cactus_top.png", "default_cactus_top.png", "default_cactus_side.png"}, + is_ground_content = true, + groups = {snappy=2,choppy=3,flammable=2}, + sounds = default.node_sound_wood_defaults(), +}) + +minetest.register_node("default:papyrus", { + description = "Papyrus", + drawtype = "plantlike", + tiles = {"default_papyrus.png"}, + inventory_image = "default_papyrus.png", + wield_image = "default_papyrus.png", + paramtype = "light", + is_ground_content = true, + walkable = false, + groups = {snappy=3,flammable=2}, + sounds = default.node_sound_leaves_defaults(), +}) + +minetest.register_node("default:bookshelf", { + description = "Bookshelf", + tiles = {"default_wood.png", "default_wood.png", "default_bookshelf.png"}, + is_ground_content = true, + groups = {snappy=2,choppy=3,oddly_breakable_by_hand=2,flammable=3}, + sounds = default.node_sound_wood_defaults(), +}) + +minetest.register_node("default:glass", { + description = "Glass", + drawtype = "glasslike", + tiles = {"default_glass.png"}, + inventory_image = minetest.inventorycube("default_glass.png"), + paramtype = "light", + sunlight_propagates = true, + is_ground_content = true, + groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3}, + sounds = default.node_sound_glass_defaults(), +}) + +minetest.register_node("default:fence_wood", { + description = "Wooden Fence", + drawtype = "fencelike", + tiles = {"default_wood.png"}, + inventory_image = "default_fence.png", + wield_image = "default_fence.png", + paramtype = "light", + is_ground_content = true, + selection_box = { + type = "fixed", + fixed = {-1/7, -1/2, -1/7, 1/7, 1/2, 1/7}, + }, + groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=2}, + sounds = default.node_sound_wood_defaults(), +}) + +minetest.register_node("default:rail", { + description = "Rail", + drawtype = "raillike", + tiles = {"default_rail.png", "default_rail_curved.png", "default_rail_t_junction.png", "default_rail_crossing.png"}, + inventory_image = "default_rail.png", + wield_image = "default_rail.png", + paramtype = "light", + is_ground_content = true, + walkable = false, + selection_box = { + type = "fixed", + -- but how to specify the dimensions for curved and sideways rails? + fixed = {-1/2, -1/2, -1/2, 1/2, -1/2+1/16, 1/2}, + }, + groups = {bendy=2,snappy=1,dig_immediate=2}, +}) + +minetest.register_node("default:ladder", { + description = "Ladder", + drawtype = "signlike", + tiles = {"default_ladder.png"}, + inventory_image = "default_ladder.png", + wield_image = "default_ladder.png", + paramtype = "light", + paramtype2 = "wallmounted", + is_ground_content = true, + walkable = false, + climbable = true, + selection_box = { + type = "wallmounted", + --wall_top = = + --wall_bottom = = + --wall_side = = + }, + groups = {snappy=1,choppy=2,oddly_breakable_by_hand=3,flammable=2}, + legacy_wallmounted = true, + sounds = default.node_sound_wood_defaults(), +}) + +minetest.register_node("default:wood", { + description = "Wooden Planks", + tiles = {"default_wood.png"}, + is_ground_content = true, + groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=3}, + sounds = default.node_sound_wood_defaults(), +}) + +minetest.register_node("default:mese", { + description = "Mese", + tiles = {"default_mese.png"}, + is_ground_content = true, + groups = {cracky=1}, + sounds = default.node_sound_defaults(), +}) + +minetest.register_node("default:cloud", { + description = "Cloud", + tiles = {"default_cloud.png"}, + is_ground_content = true, + sounds = default.node_sound_defaults(), + groups = {not_in_creative_inventory=1}, +}) + +minetest.register_node("default:water_flowing", { + description = "Flowing Water", + inventory_image = minetest.inventorycube("default_water.png"), + drawtype = "flowingliquid", + tiles = {"default_water.png"}, + special_tiles = { + {name="default_water.png", backface_culling=false}, + {name="default_water.png", backface_culling=true}, + }, + alpha = WATER_ALPHA, + paramtype = "light", + walkable = false, + pointable = false, + diggable = false, + buildable_to = true, + liquidtype = "flowing", + liquid_alternative_flowing = "default:water_flowing", + liquid_alternative_source = "default:water_source", + liquid_viscosity = WATER_VISC, + post_effect_color = {a=64, r=100, g=100, b=200}, + groups = {water=3, liquid=3, puts_out_fire=1, not_in_creative_inventory=1}, +}) + +minetest.register_node("default:water_source", { + description = "Water Source", + inventory_image = minetest.inventorycube("default_water.png"), + drawtype = "liquid", + tiles = {"default_water.png"}, + special_tiles = { + -- New-style water source material (mostly unused) + {name="default_water.png", backface_culling=false}, + }, + alpha = WATER_ALPHA, + paramtype = "light", + walkable = false, + pointable = false, + diggable = false, + buildable_to = true, + liquidtype = "source", + liquid_alternative_flowing = "default:water_flowing", + liquid_alternative_source = "default:water_source", + liquid_viscosity = WATER_VISC, + post_effect_color = {a=64, r=100, g=100, b=200}, + groups = {water=3, liquid=3, puts_out_fire=1}, +}) + +minetest.register_node("default:lava_flowing", { + description = "Flowing Lava", + inventory_image = minetest.inventorycube("default_lava.png"), + drawtype = "flowingliquid", + tiles = {"default_lava.png"}, + special_tiles = { + { + image="default_lava_flowing_animated.png", + backface_culling=false, + animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=3.3} + }, + { + image="default_lava_flowing_animated.png", + backface_culling=true, + animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=3.3} + }, + }, + paramtype = "light", + light_source = LIGHT_MAX - 1, + walkable = false, + pointable = false, + diggable = false, + buildable_to = true, + liquidtype = "flowing", + liquid_alternative_flowing = "default:lava_flowing", + liquid_alternative_source = "default:lava_source", + liquid_viscosity = LAVA_VISC, + damage_per_second = 4*2, + post_effect_color = {a=192, r=255, g=64, b=0}, + groups = {lava=3, liquid=2, hot=3, igniter=1, not_in_creative_inventory=1}, +}) + +minetest.register_node("default:lava_source", { + description = "Lava Source", + inventory_image = minetest.inventorycube("default_lava.png"), + drawtype = "liquid", + tiles = { + {name="default_lava_source_animated.png", animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=3.0}} + }, + special_tiles = { + -- New-style lava source material (mostly unused) + {name="default_lava.png", backface_culling=false}, + }, + paramtype = "light", + light_source = LIGHT_MAX - 1, + walkable = false, + pointable = false, + diggable = false, + buildable_to = true, + liquidtype = "source", + liquid_alternative_flowing = "default:lava_flowing", + liquid_alternative_source = "default:lava_source", + liquid_viscosity = LAVA_VISC, + damage_per_second = 4*2, + post_effect_color = {a=192, r=255, g=64, b=0}, + groups = {lava=3, liquid=2, hot=3, igniter=1}, +}) + +minetest.register_node("default:torch", { + description = "Torch", + drawtype = "torchlike", + --tiles = {"default_torch_on_floor.png", "default_torch_on_ceiling.png", "default_torch.png"}, + tiles = { + {name="default_torch_on_floor_animated.png", animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=3.0}}, + {name="default_torch_on_ceiling_animated.png", animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=3.0}}, + {name="default_torch_animated.png", animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=3.0}} + }, + inventory_image = "default_torch_on_floor.png", + wield_image = "default_torch_on_floor.png", + paramtype = "light", + paramtype2 = "wallmounted", + sunlight_propagates = true, + walkable = false, + light_source = LIGHT_MAX-1, + selection_box = { + type = "wallmounted", + wall_top = {-0.1, 0.5-0.6, -0.1, 0.1, 0.5, 0.1}, + wall_bottom = {-0.1, -0.5, -0.1, 0.1, -0.5+0.6, 0.1}, + wall_side = {-0.5, -0.3, -0.1, -0.5+0.3, 0.3, 0.1}, + }, + groups = {choppy=2,dig_immediate=3,flammable=1}, + legacy_wallmounted = true, + sounds = default.node_sound_defaults(), +}) + +minetest.register_node("default:sign_wall", { + description = "Sign", + drawtype = "signlike", + tiles = {"default_sign_wall.png"}, + inventory_image = "default_sign_wall.png", + wield_image = "default_sign_wall.png", + paramtype = "light", + paramtype2 = "wallmounted", + sunlight_propagates = true, + walkable = false, + selection_box = { + type = "wallmounted", + --wall_top = + --wall_bottom = + --wall_side = + }, + groups = {choppy=2,dig_immediate=2}, + legacy_wallmounted = true, + sounds = default.node_sound_defaults(), + on_construct = function(pos) + --local n = minetest.env:get_node(pos) + local meta = minetest.env:get_meta(pos) + meta:set_string("formspec", "hack:sign_text_input") + meta:set_string("infotext", "\"\"") + end, + on_receive_fields = function(pos, formname, fields, sender) + --print("Sign at "..minetest.pos_to_string(pos).." got "..dump(fields)) + local meta = minetest.env:get_meta(pos) + fields.text = fields.text or "" + print((sender:get_player_name() or "").." wrote \""..fields.text.. + "\" to sign at "..minetest.pos_to_string(pos)) + meta:set_string("text", fields.text) + meta:set_string("infotext", '"'..fields.text..'"') + end, +}) + +minetest.register_node("default:chest", { + description = "Chest", + tiles = {"default_chest_top.png", "default_chest_top.png", "default_chest_side.png", + "default_chest_side.png", "default_chest_side.png", "default_chest_front.png"}, + paramtype2 = "facedir", + groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, + legacy_facedir_simple = true, + sounds = default.node_sound_wood_defaults(), + on_construct = function(pos) + local meta = minetest.env:get_meta(pos) + meta:set_string("formspec", + "size[8,9]".. + "list[current_name;main;0,0;8,4;]".. + "list[current_player;main;0,5;8,4;]") + meta:set_string("infotext", "Chest") + local inv = meta:get_inventory() + inv:set_size("main", 8*4) + end, + can_dig = function(pos,player) + local meta = minetest.env:get_meta(pos); + local inv = meta:get_inventory() + return inv:is_empty("main") + end, + on_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player) + minetest.log("action", player:get_player_name().. + " moves stuff in chest at "..minetest.pos_to_string(pos)) + end, + on_metadata_inventory_put = function(pos, listname, index, stack, player) + minetest.log("action", player:get_player_name().. + " moves stuff to chest at "..minetest.pos_to_string(pos)) + end, + on_metadata_inventory_take = function(pos, listname, index, stack, player) + minetest.log("action", player:get_player_name().. + " takes stuff from chest at "..minetest.pos_to_string(pos)) + end, +}) + +local function has_locked_chest_privilege(meta, player) + if player:get_player_name() ~= meta:get_string("owner") then + return false + end + return true +end + +minetest.register_node("default:chest_locked", { + description = "Locked Chest", + tiles = {"default_chest_top.png", "default_chest_top.png", "default_chest_side.png", + "default_chest_side.png", "default_chest_side.png", "default_chest_lock.png"}, + paramtype2 = "facedir", + groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, + legacy_facedir_simple = true, + sounds = default.node_sound_wood_defaults(), + after_place_node = function(pos, placer) + local meta = minetest.env:get_meta(pos) + meta:set_string("owner", placer:get_player_name() or "") + meta:set_string("infotext", "Locked Chest (owned by ".. + meta:get_string("owner")..")") + end, + on_construct = function(pos) + local meta = minetest.env:get_meta(pos) + meta:set_string("formspec", + "size[8,9]".. + "list[current_name;main;0,0;8,4;]".. + "list[current_player;main;0,5;8,4;]") + meta:set_string("infotext", "Locked Chest") + meta:set_string("owner", "") + local inv = meta:get_inventory() + inv:set_size("main", 8*4) + end, + can_dig = function(pos,player) + local meta = minetest.env:get_meta(pos); + local inv = meta:get_inventory() + return inv:is_empty("main") + end, + allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player) + local meta = minetest.env:get_meta(pos) + if not has_locked_chest_privilege(meta, player) then + minetest.log("action", player:get_player_name().. + " tried to access a locked chest belonging to ".. + meta:get_string("owner").." at ".. + minetest.pos_to_string(pos)) + return 0 + end + return count + end, + allow_metadata_inventory_put = function(pos, listname, index, stack, player) + local meta = minetest.env:get_meta(pos) + if not has_locked_chest_privilege(meta, player) then + minetest.log("action", player:get_player_name().. + " tried to access a locked chest belonging to ".. + meta:get_string("owner").." at ".. + minetest.pos_to_string(pos)) + return 0 + end + return stack:get_count() + end, + allow_metadata_inventory_take = function(pos, listname, index, stack, player) + local meta = minetest.env:get_meta(pos) + if not has_locked_chest_privilege(meta, player) then + minetest.log("action", player:get_player_name().. + " tried to access a locked chest belonging to ".. + meta:get_string("owner").." at ".. + minetest.pos_to_string(pos)) + return 0 + end + return stack:get_count() + end, + on_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player) + minetest.log("action", player:get_player_name().. + " moves stuff in locked chest at "..minetest.pos_to_string(pos)) + end, + on_metadata_inventory_put = function(pos, listname, index, stack, player) + minetest.log("action", player:get_player_name().. + " moves stuff to locked chest at "..minetest.pos_to_string(pos)) + end, + on_metadata_inventory_take = function(pos, listname, index, stack, player) + minetest.log("action", player:get_player_name().. + " takes stuff from locked chest at "..minetest.pos_to_string(pos)) + end, +}) + +default.furnace_inactive_formspec = + "size[8,9]".. + "image[2,2;1,1;default_furnace_fire_bg.png]".. + "list[current_name;fuel;2,3;1,1;]".. + "list[current_name;src;2,1;1,1;]".. + "list[current_name;dst;5,1;2,2;]".. + "list[current_player;main;0,5;8,4;]" + +minetest.register_node("default:furnace", { + description = "Furnace", + tiles = {"default_furnace_top.png", "default_furnace_bottom.png", "default_furnace_side.png", + "default_furnace_side.png", "default_furnace_side.png", "default_furnace_front.png"}, + paramtype2 = "facedir", + groups = {cracky=2}, + legacy_facedir_simple = true, + sounds = default.node_sound_stone_defaults(), + on_construct = function(pos) + local meta = minetest.env:get_meta(pos) + meta:set_string("formspec", default.furnace_inactive_formspec) + meta:set_string("infotext", "Furnace") + local inv = meta:get_inventory() + inv:set_size("fuel", 1) + inv:set_size("src", 1) + inv:set_size("dst", 4) + end, + can_dig = function(pos,player) + local meta = minetest.env:get_meta(pos); + local inv = meta:get_inventory() + if not inv:is_empty("fuel") then + return false + elseif not inv:is_empty("dst") then + return false + elseif not inv:is_empty("src") then + return false + end + return true + end, +}) + +minetest.register_node("default:furnace_active", { + description = "Furnace", + tiles = {"default_furnace_top.png", "default_furnace_bottom.png", "default_furnace_side.png", + "default_furnace_side.png", "default_furnace_side.png", "default_furnace_front_active.png"}, + paramtype2 = "facedir", + light_source = 8, + drop = "default:furnace", + groups = {cracky=2, not_in_creative_inventory=1}, + legacy_facedir_simple = true, + sounds = default.node_sound_stone_defaults(), + on_construct = function(pos) + local meta = minetest.env:get_meta(pos) + meta:set_string("formspec", default.furnace_inactive_formspec) + meta:set_string("infotext", "Furnace"); + local inv = meta:get_inventory() + inv:set_size("fuel", 1) + inv:set_size("src", 1) + inv:set_size("dst", 4) + end, + can_dig = function(pos,player) + local meta = minetest.env:get_meta(pos); + local inv = meta:get_inventory() + if not inv:is_empty("fuel") then + return false + elseif not inv:is_empty("dst") then + return false + elseif not inv:is_empty("src") then + return false + end + return true + end, +}) + +function hacky_swap_node(pos,name) + local node = minetest.env:get_node(pos) + local meta = minetest.env:get_meta(pos) + local meta0 = meta:to_table() + if node.name == name then + return + end + node.name = name + local meta0 = meta:to_table() + minetest.env:set_node(pos,node) + meta = minetest.env:get_meta(pos) + meta:from_table(meta0) +end + +minetest.register_abm({ + nodenames = {"default:furnace","default:furnace_active"}, + interval = 1.0, + chance = 1, + action = function(pos, node, active_object_count, active_object_count_wider) + local meta = minetest.env:get_meta(pos) + for i, name in ipairs({ + "fuel_totaltime", + "fuel_time", + "src_totaltime", + "src_time" + }) do + if meta:get_string(name) == "" then + meta:set_float(name, 0.0) + end + end + + local inv = meta:get_inventory() + + local srclist = inv:get_list("src") + local cooked = nil + + if srclist then + cooked = minetest.get_craft_result({method = "cooking", width = 1, items = srclist}) + end + + local was_active = false + + if meta:get_float("fuel_time") < meta:get_float("fuel_totaltime") then + was_active = true + meta:set_float("fuel_time", meta:get_float("fuel_time") + 1) + meta:set_float("src_time", meta:get_float("src_time") + 1) + if cooked and cooked.item and meta:get_float("src_time") >= cooked.time then + -- check if there's room for output in "dst" list + if inv:room_for_item("dst",cooked.item) then + -- Put result in "dst" list + inv:add_item("dst", cooked.item) + -- take stuff from "src" list + srcstack = inv:get_stack("src", 1) + srcstack:take_item() + inv:set_stack("src", 1, srcstack) + else + print("Could not insert '"..cooked.item:to_string().."'") + end + meta:set_string("src_time", 0) + end + end + + if meta:get_float("fuel_time") < meta:get_float("fuel_totaltime") then + local percent = math.floor(meta:get_float("fuel_time") / + meta:get_float("fuel_totaltime") * 100) + meta:set_string("infotext","Furnace active: "..percent.."%") + hacky_swap_node(pos,"default:furnace_active") + meta:set_string("formspec", + "size[8,9]".. + "image[2,2;1,1;default_furnace_fire_bg.png^[lowpart:".. + (100-percent)..":default_furnace_fire_fg.png]".. + "list[current_name;fuel;2,3;1,1;]".. + "list[current_name;src;2,1;1,1;]".. + "list[current_name;dst;5,1;2,2;]".. + "list[current_player;main;0,5;8,4;]") + return + end + + local fuel = nil + local cooked = nil + local fuellist = inv:get_list("fuel") + local srclist = inv:get_list("src") + + if srclist then + cooked = minetest.get_craft_result({method = "cooking", width = 1, items = srclist}) + end + if fuellist then + fuel = minetest.get_craft_result({method = "fuel", width = 1, items = fuellist}) + end + + if fuel.time <= 0 then + meta:set_string("infotext","Furnace out of fuel") + hacky_swap_node(pos,"default:furnace") + meta:set_string("formspec", default.furnace_inactive_formspec) + return + end + + if cooked.item:is_empty() then + if was_active then + meta:set_string("infotext","Furnace is empty") + hacky_swap_node(pos,"default:furnace") + meta:set_string("formspec", default.furnace_inactive_formspec) + end + return + end + + meta:set_string("fuel_totaltime", fuel.time) + meta:set_string("fuel_time", 0) + + local stack = inv:get_stack("fuel", 1) + stack:take_item() + inv:set_stack("fuel", 1, stack) + end, +}) + +minetest.register_node("default:cobble", { + description = "Cobblestone", + tiles = {"default_cobble.png"}, + is_ground_content = true, + groups = {cracky=3}, + sounds = default.node_sound_stone_defaults(), +}) + +minetest.register_node("default:mossycobble", { + description = "Mossy Cobblestone", + tiles = {"default_mossycobble.png"}, + is_ground_content = true, + groups = {cracky=3}, + sounds = default.node_sound_stone_defaults(), +}) + +minetest.register_node("default:steelblock", { + description = "Steel Block", + tiles = {"default_steel_block.png"}, + is_ground_content = true, + groups = {snappy=1,bendy=2,cracky=1,melty=2,level=2}, + sounds = default.node_sound_stone_defaults(), +}) + +minetest.register_node("default:nyancat", { + description = "Nyan Cat", + tiles = {"default_nc_side.png", "default_nc_side.png", "default_nc_side.png", + "default_nc_side.png", "default_nc_back.png", "default_nc_front.png"}, + inventory_image = "default_nc_front.png", + paramtype2 = "facedir", + groups = {cracky=2}, + legacy_facedir_simple = true, + sounds = default.node_sound_defaults(), +}) + +minetest.register_node("default:nyancat_rainbow", { + description = "Nyan Cat Rainbow", + tiles = {"default_nc_rb.png"}, + inventory_image = "default_nc_rb.png", + groups = {cracky=2}, + sounds = default.node_sound_defaults(), +}) + +minetest.register_node("default:sapling", { + description = "Sapling", + drawtype = "plantlike", + visual_scale = 1.0, + tiles = {"default_sapling.png"}, + inventory_image = "default_sapling.png", + wield_image = "default_sapling.png", + paramtype = "light", + walkable = false, + groups = {snappy=2,dig_immediate=3,flammable=2}, + sounds = default.node_sound_defaults(), +}) + +minetest.register_node("default:apple", { + description = "Apple", + drawtype = "plantlike", + visual_scale = 1.0, + tiles = {"default_apple.png"}, + inventory_image = "default_apple.png", + paramtype = "light", + sunlight_propagates = true, + walkable = false, + groups = {fleshy=3,dig_immediate=3,flammable=2}, + on_use = minetest.item_eat(4), + sounds = default.node_sound_defaults(), +}) + +minetest.register_node("default:dry_shrub", { + description = "Dry Shrub", + drawtype = "plantlike", + visual_scale = 1.0, + tiles = {"default_dry_shrub.png"}, + inventory_image = "default_dry_shrub.png", + wield_image = "default_dry_shrub.png", + paramtype = "light", + walkable = false, + groups = {snappy=3,flammable=3}, + sounds = default.node_sound_leaves_defaults(), + selection_box = { + type = "fixed", + fixed = {-1/3, -1/2, -1/3, 1/3, 1/6, 1/3}, + }, +}) + +-- +-- Crafting items +-- + +minetest.register_craftitem("default:stick", { + description = "Stick", + inventory_image = "default_stick.png", +}) + +minetest.register_craftitem("default:paper", { + description = "Paper", + inventory_image = "default_paper.png", +}) + +minetest.register_craftitem("default:book", { + description = "Book", + inventory_image = "default_book.png", +}) + +minetest.register_craftitem("default:coal_lump", { + description = "Coal Lump", + inventory_image = "default_coal_lump.png", +}) + +minetest.register_craftitem("default:iron_lump", { + description = "Iron Lump", + inventory_image = "default_iron_lump.png", +}) + +minetest.register_craftitem("default:clay_lump", { + description = "Clay Lump", + inventory_image = "default_clay_lump.png", +}) + +minetest.register_craftitem("default:steel_ingot", { + description = "Steel Ingot", + inventory_image = "default_steel_ingot.png", +}) + +minetest.register_craftitem("default:clay_brick", { + description = "Clay Brick", + inventory_image = "default_steel_ingot.png", + inventory_image = "default_clay_brick.png", +}) + +minetest.register_craftitem("default:scorched_stuff", { + description = "Scorched Stuff", + inventory_image = "default_scorched_stuff.png", +}) + +-- +-- Falling stuff +-- + +minetest.register_entity("default:falling_node", { + initial_properties = { + physical = true, + collisionbox = {-0.5,-0.5,-0.5, 0.5,0.5,0.5}, + visual = "wielditem", + textures = {}, + visual_size = {x=0.667, y=0.667}, + }, + + nodename = "", + + set_node = function(self, nodename) + self.nodename = nodename + local stack = ItemStack(nodename) + local itemtable = stack:to_table() + local itemname = nil + if itemtable then + itemname = stack:to_table().name + end + local item_texture = nil + local item_type = "" + if minetest.registered_items[itemname] then + item_texture = minetest.registered_items[itemname].inventory_image + item_type = minetest.registered_items[itemname].type + end + prop = { + is_visible = true, + textures = {nodename}, + } + self.object:set_properties(prop) + end, + + get_staticdata = function(self) + return self.nodename + end, + + on_activate = function(self, staticdata) + self.nodename = staticdata + self.object:set_armor_groups({immortal=1}) + --self.object:setacceleration({x=0, y=-10, z=0}) + self:set_node(self.nodename) + end, + + on_step = function(self, dtime) + -- Set gravity + self.object:setacceleration({x=0, y=-10, z=0}) + -- Turn to actual sand when collides to ground or just move + local pos = self.object:getpos() + local bcp = {x=pos.x, y=pos.y-0.7, z=pos.z} -- Position of bottom center point + local bcn = minetest.env:get_node(bcp) + -- Note: walkable is in the node definition, not in item groups + if minetest.registered_nodes[bcn.name] and + minetest.registered_nodes[bcn.name].walkable then + local np = {x=bcp.x, y=bcp.y+1, z=bcp.z} + -- Check what's here + local n2 = minetest.env:get_node(np) + -- If it's not air or liquid, remove node and replace it with + -- it's drops + if n2.name ~= "air" and (not minetest.registered_nodes[n2.name] or + minetest.registered_nodes[n2.name].liquidtype == "none") then + local drops = minetest.get_node_drops(n2.name, "") + minetest.env:remove_node(np) + -- Add dropped items + local _, dropped_item + for _, dropped_item in ipairs(drops) do + minetest.env:add_item(np, dropped_item) + end + -- Run script hook + local _, callback + for _, callback in ipairs(minetest.registered_on_dignodes) do + callback(np, n2, nil) + end + end + -- Create node and remove entity + minetest.env:add_node(np, {name=self.nodename}) + self.object:remove() + else + -- Do nothing + end + end +}) + +function default.spawn_falling_node(p, nodename) + obj = minetest.env:add_entity(p, "default:falling_node") + obj:get_luaentity():set_node(nodename) +end + +-- Horrible crap to support old code +-- Don't use this and never do what this does, it's completely wrong! +-- (More specifically, the client and the C++ code doesn't get the group) +function default.register_falling_node(nodename, texture) + minetest.log("error", debug.traceback()) + minetest.log('error', "WARNING: default.register_falling_node is deprecated") + if minetest.registered_nodes[nodename] then + minetest.registered_nodes[nodename].groups.falling_node = 1 + end +end + +-- +-- Some common functions +-- + +function nodeupdate_single(p) + n = minetest.env:get_node(p) + if minetest.get_node_group(n.name, "falling_node") ~= 0 then + p_bottom = {x=p.x, y=p.y-1, z=p.z} + n_bottom = minetest.env:get_node(p_bottom) + -- Note: walkable is in the node definition, not in item groups + if minetest.registered_nodes[n_bottom.name] and + not minetest.registered_nodes[n_bottom.name].walkable then + minetest.env:remove_node(p) + default.spawn_falling_node(p, n.name) + nodeupdate(p) + end + end +end + +function nodeupdate(p) + for x = -1,1 do + for y = -1,1 do + for z = -1,1 do + p2 = {x=p.x+x, y=p.y+y, z=p.z+z} + nodeupdate_single(p2) + end + end + end +end + +-- +-- Global callbacks +-- + +-- Global environment step function +function on_step(dtime) + -- print("on_step") +end +minetest.register_globalstep(on_step) + +function on_placenode(p, node) + --print("on_placenode") + nodeupdate(p) +end +minetest.register_on_placenode(on_placenode) + +function on_dignode(p, node) + --print("on_dignode") + nodeupdate(p) +end +minetest.register_on_dignode(on_dignode) + +function on_punchnode(p, node) +end +minetest.register_on_punchnode(on_punchnode) + +-- END diff --git a/mods/default/leafdecay.lua b/mods/default/leafdecay.lua new file mode 100644 index 0000000..8f4ff97 --- /dev/null +++ b/mods/default/leafdecay.lua @@ -0,0 +1,92 @@ +-- minetest/default/leafdecay.lua + +-- To enable leaf decay for a node, add it to the "leafdecay" group. +-- +-- The rating of the group determines how far from a node in the group "tree" +-- the node can be without decaying. +-- +-- If param2 of the node is ~= 0, the node will always be preserved. Thus, if +-- the player places a node of that kind, you will want to set param2=1 or so. + +default.leafdecay_trunk_cache = {} +default.leafdecay_enable_cache = true +-- Spread the load of finding trunks +default.leafdecay_trunk_find_allow_accumulator = 0 + +minetest.register_globalstep(function(dtime) + local finds_per_second = 5000 + default.leafdecay_trunk_find_allow_accumulator = + math.floor(dtime * finds_per_second) +end) + +minetest.register_abm({ + nodenames = {"group:leafdecay"}, + neighbors = {"air", "group:liquid"}, + -- A low interval and a high inverse chance spreads the load + interval = 2, + chance = 5, + + action = function(p0, node, _, _) + --print("leafdecay ABM at "..p0.x..", "..p0.y..", "..p0.z..")") + local do_preserve = false + local d = minetest.registered_nodes[node.name].groups.leafdecay + if not d or d == 0 then + --print("not groups.leafdecay") + return + end + local n0 = minetest.env:get_node(p0) + if n0.param2 ~= 0 then + --print("param2 ~= 0") + return + end + local p0_hash = nil + if default.leafdecay_enable_cache then + p0_hash = minetest.hash_node_position(p0) + local trunkp = default.leafdecay_trunk_cache[p0_hash] + if trunkp then + local n = minetest.env:get_node(trunkp) + local reg = minetest.registered_nodes[n.name] + -- Assume ignore is a trunk, to make the thing work at the border of the active area + if n.name == "ignore" or (reg.groups.tree and reg.groups.tree ~= 0) then + --print("cached trunk still exists") + return + end + --print("cached trunk is invalid") + -- Cache is invalid + table.remove(default.leafdecay_trunk_cache, p0_hash) + end + end + if default.leafdecay_trunk_find_allow_accumulator <= 0 then + return + end + default.leafdecay_trunk_find_allow_accumulator = + default.leafdecay_trunk_find_allow_accumulator - 1 + -- Assume ignore is a trunk, to make the thing work at the border of the active area + local p1 = minetest.env:find_node_near(p0, d, {"ignore", "group:tree"}) + if p1 then + do_preserve = true + if default.leafdecay_enable_cache then + --print("caching trunk") + -- Cache the trunk + default.leafdecay_trunk_cache[p0_hash] = p1 + end + end + if not do_preserve then + -- Drop stuff other than the node itself + itemstacks = minetest.get_node_drops(n0.name) + for _, itemname in ipairs(itemstacks) do + if itemname ~= n0.name then + local p_drop = { + x = p0.x - 0.5 + math.random(), + y = p0.y - 0.5 + math.random(), + z = p0.z - 0.5 + math.random(), + } + minetest.env:add_item(p_drop, itemname) + end + end + -- Remove node + minetest.env:remove_node(p0) + end + end +}) + diff --git a/mods/default/mapgen.lua b/mods/default/mapgen.lua new file mode 100644 index 0000000..35fc065 --- /dev/null +++ b/mods/default/mapgen.lua @@ -0,0 +1,275 @@ +-- minetest/default/mapgen.lua + +-- +-- Aliases for map generator outputs +-- + +minetest.register_alias("mapgen_air", "air") +minetest.register_alias("mapgen_stone", "default:stone") +minetest.register_alias("mapgen_tree", "default:tree") +minetest.register_alias("mapgen_leaves", "default:leaves") +minetest.register_alias("mapgen_apple", "default:apple") +minetest.register_alias("mapgen_water_source", "default:water_source") +minetest.register_alias("mapgen_dirt", "default:dirt") +minetest.register_alias("mapgen_sand", "default:sand") +minetest.register_alias("mapgen_gravel", "default:gravel") +minetest.register_alias("mapgen_clay", "default:clay") +minetest.register_alias("mapgen_lava_source", "default:lava_source") +minetest.register_alias("mapgen_cobble", "default:cobble") +minetest.register_alias("mapgen_mossycobble", "default:mossycobble") +minetest.register_alias("mapgen_dirt_with_grass", "default:dirt_with_grass") +minetest.register_alias("mapgen_junglegrass", "default:junglegrass") +minetest.register_alias("mapgen_stone_with_coal", "default:stone_with_coal") +minetest.register_alias("mapgen_stone_with_iron", "default:stone_with_iron") +minetest.register_alias("mapgen_mese", "default:mese") +minetest.register_alias("mapgen_desert_sand", "default:desert_sand") +minetest.register_alias("mapgen_desert_stone", "default:desert_stone") + +-- +-- Ore generation +-- + +local function generate_ore(name, wherein, minp, maxp, seed, chunks_per_volume, chunk_size, ore_per_chunk, height_min, height_max) + if maxp.y < height_min or minp.y > height_max then + return + end + local y_min = math.max(minp.y, height_min) + local y_max = math.min(maxp.y, height_max) + local volume = (maxp.x-minp.x+1)*(y_max-y_min+1)*(maxp.z-minp.z+1) + local pr = PseudoRandom(seed) + local num_chunks = math.floor(chunks_per_volume * volume) + local inverse_chance = math.floor(chunk_size*chunk_size*chunk_size / ore_per_chunk) + --print("generate_ore num_chunks: "..dump(num_chunks)) + for i=1,num_chunks do + local y0 = pr:next(y_min, y_max-chunk_size+1) + if y0 >= height_min and y0 <= height_max then + local x0 = pr:next(minp.x, maxp.x-chunk_size+1) + local z0 = pr:next(minp.z, maxp.z-chunk_size+1) + local p0 = {x=x0, y=y0, z=z0} + for x1=0,chunk_size-1 do + for y1=0,chunk_size-1 do + for z1=0,chunk_size-1 do + if pr:next(1,inverse_chance) == 1 then + local x2 = x0+x1 + local y2 = y0+y1 + local z2 = z0+z1 + local p2 = {x=x2, y=y2, z=z2} + if minetest.env:get_node(p2).name == wherein then + minetest.env:set_node(p2, {name=name}) + end + end + end + end + end + end + end + --print("generate_ore done") +end + +function default.make_papyrus(pos, size) + for y=0,size-1 do + local p = {x=pos.x, y=pos.y+y, z=pos.z} + minetest.env:set_node(p, {name="default:papyrus"}) + end +end + +function default.make_cactus(pos, size) + for y=0,size-1 do + local p = {x=pos.x, y=pos.y+y, z=pos.z} + minetest.env:set_node(p, {name="default:cactus"}) + end +end + +-- facedir: 0/1/2/3 (head node facedir value) +-- length: length of rainbow tail +function default.make_nyancat(pos, facedir, length) + local tailvec = {x=0, y=0, z=0} + if facedir == 0 then + tailvec.z = 1 + elseif facedir == 1 then + tailvec.x = 1 + elseif facedir == 2 then + tailvec.z = -1 + elseif facedir == 3 then + tailvec.x = -1 + else + print("default.make_nyancat(): Invalid facedir: "+dump(facedir)) + facedir = 0 + tailvec.z = 1 + end + local p = {x=pos.x, y=pos.y, z=pos.z} + minetest.env:set_node(p, {name="default:nyancat", param2=facedir}) + for i=1,length do + p.x = p.x + tailvec.x + p.z = p.z + tailvec.z + minetest.env:set_node(p, {name="default:nyancat_rainbow"}) + end +end + +function generate_nyancats(seed, minp, maxp) + local height_min = -31000 + local height_max = -32 + if maxp.y < height_min or minp.y > height_max then + return + end + local y_min = math.max(minp.y, height_min) + local y_max = math.min(maxp.y, height_max) + local volume = (maxp.x-minp.x+1)*(y_max-y_min+1)*(maxp.z-minp.z+1) + local pr = PseudoRandom(seed + 9324342) + local max_num_nyancats = math.floor(volume / (16*16*16)) + for i=1,max_num_nyancats do + if pr:next(0, 1000) == 0 then + local x0 = pr:next(minp.x, maxp.x) + local y0 = pr:next(minp.y, maxp.y) + local z0 = pr:next(minp.z, maxp.z) + local p0 = {x=x0, y=y0, z=z0} + default.make_nyancat(p0, pr:next(0,3), pr:next(3,15)) + end + end +end + +minetest.register_on_generated(function(minp, maxp, seed) + -- Generate regular ores + generate_ore("default:stone_with_coal", "default:stone", minp, maxp, seed+0, 1/8/8/8, 3, 8, -31000, 64) + generate_ore("default:stone_with_iron", "default:stone", minp, maxp, seed+1, 1/12/12/12, 2, 3, -15, 2) + generate_ore("default:stone_with_iron", "default:stone", minp, maxp, seed+2, 1/9/9/9, 3, 5, -63, -16) + generate_ore("default:stone_with_iron", "default:stone", minp, maxp, seed+3, 1/7/7/7, 3, 5, -31000, -64) + generate_ore("default:mese", "default:stone", minp, maxp, seed+4, 1/16/16/16, 2, 3, -127, -64) + generate_ore("default:mese", "default:stone", minp, maxp, seed+5, 1/9/9/9, 3, 5, -31000,-128) + + generate_ore("default:stone_with_coal", "default:stone", minp, maxp, seed+7, 1/24/24/24, 6,27, -31000, 0) + generate_ore("default:stone_with_iron", "default:stone", minp, maxp, seed+6, 1/24/24/24, 6,27, -31000, -64) + + if maxp.y >= 2 and minp.y <= 0 then + -- Generate clay + -- Assume X and Z lengths are equal + local divlen = 4 + local divs = (maxp.x-minp.x)/divlen+1; + for divx=0+1,divs-1-1 do + for divz=0+1,divs-1-1 do + local cx = minp.x + math.floor((divx+0.5)*divlen) + local cz = minp.z + math.floor((divz+0.5)*divlen) + if minetest.env:get_node({x=cx,y=1,z=cz}).name == "default:water_source" and + minetest.env:get_node({x=cx,y=0,z=cz}).name == "default:sand" then + local is_shallow = true + local num_water_around = 0 + if minetest.env:get_node({x=cx-divlen*2,y=1,z=cz+0}).name == "default:water_source" then + num_water_around = num_water_around + 1 end + if minetest.env:get_node({x=cx+divlen*2,y=1,z=cz+0}).name == "default:water_source" then + num_water_around = num_water_around + 1 end + if minetest.env:get_node({x=cx+0,y=1,z=cz-divlen*2}).name == "default:water_source" then + num_water_around = num_water_around + 1 end + if minetest.env:get_node({x=cx+0,y=1,z=cz+divlen*2}).name == "default:water_source" then + num_water_around = num_water_around + 1 end + if num_water_around >= 2 then + is_shallow = false + end + if is_shallow then + for x1=-divlen,divlen do + for z1=-divlen,divlen do + if minetest.env:get_node({x=cx+x1,y=0,z=cz+z1}).name == "default:sand" then + minetest.env:set_node({x=cx+x1,y=0,z=cz+z1}, {name="default:clay"}) + end + end + end + end + end + end + end + -- Generate papyrus + local perlin1 = minetest.env:get_perlin(354, 3, 0.7, 100) + -- Assume X and Z lengths are equal + local divlen = 8 + local divs = (maxp.x-minp.x)/divlen+1; + for divx=0,divs-1 do + for divz=0,divs-1 do + local x0 = minp.x + math.floor((divx+0)*divlen) + local z0 = minp.z + math.floor((divz+0)*divlen) + local x1 = minp.x + math.floor((divx+1)*divlen) + local z1 = minp.z + math.floor((divz+1)*divlen) + -- Determine papyrus amount from perlin noise + local papyrus_amount = math.floor(perlin1:get2d({x=x0, y=z0}) * 45 - 20) + -- Find random positions for papyrus based on this random + local pr = PseudoRandom(seed+1) + for i=0,papyrus_amount do + local x = pr:next(x0, x1) + local z = pr:next(z0, z1) + if minetest.env:get_node({x=x,y=1,z=z}).name == "default:dirt_with_grass" and + minetest.env:find_node_near({x=x,y=1,z=z}, 1, "default:water_source") then + default.make_papyrus({x=x,y=2,z=z}, pr:next(2, 4)) + end + end + end + end + -- Generate cactuses + local perlin1 = minetest.env:get_perlin(230, 3, 0.6, 100) + -- Assume X and Z lengths are equal + local divlen = 16 + local divs = (maxp.x-minp.x)/divlen+1; + for divx=0,divs-1 do + for divz=0,divs-1 do + local x0 = minp.x + math.floor((divx+0)*divlen) + local z0 = minp.z + math.floor((divz+0)*divlen) + local x1 = minp.x + math.floor((divx+1)*divlen) + local z1 = minp.z + math.floor((divz+1)*divlen) + -- Determine cactus amount from perlin noise + local cactus_amount = math.floor(perlin1:get2d({x=x0, y=z0}) * 6 - 3) + -- Find random positions for cactus based on this random + local pr = PseudoRandom(seed+1) + for i=0,cactus_amount do + local x = pr:next(x0, x1) + local z = pr:next(z0, z1) + -- Find ground level (0...15) + local ground_y = nil + for y=30,0,-1 do + if minetest.env:get_node({x=x,y=y,z=z}).name ~= "air" then + ground_y = y + break + end + end + -- If desert sand, make cactus + if ground_y and minetest.env:get_node({x=x,y=ground_y,z=z}).name == "default:desert_sand" then + default.make_cactus({x=x,y=ground_y+1,z=z}, pr:next(3, 4)) + end + end + end + end + -- Generate dry shrubs + local perlin1 = minetest.env:get_perlin(329, 3, 0.6, 100) + -- Assume X and Z lengths are equal + local divlen = 16 + local divs = (maxp.x-minp.x)/divlen+1; + for divx=0,divs-1 do + for divz=0,divs-1 do + local x0 = minp.x + math.floor((divx+0)*divlen) + local z0 = minp.z + math.floor((divz+0)*divlen) + local x1 = minp.x + math.floor((divx+1)*divlen) + local z1 = minp.z + math.floor((divz+1)*divlen) + -- Determine cactus amount from perlin noise + local cactus_amount = math.floor(perlin1:get2d({x=x0, y=z0}) * 5 + 0) + -- Find random positions for cactus based on this random + local pr = PseudoRandom(seed+1) + for i=0,cactus_amount do + local x = pr:next(x0, x1) + local z = pr:next(z0, z1) + -- Find ground level (0...15) + local ground_y = nil + for y=30,0,-1 do + if minetest.env:get_node({x=x,y=y,z=z}).name ~= "air" then + ground_y = y + break + end + end + -- If desert sand, make cactus + if ground_y and minetest.env:get_node({x=x,y=ground_y,z=z}).name == "default:desert_sand" then + minetest.env:set_node({x=x,y=ground_y+1,z=z}, {name="default:dry_shrub"}) + end + end + end + end + end + + -- Generate nyan cats + generate_nyancats(seed, minp, maxp) +end) + diff --git a/mods/default/sounds/default_dig_choppy.ogg b/mods/default/sounds/default_dig_choppy.ogg new file mode 100644 index 0000000..d605145 Binary files /dev/null and b/mods/default/sounds/default_dig_choppy.ogg differ diff --git a/mods/default/sounds/default_dig_cracky.ogg b/mods/default/sounds/default_dig_cracky.ogg new file mode 100644 index 0000000..53d45c1 Binary files /dev/null and b/mods/default/sounds/default_dig_cracky.ogg differ diff --git a/mods/default/sounds/default_dig_crumbly.1.ogg b/mods/default/sounds/default_dig_crumbly.1.ogg new file mode 100644 index 0000000..ea5830a Binary files /dev/null and b/mods/default/sounds/default_dig_crumbly.1.ogg differ diff --git a/mods/default/sounds/default_dig_crumbly.2.ogg b/mods/default/sounds/default_dig_crumbly.2.ogg new file mode 100644 index 0000000..f1a9248 Binary files /dev/null and b/mods/default/sounds/default_dig_crumbly.2.ogg differ diff --git a/mods/default/sounds/default_dig_dig_immediate.ogg b/mods/default/sounds/default_dig_dig_immediate.ogg new file mode 100644 index 0000000..526629b Binary files /dev/null and b/mods/default/sounds/default_dig_dig_immediate.ogg differ diff --git a/mods/default/sounds/default_dig_oddly_breakable_by_hand.ogg b/mods/default/sounds/default_dig_oddly_breakable_by_hand.ogg new file mode 100644 index 0000000..d605145 Binary files /dev/null and b/mods/default/sounds/default_dig_oddly_breakable_by_hand.ogg differ diff --git a/mods/default/sounds/default_dug_node.1.ogg b/mods/default/sounds/default_dug_node.1.ogg new file mode 100644 index 0000000..9d56bb8 Binary files /dev/null and b/mods/default/sounds/default_dug_node.1.ogg differ diff --git a/mods/default/sounds/default_grass_footstep.1.ogg b/mods/default/sounds/default_grass_footstep.1.ogg new file mode 100644 index 0000000..ce625d9 Binary files /dev/null and b/mods/default/sounds/default_grass_footstep.1.ogg differ diff --git a/mods/default/sounds/default_grass_footstep.2.ogg b/mods/default/sounds/default_grass_footstep.2.ogg new file mode 100644 index 0000000..330ca47 Binary files /dev/null and b/mods/default/sounds/default_grass_footstep.2.ogg differ diff --git a/mods/default/sounds/default_grass_footstep.3.ogg b/mods/default/sounds/default_grass_footstep.3.ogg new file mode 100644 index 0000000..07acc1e Binary files /dev/null and b/mods/default/sounds/default_grass_footstep.3.ogg differ diff --git a/mods/default/sounds/default_gravel_footstep.1.ogg b/mods/default/sounds/default_gravel_footstep.1.ogg new file mode 100644 index 0000000..68758b2 Binary files /dev/null and b/mods/default/sounds/default_gravel_footstep.1.ogg differ diff --git a/mods/default/sounds/default_gravel_footstep.2.ogg b/mods/default/sounds/default_gravel_footstep.2.ogg new file mode 100644 index 0000000..128ae57 Binary files /dev/null and b/mods/default/sounds/default_gravel_footstep.2.ogg differ diff --git a/mods/default/sounds/default_gravel_footstep.3.ogg b/mods/default/sounds/default_gravel_footstep.3.ogg new file mode 100644 index 0000000..7a5863f Binary files /dev/null and b/mods/default/sounds/default_gravel_footstep.3.ogg differ diff --git a/mods/default/sounds/default_gravel_footstep.4.ogg b/mods/default/sounds/default_gravel_footstep.4.ogg new file mode 100644 index 0000000..8cdadb1 Binary files /dev/null and b/mods/default/sounds/default_gravel_footstep.4.ogg differ diff --git a/mods/default/sounds/default_hard_footstep.1.ogg b/mods/default/sounds/default_hard_footstep.1.ogg new file mode 100644 index 0000000..6b351ff Binary files /dev/null and b/mods/default/sounds/default_hard_footstep.1.ogg differ diff --git a/mods/default/sounds/default_hard_footstep.2.ogg b/mods/default/sounds/default_hard_footstep.2.ogg new file mode 100644 index 0000000..2ce721e Binary files /dev/null and b/mods/default/sounds/default_hard_footstep.2.ogg differ diff --git a/mods/default/sounds/default_place_node.1.ogg b/mods/default/sounds/default_place_node.1.ogg new file mode 100644 index 0000000..526629b Binary files /dev/null and b/mods/default/sounds/default_place_node.1.ogg differ diff --git a/mods/default/sounds/default_place_node.2.ogg b/mods/default/sounds/default_place_node.2.ogg new file mode 100644 index 0000000..012c667 Binary files /dev/null and b/mods/default/sounds/default_place_node.2.ogg differ diff --git a/mods/default/sounds/default_place_node.3.ogg b/mods/default/sounds/default_place_node.3.ogg new file mode 100644 index 0000000..eaf9719 Binary files /dev/null and b/mods/default/sounds/default_place_node.3.ogg differ diff --git a/mods/default/textures/crack_anylength.png b/mods/default/textures/crack_anylength.png new file mode 100644 index 0000000..4997839 Binary files /dev/null and b/mods/default/textures/crack_anylength.png differ diff --git a/mods/default/textures/default_apple.png b/mods/default/textures/default_apple.png new file mode 100644 index 0000000..9593f28 Binary files /dev/null and b/mods/default/textures/default_apple.png differ diff --git a/mods/default/textures/default_book.png b/mods/default/textures/default_book.png new file mode 100644 index 0000000..176fb6a Binary files /dev/null and b/mods/default/textures/default_book.png differ diff --git a/mods/default/textures/default_bookshelf.png b/mods/default/textures/default_bookshelf.png new file mode 100644 index 0000000..5ecc50f Binary files /dev/null and b/mods/default/textures/default_bookshelf.png differ diff --git a/mods/default/textures/default_brick.png b/mods/default/textures/default_brick.png new file mode 100644 index 0000000..32d77f3 Binary files /dev/null and b/mods/default/textures/default_brick.png differ diff --git a/mods/default/textures/default_cactus_side.png b/mods/default/textures/default_cactus_side.png new file mode 100644 index 0000000..395dd0d Binary files /dev/null and b/mods/default/textures/default_cactus_side.png differ diff --git a/mods/default/textures/default_cactus_top.png b/mods/default/textures/default_cactus_top.png new file mode 100644 index 0000000..60a193c Binary files /dev/null and b/mods/default/textures/default_cactus_top.png differ diff --git a/mods/default/textures/default_chest_front.png b/mods/default/textures/default_chest_front.png new file mode 100644 index 0000000..47b7771 Binary files /dev/null and b/mods/default/textures/default_chest_front.png differ diff --git a/mods/default/textures/default_chest_lock.png b/mods/default/textures/default_chest_lock.png new file mode 100644 index 0000000..f5346f4 Binary files /dev/null and b/mods/default/textures/default_chest_lock.png differ diff --git a/mods/default/textures/default_chest_side.png b/mods/default/textures/default_chest_side.png new file mode 100644 index 0000000..5665168 Binary files /dev/null and b/mods/default/textures/default_chest_side.png differ diff --git a/mods/default/textures/default_chest_top.png b/mods/default/textures/default_chest_top.png new file mode 100644 index 0000000..b4e8a12 Binary files /dev/null and b/mods/default/textures/default_chest_top.png differ diff --git a/mods/default/textures/default_clay.png b/mods/default/textures/default_clay.png new file mode 100644 index 0000000..3557429 Binary files /dev/null and b/mods/default/textures/default_clay.png differ diff --git a/mods/default/textures/default_clay_brick.png b/mods/default/textures/default_clay_brick.png new file mode 100644 index 0000000..e36648e Binary files /dev/null and b/mods/default/textures/default_clay_brick.png differ diff --git a/mods/default/textures/default_clay_lump.png b/mods/default/textures/default_clay_lump.png new file mode 100644 index 0000000..be0bab9 Binary files /dev/null and b/mods/default/textures/default_clay_lump.png differ diff --git a/mods/default/textures/default_cloud.png b/mods/default/textures/default_cloud.png new file mode 100644 index 0000000..24091a3 Binary files /dev/null and b/mods/default/textures/default_cloud.png differ diff --git a/mods/default/textures/default_coal_lump.png b/mods/default/textures/default_coal_lump.png new file mode 100644 index 0000000..bad901e Binary files /dev/null and b/mods/default/textures/default_coal_lump.png differ diff --git a/mods/default/textures/default_cobble.png b/mods/default/textures/default_cobble.png new file mode 100644 index 0000000..bc79696 Binary files /dev/null and b/mods/default/textures/default_cobble.png differ diff --git a/mods/default/textures/default_desert_sand.png b/mods/default/textures/default_desert_sand.png new file mode 100644 index 0000000..9e36263 Binary files /dev/null and b/mods/default/textures/default_desert_sand.png differ diff --git a/mods/default/textures/default_desert_stone.png b/mods/default/textures/default_desert_stone.png new file mode 100644 index 0000000..a1afe6d Binary files /dev/null and b/mods/default/textures/default_desert_stone.png differ diff --git a/mods/default/textures/default_dirt.png b/mods/default/textures/default_dirt.png new file mode 100644 index 0000000..30cd4bf Binary files /dev/null and b/mods/default/textures/default_dirt.png differ diff --git a/mods/default/textures/default_dry_shrub.png b/mods/default/textures/default_dry_shrub.png new file mode 100644 index 0000000..450d5d9 Binary files /dev/null and b/mods/default/textures/default_dry_shrub.png differ diff --git a/mods/default/textures/default_fence.png b/mods/default/textures/default_fence.png new file mode 100644 index 0000000..0b99f0e Binary files /dev/null and b/mods/default/textures/default_fence.png differ diff --git a/mods/default/textures/default_furnace_bottom.png b/mods/default/textures/default_furnace_bottom.png new file mode 100644 index 0000000..c86782a Binary files /dev/null and b/mods/default/textures/default_furnace_bottom.png differ diff --git a/mods/default/textures/default_furnace_fire_bg.png b/mods/default/textures/default_furnace_fire_bg.png new file mode 100644 index 0000000..1272e10 Binary files /dev/null and b/mods/default/textures/default_furnace_fire_bg.png differ diff --git a/mods/default/textures/default_furnace_fire_fg.png b/mods/default/textures/default_furnace_fire_fg.png new file mode 100644 index 0000000..fbb19df Binary files /dev/null and b/mods/default/textures/default_furnace_fire_fg.png differ diff --git a/mods/default/textures/default_furnace_front.png b/mods/default/textures/default_furnace_front.png new file mode 100644 index 0000000..8f01e99 Binary files /dev/null and b/mods/default/textures/default_furnace_front.png differ diff --git a/mods/default/textures/default_furnace_front_active.png b/mods/default/textures/default_furnace_front_active.png new file mode 100644 index 0000000..10ffd1f Binary files /dev/null and b/mods/default/textures/default_furnace_front_active.png differ diff --git a/mods/default/textures/default_furnace_side.png b/mods/default/textures/default_furnace_side.png new file mode 100644 index 0000000..c86782a Binary files /dev/null and b/mods/default/textures/default_furnace_side.png differ diff --git a/mods/default/textures/default_furnace_top.png b/mods/default/textures/default_furnace_top.png new file mode 100644 index 0000000..c86782a Binary files /dev/null and b/mods/default/textures/default_furnace_top.png differ diff --git a/mods/default/textures/default_glass.png b/mods/default/textures/default_glass.png new file mode 100644 index 0000000..ade0196 Binary files /dev/null and b/mods/default/textures/default_glass.png differ diff --git a/mods/default/textures/default_grass.png b/mods/default/textures/default_grass.png new file mode 100644 index 0000000..4e1f0f1 Binary files /dev/null and b/mods/default/textures/default_grass.png differ diff --git a/mods/default/textures/default_grass_footsteps.png b/mods/default/textures/default_grass_footsteps.png new file mode 100644 index 0000000..57e063d Binary files /dev/null and b/mods/default/textures/default_grass_footsteps.png differ diff --git a/mods/default/textures/default_grass_side.png b/mods/default/textures/default_grass_side.png new file mode 100644 index 0000000..6ca1a6f Binary files /dev/null and b/mods/default/textures/default_grass_side.png differ diff --git a/mods/default/textures/default_gravel.png b/mods/default/textures/default_gravel.png new file mode 100644 index 0000000..f08666a Binary files /dev/null and b/mods/default/textures/default_gravel.png differ diff --git a/mods/default/textures/default_iron_lump.png b/mods/default/textures/default_iron_lump.png new file mode 100644 index 0000000..edb9310 Binary files /dev/null and b/mods/default/textures/default_iron_lump.png differ diff --git a/mods/default/textures/default_junglegrass.png b/mods/default/textures/default_junglegrass.png new file mode 100644 index 0000000..eea87c0 Binary files /dev/null and b/mods/default/textures/default_junglegrass.png differ diff --git a/mods/default/textures/default_jungletree.png b/mods/default/textures/default_jungletree.png new file mode 100644 index 0000000..d8c2635 Binary files /dev/null and b/mods/default/textures/default_jungletree.png differ diff --git a/mods/default/textures/default_jungletree_top.png b/mods/default/textures/default_jungletree_top.png new file mode 100644 index 0000000..805272a Binary files /dev/null and b/mods/default/textures/default_jungletree_top.png differ diff --git a/mods/default/textures/default_ladder.png b/mods/default/textures/default_ladder.png new file mode 100644 index 0000000..1105635 Binary files /dev/null and b/mods/default/textures/default_ladder.png differ diff --git a/mods/default/textures/default_lava.png b/mods/default/textures/default_lava.png new file mode 100644 index 0000000..9cf9fa8 Binary files /dev/null and b/mods/default/textures/default_lava.png differ diff --git a/mods/default/textures/default_lava_flowing_animated.png b/mods/default/textures/default_lava_flowing_animated.png new file mode 100644 index 0000000..cef8e36 Binary files /dev/null and b/mods/default/textures/default_lava_flowing_animated.png differ diff --git a/mods/default/textures/default_lava_source_animated.png b/mods/default/textures/default_lava_source_animated.png new file mode 100644 index 0000000..9339a68 Binary files /dev/null and b/mods/default/textures/default_lava_source_animated.png differ diff --git a/mods/default/textures/default_leaves.png b/mods/default/textures/default_leaves.png new file mode 100644 index 0000000..d0258ed Binary files /dev/null and b/mods/default/textures/default_leaves.png differ diff --git a/mods/default/textures/default_mese.png b/mods/default/textures/default_mese.png new file mode 100644 index 0000000..4c876cd Binary files /dev/null and b/mods/default/textures/default_mese.png differ diff --git a/mods/default/textures/default_mineral_coal.png b/mods/default/textures/default_mineral_coal.png new file mode 100644 index 0000000..3ff9692 Binary files /dev/null and b/mods/default/textures/default_mineral_coal.png differ diff --git a/mods/default/textures/default_mineral_iron.png b/mods/default/textures/default_mineral_iron.png new file mode 100644 index 0000000..51b15d9 Binary files /dev/null and b/mods/default/textures/default_mineral_iron.png differ diff --git a/mods/default/textures/default_mossycobble.png b/mods/default/textures/default_mossycobble.png new file mode 100644 index 0000000..ca72717 Binary files /dev/null and b/mods/default/textures/default_mossycobble.png differ diff --git a/mods/default/textures/default_nc_back.png b/mods/default/textures/default_nc_back.png new file mode 100644 index 0000000..f09f416 Binary files /dev/null and b/mods/default/textures/default_nc_back.png differ diff --git a/mods/default/textures/default_nc_front.png b/mods/default/textures/default_nc_front.png new file mode 100644 index 0000000..cad9eda Binary files /dev/null and b/mods/default/textures/default_nc_front.png differ diff --git a/mods/default/textures/default_nc_rb.png b/mods/default/textures/default_nc_rb.png new file mode 100644 index 0000000..7ebc993 Binary files /dev/null and b/mods/default/textures/default_nc_rb.png differ diff --git a/mods/default/textures/default_nc_side.png b/mods/default/textures/default_nc_side.png new file mode 100644 index 0000000..f954045 Binary files /dev/null and b/mods/default/textures/default_nc_side.png differ diff --git a/mods/default/textures/default_paper.png b/mods/default/textures/default_paper.png new file mode 100644 index 0000000..ae5c06b Binary files /dev/null and b/mods/default/textures/default_paper.png differ diff --git a/mods/default/textures/default_papyrus.png b/mods/default/textures/default_papyrus.png new file mode 100644 index 0000000..bf0dec7 Binary files /dev/null and b/mods/default/textures/default_papyrus.png differ diff --git a/mods/default/textures/default_rail.png b/mods/default/textures/default_rail.png new file mode 100644 index 0000000..18176d9 Binary files /dev/null and b/mods/default/textures/default_rail.png differ diff --git a/mods/default/textures/default_rail_crossing.png b/mods/default/textures/default_rail_crossing.png new file mode 100644 index 0000000..9846405 Binary files /dev/null and b/mods/default/textures/default_rail_crossing.png differ diff --git a/mods/default/textures/default_rail_curved.png b/mods/default/textures/default_rail_curved.png new file mode 100644 index 0000000..62afa3d Binary files /dev/null and b/mods/default/textures/default_rail_curved.png differ diff --git a/mods/default/textures/default_rail_t_junction.png b/mods/default/textures/default_rail_t_junction.png new file mode 100644 index 0000000..9985f63 Binary files /dev/null and b/mods/default/textures/default_rail_t_junction.png differ diff --git a/mods/default/textures/default_sand.png b/mods/default/textures/default_sand.png new file mode 100644 index 0000000..2a48456 Binary files /dev/null and b/mods/default/textures/default_sand.png differ diff --git a/mods/default/textures/default_sandstone.png b/mods/default/textures/default_sandstone.png new file mode 100644 index 0000000..c4759b4 Binary files /dev/null and b/mods/default/textures/default_sandstone.png differ diff --git a/mods/default/textures/default_sapling.png b/mods/default/textures/default_sapling.png new file mode 100644 index 0000000..d03c3e4 Binary files /dev/null and b/mods/default/textures/default_sapling.png differ diff --git a/mods/default/textures/default_scorched_stuff.png b/mods/default/textures/default_scorched_stuff.png new file mode 100644 index 0000000..9ced2fb Binary files /dev/null and b/mods/default/textures/default_scorched_stuff.png differ diff --git a/mods/default/textures/default_sign_wall.png b/mods/default/textures/default_sign_wall.png new file mode 100644 index 0000000..d5c6dcd Binary files /dev/null and b/mods/default/textures/default_sign_wall.png differ diff --git a/mods/default/textures/default_steel_block.png b/mods/default/textures/default_steel_block.png new file mode 100644 index 0000000..8e20200 Binary files /dev/null and b/mods/default/textures/default_steel_block.png differ diff --git a/mods/default/textures/default_steel_ingot.png b/mods/default/textures/default_steel_ingot.png new file mode 100644 index 0000000..f6c9414 Binary files /dev/null and b/mods/default/textures/default_steel_ingot.png differ diff --git a/mods/default/textures/default_stick.png b/mods/default/textures/default_stick.png new file mode 100644 index 0000000..2d31797 Binary files /dev/null and b/mods/default/textures/default_stick.png differ diff --git a/mods/default/textures/default_stone.png b/mods/default/textures/default_stone.png new file mode 100644 index 0000000..17c3f56 Binary files /dev/null and b/mods/default/textures/default_stone.png differ diff --git a/mods/default/textures/default_tnt_bottom.png b/mods/default/textures/default_tnt_bottom.png new file mode 100644 index 0000000..8ba2fca Binary files /dev/null and b/mods/default/textures/default_tnt_bottom.png differ diff --git a/mods/default/textures/default_tnt_side.png b/mods/default/textures/default_tnt_side.png new file mode 100644 index 0000000..d9a2bc4 Binary files /dev/null and b/mods/default/textures/default_tnt_side.png differ diff --git a/mods/default/textures/default_tnt_top.png b/mods/default/textures/default_tnt_top.png new file mode 100644 index 0000000..a84ffc9 Binary files /dev/null and b/mods/default/textures/default_tnt_top.png differ diff --git a/mods/default/textures/default_tool_mesepick.png b/mods/default/textures/default_tool_mesepick.png new file mode 100644 index 0000000..4828f0f Binary files /dev/null and b/mods/default/textures/default_tool_mesepick.png differ diff --git a/mods/default/textures/default_tool_steelaxe.png b/mods/default/textures/default_tool_steelaxe.png new file mode 100644 index 0000000..0ad23c9 Binary files /dev/null and b/mods/default/textures/default_tool_steelaxe.png differ diff --git a/mods/default/textures/default_tool_steelpick.png b/mods/default/textures/default_tool_steelpick.png new file mode 100644 index 0000000..1d5a2d1 Binary files /dev/null and b/mods/default/textures/default_tool_steelpick.png differ diff --git a/mods/default/textures/default_tool_steelshovel.png b/mods/default/textures/default_tool_steelshovel.png new file mode 100644 index 0000000..ed84138 Binary files /dev/null and b/mods/default/textures/default_tool_steelshovel.png differ diff --git a/mods/default/textures/default_tool_steelsword.png b/mods/default/textures/default_tool_steelsword.png new file mode 100644 index 0000000..036b03f Binary files /dev/null and b/mods/default/textures/default_tool_steelsword.png differ diff --git a/mods/default/textures/default_tool_stoneaxe.png b/mods/default/textures/default_tool_stoneaxe.png new file mode 100644 index 0000000..698ac91 Binary files /dev/null and b/mods/default/textures/default_tool_stoneaxe.png differ diff --git a/mods/default/textures/default_tool_stonepick.png b/mods/default/textures/default_tool_stonepick.png new file mode 100644 index 0000000..71ff0b5 Binary files /dev/null and b/mods/default/textures/default_tool_stonepick.png differ diff --git a/mods/default/textures/default_tool_stoneshovel.png b/mods/default/textures/default_tool_stoneshovel.png new file mode 100644 index 0000000..ba52431 Binary files /dev/null and b/mods/default/textures/default_tool_stoneshovel.png differ diff --git a/mods/default/textures/default_tool_stonesword.png b/mods/default/textures/default_tool_stonesword.png new file mode 100644 index 0000000..8f8191f Binary files /dev/null and b/mods/default/textures/default_tool_stonesword.png differ diff --git a/mods/default/textures/default_tool_woodaxe.png b/mods/default/textures/default_tool_woodaxe.png new file mode 100644 index 0000000..3daa4af Binary files /dev/null and b/mods/default/textures/default_tool_woodaxe.png differ diff --git a/mods/default/textures/default_tool_woodpick.png b/mods/default/textures/default_tool_woodpick.png new file mode 100644 index 0000000..7346630 Binary files /dev/null and b/mods/default/textures/default_tool_woodpick.png differ diff --git a/mods/default/textures/default_tool_woodshovel.png b/mods/default/textures/default_tool_woodshovel.png new file mode 100644 index 0000000..649ab4c Binary files /dev/null and b/mods/default/textures/default_tool_woodshovel.png differ diff --git a/mods/default/textures/default_tool_woodsword.png b/mods/default/textures/default_tool_woodsword.png new file mode 100644 index 0000000..d6c6be3 Binary files /dev/null and b/mods/default/textures/default_tool_woodsword.png differ diff --git a/mods/default/textures/default_torch.png b/mods/default/textures/default_torch.png new file mode 100644 index 0000000..b9444af Binary files /dev/null and b/mods/default/textures/default_torch.png differ diff --git a/mods/default/textures/default_torch_animated.png b/mods/default/textures/default_torch_animated.png new file mode 100644 index 0000000..ca1668c Binary files /dev/null and b/mods/default/textures/default_torch_animated.png differ diff --git a/mods/default/textures/default_torch_on_ceiling.png b/mods/default/textures/default_torch_on_ceiling.png new file mode 100644 index 0000000..8deef96 Binary files /dev/null and b/mods/default/textures/default_torch_on_ceiling.png differ diff --git a/mods/default/textures/default_torch_on_ceiling_animated.png b/mods/default/textures/default_torch_on_ceiling_animated.png new file mode 100644 index 0000000..b101561 Binary files /dev/null and b/mods/default/textures/default_torch_on_ceiling_animated.png differ diff --git a/mods/default/textures/default_torch_on_floor.png b/mods/default/textures/default_torch_on_floor.png new file mode 100644 index 0000000..925a59a Binary files /dev/null and b/mods/default/textures/default_torch_on_floor.png differ diff --git a/mods/default/textures/default_torch_on_floor_animated.png b/mods/default/textures/default_torch_on_floor_animated.png new file mode 100644 index 0000000..0b55818 Binary files /dev/null and b/mods/default/textures/default_torch_on_floor_animated.png differ diff --git a/mods/default/textures/default_tree.png b/mods/default/textures/default_tree.png new file mode 100644 index 0000000..ab12501 Binary files /dev/null and b/mods/default/textures/default_tree.png differ diff --git a/mods/default/textures/default_tree_top.png b/mods/default/textures/default_tree_top.png new file mode 100644 index 0000000..6d62006 Binary files /dev/null and b/mods/default/textures/default_tree_top.png differ diff --git a/mods/default/textures/default_water.png b/mods/default/textures/default_water.png new file mode 100644 index 0000000..eb506f1 Binary files /dev/null and b/mods/default/textures/default_water.png differ diff --git a/mods/default/textures/default_wood.png b/mods/default/textures/default_wood.png new file mode 100644 index 0000000..66f2b72 Binary files /dev/null and b/mods/default/textures/default_wood.png differ diff --git a/mods/default/textures/heart.png b/mods/default/textures/heart.png new file mode 100644 index 0000000..6bc183e Binary files /dev/null and b/mods/default/textures/heart.png differ diff --git a/mods/default/textures/player.png b/mods/default/textures/player.png new file mode 100644 index 0000000..90adf97 Binary files /dev/null and b/mods/default/textures/player.png differ diff --git a/mods/default/textures/player_back.png b/mods/default/textures/player_back.png new file mode 100644 index 0000000..530aa75 Binary files /dev/null and b/mods/default/textures/player_back.png differ diff --git a/mods/default/textures/treeprop.png b/mods/default/textures/treeprop.png new file mode 100644 index 0000000..72e831b Binary files /dev/null and b/mods/default/textures/treeprop.png differ diff --git a/mods/default/textures/wieldhand.png b/mods/default/textures/wieldhand.png new file mode 100644 index 0000000..c4549e5 Binary files /dev/null and b/mods/default/textures/wieldhand.png differ diff --git a/mods/dye/README.txt b/mods/dye/README.txt new file mode 100644 index 0000000..d414c2c --- /dev/null +++ b/mods/dye/README.txt @@ -0,0 +1,15 @@ +Minetest 0.4 mod: dye +====================== + +See init.lua for documentation. + +License of source code and media files: +--------------------------------------- +Copyright (C) 2012 Perttu Ahola (celeron55) + +This program is free software. It comes without any warranty, to +the extent permitted by applicable law. You can redistribute it +and/or modify it under the terms of the Do What The Fuck You Want +To Public License, Version 2, as published by Sam Hocevar. See +http://sam.zoy.org/wtfpl/COPYING for more details. + diff --git a/mods/dye/depends.txt b/mods/dye/depends.txt new file mode 100644 index 0000000..e69de29 diff --git a/mods/dye/init.lua b/mods/dye/init.lua new file mode 100644 index 0000000..2886828 --- /dev/null +++ b/mods/dye/init.lua @@ -0,0 +1,134 @@ +-- minetest/dye/init.lua + +-- To make recipes that will work with any dye ever made by anybody, define +-- them based on groups. +-- You can select any group of groups, based on your need for amount of colors. +-- basecolor: 9, excolor: 17, unicolor: 89 +-- +-- Example of one shapeless recipe using a color group: +-- Note: As this uses basecolor_*, you'd need 9 of these. +-- minetest.register_craft({ +-- type = "shapeless", +-- output = ':item_yellow', +-- recipe = {':item_no_color', 'group:basecolor_yellow'}, +-- }) + +-- Other mods can use these for looping through available colors +local dye = {} +dye.basecolors = {"white", "grey", "black", "red", "yellow", "green", "cyan", "blue", "magenta"} +dye.excolors = {"white", "lightgrey", "grey", "darkgrey", "black", "red", "orange", "yellow", "lime", "green", "aqua", "cyan", "sky_blue", "blue", "violet", "magenta", "red_violet"} + +-- Base color groups: +-- - basecolor_white +-- - basecolor_grey +-- - basecolor_black +-- - basecolor_red +-- - basecolor_yellow +-- - basecolor_green +-- - basecolor_cyan +-- - basecolor_blue +-- - basecolor_magenta + +-- Extended color groups (* = equal to a base color): +-- * excolor_white +-- - excolor_lightgrey +-- * excolor_grey +-- - excolor_darkgrey +-- * excolor_black +-- * excolor_red +-- - excolor_orange +-- * excolor_yellow +-- - excolor_lime +-- * excolor_green +-- - excolor_aqua +-- * excolor_cyan +-- - excolor_sky_blue +-- * excolor_blue +-- - excolor_violet +-- * excolor_magenta +-- - excolor_red_violet + +-- The whole unifieddyes palette as groups: +-- - unicolor_ +-- For the following, no white/grey/black is allowed: +-- - unicolor_medium_ +-- - unicolor_dark_ +-- - unicolor_light_ +-- - unicolor__s50 +-- - unicolor_medium__s50 +-- - unicolor_dark__s50 + +-- Local stuff +local dyelocal = {} + +-- This collection of colors is partly a historic thing, partly something else. +dyelocal.dyes = { + {"white", "White dye", {dye=1, basecolor_white=1, excolor_white=1, unicolor_white=1}}, + {"grey", "Grey dye", {dye=1, basecolor_grey=1, excolor_grey=1, unicolor_grey=1}}, + {"dark_grey", "Dark grey dye", {dye=1, basecolor_grey=1, excolor_darkgrey=1, unicolor_darkgrey=1}}, + {"black", "Black dye", {dye=1, basecolor_black=1, excolor_black=1, unicolor_black=1}}, + {"violet", "Violet dye", {dye=1, basecolor_magenta=1, excolor_violet=1, unicolor_violet=1}}, + {"blue", "Blue dye", {dye=1, basecolor_blue=1, excolor_blue=1, unicolor_blue=1}}, + {"cyan", "Cyan dye", {dye=1, basecolor_cyan=1, excolor_cyan=1, unicolor_cyan=1}}, + {"dark_green", "Dark green dye",{dye=1, basecolor_green=1, excolor_green=1, unicolor_dark_green=1}}, + {"green", "Green dye", {dye=1, basecolor_green=1, excolor_green=1, unicolor_green=1}}, + {"yellow", "Yellow dye", {dye=1, basecolor_yellow=1, excolor_yellow=1, unicolor_yellow=1}}, + {"brown", "Brown dye", {dye=1, basecolor_yellow=1, excolor_orange=1, unicolor_dark_orange=1}}, + {"orange", "Orange dye", {dye=1, basecolor_orange=1, excolor_orange=1, unicolor_orange=1}}, + {"red", "Red dye", {dye=1, basecolor_red=1, excolor_red=1, unicolor_red=1}}, + {"magenta", "Magenta dye", {dye=1, basecolor_magenta=1, excolor_red_violet=1,unicolor_red_violet=1}}, + {"pink", "Pink dye", {dye=1, basecolor_red=1, excolor_red=1, unicolor_light_red=1}}, +} + +-- Define items +for _, row in ipairs(dyelocal.dyes) do + local name = row[1] + local description = row[2] + local groups = row[3] + local item_name = "dye:"..name + local item_image = "dye_"..name..".png" + minetest.register_craftitem(item_name, { + inventory_image = item_image, + description = description, + groups = groups + }) +end + +-- Mix recipes +-- Just mix everything to everything somehow sanely + +dyelocal.mixbases = {"magenta", "red", "orange", "brown", "yellow", "green", "dark_green", "cyan", "blue", "violet", "black", "dark_grey", "grey", "white"} + +dyelocal.mixes = { + -- magenta, red, orange, brown, yellow, green, dark_green, cyan, blue, violet, black, dark_grey, grey, white + white = {"pink", "pink", "orange", "orange", "yellow", "green", "green", "grey", "cyan", "violet", "grey", "grey", "white", "white"}, + grey = {"pink", "pink", "orange", "orange", "yellow", "green", "green", "grey", "cyan", "pink", "dark_grey","grey", "grey"}, + dark_grey={"brown","brown", "brown", "brown", "brown","dark_green","dark_green","blue","blue","violet","black", "black"}, + black = {"black", "black", "black", "black", "black", "black", "black", "black", "black", "black", "black"}, + violet= {"magenta","magenta","red", "brown", "red", "cyan", "brown", "blue", "violet","violet"}, + blue = {"violet", "magenta","brown","brown","dark_green","cyan","cyan", "cyan", "blue"}, + cyan = {"blue","brown","dark_green","dark_grey","green","cyan","dark_green","cyan"}, + dark_green={"brown","brown","brown", "brown", "green", "green", "dark_green"}, + green = {"brown", "yellow","yellow","dark_green","green","green"}, + yellow= {"red", "orange", "yellow","orange", "yellow"}, + brown = {"brown", "brown","orange", "brown"}, + orange= {"red", "orange","orange"}, + red = {"magenta","red"}, + magenta={"magenta"}, +} + +for one,results in pairs(dyelocal.mixes) do + for i,result in ipairs(results) do + local another = dyelocal.mixbases[i] + minetest.register_craft({ + type = "shapeless", + output = 'dye:'..result..' 2', + recipe = {'dye:'..one, 'dye:'..another}, + }) + end +end + +-- Hide dyelocal +dyelocal = nil + +-- EOF diff --git a/mods/dye/textures/dye_black.png b/mods/dye/textures/dye_black.png new file mode 100644 index 0000000..ef526e6 Binary files /dev/null and b/mods/dye/textures/dye_black.png differ diff --git a/mods/dye/textures/dye_blue.png b/mods/dye/textures/dye_blue.png new file mode 100644 index 0000000..d3e9791 Binary files /dev/null and b/mods/dye/textures/dye_blue.png differ diff --git a/mods/dye/textures/dye_brown.png b/mods/dye/textures/dye_brown.png new file mode 100644 index 0000000..5b27085 Binary files /dev/null and b/mods/dye/textures/dye_brown.png differ diff --git a/mods/dye/textures/dye_cyan.png b/mods/dye/textures/dye_cyan.png new file mode 100644 index 0000000..3ae44e2 Binary files /dev/null and b/mods/dye/textures/dye_cyan.png differ diff --git a/mods/dye/textures/dye_dark_green.png b/mods/dye/textures/dye_dark_green.png new file mode 100644 index 0000000..784b785 Binary files /dev/null and b/mods/dye/textures/dye_dark_green.png differ diff --git a/mods/dye/textures/dye_dark_grey.png b/mods/dye/textures/dye_dark_grey.png new file mode 100644 index 0000000..adaa014 Binary files /dev/null and b/mods/dye/textures/dye_dark_grey.png differ diff --git a/mods/dye/textures/dye_green.png b/mods/dye/textures/dye_green.png new file mode 100644 index 0000000..e88631c Binary files /dev/null and b/mods/dye/textures/dye_green.png differ diff --git a/mods/dye/textures/dye_grey.png b/mods/dye/textures/dye_grey.png new file mode 100644 index 0000000..c4706e7 Binary files /dev/null and b/mods/dye/textures/dye_grey.png differ diff --git a/mods/dye/textures/dye_magenta.png b/mods/dye/textures/dye_magenta.png new file mode 100644 index 0000000..4946c71 Binary files /dev/null and b/mods/dye/textures/dye_magenta.png differ diff --git a/mods/dye/textures/dye_orange.png b/mods/dye/textures/dye_orange.png new file mode 100644 index 0000000..347964d Binary files /dev/null and b/mods/dye/textures/dye_orange.png differ diff --git a/mods/dye/textures/dye_pink.png b/mods/dye/textures/dye_pink.png new file mode 100644 index 0000000..ec2acf5 Binary files /dev/null and b/mods/dye/textures/dye_pink.png differ diff --git a/mods/dye/textures/dye_red.png b/mods/dye/textures/dye_red.png new file mode 100644 index 0000000..9f8c151 Binary files /dev/null and b/mods/dye/textures/dye_red.png differ diff --git a/mods/dye/textures/dye_violet.png b/mods/dye/textures/dye_violet.png new file mode 100644 index 0000000..0ee216c Binary files /dev/null and b/mods/dye/textures/dye_violet.png differ diff --git a/mods/dye/textures/dye_white.png b/mods/dye/textures/dye_white.png new file mode 100644 index 0000000..508e32f Binary files /dev/null and b/mods/dye/textures/dye_white.png differ diff --git a/mods/dye/textures/dye_yellow.png b/mods/dye/textures/dye_yellow.png new file mode 100644 index 0000000..d00a5b8 Binary files /dev/null and b/mods/dye/textures/dye_yellow.png differ diff --git a/mods/fire/README.txt b/mods/fire/README.txt new file mode 100644 index 0000000..564d4a2 --- /dev/null +++ b/mods/fire/README.txt @@ -0,0 +1,30 @@ +Minetest 0.4 mod: fire +====================== + +License of source code: +----------------------- +Copyright (C) 2012 Perttu Ahola (celeron55) + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 2.1 of the License, or +(at your option) any later version. + +http://www.gnu.org/licenses/lgpl-2.1.html + +License of media (textures and sounds) +-------------------------------------- +Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) +http://creativecommons.org/licenses/by-sa/3.0/ + +Authors of media files +----------------------- +Everything not listed in here: +Copyright (C) 2012 Perttu Ahola (celeron55) + +fire_small.ogg sampled from: + http://www.freesound.org/people/dobroide/sounds/4211/ + +fire_large.ogg sampled from: + http://www.freesound.org/people/Dynamicell/sounds/17548/ + diff --git a/mods/fire/init.lua b/mods/fire/init.lua new file mode 100644 index 0000000..846a2d3 --- /dev/null +++ b/mods/fire/init.lua @@ -0,0 +1,188 @@ +-- minetest/fire/init.lua + +minetest.register_node("fire:basic_flame", { + description = "Fire", + drawtype = "glasslike", + tiles = {"fire_basic_flame.png"}, + light_source = 14, + groups = {igniter=2,dig_immediate=3}, + drop = '', + walkable = false, +}) + +local fire = {} +fire.D = 6 +-- key: position hash of low corner of area +-- value: {handle=sound handle, name=sound name} +fire.sounds = {} + +function fire.get_area_p0p1(pos) + local p0 = { + x=math.floor(pos.x/fire.D)*fire.D, + y=math.floor(pos.y/fire.D)*fire.D, + z=math.floor(pos.z/fire.D)*fire.D, + } + local p1 = { + x=p0.x+fire.D-1, + y=p0.y+fire.D-1, + z=p0.z+fire.D-1 + } + return p0, p1 +end + +function fire.update_sounds_around(pos) + local p0, p1 = fire.get_area_p0p1(pos) + local cp = {x=(p0.x+p1.x)/2, y=(p0.y+p1.y)/2, z=(p0.z+p1.z)/2} + local flames_p = minetest.env:find_nodes_in_area(p0, p1, {"fire:basic_flame"}) + --print("number of flames at "..minetest.pos_to_string(p0).."/" + -- ..minetest.pos_to_string(p1)..": "..#flames_p) + local should_have_sound = (#flames_p > 0) + local wanted_sound = nil + if #flames_p >= 9 then + wanted_sound = {name="fire_large", gain=1.5} + elseif #flames_p > 0 then + wanted_sound = {name="fire_small", gain=1.5} + end + local p0_hash = minetest.hash_node_position(p0) + local sound = fire.sounds[p0_hash] + if not sound then + if should_have_sound then + fire.sounds[p0_hash] = { + handle = minetest.sound_play(wanted_sound, {pos=cp, loop=true}), + name = wanted_sound.name, + } + end + else + if not wanted_sound then + minetest.sound_stop(sound.handle) + fire.sounds[p0_hash] = nil + elseif sound.name ~= wanted_sound.name then + minetest.sound_stop(sound.handle) + fire.sounds[p0_hash] = { + handle = minetest.sound_play(wanted_sound, {pos=cp, loop=true}), + name = wanted_sound.name, + } + end + end +end + +function fire.on_flame_add_at(pos) + --print("flame added at "..minetest.pos_to_string(pos)) + fire.update_sounds_around(pos) +end + +function fire.on_flame_remove_at(pos) + --print("flame removed at "..minetest.pos_to_string(pos)) + fire.update_sounds_around(pos) +end + +function fire.find_pos_for_flame_around(pos) + return minetest.env:find_node_near(pos, 1, {"air"}) +end + +function fire.flame_should_extinguish(pos) + --return minetest.env:find_node_near(pos, 1, {"group:puts_out_fire"}) + local p0 = {x=pos.x-2, y=pos.y, z=pos.z-2} + local p1 = {x=pos.x+2, y=pos.y, z=pos.z+2} + local ps = minetest.env:find_nodes_in_area(p0, p1, {"group:puts_out_fire"}) + return (#ps ~= 0) +end + +minetest.register_on_placenode(function(pos, newnode, placer) + if newnode.name == "fire:basic_flame" then + fire.on_flame_add_at(pos) + end +end) + +minetest.register_on_dignode(function(pos, oldnode, digger) + if oldnode.name == "fire:basic_flame" then + fire.on_flame_remove_at(pos) + end +end) + +-- Ignite neighboring nodes +minetest.register_abm({ + nodenames = {"group:flammable"}, + neighbors = {"group:igniter"}, + interval = 1, + chance = 2, + action = function(p0, node, _, _) + -- If there is water or stuff like that around flame, don't ignite + if fire.flame_should_extinguish(p0) then + return + end + local p = fire.find_pos_for_flame_around(p0) + if p then + minetest.env:set_node(p, {name="fire:basic_flame"}) + fire.on_flame_add_at(p) + end + end, +}) + +-- Rarely ignite things from far +minetest.register_abm({ + nodenames = {"group:igniter"}, + neighbors = {"air"}, + interval = 2, + chance = 10, + action = function(p0, node, _, _) + local reg = minetest.registered_nodes[node.name] + if not reg or not reg.groups.igniter or reg.groups.igniter < 2 then + return + end + local d = reg.groups.igniter + local p = minetest.env:find_node_near(p0, d, {"group:flammable"}) + if p then + -- If there is water or stuff like that around flame, don't ignite + if fire.flame_should_extinguish(p) then + return + end + local p2 = fire.find_pos_for_flame_around(p) + if p2 then + minetest.env:set_node(p2, {name="fire:basic_flame"}) + fire.on_flame_add_at(p2) + end + end + end, +}) + +-- Remove flammable nodes and flame +minetest.register_abm({ + nodenames = {"fire:basic_flame"}, + interval = 1, + chance = 2, + action = function(p0, node, _, _) + -- If there is water or stuff like that around flame, remove flame + if fire.flame_should_extinguish(p0) then + minetest.env:remove_node(p0) + fire.on_flame_remove_at(p0) + return + end + -- Make the following things rarer + if math.random(1,3) == 1 then + return + end + -- If there are no flammable nodes around flame, remove flame + if not minetest.env:find_node_near(p0, 1, {"group:flammable"}) then + minetest.env:remove_node(p0) + fire.on_flame_remove_at(p0) + return + end + if math.random(1,4) == 1 then + -- remove a flammable node around flame + local p = minetest.env:find_node_near(p0, 1, {"group:flammable"}) + if p then + -- If there is water or stuff like that around flame, don't remove + if fire.flame_should_extinguish(p0) then + return + end + minetest.env:remove_node(p) + end + else + -- remove flame + minetest.env:remove_node(p0) + fire.on_flame_remove_at(p0) + end + end, +}) + diff --git a/mods/fire/sounds/fire_large.ogg b/mods/fire/sounds/fire_large.ogg new file mode 100644 index 0000000..fe78e62 Binary files /dev/null and b/mods/fire/sounds/fire_large.ogg differ diff --git a/mods/fire/sounds/fire_small.ogg b/mods/fire/sounds/fire_small.ogg new file mode 100644 index 0000000..5aac595 Binary files /dev/null and b/mods/fire/sounds/fire_small.ogg differ diff --git a/mods/fire/textures/fire_basic_flame.png b/mods/fire/textures/fire_basic_flame.png new file mode 100644 index 0000000..a5c2afd Binary files /dev/null and b/mods/fire/textures/fire_basic_flame.png differ diff --git a/mods/give_initial_stuff/depends.txt b/mods/give_initial_stuff/depends.txt new file mode 100644 index 0000000..3a7daa1 --- /dev/null +++ b/mods/give_initial_stuff/depends.txt @@ -0,0 +1,2 @@ +default + diff --git a/mods/give_initial_stuff/init.lua b/mods/give_initial_stuff/init.lua new file mode 100644 index 0000000..9cf6b51 --- /dev/null +++ b/mods/give_initial_stuff/init.lua @@ -0,0 +1,12 @@ +minetest.register_on_newplayer(function(player) + print("on_newplayer") + if minetest.setting_getbool("give_initial_stuff") then + print("giving give_initial_stuff to player") + player:get_inventory():add_item('main', 'default:pick_steel') + player:get_inventory():add_item('main', 'default:torch 99') + player:get_inventory():add_item('main', 'default:axe_steel') + player:get_inventory():add_item('main', 'default:shovel_steel') + player:get_inventory():add_item('main', 'default:cobble 99') + end +end) + diff --git a/mods/legacy/depends.txt b/mods/legacy/depends.txt new file mode 100644 index 0000000..3a7daa1 --- /dev/null +++ b/mods/legacy/depends.txt @@ -0,0 +1,2 @@ +default + diff --git a/mods/legacy/init.lua b/mods/legacy/init.lua new file mode 100644 index 0000000..fa8f297 --- /dev/null +++ b/mods/legacy/init.lua @@ -0,0 +1,133 @@ +-- legacy (Minetest 0.4 mod) +-- Provides as much backwards-compatibility as feasible + +-- +-- Aliases to support loading 0.3 and old 0.4 worlds and inventories +-- + +minetest.register_alias("stone", "default:stone") +minetest.register_alias("stone_with_coal", "default:stone_with_coal") +minetest.register_alias("stone_with_iron", "default:stone_with_iron") +minetest.register_alias("dirt_with_grass", "default:dirt_with_grass") +minetest.register_alias("dirt_with_grass_footsteps", "default:dirt_with_grass_footsteps") +minetest.register_alias("dirt", "default:dirt") +minetest.register_alias("sand", "default:sand") +minetest.register_alias("gravel", "default:gravel") +minetest.register_alias("sandstone", "default:sandstone") +minetest.register_alias("clay", "default:clay") +minetest.register_alias("brick", "default:brick") +minetest.register_alias("tree", "default:tree") +minetest.register_alias("jungletree", "default:jungletree") +minetest.register_alias("junglegrass", "default:junglegrass") +minetest.register_alias("leaves", "default:leaves") +minetest.register_alias("cactus", "default:cactus") +minetest.register_alias("papyrus", "default:papyrus") +minetest.register_alias("bookshelf", "default:bookshelf") +minetest.register_alias("glass", "default:glass") +minetest.register_alias("wooden_fence", "default:fence_wood") +minetest.register_alias("rail", "default:rail") +minetest.register_alias("ladder", "default:ladder") +minetest.register_alias("wood", "default:wood") +minetest.register_alias("mese", "default:mese") +minetest.register_alias("cloud", "default:cloud") +minetest.register_alias("water_flowing", "default:water_flowing") +minetest.register_alias("water_source", "default:water_source") +minetest.register_alias("lava_flowing", "default:lava_flowing") +minetest.register_alias("lava_source", "default:lava_source") +minetest.register_alias("torch", "default:torch") +minetest.register_alias("sign_wall", "default:sign_wall") +minetest.register_alias("furnace", "default:furnace") +minetest.register_alias("chest", "default:chest") +minetest.register_alias("locked_chest", "default:chest_locked") +minetest.register_alias("cobble", "default:cobble") +minetest.register_alias("mossycobble", "default:mossycobble") +minetest.register_alias("steelblock", "default:steelblock") +minetest.register_alias("nyancat", "default:nyancat") +minetest.register_alias("nyancat_rainbow", "default:nyancat_rainbow") +minetest.register_alias("sapling", "default:sapling") +minetest.register_alias("apple", "default:apple") + +minetest.register_alias("WPick", "default:pick_wood") +minetest.register_alias("STPick", "default:pick_stone") +minetest.register_alias("SteelPick", "default:pick_steel") +minetest.register_alias("MesePick", "default:pick_mese") +minetest.register_alias("WShovel", "default:shovel_wood") +minetest.register_alias("STShovel", "default:shovel_stone") +minetest.register_alias("SteelShovel", "default:shovel_steel") +minetest.register_alias("WAxe", "default:axe_wood") +minetest.register_alias("STAxe", "default:axe_stone") +minetest.register_alias("SteelAxe", "default:axe_steel") +minetest.register_alias("WSword", "default:sword_wood") +minetest.register_alias("STSword", "default:sword_stone") +minetest.register_alias("SteelSword", "default:sword_steel") + +minetest.register_alias("Stick", "default:stick") +minetest.register_alias("paper", "default:paper") +minetest.register_alias("book", "default:book") +minetest.register_alias("lump_of_coal", "default:coal_lump") +minetest.register_alias("lump_of_iron", "default:iron_lump") +minetest.register_alias("lump_of_clay", "default:clay_lump") +minetest.register_alias("steel_ingot", "default:steel_ingot") +minetest.register_alias("clay_brick", "default:clay_brick") +minetest.register_alias("scorched_stuff", "default:scorched_stuff") + +-- +-- Old items +-- + +minetest.register_craftitem(":rat", { + description = "Rat", + inventory_image = "rat.png", + on_drop = function(item, dropper, pos) + minetest.env:add_rat(pos) + item:take_item() + return item + end, + on_place = function(item, dropped, pointed) + pos = minetest.get_pointed_thing_position(pointed, true) + if pos ~= nil then + minetest.env:add_rat(pos) + item:take_item() + return item + end + end +}) + +minetest.register_craftitem(":cooked_rat", { + description = "Cooked rat", + inventory_image = "cooked_rat.png", + on_use = minetest.item_eat(6), +}) + +minetest.register_craftitem(":firefly", { + description = "Firefly", + inventory_image = "firefly.png", + groups = {not_in_creative_inventory=1}, + on_drop = function(item, dropper, pos) + minetest.env:add_firefly(pos) + item:take_item() + return item + end, + on_place = function(item, dropped, pointed) + pos = minetest.get_pointed_thing_position(pointed, true) + if pos ~= nil then + minetest.env:add_firefly(pos) + item:take_item() + return item + end + end +}) + +minetest.register_craft({ + type = "cooking", + output = "cooked_rat", + recipe = "rat", +}) + +minetest.register_craft({ + type = "cooking", + output = "scorched_stuff", + recipe = "cooked_rat", +}) + +-- END diff --git a/mods/legacy/textures/apple_iron.png b/mods/legacy/textures/apple_iron.png new file mode 100644 index 0000000..2dffdf0 Binary files /dev/null and b/mods/legacy/textures/apple_iron.png differ diff --git a/mods/legacy/textures/cooked_rat.png b/mods/legacy/textures/cooked_rat.png new file mode 100644 index 0000000..daad3be Binary files /dev/null and b/mods/legacy/textures/cooked_rat.png differ diff --git a/mods/legacy/textures/dungeon_master.png b/mods/legacy/textures/dungeon_master.png new file mode 100644 index 0000000..3457c82 Binary files /dev/null and b/mods/legacy/textures/dungeon_master.png differ diff --git a/mods/legacy/textures/fireball.png b/mods/legacy/textures/fireball.png new file mode 100644 index 0000000..5231428 Binary files /dev/null and b/mods/legacy/textures/fireball.png differ diff --git a/mods/legacy/textures/firefly.png b/mods/legacy/textures/firefly.png new file mode 100644 index 0000000..40df7fa Binary files /dev/null and b/mods/legacy/textures/firefly.png differ diff --git a/mods/legacy/textures/oerkki1.png b/mods/legacy/textures/oerkki1.png new file mode 100644 index 0000000..33cbac9 Binary files /dev/null and b/mods/legacy/textures/oerkki1.png differ diff --git a/mods/legacy/textures/oerkki1_damaged.png b/mods/legacy/textures/oerkki1_damaged.png new file mode 100644 index 0000000..9b77738 Binary files /dev/null and b/mods/legacy/textures/oerkki1_damaged.png differ diff --git a/mods/legacy/textures/rat.png b/mods/legacy/textures/rat.png new file mode 100644 index 0000000..d1a0e2a Binary files /dev/null and b/mods/legacy/textures/rat.png differ diff --git a/mods/stairs/README.txt b/mods/stairs/README.txt new file mode 100644 index 0000000..716a677 --- /dev/null +++ b/mods/stairs/README.txt @@ -0,0 +1,26 @@ +Minetest 0.4 mod: stairs +========================= + +License of source code: +----------------------- +Copyright (C) 2011-2012 Kahrl +Copyright (C) 2011-2012 celeron55, Perttu Ahola + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +http://www.gnu.org/licenses/lgpl-2.1.html + +License of media (textures and sounds) +-------------------------------------- +Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) +http://creativecommons.org/licenses/by-sa/3.0/ + +Authors of media files +----------------------- +Everything not listed in here: +Copyright (C) 2010-2012 celeron55, Perttu Ahola + + diff --git a/mods/stairs/depends.txt b/mods/stairs/depends.txt new file mode 100644 index 0000000..4ad96d5 --- /dev/null +++ b/mods/stairs/depends.txt @@ -0,0 +1 @@ +default diff --git a/mods/stairs/init.lua b/mods/stairs/init.lua new file mode 100644 index 0000000..1b00ef3 --- /dev/null +++ b/mods/stairs/init.lua @@ -0,0 +1,146 @@ +-- Minetest 0.4 mod: stairs +-- See README.txt for licensing and other information. + +stairs = {} + +-- Node will be called stairs:stair_ +function stairs.register_stair(subname, recipeitem, groups, images, description) + minetest.register_node("stairs:stair_" .. subname, { + description = description, + drawtype = "nodebox", + tiles = images, + paramtype = "light", + paramtype2 = "facedir", + is_ground_content = true, + groups = groups, + node_box = { + type = "fixed", + fixed = { + {-0.5, -0.5, -0.5, 0.5, 0, 0.5}, + {-0.5, 0, 0, 0.5, 0.5, 0.5}, + }, + }, + }) + + minetest.register_craft({ + output = 'stairs:stair_' .. subname .. ' 4', + recipe = { + {recipeitem, "", ""}, + {recipeitem, recipeitem, ""}, + {recipeitem, recipeitem, recipeitem}, + }, + }) + + -- Flipped recipe for the silly minecrafters + minetest.register_craft({ + output = 'stairs:stair_' .. subname .. ' 4', + recipe = { + {"", "", recipeitem}, + {"", recipeitem, recipeitem}, + {recipeitem, recipeitem, recipeitem}, + }, + }) +end + +-- Node will be called stairs:slab_ +function stairs.register_slab(subname, recipeitem, groups, images, description) + minetest.register_node("stairs:slab_" .. subname, { + description = description, + drawtype = "nodebox", + tiles = images, + paramtype = "light", + is_ground_content = true, + groups = groups, + node_box = { + type = "fixed", + fixed = {-0.5, -0.5, -0.5, 0.5, 0, 0.5}, + }, + selection_box = { + type = "fixed", + fixed = {-0.5, -0.5, -0.5, 0.5, 0, 0.5}, + }, + on_place = function(itemstack, placer, pointed_thing) + if pointed_thing.type ~= "node" then + return itemstack + end + + -- If it's being placed on an another similar one, replace it with + -- a full block + local slabpos = nil + local slabnode = nil + local p0 = pointed_thing.under + local p1 = pointed_thing.above + local n0 = minetest.env:get_node(p0) + local n1 = minetest.env:get_node(p1) + if n0.name == "stairs:slab_" .. subname then + slabpos = p0 + slabnode = n0 + elseif n1.name == "stairs:slab_" .. subname then + slabpos = p1 + slabnode = n1 + end + if slabpos then + -- Remove the slab at slabpos + minetest.env:remove_node(slabpos) + -- Make a fake stack of a single item and try to place it + local fakestack = ItemStack(recipeitem) + pointed_thing.above = slabpos + fakestack = minetest.item_place(fakestack, placer, pointed_thing) + -- If the item was taken from the fake stack, decrement original + if not fakestack or fakestack:is_empty() then + itemstack:take_item(1) + -- Else put old node back + else + minetest.env:set_node(slabpos, slabnode) + end + return itemstack + end + + -- Otherwise place regularly + return minetest.item_place(itemstack, placer, pointed_thing) + end, + }) + + minetest.register_craft({ + output = 'stairs:slab_' .. subname .. ' 3', + recipe = { + {recipeitem, recipeitem, recipeitem}, + }, + }) +end + +-- Nodes will be called stairs:{stair,slab}_ +function stairs.register_stair_and_slab(subname, recipeitem, groups, images, desc_stair, desc_slab) + stairs.register_stair(subname, recipeitem, groups, images, desc_stair) + stairs.register_slab(subname, recipeitem, groups, images, desc_slab) +end + +stairs.register_stair_and_slab("wood", "default:wood", + {snappy=2,choppy=2,oddly_breakable_by_hand=2}, + {"default_wood.png"}, + "Wooden stair", + "Wooden slab") + +stairs.register_stair_and_slab("stone", "default:stone", + {cracky=3}, + {"default_stone.png"}, + "Stone stair", + "Stone slab") + +stairs.register_stair_and_slab("cobble", "default:cobble", + {cracky=3}, + {"default_cobble.png"}, + "Cobble stair", + "Cobble slab") + +stairs.register_stair_and_slab("brick", "default:brick", + {cracky=3}, + {"default_brick.png"}, + "Brick stair", + "Brick slab") + +stairs.register_stair_and_slab("sandstone", "default:sandstone", + {crumbly=2,cracky=2}, + {"default_sandstone.png"}, + "Sandstone stair", + "Sandstone slab") diff --git a/mods/vessels/README.txt b/mods/vessels/README.txt new file mode 100644 index 0000000..150b501 --- /dev/null +++ b/mods/vessels/README.txt @@ -0,0 +1,45 @@ +Minetest 0.4 mod: vessels +========================== + +Crafts +------- +Glass bottle (yields 10) + + G - G + G - G + - G - + +Drinking Glass (yields 14) + + G - G + G - G + G G G + +Heavy Steel Bottle (yields 5) + + S - S + S - S + - S - + +License of source code: +----------------------- +Copyright (C) 2012 Vanessa Ezekowitz +Version 2012-09-02 +Modifications by Perttu Ahola + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 2.1 of the License, or +(at your option) any later version. + +http://www.gnu.org/licenses/lgpl-2.1.html + +License of media (textures and sounds) +-------------------------------------- +WTFPL + +Authors of media files +----------------------- +Unless specifically noted, +Copyright (C) 2012 Vanessa Ezekowitz + diff --git a/mods/vessels/depends.txt b/mods/vessels/depends.txt new file mode 100644 index 0000000..4ad96d5 --- /dev/null +++ b/mods/vessels/depends.txt @@ -0,0 +1 @@ +default diff --git a/mods/vessels/init.lua b/mods/vessels/init.lua new file mode 100644 index 0000000..81cbad3 --- /dev/null +++ b/mods/vessels/init.lua @@ -0,0 +1,86 @@ +-- Minetest 0.4 mod: vessels +-- See README.txt for licensing and other information. + +minetest.register_craftitem("vessels:glass_bottle", { + description = "Glass Bottle (empty)", + inventory_image = "vessels_glass_bottle.png", + groups = {vessel=1}, +}) + +minetest.register_craft( { + output = "vessels:glass_bottle 10", + recipe = { + { "default:glass", "", "default:glass" }, + { "default:glass", "", "default:glass" }, + { "", "default:glass", "" } + } +}) + +minetest.register_craftitem("vessels:drinking_glass", { + description = "Drinking Glass (empty)", + inventory_image = "vessels_drinking_glass.png", + groups = {vessel=1}, +}) + +minetest.register_craft( { + output = "vessels:drinking_glass 14", + recipe = { + { "default:glass", "", "default:glass" }, + { "default:glass", "", "default:glass" }, + { "default:glass", "default:glass", "default:glass" } + } +}) + +minetest.register_craftitem("vessels:steel_bottle", { + description = "Heavy Steel Bottle (empty)", + inventory_image = "vessels_steel_bottle.png", + groups = {vessel=1}, +}) + +minetest.register_craft( { + output = "vessels:steel_bottle 5", + recipe = { + { "default:steel_ingot", "", "default:steel_ingot" }, + { "default:steel_ingot", "", "default:steel_ingot" }, + { "", "default:steel_ingot", "" } + } +}) + + +-- Make sure we can recycle them + +minetest.register_craftitem("vessels:glass_fragments", { + description = "Pile of Glass Fragments", + inventory_image = "vessels_glass_fragments.png", +}) + +minetest.register_craft( { + type = "shapeless", + output = "vessels:glass_fragments", + recipe = { + "vessels:glass_bottle", + "vessels:glass_bottle", + }, +}) + +minetest.register_craft( { + type = "shapeless", + output = "vessels:glass_fragments", + recipe = { + "vessels:drinking_glass", + "vessels:drinking_glass", + }, +}) + +minetest.register_craft({ + type = "cooking", + output = "default:glass", + recipe = "vessels:glass_fragments", +}) + +minetest.register_craft( { + type = "cooking", + output = "default:steel_ingot", + recipe = "vessels:steel_bottle", +}) + diff --git a/mods/vessels/textures/alternates/vessels_drinking_glass.png b/mods/vessels/textures/alternates/vessels_drinking_glass.png new file mode 100644 index 0000000..8ad033e Binary files /dev/null and b/mods/vessels/textures/alternates/vessels_drinking_glass.png differ diff --git a/mods/vessels/textures/alternates/vessels_glass_bottle.png b/mods/vessels/textures/alternates/vessels_glass_bottle.png new file mode 100644 index 0000000..d922579 Binary files /dev/null and b/mods/vessels/textures/alternates/vessels_glass_bottle.png differ diff --git a/mods/vessels/textures/alternates/vessels_steel_bottle.png b/mods/vessels/textures/alternates/vessels_steel_bottle.png new file mode 100644 index 0000000..629c857 Binary files /dev/null and b/mods/vessels/textures/alternates/vessels_steel_bottle.png differ diff --git a/mods/vessels/textures/vessels_drinking_glass.png b/mods/vessels/textures/vessels_drinking_glass.png new file mode 100644 index 0000000..18f5cb8 Binary files /dev/null and b/mods/vessels/textures/vessels_drinking_glass.png differ diff --git a/mods/vessels/textures/vessels_glass_bottle.png b/mods/vessels/textures/vessels_glass_bottle.png new file mode 100644 index 0000000..c325fd1 Binary files /dev/null and b/mods/vessels/textures/vessels_glass_bottle.png differ diff --git a/mods/vessels/textures/vessels_glass_fragments.png b/mods/vessels/textures/vessels_glass_fragments.png new file mode 100644 index 0000000..7772a23 Binary files /dev/null and b/mods/vessels/textures/vessels_glass_fragments.png differ diff --git a/mods/vessels/textures/vessels_steel_bottle.png b/mods/vessels/textures/vessels_steel_bottle.png new file mode 100644 index 0000000..d2b846d Binary files /dev/null and b/mods/vessels/textures/vessels_steel_bottle.png differ diff --git a/mods/wool/README.txt b/mods/wool/README.txt new file mode 100644 index 0000000..9db1332 --- /dev/null +++ b/mods/wool/README.txt @@ -0,0 +1,28 @@ +Minetest 0.4 mod: wool +====================== + +Mostly backward-compatible with jordach's 16-color wool mod. + +License of source code: +----------------------- +Copyright (C) 2012 Perttu Ahola (celeron55) + +This program is free software. It comes without any warranty, to +the extent permitted by applicable law. You can redistribute it +and/or modify it under the terms of the Do What The Fuck You Want +To Public License, Version 2, as published by Sam Hocevar. See +http://sam.zoy.org/wtfpl/COPYING for more details. + +License of media (textures and sounds) +-------------------------------------- +Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) +http://creativecommons.org/licenses/by-sa/3.0/ + +Authors of media files +----------------------- +Cisoun: +- wool_black.png wool_brown.png wool_dark_green.png wool_green.png +- wool_magenta.png wool_pink.png wool_violet.png wool_yellow.png wool_blue.png +- wool_cyan.png wool_dark_grey.png wool_grey.png wool_orange.png wool_red.png +- wool_white.png + diff --git a/mods/wool/depends.txt b/mods/wool/depends.txt new file mode 100644 index 0000000..e69de29 diff --git a/mods/wool/init.lua b/mods/wool/init.lua new file mode 100644 index 0000000..8b69a9e --- /dev/null +++ b/mods/wool/init.lua @@ -0,0 +1,48 @@ +-- minetest/wool/init.lua + +-- Backwards compatibility with jordach's 16-color wool mod +minetest.register_alias("wool:dark_blue", "wool:blue") +minetest.register_alias("wool:gold", "wool:yellow") + +local wool = {} +-- This uses a trick: you can first define the recipes using all of the base +-- colors, and then some recipes using more specific colors for a few non-base +-- colors available. When crafting, the last recipes will be checked first. +wool.dyes = { + {"white", "White", nil}, + {"grey", "Grey", "basecolor_grey"}, + {"black", "Black", "basecolor_black"}, + {"red", "Red", "basecolor_red"}, + {"yellow", "Yellow", "basecolor_yellow"}, + {"green", "Green", "basecolor_green"}, + {"cyan", "Cyan", "basecolor_cyan"}, + {"blue", "Blue", "basecolor_blue"}, + {"magenta", "Magenta", "basecolor_magenta"}, + {"orange", "Orange", "excolor_orange"}, + {"violet", "Violet", "excolor_violet"}, + {"brown", "Brown", "unicolor_dark_orange"}, + {"pink", "Pink", "unicolor_light_red"}, + {"dark_grey", "Dark Grey", "unicolor_darkgrey"}, + {"dark_green", "Dark Green", "unicolor_dark_green"}, +} + +for _, row in ipairs(wool.dyes) do + local name = row[1] + local desc = row[2] + local craft_color_group = row[3] + -- Node Definition + minetest.register_node("wool:"..name, { + description = desc.." Wool", + tiles = {"wool_"..name..".png"}, + groups = {snappy=2,choppy=2,oddly_breakable_by_hand=3,flammable=3}, + }) + if craft_color_group then + -- Crafting from dye and white wool + minetest.register_craft({ + type = "shapeless", + output = 'wool:'..name..' 16', + recipe = {'group:dye,'..craft_color_group, 'wool:white'}, + }) + end +end + diff --git a/mods/wool/textures/wool_black.png b/mods/wool/textures/wool_black.png new file mode 100644 index 0000000..f22e3bb Binary files /dev/null and b/mods/wool/textures/wool_black.png differ diff --git a/mods/wool/textures/wool_blue.png b/mods/wool/textures/wool_blue.png new file mode 100644 index 0000000..826d397 Binary files /dev/null and b/mods/wool/textures/wool_blue.png differ diff --git a/mods/wool/textures/wool_brown.png b/mods/wool/textures/wool_brown.png new file mode 100644 index 0000000..0dcee4b Binary files /dev/null and b/mods/wool/textures/wool_brown.png differ diff --git a/mods/wool/textures/wool_cyan.png b/mods/wool/textures/wool_cyan.png new file mode 100644 index 0000000..372ef45 Binary files /dev/null and b/mods/wool/textures/wool_cyan.png differ diff --git a/mods/wool/textures/wool_dark_green.png b/mods/wool/textures/wool_dark_green.png new file mode 100644 index 0000000..54d12f6 Binary files /dev/null and b/mods/wool/textures/wool_dark_green.png differ diff --git a/mods/wool/textures/wool_dark_grey.png b/mods/wool/textures/wool_dark_grey.png new file mode 100644 index 0000000..c15bec4 Binary files /dev/null and b/mods/wool/textures/wool_dark_grey.png differ diff --git a/mods/wool/textures/wool_green.png b/mods/wool/textures/wool_green.png new file mode 100644 index 0000000..d70fe2b Binary files /dev/null and b/mods/wool/textures/wool_green.png differ diff --git a/mods/wool/textures/wool_grey.png b/mods/wool/textures/wool_grey.png new file mode 100644 index 0000000..86e647c Binary files /dev/null and b/mods/wool/textures/wool_grey.png differ diff --git a/mods/wool/textures/wool_magenta.png b/mods/wool/textures/wool_magenta.png new file mode 100644 index 0000000..c4da6ae Binary files /dev/null and b/mods/wool/textures/wool_magenta.png differ diff --git a/mods/wool/textures/wool_orange.png b/mods/wool/textures/wool_orange.png new file mode 100644 index 0000000..2a76cf9 Binary files /dev/null and b/mods/wool/textures/wool_orange.png differ diff --git a/mods/wool/textures/wool_pink.png b/mods/wool/textures/wool_pink.png new file mode 100644 index 0000000..6d59544 Binary files /dev/null and b/mods/wool/textures/wool_pink.png differ diff --git a/mods/wool/textures/wool_red.png b/mods/wool/textures/wool_red.png new file mode 100644 index 0000000..ab4dd64 Binary files /dev/null and b/mods/wool/textures/wool_red.png differ diff --git a/mods/wool/textures/wool_violet.png b/mods/wool/textures/wool_violet.png new file mode 100644 index 0000000..653af58 Binary files /dev/null and b/mods/wool/textures/wool_violet.png differ diff --git a/mods/wool/textures/wool_white.png b/mods/wool/textures/wool_white.png new file mode 100644 index 0000000..f3371aa Binary files /dev/null and b/mods/wool/textures/wool_white.png differ diff --git a/mods/wool/textures/wool_yellow.png b/mods/wool/textures/wool_yellow.png new file mode 100644 index 0000000..5c5d72f Binary files /dev/null and b/mods/wool/textures/wool_yellow.png differ