diff options
author | Calinou <calinou9999spam@gmail.com> | 2013-07-11 20:33:02 +0200 |
---|---|---|
committer | Calinou <calinou9999spam@gmail.com> | 2013-07-11 20:33:02 +0200 |
commit | 85aea72376f98a8fc17c3f109a4dd0d987c2b6eb (patch) | |
tree | b92b414a4c474f5a13ef364e044840a4b3a1f288 | |
parent | f9bddb6dda60cda59667ef600e570f5774efe6cf (diff) | |
download | moreblocks-85aea72376f98a8fc17c3f109a4dd0d987c2b6eb.tar.gz moreblocks-85aea72376f98a8fc17c3f109a4dd0d987c2b6eb.tar.bz2 moreblocks-85aea72376f98a8fc17c3f109a4dd0d987c2b6eb.zip |
More Blocks
66 files changed, 2809 insertions, 2 deletions
diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 0000000..f42bd64 --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,13 @@ ++---- zlib/libpng license ----+ + +Copyright (c) 2013 Calinou + +This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. + +Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. + +2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. + +3. This notice may not be removed or altered from any source distribution. diff --git a/README.md b/README.md deleted file mode 100644 index f0f635d..0000000 --- a/README.md +++ /dev/null @@ -1,2 +0,0 @@ -moreblocks -========== diff --git a/README.txt b/README.txt new file mode 100644 index 0000000..4c15581 --- /dev/null +++ b/README.txt @@ -0,0 +1,22 @@ +Calinou's Minetest Mods +===================== + +Calinou's Mods for Minetest [http://minetest.net], a free and opensource Minecraft-like game. + +This Git repository is mostly made for servers; it allows easy updating. + +To install, just clone this repository somewhere, then copy the "calinou_mods" folder in the "mods/minetest" folder of Minetest's installation folder. + + + +Misc stuff +===================== + +All these mods' source codes, except More Ores are under the zlib/libpng license. More Ores is under the GNU GPLv3; the mods' textures are under the CC BY-SA 3.0 Unported. + +Mods' forum threads: +More Blocks: http://minetest.net/forum/viewtopic.php?id=509 +More Ores: http://minetest.net/forum/viewtopic.php?id=549 +Map Tools: http://minetest.net/forum/viewtopic.php?id=1882 +Doors+: http://minetest.net/forum/viewtopic.php?id=2059 +Stairs+: http://minetest.net/forum/viewtopic.php?id=2092 diff --git a/_config.txt b/_config.txt new file mode 100644 index 0000000..b4395f4 --- /dev/null +++ b/_config.txt @@ -0,0 +1,11 @@ +------------------------------------------------------------------------------ +------------------------------ CONFIGURATION --------------------------------- +------------------------------------------------------------------------------ + +------------------------------------------------------------------------------ +-------- Change settings by changing the values after the "=". --------------- +------------------------------------------------------------------------------ + + +-- Whether to direct wood based on player yaw when placing the block +wood_facedir = true diff --git a/aliases.lua b/aliases.lua new file mode 100644 index 0000000..f13b443 --- /dev/null +++ b/aliases.lua @@ -0,0 +1,183 @@ +-- Aliases (some of them are about the default mod, some about moreblocks) + +-- Additional default aliases + +minetest.register_alias("woodpick", "default:pick_wood") +minetest.register_alias("woodenpick", "default:pick_wood") +minetest.register_alias("stonepick", "default:pick_stone") +minetest.register_alias("steelpick", "default:pick_steel") +minetest.register_alias("ironpick", "default:pick_steel") +minetest.register_alias("mesepick", "default:pick_mese") + +minetest.register_alias("woodaxe", "default:axe_wood") +minetest.register_alias("woodenaxe", "default:axe_wood") +minetest.register_alias("stoneaxe", "default:axe_stone") +minetest.register_alias("steelaxe", "default:axe_steel") +minetest.register_alias("ironaxe", "default:axe_steel") + +minetest.register_alias("woodshovel", "default:shovel_wood") +minetest.register_alias("woodenshovel", "default:shovel_wood") +minetest.register_alias("stoneshovel", "default:shovel_stone") +minetest.register_alias("steelshovel", "default:shovel_steel") +minetest.register_alias("ironshovel", "default:shovel_steel") + +minetest.register_alias("woodsword", "default:sword_wood") +minetest.register_alias("woodensword", "default:sword_wood") +minetest.register_alias("stonesword", "default:sword_stone") +minetest.register_alias("steelsword", "default:sword_steel") +minetest.register_alias("ironsword", "default:sword_steel") + +minetest.register_alias("grass", "default:dirt_with_grass") +minetest.register_alias("grassblock", "default:dirt_with_grass") +minetest.register_alias("grass_block", "default:dirt_with_grass") + +minetest.register_alias("grassfootsteps", "default:dirt_with_grass_footsteps") +minetest.register_alias("grass_footsteps", "default:dirt_with_grass_footsteps") + +minetest.register_alias("jungle_tree", "default:jungletree") + +minetest.register_alias("stick", "default:stick") +minetest.register_alias("sign", "default:sign_wall") +minetest.register_alias("fence", "default:fence_wood") +minetest.register_alias("coal", "default:coal_lump") +minetest.register_alias("iron", "default:iron_lump") +minetest.register_alias("clay", "default:clay_lump") +minetest.register_alias("steel", "default:steel_ingot") +minetest.register_alias("steel_block", "default:steelblock") + +minetest.register_alias("stonebrick", "default:stonebrick") +minetest.register_alias("stonebricks", "default:stonebrick") +minetest.register_alias("stone_brick", "default:stonebrick") +minetest.register_alias("stone_bricks", "default:stonebrick") + +minetest.register_alias("sweeper", "moreblocks:sweeper") +minetest.register_alias("circularsaw", "moreblocks:circular_saw") +minetest.register_alias("circular_saw", "moreblocks:circular_saw") +minetest.register_alias("screwdriver", "moreblocks:screwdriver") +minetest.register_alias("screw_driver", "moreblocks:screw_driver") +minetest.register_alias("screwdrive", "moreblocks:screw_driver") +minetest.register_alias("screw_drive", "moreblocks:screw_driver") +minetest.register_alias("sweep", "moreblocks:sweeper") +minetest.register_alias("junglestick", "moreblocks:jungle_stick") +minetest.register_alias("jungle_stick", "moreblocks:jungle_stick") + +minetest.register_alias("obsidian", "default:obsidian") +minetest.register_alias("obsidianglass", "default:obsidian_glass") +minetest.register_alias("obsidian_glass", "default:obsidian_glass") + +-- More Blocks aliases + +minetest.register_alias("circlestonebrick", "moreblocks:circle_stone_bricks") +minetest.register_alias("circlestonebricks", "moreblocks:circle_stone_bricks") +minetest.register_alias("circlestone_brick", "moreblocks:circle_stone_bricks") +minetest.register_alias("circlestone_bricks", "moreblocks:circle_stone_bricks") +minetest.register_alias("circle_stonebrick", "moreblocks:circle_stone_bricks") +minetest.register_alias("circle_stonebricks", "moreblocks:circle_stone_bricks") +minetest.register_alias("circle_stone_brick", "moreblocks:circle_stone_bricks") +minetest.register_alias("circle_stone_bricks", "moreblocks:circle_stone_bricks") + +minetest.register_alias("stonesquare", "moreblocks:stone_tile") +minetest.register_alias("stonesquares", "moreblocks:stone_tile") +minetest.register_alias("stone_square", "moreblocks:stone_tile") +minetest.register_alias("stone_squares", "moreblocks:stone_tile") +minetest.register_alias("stonetile", "moreblocks:stone_tile") +minetest.register_alias("stonetiles", "moreblocks:stone_tile") +minetest.register_alias("stone_tile", "moreblocks:stone_tile") +minetest.register_alias("stone_tiles", "moreblocks:stone_tile") + +minetest.register_alias("splitstonesquare", "moreblocks:split_stone_tile") +minetest.register_alias("splitstonesquares", "moreblocks:split_stone_tile") +minetest.register_alias("split_stone_square", "moreblocks:split_stone_tile") +minetest.register_alias("split_stone_squares", "moreblocks:split_stone_tile") +minetest.register_alias("split_stonesquare", "moreblocks:split_stone_tile") +minetest.register_alias("split_stonesquares", "moreblocks:split_stone_tile") + +minetest.register_alias("coalstone", "moreblocks:coal_stone") +minetest.register_alias("coal_stone", "moreblocks:coal_stone") + +minetest.register_alias("ironstone", "moreblocks:iron_stone") +minetest.register_alias("iron_stone", "moreblocks:iron_stone") + +minetest.register_alias("coalglass", "moreblocks:coal_glass") +minetest.register_alias("coal_glass", "moreblocks:coal_glass") + +minetest.register_alias("ironglass", "moreblocks:iron_glass") +minetest.register_alias("iron_glass", "moreblocks:iron_glass") + +minetest.register_alias("glowglass", "moreblocks:glow_glass") +minetest.register_alias("glow_glass", "moreblocks:glow_glass") + +minetest.register_alias("superglowglass", "moreblocks:super_glow_glass") +minetest.register_alias("super_glowglass", "moreblocks:super_glow_glass") +minetest.register_alias("super_glow_glass", "moreblocks:super_glow_glass") + +minetest.register_alias("plankstone", "moreblocks:plankstone") + +minetest.register_alias("cactusbrick", "moreblocks:cactus_brick") +minetest.register_alias("cactus_brick", "moreblocks:cactus_brick") + +minetest.register_alias("cactuschecker", "moreblocks:cactus_checker") +minetest.register_alias("cactus_checker", "moreblocks:cactus_checker") + +minetest.register_alias("coalchecker", "moreblocks:coal_checker") +minetest.register_alias("coal_checker", "moreblocks:coal_checker") + +minetest.register_alias("ironchecker", "moreblocks:iron_checker") +minetest.register_alias("iron_checker", "moreblocks:iron_checker") + +minetest.register_alias("woodtile", "moreblocks:wood_tile") +minetest.register_alias("woodentile", "moreblocks:wood_tile") +minetest.register_alias("wood_tile", "moreblocks:wood_tile") +minetest.register_alias("wooden_tile", "moreblocks:wood_tile") + +minetest.register_alias("woodtile_full", "moreblocks:wood_tile_full") +minetest.register_alias("woodentile_full", "moreblocks:wood_tile_full") +minetest.register_alias("wood_tile_full", "moreblocks:wood_tile_full") +minetest.register_alias("wooden_tile_full", "moreblocks:wood_tile_full") +minetest.register_alias("full_woodtile", "moreblocks:wood_tile_full") +minetest.register_alias("full_woodentile", "moreblocks:wood_tile_full") +minetest.register_alias("full_wood_tile", "moreblocks:wood_tile_full") +minetest.register_alias("full_wooden_tile", "moreblocks:wood_tile_full") + +-- Old block/item replacement + +minetest.register_alias("moreblocks:oerkkiblock", "default:mossycobble") +minetest.register_alias("moreblocks:screwdriver", "screwdriver:screwdriver") + +-- Node and item renaming + +minetest.register_alias("moreblocks:stone_bricks", "default:stonebrick") +minetest.register_alias("moreblocks:stonebrick", "default:stonebrick") +minetest.register_alias("moreblocks:junglewood", "default:junglewood") +minetest.register_alias("moreblocks:jungle_wood", "default:junglewood") + +minetest.register_alias("moreblocks:horizontaltree", "moreblocks:horizontal_tree") +minetest.register_alias("moreblocks:horizontaljungletree", "moreblocks:horizontal_jungle_tree") +minetest.register_alias("moreblocks:stonesquare", "moreblocks:stone_tile") +minetest.register_alias("moreblocks:circlestonebrick", "moreblocks:circle_stone_bricks") +minetest.register_alias("moreblocks:ironstonebrick", "moreblocks:iron_stone_bricks") +minetest.register_alias("moreblocks:fence_junglewood", "moreblocks:fence_jungle_wood") +minetest.register_alias("moreblocks:coalstone", "moreblocks:coal_stone") +minetest.register_alias("moreblocks:ironstone", "moreblocks:iron_stone") +minetest.register_alias("moreblocks:woodtile", "moreblocks:wood_tile") +minetest.register_alias("moreblocks:woodtile_full", "moreblocks:wood_tile_full") +minetest.register_alias("moreblocks:woodtile_centered", "moreblocks:wood_tile_centered") +minetest.register_alias("moreblocks:woodtile_up", "moreblocks:wood_tile_up") +minetest.register_alias("moreblocks:woodtile_down", "moreblocks:wood_tile_down") +minetest.register_alias("moreblocks:woodtile_left", "moreblocks:wood_tile_left") +minetest.register_alias("moreblocks:woodtile_right", "moreblocks:wood_tile_right") +minetest.register_alias("moreblocks:coalglass", "moreblocks:coal_glass") +minetest.register_alias("moreblocks:ironglass", "moreblocks:iron_glass") +minetest.register_alias("moreblocks:glowglass", "moreblocks:glow_glass") +minetest.register_alias("moreblocks:superglowglass", "moreblocks:super_glow_glass") +minetest.register_alias("moreblocks:trapglass", "moreblocks:trap_glass") +minetest.register_alias("moreblocks:trapstone", "moreblocks:trap_stone") +minetest.register_alias("moreblocks:cactuschecker", "moreblocks:cactus_checker") +minetest.register_alias("moreblocks:coalchecker", "moreblocks:coal_checker") +minetest.register_alias("moreblocks:ironchecker", "moreblocks:iron_checker") +minetest.register_alias("moreblocks:cactusbrick", "moreblocks:cactus_brick") +minetest.register_alias("moreblocks:cleanglass", "moreblocks:clean_glass") +minetest.register_alias("moreblocks:emptybookshelf", "moreblocks:empty_bookshelf") +minetest.register_alias("moreblocks:junglestick", "moreblocks:jungle_stick") +minetest.register_alias("moreblocks:splitstonesquare","moreblocks:split_stone_tile") +minetest.register_alias("moreblocks:allfacestree","moreblocks:all_faces_tree") diff --git a/circular_saw.lua b/circular_saw.lua new file mode 100644 index 0000000..1e385c9 --- /dev/null +++ b/circular_saw.lua @@ -0,0 +1,365 @@ +-- Load translation library if intllib is installed + +local S +if (minetest.get_modpath("intllib")) then + dofile(minetest.get_modpath("intllib").."/intllib.lua") + S = intllib.Getter(minetest.get_current_modname()) + else + S = function ( s ) return s end +end + +circular_saw = {}; + +circular_saw.known_stairs = {} + + +-- Register known moreblocks stairs +for i,v in ipairs({"default:wood", "default:stone", "default:cobble", "default:mossycobble", "default:brick", "default:sandstone", + "default:steelblock", "default:desert_stone", "default:glass", "default:tree", "default:jungletree", "default:stonebrick", + "default:obsidian", "default:obsidian_glass", "default:stone_bricks", "default:junglewood", "default:goldblock", + "default:copperblock", "default:bronzeblock", "default:diamondblock", "default:desert_stonebrick", "default:sandstonebrick", + + "moreblocks:coal_stone", "moreblocks:iron_stone", "moreblocks:coal_checker", "moreblocks:iron_checker", + "moreblocks:cactus_checker", "moreblocks:coal_glass", "moreblocks:iron_glass", "moreblocks:glow_glass", + "moreblocks:super_glow_glass", "moreblocks:wooden_tile", "moreblocks:stone_tile", "moreblocks:split_stone_tile", + "moreblocks:iron_stone_bricks", "moreblocks:circle_stone_bricks", "moreblocks:wood_tile_centered", + "moreblocks:wood_tile_full", "moreblocks:plank_stone"}) do + table.insert(circular_saw.known_stairs, v); +end + + +-- How many microblocks does this shape at the output inventory cost? +circular_saw.cost_in_microblocks = { 6, 7, 5, 3, 2, 4, 6, + 2, 1, 4, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0 }; + +-- anz: amount of input material in microblocks +circular_saw.get_stair_output_inv = function(modname, material, anz, max) + + local max_offered = 99; + + if(not(max) or (max == nil) or tonumber(max) > 99 or tonumber(max) < 1) then + max_offered = 99; + else + max_offered = tonumber(max); + end + + + -- If there is nothing inside display empty inventory + if(anz < 1) then + return { "", "", "", "", "", "", "", + "", "", "", "", "", "", "", + "", "", "", "", "", "", "", + "", "", "", "", "", "", ""}; + end + + return { + modname .. ":stair_" .. material .. " " .. math.min(math.floor(anz/6), max_offered), + modname .. ":stair_" .. material .. "_inner " .. math.min(math.floor(anz/7), max_offered), + modname .. ":stair_" .. material .. "_outer " .. math.min(math.floor(anz/5), max_offered), + modname .. ":stair_" .. material .. "_half " .. math.min(math.floor(anz/3), max_offered), + modname .. ":slab_" .. material .. "_quarter " .. math.min(math.floor(anz/2), max_offered), + modname .. ":slab_" .. material .. " " .. math.min(math.floor(anz/4), max_offered), + modname .. ":slab_" .. material .. "_three_quarter " .. math.min(math.floor(anz/6), max_offered), + + modname .. ":panel_" .. material .. "_bottom " .. math.min(math.floor(anz/2), max_offered), + modname .. ":micro_" .. material .. "_bottom " .. math.min(math.floor(anz/1), max_offered), + modname .. ":stair_" .. material .. "_alt " .. math.min(math.floor(anz/4), max_offered), + "", + } +end + + +-- Reset empty circular_saw after last full block has been taken out (or the circular_saw has been placed the first tiem); note: max_offered is not reset +circular_saw.reset_circular_saw = function(pos) + local meta = minetest.env:get_meta(pos); + local inv = meta:get_inventory(); + + inv:set_list("input", { "" }); + inv:set_list("micro", { "" }); + inv:set_list("output", circular_saw.get_stair_output_inv("", "", 0, meta:get_string("max_offered"))); + meta:set_int("anz", 0); + + meta:set_string("infotext", "Circular saw, empty (owned by " .. (meta:get_string("owner") or "") .. ")"); +end + + +-- Player has taken something out of the box or placed something inside; that amounts to count microblocks +circular_saw.update_inventory = function(pos, amount) + local meta = minetest.env:get_meta(pos); + local inv = meta:get_inventory(); + local akt = meta:get_int("anz"); + + -- The material is receicled automaticly + inv:set_list("recycle", { "" }); + + if(akt + amount < 1) then -- If the last block is taken out + + circular_saw.reset_circular_saw(pos); + return; + + end + + local stack = inv:get_stack("input", 1); + -- At least one "normal" block is necessary to see what kind of stairs are requested + if(stack:is_empty()) then + + -- Any microblocks not taken out yet are now lost (covers material loss in the machine) + circular_saw.reset_circular_saw(pos); + return; + + end + local node_name = stack:get_name(); + local liste = node_name:split(":"); + local modname = liste[1]; + local material = liste[2]; + + -- Display as many full blocks as possible + inv:set_list("input", { modname.. ":" .. material .. " " .. math.floor( (akt + amount) / 8) }); + + -- The stairnodes made of default nodes use moreblocks namespace, other mods keep own. + if(modname == "default") then modname = "moreblocks"; end + --print("circular_saw set to " ..modname.. " : " ..material.. " with " .. (akt+amount) .. " microblocks."); + + -- 0-7 microblocks may remain as a rest + inv:set_list("micro", { modname.. ":micro_" .. material .. "_bottom " .. ((akt + amount) % 8) }); + -- Display + inv:set_list("output", circular_saw.get_stair_output_inv(modname, material, (akt + amount), meta:get_string("max_offered"))); + -- Store how many microblocks are available + meta:set_int("anz", (akt+amount)); + + meta:set_string("infotext", "Circular saw, working with " ..material.. " (owned by " .. (meta:get_string("owner") or "") .. ")"); +end + + +-- The amount of items offered per shape can be configured +circular_saw.on_receive_fields = function(pos, formname, fields, sender) + local meta = minetest.env:get_meta(pos); + if(fields.max_offered and tonumber(fields.max_offered) > 0 and tonumber(fields.max_offered) < 99) then + meta:set_string("max_offered", fields.max_offered); + circular_saw.update_inventory(pos, 0); -- update to show the correct number of items + end +end + + +-- Moving the inventory of the circular_saw around is not allowed because it is a fictional inventory +circular_saw.allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player) + -- Moving inventory around would be rather immpractical and make things more difficult to calculate + return 0; +end + + +-- Only input- and recycle-slot are intended as input slots +circular_saw.allow_metadata_inventory_put = function(pos, listname, index, stack, player) + + -- The player is not allowed to put something in there + if(listname == "output" or listname == "micro") then + return 0; + end + + local meta = minetest.env:get_meta(pos); + local inv = meta:get_inventory(); + + -- Only alow those items that are offered in the output inventory to be recycled + if(listname == "recycle" and not(inv:contains_item("output", stack:get_name()))) then + return 0; + end + + -- Only accept certain blocks as input which are known to be craftable into stairs + if(listname == "input") then + + for i,v in ipairs(circular_saw.known_stairs) do + + if(circular_saw.known_stairs[ i ] == stack:get_name()) then + return stack:get_count(); + end + + end + return 0; + + end + + return stack:get_count() +end + +-- Taking is allowed from all slots (even the internal microblock slot) + +-- Putting something in is slightly more complicated than taking anything because we have to make sure it is of a suitable material +circular_saw.on_metadata_inventory_put = function(pos, listname, index, stack, player) + + -- We need to find out if the circular_saw is already set to a specific material or not + local meta = minetest.env:get_meta(pos); + local inv = meta:get_inventory(); + + -- Putting something into the input slot is only possible if that had been empty before or did contain something of the same material + if( listname=="input") then + + -- Each new block is worth 8 microblocks + circular_saw.update_inventory(pos, 8 * stack:get_count()); + + elseif(listname=="recycle") then + + -- Lets look which shape this represents + for i,v in ipairs(inv:get_list("output")) do + + if(v:get_name() == stack:get_name()) then + + local value = circular_saw.cost_in_microblocks[ i ] * stack:get_count(); + --print("\nRecycling " .. (v:get_name()) .. " into " ..value.. " microblocks."); + + -- We get value microblocks back + circular_saw.update_inventory(pos, value); + end + end + end +end + +-- The player takes something +circular_saw.on_metadata_inventory_take = function(pos, listname, index, stack, player) + + -- If it is one of the offered stairs: find out how many microblocks have to be substracted + if(listname=="output") then + + -- We do know how much each block at each position costs + local cost = circular_saw.cost_in_microblocks[ index ] * stack:get_count(); + + circular_saw.update_inventory(pos, -1 * cost); + + elseif(listname=="mikro") then + + -- Each microblock costs 1 microblock + circular_saw.update_inventory(pos, -1 * 1 * stack:get_count()); + + elseif(listname=="input") then + + -- Each normal (= full) block taken costs 8 microblocks + circular_saw.update_inventory(pos, -1 * 8 * stack:get_count()); + + end + -- The recycle field plays no role here since it is processed immediately +end + + +circular_saw.on_construct_init = function(pos, formspec) + + local meta = minetest.env:get_meta(pos) + meta:set_string("formspec", formspec); + + meta:set_int( "anz", 0); -- No microblocks inside yet + meta:set_string("max_offered", 99); -- How many items of this kind are offered by default? + meta:set_string("infotext", "Circular saw, empty") + + local inv = meta:get_inventory() + inv:set_size("input", 1) -- Input slot for full blocks of material x + inv:set_size("micro", 1) -- Storage for 1-7 surplus microblocks + inv:set_size("recycle", 1) -- Surplus partial blocks can be placed here + inv:set_size("output", 28) -- 4*7 versions of stair-parts of material x + + circular_saw.reset_circular_saw(pos); +end + + +circular_saw.can_dig = function(pos,player) + local meta = minetest.env:get_meta(pos); + local inv = meta:get_inventory() + if not inv:is_empty("input") then + return false + elseif not inv:is_empty("micro") then + return false + elseif not inv:is_empty("recycle") then + return false + end + + -- Can be digged by anyone when empty (not only by the owner) + return true +end, + + +minetest.register_node("moreblocks:circular_saw", { + description = S("Circular Saw"), + drawtype = "nodebox", + node_box = { + type = "fixed", + fixed = { + {-0.4, -0.5, -0.4, -0.25, 0.25, -0.25}, -- Leg + {0.25, -0.5, 0.25, 0.4, 0.25, 0.4}, -- Leg + {-0.4, -0.5, 0.25, -0.25, 0.25, 0.4}, -- Leg + {0.25, -0.5, -0.4, 0.4, 0.25, -0.25}, -- Leg + {-0.5, 0.25, -0.5, 0.5, 0.375, 0.5}, -- Tabletop + {-0.01, 0.4375, -0.125, 0.01, 0.5, 0.125}, -- Saw blade (top) + {-0.01, 0.375, -0.1875, 0.01, 0.4375, 0.1875}, -- Saw blade (bottom) + {-0.25, -0.0625, -0.25, 0.25, 0.25, 0.25}, -- Motor case + }, + }, + selection_box = { + type = "fixed", + fixed = { + {-0.4, -0.5, -0.4, -0.25, 0.25, -0.25}, -- Leg + {0.25, -0.5, 0.25, 0.4, 0.25, 0.4}, -- Leg + {-0.4, -0.5, 0.25, -0.25, 0.25, 0.4}, -- Leg + {0.25, -0.5, -0.4, 0.4, 0.25, -0.25}, -- Leg + {-0.5, 0.25, -0.5, 0.5, 0.375, 0.5}, -- Tabletop + {-0.01, 0.4375, -0.125, 0.01, 0.5, 0.125}, -- Saw blade (top) + {-0.01, 0.375, -0.1875, 0.01, 0.4375, 0.1875}, -- Saw blade (bottom) + {-0.25, -0.0625, -0.25, 0.25, 0.25, 0.25}, -- Motor case + }, + }, + tiles = {"moreblocks_circular_saw_top.png", "moreblocks_circular_saw_bottom.png", "moreblocks_circular_saw_side.png"}, + paramtype = "light", + sunlight_propagates = true, + paramtype2 = "facedir", + groups = {cracky=2}, + on_construct = function(pos) + return circular_saw.on_construct_init(pos, + "size[10,9]" .. + "list[current_name;input;0,0;1,1;]" .. + "label[0,0;Input material]" .. + "list[current_name;micro;0,1;1,1;]" .. + "label[0,1;Rest/microblocks]" .. + "field[0.3,2.5;1,1;max_offered;Max:;${max_offered}]" .. + "button[1,2;1,1;Set;Set]" .. + "list[current_name;recycle;0,3;1,1;]" .. + "label[0,3;Recycle output]" .. + "list[current_name;output;2,0;7,4;]" .. + "list[current_player;main;1,5;8,4;]"); + end, + + can_dig = function(pos,player) + return circular_saw.can_dig(pos, player); + end, + + -- Set owner of this circular saw + 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", "Circular saw is empty (owned by " .. (placer:get_player_name() or "") .. ")"); + end, + + -- The amount of items offered per shape can be configured + on_receive_fields = function(pos, formname, fields, sender) + return circular_saw.on_receive_fields(pos, formname, fields, sender); + end, + + allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player) + return circular_saw.allow_metadata_inventory_move(pos, from_list, from_index, to_list, to_index, count, player); + end, + + -- Only input- and recycle-slot are intended as input slots + allow_metadata_inventory_put = function(pos, listname, index, stack, player) + return circular_saw.allow_metadata_inventory_put(pos, listname, index, stack, player); + end, + + -- Taking is allowed from all slots (even the internal microblock slot); moving is forbidden + + -- Putting something in is slightly more complicated than taking anything because we have to make sure it is of a suitable material + on_metadata_inventory_put = function(pos, listname, index, stack, player) + return circular_saw.on_metadata_inventory_put(pos, listname, index, stack, player); + end, + + on_metadata_inventory_take = function(pos, listname, index, stack, player) + return circular_saw.on_metadata_inventory_take(pos, listname, index, stack, player); + end + +}) diff --git a/crafting.lua b/crafting.lua new file mode 100644 index 0000000..f772409 --- /dev/null +++ b/crafting.lua @@ -0,0 +1,375 @@ +-- Crafting + +minetest.register_craft({ + output = "default:stick 1", + recipe = { + {"default:dry_shrub"}, + } +}) + +minetest.register_craft({ + output = "default:dirt_with_grass 1", + recipe = { + {"default:junglegrass"}, + {"default:dirt"}, + } +}) + +minetest.register_craft({ + output = "default:dirt_with_grass 1", + recipe = { + {"default:mese"}, + {"default:dirt"}, + } +}) + +minetest.register_craft({ + output = "default:mossycobble 1", + recipe = { + {"default:junglegrass"}, + {"default:cobble"}, + } +}) + +minetest.register_craft({ + output = "default:mossycobble 1", + recipe = { + {"default:mese"}, + {"default:cobble"}, + } +}) + +minetest.register_craft({ + output = "moreblocks:woodtile 9", + recipe = { + {"default:wood", "default:wood", "default:wood"}, + {"default:wood", "default:wood", "default:wood"}, + {"default:wood", "default:wood", "default:wood"}, + } +}) + +minetest.register_craft({ + output = "moreblocks:woodtile_flipped 1", + recipe = { + {"moreblocks:woodtile"}, + } +}) + +minetest.register_craft({ + output = "moreblocks:woodtile_center 9", + recipe = { + {"default:wood", "default:wood", "default:wood"}, + {"default:wood", "moreblocks:woodtile", "default:wood"}, + {"default:wood", "default:wood", "default:wood"}, + } +}) + +minetest.register_craft({ + output = "moreblocks:woodtile_full 4", + recipe = { + {"moreblocks:woodtile", "moreblocks:woodtile"}, + {"moreblocks:woodtile", "moreblocks:woodtile"}, + } +}) + +minetest.register_craft({ + output = "moreblocks:woodtile_up 1", + recipe = { + {"default:stick"}, + {"moreblocks:woodtile_center"}, + } +}) + +minetest.register_craft({ + output = "moreblocks:woodtile_down 1", + recipe = { + {"moreblocks:woodtile_center"}, + {"default:stick"}, + } +}) + +minetest.register_craft({ + output = "moreblocks:woodtile_left 1", + recipe = { + {"default:stick", "moreblocks:woodtile_center"}, + } +}) + +minetest.register_craft({ + output = "moreblocks:woodtile_right 1", + recipe = { + {"moreblocks:woodtile_center", "default:stick"}, + } +}) + +minetest.register_craft({ + output = "moreblocks:junglestick 4", + recipe = { + {"default:junglewood"}, + } +}) + +minetest.register_craft({ + output = "moreblocks:fence_jungle_wood 2", + recipe = { + {"moreblocks:jungle_stick", "moreblocks:jungle_stick", "moreblocks:jungle_stick"}, + {"moreblocks:jungle_stick", "moreblocks:jungle_stick", "moreblocks:jungle_stick"}, + } +}) + +minetest.register_craft({ + output = "moreblocks:circle_stone_bricks 8", + recipe = { + {"default:stone", "default:stone", "default:stone"}, + {"default:stone", "", "default:stone"}, + {"default:stone", "default:stone", "default:stone"}, + } +}) + +minetest.register_craft({ + output = "moreblocks:all_faces_tree 8", + recipe = { + {"default:tree", "default:tree", "default:tree"}, + {"default:tree", "", "default:tree"}, + {"default:tree", "default:tree", "default:tree"}, + } +}) + +minetest.register_craft({ + output = "moreblocks:all_faces_jungle_tree 8", + recipe = { + {"default:jungletree", "default:jungletree", "default:jungletree"}, + {"default:jungletree", "", "default:jungletree"}, + {"default:jungletree", "default:jungletree", "default:jungletree"}, + } +}) + +minetest.register_craft({ + output = "moreblocks:sweeper 3", + recipe = { + {"default:junglegrass"}, + {"default:stick"}, + } +}) + +minetest.register_craft({ + output = "moreblocks:stone_tile 4", + recipe = { + {"default:cobble", "default:cobble"}, + {"default:cobble", "default:cobble"}, + } +}) + +minetest.register_craft({ + output = "moreblocks:split_stone_tile 1", + recipe = { + {"moreblocks:stone_tile"}, + } +}) + +minetest.register_craft({ + output = "moreblocks:empty_bookshelf 1", + recipe = { + {"moreblocks:sweeper"}, + {"default:bookshelf"}, + } +}) + +minetest.register_craft({ + output = "moreblocks:iron_stone_bricks 1", + type = "shapeless", + recipe = {"default:steel_ingot", "default:stone_brick"}, +}) + +minetest.register_craft({ + output = "default:wood 4", + recipe = { + {"moreblocks:horizontal_tree"}, + } +}) + +minetest.register_craft({ + output = "default:junglewood 4", + recipe = { + {"moreblocks:horizontal_jungle_tree"}, + } +}) + +minetest.register_craft({ + output = "moreblocks:plankstone 4", + recipe = { + {"default:stone", "default:wood"}, + {"default:wood", "default:stone"}, + } +}) + +minetest.register_craft({ + output = "moreblocks:plankstone 4", + recipe = { + {"default:wood", "default:stone"}, + {"default:stone", "default:wood"}, + } +}) + +minetest.register_craft({ + output = "moreblocks:coal_checker 4", + recipe = { + {"default:stone", "default:coal_lump"}, + {"default:coal_lump", "default:stone"}, + } +}) + +minetest.register_craft({ + output = "moreblocks:coal_checker 4", + recipe = { + {"default:coal_lump", "default:stone"}, + {"default:stone", "default:coal_lump"}, + } +}) + +minetest.register_craft({ + output = "moreblocks:iron_checker 4", + recipe = { + {"default:steel_ingot", "default:stone"}, + {"default:stone", "default:steel_ingot"}, + } +}) + +minetest.register_craft({ + output = "moreblocks:iron_checker 4", + recipe = { + {"default:stone", "default:steel_ingot"}, + {"default:steel_ingot", "default:stone"}, + } +}) + +minetest.register_craft({ + output = "default:chest_locked 1", + type = "shapeless", + recipe = {"default:steel_ingot", "default:chest"}, +}) + +minetest.register_craft({ + output = "moreblocks:iron_glass 1", + type = "shapeless", + recipe = {"default:steel_ingot", "default:glass"}, +}) + +minetest.register_craft({ + output = "moreblocks:coal_glass 1", + type = "shapeless", + recipe = {"default:coal_lump", "default:glass"}, +}) + +minetest.register_craft({ + output = "moreblocks:clean_glass 1", + type = "shapeless", + recipe = {"moreblocks:sweeper", "default:glass"}, +}) + +minetest.register_craft({ + output = "moreblocks:glow_glass 1", + type = "shapeless", + recipe = {"default:torch", "default:glass"}, +}) + +minetest.register_craft({ + output = "moreblocks:super_glow_glass 1", + type = "shapeless", + recipe = {"default:torch", "default:torch", "default:glass"}, +}) + +minetest.register_craft({ + output = "moreblocks:coal_stone 1", + type = "shapeless", + recipe = {"default:coal_lump", "default:stone"}, +}) + +minetest.register_craft({ + output = "moreblocks:iron_stone 1", + type = "shapeless", + recipe = {"default:iron_lump", "default:stone"}, +}) + +minetest.register_craft({ + output = "moreblocks:trap_stone 12", + type = "shapeless", + recipe = {"default:mese", "default:stone"}, +}) + +minetest.register_craft({ + output = "moreblocks:trap_glass 12", + type = "shapeless", + recipe = {"default:mese", "default:glass"}, +}) + +minetest.register_craft({ + output = "moreblocks:cactus_brick 1", + type = "shapeless", + recipe = {"default:cactus", "default:brick"}, +}) + +minetest.register_craft({ + output = "moreblocks:cactus_checker 4", + recipe = { + {"default:cactus", "default:stone"}, + {"default:stone", "default:cactus"}, + } +}) + +minetest.register_craft({ + output = "moreblocks:cactuschecker 4", + recipe = { + {"default:stone", "default:cactus"}, + {"default:cactus", "default:stone"}, + } +}) + +minetest.register_craft({ + output = "moreblocks:rope 2", + recipe = { + {"default:junglegrass"}, + {"default:junglegrass"}, + {"default:junglegrass"}, + } +}) + +minetest.register_craft({ + output = "moreblocks:horizontal_tree 2", + recipe = { + {"default:tree", "", "default:tree"}, + } +}) + +minetest.register_craft({ + output = "default:tree 2", + recipe = { + {"moreblocks:horizontal_tree"}, + {"moreblocks:horizontal_tree"}, + } +}) + +minetest.register_craft({ + output = "moreblocks:horizontal_jungle_tree 2", + recipe = { + {"default:jungletree", "", "default:jungletree"}, + } +}) + +minetest.register_craft({ + output = "default:jungletree 2", + recipe = { + {"moreblocks:horizontal_jungle_tree"}, + {"moreblocks:horizontal_jungle_tree"}, + } +}) + + +minetest.register_craft({ + output = "moreblocks:circular_saw 1", + recipe = { + { "", "default:steel_ingot", "" }, + { "default:tree", "default:tree", "default:tree"}, + { "default:tree", "", "default:tree"}, + } +}) diff --git a/depends.txt b/depends.txt new file mode 100644 index 0000000..562cf63 --- /dev/null +++ b/depends.txt @@ -0,0 +1 @@ +default
diff --git a/init.lua b/init.lua new file mode 100644 index 0000000..fb74721 --- /dev/null +++ b/init.lua @@ -0,0 +1,358 @@ +-- Load translation library if intllib is installed
+
+local S
+if (minetest.get_modpath("intllib")) then
+ dofile(minetest.get_modpath("intllib").."/intllib.lua")
+ S = intllib.Getter(minetest.get_current_modname())
+ else
+ S = function ( s ) return s end
+end
+
+dofile(minetest.get_modpath("moreblocks").."/_config.txt")
+
+dofile(minetest.get_modpath("moreblocks").."/redefinitions.lua")
+dofile(minetest.get_modpath("moreblocks").."/crafting.lua")
+dofile(minetest.get_modpath("moreblocks").."/aliases.lua")
+dofile(minetest.get_modpath("moreblocks").."/stairsplus_convert.lua")
+dofile(minetest.get_modpath("moreblocks").."/stairsplus/stairs.lua")
+dofile(minetest.get_modpath("moreblocks").."/stairsplus/slabs.lua")
+dofile(minetest.get_modpath("moreblocks").."/stairsplus/panels.lua")
+dofile(minetest.get_modpath("moreblocks").."/stairsplus/microblocks.lua")
+dofile(minetest.get_modpath("moreblocks").."/stairsplus/aliases.lua")
+dofile(minetest.get_modpath("moreblocks").."/stairsplus.lua")
+dofile(minetest.get_modpath("moreblocks").."/circular_saw.lua")
+
+print(S("[moreblocks] loaded."))
+
+--[[
+****
+More Blocks
+by Calinou
+Licensed under the zlib/libpng license for code and CC BY-SA for textures, see LICENSE.txt for info.
+****
+--]]
+
+-- Blocks
+
+minetest.register_node("moreblocks:wood_tile", {
+ description = S("Wooden Tile"),
+ tiles = {"moreblocks_wood_tile.png", "moreblocks_wood_tile.png", "moreblocks_wood_tile.png", "moreblocks_wood_tile.png", "moreblocks_wood_tile.png^[transformR90", "moreblocks_wood_tile.png^[transformR90"},
+ paramtype2 = "facedir",
+ groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=3},
+ sounds = default.node_sound_wood_defaults(),
+})
+
+minetest.register_node("moreblocks:wood_tile_flipped", {
+ description = S("Wooden Tile"),
+ tiles = {"moreblocks_wood_tile_flipped.png", "moreblocks_wood_tile_flipped.png", "moreblocks_wood_tile_flipped.png", "moreblocks_wood_tile_flipped.png", "moreblocks_wood_tile_flipped.png^[transformR90", "moreblocks_wood_tile_flipped.png^[transformR90"},
+ paramtype2 = "facedir",
+ groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=3},
+ sounds = default.node_sound_wood_defaults(),
+})
+
+minetest.register_node("moreblocks:wood_tile_center", {
+ description = S("Centered Wooden Tile"),
+ tiles = {"moreblocks_wood_tile_center.png", "moreblocks_wood_tile_center.png", "moreblocks_wood_tile_center.png", "moreblocks_wood_tile_center.png", "moreblocks_wood_tile_center.png^[transformR90", "moreblocks_wood_tile_center.png^[transformR90"},
+ paramtype2 = "facedir",
+ groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=3},
+ sounds = default.node_sound_wood_defaults(),
+})
+
+minetest.register_node("moreblocks:wood_tile_full", {
+ description = S("Full Wooden Tile"),
+ tiles = {"moreblocks_wood_tile_full.png", "moreblocks_wood_tile_full.png", "moreblocks_wood_tile_full.png",
+ "moreblocks_wood_tile_full.png", "moreblocks_wood_tile_full.png^[transformR90", "moreblocks_wood_tile_full.png^[transformR90"},
+ paramtype2 = "facedir",
+ groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=3},
+ sounds = default.node_sound_wood_defaults(),
+})
+
+minetest.register_node("moreblocks:wood_tile_up", {
+ description = S("Up Wooden Tile"),
+ tiles = {"moreblocks_wood_tile_up.png", "moreblocks_wood_tile_up.png", "moreblocks_wood_tile_up.png",
+ "moreblocks_wood_tile_up.png", "moreblocks_wood_tile_up.png^[transformR90", "moreblocks_wood_tile_up.png^[transformR90"},
+ paramtype2 = "facedir",
+ groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=3},
+ sounds = default.node_sound_wood_defaults(),
+})
+
+minetest.register_node("moreblocks:wood_tile_down", {
+ description = S("Down Wooden Tile"),
+ tiles = {"moreblocks_wood_tile_down.png", "moreblocks_wood_tile_down.png", "moreblocks_wood_tile_down.png",
+ "moreblocks_wood_tile_down.png", "moreblocks_wood_tile_down.png^[transformR90", "moreblocks_wood_tile_down.png^[transformR90"},
+ paramtype2 = "facedir",
+ groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=3},
+ sounds = default.node_sound_wood_defaults(),
+})
+
+minetest.register_node("moreblocks:wood_tile_left", {
+ description = S("Left Wooden Tile"),
+ tiles = {"moreblocks_wood_tile_left.png", "moreblocks_wood_tile_left.png", "moreblocks_wood_tile_left.png",
+ "moreblocks_wood_tile_left.png", "moreblocks_wood_tile_left.png^[transformR90", "moreblocks_wood_tile_left.png^[transformR90"},
+ paramtype2 = "facedir",
+ groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=3},
+ sounds = default.node_sound_wood_defaults(),
+})
+
+minetest.register_node("moreblocks:wood_tile_right", {
+ description = S("Right Wooden Tile"),
+ tiles = {"moreblocks_wood_tile_right.png", "moreblocks_wood_tile_right.png", "moreblocks_wood_tile_right.png",
+ "moreblocks_wood_tile_right.png", "moreblocks_wood_tile_right.png^[transformR90", "moreblocks_wood_tile_right.png^[transformR90"},
+ paramtype2 = "facedir",
+ groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=3},
+ sounds = default.node_sound_wood_defaults(),
+})
+
+minetest.register_node("moreblocks:circle_stone_bricks", {
+ description = S("Circle Stone Bricks"),
+ tiles = {"moreblocks_circle_stone_bricks.png"},
+ groups = {cracky=3},
+ sounds = default.node_sound_stone_defaults(),
+})
+
+minetest.register_node("moreblocks:iron_stone_bricks", {
+ description = S("Iron Stone Bricks"),
+ tiles = {"moreblocks_iron_stone_bricks.png"},
+ groups = {cracky=3},
+ sounds = default.node_sound_stone_defaults(),
+})
+
+minetest.register_node("moreblocks:stone_tile", {
+ description = S("Stone Tile"),
+ tiles = {"moreblocks_stone_tile.png"},
+ groups = {cracky=3},
+ sounds = default.node_sound_stone_defaults(),
+})
+
+minetest.register_node("moreblocks:split_stone_tile", {
+ description = S("Split Stone Tile"),
+ tiles = {"moreblocks_split_stone_tile_top.png", "moreblocks_split_stone_tile.png"},
+ groups = {cracky=3},
+ sounds = default.node_sound_stone_defaults(),
+})
+
+minetest.register_node("moreblocks:plankstone", {
+ description = S("Plankstone"),
+ tiles = {"moreblocks_plankstone.png", "moreblocks_plankstone.png", "moreblocks_plankstone.png",
+ "moreblocks_plankstone.png", "moreblocks_plankstone.png^[transformR90", "moreblocks_plankstone.png^[transformR90"},
+ groups = {cracky=3},
+ sounds = default.node_sound_stone_defaults(),
+})
+
+minetest.register_node("moreblocks:iron_glass", {
+ description = S("Iron Glass"),
+ drawtype = "glasslike",
+ tiles = {"moreblocks_iron_glass.png"},
+ inventory_image = minetest.inventorycube("moreblocks_iron_glass.png"),
+ paramtype = "light",
+ sunlight_propagates = true,
+ groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3},
+ sounds = default.node_sound_glass_defaults(),
+})
+
+minetest.register_node("moreblocks:coal_glass", {
+ description = S("Coal Glass"),
+ drawtype = "glasslike",
+ tiles = {"moreblocks_coal_glass.png"},
+ inventory_image = minetest.inventorycube("moreblocks_coal_glass.png"),
+ paramtype = "light",
+ sunlight_propagates = true,
+ groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3},
+ sounds = default.node_sound_glass_defaults(),
+})
+
+minetest.register_node("moreblocks:clean_glass", {
+ description = S("Clean Glass"),
+ drawtype = "glasslike",
+ tiles = {"moreblocks_clean_glass.png"},
+ inventory_image = minetest.inventorycube("moreblocks_clean_glass.png"),
+ paramtype = "light",
+ sunlight_propagates = true,
+ groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3},
+ sounds = default.node_sound_glass_defaults(),
+})
+
+
+minetest.register_node("moreblocks:cactus_brick", {
+ description = S("Cactus Brick"),
+ tiles = {"moreblocks_cactus_brick.png"},
+ groups = {cracky=3},
+ sounds = default.node_sound_stone_defaults(),
+})
+
+minetest.register_node("moreblocks:cactus_checker", {
+ description = S("Cactus Checker"),
+ tiles = {"moreblocks_cactus_checker.png", "moreblocks_cactus_checker.png", "moreblocks_cactus_checker.png",
+ "moreblocks_cactus_checker.png", "moreblocks_cactus_checker.png^[transformR90", "moreblocks_cactus_checker.png^[transformR90"},
+ paramtype2 = "facedir",
+ groups = {cracky=3},
+ sounds = default.node_sound_stone_defaults(),
+})
+
+minetest.register_node("moreblocks:empty_bookshelf", {
+ description = S("Empty Bookshelf"),
+ tiles = {"default_wood.png", "default_wood.png", "moreblocks_empty_bookshelf.png"},
+ groups = {snappy=2,choppy=3,oddly_breakable_by_hand=2,flammable=3},
+ sounds = default.node_sound_wood_defaults(),
+})
+
+minetest.register_node("moreblocks:coal_stone", {
+ description = S("Coal Stone"),
+ tiles = {"moreblocks_coal_stone.png"},
+ groups = {cracky=3},
+ sounds = default.node_sound_stone_defaults(),
+})
+
+minetest.register_node("moreblocks:iron_stone", {
+ description = S("Iron Stone"),
+ tiles = {"moreblocks_iron_stone.png"},
+ groups = {cracky=3},
+ sounds = default.node_sound_stone_defaults(),
+})
+
+minetest.register_node("moreblocks:coal_checker", {
+ description = S("Coal Checker"),
+ tiles = {"moreblocks_coal_checker.png", "moreblocks_coal_checker.png", "moreblocks_coal_checker.png",
+ "moreblocks_coal_checker.png", "moreblocks_coal_checker.png^[transformR90", "moreblocks_coal_checker.png^[transformR90"},
+ paramtype2 = "facedir",
+ groups = {cracky=3},
+ sounds = default.node_sound_stone_defaults(),
+})
+
+minetest.register_node("moreblocks:iron_checker", {
+ description = S("Iron Checker"),
+ tiles = {"moreblocks_iron_checker.png", "moreblocks_iron_checker.png", "moreblocks_iron_checker.png",
+ "moreblocks_iron_checker.png", "moreblocks_iron_checker.png^[transformR90", "moreblocks_iron_checker.png^[transformR90"},
+ paramtype2 = "facedir",
+ groups = {cracky=3},
+ sounds = default.node_sound_stone_defaults(),
+})
+
+minetest.register_node("moreblocks:trap_stone", {
+ description = S("Trap Stone"),
+ tiles = {"moreblocks_trap_stone.png"},
+ walkable = false,
+ groups = {cracky=3},
+ sounds = default.node_sound_stone_defaults(),
+})
+
+minetest.register_node("moreblocks:trap_glass", {
+ description = S("Trap Glass"),
+ drawtype = "glasslike",
+ tiles = {"moreblocks_trap_glass.png"},
+ inventory_image = minetest.inventorycube("moreblocks_trap_glass.png"),
+ paramtype = "light",
+ sunlight_propagates = true,
+ walkable = false,
+ groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3},
+ sounds = default.node_sound_glass_defaults(),
+})
+
+minetest.register_node("moreblocks:fence_jungle_wood", {
+ description = S("Jungle Wood Fence"),
+ drawtype = "fencelike",
+ tiles = {"moreblocks_jungle_wood.png"},
+ inventory_image = "moreblocks_fence_jungle_wood.png",
+ wield_image = "moreblocks_fence_jungle_wood.png",
+ paramtype = "light",
+ selection_box = {
+ type = "fixed",
+ fixed = {-1/7, -1/2, -1/7, 1/7, 1/2, 1/7},
+ },
+ groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2,flammable=2},
+ sounds = default.node_sound_wood_defaults(),
+})
+
+minetest.register_node("moreblocks:horizontal_tree", {
+ description = S("Horizontal Tree"),
+ tiles = {"default_tree.png", "default_tree.png", "default_tree.png^[transformR90",
+ "default_tree.png^[transformR90", "default_tree_top.png", "default_tree_top.png"},
+ paramtype2 = "facedir",
+ groups = {tree=1,snappy=1,choppy=2,oddly_breakable_by_hand=1,flammable=2},
+ sounds = default.node_sound_wood_defaults(),
+ furnace_burntime = 30,
+})
+
+minetest.register_node("moreblocks:horizontal_jungle_tree", {
+ description = S("Horizontal Jungle Tree"),
+ tiles = {"default_jungletree.png", "default_jungletree.png", "default_jungletree.png^[transformR90",
+ "default_jungletree.png^[transformR90", "default_jungletree_top.png", "default_jungletree_top.png"},
+ paramtype2 = "facedir",
+ groups = {tree=1,snappy=1,choppy=2,oddly_breakable_by_hand=1,flammable=2},
+ sounds = default.node_sound_wood_defaults(),
+ furnace_burntime = 30,
+})
+
+minetest.register_node("moreblocks:all_faces_tree", {
+ description = S("All-faces Tree"),
+ tiles = {"default_tree_top.png"},
+ groups = {tree=1,snappy=1,choppy=2,oddly_breakable_by_hand=1,flammable=2},
+ sounds = default.node_sound_wood_defaults(),
+ furnace_burntime = 30,
+})
+
+minetest.register_node("moreblocks:all_faces_jungle_tree", {
+ description = S("All-faces Tree"),
+ tiles = {"default_jungletree_top.png"},
+ groups = {tree=1,snappy=1,choppy=2,oddly_breakable_by_hand=1,flammable=2},
+ sounds = default.node_sound_wood_defaults(),
+ furnace_burntime = 30,
+})
+
+minetest.register_node("moreblocks:glow_glass", {
+ description = S("Glow Glass"),
+ drawtype = "glasslike",
+ tiles = {"moreblocks_glow_glass.png"},
+ inventory_image = minetest.inventorycube("moreblocks_glow_glass.png"),
+ paramtype = "light",
+ sunlight_propagates = true,
+ light_source = 11,
+ groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3},
+ sounds = default.node_sound_glass_defaults(),
+})
+
+minetest.register_node("moreblocks:super_glow_glass", {
+ description = S("Super Glow Glass"),
+ drawtype = "glasslike",
+ tiles = {"moreblocks_super_glow_glass.png"},
+ inventory_image = minetest.inventorycube("moreblocks_super_glow_glass.png"),
+ paramtype = "light",
+ sunlight_propagates = true,
+ light_source = 15,
+ groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3},
+ sounds = default.node_sound_glass_defaults(),
+})
+
+minetest.register_node("moreblocks:rope", {
+ description = S("Rope"),
+ drawtype = "signlike",
+ tiles = {"moreblocks_rope.png"},
+ inventory_image = "moreblocks_rope.png",
+ wield_image = "moreblocks_rope.png",
+ paramtype = "light",
+ paramtype2 = "wallmounted",
+ walkable = false,
+ climbable = true,
+ selection_box = {
+ type = "wallmounted",
+ },
+ groups = {snappy=3,flammable=2},
+ sounds = default.node_sound_leaves_defaults(),
+})
+
+-- Items
+
+minetest.register_craftitem("moreblocks:sweeper", {
+ description = S("Sweeper"),
+ inventory_image = "moreblocks_sweeper.png",
+})
+
+minetest.register_craftitem("moreblocks:jungle_stick", {
+ description = S("Jungle Stick"),
+ inventory_image = "moreblocks_junglestick.png",
+})
+
+minetest.register_craftitem("moreblocks:nothing", {
+ inventory_image = "invisible.png",
+ on_use = minetest.item_eat(0),
+})
diff --git a/locale/es.txt b/locale/es.txt new file mode 100644 index 0000000..d11ba49 --- /dev/null +++ b/locale/es.txt @@ -0,0 +1,52 @@ +# Translation by kaeza + +[moreblocks] loaded. = [moreblocks] cargado. + +Jungle Wooden Planks = Tablones de madera de jungla +Empty Bookshelf = Estante para libros vacío +Clean Glass = Cristal Limpio +Plankstone = Tablones de piedra +Wooden Tile = Parquet +Full Wooden Tile = Parquet Completo +Centered Wooden Tile = Parquet Centrado +Up Wooden Tile = Parquet Superior +Down Wooden Tile = Parquet Inferior +Left Wooden Tile = Parquet Izquierdo +Right Wooden Tile = Parquet Derecho +Circle Stone Bricks = Bloques de Piedra Circulares +Stone Tile = Baldosa de Piedra +Split Stone Tile = Baldosas de Piedra Partida +Glow Glass = Cristal Brillante +Super Glow Glass = Cristal Súper Brillante +Coal Glass = Cristal con Carbón +Iron Glass = Cristal con Hierro +Coal Checker = Cuadros de Carbón +Iron Checker = Cuadros de Hierro +Trap Stone = Piedra Trampa +Trap Glass = Cristal Trampa +Coal Stone = Carbón y Piedra +Iron Stone = Hierro y Piedra +Cactus Checker = Cuadros de Cactus +Cactus Brick = Ladrillos de Cactus +Sweeper = Limpiador +Jungle Stick = Varita de Madera de Jungla +Horizontal Tree = Tronco de árbol horizontal +Horizontal Jungle Tree = Tronco de árbol de la jungla horizontal +Rope = Soga +All-faces Tree = Tronco de Árbol + +%s Stairs = Escalera de %s +%s Slab = Losa de %s +%s Panel = Panel de %s +%s Microblock = Microbloque de %s + +Wooden = Madera +Papyrus = Papiro +Dry Shrub = Arbusto Desértico +Sapling = Brote de Árbol +Wooden Planks = Tablones de Madera +Ladder = Escalera de Mano +Glass = Cristal + +%s Pane = Panel de %s +%s Fence = Valla de %s diff --git a/locale/fr.txt b/locale/fr.txt new file mode 100644 index 0000000..e537a8c --- /dev/null +++ b/locale/fr.txt @@ -0,0 +1,54 @@ +# Translation by Calinou + +[moreblocks] loaded. = [moreblocks] a été chargé. + +Jungle Wooden Planks = Planches de bois de jungle +Empty Bookshelf = Étagère vide +Clean Glass = Verre propre +Plankstone = Pierre-bois +Wooden Tile = Dalle en bois +Full Wooden Tile = Dalle en bois complète +Centered Wooden Tile = Dalle en bois centrée +Up Wooden Tile = Dalle en bois vers le haut +Down Wooden Tile = Dalle en bois vers le bas +Left Wooden Tile = Dalle en bois vers la gauche +Right Wooden Tile = Dalle en bois vers la droite +Circle Stone Bricks = Briques en pierre circulaires +Stone Tile = Dalle en pierre +Split Stone Tile = Dalle en pierre découpée +Glow Glass = Verre brillant +Super Glow Glass = Verre très brillant +Coal Glass = Verre en charbon +Iron Glass = Verre en fer +Coal Checker = Damier en charbon +Iron Checker = Damier en fer +Trap Stone = Pierre à piège +Trap Glass = Verre à piège +Coal Stone = Pierre en charbon +Iron Stone = Pierre en fer +Cactus Checker = Damier en cactus +Cactus Brick = Briques en cactus +Sweeper = Balai +Jungle Stick = Bâton en bois de jungle +Horizontal Tree = Tronc d'arbre horizontal +Horizontal Jungle Tree = Tronc d'arbre de jungle horizontal +Rope = Corde +All-faces Tree = Tronc d'arbre + +Wooden = bois +Papyrus = Papyrus +Dry Shrub = Buisson mort +Sapling = Pousse d'arbre +Wooden Planks = Planches de bois +Ladder = Échelle +Glass = Verre + +Circular Saw = Scie circulaire + +%s Stairs = Escaliers en %s +%s Slab = Demi-dalle en %s +%s Panel = Barre en %s +%s Microblock = Microbloc en %s + +%s Pane = Panneau en %s +%s Fence = Barrière en %s diff --git a/redefinitions.lua b/redefinitions.lua new file mode 100644 index 0000000..0456733 --- /dev/null +++ b/redefinitions.lua @@ -0,0 +1,287 @@ +-- Redefinitions of some default crafting recipes + +minetest.register_craft({ + output = "default:sign_wall 4", + recipe = { + {"default:wood", "default:wood", "default:wood"}, + {"default:wood", "default:wood", "default:wood"}, + {"", "default:stick", ""}, + } +}) + +minetest.register_craft({ + output = "default:ladder 3", + recipe = { + {"default:stick", "", "default:stick"}, + {"default:stick", "default:stick", "default:stick"}, + {"default:stick", "", "default:stick"}, + } +}) + +minetest.register_craft({ + output = "default:paper 3", + recipe = { + {"default:papyrus", "default:papyrus", "default:papyrus"}, + } +}) + +minetest.register_craft({ + output = "default:rail 16", + 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:axe_wood", + recipe = { + {"default:wood", "default:wood"}, + {"default:stick", "default:wood"}, + {"default:stick", ""}, + } +}) + +minetest.register_craft({ + output = "default:axe_stone", + recipe = { + {"default:cobble", "default:cobble"}, + {"default:stick", "default:cobble"}, + {"default:stick", ""}, + } +}) + +minetest.register_craft({ + output = "default:axe_steel", + recipe = { + {"default:steel_ingot", "default:steel_ingot"}, + {"default:stick", "default:steel_ingot"}, + {"default:stick", ""}, + } +}) + +-- Tool repair buff (15% bonus instead of 2%) + +minetest.register_craft({ + type = "toolrepair", + additional_wear = -0.15, +}) + +-- Redefinitions of some default nodes + +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", + sunlight_propagates = true, + paramtype2 = "wallmounted", + walkable = false, + climbable = true, + selection_box = { + type = "wallmounted", + }, + groups = {snappy=1,choppy=2,oddly_breakable_by_hand=3,flammable=2}, + legacy_wallmounted = true, + sounds = default.node_sound_wood_defaults(), +}) + +if wood_facedir == true +then +minetest.register_node(":default:wood", { + description = "Wooden Planks", + tiles = {"default_wood.png"}, + paramtype2 = "facedir", + groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=3,wood=1}, + sounds = default.node_sound_wood_defaults(), +}) +end + +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", + sunlight_propagates = true, + walkable = false, + selection_box = { + type = "fixed", + fixed = {-0.3, -0.5, -0.3, 0.3, 0.35, 0.3} + }, + groups = {snappy=2,dig_immediate=3,flammable=2,attached_node=1}, + 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", + sunlight_propagates = true, + walkable = false, + groups = {snappy=3,flammable=3,attached_node=1}, + sounds = default.node_sound_leaves_defaults(), + selection_box = { + type = "fixed", + fixed = {-1/3, -1/2, -1/3, 1/3, 1/6, 1/3}, + }, +}) + +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", + sunlight_propagates = true, + walkable = false, + selection_box = { + type = "fixed", + fixed = {-0.3, -0.5, -0.3, 0.3, 0.5, 0.3} + }, + groups = {snappy=3,flammable=2}, + sounds = default.node_sound_leaves_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", + sunlight_propagates = 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:grass_1", { + description = "Grass", + drawtype = "plantlike", + tiles = {"default_grass_1.png"}, + inventory_image = "default_grass_1.png", + wield_image = "default_grass_1.png", + paramtype = "light", + walkable = false, + sunlight_propagates = true, + groups = {snappy=3,flammable=3,attached_node=1}, + sounds = default.node_sound_leaves_defaults(), + selection_box = { + type = "fixed", + fixed = {-0.5, -0.5, -0.5, 0.5, -0.3125, 0.5}, + }, + on_place = function(itemstack, placer, pointed_thing) + -- place a random grass node + local stack = ItemStack("default:grass_" .. math.random(1,5)) + local ret = minetest.item_place(stack, placer, pointed_thing) + return ItemStack("default:grass_1 " .. itemstack:get_count()-(1-ret:get_count())) + end, +}) + +minetest.register_node(":default:grass_2", { + description = "Grass", + drawtype = "plantlike", + tiles = {"default_grass_2.png"}, + paramtype = "light", + walkable = false, + sunlight_propagates = true, + drop = "default:grass_1", + groups = {snappy=3,flammable=3,attached_node=1,not_in_creative_inventory=1}, + sounds = default.node_sound_leaves_defaults(), + selection_box = { + type = "fixed", + fixed = {-0.5, -0.5, -0.5, 0.5, -0.3125, 0.5}, + }, +}) +minetest.register_node(":default:grass_3", { + description = "Grass", + drawtype = "plantlike", + tiles = {"default_grass_3.png"}, + paramtype = "light", + walkable = false, + sunlight_propagates = true, + drop = "default:grass_1", + groups = {snappy=3,flammable=3,attached_node=1,not_in_creative_inventory=1}, + sounds = default.node_sound_leaves_defaults(), + selection_box = { + type = "fixed", + fixed = {-0.5, -0.5, -0.5, 0.5, -0.3125, 0.5}, + }, +}) + +minetest.register_node(":default:grass_4", { + description = "Grass", + drawtype = "plantlike", + tiles = {"default_grass_4.png"}, + paramtype = "light", + walkable = false, + sunlight_propagates = true, + drop = "default:grass_1", + groups = {snappy=3,flammable=3,attached_node=1,not_in_creative_inventory=1}, + sounds = default.node_sound_leaves_defaults(), + selection_box = { + type = "fixed", + fixed = {-0.5, -0.5, -0.5, 0.5, -0.3125, 0.5}, + }, +}) + +minetest.register_node(":default:grass_5", { + description = "Grass", + drawtype = "plantlike", + tiles = {"default_grass_5.png"}, + paramtype = "light", + walkable = false, + sunlight_propagates = true, + drop = "default:grass_1", + groups = {snappy=3,flammable=3,attached_node=1,not_in_creative_inventory=1}, + sounds = default.node_sound_leaves_defaults(), + selection_box = { + type = "fixed", + fixed = {-0.5, -0.5, -0.5, 0.5, -0.3125, 0.5}, + }, +}) + +minetest.register_node(":default:junglegrass", { + description = "Jungle Grass", + drawtype = "plantlike", + visual_scale = 1.25, + tiles = {"default_junglegrass.png"}, + paramtype = "light", + walkable = false, + sunlight_propagates = true, + groups = {snappy=3,flammable=2,attached_node=1}, + sounds = default.node_sound_leaves_defaults(), + selection_box = { + type = "fixed", + fixed = {-0.5, -0.5, -0.5, 0.5, -0.3125, 0.5}, + }, +}) + +minetest.register_node(":default:junglesapling", { + description = "Jungle Sapling", + drawtype = "plantlike", + sunlight_propagates = true, + tiles = {"default_junglesapling.png"}, + paramtype = "light", + walkable = false, + selection_box = { + type = "fixed", + fixed = {-0.3, -0.5, -0.3, 0.3, 0.35, 0.3} + }, + groups = {snappy=2,dig_immediate=3,flammable=2,attached_node=1}, + sounds = default.node_sound_defaults(), +}) diff --git a/stairsplus.lua b/stairsplus.lua new file mode 100644 index 0000000..82822bf --- /dev/null +++ b/stairsplus.lua @@ -0,0 +1,434 @@ +-- Nodes will be called <modname>:{stair,slab,panel,micro}_<subname> + +if minetest.get_modpath("unified_inventory") or not minetest.setting_getbool("creative_mode") then + stairsplus_expect_infinite_stacks = false +else + stairsplus_expect_infinite_stacks = true +end + +-- these vales are in order: facedir in degrees = 90, 0, 270, 180, 90 + +local dirs1 = { 21, 20, 23, 22, 21 } +local dirs2 = { 15, 8, 17, 6, 15 } +local dirs3 = { 14, 11, 16, 5, 14 } + +stairsplus_players_onwall = {} + +minetest.register_chatcommand("st", { + params = "", + description = "Toggle stairsplus between placing wall/vertical stairs/panels and normal.", + func = function(name, param) + stairsplus_players_onwall[name] = not stairsplus_players_onwall[name] + + if stairsplus_players_onwall[name] then + minetest.chat_send_player(name, "Stairsplus: Placing wall stairs/vertical panels.") + else + minetest.chat_send_player(name, "Stairsplus: Placing floor/ceiling stairs/panels.") + end + end +}) + +stairsplus_can_it_stack = function(itemstack, placer, pointed_thing) + return false +--[[ + 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 p1 = pointed_thing.above + p1 = {x = p1.x, y = p1.y - 1, z = p1.z} + local n1 = minetest.env:get_node(p1) + if n1.name == modname .. ":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 + + if n1.name == modname .. ":slab_" .. subname .. "_quarter" 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(modname .. ":slab_" .. subname .. "_three_quarter") + 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 + +local function get_nodedef_field(nodename, fieldname) + if not minetest.registered_nodes[nodename] then + return nil + end + return minetest.registered_nodes[nodename][fieldname] +end + +function stairsplus_rotate_and_place(itemstack, placer, pointed_thing, onwall) + + local node = minetest.env:get_node(pointed_thing.under) + + if not minetest.registered_nodes[node.name] or not minetest.registered_nodes[node.name].on_rightclick then + + local above = pointed_thing.above + local under = pointed_thing.under + local top = {x=under.x, y=under.y+1, z=under.z} + + local pitch = placer:get_look_pitch() + local node = minetest.env:get_node(above) + local fdir = minetest.dir_to_facedir(placer:get_look_dir()) + local wield_name = itemstack:get_name() + + local slab = string.find(wield_name, "slab") + local panel = string.find(wield_name, "panel") + local micro = string.find(wield_name, "micro") + local iswall = (above.x ~= under.x) or (above.z ~= under.z) + local isceiling = (above.x == under.x) and (above.z == under.z) and (pitch > 0) + + if get_nodedef_field(minetest.env:get_node(under).name, "buildable_to") then + if slab then fdir = 0 end + minetest.env:add_node(under, {name = wield_name, param2 = fdir }) -- place right side up + elseif not get_nodedef_field(minetest.env:get_node(above).name, "buildable_to") then + return + elseif onwall or (iswall and (slab or panel)) then + if slab then + minetest.env:add_node(above, {name = wield_name, param2 = dirs2[fdir+2] }) -- place with wall slab rotation + else + minetest.env:add_node(above, {name = wield_name, param2 = dirs3[fdir+2] }) -- place with wall panel/micro rotation + end + elseif isceiling then + local nfdir = dirs1[fdir+2] + if slab then nfdir = 22 end + minetest.env:add_node(above, {name = wield_name, param2 = nfdir }) -- place upside down variant + else + if slab then fdir = 0 end + minetest.env:add_node(above, {name = wield_name, param2 = fdir }) -- place right side up + end + + if not stairsplus_expect_infinite_stacks then + itemstack:take_item() + return itemstack + end + else + minetest.registered_nodes[node.name].on_rightclick(pointed_thing.under, node, placer) + end +end + +function register_stair_slab_panel_micro(modname, subname, recipeitem, groups, images, description, drop, light) + register_stair(modname, subname, recipeitem, groups, images, description, drop, light) + register_slab( modname, subname, recipeitem, groups, images, description, drop, light) + register_panel(modname, subname, recipeitem, groups, images, description, drop, light) + register_micro(modname, subname, recipeitem, groups, images, description, drop, light) + register_6dfacedir_conversion(modname, subname) +end + +-- Default stairs/slabs/panels/microblocks + +register_stair_slab_panel_micro("moreblocks", "wood", "default:wood", + {not_in_creative_inventory=1,snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=3}, + {"default_wood.png"}, + "Wooden", + "wood", + 0) + +register_stair_slab_panel_micro("moreblocks", "stone", "default:stone", + {not_in_creative_inventory=1,cracky=3}, + {"default_stone.png"}, + "Stone", + "cobble", + 0) + +register_stair_slab_panel_micro("moreblocks", "cobble", "default:cobble", + {not_in_creative_inventory=1,cracky=3}, + {"default_cobble.png"}, + "Cobblestone", + "cobble", + 0) + +register_stair_slab_panel_micro("moreblocks", "mossycobble", "default:mossycobble", + {not_in_creative_inventory=1,cracky=3}, + {"default_mossycobble.png"}, + "Mossy Cobblestone", + "mossycobble", + 0) + +register_stair_slab_panel_micro("moreblocks", "brick", "default:brick", + {not_in_creative_inventory=1,cracky=3}, + {"default_brick.png"}, + "Brick", + "brick", + 0) + +register_stair_slab_panel_micro("moreblocks", "sandstone", "default:sandstone", + {not_in_creative_inventory=1,crumbly=2,cracky=2}, + {"default_sandstone.png"}, + "Sandstone", + "sandstone", + 0) + +register_stair_slab_panel_micro("moreblocks", "steelblock", "default:steelblock", + {not_in_creative_inventory=1,cracky=1,level=2}, + {"default_steel_block.png"}, + "Steel Block", + "steelblock", + 0) + +register_stair_slab_panel_micro("moreblocks", "goldblock", "default:goldblock", + {not_in_creative_inventory=1,cracky=1}, + {"default_gold_block.png"}, + "Gold Block", + "goldblock", + 0) + +register_stair_slab_panel_micro("moreblocks", "copperblock", "default:copperblock", + {not_in_creative_inventory=1,cracky=1,level=2}, + {"default_copper_block.png"}, + "Copper Block", + "copperblock", + 0) + +register_stair_slab_panel_micro("moreblocks", "bronzeblock", "default:bronzeblock", + {not_in_creative_inventory=1,cracky=1,level=2}, + {"default_bronze_block.png"}, + "Bronze Block", + "bronzeblock", + 0) + +register_stair_slab_panel_micro("moreblocks", "diamondblock", "default:diamondblock", + {not_in_creative_inventory=1,cracky=1,level=3}, + {"default_diamond_block.png"}, + "Diamond Block", + "diamondblock", + 0) + +register_stair_slab_panel_micro("moreblocks", "desert_stone", "default:desert_stone", + {not_in_creative_inventory=1,cracky=3}, + {"default_desert_stone.png"}, + "Desert Stone", + "desert_stone", + 0) + +register_stair_slab_panel_micro("moreblocks", "glass", "default:glass", + {not_in_creative_inventory=1,snappy=2,cracky=3,oddly_breakable_by_hand=3}, + {"moreblocks_glass_stairsplus.png"}, + "Glass", + "glass", + 0) + +register_stair_slab_panel_micro("moreblocks", "tree", "default:tree", + {not_in_creative_inventory=1,tree=1,snappy=1,choppy=2,oddly_breakable_by_hand=1,flammable=2}, + {"default_tree_top.png", "default_tree_top.png", "default_tree.png"}, + "Tree", + "tree", + 0) + +register_stair_slab_panel_micro("moreblocks", "jungletree", "default:jungletree", + {not_in_creative_inventory=1,tree=1,snappy=1,choppy=2,oddly_breakable_by_hand=1,flammable=2}, + {"default_jungletree_top.png", "default_jungletree_top.png", "default_jungletree.png"}, + "Jungle Tree", + "jungletree", + 0) + +register_stair_slab_panel_micro("moreblocks", "obsidian", "default:obsidian", + {not_in_creative_inventory=1,cracky=1,level=2}, + {"default_obsidian.png"}, + "Obsidian", + "obsidian", + 0) + +register_stair_slab_panel_micro("moreblocks", "obsidian_glass", "default:obsidian_glass", + {not_in_creative_inventory=1,cracky=3,oddly_breakable_by_hand=3}, + {"moreblocks_obsidian_glass_stairsplus.png"}, + "Obsidian Glass", + "obsidian_glass", + 0) + +register_stair_slab_panel_micro("moreblocks", "stonebrick", "default:stonebrick", + {not_in_creative_inventory=1,cracky=3}, + {"default_stone_brick.png"}, + "Stone Bricks", + "stone_bricks", + 0) + +register_stair_slab_panel_micro("moreblocks", "desert_stonebrick", "default:desert_stonebrick", + {not_in_creative_inventory=1,cracky=3}, + {"default_desert_stone_brick.png"}, + "Desert Stone Bricks", + "desert_stonebrick", + 0) + +register_stair_slab_panel_micro("moreblocks", "sandstonebrick", "default:sandstonebrick", + {not_in_creative_inventory=1,cracky=3}, + {"default_sandstone_brick.png"}, + "Sandstone Bricks", + "sandstonebrick", + 0) + +-- More Blocks stairs/slabs/panels/microblocks + +register_stair_slab_panel_micro("moreblocks", "circle_stone_bricks", "moreblocks:circle_stone_bricks", + {not_in_creative_inventory=1,cracky=3}, + {"moreblocks_circle_stone_bricks.png"}, + "Circle Stone Bricks", + "circle_stone_bricks", + 0) + +register_stair_slab_panel_micro("moreblocks", "iron_stone_bricks", "moreblocks:iron_stone_bricks", + {not_in_creative_inventory=1,cracky=3}, + {"moreblocks_iron_stone_bricks.png"}, + "Iron Stone Bricks", + "iron_stone_bricks", + 0) + +register_stair_slab_panel_micro("moreblocks", "stone_tile", "moreblocks:stone_tile", + {not_in_creative_inventory=1,cracky=3}, + {"moreblocks_stone_tile.png"}, + "Stonesquare", + "stone_tile", + 0) + +register_stair_slab_panel_micro("moreblocks", "split_stone_tile", "moreblocks:split_stone_tile", + {not_in_creative_inventory=1,cracky=3}, + {"moreblocks_split_stone_tile_top.png", "moreblocks_split_stone_tile.png"}, + "Split Stonesquare", + "split_stone_tile", + 0) + +register_stair_slab_panel_micro("moreblocks", "jungle_wood", "default:junglewood", + {not_in_creative_inventory=1,snappy=1, choppy=2, oddly_breakable_by_hand=2,flammable=3}, + {"default_junglewood.png"}, + "Jungle Wood", + "jungle_wood", + 0) + +register_stair_slab_panel_micro("moreblocks", "plankstone", "moreblocks:plankstone", + {not_in_creative_inventory=1,cracky=3}, + {"moreblocks_plankstone.png", "moreblocks_plankstone.png", "moreblocks_plankstone.png", + "moreblocks_plankstone.png", "moreblocks_plankstone.png^[transformR90", "moreblocks_plankstone.png^[transformR90"}, + "Plankstone", + "plankstone", + 0) + +register_stair_slab_panel_micro("moreblocks", "coal_checker", "moreblocks:coal_checker", + {not_in_creative_inventory=1,cracky=3}, + {"moreblocks_coal_checker.png", "moreblocks_coal_checker.png", "moreblocks_coal_checker.png", + "moreblocks_coal_checker.png", "moreblocks_coal_checker.png^[transformR90", "moreblocks_coal_checker.png^[transformR90"}, + "Coal Checker", + "coal_checker", + 0) + +register_stair_slab_panel_micro("moreblocks", "iron_checker", "moreblocks:iron_checker", + {not_in_creative_inventory=1,cracky=3}, + {"moreblocks_iron_checker.png", "moreblocks_iron_checker.png", "moreblocks_iron_checker.png", + "moreblocks_iron_checker.png", "moreblocks_iron_checker.png^[transformR90", "moreblocks_iron_checker.png^[transformR90"}, + "Iron Checker", + "iron_checker", + 0) + +register_stair_slab_panel_micro("moreblocks", "cactus_checker", "moreblocks:cactus_checker", + {not_in_creative_inventory=1,cracky=3}, + {"moreblocks_cactus_checker.png", "moreblocks_cactus_checker.png", "moreblocks_cactus_checker.png", + "moreblocks_cactus_checker.png", "moreblocks_cactus_checker.png^[transformR90", "moreblocks_cactus_checker.png^[transformR90"}, + "Cactus Checker", + "cactus_checker", + 0) + +register_stair_slab_panel_micro("moreblocks", "coal_stone", "moreblocks:coal_stone", + {not_in_creative_inventory=1,cracky=3}, + {"moreblocks_coal_stone.png"}, + "Coal Stone", + "coal_stone", + 0) + +register_stair_slab_panel_micro("moreblocks", "iron_stone", "moreblocks:iron_stone", + {not_in_creative_inventory=1,cracky=3}, + {"moreblocks_iron_stone.png"}, + "Iron Stone", + "iron_stone", + 0) + +register_stair_slab_panel_micro("moreblocks", "glow_glass", "moreblocks:glow_glass", + {not_in_creative_inventory=1,snappy=2,cracky=3,oddly_breakable_by_hand=3}, + {"moreblocks_glow_glass_stairsplus.png"}, + "Glow Glass", + "glow_glass", + 11) + +register_stair_slab_panel_micro("moreblocks", "super_glow_glass", "moreblocks:super_glow_glass", + {not_in_creative_inventory=1,snappy=2, cracky=3, oddly_breakable_by_hand=3}, + {"moreblocks_super_glow_glass_stairsplus.png"}, + "Super Glow Glass", + "super_glow_glass", + 15) + +register_stair_slab_panel_micro("moreblocks", "coal_glass", "moreblocks:coal_glass", + {not_in_creative_inventory=1,snappy=2, cracky=3, oddly_breakable_by_hand=3}, + {"moreblocks_coal_glass_stairsplus.png"}, + "Coal Glass", + "coal_glass", + 0) + +register_stair_slab_panel_micro("moreblocks", "iron_glass", "moreblocks:iron_glass", + {not_in_creative_inventory=1,snappy=2,cracky=3,oddly_breakable_by_hand=3}, + {"moreblocks_iron_glass_stairsplus.png"}, + "Iron Glass", + "iron_glass", + 0) + +register_stair_slab_panel_micro("moreblocks", "wood_tile", "moreblocks:wood_tile", + {not_in_creative_inventory=1,snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=3}, + {"moreblocks_wood_tile.png", "moreblocks_wood_tile.png", "moreblocks_wood_tile.png", + "moreblocks_wood_tile.png", "moreblocks_wood_tile.png^[transformR90", "moreblocks_wood_tile.png^[transformR90"}, + "Wooden Tile", + "wood_tile", + 0) + +register_stair_slab_panel_micro("moreblocks", "wood_tile_center", "moreblocks:wood_tile_center", + {not_in_creative_inventory=1,snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=3}, + {"moreblocks_wood_tile_center.png", "moreblocks_wood_tile_center.png", "moreblocks_wood_tile_center.png", + "moreblocks_wood_tile_center.png", "moreblocks_wood_tile_center.png^[transformR90", "moreblocks_wood_tile_center.png^[transformR90"}, + "Centered Wooden Tile", + "wood_tile_center", + 0) + +register_stair_slab_panel_micro("moreblocks", "wood_tile_full", "moreblocks:wood_tile_full", + {not_in_creative_inventory=1,snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=3}, + {"moreblocks_wood_tile_full.png", "moreblocks_wood_tile_full.png", "moreblocks_wood_tile_full.png", + "moreblocks_wood_tile_full.png", "moreblocks_wood_tile_full.png^[transformR90", "moreblocks_wood_tile_full.png^[transformR90"}, + "Full Wooden Tile", + "wood_tile_full", + 0) diff --git a/stairsplus/aliases.lua b/stairsplus/aliases.lua new file mode 100644 index 0000000..3fcd867 --- /dev/null +++ b/stairsplus/aliases.lua @@ -0,0 +1,61 @@ +function register_stairsplus_alias(modname, origname, newname) +minetest.register_alias(modname .. ":slab_" .. origname, "moreblocks:slab_" .. newname) +minetest.register_alias(modname .. ":slab_" .. origname .. "_inverted", "moreblocks:slab_" .. newname .. "_inverted") +minetest.register_alias(modname .. ":slab_" .. origname .. "_wall", "moreblocks:slab_" .. newname .. "_wall") +minetest.register_alias(modname .. ":slab_" .. origname .. "_quarter", "moreblocks:slab_" .. newname .. "_quarter") +minetest.register_alias(modname .. ":slab_" .. origname .. "_quarter_inverted", "moreblocks:slab_" .. newname .. "_quarter_inverted") +minetest.register_alias(modname .. ":slab_" .. origname .. "_quarter_wall", "moreblocks:slab_" .. newname .. "_quarter_wall") +minetest.register_alias(modname .. ":slab_" .. origname .. "_three_quarter", "moreblocks:slab_" .. newname .. "_three_quarter") +minetest.register_alias(modname .. ":slab_" .. origname .. "_three_quarter_inverted", "moreblocks:slab_" .. newname .. "_three_quarter_inverted") +minetest.register_alias(modname .. ":slab_" .. origname .. "_three_quarter_wall", "moreblocks:slab_" .. newname .. "_three_quarter_wall") +minetest.register_alias(modname .. ":stair_" .. origname, "moreblocks:stair_" .. newname) +minetest.register_alias(modname .. ":stair_" .. origname .. "_inverted", "moreblocks:stair_" .. newname .. "_inverted") +minetest.register_alias(modname .. ":stair_" .. origname .. "_wall", "moreblocks:stair_" .. newname .. "_wall") +minetest.register_alias(modname .. ":stair_" .. origname .. "_wall_half", "moreblocks:stair_" .. newname .. "_wall_half") +minetest.register_alias(modname .. ":stair_" .. origname .. "_wall_half_inverted", "moreblocks:stair_" .. newname .. "_wall_half_inverted") +minetest.register_alias(modname .. ":stair_" .. origname .. "_half", "moreblocks:stair_" .. newname .. "_half") +minetest.register_alias(modname .. ":stair_" .. origname .. "_half_inverted", "moreblocks:stair_" .. newname .. "_half_inverted") +minetest.register_alias(modname .. ":stair_" .. origname .. "_right_half", "moreblocks:stair_" .. newname .. "_right_half") +minetest.register_alias(modname .. ":stair_" .. origname .. "_right_half_inverted", "moreblocks:stair_" .. newname .. "_right_half_inverted") +minetest.register_alias(modname .. ":stair_" .. origname .. "_wall_half", "moreblocks:stair_" .. newname .. "_wall_half") +minetest.register_alias(modname .. ":stair_" .. origname .. "_wall_half_inverted", "moreblocks:stair_" .. newname .. "_wall_half_inverted") +minetest.register_alias(modname .. ":stair_" .. origname .. "_inner", "moreblocks:stair_" .. newname .. "_inner") +minetest.register_alias(modname .. ":stair_" .. origname .. "_inner_inverted", "moreblocks:stair_" .. newname .. "_inner_inverted") +minetest.register_alias(modname .. ":stair_" .. origname .. "_outer", "moreblocks:stair_" .. newname .. "_outer") +minetest.register_alias(modname .. ":stair_" .. origname .. "_outer_inverted", "moreblocks:stair_" .. newname .. "_outer_inverted") +minetest.register_alias(modname .. ":panel_" .. origname .. "_bottom", "moreblocks:panel_" .. newname .. "_bottom") +minetest.register_alias(modname .. ":panel_" .. origname .. "_top", "moreblocks:panel_" .. newname .. "_top") +minetest.register_alias(modname .. ":panel_" .. origname .. "_vertical", "moreblocks:panel_" .. newname .. "_vertical") +minetest.register_alias(modname .. ":micro_" .. origname .. "_bottom", "moreblocks:micro_" .. newname .. "_bottom") +minetest.register_alias(modname .. ":micro_" .. origname .. "_top", "moreblocks:micro_" .. newname .. "_top") +end + +register_stairsplus_alias("stairsplus", "stone", "stone") +register_stairsplus_alias("stairsplus", "wood", "wood") +register_stairsplus_alias("stairsplus", "cobble", "cobble") +register_stairsplus_alias("stairsplus", "brick", "brick") +register_stairsplus_alias("stairsplus", "sandstone", "sandstone") +register_stairsplus_alias("stairsplus", "glass", "glass") +register_stairsplus_alias("stairsplus", "tree", "tree") +register_stairsplus_alias("stairsplus", "jungletree", "jungletree") +register_stairsplus_alias("stairsplus", "desert_stone", "desert_stone") +register_stairsplus_alias("stairsplus", "steelblock", "steelblock") +register_stairsplus_alias("stairsplus", "mossycobble", "mossycobble") + +register_stairsplus_alias("moreblocks", "coalstone", "coal_stone") +register_stairsplus_alias("moreblocks", "junglewood", "jungle_wood") +register_stairsplus_alias("moreblocks", "circlestonebrick", "circle_stone_bricks") +register_stairsplus_alias("moreblocks", "ironstone", "iron_stone") +register_stairsplus_alias("moreblocks", "coalglass", "coal_glass") +register_stairsplus_alias("moreblocks", "ironglass", "iron_glass") +register_stairsplus_alias("moreblocks", "glowglass", "glow_glass") +register_stairsplus_alias("moreblocks", "superglowglass", "super_glow_glass") +register_stairsplus_alias("moreblocks", "coalchecker", "coal_checker") +register_stairsplus_alias("moreblocks", "ironchecker", "iron_checker") +register_stairsplus_alias("moreblocks", "cactuschecker", "cactus_checker") +register_stairsplus_alias("moreblocks", "ironstonebrick", "iron_stone_bricks") +register_stairsplus_alias("moreblocks", "stonesquare", "stone_tile") +register_stairsplus_alias("moreblocks", "splitstonesquare", "split_stone_tile") +register_stairsplus_alias("moreblocks", "woodtile", "wood_tile") +register_stairsplus_alias("moreblocks", "woodtile_centered", "wood_tile_centered") +register_stairsplus_alias("moreblocks", "woodtile_full", "wood_tile_full") diff --git a/stairsplus/microblocks.lua b/stairsplus/microblocks.lua new file mode 100644 index 0000000..2a1943a --- /dev/null +++ b/stairsplus/microblocks.lua @@ -0,0 +1,43 @@ +-- Load translation library if intllib is installed + +local S +if (minetest.get_modpath("intllib")) then + dofile(minetest.get_modpath("intllib").."/intllib.lua") + S = intllib.Getter(minetest.get_current_modname()) + else + S = function ( s ) return s end +end + +-- Node will be called <modname>micro_<subname> + +function register_micro(modname, subname, recipeitem, groups, images, description, drop, light) + + minetest.register_node(":"..modname .. ":micro_" .. subname, { + description = S("%s Microblock"):format(S(description)), + drawtype = "nodebox", + tiles = images, + light_source = light, + drop = modname .. ":micro_" .. drop, + paramtype = "light", + paramtype2 = "facedir", + sunlight_propagates = true, + groups = groups, + node_box = { + type = "fixed", + fixed = {-0.5, -0.5, 0, 0, 0, 0.5}, + }, + selection_box = { + type = "fixed", + fixed = {-0.5, -0.5, 0, 0, 0, 0.5}, + }, + sounds = default.node_sound_stone_defaults(), + on_place = function(itemstack, placer, pointed_thing) + local keys=placer:get_player_control() + stairsplus_rotate_and_place(itemstack, placer, pointed_thing, keys["sneak"]) + return itemstack + end + }) + + minetest.register_alias(modname..":micro_"..subname.."_bottom", modname..":micro_"..subname) +end + diff --git a/stairsplus/panels.lua b/stairsplus/panels.lua new file mode 100644 index 0000000..8a00b7f --- /dev/null +++ b/stairsplus/panels.lua @@ -0,0 +1,42 @@ +-- Load translation library if intllib is installed + +local S +if (minetest.get_modpath("intllib")) then + dofile(minetest.get_modpath("intllib").."/intllib.lua") + S = intllib.Getter(minetest.get_current_modname()) + else + S = function ( s ) return s end +end + +-- Node will be called <modname>panel_<subname> + +function register_panel(modname, subname, recipeitem, groups, images, description, drop, light) + + minetest.register_node(":" .. modname .. ":panel_" .. subname, { + description = S("%s Panel"):format(S(description)), + drawtype = "nodebox", + tiles = images, + light_source = light, + drop = modname .. ":panel_" .. drop, + paramtype = "light", + paramtype2 = "facedir", + sunlight_propagates = true, + groups = groups, + node_box = { + type = "fixed", + fixed = {-0.5, -0.5, 0, 0.5, 0, 0.5}, + }, + selection_box = { + type = "fixed", + fixed = {-0.5, -0.5, 0, 0.5, 0, 0.5}, + }, + on_place = function(itemstack, placer, pointed_thing) + local keys=placer:get_player_control() + stairsplus_rotate_and_place(itemstack, placer, pointed_thing, keys["sneak"]) + return itemstack + end + }) + + minetest.register_alias(modname..":panel_"..subname.."_bottom", modname..":panel_"..subname) +end + diff --git a/stairsplus/slabs.lua b/stairsplus/slabs.lua new file mode 100644 index 0000000..458c8b9 --- /dev/null +++ b/stairsplus/slabs.lua @@ -0,0 +1,127 @@ +-- Load translation library if intllib is installed + +local S +if (minetest.get_modpath("intllib")) then + dofile(minetest.get_modpath("intllib").."/intllib.lua") + S = intllib.Getter(minetest.get_current_modname()) + else + S = function ( s ) return s end +end + +-- Node will be called <modname>slab_<subname> + +function register_slab(modname, subname, recipeitem, groups, images, description, drop, light) + + minetest.register_node(":" .. modname .. ":slab_" .. subname, { + description = S("%s Slab"):format(S(description)), + drawtype = "nodebox", + tiles = images, + light_source = light, + drop = modname .. ":slab_" .. drop, + paramtype = "light", + paramtype2 = "facedir", + sunlight_propagates = 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}, + }, + sounds = default.node_sound_stone_defaults(), + on_place = function(itemstack, placer, pointed_thing) + local keys=placer:get_player_control() + stairsplus_rotate_and_place(itemstack, placer, pointed_thing, keys["sneak"]) + return itemstack + end + }) + + minetest.register_node(":stairs:slab_" .. subname, { + description = S("%s Slab"):format(S(description)), + drawtype = "nodebox", + tiles = images, + drop = modname .. ":slab_" .. drop, + paramtype = "light", + paramtype2 = "facedir", + sunlight_propagates = 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}, + }, + sounds = default.node_sound_stone_defaults(), + on_place = function(itemstack, placer, pointed_thing) + local keys=placer:get_player_control() + stairsplus_rotate_and_place(itemstack, placer, pointed_thing, keys["sneak"]) + return itemstack + end + }) + + minetest.register_node(":"..modname .. ":slab_" .. subname .. "_quarter", { + description = S("%s Slab"):format(S(description)), + drawtype = "nodebox", + tiles = images, + light_source = light, + drop = modname .. ":slab_" .. drop .. "_quarter", + paramtype = "light", + paramtype2 = "facedir", + sunlight_propagates = true, + groups = groups, + node_box = { + type = "fixed", + fixed = {-0.5, -0.5, -0.5, 0.5, -0.25, 0.5}, + }, + selection_box = { + type = "fixed", + fixed = {-0.5, -0.5, -0.5, 0.5, -0.25, 0.5}, + }, + sounds = default.node_sound_stone_defaults(), + on_place = function(itemstack, placer, pointed_thing) + local keys=placer:get_player_control() + stairsplus_rotate_and_place(itemstack, placer, pointed_thing, keys["sneak"]) + return itemstack + end + }) + + minetest.register_node(":"..modname .. ":slab_" .. subname .. "_three_quarter", { + description = S("%s Slab"):format(S(description)), + drawtype = "nodebox", + tiles = images, + light_source = light, + drop = modname .. ":slab_" .. drop .. "_three_quarter", + paramtype = "light", + paramtype2 = "facedir", + sunlight_propagates = true, + groups = groups, + node_box = { + type = "fixed", + fixed = {-0.5, -0.5, -0.5, 0.5, 0.25, 0.5}, + }, + selection_box = { + type = "fixed", + fixed = {-0.5, -0.5, -0.5, 0.5, 0.25, 0.5}, + }, + sounds = default.node_sound_stone_defaults(), + on_place = function(itemstack, placer, pointed_thing) + local keys=placer:get_player_control() + stairsplus_rotate_and_place(itemstack, placer, pointed_thing, keys["sneak"]) + return itemstack + end + }) + + -- Unregister default recipes + + minetest.register_craft({ + output = "moreblocks:nothing 1", + recipe = { + {recipeitem, recipeitem, recipeitem}, + }, + }) +end + diff --git a/stairsplus/stairs.lua b/stairsplus/stairs.lua new file mode 100644 index 0000000..ae06e73 --- /dev/null +++ b/stairsplus/stairs.lua @@ -0,0 +1,248 @@ +-- Load translation library if intllib is installed + +local S +if (minetest.get_modpath("intllib")) then + dofile(minetest.get_modpath("intllib").."/intllib.lua") + S = intllib.Getter(minetest.get_current_modname()) + else + S = function ( s ) return s end +end + +-- Node will be called <modname>:stair_<subname> + +function register_stair(modname, subname, recipeitem, groups, images, description, drop, light) + + minetest.register_node(":" .. modname .. ":stair_" .. subname, { + description = S("%s Stairs"):format(S(description)), + drawtype = "nodebox", + tiles = images, + light_source = light, + paramtype = "light", + paramtype2 = "facedir", + sunlight_propagates = 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}, + }, + }, + selection_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}, + }, + }, + sounds = default.node_sound_stone_defaults(), + on_place = function(itemstack, placer, pointed_thing) + local keys=placer:get_player_control() + stairsplus_rotate_and_place(itemstack, placer, pointed_thing, keys["sneak"]) + return itemstack + end + }) + + minetest.register_node(":stairs:stair_" .. subname, { + description = S("%s Stairs"):format(S(description)), + drawtype = "nodebox", + tiles = images, + paramtype = "light", + paramtype2 = "facedir", + sunlight_propagates = true, + groups = {cracky=3, not_in_creative_inventory=1}, + 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}, + }, + }, + selection_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}, + }, + }, + sounds = default.node_sound_stone_defaults(), + on_place = function(itemstack, placer, pointed_thing) + local keys=placer:get_player_control() + stairsplus_rotate_and_place(itemstack, placer, pointed_thing, keys["sneak"]) + return itemstack + end + }) + + minetest.register_node(":" .. modname .. ":stair_" .. subname .. "_half", { + description = S("%s Stairs"):format(S(description)), + drawtype = "nodebox", + tiles = images, + light_source = light, + paramtype = "light", + paramtype2 = "facedir", + sunlight_propagates = true, + groups = groups, + node_box = { + type = "fixed", + fixed = { + {-0.5, -0.5, -0.5, 0, 0, 0.5}, + {-0.5, 0, 0, 0, 0.5, 0.5}, + }, + }, + selection_box = { + type = "fixed", + fixed = { + {-0.5, -0.5, -0.5, 0, 0, 0.5}, + {-0.5, 0, 0, 0, 0.5, 0.5}, + }, + }, + sounds = default.node_sound_stone_defaults(), + on_place = function(itemstack, placer, pointed_thing) + local keys=placer:get_player_control() + stairsplus_rotate_and_place(itemstack, placer, pointed_thing, keys["sneak"]) + return itemstack + end + }) + + minetest.register_node(":"..modname .. ":stair_" .. subname .. "_right_half", { + description = S("%s Stairs"):format(S(description)), + drawtype = "nodebox", + tiles = images, + light_source = light, + paramtype = "light", + paramtype2 = "facedir", + sunlight_propagates = true, + groups = groups, + node_box = { + type = "fixed", + fixed = { + {0, -0.5, -0.5, 0.5, 0, 0.5}, + {0, 0, 0, 0.5, 0.5, 0.5}, + }, + }, + selection_box = { + type = "fixed", + fixed = { + {0, -0.5, -0.5, 0.5, 0, 0.5}, + {0, 0, 0, 0.5, 0.5, 0.5}, + }, + }, + sounds = default.node_sound_stone_defaults(), + on_place = function(itemstack, placer, pointed_thing) + local keys=placer:get_player_control() + stairsplus_rotate_and_place(itemstack, placer, pointed_thing, keys["sneak"]) + return itemstack + end + }) + + minetest.register_node(":"..modname .. ":stair_" .. subname .. "_inner", { + description = S("%s Stairs"):format(S(description)), + drawtype = "nodebox", + tiles = images, + light_source = light, + drop = modname .. ":stair_" .. drop .. "_inner", + paramtype = "light", + paramtype2 = "facedir", + sunlight_propagates = 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}, + {-0.5, 0, -0.5, 0, 0.5, 0}, + }, + }, + selection_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}, + {-0.5, 0, -0.5, 0, 0.5, 0}, + }, + }, + sounds = default.node_sound_stone_defaults(), + on_place = function(itemstack, placer, pointed_thing) + local keys=placer:get_player_control() + stairsplus_rotate_and_place(itemstack, placer, pointed_thing, keys["sneak"]) + return itemstack + end + }) + + minetest.register_node(":"..modname .. ":stair_" .. subname .. "_outer", { + description = S("%s Stairs"):format(S(description)), + drawtype = "nodebox", + tiles = images, + light_source = light, + drop = modname .. ":stair_" .. drop .. "_outer", + paramtype = "light", + paramtype2 = "facedir", + sunlight_propagates = true, + groups = groups, + node_box = { + type = "fixed", + fixed = { + {-0.5, -0.5, -0.5, 0.5, 0, 0.5}, + {-0.5, 0, 0, 0, 0.5, 0.5}, + }, + }, + selection_box = { + type = "fixed", + fixed = { + {-0.5, -0.5, -0.5, 0.5, 0, 0.5}, + {-0.5, 0, 0, 0, 0.5, 0.5}, + }, + }, + sounds = default.node_sound_stone_defaults(), + on_place = function(itemstack, placer, pointed_thing) + local keys=placer:get_player_control() + stairsplus_rotate_and_place(itemstack, placer, pointed_thing, keys["sneak"]) + return itemstack + end + }) + + minetest.register_node(":" .. modname .. ":stair_" .. subname .. "_alt", { + description = S("%s Stairs"):format(S(description)), + drawtype = "nodebox", + tiles = images, + light_source = light, + paramtype = "light", + paramtype2 = "facedir", + sunlight_propagates = true, + groups = groups, + node_box = { + type = "fixed", + fixed = { + {-0.5, -0.5, -0.5, 0.5, 0, 0}, + {-0.5, 0, 0, 0.5, 0.5, 0.5}, + }, + }, + sounds = default.node_sound_stone_defaults(), + on_place = function(itemstack, placer, pointed_thing) + local keys=placer:get_player_control() + stairsplus_rotate_and_place(itemstack, placer, pointed_thing, keys["sneak"]) + return itemstack + end + }) + + -- Unregister default recipes + + minetest.register_craft({ + output = "moreblocks:nothing 1", + recipe = { + {recipeitem, "", ""}, + {recipeitem, recipeitem, ""}, + {recipeitem, recipeitem, recipeitem}, + }, + }) + + minetest.register_craft({ + output = "moreblocks:nothing 1", + recipe = { + {"", "", recipeitem}, + {"", recipeitem, recipeitem}, + {recipeitem, recipeitem, recipeitem}, + }, + }) +end + diff --git a/stairsplus_convert.lua b/stairsplus_convert.lua new file mode 100644 index 0000000..7d6b94b --- /dev/null +++ b/stairsplus_convert.lua @@ -0,0 +1,133 @@ +-- Function to convert all stairs/slabs/etc nodes from +-- inverted, wall, etc to regular + 6d facedir + +local dirs1 = { 21, 20, 23, 22, 21 } +local dirs2 = { 15, 8, 17, 6, 15 } +local dirs3 = { 14, 11, 16, 5, 14 } + +function register_6dfacedir_conversion(modname, material) + --print("Register stairsplus 6d facedir conversion") + --print('ABM for '..modname..' "'..material..'"') + + local objects_list1 = { + modname..":slab_" .. material .. "_inverted", + modname..":slab_" .. material .. "_quarter_inverted", + modname..":slab_" .. material .. "_three_quarter_inverted", + modname..":stair_" .. material .. "_inverted", + modname..":stair_" .. material .. "_wall", + modname..":stair_" .. material .. "_wall_half", + modname..":stair_" .. material .. "_wall_half_inverted", + modname..":stair_" .. material .. "_half_inverted", + modname..":stair_" .. material .. "_right_half_inverted", + modname..":panel_" .. material .. "_vertical", + modname..":panel_" .. material .. "_top", + } + + local objects_list2 = { + modname..":slab_" .. material .. "_wall", + modname..":slab_" .. material .. "_quarter_wall", + modname..":slab_" .. material .. "_three_quarter_wall", + modname..":stair_" .. material .. "_inner_inverted", + modname..":stair_" .. material .. "_outer_inverted", + modname..":micro_" .. material .. "_top" + } + + for j in ipairs(objects_list1) do + local flip_upside_down = false + local flip_to_wall = false + + local object = objects_list1[j] + local dest_object = objects_list1[j] + + if string.find(dest_object, "_inverted") then + flip_upside_down = true + dest_object = string.gsub(dest_object, "_inverted", "") + end + + if string.find(dest_object, "_top") then + flip_upside_down = true + dest_object = string.gsub(dest_object, "_top", "") + end + + if string.find(dest_object, "_wall") then + flip_to_wall = true + dest_object = string.gsub(dest_object, "_wall", "") + end + + if string.find(dest_object, "_vertical") then + flip_to_wall = true + dest_object = string.gsub(dest_object, "_vertical", "") + end + + if string.find(dest_object, "_half") and not string.find(dest_object, "_right_half") then + dest_object = string.gsub(dest_object, "_half", "_right_half") + elseif string.find(dest_object, "_right_half") then + dest_object = string.gsub(dest_object, "_right_half", "_half") + end + + --print(" +---> convert "..object) + --print(" | to "..dest_object) + + minetest.register_abm({ + nodenames = { object }, + interval = 1, + chance = 1, + action = function(pos, node, active_object_count, active_object_count_wider) + local fdir = node.param2 or 0 + + if flip_upside_down and not flip_to_wall then + nfdir = dirs1[fdir+2] + elseif flip_to_wall and not flip_upside_down then + nfdir = dirs2[fdir+1] + elseif flip_to_wall and flip_upside_down then + nfdir = dirs3[fdir+2] + end + minetest.env:add_node(pos, {name = dest_object, param2 = nfdir}) + end + }) + end + + for j in ipairs(objects_list2) do + local flip_upside_down = false + local flip_to_wall = false + + local object = objects_list2[j] + local dest_object = objects_list2[j] + + if string.find(dest_object, "_inverted") then + flip_upside_down = true + dest_object = string.gsub(dest_object, "_inverted", "") + end + + if string.find(dest_object, "_top") then + flip_upside_down = true + dest_object = string.gsub(dest_object, "_top", "") + end + + if string.find(dest_object, "_wall") then + flip_to_wall = true + dest_object = string.gsub(dest_object, "_wall", "") + end + + --print(" +---> convert "..object) + --print(" | to "..dest_object) + + minetest.register_abm({ + nodenames = { object }, + interval = 1, + chance = 1, + action = function(pos, node, active_object_count, active_object_count_wider) + local fdir = node.param2 + local nfdir = 20 + + if flip_upside_down and not flip_to_wall then + nfdir = dirs1[fdir+1] + elseif flip_to_wall and not flip_upside_down then + nfdir = dirs2[fdir+2] + + end + minetest.env:add_node(pos, {name = dest_object, param2 = nfdir}) + end + }) + end +end diff --git a/textures/moreblocks_cactus_brick.png b/textures/moreblocks_cactus_brick.png Binary files differnew file mode 100644 index 0000000..bdd4b92 --- /dev/null +++ b/textures/moreblocks_cactus_brick.png diff --git a/textures/moreblocks_cactus_checker.png b/textures/moreblocks_cactus_checker.png Binary files differnew file mode 100644 index 0000000..0e55b0a --- /dev/null +++ b/textures/moreblocks_cactus_checker.png diff --git a/textures/moreblocks_circle_stone_bricks.png b/textures/moreblocks_circle_stone_bricks.png Binary files differnew file mode 100644 index 0000000..03bbcbb --- /dev/null +++ b/textures/moreblocks_circle_stone_bricks.png diff --git a/textures/moreblocks_circular_saw_bottom.png b/textures/moreblocks_circular_saw_bottom.png Binary files differnew file mode 100644 index 0000000..c472a8b --- /dev/null +++ b/textures/moreblocks_circular_saw_bottom.png diff --git a/textures/moreblocks_circular_saw_side.png b/textures/moreblocks_circular_saw_side.png Binary files differnew file mode 100644 index 0000000..a557095 --- /dev/null +++ b/textures/moreblocks_circular_saw_side.png diff --git a/textures/moreblocks_circular_saw_top.png b/textures/moreblocks_circular_saw_top.png Binary files differnew file mode 100644 index 0000000..cec4aaa --- /dev/null +++ b/textures/moreblocks_circular_saw_top.png diff --git a/textures/moreblocks_clean_glass.png b/textures/moreblocks_clean_glass.png Binary files differnew file mode 100644 index 0000000..906a3c1 --- /dev/null +++ b/textures/moreblocks_clean_glass.png diff --git a/textures/moreblocks_coal_checker.png b/textures/moreblocks_coal_checker.png Binary files differnew file mode 100644 index 0000000..4da7746 --- /dev/null +++ b/textures/moreblocks_coal_checker.png diff --git a/textures/moreblocks_coal_glass.png b/textures/moreblocks_coal_glass.png Binary files differnew file mode 100644 index 0000000..d7c830d --- /dev/null +++ b/textures/moreblocks_coal_glass.png diff --git a/textures/moreblocks_coal_glass_stairsplus.png b/textures/moreblocks_coal_glass_stairsplus.png Binary files differnew file mode 100644 index 0000000..0441cec --- /dev/null +++ b/textures/moreblocks_coal_glass_stairsplus.png diff --git a/textures/moreblocks_coal_stone.png b/textures/moreblocks_coal_stone.png Binary files differnew file mode 100644 index 0000000..95db8fa --- /dev/null +++ b/textures/moreblocks_coal_stone.png diff --git a/textures/moreblocks_empty_bookshelf.png b/textures/moreblocks_empty_bookshelf.png Binary files differnew file mode 100644 index 0000000..56fc713 --- /dev/null +++ b/textures/moreblocks_empty_bookshelf.png diff --git a/textures/moreblocks_fence_jungle_wood.png b/textures/moreblocks_fence_jungle_wood.png Binary files differnew file mode 100644 index 0000000..63a39ee --- /dev/null +++ b/textures/moreblocks_fence_jungle_wood.png diff --git a/textures/moreblocks_fence_wood.png b/textures/moreblocks_fence_wood.png Binary files differnew file mode 100644 index 0000000..0b99f0e --- /dev/null +++ b/textures/moreblocks_fence_wood.png diff --git a/textures/moreblocks_glass.png b/textures/moreblocks_glass.png Binary files differnew file mode 100644 index 0000000..ade0196 --- /dev/null +++ b/textures/moreblocks_glass.png diff --git a/textures/moreblocks_glass_stairsplus.png b/textures/moreblocks_glass_stairsplus.png Binary files differnew file mode 100644 index 0000000..d222b62 --- /dev/null +++ b/textures/moreblocks_glass_stairsplus.png diff --git a/textures/moreblocks_glow_glass.png b/textures/moreblocks_glow_glass.png Binary files differnew file mode 100644 index 0000000..84991fa --- /dev/null +++ b/textures/moreblocks_glow_glass.png diff --git a/textures/moreblocks_glow_glass_stairsplus.png b/textures/moreblocks_glow_glass_stairsplus.png Binary files differnew file mode 100644 index 0000000..235179c --- /dev/null +++ b/textures/moreblocks_glow_glass_stairsplus.png diff --git a/textures/moreblocks_iron_checker.png b/textures/moreblocks_iron_checker.png Binary files differnew file mode 100644 index 0000000..f852884 --- /dev/null +++ b/textures/moreblocks_iron_checker.png diff --git a/textures/moreblocks_iron_glass.png b/textures/moreblocks_iron_glass.png Binary files differnew file mode 100644 index 0000000..ad5cd1e --- /dev/null +++ b/textures/moreblocks_iron_glass.png diff --git a/textures/moreblocks_iron_glass_stairsplus.png b/textures/moreblocks_iron_glass_stairsplus.png Binary files differnew file mode 100644 index 0000000..b41cba7 --- /dev/null +++ b/textures/moreblocks_iron_glass_stairsplus.png diff --git a/textures/moreblocks_iron_stone.png b/textures/moreblocks_iron_stone.png Binary files differnew file mode 100644 index 0000000..657c4b2 --- /dev/null +++ b/textures/moreblocks_iron_stone.png diff --git a/textures/moreblocks_iron_stone_bricks.png b/textures/moreblocks_iron_stone_bricks.png Binary files differnew file mode 100644 index 0000000..1b0ed5c --- /dev/null +++ b/textures/moreblocks_iron_stone_bricks.png diff --git a/textures/moreblocks_jungle_wood.png b/textures/moreblocks_jungle_wood.png Binary files differnew file mode 100644 index 0000000..ebc6485 --- /dev/null +++ b/textures/moreblocks_jungle_wood.png diff --git a/textures/moreblocks_junglestick.png b/textures/moreblocks_junglestick.png Binary files differnew file mode 100644 index 0000000..afe5892 --- /dev/null +++ b/textures/moreblocks_junglestick.png diff --git a/textures/moreblocks_obsidian_glass_stairsplus.png b/textures/moreblocks_obsidian_glass_stairsplus.png Binary files differnew file mode 100644 index 0000000..eb758f1 --- /dev/null +++ b/textures/moreblocks_obsidian_glass_stairsplus.png diff --git a/textures/moreblocks_plankstone.png b/textures/moreblocks_plankstone.png Binary files differnew file mode 100644 index 0000000..ac866b8 --- /dev/null +++ b/textures/moreblocks_plankstone.png diff --git a/textures/moreblocks_plankstone_2.png b/textures/moreblocks_plankstone_2.png Binary files differnew file mode 100644 index 0000000..52656b0 --- /dev/null +++ b/textures/moreblocks_plankstone_2.png diff --git a/textures/moreblocks_rope.png b/textures/moreblocks_rope.png Binary files differnew file mode 100644 index 0000000..55967a6 --- /dev/null +++ b/textures/moreblocks_rope.png diff --git a/textures/moreblocks_split_stone_tile.png b/textures/moreblocks_split_stone_tile.png Binary files differnew file mode 100644 index 0000000..579e5ac --- /dev/null +++ b/textures/moreblocks_split_stone_tile.png diff --git a/textures/moreblocks_split_stone_tile_top.png b/textures/moreblocks_split_stone_tile_top.png Binary files differnew file mode 100644 index 0000000..76e39df --- /dev/null +++ b/textures/moreblocks_split_stone_tile_top.png diff --git a/textures/moreblocks_stone_bricks.png b/textures/moreblocks_stone_bricks.png Binary files differnew file mode 100644 index 0000000..52c8ca8 --- /dev/null +++ b/textures/moreblocks_stone_bricks.png diff --git a/textures/moreblocks_stone_tile.png b/textures/moreblocks_stone_tile.png Binary files differnew file mode 100644 index 0000000..20b070e --- /dev/null +++ b/textures/moreblocks_stone_tile.png diff --git a/textures/moreblocks_super_glow_glass.png b/textures/moreblocks_super_glow_glass.png Binary files differnew file mode 100644 index 0000000..65e09f4 --- /dev/null +++ b/textures/moreblocks_super_glow_glass.png diff --git a/textures/moreblocks_super_glow_glass_stairsplus.png b/textures/moreblocks_super_glow_glass_stairsplus.png Binary files differnew file mode 100644 index 0000000..b8a6657 --- /dev/null +++ b/textures/moreblocks_super_glow_glass_stairsplus.png diff --git a/textures/moreblocks_sweeper.png b/textures/moreblocks_sweeper.png Binary files differnew file mode 100644 index 0000000..e901ef0 --- /dev/null +++ b/textures/moreblocks_sweeper.png diff --git a/textures/moreblocks_trap_glass.png b/textures/moreblocks_trap_glass.png Binary files differnew file mode 100644 index 0000000..e0d1c26 --- /dev/null +++ b/textures/moreblocks_trap_glass.png diff --git a/textures/moreblocks_trap_stone.png b/textures/moreblocks_trap_stone.png Binary files differnew file mode 100644 index 0000000..05a2531 --- /dev/null +++ b/textures/moreblocks_trap_stone.png diff --git a/textures/moreblocks_wood.png b/textures/moreblocks_wood.png Binary files differnew file mode 100644 index 0000000..66f2b72 --- /dev/null +++ b/textures/moreblocks_wood.png diff --git a/textures/moreblocks_wood_tile.png b/textures/moreblocks_wood_tile.png Binary files differnew file mode 100644 index 0000000..c05a56f --- /dev/null +++ b/textures/moreblocks_wood_tile.png diff --git a/textures/moreblocks_wood_tile_center.png b/textures/moreblocks_wood_tile_center.png Binary files differnew file mode 100644 index 0000000..7b8f822 --- /dev/null +++ b/textures/moreblocks_wood_tile_center.png diff --git a/textures/moreblocks_wood_tile_down.png b/textures/moreblocks_wood_tile_down.png Binary files differnew file mode 100644 index 0000000..aedddfb --- /dev/null +++ b/textures/moreblocks_wood_tile_down.png diff --git a/textures/moreblocks_wood_tile_flipped.png b/textures/moreblocks_wood_tile_flipped.png Binary files differnew file mode 100644 index 0000000..66eb5a6 --- /dev/null +++ b/textures/moreblocks_wood_tile_flipped.png diff --git a/textures/moreblocks_wood_tile_full.png b/textures/moreblocks_wood_tile_full.png Binary files differnew file mode 100644 index 0000000..0c28e92 --- /dev/null +++ b/textures/moreblocks_wood_tile_full.png diff --git a/textures/moreblocks_wood_tile_left.png b/textures/moreblocks_wood_tile_left.png Binary files differnew file mode 100644 index 0000000..b84166f --- /dev/null +++ b/textures/moreblocks_wood_tile_left.png diff --git a/textures/moreblocks_wood_tile_right.png b/textures/moreblocks_wood_tile_right.png Binary files differnew file mode 100644 index 0000000..883f44c --- /dev/null +++ b/textures/moreblocks_wood_tile_right.png diff --git a/textures/moreblocks_wood_tile_up.png b/textures/moreblocks_wood_tile_up.png Binary files differnew file mode 100644 index 0000000..6221910 --- /dev/null +++ b/textures/moreblocks_wood_tile_up.png |