From 42887e0abcfe04b9ce8eab2d345f0a258d7ec547 Mon Sep 17 00:00:00 2001 From: TenPlus1 Date: Sun, 13 Aug 2017 20:13:57 +0100 Subject: [PATCH] added floor paint feature and moreblock support --- README.md | 3 ++- api.txt | 19 +++++++++++++++++++ blocks.lua | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ init.lua | 30 ++++++++++++++++++++++++++++++ 4 files changed, 103 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 0b5d5fc..6698583 100644 --- a/README.md +++ b/README.md @@ -19,5 +19,6 @@ Changelog: - 0.4 - Added ability to add custom functions within lucky blocks - 0.5 - Explosions now have radius and fire setting, also added new blocks - 0.6 - Use TNT mod for explosions and if not active do entity damage only +- 0.7 - Added new floor feature to blocks and moreblocks support -Lucky Blocks: 118 (depending on mods enabled) +Lucky Blocks: 136 (depending on mods enabled) diff --git a/api.txt b/api.txt index d26bb69..e347286 100644 --- a/api.txt +++ b/api.txt @@ -269,6 +269,25 @@ Strike player and place permanent flame {"lig", "fire:permanent_flame"} +Floor Placement +--------------- + +This feature places random blocks from the list provided to make a floor under +the lucky block with a pause after each block. + +{"flo", width, {node_list}, offset}, + +e.g. + +Place a three wide obsidian and gold block floor with offset of 1 to centre on +lucky block + + {"flo", 3, {"default:goldblock", "default:obsidian"}, 1} + +Have a woolen floor at 5 width with offset of 2 to keep it centred + + {"flo", 5, {"wool:red", "wool:blue", "wool:white", "wool:orange"}, 2} + Custom Function --------------- diff --git a/blocks.lua b/blocks.lua index 581be19..0177b6d 100644 --- a/blocks.lua +++ b/blocks.lua @@ -266,6 +266,58 @@ end end -- END moreores +-- Moreblocks mod +if minetest.get_modpath("moreblocks") then +local p = "moreblocks:" +local lav = {name = "default:lava_source"} +local air = {name = "air"} +local trs = {name = p.."trap_stone"} +local trg = {name = p.."trap_glow_glass"} +local trapstone_trap = { + size = {x = 3, y = 6, z = 3}, + data = { + lav, lav, lav, air, air, air, air, air, air, + air, air, air, air, air, air, trs, trs, trs, + lav, lav, lav, air, air, air, air, air, air, + air, air, air, air, trg, air, trs, air, trs, + lav, lav, lav, air, air, air, air, air, air, + air, air, air, air, air, air, trs, trs, trs, + }, +} + +lucky_block:add_schematics({ + {"trapstonetrap", trapstone_trap, {x = 1, y = 6, z = 1}}, +}) + +lucky_block:add_blocks({ + {"dro", {p.."wood_tile", p.."wood_tile_flipped", p.."wood_tile_center", + p.."wood_tile_full", p.."wood_tile_up", p.."wood_tile_down", + p.."wood_tile_left", p.."wood_tile_right"}, 20}, + {"dro", {p.."circle_stone_bricks"}, 20}, + {"dro", {p.."grey_bricks"}, 20}, + {"dro", {p.."stone_tile", p.."split_stone_tile", p.."split_stone_tile_alt"}, 20}, + {"flo", 5, {"moreblocks:stone_tile", "moreblocks:split_stone_tile"}, 2}, + {"dro", {p.."tar", p.."cobble_compressed"}, 10}, + {"dro", {p.."cactus_brick", p.."cactus_checker"}, 10}, + {"nod", {p.."empty_bookshelf"}, 0}, + {"dro", {p.."coal_stone", p.."coal_checker", p.."coal_stone_bricks", p.."coal_glass"}, 20}, + {"exp", 3}, + {"dro", {p.."iron_stone", p.."iron_checker", p.."iron_stone_bricks", p.."iron_glass"}, 20}, + {"dro", {p.."trap_stone", p.."trap_glass", p.."trap_glow_glass"}, 10}, + {"sch", "trapstonetrap", 0, true}, + {"dro", {p.."all_faces_tree", p.."all_faces_jungle_tree", p.."plankstone"}, 10}, + {"fal", {p.."all_faces_tree", p.."all_faces_tree", p.."all_faces_tree", p.."all_faces_tree", p.."all_faces_tree"}, 0}, + {"dro", {p.."glow_glass", p.."super_glow_glass", p.."clean_glass"}, 10}, + {"nod", "default:chest", 0, { + {name = p.."rope", max = 10}, + {name = p.."sweeper", max = 1}, + {name = p.."circular_saw", max = 1}, + {name = p.."grey_bricks", max = 10}, + {name = p.."tar", max = 3}}}, + {"flo", 3, {"moreblocks:copperpatina"}, 1}, +}) +end + -- Bows mod if minetest.get_modpath("bows") then lucky_block:add_blocks({ diff --git a/init.lua b/init.lua index 3dcf930..7b79c01 100644 --- a/init.lua +++ b/init.lua @@ -523,6 +523,36 @@ local lucky_block = function(pos, digger) end end) + -- floor paint + elseif action == "flo" then + + local size = lucky_list[luck][2] or 1 + local nods = lucky_list[luck][3] or {"default:dirt"} + local offs = lucky_list[luck][4] or 0 + local num = 1 + + for x = 0, size - 1 do + for z = 0, size - 1 do + + minetest.after(0.5 * num, function() + + minetest.set_node({ + x = (pos.x + x) - offs, + y = pos.y - 1, + z = (pos.z + z) - offs + }, {name = nods[math.random(#nods)]}) + + minetest.sound_play("default_place_node", { + pos = pos, + gain = 1.0, + max_hear_distance = 10 + }) + end) + + num = num + 1 + end + end + -- custom function elseif action == "cus" then