From 008ade61de87a6723555543c0f164d0f75bf05da Mon Sep 17 00:00:00 2001 From: Calinou Date: Sat, 3 May 2014 21:40:45 +0200 Subject: [PATCH] Added desert cobblestone Stairs+ nodes, circular saw cosmetic changes, remove obsolete code. --- circular_saw.lua | 35 +-- stairsplus.lua | 413 ----------------------------------- stairsplus/init.lua | 1 + stairsplus/registrations.lua | 3 +- 4 files changed, 21 insertions(+), 431 deletions(-) delete mode 100644 stairsplus.lua diff --git a/circular_saw.lua b/circular_saw.lua index d525979..b7d791c 100644 --- a/circular_saw.lua +++ b/circular_saw.lua @@ -5,8 +5,8 @@ circular_saw = {} circular_saw.known_stairs = setmetatable({}, { __newindex = function(k, v) local modname = minetest.get_current_modname() - print(("Mod %s tried to add node %s to the circular saw" - .." manually!"):format(modname, v)) + print(("WARNING: mod %s tried to add node %s to the circular saw" + .." manually."):format(modname, v)) end, }) @@ -94,7 +94,7 @@ function circular_saw:reset(pos) meta:set_int("anz", 0) meta:set_string("infotext", - S("Circular saw, empty (owned by %s)") + S("Circular Saw is empty (owned by %s)") :format(meta:get_string("owner") or "")) end @@ -153,7 +153,7 @@ function circular_saw:update_inventory(pos, amount) meta:set_int("anz", amount) meta:set_string("infotext", - S("Circular saw, working with %s (owned by %s)") + S("Circular Saw is working on %s (owned by %s)") :format(material, meta:get_string("owner") or "")) end @@ -284,15 +284,15 @@ function circular_saw.on_construct(pos) "list[current_name;output;2.8,0;8,4;]".. "list[current_player;main;1.5,5;8,4;]") - meta:set_int("anz", 0) -- No microblocks inside yet + 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", S("Circular saw, empty")) + meta:set_string("infotext", S("Circular Saw is 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", 4*8) -- 4x8 versions of stair-parts of material x + 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", 4*8) -- 4x8 versions of stair-parts of material x. circular_saw:reset(pos) end @@ -307,7 +307,7 @@ function circular_saw.can_dig(pos,player) return false end - -- Can be dug by anyone when empty (not only by the owner) + -- Can be dug by anyone when empty ,not only by the owner. return true end @@ -333,26 +333,27 @@ minetest.register_node("moreblocks:circular_saw", { paramtype = "light", sunlight_propagates = true, paramtype2 = "facedir", - groups = {cracky=2}, + groups = {choppy = 2,oddly_breakable_by_hand = 2}, + sounds = default.node_sound_wood_defaults(), on_construct = circular_saw.on_construct, can_dig = circular_saw.can_dig, - -- Set owner of this circular saw + -- Set the owner of this circular saw. after_place_node = function(pos, placer) local meta = minetest.get_meta(pos) local owner = placer and placer:get_player_name() or "" meta:set_string("owner", owner) meta:set_string("infotext", - S("Circular saw is empty (owned by %s)") + S("Circular Saw is empty (owned by %s)") :format(owner)) end, - -- The amount of items offered per shape can be configured + -- The amount of items offered per shape can be configured. on_receive_fields = circular_saw.on_receive_fields, allow_metadata_inventory_move = circular_saw.allow_metadata_inventory_move, - -- Only input- and recycle-slot are intended as input slots + -- Only input- and recycle-slot are intended as input slots. allow_metadata_inventory_put = circular_saw.allow_metadata_inventory_put, -- 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 + -- 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 = circular_saw.on_metadata_inventory_put, on_metadata_inventory_take = circular_saw.on_metadata_inventory_take, }) diff --git a/stairsplus.lua b/stairsplus.lua deleted file mode 100644 index 458a722..0000000 --- a/stairsplus.lua +++ /dev/null @@ -1,413 +0,0 @@ --- Nodes will be called :{stair,slab,panel,micro}_ - -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_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(itemstack, placer, pointed_thing) - local keys=placer:get_player_control() - stairsplus_rotate_and_place(itemstack, placer, pointed_thing, keys["sneak"]) - return itemstack - end - -]]-- - -function stairsplus_rotate_and_place(itemstack, placer, pointed_thing) - if not moreblocks.node_is_owned(pointed_thing.under, placer) then - local keys=placer:get_player_control() - minetest.rotate_and_place(itemstack, placer, pointed_thing, - stairsplus_expect_infinite_stacks, {force_wall = keys.sneak}) - end - return itemstack -end - -function register_stair_slab_panel_micro(modname, subname, recipeitem, groups, images, description, drop, light) - if show_stairsplus_creative_inv then - groups.not_in_creative_inventory = 0 - else - groups.not_in_creative_inventory = 1 - end - 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", - {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", - {cracky=3}, - {"default_stone.png"}, - "Stone", - "cobble", - 0) - -register_stair_slab_panel_micro("moreblocks", "cobble", "default:cobble", - {cracky=3}, - {"default_cobble.png"}, - "Cobblestone", - "cobble", - 0) - -register_stair_slab_panel_micro("moreblocks", "mossycobble", "default:mossycobble", - {cracky=3}, - {"default_mossycobble.png"}, - "Mossy Cobblestone", - "mossycobble", - 0) - -register_stair_slab_panel_micro("moreblocks", "brick", "default:brick", - {cracky=3}, - {"default_brick.png"}, - "Brick", - "brick", - 0) - -register_stair_slab_panel_micro("moreblocks", "sandstone", "default:sandstone", - {crumbly=2, cracky=2}, - {"default_sandstone.png"}, - "Sandstone", - "sandstone", - 0) - -register_stair_slab_panel_micro("moreblocks", "steelblock", "default:steelblock", - {cracky=1, level=2}, - {"default_steel_block.png"}, - "Steel Block", - "steelblock", - 0) - -register_stair_slab_panel_micro("moreblocks", "goldblock", "default:goldblock", - {cracky=1}, - {"default_gold_block.png"}, - "Gold Block", - "goldblock", - 0) - -register_stair_slab_panel_micro("moreblocks", "copperblock", "default:copperblock", - {cracky=1, level=2}, - {"default_copper_block.png"}, - "Copper Block", - "copperblock", - 0) - -register_stair_slab_panel_micro("moreblocks", "bronzeblock", "default:bronzeblock", - {cracky=1, level=2}, - {"default_bronze_block.png"}, - "Bronze Block", - "bronzeblock", - 0) - -register_stair_slab_panel_micro("moreblocks", "diamondblock", "default:diamondblock", - {cracky=1, level=3}, - {"default_diamond_block.png"}, - "Diamond Block", - "diamondblock", - 0) - -register_stair_slab_panel_micro("moreblocks", "desert_stone", "default:desert_stone", - {cracky=3}, - {"default_desert_stone.png"}, - "Desert Stone", - "desert_stone", - 0) - -register_stair_slab_panel_micro("moreblocks", "glass", "default:glass", - {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", - {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", - {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", - {cracky=1, level=2}, - {"default_obsidian.png"}, - "Obsidian", - "obsidian", - 0) - -register_stair_slab_panel_micro("moreblocks", "obsidian_glass", "default:obsidian_glass", - {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", - {cracky=3}, - {"default_stone_brick.png"}, - "Stone Bricks", - "stonebrick", - 0) - -register_stair_slab_panel_micro("moreblocks", "desert_stonebrick", "default:desert_stonebrick", - {cracky=3}, - {"default_desert_stone_brick.png"}, - "Desert Stone Bricks", - "desert_stonebrick", - 0) - -register_stair_slab_panel_micro("moreblocks", "sandstonebrick", "default:sandstonebrick", - {cracky=3}, - {"default_sandstone_brick.png"}, - "Sandstone Bricks", - "sandstonebrick", - 0) - --- More Blocks stairs/slabs/panels/microblocks - -register_stair_slab_panel_micro("moreblocks", "invisible", "air", - {unbreakable=1, not_in_creative_inventory=1}, - {"invisible.png"}, - "Invisible", - "invisible", - 0) - -register_stair_slab_panel_micro("moreblocks", "circle_stone_bricks", "moreblocks:circle_stone_bricks", - {cracky=3}, - {"moreblocks_circle_stone_bricks.png"}, - "Circle Stone Bricks", - "circle_stone_bricks", - 0) - -register_stair_slab_panel_micro("moreblocks", "coal_stone_bricks", "moreblocks:coal_stone_bricks", - {cracky=3}, - {"moreblocks_coal_stone_bricks.png"}, - "Coal Stone Bricks", - "Coal_stone_bricks", - 0) - -register_stair_slab_panel_micro("moreblocks", "iron_stone_bricks", "moreblocks:iron_stone_bricks", - {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", - {cracky=3}, - {"moreblocks_stone_tile.png"}, - "Stonesquare", - "stone_tile", - 0) - -register_stair_slab_panel_micro("moreblocks", "split_stone_tile", "moreblocks:split_stone_tile", - {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", -- Compatibility - {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", "junglewood", "default:junglewood", - {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", - {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", - {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", - {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", - {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", - {cracky=3}, - {"moreblocks_coal_stone.png"}, - "Coal Stone", - "coal_stone", - 0) - -register_stair_slab_panel_micro("moreblocks", "iron_stone", "moreblocks:iron_stone", - {cracky=3}, - {"moreblocks_iron_stone.png"}, - "Iron Stone", - "iron_stone", - 0) - -register_stair_slab_panel_micro("moreblocks", "glow_glass", "moreblocks:glow_glass", - {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", - {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", - {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", - {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", - {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", - {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", - {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/init.lua b/stairsplus/init.lua index 7cc0385..74d7ddb 100644 --- a/stairsplus/init.lua +++ b/stairsplus/init.lua @@ -1,3 +1,4 @@ + -- Nodes will be called :{stair,slab,panel,micro}_ local modpath = minetest.get_modpath("moreblocks").."/stairsplus" diff --git a/stairsplus/registrations.lua b/stairsplus/registrations.lua index 6e44ee1..a29721e 100644 --- a/stairsplus/registrations.lua +++ b/stairsplus/registrations.lua @@ -1,4 +1,4 @@ --- Default stairs/slabs/panels/microblocks +-- Default stairs/slabs/panels/microblocks. local default_nodes = { "stone", @@ -12,6 +12,7 @@ local default_nodes = { "bronzeblock", "diamondblock", "desert_stone", + "desert_cobble", "glass", "tree", "wood",