diff --git a/README.md b/README.md index d7164b7..52727c6 100644 --- a/README.md +++ b/README.md @@ -28,5 +28,6 @@ Changelog: - 1.3 - Add lightning staff as rare drop, tidy code, lightning fire check, slender potion - 1.4 - Bug fix falling nodes, add worm farm drops - 1.5 - Filled chests can now add tools with custom wear levels, code tidy and tweaks +- 1.6 - Add support for mineclone2 game, tweak and tidy code, add new screenshot Lucky Blocks: 266 (depending on mods enabled) diff --git a/blocks.lua b/blocks.lua deleted file mode 100644 index fc32aac..0000000 --- a/blocks.lua +++ /dev/null @@ -1,1064 +0,0 @@ - --- Load support for intllib. -local MP = minetest.get_modpath(minetest.get_current_modname()) -local S, NS = dofile(MP .. "/intllib.lua") - - --- Default tree schematics -local dpath = minetest.get_modpath("default") .. "/schematics/" - -lucky_block:add_schematics({ - {"appletree", dpath .. "apple_tree_from_sapling.mts", {x = 3, y = 1, z = 3}}, - {"jungletree", dpath .. "jungle_tree_from_sapling.mts", {x = 2, y = 1, z = 2}}, - {"defpinetree", dpath .. "pine_tree_from_sapling.mts", {x = 2, y = 1, z = 2}}, - {"acaciatree", dpath .. "acacia_tree_from_sapling.mts", {x = 4, y = 1, z = 4}}, - {"aspentree", dpath .. "aspen_tree_from_sapling.mts", {x = 2, y = 1, z = 2}}, - {"largecactus", dpath .. "large_cactus.mts", {x = 2, y = 1, z = 2}}, - {"defaultbush", dpath .. "bush.mts", {x = 1, y = 1, z = 1}}, - {"acaciabush", dpath .. "acacia_bush.mts", {x = 1, y = 1, z = 1}}, - {"corals", MP .. "/schematics/corals.mts", {x = 2, y = 1, z = 2}} -}) - - --- Default blocks -lucky_block:add_blocks({ - {"nod", {"default:chest"}, 0}, - {"lig"}, - {"fal", {"default:wood", "default:gravel", "default:sand", - "default:desert_sand", "default:stone", "default:dirt", - "default:goldblock"}, 0}, - {"sch", "watertrap", 1, true}, - {"tel"}, - {"dro", {"default:apple"}, 10}, - {"sch", "appletree", 0, false}, - {"dro", {"default:snow"}, 10}, - {"nod", "default:chest", 0, { - {name = "bucket:bucket_water", max = 1}, - {name = "default:wood", max = 3}, - {name = "default:pick_diamond", max = 1}, - {name = "default:coal_lump", max = 3} - }}, - {"sch", "sandtrap", 1, true}, - {"sch", "defpinetree", 0, false}, - {"sch", "lavatrap", 1, true}, - {"dro", {"default:mese_crystal_fragment"}, 15}, - {"dro", {"default:mese_crystal"}, 10}, - {"dro", {"default:mese"}, 1}, - {"exp", 2}, - {"sch", "acaciabush", 0, false}, - {"nod", "default:diamondblock", 0}, - {"nod", "default:steelblock", 0}, - {"nod", "default:dirt", 0}, - {"nod", "default:chest", 0, { - {name = "default:dirt", max = 15}, - {name = "default:dirt_with_dry_grass", max = 15}, - {name = "default:dirt_with_rainforest_litter", max = 15}, - {name = "default:dirt_with_grass", max = 15}, - {name = "default:dirt_with_snow", max = 15}, - }}, - {"dro", {"dye:"}, 10, true}, - {"dro", {"default:sword_steel"}}, - {"sch", "jungletree", 0, false}, - {"sch", "sandtrap", 1, true, {{"default:sand", "default:silver_sand"}} }, - {"dro", {"default:pick_steel"}}, - {"dro", {"default:shovel_steel"}}, - {"exp"}, - {"dro", {"default:coal_lump"}, 3}, - {"sch", "defaultbush", 0, false}, - {"tro", "default:mese", "tnt_blast", true}, - {"sch", "acaciatree", 0, false}, - {"dro", {"default:axe_steel"}}, - {"dro", {"default:sword_bronze"}}, - {"exp", 3}, - {"nod", "default:chest", 0, { - {name = "default:acacia_sapling", max = 10}, - {name = "default:aspen_sapling", max = 10}, - {name = "default:pine_sapling", max = 10}, - {name = "default:sapling", max = 10}, - {name = "default:junglesapling", max = 10}, - {name = "default:acacia_bush_sapling", max = 5}, - {name = "default:bush_sapling", max = 5}, - }}, - {"sch", "platform", 1, true}, - {"nod", "default:wood", 0}, - {"dro", {"default:pick_bronze"}}, - {"sch", "aspentree", 0, false}, - {"dro", {"default:shovel_bronze"}}, - {"nod", "default:gravel", 0}, - {"sch", "sandtrap", 1, true, {{"default:sand", "default:gravel"}} }, - {"sch", "largecactus", 0, false}, - {"dro", {"default:axe_bronze"}}, - {"dro", {"default:bookshelf", "default:book", "default:paper"}, 5}, - {"dro", {"default:fence_wood"}, 10}, - {"dro", {"default:fence_acacia_wood"}, 10}, - {"dro", {"default:fence_aspen_wood"}, 10}, - {"dro", {"default:fence_junglewood"}, 10}, - {"dro", {"default:fence_pine_wood"}, 10}, - {"sch", "obsidiantrap", 1, true}, - {"sch", "sandtrap", 1, true, {{"default:sand", "default:desert_sand"}} }, - {"nod", "default:chest", 0, { - {name = "default:acacia_wood", max = 10}, - {name = "default:aspen_wood", max = 10}, - {name = "default:pine_wood", max = 10}, - {name = "default:wood", max = 10}, - {name = "default:junglewood", max = 10}, - }}, - {"nod", "default:chest", 0, { - {name = "default:acacia_tree", max = 10}, - {name = "default:aspen_tree", max = 10}, - {name = "default:pine_tree", max = 10}, - {name = "default:tree", max = 10}, - {name = "default:jungletree", max = 10}, - }}, - {"dro", {"default:coral_brown"}, 5}, - {"dro", {"default:coral_orange"}, 5}, - {"dro", {"default:coral_skeleton"}, 5}, - {"sch", "corals", 0, true}, - {"dro", {"default:mese_post_light"}, 5}, - {"dro", {"default:fence_wood"}, 5}, - {"nod", "default:mese_post_light"}, - {"dro", {"default:silver_sand"}, 20}, - {"dro", {"default:sand"}, 20}, - {"dro", {"default:desert_sand"}, 20}, - {"dro", {"default:gravel"}, 15}, - {"nod", "default:chest", 0, { - {name = "default:silver_sand", max = 20}, - {name = "default:silver_sandstone", max = 20}, - {name = "default:desert_sand", max = 20}, - {name = "default:silver_sandstone", max = 20}, - {name = "default:sand", max = 20}, - {name = "default:sandstone", max = 20}, - {name = "default:gravel", max = 20}, - }}, - {"dro", {"default:obsidian"}, 14} -}) - -local green = minetest.get_color_escape_sequence("#1eff00") - --- custom function (punches player with 5 damage) -local function punchy(pos, player) - - player:punch(player, 1.0, { - full_punch_interval = 1.0, - damage_groups = {fleshy = 5} - }, nil) - - minetest.sound_play("player_damage", {pos = pos, gain = 1.0}, true) - - minetest.chat_send_player(player:get_player_name(), - green .. S("Stop hitting yourself!")) -end - --- custom function (pint sized player) and potion with recipe -local function pint(pos, player) - - player:set_properties({ - visual_size = {x = 0.5, y = 0.5}, - collisionbox = {-0.15, 0.0, -0.15, 0.15, .85, 0.15}, - eye_height = 0.73, - stepheight = 0.3 - }) - - minetest.chat_send_player(player:get_player_name(), - green .. S("Pint Sized Player!")) - - minetest.sound_play("default_place_node", {pos = pos, gain = 1.0}, true) - - minetest.after (180, function(player, pos) -- 3 minutes - - if player and player:is_player() then - - player:set_properties({ - visual_size = {x = 1.0, y = 1.0}, - collisionbox = {-0.3, 0.0, -0.3, 0.3, 1.7, 0.3}, - eye_height = 1.47, - stepheight = 0.6 - }) - - minetest.sound_play("default_place_node", - {pos = player:get_pos(), gain = 1.0}, true) - end - end, player) -end - --- pint sized potion item -minetest.register_craftitem("lucky_block:pint_sized_potion", { - description = S("Pint Sized Potion (DRINK ME)"), - inventory_image = "lucky_pint_sized_potion.png", - groups = {vessel = 1}, - on_use = function(itemstack, user, pointed_thing) - - itemstack:take_item() - - local pos = user:get_pos() - local inv = user:get_inventory() - local item = "vessels:glass_bottle" - - if inv:room_for_item("main", {name = item}) then - inv:add_item("main", item) - else - minetest.add_item(pos, {name = item}) - end - - pint(pos, user) - - return itemstack - end -}) - --- pint sized potion recipe -minetest.register_craft({ - output = "lucky_block:pint_sized_potion", - recipe = { - {"default:bush_sapling", "flowers:tulip", "default:acacia_bush_sapling"}, - {"dye:blue", "default:apple", "dye:cyan"}, - {"", "vessels:glass_bottle", ""} - } -}) - --- custom function (slender player) and potion with recipe -local function slender(pos, player) - - player:set_properties({ - visual_size = {x = 1.0, y = 1.5}, - collisionbox = {-0.3, 0.0, -0.3, 0.3, 1.7 + .85, 0.3}, - eye_height = 1.47 + 0.73, - stepheight = 0.9 - }) - - minetest.chat_send_player(player:get_player_name(), - green .. S("Slender Player!")) - - minetest.sound_play("default_place_node", {pos = pos, gain = 1.0}, true) - - minetest.after (180, function(player, pos) -- 3 minutes - - if player and player:is_player() then - - player:set_properties({ - visual_size = {x = 1.0, y = 1.0}, - collisionbox = {-0.3, 0.0, -0.3, 0.3, 1.7, 0.3}, - eye_height = 1.47, - stepheight = 0.6 - }) - - minetest.sound_play("default_place_node", - {pos = player:get_pos(), gain = 1.0}, true) - end - end, player) -end - --- slender player potion item -minetest.register_craftitem("lucky_block:slender_player_potion", { - description = S("Slender Player Potion (DRINK ME)"), - inventory_image = "lucky_slender_potion.png", - groups = {vessel = 1}, - on_use = function(itemstack, user, pointed_thing) - - itemstack:take_item() - - local pos = user:get_pos() - local inv = user:get_inventory() - local item = "vessels:glass_bottle" - - if inv:room_for_item("main", {name = item}) then - inv:add_item("main", item) - else - minetest.add_item(pos, {name = item}) - end - - slender(pos, user) - - return itemstack - end -}) - --- slender player potion recipe -minetest.register_craft({ - output = "lucky_block:slender_player_potion", - recipe = { - {"default:bush_sapling", "flowers:rose", "default:pine_bush_sapling"}, - {"dye:red", "default:apple", "dye:orange"}, - {"", "vessels:glass_bottle", ""} - } -}) - --- custom function (drop player inventory and replace with items and show msg) -local function dropsy(pos, player, def) - - local player_inv = player:get_inventory() - - pos = player:get_pos() or pos - - for i = 1, player_inv:get_size("main") do - - local obj = minetest.add_item(pos, player_inv:get_stack("main", i)) - - if obj then - - obj:set_velocity({ - x = math.random(-10, 10) / 9, - y = 5, - z = math.random(-10, 10) / 9 - }) - end - - player_inv:set_stack("main", i, def.item) - end - - minetest.chat_send_player(player:get_player_name(), green .. S(def.msg)) -end - --- lightning staff -minetest.register_tool("lucky_block:lightning_staff", { - description = S("Lightning Staff"), - inventory_image = "lucky_lightning_staff.png", - range = 10, - groups = {not_in_creative_inventory = 1}, - - on_use = function(itemstack, user, pointed_thing) - - local pos = user:get_pos() - - if pointed_thing.type == "object" then - pos = pointed_thing.ref:get_pos() - elseif pointed_thing.type == "node" then - pos = pointed_thing.above - end - - if not pos then return end - - local bnod = pos and minetest.get_node_or_nil(pos) - local bref = bnod and minetest.registered_items[bnod.name] - - if bref and bref.buildable_to == true then - minetest.set_node(pos, {name = "fire:basic_flame"}) - end - - local radius = 4 - local objs = minetest.get_objects_inside_radius(pos, radius) - local obj_pos, dist - - -- add temp entity to cause damage - local tmp_ent = minetest.add_entity(pos, "lucky_block:temp") - - for n = 1, #objs do - - obj_pos = objs[n]:get_pos() - - dist = vector.distance(pos, obj_pos) - - if dist < 1 then dist = 1 end - - local damage = math.floor((4 / dist) * radius) - local ent = objs[n]:get_luaentity() - - -- if you blast yourself then delay hurt for bones mod if dead - if objs[n] == user then - - minetest.after(0.1, function() - objs[n]:punch(tmp_ent, 1.0, { - full_punch_interval = 1.0, - damage_groups = {fleshy = damage, fire = 1} - }, pos) - end) - else - objs[n]:punch(tmp_ent, 1.0, { - full_punch_interval = 1.0, - damage_groups = {fleshy = damage, fire = 1} - }, pos) - end - end - - minetest.add_particle({ - pos = {x = pos.x, y = pos.y + 4, z = pos.z}, - velocity = {x = 0, y = 0, z = 0}, - acceleration = {x = 0, y = 0, z = 0}, - expirationtime = 1.0, - collisiondetection = false, - texture = "lucky_lightning.png", - size = 100, - glow = 15 - }) - - minetest.sound_play("lightning", { - pos = pos, gain = 1.0, max_hear_distance = 25}, true) - - itemstack:add_wear(65535 / 50) -- 50 uses - - return itemstack - end -}) - -lucky_block:add_blocks({ - {"cus", pint}, - {"cus", dropsy, {item = "default:dry_shrub", msg = "Dry shrub takeover!"}}, - {"cus", punchy}, - {"cus", slender}, - {"dro", {"lucky_block:pint_sized_potion"}, 1}, - {"dro", {"lucky_block:slender_player_potion"}, 1}, - {"nod", "default:chest", 0, { - {name = "default:stick", max = 10}, - {name = "default:acacia_bush_stem", max = 10}, - {name = "default:bush_stem", max = 10}, - {name = "default:pine_bush_stem", max = 10}, - {name = "default:grass_1", max = 10}, - {name = "default:dry_grass_1", max = 10}, - {name = "lucky_block:lightning_staff", max = 1, chance = 10} - }} -}) - --- wool mod -if minetest.get_modpath("wool") then - - lucky_block:add_blocks({ - {"sch", "sandtrap", 1, true, {{"default:sand", "wool:red"}} }, - {"dro", {"wool:"}, 10, true}, - {"sch", "sandtrap", 1, true, {{"default:sand", "wool:green"}} }, - {"dro", {"wool:white"}, 10} - }) -end - --- extra doors mod -if minetest.get_modpath("extra_doors") then - - lucky_block:add_blocks({ - {"dro", {"default:steel_rod"}, 10}, - {"dro", {"extra_doors:door_woodpanel1"}, 1}, - {"dro", {"extra_doors:door_woodglass1"}, 1}, - {"dro", {"extra_doors:door_woodglass2"}, 1}, - {"dro", {"extra_doors:door_door_japanese"}, 1}, - {"dro", {"extra_doors:door_door_french"}, 1}, - {"dro", {"extra_doors:door_door_cottage1"}, 1}, - {"dro", {"extra_doors:door_door_cottage2"}, 1}, - {"dro", {"extra_doors:door_door_barn1"}, 1}, - {"lig"}, - {"dro", {"extra_doors:door_door_barn2"}, 1}, - {"dro", {"extra_doors:door_door_castle1"}, 1}, - {"dro", {"extra_doors:door_door_castle2"}, 1}, - {"dro", {"extra_doors:door_door_mansion1"}, 1}, - {"dro", {"extra_doors:door_door_mansion2"}, 1}, - {"dro", {"extra_doors:door_door_dungeon1"}, 1}, - {"dro", {"extra_doors:door_door_dungeon2"}, 1}, - {"dro", {"extra_doors:door_door_steelpanel1"}, 1}, - {"dro", {"extra_doors:door_door_steelglass1"}, 1}, - {"dro", {"extra_doors:door_door_steelglass2"}, 1} - }) -end - --- Flowers mod -if minetest.get_modpath("flowers") then - - lucky_block:add_blocks({ - {"nod", "flowers:rose", 0}, - {"dro", {"flowers:mushroom_red"}, 5}, - {"dro", {"flowers:mushroom_brown"}, 5}, - {"dro", {"flowers:rose", "flowers:tulip", "flowers:dandelion_yellow", - "flowers:geranium", "flowers:viola", "flowers:dandelion_white"}, 12}, - {"nod", "default:chest", 0, { - {name = "flowers:geranium", max = 15}, - {name = "flowers:viola", max = 15}, - {name = "flowers:dandelion_white", max = 15}, - {name = "flowers:dandelion_yellow", max = 15}, - {name = "flowers:tulip", max = 15}, - {name = "flowers:rose", max = 15}, - {name = "flowers:mushroom_brown", max = 10}, - {name = "flowers:mushroom_red", max = 10}, - {name = "flowers:waterlily", max = 10} - }} - }) -end - --- Doors mod -if minetest.get_modpath("doors") then - - lucky_block:add_blocks({ - {"dro", {"doors:door_wood"}}, - {"dro", {"doors:door_steel"}}, - {"dro", {"doors:door_glass"}}, - {"dro", {"doors:door_obsidian_glass"}}, - {"dro", {"doors:trapdoor"}}, - {"dro", {"doors:trapdoor_steel"}}, - {"dro", {"doors:gate_acacia_wood_closed"}}, - {"dro", {"doors:gate_aspen_wood_closed"}}, - {"dro", {"doors:gate_wood_closed"}}, - {"dro", {"doors:gate_pine_wood_closed"}}, - {"dro", {"doors:gate_junglewood_closed"}} - }) -end - --- Screwdriver mod -if minetest.get_modpath("screwdriver") then - - if screwdriver and screwdriver.handler then - - minetest.register_tool(":screwdriver:screwdriver_magenta", { - description = S("Super Mega Magenta Ultra Screwdriver 2500" - .. "\n(left-click to rotate face, right-click to rotates axis)"), - inventory_image = "screwdriver.png^[colorize:#ff009970", - groups = {not_in_creative_inventory = 1}, - - on_use = function(itemstack, user, pointed_thing) - screwdriver.handler(itemstack, user, pointed_thing, - screwdriver.ROTATE_FACE, 2500) - return itemstack - end, - - on_place = function(itemstack, user, pointed_thing) - screwdriver.handler(itemstack, user, pointed_thing, - screwdriver.ROTATE_AXIS, 2500) - return itemstack - end - }) - end - - lucky_block:add_blocks({ - {"dro", {"screwdriver:screwdriver"}}, - {"dro", {"screwdriver:screwdriver_magenta"}}, - }) -end - --- Vessels mod -if minetest.get_modpath("vessels") then - - lucky_block:add_blocks({ - {"dro", {"vessels:shelf", "vessels:drinking_glass", "vessels:glass_bottle", - "vessels:steel_bottle", "vessels:glass_fragments"}, 5}, - {"nod", "vessels:drinking_glass", 0}, - {"nod", "vessels:glass_bottle", 0}, - {"nod", "vessels:steel_bottle", 0} - }) -end - --- Farming mod (default) -if minetest.get_modpath("farming") then - - lucky_block:add_blocks({ - {"dro", {"farming:bread"}, 5}, - {"sch", "instafarm", 0, true}, - {"nod", "default:water_source", 1}, - {"nod", "farming:straw", 0}, - {"dro", {"farming:straw"}, 8} - }) -end - --- Home Decor mod -if minetest.get_modpath("homedecor") then - - lucky_block:add_blocks({ - {"nod", "homedecor:toilet", 0}, - {"nod", "homedecor:table", 0}, - {"nod", "homedecor:chair", 0}, - {"nod", "homedecor:table_lamp_off", 0}, - {"dro", {"homedecor:plastic_sheeting", "homedecor:plastic_base"}, 15}, - {"dro", {"homedecor:roof_tile_terracotta"}, 20}, - {"dro", {"homedecor:shutter_oak"}, 5}, - {"dro", {"homedecor:shutter_black"}, 5}, - {"dro", {"homedecor:shutter_dark_grey"}, 5}, - {"dro", {"homedecor:shutter_grey"}, 5}, - {"dro", {"homedecor:shutter_white"}, 5}, - {"dro", {"homedecor:shutter_mahogany"}, 5}, - {"dro", {"homedecor:shutter_yellow"}, 5}, - {"dro", {"homedecor:shutter_forest_green"}, 5}, - {"dro", {"homedecor:shutter_light_blue"}, 5}, - {"dro", {"homedecor:shutter_violet"}, 5}, - {"dro", {"homedecor:table_legs_wrought_iron", "homedecor:utility_table_legs"}, 5}, - {"dro", {"homedecor:pole_wrought_iron"}, 10}, - {"dro", {"homedecor:fence_picket_white"}, 20} - }) -end - --- Boats mod -if minetest.get_modpath("boats") then - - lucky_block:add_blocks({ - {"dro", {"boats:boat"}} - }) -end - --- Beds mod -if minetest.get_modpath("beds") then - - lucky_block:add_blocks({ - {"dro", {"beds:bed"}}, - {"dro", {"beds:fancy_bed"}} - }) -end - --- Walls mod -if minetest.get_modpath("walls") then - - lucky_block:add_blocks({ - {"dro", {"walls:cobble"}, 10}, - {"dro", {"walls:mossycobble"}, 10}, - {"dro", {"walls:desertcobble"}, 10} - }) -end - --- Carts mod -if minetest.get_modpath("carts") -or minetest.get_modpath("boost_cart") then - - lucky_block:add_blocks({ - {"dro", {"carts:cart"}}, - {"dro", {"default:rail"}, 10}, - {"dro", {"carts:powerrail"}, 5}, - {"dro", {"carts:brakerail"}, 5} - }) -end - --- 3D Armor mod -if minetest.get_modpath("3d_armor") then - - lucky_block:add_blocks({ - {"dro", {"3d_armor:boots_wood"}}, - {"dro", {"3d_armor:leggings_wood"}}, - {"dro", {"3d_armor:chestplate_wood"}}, - {"dro", {"3d_armor:helmet_wood"}}, - {"tel"}, - {"dro", {"3d_armor:boots_steel"}}, - {"dro", {"3d_armor:leggings_steel"}}, - {"dro", {"3d_armor:chestplate_steel"}}, - {"dro", {"3d_armor:helmet_steel"}}, - {"dro", {"3d_armor:boots_gold"}}, - {"dro", {"3d_armor:leggings_gold"}}, - {"dro", {"3d_armor:chestplate_gold"}}, - {"exp"}, - {"dro", {"3d_armor:helmet_gold"}}, - {"dro", {"3d_armor:boots_cactus"}}, - {"dro", {"3d_armor:leggings_cactus"}}, - {"dro", {"3d_armor:chestplate_cactus"}}, - {"dro", {"3d_armor:helmet_cactus"}}, - {"dro", {"3d_armor:boots_bronze"}}, - {"dro", {"3d_armor:leggings_bronze"}}, - {"dro", {"3d_armor:chestplate_bronze"}}, - {"dro", {"3d_armor:helmet_bronze"}}, - {"lig"} - }) -end - --- 3D Armor's Shields mod -if minetest.get_modpath("shields") then - - lucky_block:add_blocks({ - {"dro", {"shields:shield_wood"}}, - {"dro", {"shields:shield_steel"}}, - {"dro", {"shields:shield_gold"}}, - {"dro", {"shields:shield_cactus"}}, - {"dro", {"shields:shield_bronze"}}, - {"exp", 2} - }) -end - --- Fire mod -if minetest.get_modpath("fire") then - - lucky_block:add_blocks({ - {"dro", {"fire:flint_and_steel"}}, - {"dro", {"default:flint"}, 5}, - {"nod", "fire:basic_flame", 1}, - {"nod", "fire:permanent_flame", 1}, - {"sch", "firetrap", 1, true}, - }) -end - --- Caverealms -if minetest.get_modpath("caverealms") then - - lucky_block:add_blocks({ - {"sch", "sandtrap", 1, true, {{"default:sand", "caverealms:coal_dust"}} }, - {"sch", "obsidiantrap", 1, true, {{"default:obsidian", - "caverealms:glow_obsidian_brick_2"}} }, - {"flo", 5, {"caverealms:stone_with_moss"}, 2}, - {"flo", 5, {"caverealms:stone_with_lichen"}, 2}, - {"flo", 5, {"caverealms:stone_with_algae"}, 2}, - }) -end - --- TNT mod -if minetest.get_modpath("tnt") then - - local p = "tnt:tnt_burning" - - lucky_block:add_blocks({ - {"dro", {"tnt:gunpowder"}, 5}, - {"fal", {p, p, p, p, p}, 1, true, 4}, - {"nod", "tnt:tnt_burning", 0} - }) -end - --- More Ore's mod -if minetest.get_modpath("moreores") then - - lucky_block:add_blocks({ - {"nod", "moreores:tin_block", 0}, - {"nod", "moreores:silver_block", 0}, - {"fal", {"default:sand", "default:sand", "default:sand", "default:sand", - "default:sand", "default:sand", "moreores:mithril_block"}, 0}, - {"dro", {"moreores:pick_silver"}}, - {"dro", {"moreores:pick_mithril"}}, - {"tro", "moreores:silver_block"}, - {"dro", {"moreores:shovel_silver"}}, - {"dro", {"moreores:shovel_mithril"}}, - {"dro", {"moreores:axe_silver"}}, - {"dro", {"moreores:axe_mithril"}}, - {"tro", "moreores:mithril_block"}, - {"dro", {"moreores:hoe_silver"}}, - {"dro", {"moreores:hoe_mithril"}}, - {"lig"}, - {"nod", "default:chest", 0, { - {name = "moreores:silver_lump", max = 10}, - {name = "moreores:mithril_lump", max = 10}, - {name = "default:copper_lump", max = 10}, - {name = "default:gold_lump", max = 10}, - {name = "default:iron_lump", max = 10}, - {name = "default:tin_lump", max = 10}, - {name = "default:coal_lump", max = 10}, - {name = "default:clay_lump", max = 10} - }} - }) - - if minetest.get_modpath("3d_armor") then - - lucky_block:add_blocks({ - {"dro", {"3d_armor:helmet_mithril"}}, - {"dro", {"3d_armor:chestplate_mithril"}}, - {"dro", {"3d_armor:leggings_mithril"}}, - {"dro", {"3d_armor:boots_mithril"}} - }) - end - - if minetest.get_modpath("shields") then - - lucky_block:add_blocks({ - {"dro", {"shields:shield_mithril"}} - }) - 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"}, 10}, - {"dro", {p.."wood_tile_center"}, 10}, - {"dro", {p.."wood_tile_full"}, 10}, - {"dro", {p.."wood_tile_offset"}, 10}, - {"dro", {p.."circle_stone_bricks"}, 20}, - {"dro", {p.."grey_bricks"}, 20}, - {"dro", {p.."stone_tile"}, 10}, - {"dro", {p.."split_stone_tile"}, 10}, - {"dro", {p.."split_stone_tile_alt"}, 10}, - {"flo", 5, {"moreblocks:stone_tile", "moreblocks:split_stone_tile"}, 2}, - {"dro", {p.."tar", p.."cobble_compressed"}, 10}, - {"dro", {p.."cactus_brick"}, 10}, - {"dro", {p.."cactus_checker"}, 10}, - {"nod", {p.."empty_bookshelf"}, 0}, - {"dro", {p.."coal_stone"}, 10}, - {"dro", {p.."coal_checker"}, 10}, - {"dro", {p.."coal_stone_bricks"}, 10}, - {"dro", {p.."coal_glass"}, 10}, - {"exp", 3}, - {"dro", {p.."iron_stone"}, 10}, - {"dro", {p.."iron_checker"}, 10}, - {"dro", {p.."iron_stone_bricks"}, 10}, - {"dro", {p.."iron_glass"}, 10}, - {"dro", {p.."trap_obsidian"}, 10}, - {"dro", {p.."trap_sandstone"}, 10}, - {"dro", {p.."trap_desert_stone"}, 10}, - {"dro", {p.."trap_stone"}, 10}, - {"dro", {p.."trap_glass"}, 10}, - {"dro", {p.."trap_glow_glass"}, 10}, - {"dro", {p.."trap_obsidian_glass"}, 10}, - {"lig"}, - {"sch", "trapstonetrap", 0, true}, - {"dro", {p.."all_faces_tree"}, 10}, - {"dro", {p.."all_faces_jungle_tree"}, 10}, - {"dro", {p.."all_faces_pine_tree"}, 10}, - {"dro", {p.."all_faces_acacia_tree"}, 10}, - {"dro", {p.."all_faces_aspen_tree"}, 10}, - {"flo", 3, {p.."all_faces_acacia_tree"}, 1}, - {"dro", {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"}, 10}, - {"dro", {p.."super_glow_glass"}, 10}, - {"dro", {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 - --- Bags mod -if minetest.get_modpath("bags") or minetest.get_modpath("sfinv_bags") then - - minetest.register_craftitem(":bags:spar", { - description = "Spar Bag", - inventory_image = "bags_spar.png", - groups = {bagslots = 2, flammable = 2} - }) - - lucky_block:add_blocks({ - {"dro", {"bags:spar"}}, - {"dro", {"bags:small"}}, - {"dro", {"bags:medium"}}, - {"dro", {"bags:large"}}, - {"dro", {"bags:trolley"}} - }) -end - --- Nether Mod -if minetest.get_modpath("nether") then - - local p = "nether:" - - -- add well blocks - lucky_block.wellblocks[#lucky_block.wellblocks + 1] = {p.."glowstone", 4} - lucky_block.wellblocks[#lucky_block.wellblocks + 1] = {p.."glowstone_deep", 4} - - -- add lucky blocks - lucky_block:add_blocks({ - {"flo", 3, {"nether:rack", "nether:brick", "nether:brick_cracked"}, 1}, - {"flo", 3, {"nether:rack_deep", "nether:brick_deep"}, 1}, - {"flo", 3, {"nether:basalt", "nether:basalt_hewn", "nether:basalt_chiselled"}, 1}, - {"nod", "nether:glowstone", 0}, - {"nod", "nether:glowstone_deep", 0}, - {"exp", 3}, - {"fal", {p.."sand", p.."sand", p.."sand", p.."sand", p.."sand", p.."glowstone"}, 0}, - {"nod", "nether:lava_crust", 1}, - {"nod", "default:chest", 0, { - {name = p.."fence_nether_brick", max = 5}, - {name = p.."rack_wall", max = 5}, - {name = p.."rack", max = 5}, - {name = p.."axe_nether", max = 1}, - {name = p.."sword_nether", max = 1}, - {name = p.."nether_lump", max = 3} - }}, - {"exp", 2}, - {"sch", "wishingwell", 0, true, { - {"default:stonebrick", p.."brick"}, - {"stairs:slab_stonebrick", "stairs:slab_nether_brick"}, - {"default:fence_wood", p.."fence_nether_brick"}, - {"default:steelblock", p.."basalt_chiselled"}, - {"default:water_source", "default:lava_source"}, - {"default:glass", "default:obsidian_glass"} - }}, - {"lig"}, - {"sch", "platform", 1, true, { - {"default:sandstonebrick", p.."brick_deep"}, - {"default:sandstone", p.."rack_deep"}, - {"lucky_block:lucky_block", "lucky_block:super_lucky_block"} - }}, - {"nod", "default:chest", 0, { - {name = p.."rack_deep_wall", max = 5}, - {name = p.."rack_deep", max = 5}, - {name = p.."pick_nether", max = 1}, - {name = p.."shovel_nether", max = 1}, - {name = p.."nether_lump", max = 3} - }}, - }) - - if minetest.get_modpath("3d_armor") then - - lucky_block:add_blocks({ - {"dro", {"3d_armor:helmet_nether"}}, - {"dro", {"3d_armor:chestplate_nether"}}, - {"dro", {"3d_armor:leggings_nether"}}, - {"dro", {"3d_armor:boots_nether"}} - }) - end - - if minetest.get_modpath("shields") then - - lucky_block:add_blocks({ - {"dro", {"shields:shield_nether"}} - }) - end - - if minetest.get_modpath("xpanes") and minetest.registered_nodes["nether:geode"] then - - lucky_block:add_blocks({ - {"dro", {"xpanes:nether_crystal_pane_flat"}, 5}, - {"nod", "nether_geode", 0}, - {"dro", {"nether_geode"}, 3} - }) - end -end - --- worm farm mod -if minetest.get_modpath("worm_farm") then - - lucky_block:add_blocks({ - {"nod", "default:chest", 0, { - {name = "ethereal:worm", max = 5}, - {name = "worm_farm:worm_tea", max = 5}, - {name = "ethereal:worm", max = 5}, - {name = "worm_farm:worm_farm", max = 1} - }}, - {"cus", dropsy, {item = "ethereal:worm", msg = "Worm Attack!"}}, - {"dro", {"worm_farm:worm_farm"}, 1} - }) -end - - --- Additional Wishing Well Styles -lucky_block:add_blocks({ - {"sch", "wishingwell", 0, true}, - {"sch", "wishingwell", 0, true, { - {"default:stonebrick", "default:silver_sandstone_brick"}, - {"stairs:slab_stonebrick", "stairs:slab_silver_sandstone_brick"}, - {"default:fence_wood", "default:fence_aspen_wood"}, - {"default:steelblock", "default:tinblock"}, - } }, - {"sch", "wishingwell", 0, true, { - {"default:stonebrick", "default:sandstonebrick"}, - {"stairs:slab_stonebrick", "stairs:slab_sandstonebrick"}, - {"default:fence_wood", "default:fence_junglewood"}, - {"default:steelblock", "default:goldblock"}, - } }, - {"sch", "wishingwell", 0, true, { - {"default:stonebrick", "default:desert_stonebrick"}, - {"stairs:slab_stonebrick", "stairs:slab_desert_stonebrick"}, - {"default:fence_wood", "default:fence_acacia_wood"}, - {"default:steelblock", "default:copperblock"}, - } }, - {"sch", "wishingwell", 0, true, { - {"default:stonebrick", "default:desert_sandstone_brick"}, - {"stairs:slab_stonebrick", "stairs:slab_desert_sandstone_brick"}, - {"default:fence_wood", "default:fence_pine_wood"}, - {"default:steelblock", "default:bronzeblock"}, - } }, -}) - --- Special items -minetest.register_node("lucky_block:void_mirror", { - description = S("Void Mirror (Place to see through solid walls during daytime)"), - drawtype = "normal", - tiles = {"default_obsidian_glass.png^[brighten"}, - use_texture_alpha = "clip", - groups = {snappy = 3, not_in_creative_inventory = 1}, - sounds = default.node_sound_glass_defaults() -}) - -lucky_block:add_blocks({ - {"dro", {"lucky_block:void_mirror"}} -}) - --- Troll -local green = minetest.get_color_escape_sequence("#1eff00") - -local function fake_items(pos, player, def) - - for n = 1, 25 do - - minetest.add_particle({ - time = 15, - pos = { - x = pos.x + math.random(-20, 20) / 10, - y = pos.y, - z = pos.z + math.random(-20, 20) / 10 - }, - velocity = {x = 0, y = 2, z = 0}, - acceleration = {x = 0, y = -10, z = 0}, - expirationtime = 4, - maxsize = 4, - texture = def.tex, - glow = 2, - size = 5, - collisiondetection = true, - vertical = true - }) - end - - minetest.chat_send_player(player:get_player_name(), - green .. S("Wow! So many faux " .. def.txt .. "!")) -end - -lucky_block:add_blocks({ - {"cus", fake_items, {tex = "default_diamond.png", txt = "diamonds"} }, - {"cus", fake_items, {tex = "default_gold_ingot.png", txt = "ingots"} }, - {"cus", fake_items, {tex = "default_mese_crystal.png", txt = "crystals"} } -}) - --- Void Pick -local old_handle_node_drops = minetest.handle_node_drops - -function minetest.handle_node_drops(pos, drops, digger) - - -- are we holding Crystal Shovel? - if not digger - or digger:get_wielded_item():get_name() ~= "lucky_block:pick_void" then - return old_handle_node_drops(pos, drops, digger) - end - - local nn = minetest.get_node(pos).name - - if nn == "default:furnace_active" - or nn:find("xpanes:") - or nn:find("door") - or minetest.get_item_group(nn, "cracky") == 0 then - return old_handle_node_drops(pos, drops, digger) - end - - return old_handle_node_drops(pos, {ItemStack(nn)}, digger) -end - - -minetest.register_tool("lucky_block:pick_void", { - description = "Void pick (Soft Touch)", - inventory_image = "lucky_void_pick.png", - wield_image = "lucky_void_pick.png^[transformR90", - tool_capabilities = { - full_punch_interval = 1.2, - max_drop_level = 3, - groupcaps = { - cracky = { - times = {[1] = 2.4, [2] = 1.2, [3] = 0.60}, - uses = 20, - maxlevel = 3 - } - }, - damage_groups = {fleshy = 5}, - }, - groups = {pickaxe = 1, not_in_creative_inventory = 1}, - sound = {breaks = "default_tool_breaks"} -}) - -lucky_block:add_blocks({ - {"nod", "default:chest", 0, { - {name = "lucky_block:pick_void", max = 1, chance = 7}, - {name = "default:stone_with_coal", max = 5}, - {name = "default:stone_with_iron", max = 5}, - {name = "default:stone_with_copper", max = 5}, - {name = "default:stone_with_mese", max = 5}, - {name = "default:stone_with_gold", max = 5}, - {name = "default:stone_with_diamond", max = 5} - }} -}) diff --git a/blocks_def.lua b/blocks_def.lua new file mode 100644 index 0000000..c11e1d6 --- /dev/null +++ b/blocks_def.lua @@ -0,0 +1,534 @@ + +local S = lucky_block.intllib +local MP = minetest.get_modpath("lucky_block") + +-- default mod +if lucky_block.def_mod then + + -- chest items + lucky_block:add_chest_items({ + {name = "default:wood", max = 5}, + {name = "default:apple", max = 3}, + {name = "default:steel_ingot", max = 3}, + {name = "default:gold_ingot", max = 3, chance = 2}, + {name = "default:diamond", max = 2, chance = 3}, + {name = "default:mese_crystal_fragment", max = 3, chance = 3}, + {name = "default:pick_steel", max = 1, chance = 2, min_wear = 20000, max_wear = 65536} + }) + + local dpath = minetest.get_modpath("default") .. "/schematics/" + + -- Default tree schematics + lucky_block:add_schematics({ + {"appletree", dpath .. "apple_tree_from_sapling.mts", {x = 3, y = 1, z = 3}}, + {"jungletree", dpath .. "jungle_tree_from_sapling.mts", {x = 2, y = 1, z = 2}}, + {"defpinetree", dpath .. "pine_tree_from_sapling.mts", {x = 2, y = 1, z = 2}}, + {"acaciatree", dpath .. "acacia_tree_from_sapling.mts", {x = 4, y = 1, z = 4}}, + {"aspentree", dpath .. "aspen_tree_from_sapling.mts", {x = 2, y = 1, z = 2}}, + {"largecactus", dpath .. "large_cactus.mts", {x = 2, y = 1, z = 2}}, + {"defaultbush", dpath .. "bush.mts", {x = 1, y = 1, z = 1}}, + {"acaciabush", dpath .. "acacia_bush.mts", {x = 1, y = 1, z = 1}}, + {"corals", MP .. "/schematics/corals.mts", {x = 2, y = 1, z = 2}} + }) + + -- Default lucky blocks + lucky_block:add_blocks({ + {"nod", {"default:chest"}, 0}, + {"lig"}, + {"fal", {"default:wood", "default:gravel", "default:sand", + "default:desert_sand", "default:stone", "default:dirt", + "default:goldblock"}, 0}, + {"sch", "watertrap", 1, true}, + {"tel"}, + {"dro", {"default:apple"}, 10}, + {"sch", "appletree", 0, false}, + {"dro", {"default:snow"}, 10}, + {"nod", "default:chest", 0, { + {name = "bucket:bucket_water", max = 1}, + {name = "default:wood", max = 3}, + {name = "default:pick_diamond", max = 1}, + {name = "default:coal_lump", max = 3} + }}, + {"sch", "sandtrap", 1, true}, + {"sch", "defpinetree", 0, false}, + {"sch", "lavatrap", 1, true}, + {"dro", {"default:mese_crystal_fragment"}, 15}, + {"dro", {"default:mese_crystal"}, 10}, + {"dro", {"default:mese"}, 1}, + {"exp", 2}, + {"sch", "acaciabush", 0, false}, + {"nod", "default:diamondblock", 0}, + {"nod", "default:steelblock", 0}, + {"nod", "default:dirt", 0}, + {"nod", "default:chest", 0, { + {name = "default:dirt", max = 15}, + {name = "default:dirt_with_dry_grass", max = 15}, + {name = "default:dirt_with_rainforest_litter", max = 15}, + {name = "default:dirt_with_grass", max = 15}, + {name = "default:dirt_with_snow", max = 15}, + }}, + {"dro", {"dye:"}, 10, true}, + {"dro", {"default:sword_steel"}}, + {"sch", "jungletree", 0, false}, + {"sch", "sandtrap", 1, true, {{"default:sand", "default:silver_sand"}} }, + {"dro", {"default:pick_steel"}}, + {"dro", {"default:shovel_steel"}}, + {"exp"}, + {"dro", {"default:coal_lump"}, 3}, + {"sch", "defaultbush", 0, false}, + {"tro", "default:mese", "tnt_blast", true}, + {"sch", "acaciatree", 0, false}, + {"dro", {"default:axe_steel"}}, + {"dro", {"default:sword_bronze"}}, + {"exp", 3}, + {"nod", "default:chest", 0, { + {name = "default:acacia_sapling", max = 10}, + {name = "default:aspen_sapling", max = 10}, + {name = "default:pine_sapling", max = 10}, + {name = "default:sapling", max = 10}, + {name = "default:junglesapling", max = 10}, + {name = "default:acacia_bush_sapling", max = 5}, + {name = "default:bush_sapling", max = 5}, + }}, + {"sch", "platform", 1, true}, + {"nod", "default:wood", 0}, + {"dro", {"default:pick_bronze"}}, + {"sch", "aspentree", 0, false}, + {"dro", {"default:shovel_bronze"}}, + {"nod", "default:gravel", 0}, + {"sch", "sandtrap", 1, true, {{"default:sand", "default:gravel"}} }, + {"sch", "largecactus", 0, false}, + {"dro", {"default:axe_bronze"}}, + {"dro", {"default:bookshelf", "default:book", "default:paper"}, 5}, + {"dro", {"default:fence_wood"}, 10}, + {"dro", {"default:fence_acacia_wood"}, 10}, + {"dro", {"default:fence_aspen_wood"}, 10}, + {"dro", {"default:fence_junglewood"}, 10}, + {"dro", {"default:fence_pine_wood"}, 10}, + {"sch", "obsidiantrap", 1, true}, + {"sch", "sandtrap", 1, true, {{"default:sand", "default:desert_sand"}} }, + {"nod", "default:chest", 0, { + {name = "default:acacia_wood", max = 10}, + {name = "default:aspen_wood", max = 10}, + {name = "default:pine_wood", max = 10}, + {name = "default:wood", max = 10}, + {name = "default:junglewood", max = 10}, + }}, + {"nod", "default:chest", 0, { + {name = "default:acacia_tree", max = 10}, + {name = "default:aspen_tree", max = 10}, + {name = "default:pine_tree", max = 10}, + {name = "default:tree", max = 10}, + {name = "default:jungletree", max = 10}, + }}, + {"dro", {"default:coral_brown"}, 5}, + {"dro", {"default:coral_orange"}, 5}, + {"dro", {"default:coral_skeleton"}, 5}, + {"sch", "corals", 0, true}, + {"dro", {"default:mese_post_light"}, 5}, + {"dro", {"default:fence_wood"}, 5}, + {"nod", "default:mese_post_light"}, + {"dro", {"default:silver_sand"}, 20}, + {"dro", {"default:sand"}, 20}, + {"dro", {"default:desert_sand"}, 20}, + {"dro", {"default:gravel"}, 15}, + {"nod", "default:chest", 0, { + {name = "default:silver_sand", max = 20}, + {name = "default:silver_sandstone", max = 20}, + {name = "default:desert_sand", max = 20}, + {name = "default:silver_sandstone", max = 20}, + {name = "default:sand", max = 20}, + {name = "default:sandstone", max = 20}, + {name = "default:gravel", max = 20}, + }}, + {"dro", {"default:obsidian"}, 14} + }) + + -- Additional Wishing Well Styles + lucky_block:add_blocks({ + {"sch", "wishingwell", 0, true}, + {"sch", "wishingwell", 0, true, { + {"default:stonebrick", "default:silver_sandstone_brick"}, + {"stairs:slab_stonebrick", "stairs:slab_silver_sandstone_brick"}, + {"default:fence_wood", "default:fence_aspen_wood"}, + {"default:steelblock", "default:tinblock"}, + } }, + {"sch", "wishingwell", 0, true, { + {"default:stonebrick", "default:sandstonebrick"}, + {"stairs:slab_stonebrick", "stairs:slab_sandstonebrick"}, + {"default:fence_wood", "default:fence_junglewood"}, + {"default:steelblock", "default:goldblock"}, + } }, + {"sch", "wishingwell", 0, true, { + {"default:stonebrick", "default:desert_stonebrick"}, + {"stairs:slab_stonebrick", "stairs:slab_desert_stonebrick"}, + {"default:fence_wood", "default:fence_acacia_wood"}, + {"default:steelblock", "default:copperblock"}, + } }, + {"sch", "wishingwell", 0, true, { + {"default:stonebrick", "default:desert_sandstone_brick"}, + {"stairs:slab_stonebrick", "stairs:slab_desert_sandstone_brick"}, + {"default:fence_wood", "default:fence_pine_wood"}, + {"default:steelblock", "default:bronzeblock"}, + } }, + }) +end + + +-- wool mod +if minetest.get_modpath("wool") then + + lucky_block:add_blocks({ + {"sch", "sandtrap", 1, true, {{"default:sand", "wool:red"}} }, + {"dro", {"wool:"}, 10, true}, + {"sch", "sandtrap", 1, true, {{"default:sand", "wool:green"}} }, + {"dro", {"wool:white"}, 10} + }) +end + +-- Flowers mod +if minetest.get_modpath("flowers") then + + lucky_block:add_blocks({ + {"nod", "flowers:rose", 0}, + {"dro", {"flowers:mushroom_red"}, 5}, + {"dro", {"flowers:mushroom_brown"}, 5}, + {"dro", {"flowers:rose", "flowers:tulip", "flowers:dandelion_yellow", + "flowers:geranium", "flowers:viola", "flowers:dandelion_white"}, 12}, + {"nod", "default:chest", 0, { + {name = "flowers:geranium", max = 15}, + {name = "flowers:viola", max = 15}, + {name = "flowers:dandelion_white", max = 15}, + {name = "flowers:dandelion_yellow", max = 15}, + {name = "flowers:tulip", max = 15}, + {name = "flowers:rose", max = 15}, + {name = "flowers:mushroom_brown", max = 10}, + {name = "flowers:mushroom_red", max = 10}, + {name = "flowers:waterlily", max = 10} + }} + }) +end + +-- Doors mod +if minetest.get_modpath("doors") then + + lucky_block:add_blocks({ + {"dro", {"doors:door_wood"}}, + {"dro", {"doors:door_steel"}}, + {"dro", {"doors:door_glass"}}, + {"dro", {"doors:door_obsidian_glass"}}, + {"dro", {"doors:trapdoor"}}, + {"dro", {"doors:trapdoor_steel"}}, + {"dro", {"doors:gate_acacia_wood_closed"}}, + {"dro", {"doors:gate_aspen_wood_closed"}}, + {"dro", {"doors:gate_wood_closed"}}, + {"dro", {"doors:gate_pine_wood_closed"}}, + {"dro", {"doors:gate_junglewood_closed"}} + }) +end + +-- Screwdriver mod +if minetest.get_modpath("screwdriver") then + + if screwdriver and screwdriver.handler then + + minetest.register_tool(":screwdriver:screwdriver_magenta", { + description = S("Super Mega Magenta Ultra Screwdriver 2500" + .. "\n(left-click to rotate face, right-click to rotates axis)"), + inventory_image = "screwdriver.png^[colorize:#ff009970", + groups = {not_in_creative_inventory = 1}, + + on_use = function(itemstack, user, pointed_thing) + screwdriver.handler(itemstack, user, pointed_thing, + screwdriver.ROTATE_FACE, 2500) + return itemstack + end, + + on_place = function(itemstack, user, pointed_thing) + screwdriver.handler(itemstack, user, pointed_thing, + screwdriver.ROTATE_AXIS, 2500) + return itemstack + end + }) + end + + lucky_block:add_blocks({ + {"dro", {"screwdriver:screwdriver"}}, + {"dro", {"screwdriver:screwdriver_magenta"}}, + }) +end + +-- Vessels mod +if minetest.get_modpath("vessels") then + + lucky_block:add_blocks({ + {"dro", {"vessels:shelf", "vessels:drinking_glass", "vessels:glass_bottle", + "vessels:steel_bottle", "vessels:glass_fragments"}, 5}, + {"nod", "vessels:drinking_glass", 0}, + {"nod", "vessels:glass_bottle", 0}, + {"nod", "vessels:steel_bottle", 0} + }) +end + +-- Farming mod (default) +if minetest.get_modpath("farming") then + + lucky_block:add_blocks({ + {"dro", {"farming:bread"}, 5}, + {"sch", "instafarm", 0, true}, + {"nod", "default:water_source", 1}, + {"nod", "farming:straw", 0}, + {"dro", {"farming:straw"}, 8} + }) +end + +-- Boats mod +if minetest.get_modpath("boats") then + + lucky_block:add_blocks({ + {"dro", {"boats:boat"}} + }) +end + +-- Beds mod +if minetest.get_modpath("beds") then + + lucky_block:add_blocks({ + {"dro", {"beds:bed"}}, + {"dro", {"beds:fancy_bed"}} + }) +end + +-- Walls mod +if minetest.get_modpath("walls") then + + lucky_block:add_blocks({ + {"dro", {"walls:cobble"}, 10}, + {"dro", {"walls:mossycobble"}, 10}, + {"dro", {"walls:desertcobble"}, 10} + }) +end + +-- Carts mod +if minetest.get_modpath("carts") +or minetest.get_modpath("boost_cart") then + + lucky_block:add_blocks({ + {"dro", {"carts:cart"}}, + {"dro", {"default:rail"}, 10}, + {"dro", {"carts:powerrail"}, 5}, + {"dro", {"carts:brakerail"}, 5} + }) +end + +-- 3D Armor mod +if minetest.get_modpath("3d_armor") then + + lucky_block:add_blocks({ + {"dro", {"3d_armor:boots_wood"}}, + {"dro", {"3d_armor:leggings_wood"}}, + {"dro", {"3d_armor:chestplate_wood"}}, + {"dro", {"3d_armor:helmet_wood"}}, + {"tel"}, + {"dro", {"3d_armor:boots_steel"}}, + {"dro", {"3d_armor:leggings_steel"}}, + {"dro", {"3d_armor:chestplate_steel"}}, + {"dro", {"3d_armor:helmet_steel"}}, + {"dro", {"3d_armor:boots_gold"}}, + {"dro", {"3d_armor:leggings_gold"}}, + {"dro", {"3d_armor:chestplate_gold"}}, + {"exp"}, + {"dro", {"3d_armor:helmet_gold"}}, + {"dro", {"3d_armor:boots_cactus"}}, + {"dro", {"3d_armor:leggings_cactus"}}, + {"dro", {"3d_armor:chestplate_cactus"}}, + {"dro", {"3d_armor:helmet_cactus"}}, + {"dro", {"3d_armor:boots_bronze"}}, + {"dro", {"3d_armor:leggings_bronze"}}, + {"dro", {"3d_armor:chestplate_bronze"}}, + {"dro", {"3d_armor:helmet_bronze"}}, + {"lig"} + }) +end + +-- 3D Armor's Shields mod +if minetest.get_modpath("shields") then + + lucky_block:add_blocks({ + {"dro", {"shields:shield_wood"}}, + {"dro", {"shields:shield_steel"}}, + {"dro", {"shields:shield_gold"}}, + {"dro", {"shields:shield_cactus"}}, + {"dro", {"shields:shield_bronze"}}, + {"exp", 2} + }) +end + +-- Fire mod +if minetest.get_modpath("fire") then + + lucky_block:add_blocks({ + {"dro", {"fire:flint_and_steel"}}, + {"dro", {"default:flint"}, 5}, + {"nod", "fire:basic_flame", 1}, + {"nod", "fire:permanent_flame", 1}, + {"sch", "firetrap", 1, true}, + }) +end + +-- TNT mod +if minetest.get_modpath("tnt") then + + local p = "tnt:tnt_burning" + + lucky_block:add_blocks({ + {"dro", {"tnt:gunpowder"}, 5}, + {"fal", {p, p, p, p, p}, 1, true, 4}, + {"nod", "tnt:tnt_burning", 0} + }) +end + +-- More Ore's mod +if minetest.get_modpath("moreores") then + + lucky_block:add_blocks({ + {"nod", "moreores:tin_block", 0}, + {"nod", "moreores:silver_block", 0}, + {"fal", {"default:sand", "default:sand", "default:sand", "default:sand", + "default:sand", "default:sand", "moreores:mithril_block"}, 0}, + {"dro", {"moreores:pick_silver"}}, + {"dro", {"moreores:pick_mithril"}}, + {"tro", "moreores:silver_block"}, + {"dro", {"moreores:shovel_silver"}}, + {"dro", {"moreores:shovel_mithril"}}, + {"dro", {"moreores:axe_silver"}}, + {"dro", {"moreores:axe_mithril"}}, + {"tro", "moreores:mithril_block"}, + {"dro", {"moreores:hoe_silver"}}, + {"dro", {"moreores:hoe_mithril"}}, + {"lig"}, + {"nod", "default:chest", 0, { + {name = "moreores:silver_lump", max = 10}, + {name = "moreores:mithril_lump", max = 10}, + {name = "default:copper_lump", max = 10}, + {name = "default:gold_lump", max = 10}, + {name = "default:iron_lump", max = 10}, + {name = "default:tin_lump", max = 10}, + {name = "default:coal_lump", max = 10}, + {name = "default:clay_lump", max = 10} + }} + }) + + if minetest.get_modpath("3d_armor") then + + lucky_block:add_blocks({ + {"dro", {"3d_armor:helmet_mithril"}}, + {"dro", {"3d_armor:chestplate_mithril"}}, + {"dro", {"3d_armor:leggings_mithril"}}, + {"dro", {"3d_armor:boots_mithril"}} + }) + end + + if minetest.get_modpath("shields") then + + lucky_block:add_blocks({ + {"dro", {"shields:shield_mithril"}} + }) + end +end -- END moreores + +-- Bags mod +if minetest.get_modpath("bags") or minetest.get_modpath("sfinv_bags") then + + minetest.register_craftitem(":bags:spar", { + description = "Spar Bag", + inventory_image = "bags_spar.png", + groups = {bagslots = 2, flammable = 2} + }) + + lucky_block:add_blocks({ + {"dro", {"bags:spar"}}, + {"dro", {"bags:small"}}, + {"dro", {"bags:medium"}}, + {"dro", {"bags:large"}}, + {"dro", {"bags:trolley"}} + }) +end + +-- Nether Mod +if minetest.get_modpath("nether") then + + local p = "nether:" + + -- add well blocks + lucky_block.wellblocks[#lucky_block.wellblocks + 1] = {p.."glowstone", 4} + lucky_block.wellblocks[#lucky_block.wellblocks + 1] = {p.."glowstone_deep", 4} + + -- add lucky blocks + lucky_block:add_blocks({ + {"flo", 3, {"nether:rack", "nether:brick", "nether:brick_cracked"}, 1}, + {"flo", 3, {"nether:rack_deep", "nether:brick_deep"}, 1}, + {"flo", 3, {"nether:basalt", "nether:basalt_hewn", "nether:basalt_chiselled"}, 1}, + {"nod", "nether:glowstone", 0}, + {"nod", "nether:glowstone_deep", 0}, + {"exp", 3}, + {"fal", {p.."sand", p.."sand", p.."sand", p.."sand", p.."sand", p.."glowstone"}, 0}, + {"nod", "nether:lava_crust", 1}, + {"nod", "default:chest", 0, { + {name = p.."fence_nether_brick", max = 5}, + {name = p.."rack_wall", max = 5}, + {name = p.."rack", max = 5}, + {name = p.."axe_nether", max = 1}, + {name = p.."sword_nether", max = 1}, + {name = p.."nether_lump", max = 3} + }}, + {"exp", 2}, + {"sch", "wishingwell", 0, true, { + {"default:stonebrick", p.."brick"}, + {"stairs:slab_stonebrick", "stairs:slab_nether_brick"}, + {"default:fence_wood", p.."fence_nether_brick"}, + {"default:steelblock", p.."basalt_chiselled"}, + {"default:water_source", "default:lava_source"}, + {"default:glass", "default:obsidian_glass"} + }}, + {"lig"}, + {"sch", "platform", 1, true, { + {"default:sandstonebrick", p.."brick_deep"}, + {"default:sandstone", p.."rack_deep"}, + {"lucky_block:lucky_block", "lucky_block:super_lucky_block"} + }}, + {"nod", "default:chest", 0, { + {name = p.."rack_deep_wall", max = 5}, + {name = p.."rack_deep", max = 5}, + {name = p.."pick_nether", max = 1}, + {name = p.."shovel_nether", max = 1}, + {name = p.."nether_lump", max = 3} + }}, + }) + + if minetest.get_modpath("3d_armor") then + + lucky_block:add_blocks({ + {"dro", {"3d_armor:helmet_nether"}}, + {"dro", {"3d_armor:chestplate_nether"}}, + {"dro", {"3d_armor:leggings_nether"}}, + {"dro", {"3d_armor:boots_nether"}} + }) + end + + if minetest.get_modpath("shields") then + + lucky_block:add_blocks({ + {"dro", {"shields:shield_nether"}} + }) + end + + if minetest.get_modpath("xpanes") and minetest.registered_nodes["nether:geode"] then + + lucky_block:add_blocks({ + {"dro", {"xpanes:nether_crystal_pane_flat"}, 5}, + {"nod", "nether_geode", 0}, + {"dro", {"nether_geode"}, 3} + }) + end +end diff --git a/blocks_lb.lua b/blocks_lb.lua new file mode 100644 index 0000000..9b0fd84 --- /dev/null +++ b/blocks_lb.lua @@ -0,0 +1,398 @@ + +local S = lucky_block.intllib + + +-- custom function (punches player with 5 damage) +local function punchy(pos, player) + + player:punch(player, 1.0, { + full_punch_interval = 1.0, + damage_groups = {fleshy = 5} + }, nil) + + minetest.sound_play("player_damage", {pos = pos, gain = 1.0}, true) + + minetest.chat_send_player(player:get_player_name(), + lucky_block.green .. S("Stop hitting yourself!")) +end + + +-- custom function (pint sized player) and potion with recipe +local function pint(pos, player) + + player:set_properties({ + visual_size = {x = 0.5, y = 0.5}, + collisionbox = {-0.15, 0.0, -0.15, 0.15, .85, 0.15}, + eye_height = 0.73, + stepheight = 0.3 + }) + + minetest.chat_send_player(player:get_player_name(), + lucky_block.green .. S("Pint Sized Player!")) + + minetest.sound_play(lucky_block.snd_pop2, {pos = pos, gain = 1.0}, true) + + minetest.after (180, function(player, pos) -- 3 minutes + + if player and player:is_player() then + + player:set_properties({ + visual_size = {x = 1.0, y = 1.0}, + collisionbox = {-0.3, 0.0, -0.3, 0.3, 1.7, 0.3}, + eye_height = 1.47, + stepheight = 0.6 + }) + + minetest.sound_play(lucky_block.snd_pop2, { + pos = player:get_pos(), gain = 1.0}, true) + end + end, player) +end + +-- pint sized potion item +minetest.register_craftitem("lucky_block:pint_sized_potion", { + description = S("Pint Sized Potion (DRINK ME)"), + inventory_image = "lucky_pint_sized_potion.png", + groups = {vessel = 1}, + on_use = function(itemstack, user, pointed_thing) + + itemstack:take_item() + + local pos = user:get_pos() + local inv = user:get_inventory() + local item = "vessels:glass_bottle" + + if inv:room_for_item("main", {name = item}) then + inv:add_item("main", item) + else + minetest.add_item(pos, {name = item}) + end + + pint(pos, user) + + return itemstack + end +}) + +-- pint sized potion recipe (default) +if lucky_block.mod_def then + + minetest.register_craft({ + output = "lucky_block:pint_sized_potion", + recipe = { + {"default:bush_sapling", "flowers:tulip", "default:acacia_bush_sapling"}, + {"dye:blue", "default:apple", "dye:cyan"}, + {"", "vessels:glass_bottle", ""} + } + }) +end + + +-- custom function (slender player) and potion with recipe +local function slender(pos, player) + + player:set_properties({ + visual_size = {x = 1.0, y = 1.5}, + collisionbox = {-0.3, 0.0, -0.3, 0.3, 1.7 + .85, 0.3}, + eye_height = 1.47 + 0.73, + stepheight = 0.9 + }) + + minetest.chat_send_player(player:get_player_name(), + lucky_block.green .. S("Slender Player!")) + + minetest.sound_play(lucky_block.snd_pop2, {pos = pos, gain = 1.0}, true) + + minetest.after (180, function(player, pos) -- 3 minutes + + if player and player:is_player() then + + player:set_properties({ + visual_size = {x = 1.0, y = 1.0}, + collisionbox = {-0.3, 0.0, -0.3, 0.3, 1.7, 0.3}, + eye_height = 1.47, + stepheight = 0.6 + }) + + minetest.sound_play(lucky_block.snd_pop2, { + pos = player:get_pos(), gain = 1.0}, true) + end + end, player) +end + +-- slender player potion item +minetest.register_craftitem("lucky_block:slender_player_potion", { + description = S("Slender Player Potion (DRINK ME)"), + inventory_image = "lucky_slender_potion.png", + groups = {vessel = 1}, + on_use = function(itemstack, user, pointed_thing) + + itemstack:take_item() + + local pos = user:get_pos() + local inv = user:get_inventory() + local item = "vessels:glass_bottle" + + if inv:room_for_item("main", {name = item}) then + inv:add_item("main", item) + else + minetest.add_item(pos, {name = item}) + end + + slender(pos, user) + + return itemstack + end +}) + +-- slender player potion recipe +if lucky_block.mod_def then + + minetest.register_craft({ + output = "lucky_block:slender_player_potion", + recipe = { + {"default:bush_sapling", "flowers:rose", "default:pine_bush_sapling"}, + {"dye:red", "default:apple", "dye:orange"}, + {"", "vessels:glass_bottle", ""} + } + }) +end + + +-- lightning staff +minetest.register_tool("lucky_block:lightning_staff", { + description = S("Lightning Staff"), + inventory_image = "lucky_lightning_staff.png", + range = 10, + groups = {not_in_creative_inventory = 1}, + + on_use = function(itemstack, user, pointed_thing) + + local pos = user:get_pos() + + if pointed_thing.type == "object" then + pos = pointed_thing.ref:get_pos() + elseif pointed_thing.type == "node" then + pos = pointed_thing.above + end + + if not pos then return end + + local bnod = pos and minetest.get_node_or_nil(pos) + local bref = bnod and minetest.registered_items[bnod.name] + + if bref and bref.buildable_to == true then + minetest.set_node(pos, {name = "fire:basic_flame"}) + end + + local radius = 4 + local objs = minetest.get_objects_inside_radius(pos, radius) + local obj_pos, dist + + -- add temp entity to cause damage + local tmp_ent = minetest.add_entity(pos, "lucky_block:temp") + + for n = 1, #objs do + + obj_pos = objs[n]:get_pos() + + dist = vector.distance(pos, obj_pos) + + if dist < 1 then dist = 1 end + + local damage = math.floor((4 / dist) * radius) + local ent = objs[n]:get_luaentity() + + -- if you blast yourself then delay hurt for bones mod if dead + if objs[n] == user then + + minetest.after(0.1, function() + objs[n]:punch(tmp_ent, 1.0, { + full_punch_interval = 1.0, + damage_groups = {fleshy = damage, fire = 1} + }, pos) + end) + else + objs[n]:punch(tmp_ent, 1.0, { + full_punch_interval = 1.0, + damage_groups = {fleshy = damage, fire = 1} + }, pos) + end + end + + minetest.add_particle({ + pos = {x = pos.x, y = pos.y + 4, z = pos.z}, + velocity = {x = 0, y = 0, z = 0}, + acceleration = {x = 0, y = 0, z = 0}, + expirationtime = 1.0, + collisiondetection = false, + texture = "lucky_lightning.png", + size = 100, + glow = 15 + }) + + minetest.sound_play("lightning", { + pos = pos, gain = 1.0, max_hear_distance = 25}, true) + + itemstack:add_wear(65535 / 50) -- 50 uses + + return itemstack + end +}) + + +-- custom function (drop player inventory and replace with items and show msg) +local function dropsy(pos, player, def) + + local player_inv = player:get_inventory() + + pos = player:get_pos() or pos + + for i = 1, player_inv:get_size("main") do + + local obj = minetest.add_item(pos, player_inv:get_stack("main", i)) + + if obj then + + obj:set_velocity({ + x = math.random(-10, 10) / 9, + y = 5, + z = math.random(-10, 10) / 9 + }) + end + + player_inv:set_stack("main", i, def.item) + end + + minetest.chat_send_player(player:get_player_name(), lucky_block.green .. S(def.msg)) +end + + +local tex = lucky_block.mod_mcl and "default_glass.png" or "default_obsidian_glass.png^[brighten" + +-- void mirror block (place to see through solid walls) +minetest.register_node("lucky_block:void_mirror", { + description = S("Void Mirror (Place to see through solid walls during daytime)"), + drawtype = "normal", + tiles = {tex}, + use_texture_alpha = "clip", + groups = {handy = 1, snappy = 3, not_in_creative_inventory = 1}, + sounds = lucky_block.snd_glass, + _mcl_hardness = 0.6 +}) + + +-- Troll item drop +local function fake_items(pos, player, def) + + for n = 1, 25 do + + minetest.add_particle({ + time = 15, + pos = { + x = pos.x + math.random(-20, 20) / 10, + y = pos.y, + z = pos.z + math.random(-20, 20) / 10 + }, + velocity = {x = 0, y = 2, z = 0}, + acceleration = {x = 0, y = -10, z = 0}, + expirationtime = 4, + maxsize = 4, + texture = def.tex, + glow = 2, + size = 5, + collisiondetection = true, + vertical = true + }) + end + + minetest.chat_send_player(player:get_player_name(), + lucky_block.green .. S("Wow! So many faux " .. def.txt .. "!")) +end + + +-- Void Pick (disable for mineclone since it has silk touch tools) +if not lucky_block.mod_mcl then + + local old_handle_node_drops = minetest.handle_node_drops + + function minetest.handle_node_drops(pos, drops, digger) + + -- are we holding Crystal Shovel? + if not digger + or digger:get_wielded_item():get_name() ~= "lucky_block:pick_void" then + return old_handle_node_drops(pos, drops, digger) + end + + local nn = minetest.get_node(pos).name + + if nn == "default:furnace_active" + or nn:find("xpanes:") + or nn:find("door") + or minetest.get_item_group(nn, "cracky") == 0 then + return old_handle_node_drops(pos, drops, digger) + end + + return old_handle_node_drops(pos, {ItemStack(nn)}, digger) + end + + minetest.register_tool("lucky_block:pick_void", { + description = "Void pick (Soft Touch)", + inventory_image = "lucky_void_pick.png", + wield_image = "lucky_void_pick.png^[transformR90", + tool_capabilities = { + full_punch_interval = 1.2, + max_drop_level = 3, + groupcaps = { + cracky = { + times = {[1] = 2.4, [2] = 1.2, [3] = 0.60}, + uses = 20, + maxlevel = 3 + } + }, + damage_groups = {fleshy = 5}, + }, + groups = {pickaxe = 1, not_in_creative_inventory = 1}, + sound = {breaks = "default_tool_breaks"} + }) +end + +-- add custom functions and special drops +lucky_block:add_blocks({ + {"cus", pint}, + {"cus", punchy}, + {"cus", slender}, + {"dro", {"lucky_block:pint_sized_potion"}, 1}, + {"dro", {"lucky_block:slender_player_potion"}, 1}, + {"dro", {"lucky_block:void_mirror"}} +}) + + +-- custom items for default mod +if lucky_block.mod_def then + + lucky_block:add_blocks({ + {"cus", dropsy, {item = "default:dry_shrub", msg = "Dry shrub takeover!"} }, + {"cus", fake_items, {tex = "default_diamond.png", txt = "diamonds"} }, + {"cus", fake_items, {tex = "default_gold_ingot.png", txt = "ingots"} }, + {"cus", fake_items, {tex = "default_mese_crystal.png", txt = "crystals"} }, + {"nod", "default:chest", 0, { + {name = "lucky_block:pick_void", max = 1, chance = 7}, + {name = "default:stone_with_coal", max = 5}, + {name = "default:stone_with_iron", max = 5}, + {name = "default:stone_with_copper", max = 5}, + {name = "default:stone_with_mese", max = 5}, + {name = "default:stone_with_gold", max = 5}, + {name = "default:stone_with_diamond", max = 5} + }}, + {"nod", "default:chest", 0, { + {name = "default:stick", max = 10}, + {name = "default:acacia_bush_stem", max = 10}, + {name = "default:bush_stem", max = 10}, + {name = "default:pine_bush_stem", max = 10}, + {name = "default:grass_1", max = 10}, + {name = "default:dry_grass_1", max = 10}, + {name = "lucky_block:lightning_staff", max = 1, chance = 10} + }} + }) +end diff --git a/blocks_mcl.lua b/blocks_mcl.lua new file mode 100644 index 0000000..b08b778 --- /dev/null +++ b/blocks_mcl.lua @@ -0,0 +1,463 @@ + +local S = lucky_block.intllib + +-- chest items +lucky_block:add_chest_items({ + {name = "mcl_core:wood", max = 5}, + {name = "mcl_core:apple", max = 3}, + {name = "mcl_core:iron_ingot", max = 3}, + {name = "mcl_core:gold_ingot", max = 3, chance = 2}, + {name = "mcl_core:diamond", max = 2, chance = 3}, + {name = "mcl_core:pick_iron", max = 1, chance = 2, min_wear = 20000, max_wear = 65536} +}) + + +local mpath = minetest.get_modpath("mcl_core") .. "/schematics/" + +-- Default tree schematics +lucky_block:add_schematics({ + {"oaktree1", mpath .. "mcl_core_oak_large_1.mts", {x = 2, y = 1, z = 2}}, +-- {"oaktree2", mpath .. "mcl_core_oak_large_2.mts", {x = 1, y = 1, z = 1}}, +-- {"oaktree3", mpath .. "mcl_core_oak_large_3.mts", {x = 1, y = 1, z = 1}}, +-- {"oaktree4", mpath .. "mcl_core_oak_large_4.mts", {x = 1, y = 1, z = 1}}, +-- {"oaktreeclassic", mpath .. "mcl_core_oak_classic.mts", {x = 1, y = 1, z = 1}}, + {"oaktreeswamp", mpath .. "mcl_core_oak_swamp.mts", {x = 3, y = 1, z = 3}}, + {"mangrovetree1", mpath .. "mcl_mangrove_tree_1.mts", {x = 3, y = 1, z = 3}}, +-- {"mangrovetree2", mpath .. "mcl_mangrove_tree_2.mts", {x = 1, y = 1, z = 1}}, +-- {"mangrovetree3", mpath .. "mcl_mangrove_tree_3.mts", {x = 1, y = 1, z = 1}}, +-- {"mangrovetree4", mpath .. "mcl_mangrove_tree_4.mts", {x = 1, y = 1, z = 1}}, +-- {"mangrovetree5", mpath .. "mcl_mangrove_tree_5.mts", {x = 1, y = 1, z = 1}}, + {"jungletree", mpath .. "mcl_core_jungle_tree.mts", {x = 2, y = 1, z = 2}}, + {"sprucetree1", mpath .. "mcl_core_spruce_huge_1.mts", {x = 5, y = 1, z = 5}}, +-- {"sprucetree2", mpath .. "mcl_core_spruce_huge_2.mts", {x = 1, y = 1, z = 1}}, +-- {"sprucetree3", mpath .. "mcl_core_spruce_huge_3.mts", {x = 1, y = 1, z = 1}}, +-- {"sprucetree4", mpath .. "mcl_core_spruce_huge_4.mts", {x = 1, y = 1, z = 1}}, + {"birchtree", mpath .. "mcl_core_birch.mts", {x = 2, y = 1, z = 2}}, + {"birchtreetall", mpath .. "mcl_core_birch_tall.mts", {x = 3, y = 1, z = 3}}, + {"darkoaktree", mpath .. "mcl_core_dark_oak.mts", {x = 5, y = 1, z = 5}}, + {"brownmushroom1", mpath .. "mcl_mushrooms_huge_brown.mts", {x = 3, y = 1, z = 3}}, +-- {"brownmushroom2", mpath .. "mcl_mushrooms_giant_brown.mts", {x = 1, y = 1, z = 1}}, + {"redmushroom1", mpath .. "mcl_mushrooms_huge_red.mts", {x = 3, y = 1, z = 3}}, +-- {"redmushroom2", mpath .. "mcl_mushrooms_giant_red.mts", {x = 1, y = 1, z = 1}} +}) + +-- mineclone tree's +lucky_block:add_blocks({ + {"sch", "oaktree1", 0, false}, + {"sch", "oaktreeswamp", 0, false}, + {"sch", "mangrovetree1", 0, false}, + {"sch", "jungletree", 0, false}, + {"sch", "sprucetree1", 0, false}, + {"sch", "birchtree", 0, false}, + {"sch", "birchtreetall", 0, false}, + {"sch", "darkoaktree", 0, false}, + {"sch", "brownmushroom1", 0, false}, + {"sch", "redmushroom1", 0, false} +}) + +-- mineclone lucky blocks +lucky_block:add_blocks({ + {"nod", {"mcl_chests_small:chest"}, 0}, + {"lig"}, + {"fal", { + "mcl_core:wood", "mcl_core:gravel", "mcl_core:sand", + "mcl_core:sand", "mcl_core:stone", "mcl_core:dirt", "mcl_core:goldblock" + }, 0}, + {"sch", "watertrap", 1, true, { + {"default:water_source", "mcl_core:water_source"}, + {"default:obsidian_glass", "mcl_core:glass"} + }}, + {"tel"}, + {"dro", {"mcl_core:apple"}, 10}, + {"dro", {"mcl_core:snow"}, 10}, + {"sch", "sandtrap", 1, true, { + {"default:sand", "mcl_core:sand"} + }}, + {"sch", "lavatrap", 1, true, { + {"default:lava_source", "mcl_core:lava_source"} + }}, + {"exp", 2}, + {"nod", "mcl_core:diamondblock", 0}, + {"nod", "mcl_core:ironblock", 0}, + {"nod", "mcl_core:dirt", 0}, + {"nod", "mcl_chests:chest_small", 0, { + {name = "mcl_core:dirt", max = 15}, + {name = "mcl_core:mycelium", max = 15}, + {name = "mcl_core:podzol", max = 15}, + {name = "mcl_core:coarse_dirt", max = 15}, + {name = "mcl_core:dirt_with_grass", max = 15}, + }}, + {"dro", {"default:sword_steel"}}, + {"sch", "jungletree", 0, false}, + {"dro", { + "mcl_core:axe_iron", "mcl_core:pick_iron", + "mcl_core:shovel_iron", "mcl_core:sword_iron" + }}, + {"exp"}, + {"dro", {"mcl_core:coal_lump"}, 3}, + {"tro", "mcl_core:diamondblock", "tnt_explode", true}, + {"exp", 3}, + {"nod", "mcl_chests:chest_small", 0, { + {name = "mcl_core:acaciasapling", max = 10}, + {name = "mcl_core:darksapling", max = 10}, + {name = "mcl_core:birchsapling", max = 10}, + {name = "mcl_core:junglesapling", max = 10}, + {name = "mcl_core:sapling", max = 10}, + {name = "mcl_core:sprucesapling", max = 10}, + {name = "mcl_core:deadbush", max = 5}, + }}, + {"sch", "platform", 1, true, { + {"default:sandstone", "mcl_core:sandstone"}, + {"default:sandstonebrick", "mcl_core:sandstone"} + }}, + {"nod", "mcl_core:wood", 0}, + {"nod", "mcl_core:gravel", 0}, + {"sch", "sandtrap", 1, true, {{"default:sand", "mcl_core:gravel"}} }, + {"sch", "obsidiantrap", 1, true, { + {"default:obsidian", "mcl_core:obsidian"}, + {"default:lava_source", "mcl_core:lava_source"} + }}, + {"nod", "mcl_chests:chest_small", 0, { + {name = "mcl_core:wood", max = 10}, + {name = "mcl_core:acaciawood", max = 10}, + {name = "mcl_core:darkwood", max = 10}, + {name = "mcl_core:junglewood", max = 10}, + {name = "mcl_core:birchwood", max = 10}, + {name = "mcl_core:sprucewood", max = 10}, + }}, + {"nod", "mcl_chests:chest_small", 0, { + {name = "mcl_core:tree", max = 10}, + {name = "mcl_core:acaciatree", max = 10}, + {name = "mcl_core:darktree", max = 10}, + {name = "mcl_core:jungletree", max = 10}, + {name = "mcl_core:birchtree", max = 10}, + {name = "mcl_core:sprucetree", max = 10}, + }}, + {"dro", {"mcl_core:sand"}, 20}, + {"dro", {"mcl_core:gravel"}, 15}, + {"nod", "mcl_chests:chest_small", 0, { + {name = "mcl_core:sand", max = 20}, + {name = "mcl_core:sandstone", max = 20}, + {name = "mcl_core:gravel", max = 20}, + }}, + {"dro", {"mcl_core:obsidian"}, 14} +}) + +-- Additional Wishing Well Styles +lucky_block:add_blocks({ + {"sch", "wishingwell", 0, true, { + {"default:stonebrick", "mcl_core:sandstone"}, + {"stairs:slab_stonebrick", "mcl_stairs:slab_sandstone"}, + {"default:fence_wood", "mcl_fences:fence"}, + {"default:steelblock", "mcl_core:ironblock"}, + {"default:glass", "mcl_core:glass"} + }} +}) + +-- mcl_dye +if minetest.get_modpath("mcl_dye") then + + lucky_block:add_blocks({ + {"dro", {"mcl_dye:"}, 10, true} + }) +end + +-- mcl_buckets +if minetest.get_modpath("mcl_buckets") then + + lucky_block:add_blocks({ + {"dro", {"mcl_buckets:bucket_empty"}, 5}, + {"dro", {"mcl_buckets:bucket_lava"}}, + {"dro", {"mcl_buckets:bucket_water"}}, + {"dro", {"mcl_buckets:bucket_cod"}}, + {"dro", {"mcl_buckets:bucket_salmon"}}, + }) +end + +-- mcl_books +if minetest.get_modpath("mcl_books") then + + lucky_block:add_blocks({ + {"nod", "mcl_books:bookshelf"}, + {"dro", {"mcl_books:bookshelf", "mcl_books:book", "mcl_core:paper"}, 5}, + }) +end + +-- mcl_wool +if minetest.get_modpath("mcl_wool") then + + lucky_block:add_blocks({ + {"sch", "sandtrap", 1, true, {{"default:sand", "mcl_wool:red"}} }, + {"dro", {"mcl_wool:"}, 10, true}, + {"sch", "sandtrap", 1, true, {{"default:sand", "mcl_wool:green"}} }, + {"dro", {"mcl_wool:white"}, 10} + }) +end + +-- mcl_flowers +if minetest.get_modpath("mcl_flowers") then + + local tmp = "mcl_flowers:" + + lucky_block:add_blocks({ + {"dro", { + tmp.."tallgrass", tmp.."peony", tmp.."sunflower", tmp.."double_grass", + tmp.."double_fern", tmp.."fern", tmp.."waterlily", tmp.."poppy", + tmp.."dandelion", tmp.."oxeye_daisy", tmp.."tulip_orange", + tmp.."tulip_pink", tmp.."tulip_red", tmp.."tulip_white", + tmp.."allium", tmp.."azure_bluet", tmp.."blue_orchid" + }, 12}, + {"nod", "mcl_chests:chest_small", 0, { + {name = tmp.."tallgrass", max = 10}, + {name = tmp.."peony", max = 10}, + {name = tmp.."sunflower", max = 10}, + {name = tmp.."double_grass", max = 10}, + {name = tmp.."double_fern", max = 10}, + {name = tmp.."fern", max = 10}, + {name = tmp.."waterlily", max = 10}, + {name = tmp.."poppy", max = 10}, + {name = tmp.."dandelion", max = 10}, + {name = tmp.."oxeye_daisy", max = 10}, + {name = tmp.."tulip_orange", max = 10}, + {name = tmp.."tulip_pink", max = 10}, + {name = tmp.."tulip_white", max = 10}, + {name = tmp.."tulip_red", max = 10}, + {name = tmp.."allium", max = 10}, + {name = tmp.."azure_bluet", max = 10}, + {name = tmp.."blue_orchid", max = 10} + }} + }) +end + +-- mcl_doors +if minetest.get_modpath("mcl_doors") then + + lucky_block:add_blocks({ + {"dro", {"mcl_doors:wooden_door"}}, + {"dro", {"mcl_doors:acacia_door"}}, + {"dro", {"mcl_doors:birch_door"}}, + {"dro", {"mcl_doors:dark_oak_door"}}, + {"dro", {"mcl_doors:jungle_door"}}, + {"dro", {"mcl_doors:spruce_door"}}, + {"dro", {"mcl_doors:iron_door"}}, + + {"dro", {"mcl_doors:wooden_trapdoor"}}, + {"dro", {"mcl_doors:acacia_trapdoor"}}, + {"dro", {"mcl_doors:birch_trapdoor"}}, + {"dro", {"mcl_doors:dark_oak_trapdoor"}}, + {"dro", {"mcl_doors:jungle_trapdoor"}}, + {"dro", {"mcl_doors:spruce_trapdoor"}}, + {"dro", {"mcl_doors:iron_trapdoor"}} + }) +end + +-- mcl_fences +if minetest.get_modpath("mcl_fences") then + + local tmp = "mcl_fences:" + + lucky_block:add_blocks({ + {"dro", { + tmp.."fence", tmp.."spruce_fence", tmp.."birch_fence", + tmp.."jungle_fence", tmp.."dark_oak_fence", tmp.."acacia_fence" + }, 10}, + {"dro", { + tmp.."fence_gate", tmp.."spruce_fence_gate", tmp.."birch_fence_gate", + tmp.."jungle_fence_gate", tmp.."dark_oak_fence_gate", tmp.."acacia_fence_gate" + }, 5} + }) +end + +-- Screwdriver mod +if minetest.get_modpath("screwdriver") then + + if screwdriver and screwdriver.handler then + + minetest.register_tool(":screwdriver:screwdriver_magenta", { + description = S("Super Mega Magenta Ultra Screwdriver 2500" + .. "\n(left-click to rotate face, right-click to rotates axis)"), + inventory_image = "screwdriver.png^[colorize:#ff009970", + groups = {not_in_creative_inventory = 1}, + + on_use = function(itemstack, user, pointed_thing) + screwdriver.handler(itemstack, user, pointed_thing, + screwdriver.ROTATE_FACE, 2500) + return itemstack + end, + + on_place = function(itemstack, user, pointed_thing) + screwdriver.handler(itemstack, user, pointed_thing, + screwdriver.ROTATE_AXIS, 2500) + return itemstack + end + }) + end + + lucky_block:add_blocks({ + {"dro", {"screwdriver:screwdriver"}}, + {"dro", {"screwdriver:screwdriver_magenta"}}, + }) +end + +-- mcl_farming +if minetest.get_modpath("mcl_farming") then + + lucky_block:add_blocks({ + {"dro", {"mcl_farming:beetroot_item"}, 5}, + {"dro", {"mcl_farming:carrot_item"}, 5}, + {"dro", {"mcl_farming:melon_item"}, 5}, + {"dro", {"mcl_farming:potato_item"}, 5}, + {"dro", {"mcl_farming:potato_item_baked"}, 5}, + {"dro", {"mcl_farming:potato_item_poison"}, 3}, + {"nod", "mcl_farming:pumpkin"}, + {"dro", {"mcl_farming:pumpkin_pie"}, 3}, + {"dro", {"mcl_farming:wheat_item"}, 10}, + {"dro", {"mcl_farming:bread"}, 5}, + {"dro", {"mcl_farming:cookie"}, 5}, + {"nod", "mcl_farming:hay_block"}, + {"dro", {"mcl_farming:hay_block"}, 4}, + {"nod", "mcl_core:water_source", 1}, + {"sch", "instafarm", 0, true, { + {"farming:soil_wet", "mcl_farming:soil_wet"}, + {"default:dirt", "mcl_core:dirt"}, + {"default:water_source", "mcl_core:water_source"}, + {"farming:wheat_8", "mcl_farming:wheat"}, + {"farming:cotton_8", "mcl_farming:carrot"} + }}, + {"nod", "mcl_chests:chest_small", 0, { + {name = "mcl_farming:beetroot_seeds", max = 10}, + {name = "mcl_farming:melon_seeds", max = 10}, + {name = "mcl_farming:pumpkin_seeds", max = 10}, + {name = "mcl_farming:wheat_seeds", max = 10}, + {name = "mcl_farming:wheat_item", max = 10}, + {name = "mcl_farming:melon", max = 2}, + {name = "mcl_farming:pumpkin", max = 2} + }} + }) +end + +-- mcl_boats +if minetest.get_modpath("mcl_boats") then + + lucky_block:add_blocks({ + {"dro", {"mcl_boats:boat"}} + }) +end + +-- mcl_beds +if minetest.get_modpath("mcl_beds") then + + lucky_block:add_blocks({ + {"dro", {"mcl_beds:bed_"}, 1, true} + }) +end + +-- mcl_walls +if minetest.get_modpath("mcl_walls") then + + lucky_block:add_blocks({ + {"dro", {"mcl_walls:cobble"}, 10}, + {"dro", {"mcl_walls:mossycobble"}, 10}, + {"dro", {"mcl_walls:andesite"}, 10}, + {"dro", {"mcl_walls:granite"}, 10}, + {"dro", {"mcl_walls:diorite"}, 10}, + {"dro", {"mcl_walls:brick"}, 10}, + {"dro", {"mcl_walls:sandstone"}, 10}, + {"dro", {"mcl_walls:redsandstone"}, 10}, + {"dro", {"mcl_walls:stonebrick"}, 10}, + {"dro", {"mcl_walls:stonebrickmossy"}, 10}, + {"dro", {"mcl_walls:prismarine"}, 10}, + {"dro", {"mcl_walls:endbricks"}, 10}, + {"dro", {"mcl_walls:netherbrick"}, 10}, + {"dro", {"mcl_walls:rednetherbrick"}, 10}, + {"dro", {"mcl_walls:mudbrick"}, 10} + }) +end + +-- mcl_minecarts +if minetest.get_modpath("mcl_minecarts") then + + lucky_block:add_blocks({ + {"dro", {"mcl_minecarts:minecart"}}, + {"dro", {"mcl_minecarts:chest_minecart"}}, + {"dro", {"mcl_minecarts:rail"}, 10}, + {"dro", {"mcl_minecarts:golden_rail"}, 5}, + {"dro", {"mcl_minecarts:activator_rail"}, 5}, + {"dro", {"mcl_minecarts:detector_rail"}, 5} + }) +end + +-- mcl_armor +if minetest.get_modpath("mcl_armor") then + + local tmp = "mcl_armor:" + + lucky_block:add_blocks({ + {"dro", { + tmp.."leather_helmet", tmp.."leather_chestplate", + tmp.."leather_leggings", tmp.."leather_boots" + }, 1}, + {"dro", { + tmp.."gold_helmet", tmp.."gold_chestplate", + tmp.."gold_leggings", tmp.."gold_boots" + }, 1}, + {"dro", { + tmp.."chain_helmet", tmp.."chain_chestplate", + tmp.."chain_leggings", tmp.."chain_boots" + }, 1}, + {"dro", { + tmp.."iron_helmet", tmp.."iron_chestplate", + tmp.."iron_leggings", tmp.."iron_boots" + }, 1}, + {"dro", { + tmp.."diamond_helmet", tmp.."diamond_chestplate", + tmp.."diamond_leggings", tmp.."diamond_boots" + }, 1}, + {"dro", { + tmp.."netherite_helmet", tmp.."netherite_chestplate", + tmp.."netherite_leggings", tmp.."netherite_boots" + }, 1} + }) +end + +-- mcl_fire +if minetest.get_modpath("mcl_fire") then + + lucky_block:add_blocks({ + {"dro", {"mcl_fire:flint_and_steel"}}, + {"nod", "mcl_fire:fire", 1}, + {"nod", "mcl_fire:eternal_fire", 1}, + {"sch", "firetrap", 1, true, { {"fire:basic_flame", "mcl_fire:fire"} }}, + }) +end + +-- mcl_tnt +if minetest.get_modpath("mcl_tnt") then + + local p = "mcl_tnt:tnt" + + lucky_block:add_blocks({ + {"dro", {"mcl_mobitems:gunpowder"}, 5}, + {"fal", {p, p, p, p, p}, 1, true, 4}, + {"nod", p, 0} + }) +end + +-- mobs_mc +if minetest.get_modpath("mobs_mc") then + + lucky_block:add_blocks({ + --{"spw", {"entity name"}, how many to spawn, tamed, owned, range, nametag} + {"spa", {"mobs_mc:bat"}, 3, nil, nil, 5, nil}, + {"spa", {"mobs_mc:chicken"}, 4, nil, nil, 5, "Chicken Squad"}, + {"spa", {"mobs_mc:creeper"}, 1, nil, nil, 3, "Mr. Boombastic"}, + {"spa", {"mobs_mc:parrot"}, 4, nil, nil, 5, "Parrot Party"}, + {"spa", {"mobs_mc:sheep"}, 1, true, true, 5, nil}, + {"spa", {"mobs_mc:silverfish"}, 5, nil, nil, 5, nil}, + {"spa", {"mobs_mc:spider"}, 3, nil, nil, 5, nil}, + {"spa", {"mobs_mc:witch"}, 1, nil, nil, 3, "Ezmerelda"}, + {"spa", {"mobs_mc:wolf"}, 2, nil, nil, 3, nil}, + {"spa", {"mobs_mc:zombie"}, 3, nil, nil, 5, nil}, + {"spa", {"mobs_mc:pig"}, 2, nil, nil, 5, nil} + }) +end diff --git a/blocks_mod.lua b/blocks_mod.lua new file mode 100644 index 0000000..62dfa48 --- /dev/null +++ b/blocks_mod.lua @@ -0,0 +1,161 @@ + +-- extra doors mod +if minetest.get_modpath("extra_doors") then + + lucky_block:add_blocks({ + {"dro", {"default:steel_rod"}, 10}, + {"dro", {"extra_doors:door_woodpanel1"}, 1}, + {"dro", {"extra_doors:door_woodglass1"}, 1}, + {"dro", {"extra_doors:door_woodglass2"}, 1}, + {"dro", {"extra_doors:door_door_japanese"}, 1}, + {"dro", {"extra_doors:door_door_french"}, 1}, + {"dro", {"extra_doors:door_door_cottage1"}, 1}, + {"dro", {"extra_doors:door_door_cottage2"}, 1}, + {"dro", {"extra_doors:door_door_barn1"}, 1}, + {"lig"}, + {"dro", {"extra_doors:door_door_barn2"}, 1}, + {"dro", {"extra_doors:door_door_castle1"}, 1}, + {"dro", {"extra_doors:door_door_castle2"}, 1}, + {"dro", {"extra_doors:door_door_mansion1"}, 1}, + {"dro", {"extra_doors:door_door_mansion2"}, 1}, + {"dro", {"extra_doors:door_door_dungeon1"}, 1}, + {"dro", {"extra_doors:door_door_dungeon2"}, 1}, + {"dro", {"extra_doors:door_door_steelpanel1"}, 1}, + {"dro", {"extra_doors:door_door_steelglass1"}, 1}, + {"dro", {"extra_doors:door_door_steelglass2"}, 1} + }) +end + +-- Home Decor mod +if minetest.get_modpath("homedecor") then + + lucky_block:add_blocks({ + {"nod", "homedecor:toilet", 0}, + {"nod", "homedecor:table", 0}, + {"nod", "homedecor:chair", 0}, + {"nod", "homedecor:table_lamp_off", 0}, + {"dro", {"homedecor:plastic_sheeting", "homedecor:plastic_base"}, 15}, + {"dro", {"homedecor:roof_tile_terracotta"}, 20}, + {"dro", {"homedecor:shutter_oak"}, 5}, + {"dro", {"homedecor:shutter_black"}, 5}, + {"dro", {"homedecor:shutter_dark_grey"}, 5}, + {"dro", {"homedecor:shutter_grey"}, 5}, + {"dro", {"homedecor:shutter_white"}, 5}, + {"dro", {"homedecor:shutter_mahogany"}, 5}, + {"dro", {"homedecor:shutter_yellow"}, 5}, + {"dro", {"homedecor:shutter_forest_green"}, 5}, + {"dro", {"homedecor:shutter_light_blue"}, 5}, + {"dro", {"homedecor:shutter_violet"}, 5}, + {"dro", {"homedecor:table_legs_wrought_iron", "homedecor:utility_table_legs"}, 5}, + {"dro", {"homedecor:pole_wrought_iron"}, 10}, + {"dro", {"homedecor:fence_picket_white"}, 20} + }) +end + +-- Caverealms +if minetest.get_modpath("caverealms") then + + lucky_block:add_blocks({ + {"sch", "sandtrap", 1, true, {{"default:sand", "caverealms:coal_dust"}} }, + {"sch", "obsidiantrap", 1, true, {{"default:obsidian", + "caverealms:glow_obsidian_brick_2"}} }, + {"flo", 5, {"caverealms:stone_with_moss"}, 2}, + {"flo", 5, {"caverealms:stone_with_lichen"}, 2}, + {"flo", 5, {"caverealms:stone_with_algae"}, 2}, + }) +end + +-- 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"}, 10}, + {"dro", {p.."wood_tile_center"}, 10}, + {"dro", {p.."wood_tile_full"}, 10}, + {"dro", {p.."wood_tile_offset"}, 10}, + {"dro", {p.."circle_stone_bricks"}, 20}, + {"dro", {p.."grey_bricks"}, 20}, + {"dro", {p.."stone_tile"}, 10}, + {"dro", {p.."split_stone_tile"}, 10}, + {"dro", {p.."split_stone_tile_alt"}, 10}, + {"flo", 5, {"moreblocks:stone_tile", "moreblocks:split_stone_tile"}, 2}, + {"dro", {p.."tar", p.."cobble_compressed"}, 10}, + {"dro", {p.."cactus_brick"}, 10}, + {"dro", {p.."cactus_checker"}, 10}, + {"nod", {p.."empty_bookshelf"}, 0}, + {"dro", {p.."coal_stone"}, 10}, + {"dro", {p.."coal_checker"}, 10}, + {"dro", {p.."coal_stone_bricks"}, 10}, + {"dro", {p.."coal_glass"}, 10}, + {"exp", 3}, + {"dro", {p.."iron_stone"}, 10}, + {"dro", {p.."iron_checker"}, 10}, + {"dro", {p.."iron_stone_bricks"}, 10}, + {"dro", {p.."iron_glass"}, 10}, + {"dro", {p.."trap_obsidian"}, 10}, + {"dro", {p.."trap_sandstone"}, 10}, + {"dro", {p.."trap_desert_stone"}, 10}, + {"dro", {p.."trap_stone"}, 10}, + {"dro", {p.."trap_glass"}, 10}, + {"dro", {p.."trap_glow_glass"}, 10}, + {"dro", {p.."trap_obsidian_glass"}, 10}, + {"lig"}, + {"sch", "trapstonetrap", 0, true}, + {"dro", {p.."all_faces_tree"}, 10}, + {"dro", {p.."all_faces_jungle_tree"}, 10}, + {"dro", {p.."all_faces_pine_tree"}, 10}, + {"dro", {p.."all_faces_acacia_tree"}, 10}, + {"dro", {p.."all_faces_aspen_tree"}, 10}, + {"flo", 3, {p.."all_faces_acacia_tree"}, 1}, + {"dro", {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"}, 10}, + {"dro", {p.."super_glow_glass"}, 10}, + {"dro", {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 + +-- worm farm mod +if minetest.get_modpath("worm_farm") then + + lucky_block:add_blocks({ + {"nod", "default:chest", 0, { + {name = "ethereal:worm", max = 5}, + {name = "worm_farm:worm_tea", max = 5}, + {name = "ethereal:worm", max = 5}, + {name = "worm_farm:worm_farm", max = 1} + }}, + {"cus", dropsy, {item = "ethereal:worm", msg = "Worm Attack!"}}, + {"dro", {"worm_farm:worm_farm"}, 1} + }) +end diff --git a/depends.txt b/depends.txt index 9e12050..9691d97 100644 --- a/depends.txt +++ b/depends.txt @@ -1,5 +1,6 @@ -default +default? tnt? screwdriver? intllib? - +mcl_core? +mcl_sounds? diff --git a/init.lua b/init.lua index 45bc887..3034fb2 100644 --- a/init.lua +++ b/init.lua @@ -1,12 +1,60 @@ -lucky_block = {} +-- mod check +local def = minetest.get_modpath("default") +local mcl = minetest.get_modpath("mcl_core") + +-- global +lucky_block = { + mod_def = def, + mod_mcl = mcl, + snd_stone = def and default.node_sound_stone_defaults(), + snd_wood = def and default.node_sound_wood_defaults(), + snd_glass = def and default.node_sound_glass_defaults(), + snd_pop = "default_hard_footstep", + snd_pop2 = "default_place_node", + def_item = "default:coal_lump", + def_node = mcl and "mcl_core:dirt" or "default:dirt", + def_flame = mcl and "mcl_fire:fire" or "fire:basic_flame", + def_gold = mcl and "mcl_core:goldblock" or "default:goldblock", + def_glass = mcl and "mcl_core:glass" or "default:glass", + green = minetest.get_color_escape_sequence("#1eff00") +} + lucky_schems = {} --- Load support for intllib. -local MP = minetest.get_modpath(minetest.get_current_modname()) -local S = minetest.get_translator and minetest.get_translator("lucky_block") or - dofile(MP .. "/intllib.lua") +-- quick sound setup +if mcl then + + lucky_block.snd_glass = mcl_sounds.node_sound_glass_defaults() + lucky_block.snd_wood = mcl_sounds.node_sound_wood_defaults() + lucky_block.snd_stone = mcl_sounds.node_sound_stone_defaults() +end + + +-- translation support +local S +if minetest.get_translator ~= nil then + S = minetest.get_translator("lucky_block") -- 5.x translation function +else + if minetest.get_modpath("intllib") then + dofile(minetest.get_modpath("intllib") .. "/init.lua") + if intllib.make_gettext_pair then + gettext, ngettext = intllib.make_gettext_pair() -- new gettext method + else + gettext = intllib.Getter() -- old text file method + end + S = gettext + else -- boilerplate function + S = function(str, ...) + local args = {...} + return str:gsub("@%d+", function(match) + return args[tonumber(match:sub(2))] + end) + end + end +end +lucky_block.intllib = S -- default blocks @@ -42,27 +90,22 @@ function lucky_block:add_schematics(list) end --- import schematics and default blocks -dofile(minetest.get_modpath("lucky_block") .. "/schems.lua") -dofile(minetest.get_modpath("lucky_block") .. "/blocks.lua") - - -- for random colour selection local all_colours = { "grey", "black", "red", "yellow", "green", "cyan", "blue", "magenta", "orange", "violet", "brown", "pink", "dark_grey", "dark_green", "white" } --- default items in chests -local chest_stuff = { - {name = "default:wood", max = 5}, - {name = "default:apple", max = 3}, - {name = "default:steel_ingot", max = 3}, - {name = "default:gold_ingot", max = 3, chance = 2}, - {name = "default:diamond", max = 2, chance = 3}, - {name = "default:mese_crystal_fragment", max = 3, chance = 3}, - {name = "default:pick_steel", max = 1, chance = 2, min_wear = 20000, max_wear = 65536} -} +if lucky_block.mcl then + all_colours = { + "red", "blue", "cyan", "grey", "silver", "black", "yellow", "green", "magenta", + "orange", "purple", "brown", "pink", "lime", "light_blue", "white" + } +end + + +-- default chests items +local chest_stuff = {} -- call to purge the chest item list @@ -198,14 +241,9 @@ local function explode(pos, radius, sound) if minetest.get_modpath("tnt") and tnt and tnt.boom and not minetest.is_protected(pos, "") then - tnt.boom(pos, { - radius = radius, - damage_radius = radius, - sound = sound - }) + tnt.boom(pos, {radius = radius, damage_radius = radius, sound = sound}) else - minetest.sound_play(sound, { - pos = pos, gain = 1.0, max_hear_distance = 32}, true) + minetest.sound_play(sound, {pos = pos, gain = 1.0, max_hear_distance = 32}, true) entity_physics(pos, radius) @@ -259,14 +297,15 @@ local lb_node = function(pos, digger, def) end if not minetest.registered_nodes[nod] then - nod = "default:goldblock" + nod = lucky_block.def_node end effect(pos, 25, "tnt_smoke.png", 8, 8, 2, 1, 0) minetest.set_node(pos, {name = nod}) - if nod == "default:chest" then + if nod == "default:chest" + or nod == "mcl_chests:chest_small" then fill_chest(pos, items) end end @@ -370,7 +409,7 @@ local lb_teleport = function(pos, digger, def) effect(pos, 25, "tnt_smoke.png", 8, 8, 1, -10, 0) minetest.chat_send_player(digger:get_player_name(), - minetest.get_color_escape_sequence("#1eff00") .. S("Random Teleport!")) + lucky_block.green .. S("Random Teleport!")) end @@ -392,7 +431,7 @@ local lb_drop = function(pos, digger, def) end if not minetest.registered_items[item] then - item = "default:coal_lump" + item = lucky_block.def_item end local obj = minetest.add_item(pos, item) @@ -412,7 +451,7 @@ local lb_drop = function(pos, digger, def) local item = def[2][1] if not minetest.registered_items[item] then - item = ItemStack("default:coal_lump " .. tonumber(num)) + item = ItemStack(lucky_block.def_item .. " " .. tonumber(num)) else item = ItemStack(item .. " " .. tonumber(num)) end @@ -436,7 +475,7 @@ local lb_lightning = function(pos, digger, def) local nod = def[2] if not minetest.registered_nodes[nod] then - nod = "fire:basic_flame" + nod = lucky_block.def_flame end pos = digger:get_pos() @@ -523,16 +562,14 @@ local lb_troll = function(pos, def) local snd = def[3] local exp = def[4] + if not minetest.registered_nodes[nod] then + nod = lucky_block.def_gold + end + minetest.set_node(pos, {name = nod}) if snd then - - minetest.sound_play(snd, { - pos = pos, gain = 1.0, max_hear_distance = 10}, true) - end - - if not minetest.registered_nodes[nod] then - nod = "default:goldblock" + minetest.sound_play(snd, {pos = pos, gain = 1.0, max_hear_distance = 10}, true) end minetest.after(2.0, function() @@ -546,7 +583,7 @@ local lb_troll = function(pos, def) minetest.set_node(pos, {name = "air"}) - minetest.sound_play("default_hard_footstep", { + minetest.sound_play(lucky_block.snd_pop, { pos = pos, gain = 1.0, max_hear_distance = 10}, true) end end) @@ -556,7 +593,7 @@ end local lb_floor = function(pos, def) local size = def[2] or 1 - local nods = def[3] or {"default:dirt"} + local nods = def[3] or {lucky_block.def_node} local offs = def[4] or 0 local num = 1 @@ -565,13 +602,16 @@ local lb_floor = function(pos, def) minetest.after(0.5 * num, function() + local nod = nods[math.random(#nods)] + local def = minetest.registered_nodes[nod] + local snd = def and def.sounds and def.sounds.place + minetest.set_node({ x = (pos.x + x) - offs, y = pos.y - 1, - z = (pos.z + z) - offs - }, {name = nods[math.random(#nods)]}) + z = (pos.z + z) - offs}, {name = nod}) - minetest.sound_play("default_place_node", { + minetest.sound_play(snd, { pos = pos, gain = 1.0, max_hear_distance = 10}, true) end) @@ -591,67 +631,44 @@ function lucky_block:open(pos, digger, blocks_list) math.randomseed(minetest.get_timeofday() + pos.x + pos.z - os.time()) local luck = math.random(#blocks_list) ; -- luck = 1 - local action = blocks_list[luck][1] + local result = blocks_list[luck] + local action = result[1] -- print ("luck ["..luck.." of "..#blocks_list.."]", action) -- place schematic - if action == "sch" then - - lb_schematic(pos, digger, blocks_list[luck]) + if action == "sch" then lb_schematic(pos, digger, result) -- place node (if chest then fill chest) - elseif action == "nod" then - - lb_node(pos, digger, blocks_list[luck]) + elseif action == "nod" then lb_node(pos, digger, result) -- place entity - elseif action == "spw" then - - lb_spawn(pos, digger, blocks_list[luck]) + elseif action == "spw" then lb_spawn(pos, digger, result) -- explosion - elseif action == "exp" then - - lb_explode(pos, blocks_list[luck]) + elseif action == "exp" then lb_explode(pos, result) -- teleport - elseif action == "tel" then - - lb_teleport(pos, digger, blocks_list[luck]) + elseif action == "tel" then lb_teleport(pos, digger, result) -- drop items - elseif action == "dro" then - - lb_drop(pos, digger, blocks_list[luck]) + elseif action == "dro" then lb_drop(pos, digger, result) -- lightning strike - elseif action == "lig" then - - lb_lightning(pos, digger, blocks_list[luck]) + elseif action == "lig" then lb_lightning(pos, digger, result) -- falling nodes - elseif action == "fal" then - - lb_falling(pos, digger, blocks_list[luck]) + elseif action == "fal" then lb_falling(pos, digger, result) -- troll block, disappears or explodes after 2 seconds - elseif action == "tro" then - - lb_troll(pos, blocks_list[luck]) + elseif action == "tro" then lb_troll(pos, result) -- floor paint - elseif action == "flo" then - - lb_floor(pos, blocks_list[luck]) + elseif action == "flo" then lb_floor(pos, result) -- custom function elseif action == "cus" then - - local func = blocks_list[luck][2] - local def = blocks_list[luck][3] - - if func then func(pos, digger, def) end + if result[2] then result[2](pos, digger, result[3]) end end end @@ -670,9 +687,9 @@ minetest.register_node("lucky_block:lucky_block", { is_ground_content = false, paramtype = "light", light_source = 3, - groups = {oddly_breakable_by_hand = 3, unbreakable = 1}, + groups = {handy = 2, oddly_breakable_by_hand = 3, unbreakable = 1}, drop = {}, - sounds = default.node_sound_wood_defaults(), + sounds = lucky_block.snd_wood, on_dig = function(pos, node, digger) @@ -681,7 +698,10 @@ minetest.register_node("lucky_block:lucky_block", { lucky_block:open(pos, digger) end, - on_blast = function() end + on_blast = function() end, + + _mcl_hardness = 0.6, + _mcl_blast_resistance = 1200 }) minetest.register_craft({ @@ -707,9 +727,9 @@ minetest.register_node("lucky_block:super_lucky_block", { sunlight_propagates = false, is_ground_content = false, paramtype = "light", - groups = {cracky = 1, level = 2, unbreakable = 1}, + groups = {pickaxey = 5, cracky = 1, level = 2, unbreakable = 1, material_stone = 1}, drop = {}, - sounds = default.node_sound_stone_defaults(), + sounds = lucky_block.snd_stone, on_construct = function(pos) @@ -731,7 +751,7 @@ minetest.register_node("lucky_block:super_lucky_block", { if math.random(5) == 1 then pos.y = pos.y + 0.5 - minetest.add_item(pos, "default:goldblock " .. math.random(5)) + minetest.add_item(pos, lucky_block.def_gold .. " " .. math.random(5)) end else @@ -739,10 +759,35 @@ minetest.register_node("lucky_block:super_lucky_block", { end end, - on_blast = function() end + on_blast = function() end, + + _mcl_hardness = 2, + _mcl_blast_resistance = 1200 }) +local path = minetest.get_modpath("lucky_block") + +-- import schematics +dofile(path .. "/schems.lua") + +-- wishing well & drops +dofile(path .. "/wishing_well.lua") + +-- lucky block special items and blocks +dofile(path .. "/blocks_lb.lua") + +-- if mineclone detected then load specific lucky blocks +if mcl then + dofile(path .. "/blocks_mcl.lua") +else + dofile(path .. "/blocks_def.lua") +end + +-- 3rd party mod lucky blocks +dofile(path .. "/blocks_mod.lua") + + minetest.after(0, function() print("[MOD] Lucky Blocks loaded: ", #lucky_list) end) diff --git a/mod.conf b/mod.conf index f0424c3..2dc7207 100644 --- a/mod.conf +++ b/mod.conf @@ -1,4 +1,4 @@ name = lucky_block -depends = default -optional_depends = tnt, screwdriver, intllib +depends = +optional_depends = default, mcl_core, mcl_sounds, tnt, screwdriver, intllib description = Adds lucky blocks into the game which may give good, bad, hurtful items when open :) diff --git a/schems.lua b/schems.lua index 6f706a7..f94082e 100644 --- a/schems.lua +++ b/schems.lua @@ -152,36 +152,6 @@ local obsidian_trap = { } } -local stb = {name = "default:steelblock", param1 = 255} -local sbr = {name = "default:stonebrick", param1 = 255} -local fwd = {name = "default:fence_wood", param1 = 255} -local slb = {name = "stairs:slab_stonebrick", param1 = 255} -local wbl = {name = "lucky_block:well_block", param1 = 255} -local gla = {name = "default:glass", param1 = 255} - -local wishing_well = { - size = {x = 3, y = 5, z = 3}, - data = { - stb,sbr,stb, - sbr,sbr,sbr, - fwd,air,fwd, - fwd,air,fwd, - slb,slb,slb, - - sbr,wbl,sbr, - sbr,wat,sbr, - air,air,air, - air,air,air, - slb,gla,slb, - - stb,sbr,stb, - sbr,sbr,sbr, - fwd,air,fwd, - fwd,air,fwd, - slb,slb,slb - } -} - -- add schematics to list lucky_block:add_schematics({ @@ -191,130 +161,5 @@ lucky_block:add_schematics({ {"platform", platform, {x = 2, y = 1, z = 2}}, {"instafarm", insta_farm, {x = 2, y = 2, z = 1}}, {"firetrap", fire_trap, {x = 1, y = 0, z = 1}}, - {"obsidiantrap", obsidian_trap, {x = 1, y = 0, z = 1}}, - {"wishingwell", wishing_well, {x = 1, y = 1, z = 1}} -}) - --- wishing well - -minetest.register_node("lucky_block:well_block", { - description = "Well Block", - tiles = {"default_glass.png"}, - light_source = 5, - groups = {not_in_creative_inventory = 1, unbreakable = 1}, - on_blast = function() end, - drop = {} -}) - - --- Global list containing well blocks that can be dropped -lucky_block.wellblocks = { - {"default:ice", 5}, - {"default:bronzeblock", 2}, - {"default:lava_source", 7}, - {"default:coalblock", 4}, - {"default:sand", 7}, - {"default:goldblock", 2}, - {"default:cactus", 5}, - {"default:cobble", 5}, - {"default:brick", 5}, - {"fire:permanent_flame", 7}, - {"default:desert_sand", 7}, - {"default:grass_5", 7}, - {"default:obsidian", 4}, - {"default:diamondblock", 2}, - {"default:dirt", 7}, - {"default:clay", 5}, - {"default:copperblock", 2}, - {"default:mese", 2}, - {"default:silver_sand", 7}, - {"default:snowblock", 7}, - {"default:mossycobble", 5}, - {"default:lava_source", 5}, - {"default:blueberry_bush_leaves_with_berries", 4}, - {"default:coral_skeleton", 4}, - {"default:coral_orange", 4}, - {"default:coral_brown", 4}, - {"default:gravel", 5}, - {"default:permafrost_with_moss", 4}, - {"default:stone_with_diamond", 4}, - {"default:stone_with_gold", 4}, - {"default:stone_with_copper", 4}, - {"default:lava_source", 4}, - {"default:stone_with_mese", 4}, - {"default:stone_with_coal", 4}, - {"default:stone_with_tin", 4}, - {"default:stone_with_iron", 4}, - {"fire:permanent_flame", 7} -} - -local add_wblock = function(name, number) - local total = #lucky_block.wellblocks - lucky_block.wellblocks[total + 1] = {name, number} -end - --- Add additional well blocks -if minetest.get_modpath("tnt") then - add_wblock("tnt:tnt_burning", 8) - add_wblock("tnt:tnt_burning", 4) - add_wblock("tnt:tnt_burning", 8) -end - -if minetest.get_modpath("ethereal") then - add_wblock("ethereal:crystal_block", 2) -end - -if minetest.get_modpath("bones") then - add_wblock("bones:bones", 4) -end - -minetest.register_abm({ - label = "Lucky Block Wishing Well Block", - nodenames = {"lucky_block:well_block"}, - interval = 2, - chance = 1, - catch_up = false, - - action = function(pos, node, active_object_count, active_object_count_wider) - - for _,object in pairs(minetest.get_objects_inside_radius(pos, 1.2)) do - - if object and object:is_player() then - - minetest.swap_node(pos, {name = "default:glass"}) - - minetest.sound_play("default_tool_breaks", { - pos = pos, gain = 1.0, max_hear_distance = 5}, true) - - local b_no = math.random(#lucky_block.wellblocks) - local item = lucky_block.wellblocks[b_no][1] - - for n = 1, lucky_block.wellblocks[b_no][2] do - - local nod = table.copy(minetest.registered_nodes[item]) - - if nod then - - local obj = minetest.add_entity({ - x = pos.x + math.random(-7, 7), - y = pos.y + 7, - z = pos.z + math.random(-7, 7) - }, "__builtin:falling_node") - - if obj then - - local ent = obj:get_luaentity() - - if ent then - nod.param2 = 1 -- set default rotation - ent:set_node(nod) - end - end - end - end - - break - end - end - end + {"obsidiantrap", obsidian_trap, {x = 1, y = 0, z = 1}} }) diff --git a/screenshot.jpg b/screenshot.jpg new file mode 100644 index 0000000..2d7f830 Binary files /dev/null and b/screenshot.jpg differ diff --git a/screenshot.png b/screenshot.png deleted file mode 100644 index e714c53..0000000 Binary files a/screenshot.png and /dev/null differ diff --git a/wishing_well.lua b/wishing_well.lua new file mode 100644 index 0000000..6c9681e --- /dev/null +++ b/wishing_well.lua @@ -0,0 +1,198 @@ + +-- well block (player stands near and it triggers drops) +minetest.register_node("lucky_block:well_block", { + description = "Well Block", + tiles = {"default_glass.png"}, + light_source = 5, + groups = {not_in_creative_inventory = 1, unbreakable = 1}, + on_blast = function() end, + drop = {} +}) + + +-- wishing well schematic layout +local stb = {name = "default:steelblock", param1 = 255} +local sbr = {name = "default:stonebrick", param1 = 255} +local fwd = {name = "default:fence_wood", param1 = 255} +local slb = {name = "stairs:slab_stonebrick", param1 = 255} +local wbl = {name = "lucky_block:well_block", param1 = 255} +local gla = {name = "default:glass", param1 = 255} +local air = {name = "air"} + +local wishing_well = { + size = {x = 3, y = 5, z = 3}, + data = { + stb,sbr,stb, + sbr,sbr,sbr, + fwd,air,fwd, + fwd,air,fwd, + slb,slb,slb, + + sbr,wbl,sbr, + sbr,wat,sbr, + air,air,air, + air,air,air, + slb,gla,slb, + + stb,sbr,stb, + sbr,sbr,sbr, + fwd,air,fwd, + fwd,air,fwd, + slb,slb,slb + } +} + + +-- add schematic to list +lucky_block:add_schematics({ + {"wishingwell", wishing_well, {x = 1, y = 1, z = 1}} +}) + + +-- Global list containing well blocks that can be dropped +lucky_block.wellblocks = {} + + +-- helper function +local add_wblock = function(list) + + for s = 1, #list do + table.insert(lucky_block.wellblocks, list[s]) + end +end + + +if lucky_block.mod_def then + + add_wblock({ + {"default:ice", 5}, + {"default:bronzeblock", 2}, + {"default:lava_source", 7}, + {"default:coalblock", 4}, + {"default:sand", 7}, + {"default:goldblock", 2}, + {"default:cactus", 5}, + {"default:cobble", 5}, + {"default:brick", 5}, + {"fire:permanent_flame", 7}, + {"default:desert_sand", 7}, + {"default:grass_5", 7}, + {"default:obsidian", 4}, + {"default:diamondblock", 2}, + {"default:dirt", 7}, + {"default:clay", 5}, + {"default:copperblock", 2}, + {"default:mese", 2}, + {"default:silver_sand", 7}, + {"default:snowblock", 7}, + {"default:mossycobble", 5}, + {"default:lava_source", 5}, + {"default:blueberry_bush_leaves_with_berries", 4}, + {"default:coral_skeleton", 4}, + {"default:coral_orange", 4}, + {"default:coral_brown", 4}, + {"default:gravel", 5}, + {"default:permafrost_with_moss", 4}, + {"default:stone_with_diamond", 4}, + {"default:stone_with_gold", 4}, + {"default:stone_with_copper", 4}, + {"default:lava_source", 4}, + {"default:stone_with_mese", 4}, + {"default:stone_with_coal", 4}, + {"default:stone_with_tin", 4}, + {"default:stone_with_iron", 4}, + {"fire:permanent_flame", 7} + }) +end + +if minetest.get_modpath("tnt") then + + add_wblock({ + {"tnt:tnt_burning", 8}, + {"tnt:tnt_burning", 4}, + {"tnt:tnt_burning", 8} + }) +end + +if minetest.get_modpath("ethereal") then + + add_wblock({ + {"ethereal:crystal_block", 2} + }) +end + +if minetest.get_modpath("bones") then + + add_wblock({ + {"bones:bones", 4} + }) +end + +if lucky_block.mod_mcl then + + add_wblock({ + {"mcl_core:diamondblock", 4}, + {"mcl_core:goldblock", 4}, + {"mcl_core:lava_source", 4}, + {"mcl_core:water_source", 4}, + {"mcl_core:sand", 7}, + {"mcl_core:gravel", 7}, + {"mcl_core:obsidian", 4}, + {"mcl_core:ironblock", 4}, + {"mcl_core:sandstone", 7}, + {"mcl_core:snow", 7} + }) +end + + +-- abm function to detect player and trigger drops +minetest.register_abm({ + label = "Lucky Block Wishing Well Block", + nodenames = {"lucky_block:well_block"}, + interval = 2, + chance = 1, + catch_up = false, + + action = function(pos, node, active_object_count, active_object_count_wider) + + for _,object in pairs(minetest.get_objects_inside_radius(pos, 1.2)) do + + if object and object:is_player() then + + minetest.swap_node(pos, {name = lucky_block.def_glass}) + + minetest.sound_play("default_tool_breaks", { + pos = pos, gain = 1.0, max_hear_distance = 5}, true) + + local b_no = math.random(#lucky_block.wellblocks) + local item = lucky_block.wellblocks[b_no][1] + + for n = 1, lucky_block.wellblocks[b_no][2] do + + local nod = table.copy(minetest.registered_nodes[item]) + + if nod then + + local obj = minetest.add_entity({ + x = pos.x + math.random(-7, 7), + y = pos.y + 7, + z = pos.z + math.random(-7, 7) + }, "__builtin:falling_node") + + if obj then + + local ent = obj:get_luaentity() + + if ent then + nod.param2 = 1 -- set default rotation + ent:set_node(nod) + end + end + end + end + + break + end + end + end +})