From 067fadf85d34776f187fbba76269314f4d620bf5 Mon Sep 17 00:00:00 2001 From: root Date: Mon, 15 Feb 2021 16:43:50 +0100 Subject: [PATCH] update --- mods/blox/init.lua | 14 +- mods/gloopblocks/depends.txt | 7 + mods/gloopblocks/init.lua | 940 +----------------- mods/gloopblocks/lava-handling.lua | 306 ++++++ mods/gloopblocks/main.lua | 839 ++++++++++++++++ .../models/gloopblocks_ash_pile.obj | 197 ++++ .../textures/gloopblocks_ashes.png | Bin 0 -> 564 bytes mods/skinsdb/meta/character_1948.txt | 3 + mods/skinsdb/textures/character_1948.png | Bin 0 -> 7276 bytes mods/techpack/gravelsieve/init.lua | 213 ++-- mods/vehicle_mash/README.md | 14 +- mods/vehicle_mash/framework.lua | 6 +- 12 files changed, 1531 insertions(+), 1008 deletions(-) create mode 100644 mods/gloopblocks/lava-handling.lua create mode 100644 mods/gloopblocks/main.lua create mode 100644 mods/gloopblocks/models/gloopblocks_ash_pile.obj create mode 100644 mods/gloopblocks/textures/gloopblocks_ashes.png create mode 100644 mods/skinsdb/meta/character_1948.txt create mode 100644 mods/skinsdb/textures/character_1948.png diff --git a/mods/blox/init.lua b/mods/blox/init.lua index 7515685d..5b6b67a7 100644 --- a/mods/blox/init.lua +++ b/mods/blox/init.lua @@ -113,7 +113,7 @@ for _, nodeclass in ipairs(NodeClass) do paramtype = "light", paramtype2 = "color", is_ground_content = true, - groups = {cracky=3, ud_param2_colorable = 1}, + groups = {cracky=3, stone=1, ud_param2_colorable = 1}, sounds = default.node_sound_stone_defaults(), on_construct = unifieddyes.on_construct, on_dig = unifieddyes.on_dig @@ -131,7 +131,7 @@ for _, nodeclass in ipairs(NodeClass) do paramtype = "light", paramtype2 = "color", is_ground_content = true, - groups = {cracky=3, ud_param2_colorable = 1}, + groups = {cracky=3, stone=2, ud_param2_colorable = 1}, sounds = default.node_sound_stone_defaults(), on_construct = unifieddyes.on_construct, on_dig = unifieddyes.on_dig @@ -149,7 +149,7 @@ for _, nodeclass in ipairs(NodeClass) do paramtype = "light", paramtype2 = "color", is_ground_content = true, - groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2,flammable=3, ud_param2_colorable = 1}, + groups = {snappy=2, choppy=2, wood=1, oddly_breakable_by_hand=2,flammable=3, ud_param2_colorable = 1}, sounds = default.node_sound_wood_defaults(), on_construct = unifieddyes.on_construct, on_dig = unifieddyes.on_dig @@ -169,7 +169,7 @@ minetest.register_node("blox:wood_tinted", { paramtype = "light", paramtype2 = "color", is_ground_content = true, - groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2,flammable=3, ud_param2_colorable = 1}, + groups = {snappy=2, choppy=2, wood=1, oddly_breakable_by_hand=2,flammable=3, ud_param2_colorable = 1}, sounds = default.node_sound_wood_defaults(), on_construct = unifieddyes.on_construct, on_dig = unifieddyes.on_dig @@ -182,7 +182,7 @@ minetest.register_node("blox:stone_square", { paramtype = "light", paramtype2 = "color", is_ground_content = true, - groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2,flammable=3, ud_param2_colorable = 1}, + groups = {snappy=2, choppy=2, stone=1, oddly_breakable_by_hand=2,flammable=3, ud_param2_colorable = 1}, sounds = default.node_sound_wood_defaults(), on_construct = unifieddyes.on_construct, on_dig = unifieddyes.on_dig @@ -195,7 +195,7 @@ minetest.register_node("blox:cobble_tinted", { paramtype = "light", paramtype2 = "color", is_ground_content = true, - groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2,flammable=3, not_in_creative_inventory = 1, ud_param2_colorable = 1}, + groups = {snappy=2, choppy=2, stone=2, oddly_breakable_by_hand=2,flammable=3, not_in_creative_inventory = 1, ud_param2_colorable = 1}, sounds = default.node_sound_wood_defaults(), on_construct = unifieddyes.on_construct, on_dig = unifieddyes.on_dig @@ -208,7 +208,7 @@ minetest.register_node("blox:stone_tinted", { paramtype = "light", paramtype2 = "color", is_ground_content = true, - groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2,flammable=3, not_in_creative_inventory = 1, ud_param2_colorable = 1}, + groups = {snappy=2, choppy=2, stone=1, oddly_breakable_by_hand=2,flammable=3, not_in_creative_inventory = 1, ud_param2_colorable = 1}, sounds = default.node_sound_wood_defaults(), on_construct = unifieddyes.on_construct, on_dig = unifieddyes.on_dig, diff --git a/mods/gloopblocks/depends.txt b/mods/gloopblocks/depends.txt index 57849e5d..dfc42992 100644 --- a/mods/gloopblocks/depends.txt +++ b/mods/gloopblocks/depends.txt @@ -13,3 +13,10 @@ nyancat? usesdirt? worldedit? signs_lib? +bakedclay? +farming? +wool? +bushes_classic? +dryplants? +bedrock? +cottages? diff --git a/mods/gloopblocks/init.lua b/mods/gloopblocks/init.lua index 570235d0..7a220e45 100644 --- a/mods/gloopblocks/init.lua +++ b/mods/gloopblocks/init.lua @@ -12,942 +12,8 @@ gloopblocks = {} local MP = minetest.get_modpath(minetest.get_current_modname()) local S, NS = dofile(MP.."/intllib.lua") --- Nodes - -minetest.register_node("gloopblocks:rainbow_block_diagonal", { - description = S("Diagonal Rainbow Block"), - tiles = {"gloopblocks_rainbow_block.png"}, - is_ground_content = true, - groups = {cracky=3}, - sounds = default.node_sound_defaults(), -}) -minetest.register_alias("gloopblocks:rainbow_block", "gloopblocks:rainbow_block_diagonal") - -minetest.register_node("gloopblocks:rainbow_block_horizontal", { - description = S("Horizontal Rainbow Block"), - tiles = { - "gloopblocks_rainbow_horizontal.png^[transformR90", - "gloopblocks_rainbow_horizontal.png^[transformR90", - "gloopblocks_rainbow_horizontal.png" - }, - paramtype = "light", - light_source = default.LIGHT_MAX, - paramtype2 = "facedir", - groups = {cracky = 2}, - is_ground_content = false, - sounds = default.node_sound_defaults(), -}) - -minetest.register_node("gloopblocks:evil_block", { - description = S("Evil Block"), - tiles = {"gloopblocks_evil_block.png"}, - light_source = 5, - is_ground_content = true, - groups = {cracky=2}, - sounds = default.node_sound_stone_defaults(), -}) - -minetest.register_node("gloopblocks:basalt", { - description = S("Basalt"), - tiles = {"gloopblocks_basalt.png"}, - groups = {cracky=2}, - sounds = default.node_sound_stone_defaults(), -}) - -minetest.register_node("gloopblocks:pumice", { - description = S("Pumice"), - tiles = {"gloopblocks_pumice.png"}, - groups = {cracky=3}, - sounds = default.node_sound_stone_defaults(), -}) - - -minetest.register_node("gloopblocks:pavement", { - description = S("Pavement"), - tiles = {"gloopblocks_pavement.png"}, - groups = {cracky=3, oddly_breakable_by_hand=3}, - sounds = default.node_sound_stone_defaults(), -}) - -minetest.register_node("gloopblocks:oerkki_block", { - drawtype = "nodebox", - description = S("Oerkki Block"), - paramtype = "light", - paramtype2 = "facedir", - tiles = { - "gloopblocks_oerkkiblock_tb.png", - "gloopblocks_oerkkiblock_tb.png", - "gloopblocks_oerkkiblock_sides.png", - "gloopblocks_oerkkiblock_sides.png", - "gloopblocks_oerkkiblock_sides.png", - "gloopblocks_oerkkiblock_front.png" - }, - groups = {cracky=3, oddly_breakable_by_hand=3}, - sounds = default.node_sound_stone_defaults(), - selection_box = { - type = "fixed", - fixed = { -0.5, -0.5, -0.5, 0.5, 0.5, 0.5 } - }, - node_box = { - type = "fixed", - fixed = { - {-0.5, -0.5, -0.1875, 0.5, 0.5, 0.1875}, -- NodeBox1 - {-0.5, -0.5, -0.5, -0.4375, 0.5, 0.5}, -- NodeBox2 - {0.4375, -0.5, -0.5, 0.5, 0.5, 0.5}, -- NodeBox3 - {-0.5, 0.4375, -0.5, 0.5, 0.5, 0.5}, -- NodeBox4 - {-0.5, -0.5, -0.5, 0.5, -0.4375, 0.5}, -- NodeBox5 - {-0.5, -0.0625, -0.5, 0.5, 0.0625, 0.5}, -- NodeBox6 - } - } -}) - -minetest.register_node("gloopblocks:stone_brick_mossy", { - description = S("Mossy Stone Brick"), - tiles = {"gloopblocks_stone_brick_mossy.png"}, - groups = {cracky=3, stone=1}, - sounds = default.node_sound_stone_defaults(), -}) - -minetest.register_node("gloopblocks:stone_mossy", { - description = S("Mossy Stone"), - tiles = {"gloopblocks_stone_mossy.png"}, - groups = {cracky=3, stone=1}, - sounds = default.node_sound_stone_defaults(), - drop = "default:mossycobble" -}) - -minetest.register_node("gloopblocks:cobble_road", { - description = S("Cobblestone Road Bed"), - tiles = {"gloopblocks_cobble_road.png"}, - groups = {cracky=3, stone=1}, - sounds = default.node_sound_stone_defaults(), -}) - -minetest.register_node("gloopblocks:cobble_road_mossy", { - description = S("Mossy Cobblestone Road Bed"), - tiles = {"gloopblocks_cobble_road_mossy.png"}, - groups = {cracky=3, stone=1}, - sounds = default.node_sound_stone_defaults(), -}) - -minetest.register_node("gloopblocks:scaffolding", { - description = S("Wooden Scaffold"), - drawtype = "allfaces", - paramtype = "light", - sunlight_propagates = true, - tiles = {"gloopblocks_scaffold.png"}, - groups = {choppy=3, oddly_breakable_by_hand=3}, - sounds = default.node_sound_wood_defaults(), -}) - -minetest.register_alias("moreblocks:oerkkiblock", "gloopblocks:oerkki_block") -minetest.register_alias("gloopblocks:obsidian", "default:obsidian") - --- Nodes imported from Usesdirt ================================================================================ - -if not minetest.get_modpath("usesdirt") then - - local dirt_brick_tex = "default_dirt.png^gloopblocks_dirt_brick_overlay.png" - local dirt_cobble_tex = "default_cobble.png^(default_dirt.png^[mask:gloopblocks_dirt_cobble_mask.png)" - local dirt_stone_tex = "default_stone.png^(default_dirt.png^[mask:gloopblocks_dirt_stone_mask.png)" - - local dirt_ladder_tex = "(default_dirt.png^[mask:gloopblocks_ladder_mask.png)^gloopblocks_ladder_overlay.png" - local dirt_brick_ladder_tex = "(("..dirt_brick_tex..")^[mask:gloopblocks_ladder_mask.png)^gloopblocks_ladder_overlay.png" - local dirt_cobble_ladder_tex = "(("..dirt_cobble_tex..")^[mask:gloopblocks_ladder_mask.png)^gloopblocks_ladder_overlay.png" - local dirt_stone_ladder_tex = "(("..dirt_stone_tex..")^[mask:gloopblocks_ladder_mask.png)^gloopblocks_ladder_overlay.png" - - minetest.register_node(":usesdirt:dirt_brick", { - tiles = { dirt_brick_tex }, - description = "Dirt Brick", - groups = {snappy=2,choppy=1,oddly_breakable_by_hand=2}, - }) - - minetest.register_node(":usesdirt:dirt_brick_ladder", { - description = "Dirt Brick Ladder", - drawtype = "signlike", - tiles = { dirt_brick_ladder_tex }, - inventory_image = dirt_brick_ladder_tex, - wield_image = dirt_brick_ladder_tex, - paramtype = "light", - paramtype2 = "wallmounted", - is_ground_content = true, - walkable = false, - climbable = true, - selection_box = { - type = "wallmounted", - --wall_top = = - --wall_bottom = = - --wall_side = = - }, - groups = {cracky=3, stone=2}, - legacy_wallmounted = true, - }) - minetest.register_craft({ - output = 'usesdirt:dirt_brick_ladder 3', - recipe = { - {'usesdirt:dirt_brick', '', 'usesdirt:dirt_brick'}, - {'usesdirt:dirt_brick', 'usesdirt:dirt_brick','usesdirt:dirt_brick'}, - {'usesdirt:dirt_brick','','usesdirt:dirt_brick'}, - } - }) - - default.register_fence(":usesdirt:dirt_brick_fence", { - description = "Dirt Brick Fence", - texture = dirt_brick_tex, - inventory_image = "default_fence_overlay.png^("..dirt_brick_tex..")^default_fence_overlay.png^[makealpha:255,126,126", - wield_image = "default_fence_overlay.png^("..dirt_brick_tex..")^default_fence_overlay.png^[makealpha:255,126,126", - material = "usesdirt:dirt_brick", - groups = {cracky=3, stone=2}, - sounds = default.node_sound_stone_defaults(), - check_for_pole = true - }) - - if minetest.get_modpath("moreblocks") then - minetest.register_craft({ - output = 'usesdirt:dirt_brick 24', - recipe = { - {'moreblocks:dirt_compressed', 'moreblocks:dirt_compressed', '' }, - {'moreblocks:dirt_compressed', 'moreblocks:dirt_compressed', '' } - } - }) - else - minetest.register_craft({ - output = 'usesdirt:dirt_brick 6', - recipe = { - {'default:dirt', 'default:dirt', 'default:dirt'}, - {'default:dirt', 'default:dirt', 'default:dirt'}, - {'default:dirt', 'default:dirt', 'default:dirt'}, - } - }) - end - - minetest.register_node(":usesdirt:dirt_ladder", { - description = "Dirt Ladder", - drawtype = "signlike", - tiles = { dirt_ladder_tex }, - inventory_image = dirt_ladder_tex, - wield_image = dirt_ladder_tex, - paramtype = "light", - paramtype2 = "wallmounted", - is_ground_content = true, - walkable = false, - climbable = true, - selection_box = { - type = "wallmounted", - --wall_top = = - --wall_bottom = = - --wall_side = = - }, - groups = {snappy=2,choppy=2,oddly_breakable_by_hand=3}, - legacy_wallmounted = true, - }) - minetest.register_craft({ - output = 'usesdirt:dirt_ladder 3', - recipe = { - {'usesdirt:dirt_brick', '', 'usesdirt:dirt_brick'}, - {'usesdirt:dirt_brick', 'usesdirt:dirt_brick','usesdirt:dirt_brick'}, - {'usesdirt:dirt_brick','','usesdirt:dirt_brick'}, - } - }) - - default.register_fence(":usesdirt:dirt_fence", { - description = "Dirt Fence", - texture = "default_dirt.png", - inventory_image = "default_fence_overlay.png^default_dirt.png^default_fence_overlay.png^[makealpha:255,126,126", - wield_image = "default_fence_overlay.png^default_dirt.png^default_fence_overlay.png^[makealpha:255,126,126", - material = "default:dirt", - groups = {snappy=2,choppy=1,oddly_breakable_by_hand=3}, - sounds = default.node_sound_dirt_defaults(), - check_for_pole = true - }) - ----- - - minetest.register_node(":usesdirt:dirt_cobble_stone", { - tiles = { dirt_cobble_tex }, - description = "Dirt Cobble Stone", - is_ground_content = true, - groups = {cracky=3, stone=2}, - }) - minetest.register_craft({ - output = '"usesdirt:dirt_cobble_stone" 3', - recipe = { - {'usesdirt:dirt_brick', 'usesdirt:dirt_brick', 'usesdirt:dirt_brick'}, - {'usesdirt:dirt_brick', 'usesdirt:dirt_brick', 'usesdirt:dirt_brick'}, - {'usesdirt:dirt_brick', 'usesdirt:dirt_brick', 'usesdirt:dirt_brick'}, - } - }) - - minetest.register_node(":usesdirt:dirt_cobble_stone_ladder", { - description = "Dirt Cobble Stone Ladder", - drawtype = "signlike", - tiles = { dirt_cobble_ladder_tex }, - inventory_image = dirt_cobble_ladder_tex, - wield_image = dirt_cobble_ladder_tex, - paramtype = "light", - paramtype2 = "wallmounted", - is_ground_content = true, - walkable = false, - climbable = true, - selection_box = { - type = "wallmounted", - --wall_top = = - --wall_bottom = = - --wall_side = = - }, - groups = {cracky=3, stone=2}, - legacy_wallmounted = true, - }) - minetest.register_craft({ - output = 'usesdirt:dirt_cobble_stone_ladder 3', - recipe = { - {'usesdirt:dirt_cobble_stone', '', 'usesdirt:dirt_cobble_stone'}, - {'usesdirt:dirt_cobble_stone', 'usesdirt:dirt_cobble_stone','usesdirt:dirt_cobble_stone'}, - {'usesdirt:dirt_cobble_stone','','usesdirt:dirt_cobble_stone'}, - } - }) - - default.register_fence(":usesdirt:dirt_cobble_stone_fence", { - description = "Dirt Cobble Stone Fence", - texture = dirt_cobble_tex, - inventory_image = "default_fence_overlay.png^("..dirt_cobble_tex..")^default_fence_overlay.png^[makealpha:255,126,126", - wield_image = "default_fence_overlay.png^("..dirt_cobble_tex..")^default_fence_overlay.png^[makealpha:255,126,126", - material = "usesdirt:dirt_cobble_stone", - groups = {cracky=3, stone=2}, - sounds = default.node_sound_stone_defaults(), - check_for_pole = true - }) - ----- - - minetest.register_node(":usesdirt:dirt_stone", { - tiles = { dirt_stone_tex }, - description = "Dirt Stone", - is_ground_content = true, - groups = {cracky=3, stone=2}, - }) - - minetest.register_node(":usesdirt:dirt_stone_ladder", { - description = "Dirt Stone Ladder", - drawtype = "signlike", - tiles = { dirt_stone_ladder_tex }, - inventory_image = dirt_stone_ladder_tex, - wield_image = dirt_stone_ladder_tex, - paramtype = "light", - paramtype2 = "wallmounted", - is_ground_content = true, - walkable = false, - climbable = true, - selection_box = { - type = "wallmounted", - --wall_top = = - --wall_bottom = = - --wall_side = = - }, - groups = {cracky=3, stone=2}, - legacy_wallmounted = true, - }) - minetest.register_craft({ - output = 'usesdirt:dirt_stone_ladder 3', - recipe = { - {'usesdirt:dirt_stone', '', 'usesdirt:dirt_stone'}, - {'usesdirt:dirt_stone', 'usesdirt:dirt_stone','usesdirt:dirt_stone'}, - {'usesdirt:dirt_stone','','usesdirt:dirt_stone'}, - } - }) - - default.register_fence(":usesdirt:dirt_stone_fence", { - description = "Dirt Stone Fence", - texture = dirt_stone_tex, - inventory_image = "default_fence_overlay.png^("..dirt_stone_tex..")^default_fence_overlay.png^[makealpha:255,126,126", - wield_image = "default_fence_overlay.png^("..dirt_stone_tex..")^default_fence_overlay.png^[makealpha:255,126,126", - material = "usesdirt:dirt_stone", - groups = {cracky=3, stone=2}, - sounds = default.node_sound_stone_defaults(), - check_for_pole = true - }) -end - --- Stairs/slabs defs, conversion of normal -> mossy items - -if minetest.setting_getbool("gloopblocks_mossy_conversion") ~= false then - - function gloopblocks_register_mossy_conversion(mossyobjects) - for i in ipairs(mossyobjects) do - minetest.register_abm({ - nodenames = { mossyobjects[i][1] }, - neighbors = {"default:water_source", "default:water_flowing"}, - interval = 120, - chance = 50, - action = function(pos, node) - if minetest.find_node_near(pos, 2, "air") then - local fdir = node.param2 - minetest.add_node(pos, {name = mossyobjects[i][2], param2 = fdir}) - end - end, - }) - end - end -end - -if minetest.get_modpath("moreblocks") then - - stairsplus:register_all("gloopblocks", "oerkki_block", "gloopblocks:oerkki_block", { - description = S("Oerkki Block"), - tiles = { - "gloopblocks_oerkkiblock_tb.png", - "gloopblocks_oerkkiblock_tb.png", - "gloopblocks_oerkkiblock_sides.png", - "gloopblocks_oerkkiblock_sides.png", - "gloopblocks_oerkkiblock_sides.png", - "gloopblocks_oerkkiblock_front.png" - }, - groups = {cracky=2, not_in_creative_inventory=1}, - sounds = default.node_sound_stone_defaults(), - sunlight_propagates = true, - }) - - stairsplus:register_all("gloopblocks", "stone_brick_mossy", "gloopblocks:stone_brick_mossy", { - description = S("Mossy Stone Brick"), - tiles = {"gloopblocks_stone_brick_mossy.png"}, - groups = {cracky=1, not_in_creative_inventory=1}, - sounds = default.node_sound_stone_defaults(), - sunlight_propagates = true, - }) - - stairsplus:register_all("gloopblocks", "stone_mossy", "gloopblocks:stone_mossy", { - description = S("Mossy Stone"), - tiles = {"gloopblocks_stone_mossy.png"}, - groups = {cracky=1, not_in_creative_inventory=1}, - sounds = default.node_sound_stone_defaults(), - sunlight_propagates = true, - }) - - stairsplus:register_all("gloopblocks", "cobble_road", "gloopblocks:cobble_road", { - description = S("Cobblestone Roadbed"), - tiles = {"gloopblocks_cobble_road.png"}, - groups = {cracky=3, stone=1, not_in_creative_inventory=1}, - sounds = default.node_sound_stone_defaults(), - sunlight_propagates = true, - }) - - stairsplus:register_all("gloopblocks", "cobble_road_mossy", "gloopblocks:cobble_road_mossy", { - description = S("Mossy Cobblestone Roadbed"), - tiles = {"gloopblocks_cobble_road_mossy.png"}, - groups = {cracky=3, stone=1, not_in_creative_inventory=1}, - sounds = default.node_sound_stone_defaults(), - sunlight_propagates = true, - }) - - stairsplus:register_all("gloopblocks", "pavement", "gloopblocks:pavement", { - description = S("Pavement"), - tiles = {"gloopblocks_pavement.png"}, - groups = {cracky=2, not_in_creative_inventory=1}, - sounds = default.node_sound_stone_defaults(), - sunlight_propagates = true, - }) - - stairsplus:register_all("gloopblocks", "rainbow_block", "gloopblocks:rainbow_block", { - description = S("Rainbow Block"), - tiles = {"gloopblocks_rainbow_block.png"}, - groups = {cracky=3, not_in_creative_inventory=1}, - sounds = default.node_sound_defaults(), - sunlight_propagates = true, - }) - - stairsplus:register_all("gloopblocks", "evil_block", "gloopblocks:evil_block", { - description = S("Evil Block"), - tiles = {"gloopblocks_evil_block.png"}, - groups = {cracky=3, not_in_creative_inventory=1}, - sounds = default.node_sound_defaults(), - light_source = 5, - sunlight_propagates = true, - }) - - stairsplus:register_all("gloopblocks", "basalt", "gloopblocks:basalt", { - description = S("Basalt"), - tiles = {"gloopblocks_basalt.png"}, - groups = {cracky=2, not_in_creative_inventory=1}, - sounds = default.node_sound_stone_defaults(), - sunlight_propagates = true, - }) - - stairsplus:register_all("gloopblocks", "pumice", "gloopblocks:pumice", { - description = S("Pumice"), - tiles = {"gloopblocks_pumice.png"}, - groups = {cracky=3, not_in_creative_inventory=1}, - sounds = default.node_sound_stone_defaults(), - sunlight_propagates = true, - }) - - stairsplus:register_all("gloopblocks", "gravel", "default:gravel", { - description = S("Gravel"), - tiles = {"default_gravel.png"}, - groups = {crumbly = 2, falling_node = 1, not_in_creative_inventory=1}, - sounds = default.node_sound_stone_defaults(), - sunlight_propagates = false, - }) - - if minetest.get_modpath("caverealms") then - stairsplus:register_all("caverealms", "glow_crystal", "caverealms:glow_crystal", { - description = S("Glow Crystal"), - tiles = {"caverealms_glow_crystal.png"}, - groups = {cracky=3, not_in_creative_inventory=1}, - sounds = default.node_sound_glass_defaults(), - light_source = 12, - use_texture_alpha = true, - paramtype="light", - sunlight_propagates = true, - }) - - stairsplus:register_all("caverealms", "glow_emerald", "caverealms:glow_emerald", { - description = S("Glow Emerald"), - tiles = {"caverealms_glow_emerald.png"}, - groups = {cracky=3, not_in_creative_inventory=1}, - sounds = default.node_sound_glass_defaults(), - light_source = 12, - use_texture_alpha = true, - paramtype="light", - sunlight_propagates = true, - }) - - stairsplus:register_all("caverealms", "glow_mese", "caverealms:glow_mese", { - description = S("Glow Mese"), - tiles = {"caverealms_glow_mese.png"}, - groups = {cracky=3, not_in_creative_inventory=1}, - sounds = default.node_sound_glass_defaults(), - light_source = 12, - use_texture_alpha = true, - paramtype="light", - sunlight_propagates = true, - }) - end - - -- ABMs for mossy objects - - if minetest.setting_getbool("gloopblocks_mossy_conversion") ~= false then - - gloopblocks_register_mossy_conversion({ - { "moreblocks:stair_cobble", "moreblocks:stair_mossycobble" }, - { "moreblocks:stair_cobble_inner", "moreblocks:stair_mossycobble_inner" }, - { "moreblocks:stair_cobble_outer", "moreblocks:stair_mossycobble_outer" }, - { "moreblocks:stair_cobble_half", "moreblocks:stair_mossycobble_half" }, - { "moreblocks:slab_cobble_quarter", "moreblocks:slab_mossycobble_quarter" }, - { "moreblocks:slab_cobble", "moreblocks:slab_mossycobble" }, - { "moreblocks:slab_cobble_three_quarter", "moreblocks:slab_mossycobble_three_quarter" }, - { "moreblocks:panel_cobble", "moreblocks:panel_mossycobble" }, - { "moreblocks:micro_cobble", "moreblocks:micro_mossycobble" }, - { "moreblocks:stair_cobble_alt", "moreblocks:stair_mossycobble_alt" }, - - { "gloopblocks:cobble_road", "gloopblocks:cobble_road_mossy" }, - { "gloopblocks:stair_cobble_road", "gloopblocks:stair_cobble_road_mossy" }, - { "gloopblocks:slab_cobble_road", "gloopblocks:slab_cobble_road_mossy" }, - { "gloopblocks:stair_cobble_road", "gloopblocks:stair_cobble_road_mossy" }, - { "gloopblocks:stair_cobble_road_inner", "gloopblocks:stair_cobble_road_mossy_inner" }, - { "gloopblocks:stair_cobble_road_outer", "gloopblocks:stair_cobble_road_mossy_outer" }, - { "gloopblocks:stair_cobble_road_half", "gloopblocks:stair_cobble_road_mossy_half" }, - { "gloopblocks:slab_cobble_road_quarter", "gloopblocks:slab_cobble_road_mossy_quarter" }, - { "gloopblocks:slab_cobble_road", "gloopblocks:slab_cobble_road_mossy" }, - { "gloopblocks:slab_cobble_road_three_quarter", "gloopblocks:slab_cobble_road_mossy_three_quarter" }, - { "gloopblocks:panel_cobble_road", "gloopblocks:panel_cobble_road_mossy" }, - { "gloopblocks:micro_cobble_road", "gloopblocks:micro_cobble_road_mossy" }, - { "gloopblocks:stair_cobble_road_alt", "gloopblocks:stair_cobble_road_mossy_alt" }, - - { "default:stonebrick", "gloopblocks:stone_brick_mossy" }, - { "default:stair_stonebrick", "gloopblocks:stair_stone_brick_mossy" }, - { "default:slab_stonebrick", "gloopblocks:slab_stone_brick_mossy" }, - { "moreblocks:stair_stonebrick", "gloopblocks:stair_stone_brick_mossy" }, - { "moreblocks:stair_stonebrick_inner", "gloopblocks:stair_stone_brick_mossy_inner" }, - { "moreblocks:stair_stonebrick_outer", "gloopblocks:stair_stone_brick_mossy_outer" }, - { "moreblocks:stair_stonebrick_half", "gloopblocks:stair_stone_brick_mossy_half" }, - { "moreblocks:slab_stonebrick_quarter", "gloopblocks:slab_stone_brick_mossy_quarter" }, - { "moreblocks:slab_stonebrick", "gloopblocks:slab_stone_brick_mossy" }, - { "moreblocks:slab_stonebrick_three_quarter", "gloopblocks:slab_stone_brick_mossy_three_quarter" }, - { "moreblocks:panel_stonebrick", "gloopblocks:panel_stone_brick_mossy" }, - { "moreblocks:micro_stonebrick", "gloopblocks:micro_stone_brick_mossy" }, - { "moreblocks:stair_stonebrick_alt", "gloopblocks:stair_stone_brick_mossy_alt" }, - - { "default:stone", "gloopblocks:stone_mossy" }, - { "default:stair_stone", "gloopblocks:stair_stone_mossy" }, - { "default:slab_stone", "gloopblocks:slab_stone_mossy" }, - { "moreblocks:stair_stone", "gloopblocks:stair_stone_mossy" }, - { "moreblocks:stair_stone_inner", "gloopblocks:stair_stone_mossy_inner" }, - { "moreblocks:stair_stone_outer", "gloopblocks:stair_stone_mossy_outer" }, - { "moreblocks:stair_stone_half", "gloopblocks:stair_stone_mossy_half" }, - - { "moreblocks:slab_stone_quarter", "gloopblocks:slab_stone_mossy_quarter" }, - { "moreblocks:slab_stone", "gloopblocks:slab_stone_mossy" }, - { "moreblocks:slab_stone_three_quarter", "gloopblocks:slab_stone_mossy_three_quarter" }, - { "moreblocks:panel_stone", "gloopblocks:panel_stone_mossy" }, - { "moreblocks:micro_stone", "gloopblocks:micro_stone_mossy" }, - { "moreblocks:stair_stone_alt", "gloopblocks:stair_stone_mossy_alt" }, - }) - end - -elseif minetest.get_modpath("stairs") then - - --stairs.register_stair(subname, recipeitem, groups, images, description, sounds) - - -- stairs:xxxx_stone_mossy ; xxxx = stair or slab - stairs.register_stair_and_slab("stone_mossy", "gloopblocks:stone_mossy", - {cracky=3}, - {"gloopblocks_stone_mossy.png"}, - S("Mossy Stone Stair"), - S("Mossy Stone Slab"), - default.node_sound_stone_defaults()) - - -- stairs:xxxx_mossycobble - stairs.register_stair_and_slab("mossycobble", "default:mossycobble", - {cracky=3}, - {"default_mossycobble.png"}, - S("Mossy Cobble Stair"), - S("Mossy Cobble Slab"), - default.node_sound_stone_defaults()) - - -- stairs:xxxx_stone_brick_mossy - stairs.register_stair_and_slab("stone_brick_mossy", "gloopblocks:stone_brick_mossy", - {cracky=3}, - {"gloopblocks_stone_brick_mossy.png"}, - S("Mossy Stone Brick Stair"), - S("Mossy Stone Brick Slab"), - default.node_sound_stone_defaults()) - - -- stairs:xxxx_cobble_road - stairs.register_stair_and_slab("cobble_road", "gloopblocks:cobble_road", - {cracky=3}, - {"gloopblocks_cobble_road.png"}, - S("Cobble Roadbed Stair"), - S("Cobble Roadbed Slab"), - default.node_sound_stone_defaults()) - - -- stairs:xxxx_cobble_road_mossy - stairs.register_stair_and_slab("cobble_road_mossy", "gloopblocks:cobble_road_mossy", - {cracky=3}, - {"gloopblocks_cobble_road_mossy.png"}, - S("Mossy Cobble Roadbed Stair"), - S("Mossy Cobble Roadbed Slab"), - default.node_sound_stone_defaults()) - - -- stairs:xxxx_cement - stairs.register_stair_and_slab("cement", "gloopblocks:cement", - {cracky=2}, - {"basic_materials_cement_block.png"}, - S("Cement Stair"), - S("Cement Slab"), - default.node_sound_stone_defaults()) - - -- stairs:xxxx_pavement - stairs.register_stair_and_slab("pavement", "gloopblocks:pavement", - {cracky=3, oddly_breakable_by_hand=3}, - {"gloopblocks_pavement.png"}, - S("Pavement Stair"), - S("Pavement Slab"), - default.node_sound_stone_defaults()) - - stairs.register_stair_and_slab("basalt", "gloopblocks:basalt", - {cracky=2}, - {"gloopblocks_basalt.png"}, - S("Basalt Stair"), - S("Basalt Slab"), - default.node_sound_stone_defaults()) - - stairs.register_stair_and_slab("pumice", "gloopblocks:pumice", - {cracky=3}, - {"gloopblocks_pumice.png"}, - S("Pumice Stair"), - S("Pumice Slab"), - default.node_sound_stone_defaults()) - - stairs.register_stair_and_slab("rainbow_block", "gloopblocks:rainbow_block", - {cracky=3}, - {"gloopblocks_rainbow_block.png"}, - S("Rainbow Block Stair"), - S("Rainbow Block Slab"), - default.node_sound_defaults()) - - if minetest.setting_getbool("gloopblocks_mossy_conversion") ~= false then - - gloopblocks_register_mossy_conversion({ - { "default:cobble", "default:mossycobble" }, - { "stairs:stair_cobble", "stairs:stair_mossycobble" }, - { "stairs:slab_cobble", "stairs:slab_mossycobble" }, - { "gloopblocks:cobble_road", "gloopblocks:cobble_road_mossy" }, - { "stairs:stair_cobble_road", "stairs:stair_cobble_road_mossy" }, - { "stairs:slab_cobble_road", "stairs:slab_cobble_road_mossy" }, - { "default:stonebrick", "gloopblocks:stone_brick_mossy" }, - { "stairs:stair_stonebrick", "stairs:stair_stone_brick_mossy" }, - { "stairs:slab_stonebrick", "stairs:slab_stone_brick_mossy" }, - { "default:stone", "gloopblocks:stone_mossy" }, - { "stairs:stair_stone", "stairs:stair_stone_mossy" }, - { "stairs:slab_stone", "stairs:slab_stone_mossy" }, - }) - end - - minetest.register_alias("default:stair_mossycobble", "stairs:stair_mossycobble") - minetest.register_alias("default:slab_mossycobble", "stairs:slab_mossycobble") - minetest.register_alias("gloopblocks:stair_cobble_road", "stairs:stair_cobble_road") - minetest.register_alias("gloopblocks:slab_cobble_road", "stairs:slab_cobble_road") - minetest.register_alias("gloopblocks:stair_cobble_road_mossy", "stairs:stair_cobble_road_mossy") - minetest.register_alias("gloopblocks:slab_cobble_road_mossy", "stairs:slab_cobble_road_mossy") - minetest.register_alias("gloopblocks:stair_stone_brick_mossy", "stairs:stair_stone_brick_mossy") - minetest.register_alias("gloopblocks:slab_stone_brick_mossy", "stairs:slab_stone_brick_mossy") - minetest.register_alias("gloopblocks:stair_stone_mossy", "stairs:stair_stone_mossy") - minetest.register_alias("gloopblocks:slab_stone_mossy", "stairs:slab_stone_mossy") - minetest.register_alias("gloopblocks:stair_cement", "stairs:stair_cement") - minetest.register_alias("gloopblocks:slab_cement", "stairs:slab_cement") - minetest.register_alias("gloopblocks:stair_pavement", "stairs:stair_pavement") - minetest.register_alias("gloopblocks:slab_pavement", "stairs:slab_pavement") - minetest.register_alias("gloopblocks:stair_pumice", "stairs:stair_pumice") - minetest.register_alias("gloopblocks:slab_pumice", "stairs:slab_pumice") - minetest.register_alias("gloopblocks:stair_basalt", "stairs:stair_basalt") - minetest.register_alias("gloopblocks:slab_basalt", "stairs:slab_basalt") - minetest.register_alias("gloopblocks:stair_rainbow_block", "stairs:stair_rainbow_block") - minetest.register_alias("gloopblocks:slab_rainbow_block", "stairs:slab_rainbow_block") -end - --- Tools - -minetest.register_tool("gloopblocks:pick_cement", { - description = S("Cement Pickaxe"), - inventory_image = "gloopblocks_cement_pick.png", - tool_capabilities = { - full_punch_interval = 1.0, - max_drop_level=1, - groupcaps={ - cracky={times={[1]=3.50, [2]=1.40, [3]=0.90}, uses=25, maxlevel=2} - }, - damage_groups = {fleshy=4}, - }, -}) - -minetest.register_tool("gloopblocks:shovel_cement", { - description = S("Cement Shovel"), - inventory_image = "gloopblocks_cement_shovel.png", - tool_capabilities = { - full_punch_interval = 1.0, - max_drop_level=1, - groupcaps={ - crumbly={times={[1]=1.50, [2]=0.60, [3]=0.45}, uses=25, maxlevel=2} - }, - damage_groups = {fleshy=4}, - }, -}) - -minetest.register_tool("gloopblocks:axe_cement", { - description = S("Cement Axe"), - inventory_image = "gloopblocks_cement_axe.png", - tool_capabilities = { - full_punch_interval = 1.0, - max_drop_level=1, - groupcaps={ - choppy={times={[1]=3.00, [2]=1.30, [3]=0.80}, uses=25, maxlevel=2}, - fleshy={times={[2]=1.20, [3]=0.65}, uses=30, maxlevel=1} - }, - damage_groups = {fleshy=4}, - }, -}) - -minetest.register_tool("gloopblocks:sword_cement", { - description = S("Cement Sword"), - inventory_image = "gloopblocks_cement_sword.png", - tool_capabilities = { - full_punch_interval = 1.0, - max_drop_level=1, - groupcaps={ - fleshy={times={[1]=1.60, [2]=0.80, [3]=0.40}, uses=15, maxlevel=2}, - snappy={times={[2]=0.75, [3]=0.35}, uses=30, maxlevel=1}, - choppy={times={[3]=0.80}, uses=30, maxlevel=0} - }, - damage_groups = {fleshy=6}, - } -}) - -minetest.register_tool("gloopblocks:pick_evil", { - description = S("Evil Pickaxe"), - inventory_image = "gloopblocks_evil_pick.png", - tool_capabilities = { - full_punch_interval = 1.0, - max_drop_level=3, - groupcaps={ - cracky={times={[1]=0.10, [2]=0.10, [3]=0.10}, uses=10, maxlevel=2} - }, - damage_groups = {fleshy=6}, - }, -}) - -minetest.register_tool("gloopblocks:shovel_evil", { - description = S("Evil Shovel"), - inventory_image = "gloopblocks_evil_shovel.png", - tool_capabilities = { - full_punch_interval = 1.0, - max_drop_level=3, - groupcaps={ - crumbly={times={[1]=0.05, [2]=0.05, [3]=0.05}, uses=10, maxlevel=2} - }, - damage_groups = {fleshy=6}, - }, -}) - -minetest.register_tool("gloopblocks:axe_evil", { - description = S("Evil Axe"), - inventory_image = "gloopblocks_evil_axe.png", - tool_capabilities = { - full_punch_interval = 1.0, - max_drop_level=3, - groupcaps={ - choppy={times={[1]=0.15, [2]=0.15, [3]=0.15}, uses=10, maxlevel=2}, - fleshy={times={[1]=0.15, [2]=0.15, [3]=0.15}, uses=10, maxlevel=2} - }, - damage_groups = {fleshy=6}, - }, -}) - -minetest.register_tool("gloopblocks:sword_evil", { - description = S("Evil Sword"), - inventory_image = "gloopblocks_evil_sword.png", - tool_capabilities = { - full_punch_interval = 1.0, - max_drop_level=3, - groupcaps={ - fleshy={times={[1]=0.20, [2]=0.20, [3]=0.20}, uses=10, maxlevel=2}, - snappy={times={[1]=0.20, [2]=0.20, [3]=0.20}, uses=10, maxlevel=2}, - choppy={times={[1]=0.20, [2]=0.20, [3]=0.20}, uses=10, maxlevel=2} - }, - damage_groups = {fleshy=8}, - } -}) - --- Other items - -minetest.register_craftitem("gloopblocks:evil_stick", { - description = S("Evil Stick"), - inventory_image = "gloopblocks_evil_stick.png", -}) - --- define lava-cooling-based nodes and hook into the default lavacooling --- functions to generate basalt, pumice, and obsidian - -if minetest.setting_getbool("gloopblocks_lavacooling") ~= false then - - minetest.register_node("gloopblocks:obsidian_cooled", { - description = S("Obsidian"), - tiles = {"default_obsidian.png"}, - is_ground_content = true, - sounds = default.node_sound_stone_defaults(), - groups = {cracky=1, level=2, not_in_creative_inventory=1}, - drop = "default:obsidian", - after_place_node = function(pos, placer, itemstack, pointed_thing) - minetest.add_node(pos, {name = "default:obsidian"}) - end - }) - - minetest.register_node("gloopblocks:basalt_cooled", { - description = S("Basalt"), - tiles = {"gloopblocks_basalt.png"}, - groups = {cracky=2, not_in_creative_inventory=1}, - sounds = default.node_sound_stone_defaults(), - drop = "gloopblocks:basalt", - after_place_node = function(pos, placer, itemstack, pointed_thing) - minetest.add_node(pos, {name = "gloopblocks:basalt"}) - end - }) - - minetest.register_node("gloopblocks:pumice_cooled", { - description = S("Pumice"), - tiles = {"gloopblocks_pumice.png"}, - groups = {cracky=3, not_in_creative_inventory=1}, - sounds = default.node_sound_stone_defaults(), - drop = "gloopblocks:pumice", - after_place_node = function(pos, placer, itemstack, pointed_thing) - minetest.add_node(pos, {name = "gloopblocks:pumice"}) - end - }) - - local gloopblocks_search_nearby_nodes = function(pos, node) - if minetest.get_node({x=pos.x-1, y=pos.y, z=pos.z}).name == node then return true end - if minetest.get_node({x=pos.x+1, y=pos.y, z=pos.z}).name == node then return true end - if minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z}).name == node then return true end - if minetest.get_node({x=pos.x, y=pos.y+1, z=pos.z}).name == node then return true end - if minetest.get_node({x=pos.x, y=pos.y, z=pos.z-1}).name == node then return true end - if minetest.get_node({x=pos.x, y=pos.y, z=pos.z+1}).name == node then return true end - return false - end - - default.cool_lava = function(pos, node) - if node.name == "default:lava_source" then - if gloopblocks_search_nearby_nodes(pos,"default:water_source") - or gloopblocks_search_nearby_nodes(pos,"default:water_flowing") then - minetest.set_node(pos, {name="gloopblocks:obsidian_cooled"}) - end - else -- Lava flowing - if gloopblocks_search_nearby_nodes(pos,"default:water_source") then - minetest.set_node(pos, {name="gloopblocks:basalt_cooled"}) - elseif gloopblocks_search_nearby_nodes(pos,"default:water_flowing") then - minetest.set_node(pos, {name="gloopblocks:pumice_cooled"}) - end - end - end -end - -local fence_texture = - "default_fence_overlay.png^default_steel_block.png^default_fence_overlay.png^[makealpha:255,126,126" - -minetest.register_node("gloopblocks:fence_steel", { - description = S("Steel Fence"), - drawtype = "fencelike", - tiles = {"default_steel_block.png"}, - inventory_image = fence_texture, - wield_image = fence_texture, - paramtype = "light", - sunlight_propagates = true, - is_ground_content = false, - selection_box = { - type = "fixed", - fixed = {-1/7, -1/2, -1/7, 1/7, 1/2, 1/7}, - }, - groups = {choppy = 2, oddly_breakable_by_hand = 2 }, - sounds = default.node_sound_stone_defaults(), -}) - -if minetest.get_modpath("worldedit") then - function gloopblocks.liquid_ungrief(pos1, pos2, name) - local count - local p1to2 = minetest.pos_to_string(pos1).." and "..minetest.pos_to_string(pos2) - local volume = worldedit.volume(pos1, pos2) - minetest.chat_send_player(name, "Cleaning-up lava/water griefing between "..p1to2.."...") - if volume > 1000000 then - minetest.chat_send_player(name, "This operation could affect up to "..volume.." nodes. It may take a while.") - end - minetest.log("action", name.." performs lava/water greifing cleanup between "..p1to2..".") - count = worldedit.replace(pos1, pos2, "default:lava_source", "air") - count = worldedit.replace(pos1, pos2, "default:lava_flowing", "air") - count = worldedit.replace(pos1, pos2, "default:water_source", "air") - count = worldedit.replace(pos1, pos2, "default:water_flowing", "air") - count = worldedit.replace(pos1, pos2, "default:river_water_source", "air") - count = worldedit.replace(pos1, pos2, "default:river_water_flowing", "air") - count = worldedit.replace(pos1, pos2, "gloopblocks:pumice_cooled", "air") - count = worldedit.replace(pos1, pos2, "gloopblocks:basalt_cooled", "air") - count = worldedit.replace(pos1, pos2, "gloopblocks:obsidian_cooled", "air") - count = worldedit.fixlight(pos1, pos2) - minetest.chat_send_player(name, "Operation completed.") - end - - minetest.register_chatcommand("/liquid_ungrief", { - params = "[size]", - privs = {worldedit = true}, - description = "Repairs greifing caused by spilling lava and water (and their \"cooling\" results)", - func = function(name, params) - local pos1 = worldedit.pos1[name] - local pos2 = worldedit.pos2[name] - if not pos1 or not pos2 then return end - gloopblocks.liquid_ungrief(pos1, pos2, name) - end - }) -end - -dofile(minetest.get_modpath("gloopblocks").."/crafts.lua") - -minetest.register_alias("nyancat:nyancat_rainbow", "gloopblocks:rainbow_block_horizontal") -minetest.register_alias("default:nyancat_rainbow", "gloopblocks:rainbow_block_horizontal") +dofile(MP.."/main.lua") +dofile(MP.."/crafts.lua") +dofile(MP.."/lava-handling.lua") print(S("Gloopblocks Loaded!")) diff --git a/mods/gloopblocks/lava-handling.lua b/mods/gloopblocks/lava-handling.lua new file mode 100644 index 00000000..a2c083d6 --- /dev/null +++ b/mods/gloopblocks/lava-handling.lua @@ -0,0 +1,306 @@ +-- Load support for intllib. +local MP = minetest.get_modpath(minetest.get_current_modname()) +local S, NS = dofile(MP.."/intllib.lua") + +-- define lava-cooling-based nodes and hook into the default lavacooling +-- functions to generate basalt, pumice, and obsidian + +if minetest.setting_getbool("gloopblocks_lavacooling") ~= false then + + minetest.register_node("gloopblocks:obsidian_cooled", { + description = S("Obsidian"), + tiles = {"default_obsidian.png"}, + is_ground_content = true, + sounds = default.node_sound_stone_defaults(), + groups = {cracky=1, level=2, not_in_creative_inventory=1}, + drop = "default:obsidian", + after_place_node = function(pos, placer, itemstack, pointed_thing) + minetest.add_node(pos, {name = "default:obsidian"}) + end + }) + + minetest.register_node("gloopblocks:basalt_cooled", { + description = S("Basalt"), + tiles = {"gloopblocks_basalt.png"}, + groups = {cracky=2, not_in_creative_inventory=1}, + sounds = default.node_sound_stone_defaults(), + drop = "gloopblocks:basalt", + after_place_node = function(pos, placer, itemstack, pointed_thing) + minetest.add_node(pos, {name = "gloopblocks:basalt"}) + end + }) + + minetest.register_node("gloopblocks:pumice_cooled", { + description = S("Pumice"), + tiles = {"gloopblocks_pumice.png"}, + groups = {cracky=3, not_in_creative_inventory=1}, + sounds = default.node_sound_stone_defaults(), + drop = "gloopblocks:pumice", + after_place_node = function(pos, placer, itemstack, pointed_thing) + minetest.add_node(pos, {name = "gloopblocks:pumice"}) + end + }) + + local gloopblocks_search_nearby_nodes = function(pos, node) + if minetest.get_node({x=pos.x-1, y=pos.y, z=pos.z}).name == node then return true end + if minetest.get_node({x=pos.x+1, y=pos.y, z=pos.z}).name == node then return true end + if minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z}).name == node then return true end + if minetest.get_node({x=pos.x, y=pos.y+1, z=pos.z}).name == node then return true end + if minetest.get_node({x=pos.x, y=pos.y, z=pos.z-1}).name == node then return true end + if minetest.get_node({x=pos.x, y=pos.y, z=pos.z+1}).name == node then return true end + return false + end + + default.cool_lava = function(pos, node) + if node.name == "default:lava_source" then + if gloopblocks_search_nearby_nodes(pos,"default:water_source") + or gloopblocks_search_nearby_nodes(pos,"default:water_flowing") then + minetest.set_node(pos, {name="gloopblocks:obsidian_cooled"}) + end + else -- Lava flowing + if gloopblocks_search_nearby_nodes(pos,"default:water_source") then + minetest.set_node(pos, {name="gloopblocks:basalt_cooled"}) + elseif gloopblocks_search_nearby_nodes(pos,"default:water_flowing") then + minetest.set_node(pos, {name="gloopblocks:pumice_cooled"}) + end + end + end +end + +-- Allows lava to "bake" neighboring nodes (or reduce them to ashes) +-- disabled by default. You probably don't want this on a creative server :-P + +if minetest.setting_getbool("gloopblocks_lava_damage") then + minetest.register_node("gloopblocks:ash_block", { + description = S("Block of ashes"), + tiles = {"gloopblocks_ashes.png"}, + groups = {crumbly = 3}, + sounds = default.node_sound_dirt_defaults(), + }) + + local cbox = { + type = "fixed", + fixed = { -0.5, -0.5, -0.5, 0.5, -0.125, 0.5} + } + + minetest.register_node("gloopblocks:ash_pile", { + description = S("Pile of ashes"), + drawtype = "mesh", + mesh = "gloopblocks_ash_pile.obj", + tiles = {"gloopblocks_ashes.png"}, + selection_box = cbox, + collision_box = cbox, + groups = {crumbly = 3}, + sounds = default.node_sound_dirt_defaults(), + }) + + gloopblocks.lava_damage_nodes = { + ["default:cactus"] = "gloopblocks:ash_block", + ["default:coalblock"] = "gloopblocks:ash_block", + ["default:desert_cobble"] = "default:desert_stone", + ["default:desert_sandstone"] = "default:desert_sandstone_block", + ["default:gravel"] = "default:cobble", + ["default:ice"] = "default:snowblock", + ["default:permafrost"] = "default:dirt", + ["default:permafrost_with_moss"] = "default:dirt", + ["default:sandstone"] = "default:sandstone_block", + ["default:silver_sandstone"] = "default:silver_sandstone_block", + ["default:snowblock"] = "default:water_source", + + ["basic_materials:cement_block"] = "basic_materials:concrete_block", + ["bedrock:deepstone"] = "default:stone", + ["building_blocks:hardwood"] = "default:coalblock", + ["building_blocks:Tar"] = "gloopblocks:pavement", + ["bushes:basket_empty"] = "gloopblocks:ash_pile", + ["bushes:basket_blackberry"] = "gloopblocks:ash_pile", + ["bushes:basket_blueberry"] = "gloopblocks:ash_pile", + ["bushes:basket_gooseberry"] = "gloopblocks:ash_pile", + ["bushes:basket_mixed_berry"] = "gloopblocks:ash_pile", + ["bushes:basket_raspberry"] = "gloopblocks:ash_pile", + ["bushes:basket_strawberry"] = "gloopblocks:ash_pile", + ["caverealms:thin_ice"] = "default:water_source", + ["castle_masonry:rubble"] = "default:desert_stone", + ["usesdirt:dirt_stone"] = "default:stone", + ["usesdirt:dirt_cobble_stone"] = "default:stone", + ["wool:dark_grey"] = "gloopblocks:ash_pile" + } + + gloopblocks.lava_damage_groups = { + ["wood"] = "default:coalblock", + ["tree"] = "default:coalblock", + ["soil"] = "gloopblocks:basalt", + ["leaves"] = "gloopblocks:ash_pile", + ["fence"] = "gloopblocks:ash_pile", + ["stone"] = "default:stone", + } + + if minetest.get_modpath("cottages") then + gloopblocks.lava_damage_nodes["cottages:hay"] = "cottages:reet" + gloopblocks.lava_damage_nodes["cottages:hay_bale"] = "cottages:reet" + gloopblocks.lava_damage_nodes["cottages:hay_mat"] = "cottages:straw_mat" + gloopblocks.lava_damage_nodes["cottages:reet"] = "gloopblocks:ash_pile" + gloopblocks.lava_damage_nodes["cottages:roof_black"] = "gloopblocks:ash_pile" + gloopblocks.lava_damage_nodes["cottages:roof_brown"] = "gloopblocks:ash_pile" + gloopblocks.lava_damage_nodes["cottages:roof_red"] = "gloopblocks:ash_pile" + gloopblocks.lava_damage_nodes["cottages:roof_reet"] = "gloopblocks:ash_pile" + gloopblocks.lava_damage_nodes["cottages:roof_straw"] = "cottages:roof_reet" + gloopblocks.lava_damage_nodes["cottages:roof_wood"] = "gloopblocks:ash_pile" + gloopblocks.lava_damage_nodes["cottages:roof_connector_black"] = "gloopblocks:ash_pile" + gloopblocks.lava_damage_nodes["cottages:roof_connector_brown"] = "gloopblocks:ash_pile" + gloopblocks.lava_damage_nodes["cottages:roof_connector_red"] = "gloopblocks:ash_pile" + gloopblocks.lava_damage_nodes["cottages:roof_connector_reet"] = "gloopblocks:ash_pile" + gloopblocks.lava_damage_nodes["cottages:roof_connector_straw"] = "cottages:roof_connector_reet" + gloopblocks.lava_damage_nodes["cottages:roof_connector_wood"] = "gloopblocks:ash_pile" + gloopblocks.lava_damage_nodes["cottages:roof_flat_black"] = "gloopblocks:ash_pile" + gloopblocks.lava_damage_nodes["cottages:roof_flat_brown"] = "gloopblocks:ash_pile" + gloopblocks.lava_damage_nodes["cottages:roof_flat_red"] = "gloopblocks:ash_pile" + gloopblocks.lava_damage_nodes["cottages:roof_flat_reet"] = "gloopblocks:ash_pile" + gloopblocks.lava_damage_nodes["cottages:roof_flat_straw"] = "cottages:roof_flat_reet" + gloopblocks.lava_damage_nodes["cottages:roof_flat_wood"] = "gloopblocks:ash_pile" + gloopblocks.lava_damage_nodes["cottages:straw_ground"] = "cottages:loam" + gloopblocks.lava_damage_nodes["cottages:loam"] = "default:dirt" + gloopblocks.lava_damage_nodes["cottages:feldweg"] = "default:dirt" + gloopblocks.lava_damage_nodes["cottages:feldweg_crossing"] = "default:dirt" + gloopblocks.lava_damage_nodes["cottages:feldweg_curve"] = "default:dirt" + gloopblocks.lava_damage_nodes["cottages:feldweg_end"] = "default:dirt" + gloopblocks.lava_damage_nodes["cottages:feldweg_slope"] = "default:dirt" + gloopblocks.lava_damage_nodes["cottages:feldweg_slope_long"] = "default:dirt" + gloopblocks.lava_damage_nodes["cottages:feldweg_t_junction"] = "default:dirt" + end + + if minetest.get_modpath("dryplants") then + gloopblocks.lava_damage_nodes["dryplants:wetreed"] = "dryplants:reed" + gloopblocks.lava_damage_nodes["dryplants:wetreed_slab"] = "dryplants:reed_slab" + gloopblocks.lava_damage_nodes["dryplants:wetreed_roof"] = "dryplants:reed_roof" + gloopblocks.lava_damage_nodes["dryplants:wetreed_roof_corner"] = "dryplants:reed_roof_corner" + gloopblocks.lava_damage_nodes["dryplants:wetreed_roof_corner_2"] = "dryplants:reed_roof_corner_2" + gloopblocks.lava_damage_nodes["dryplants:reed"] = "gloopblocks:ash_pile" + gloopblocks.lava_damage_nodes["dryplants:reed_slab"] = "gloopblocks:ash_pile" + gloopblocks.lava_damage_nodes["dryplants:reed_roof"] = "gloopblocks:ash_pile" + gloopblocks.lava_damage_nodes["dryplants:reed_roof_corner"] = "gloopblocks:ash_pile" + gloopblocks.lava_damage_nodes["dryplants:reed_roof_corner_2"] = "gloopblocks:ash_pile" + end + + if minetest.get_modpath("wool") then + gloopblocks.lava_damage_groups["wool"] = "wool:dark_grey" + end + + if minetest.get_modpath("bakedclay") then + gloopblocks.lava_damage_nodes["default:clay"] = "bakedclay:dark_grey" + gloopblocks.lava_damage_groups["bakedclay"] = "bakedclay:dark_grey" + else + gloopblocks.lava_damage_nodes["default:clay"] = "gloopblocks:basalt" + end + + if minetest.get_modpath("moreblocks") then + gloopblocks.lava_damage_groups["sand"] = "moreblocks:coal_glass" + else + gloopblocks.lava_damage_groups["sand"] = "default:obsidian_glass" + end + + if minetest.get_modpath("farming") then + gloopblocks.lava_damage_nodes["farming:soil_wet"] = "farming:soil" + end + + gloopblocks.lava_neighbors = { + { x=-1, y=-1, z=-1 }, + { x=-1, y=-1, z= 0 }, + { x=-1, y=-1, z= 1 }, + { x=-1, y= 0, z=-1 }, + { x=-1, y= 0, z= 0 }, + { x=-1, y= 0, z= 1 }, + { x=-1, y= 1, z=-1 }, + { x=-1, y= 1, z= 0 }, + { x=-1, y= 1, z= 1 }, + + { x= 0, y=-1, z=-1 }, + { x= 0, y=-1, z= 0 }, + { x= 0, y=-1, z= 1 }, + { x= 0, y= 0, z=-1 }, +-- { x= 0, y= 0, z= 0 }, -- will always be the lava node, so ignore this space + { x= 0, y= 0, z= 1 }, + { x= 0, y= 1, z=-1 }, + { x= 0, y= 1, z= 0 }, + { x= 0, y= 1, z= 1 }, + + { x= 1, y=-1, z=-1 }, + { x= 1, y=-1, z= 0 }, + { x= 1, y=-1, z= 1 }, + { x= 1, y= 0, z=-1 }, + { x= 1, y= 0, z= 0 }, + { x= 1, y= 0, z= 1 }, + { x= 1, y= 1, z=-1 }, + { x= 1, y= 1, z= 0 }, + { x= 1, y= 1, z= 1 }, + } + + minetest.register_abm({ + nodenames = {"default:lava_source", "default:lava_flowing"}, + interval = 5, + chance = 2, + action = function(pos, node, active_object_count, active_object_count_wider) + local r=gloopblocks.lava_neighbors[math.random(1, 26)] + local pos2 = { + x = pos.x + r.x, + y = pos.y + r.y, + z = pos.z + r.z + } + local newnode + local chknode = minetest.get_node(pos2) + local def = minetest.registered_items[chknode.name] + + if gloopblocks.lava_damage_nodes[chknode.name] then + newnode = gloopblocks.lava_damage_nodes[chknode.name] + elseif def and def.drawtype == "plantlike" then + newnode = "air" + else + for group, new in pairs(gloopblocks.lava_damage_groups) do + if minetest.get_item_group(chknode.name, group) > 0 then + newnode = new + break + end + end + end + + if newnode then + minetest.set_node(pos2, {name = newnode, param2 = chknode.param2}) + end + end + }) +end + +if minetest.get_modpath("worldedit") then + function gloopblocks.liquid_ungrief(pos1, pos2, name) + local count + local p1to2 = minetest.pos_to_string(pos1).." and "..minetest.pos_to_string(pos2) + local volume = worldedit.volume(pos1, pos2) + minetest.chat_send_player(name, "Cleaning-up lava/water griefing between "..p1to2.."...") + if volume > 1000000 then + minetest.chat_send_player(name, "This operation could affect up to "..volume.." nodes. It may take a while.") + end + minetest.log("action", name.." performs lava/water greifing cleanup between "..p1to2..".") + count = worldedit.replace(pos1, pos2, "default:lava_source", "air") + count = worldedit.replace(pos1, pos2, "default:lava_flowing", "air") + count = worldedit.replace(pos1, pos2, "default:water_source", "air") + count = worldedit.replace(pos1, pos2, "default:water_flowing", "air") + count = worldedit.replace(pos1, pos2, "default:river_water_source", "air") + count = worldedit.replace(pos1, pos2, "default:river_water_flowing", "air") + count = worldedit.replace(pos1, pos2, "gloopblocks:pumice_cooled", "air") + count = worldedit.replace(pos1, pos2, "gloopblocks:basalt_cooled", "air") + count = worldedit.replace(pos1, pos2, "gloopblocks:obsidian_cooled", "air") + count = worldedit.fixlight(pos1, pos2) + minetest.chat_send_player(name, "Operation completed.") + end + + minetest.register_chatcommand("/liquid_ungrief", { + params = "[size]", + privs = {worldedit = true}, + description = "Repairs greifing caused by spilling lava and water (and their \"cooling\" results)", + func = function(name, params) + local pos1 = worldedit.pos1[name] + local pos2 = worldedit.pos2[name] + if not pos1 or not pos2 then return end + gloopblocks.liquid_ungrief(pos1, pos2, name) + end + }) +end diff --git a/mods/gloopblocks/main.lua b/mods/gloopblocks/main.lua new file mode 100644 index 00000000..ae6ffe42 --- /dev/null +++ b/mods/gloopblocks/main.lua @@ -0,0 +1,839 @@ +-- Load support for intllib. +local MP = minetest.get_modpath(minetest.get_current_modname()) +local S, NS = dofile(MP.."/intllib.lua") + +-- Nodes + +minetest.register_node("gloopblocks:rainbow_block_diagonal", { + description = S("Diagonal Rainbow Block"), + tiles = {"gloopblocks_rainbow_block.png"}, + is_ground_content = true, + groups = {cracky=3}, + sounds = default.node_sound_defaults(), +}) +minetest.register_alias("gloopblocks:rainbow_block", "gloopblocks:rainbow_block_diagonal") + +minetest.register_node("gloopblocks:rainbow_block_horizontal", { + description = S("Horizontal Rainbow Block"), + tiles = { + "gloopblocks_rainbow_horizontal.png^[transformR90", + "gloopblocks_rainbow_horizontal.png^[transformR90", + "gloopblocks_rainbow_horizontal.png" + }, + paramtype = "light", + light_source = default.LIGHT_MAX, + paramtype2 = "facedir", + groups = {cracky = 2}, + is_ground_content = false, + sounds = default.node_sound_defaults(), +}) + +minetest.register_node("gloopblocks:evil_block", { + description = S("Evil Block"), + tiles = {"gloopblocks_evil_block.png"}, + light_source = 5, + is_ground_content = true, + groups = {cracky=2}, + sounds = default.node_sound_stone_defaults(), +}) + +minetest.register_node("gloopblocks:basalt", { + description = S("Basalt"), + tiles = {"gloopblocks_basalt.png"}, + groups = {cracky=2}, + sounds = default.node_sound_stone_defaults(), +}) + +minetest.register_node("gloopblocks:pumice", { + description = S("Pumice"), + tiles = {"gloopblocks_pumice.png"}, + groups = {cracky=3}, + sounds = default.node_sound_stone_defaults(), +}) + + +minetest.register_node("gloopblocks:pavement", { + description = S("Pavement"), + tiles = {"gloopblocks_pavement.png"}, + groups = {cracky=3, oddly_breakable_by_hand=3}, + sounds = default.node_sound_stone_defaults(), +}) + +minetest.register_node("gloopblocks:oerkki_block", { + drawtype = "nodebox", + description = S("Oerkki Block"), + paramtype = "light", + paramtype2 = "facedir", + tiles = { + "gloopblocks_oerkkiblock_tb.png", + "gloopblocks_oerkkiblock_tb.png", + "gloopblocks_oerkkiblock_sides.png", + "gloopblocks_oerkkiblock_sides.png", + "gloopblocks_oerkkiblock_sides.png", + "gloopblocks_oerkkiblock_front.png" + }, + groups = {cracky=3, oddly_breakable_by_hand=3}, + sounds = default.node_sound_stone_defaults(), + selection_box = { + type = "fixed", + fixed = { -0.5, -0.5, -0.5, 0.5, 0.5, 0.5 } + }, + node_box = { + type = "fixed", + fixed = { + {-0.5, -0.5, -0.1875, 0.5, 0.5, 0.1875}, -- NodeBox1 + {-0.5, -0.5, -0.5, -0.4375, 0.5, 0.5}, -- NodeBox2 + {0.4375, -0.5, -0.5, 0.5, 0.5, 0.5}, -- NodeBox3 + {-0.5, 0.4375, -0.5, 0.5, 0.5, 0.5}, -- NodeBox4 + {-0.5, -0.5, -0.5, 0.5, -0.4375, 0.5}, -- NodeBox5 + {-0.5, -0.0625, -0.5, 0.5, 0.0625, 0.5}, -- NodeBox6 + } + } +}) + +minetest.register_node("gloopblocks:stone_brick_mossy", { + description = S("Mossy Stone Brick"), + tiles = {"gloopblocks_stone_brick_mossy.png"}, + groups = {cracky=3, stone=1}, + sounds = default.node_sound_stone_defaults(), +}) + +minetest.register_node("gloopblocks:stone_mossy", { + description = S("Mossy Stone"), + tiles = {"gloopblocks_stone_mossy.png"}, + groups = {cracky=3, stone=1}, + sounds = default.node_sound_stone_defaults(), + drop = "default:mossycobble" +}) + +minetest.register_node("gloopblocks:cobble_road", { + description = S("Cobblestone Road Bed"), + tiles = {"gloopblocks_cobble_road.png"}, + groups = {cracky=3, stone=1}, + sounds = default.node_sound_stone_defaults(), +}) + +minetest.register_node("gloopblocks:cobble_road_mossy", { + description = S("Mossy Cobblestone Road Bed"), + tiles = {"gloopblocks_cobble_road_mossy.png"}, + groups = {cracky=3, stone=1}, + sounds = default.node_sound_stone_defaults(), +}) + +minetest.register_node("gloopblocks:scaffolding", { + description = S("Wooden Scaffold"), + drawtype = "allfaces", + paramtype = "light", + sunlight_propagates = true, + tiles = {"gloopblocks_scaffold.png"}, + groups = {choppy=3, oddly_breakable_by_hand=3}, + sounds = default.node_sound_wood_defaults(), +}) + +minetest.register_alias("moreblocks:oerkkiblock", "gloopblocks:oerkki_block") +minetest.register_alias("gloopblocks:obsidian", "default:obsidian") + +-- Nodes imported from Usesdirt ================================================================================ + +if not minetest.get_modpath("usesdirt") then + + local dirt_brick_tex = "default_dirt.png^gloopblocks_dirt_brick_overlay.png" + local dirt_cobble_tex = "default_cobble.png^(default_dirt.png^[mask:gloopblocks_dirt_cobble_mask.png)" + local dirt_stone_tex = "default_stone.png^(default_dirt.png^[mask:gloopblocks_dirt_stone_mask.png)" + + local dirt_ladder_tex = "(default_dirt.png^[mask:gloopblocks_ladder_mask.png)^gloopblocks_ladder_overlay.png" + local dirt_brick_ladder_tex = "(("..dirt_brick_tex..")^[mask:gloopblocks_ladder_mask.png)^gloopblocks_ladder_overlay.png" + local dirt_cobble_ladder_tex = "(("..dirt_cobble_tex..")^[mask:gloopblocks_ladder_mask.png)^gloopblocks_ladder_overlay.png" + local dirt_stone_ladder_tex = "(("..dirt_stone_tex..")^[mask:gloopblocks_ladder_mask.png)^gloopblocks_ladder_overlay.png" + + minetest.register_node(":usesdirt:dirt_brick", { + tiles = { dirt_brick_tex }, + description = "Dirt Brick", + groups = {snappy=2,choppy=1,oddly_breakable_by_hand=2}, + }) + + minetest.register_node(":usesdirt:dirt_brick_ladder", { + description = "Dirt Brick Ladder", + drawtype = "signlike", + tiles = { dirt_brick_ladder_tex }, + inventory_image = dirt_brick_ladder_tex, + wield_image = dirt_brick_ladder_tex, + paramtype = "light", + paramtype2 = "wallmounted", + is_ground_content = true, + walkable = false, + climbable = true, + selection_box = { + type = "wallmounted", + --wall_top = = + --wall_bottom = = + --wall_side = = + }, + groups = {cracky=3, stone=2}, + legacy_wallmounted = true, + }) + minetest.register_craft({ + output = 'usesdirt:dirt_brick_ladder 3', + recipe = { + {'usesdirt:dirt_brick', '', 'usesdirt:dirt_brick'}, + {'usesdirt:dirt_brick', 'usesdirt:dirt_brick','usesdirt:dirt_brick'}, + {'usesdirt:dirt_brick','','usesdirt:dirt_brick'}, + } + }) + + default.register_fence(":usesdirt:dirt_brick_fence", { + description = "Dirt Brick Fence", + texture = dirt_brick_tex, + inventory_image = "default_fence_overlay.png^("..dirt_brick_tex..")^default_fence_overlay.png^[makealpha:255,126,126", + wield_image = "default_fence_overlay.png^("..dirt_brick_tex..")^default_fence_overlay.png^[makealpha:255,126,126", + material = "usesdirt:dirt_brick", + groups = {cracky=3, stone=2}, + sounds = default.node_sound_stone_defaults(), + check_for_pole = true + }) + + if minetest.get_modpath("moreblocks") then + minetest.register_craft({ + output = 'usesdirt:dirt_brick 24', + recipe = { + {'moreblocks:dirt_compressed', 'moreblocks:dirt_compressed', '' }, + {'moreblocks:dirt_compressed', 'moreblocks:dirt_compressed', '' } + } + }) + else + minetest.register_craft({ + output = 'usesdirt:dirt_brick 6', + recipe = { + {'default:dirt', 'default:dirt', 'default:dirt'}, + {'default:dirt', 'default:dirt', 'default:dirt'}, + {'default:dirt', 'default:dirt', 'default:dirt'}, + } + }) + end + + minetest.register_node(":usesdirt:dirt_ladder", { + description = "Dirt Ladder", + drawtype = "signlike", + tiles = { dirt_ladder_tex }, + inventory_image = dirt_ladder_tex, + wield_image = dirt_ladder_tex, + paramtype = "light", + paramtype2 = "wallmounted", + is_ground_content = true, + walkable = false, + climbable = true, + selection_box = { + type = "wallmounted", + --wall_top = = + --wall_bottom = = + --wall_side = = + }, + groups = {snappy=2,choppy=2,oddly_breakable_by_hand=3}, + legacy_wallmounted = true, + }) + minetest.register_craft({ + output = 'usesdirt:dirt_ladder 3', + recipe = { + {'usesdirt:dirt_brick', '', 'usesdirt:dirt_brick'}, + {'usesdirt:dirt_brick', 'usesdirt:dirt_brick','usesdirt:dirt_brick'}, + {'usesdirt:dirt_brick','','usesdirt:dirt_brick'}, + } + }) + + default.register_fence(":usesdirt:dirt_fence", { + description = "Dirt Fence", + texture = "default_dirt.png", + inventory_image = "default_fence_overlay.png^default_dirt.png^default_fence_overlay.png^[makealpha:255,126,126", + wield_image = "default_fence_overlay.png^default_dirt.png^default_fence_overlay.png^[makealpha:255,126,126", + material = "default:dirt", + groups = {snappy=2,choppy=1,oddly_breakable_by_hand=3}, + sounds = default.node_sound_dirt_defaults(), + check_for_pole = true + }) + +---- + + minetest.register_node(":usesdirt:dirt_cobble_stone", { + tiles = { dirt_cobble_tex }, + description = "Dirt Cobble Stone", + is_ground_content = true, + groups = {cracky=3, stone=2}, + }) + minetest.register_craft({ + output = '"usesdirt:dirt_cobble_stone" 3', + recipe = { + {'usesdirt:dirt_brick', 'usesdirt:dirt_brick', 'usesdirt:dirt_brick'}, + {'usesdirt:dirt_brick', 'usesdirt:dirt_brick', 'usesdirt:dirt_brick'}, + {'usesdirt:dirt_brick', 'usesdirt:dirt_brick', 'usesdirt:dirt_brick'}, + } + }) + + minetest.register_node(":usesdirt:dirt_cobble_stone_ladder", { + description = "Dirt Cobble Stone Ladder", + drawtype = "signlike", + tiles = { dirt_cobble_ladder_tex }, + inventory_image = dirt_cobble_ladder_tex, + wield_image = dirt_cobble_ladder_tex, + paramtype = "light", + paramtype2 = "wallmounted", + is_ground_content = true, + walkable = false, + climbable = true, + selection_box = { + type = "wallmounted", + --wall_top = = + --wall_bottom = = + --wall_side = = + }, + groups = {cracky=3, stone=2}, + legacy_wallmounted = true, + }) + minetest.register_craft({ + output = 'usesdirt:dirt_cobble_stone_ladder 3', + recipe = { + {'usesdirt:dirt_cobble_stone', '', 'usesdirt:dirt_cobble_stone'}, + {'usesdirt:dirt_cobble_stone', 'usesdirt:dirt_cobble_stone','usesdirt:dirt_cobble_stone'}, + {'usesdirt:dirt_cobble_stone','','usesdirt:dirt_cobble_stone'}, + } + }) + + default.register_fence(":usesdirt:dirt_cobble_stone_fence", { + description = "Dirt Cobble Stone Fence", + texture = dirt_cobble_tex, + inventory_image = "default_fence_overlay.png^("..dirt_cobble_tex..")^default_fence_overlay.png^[makealpha:255,126,126", + wield_image = "default_fence_overlay.png^("..dirt_cobble_tex..")^default_fence_overlay.png^[makealpha:255,126,126", + material = "usesdirt:dirt_cobble_stone", + groups = {cracky=3, stone=2}, + sounds = default.node_sound_stone_defaults(), + check_for_pole = true + }) + +---- + + minetest.register_node(":usesdirt:dirt_stone", { + tiles = { dirt_stone_tex }, + description = "Dirt Stone", + is_ground_content = true, + groups = {cracky=3, stone=2}, + }) + + minetest.register_node(":usesdirt:dirt_stone_ladder", { + description = "Dirt Stone Ladder", + drawtype = "signlike", + tiles = { dirt_stone_ladder_tex }, + inventory_image = dirt_stone_ladder_tex, + wield_image = dirt_stone_ladder_tex, + paramtype = "light", + paramtype2 = "wallmounted", + is_ground_content = true, + walkable = false, + climbable = true, + selection_box = { + type = "wallmounted", + --wall_top = = + --wall_bottom = = + --wall_side = = + }, + groups = {cracky=3, stone=2}, + legacy_wallmounted = true, + }) + minetest.register_craft({ + output = 'usesdirt:dirt_stone_ladder 3', + recipe = { + {'usesdirt:dirt_stone', '', 'usesdirt:dirt_stone'}, + {'usesdirt:dirt_stone', 'usesdirt:dirt_stone','usesdirt:dirt_stone'}, + {'usesdirt:dirt_stone','','usesdirt:dirt_stone'}, + } + }) + + default.register_fence(":usesdirt:dirt_stone_fence", { + description = "Dirt Stone Fence", + texture = dirt_stone_tex, + inventory_image = "default_fence_overlay.png^("..dirt_stone_tex..")^default_fence_overlay.png^[makealpha:255,126,126", + wield_image = "default_fence_overlay.png^("..dirt_stone_tex..")^default_fence_overlay.png^[makealpha:255,126,126", + material = "usesdirt:dirt_stone", + groups = {cracky=3, stone=2}, + sounds = default.node_sound_stone_defaults(), + check_for_pole = true + }) +end + +-- Stairs/slabs defs, conversion of normal -> mossy items + +if minetest.setting_getbool("gloopblocks_mossy_conversion") ~= false then + + function gloopblocks_register_mossy_conversion(mossyobjects) + for i in ipairs(mossyobjects) do + minetest.register_abm({ + nodenames = { mossyobjects[i][1] }, + neighbors = {"default:water_source", "default:water_flowing"}, + interval = 120, + chance = 50, + action = function(pos, node) + if minetest.find_node_near(pos, 2, "air") then + local fdir = node.param2 + minetest.add_node(pos, {name = mossyobjects[i][2], param2 = fdir}) + end + end, + }) + end + end +end + +if minetest.get_modpath("moreblocks") then + + stairsplus:register_all("gloopblocks", "oerkki_block", "gloopblocks:oerkki_block", { + description = S("Oerkki Block"), + tiles = { + "gloopblocks_oerkkiblock_tb.png", + "gloopblocks_oerkkiblock_tb.png", + "gloopblocks_oerkkiblock_sides.png", + "gloopblocks_oerkkiblock_sides.png", + "gloopblocks_oerkkiblock_sides.png", + "gloopblocks_oerkkiblock_front.png" + }, + groups = {cracky=2, not_in_creative_inventory=1}, + sounds = default.node_sound_stone_defaults(), + sunlight_propagates = true, + }) + + stairsplus:register_all("gloopblocks", "stone_brick_mossy", "gloopblocks:stone_brick_mossy", { + description = S("Mossy Stone Brick"), + tiles = {"gloopblocks_stone_brick_mossy.png"}, + groups = {cracky=1, not_in_creative_inventory=1}, + sounds = default.node_sound_stone_defaults(), + sunlight_propagates = true, + }) + + stairsplus:register_all("gloopblocks", "stone_mossy", "gloopblocks:stone_mossy", { + description = S("Mossy Stone"), + tiles = {"gloopblocks_stone_mossy.png"}, + groups = {cracky=1, not_in_creative_inventory=1}, + sounds = default.node_sound_stone_defaults(), + sunlight_propagates = true, + }) + + stairsplus:register_all("gloopblocks", "cobble_road", "gloopblocks:cobble_road", { + description = S("Cobblestone Roadbed"), + tiles = {"gloopblocks_cobble_road.png"}, + groups = {cracky=3, stone=1, not_in_creative_inventory=1}, + sounds = default.node_sound_stone_defaults(), + sunlight_propagates = true, + }) + + stairsplus:register_all("gloopblocks", "cobble_road_mossy", "gloopblocks:cobble_road_mossy", { + description = S("Mossy Cobblestone Roadbed"), + tiles = {"gloopblocks_cobble_road_mossy.png"}, + groups = {cracky=3, stone=1, not_in_creative_inventory=1}, + sounds = default.node_sound_stone_defaults(), + sunlight_propagates = true, + }) + + stairsplus:register_all("gloopblocks", "pavement", "gloopblocks:pavement", { + description = S("Pavement"), + tiles = {"gloopblocks_pavement.png"}, + groups = {cracky=2, not_in_creative_inventory=1}, + sounds = default.node_sound_stone_defaults(), + sunlight_propagates = true, + }) + + stairsplus:register_all("gloopblocks", "rainbow_block", "gloopblocks:rainbow_block", { + description = S("Rainbow Block"), + tiles = {"gloopblocks_rainbow_block.png"}, + groups = {cracky=3, not_in_creative_inventory=1}, + sounds = default.node_sound_defaults(), + sunlight_propagates = true, + }) + + stairsplus:register_all("gloopblocks", "evil_block", "gloopblocks:evil_block", { + description = S("Evil Block"), + tiles = {"gloopblocks_evil_block.png"}, + groups = {cracky=3, not_in_creative_inventory=1}, + sounds = default.node_sound_defaults(), + light_source = 5, + sunlight_propagates = true, + }) + + stairsplus:register_all("gloopblocks", "basalt", "gloopblocks:basalt", { + description = S("Basalt"), + tiles = {"gloopblocks_basalt.png"}, + groups = {cracky=2, not_in_creative_inventory=1}, + sounds = default.node_sound_stone_defaults(), + sunlight_propagates = true, + }) + + stairsplus:register_all("gloopblocks", "pumice", "gloopblocks:pumice", { + description = S("Pumice"), + tiles = {"gloopblocks_pumice.png"}, + groups = {cracky=3, not_in_creative_inventory=1}, + sounds = default.node_sound_stone_defaults(), + sunlight_propagates = true, + }) + + stairsplus:register_all("gloopblocks", "gravel", "default:gravel", { + description = S("Gravel"), + tiles = {"default_gravel.png"}, + groups = {crumbly = 2, falling_node = 1, not_in_creative_inventory=1}, + sounds = default.node_sound_stone_defaults(), + sunlight_propagates = false, + }) + + if minetest.get_modpath("caverealms") then + stairsplus:register_all("caverealms", "glow_crystal", "caverealms:glow_crystal", { + description = S("Glow Crystal"), + tiles = {"caverealms_glow_crystal.png"}, + groups = {cracky=3, not_in_creative_inventory=1}, + sounds = default.node_sound_glass_defaults(), + light_source = 12, + use_texture_alpha = true, + paramtype="light", + sunlight_propagates = true, + }) + + stairsplus:register_all("caverealms", "glow_emerald", "caverealms:glow_emerald", { + description = S("Glow Emerald"), + tiles = {"caverealms_glow_emerald.png"}, + groups = {cracky=3, not_in_creative_inventory=1}, + sounds = default.node_sound_glass_defaults(), + light_source = 12, + use_texture_alpha = true, + paramtype="light", + sunlight_propagates = true, + }) + + stairsplus:register_all("caverealms", "glow_mese", "caverealms:glow_mese", { + description = S("Glow Mese"), + tiles = {"caverealms_glow_mese.png"}, + groups = {cracky=3, not_in_creative_inventory=1}, + sounds = default.node_sound_glass_defaults(), + light_source = 12, + use_texture_alpha = true, + paramtype="light", + sunlight_propagates = true, + }) + end + + -- ABMs for mossy objects + + if minetest.setting_getbool("gloopblocks_mossy_conversion") ~= false then + + gloopblocks_register_mossy_conversion({ + { "moreblocks:stair_cobble", "moreblocks:stair_mossycobble" }, + { "moreblocks:stair_cobble_inner", "moreblocks:stair_mossycobble_inner" }, + { "moreblocks:stair_cobble_outer", "moreblocks:stair_mossycobble_outer" }, + { "moreblocks:stair_cobble_half", "moreblocks:stair_mossycobble_half" }, + { "moreblocks:slab_cobble_quarter", "moreblocks:slab_mossycobble_quarter" }, + { "moreblocks:slab_cobble", "moreblocks:slab_mossycobble" }, + { "moreblocks:slab_cobble_three_quarter", "moreblocks:slab_mossycobble_three_quarter" }, + { "moreblocks:panel_cobble", "moreblocks:panel_mossycobble" }, + { "moreblocks:micro_cobble", "moreblocks:micro_mossycobble" }, + { "moreblocks:stair_cobble_alt", "moreblocks:stair_mossycobble_alt" }, + + { "gloopblocks:cobble_road", "gloopblocks:cobble_road_mossy" }, + { "gloopblocks:stair_cobble_road", "gloopblocks:stair_cobble_road_mossy" }, + { "gloopblocks:slab_cobble_road", "gloopblocks:slab_cobble_road_mossy" }, + { "gloopblocks:stair_cobble_road", "gloopblocks:stair_cobble_road_mossy" }, + { "gloopblocks:stair_cobble_road_inner", "gloopblocks:stair_cobble_road_mossy_inner" }, + { "gloopblocks:stair_cobble_road_outer", "gloopblocks:stair_cobble_road_mossy_outer" }, + { "gloopblocks:stair_cobble_road_half", "gloopblocks:stair_cobble_road_mossy_half" }, + { "gloopblocks:slab_cobble_road_quarter", "gloopblocks:slab_cobble_road_mossy_quarter" }, + { "gloopblocks:slab_cobble_road", "gloopblocks:slab_cobble_road_mossy" }, + { "gloopblocks:slab_cobble_road_three_quarter", "gloopblocks:slab_cobble_road_mossy_three_quarter" }, + { "gloopblocks:panel_cobble_road", "gloopblocks:panel_cobble_road_mossy" }, + { "gloopblocks:micro_cobble_road", "gloopblocks:micro_cobble_road_mossy" }, + { "gloopblocks:stair_cobble_road_alt", "gloopblocks:stair_cobble_road_mossy_alt" }, + + { "default:stonebrick", "gloopblocks:stone_brick_mossy" }, + { "default:stair_stonebrick", "gloopblocks:stair_stone_brick_mossy" }, + { "default:slab_stonebrick", "gloopblocks:slab_stone_brick_mossy" }, + { "moreblocks:stair_stonebrick", "gloopblocks:stair_stone_brick_mossy" }, + { "moreblocks:stair_stonebrick_inner", "gloopblocks:stair_stone_brick_mossy_inner" }, + { "moreblocks:stair_stonebrick_outer", "gloopblocks:stair_stone_brick_mossy_outer" }, + { "moreblocks:stair_stonebrick_half", "gloopblocks:stair_stone_brick_mossy_half" }, + { "moreblocks:slab_stonebrick_quarter", "gloopblocks:slab_stone_brick_mossy_quarter" }, + { "moreblocks:slab_stonebrick", "gloopblocks:slab_stone_brick_mossy" }, + { "moreblocks:slab_stonebrick_three_quarter", "gloopblocks:slab_stone_brick_mossy_three_quarter" }, + { "moreblocks:panel_stonebrick", "gloopblocks:panel_stone_brick_mossy" }, + { "moreblocks:micro_stonebrick", "gloopblocks:micro_stone_brick_mossy" }, + { "moreblocks:stair_stonebrick_alt", "gloopblocks:stair_stone_brick_mossy_alt" }, + + { "default:stone", "gloopblocks:stone_mossy" }, + { "default:stair_stone", "gloopblocks:stair_stone_mossy" }, + { "default:slab_stone", "gloopblocks:slab_stone_mossy" }, + { "moreblocks:stair_stone", "gloopblocks:stair_stone_mossy" }, + { "moreblocks:stair_stone_inner", "gloopblocks:stair_stone_mossy_inner" }, + { "moreblocks:stair_stone_outer", "gloopblocks:stair_stone_mossy_outer" }, + { "moreblocks:stair_stone_half", "gloopblocks:stair_stone_mossy_half" }, + + { "moreblocks:slab_stone_quarter", "gloopblocks:slab_stone_mossy_quarter" }, + { "moreblocks:slab_stone", "gloopblocks:slab_stone_mossy" }, + { "moreblocks:slab_stone_three_quarter", "gloopblocks:slab_stone_mossy_three_quarter" }, + { "moreblocks:panel_stone", "gloopblocks:panel_stone_mossy" }, + { "moreblocks:micro_stone", "gloopblocks:micro_stone_mossy" }, + { "moreblocks:stair_stone_alt", "gloopblocks:stair_stone_mossy_alt" }, + }) + end + +elseif minetest.get_modpath("stairs") then + + --stairs.register_stair(subname, recipeitem, groups, images, description, sounds) + + -- stairs:xxxx_stone_mossy ; xxxx = stair or slab + stairs.register_stair_and_slab("stone_mossy", "gloopblocks:stone_mossy", + {cracky=3}, + {"gloopblocks_stone_mossy.png"}, + S("Mossy Stone Stair"), + S("Mossy Stone Slab"), + default.node_sound_stone_defaults()) + + -- stairs:xxxx_mossycobble + stairs.register_stair_and_slab("mossycobble", "default:mossycobble", + {cracky=3}, + {"default_mossycobble.png"}, + S("Mossy Cobble Stair"), + S("Mossy Cobble Slab"), + default.node_sound_stone_defaults()) + + -- stairs:xxxx_stone_brick_mossy + stairs.register_stair_and_slab("stone_brick_mossy", "gloopblocks:stone_brick_mossy", + {cracky=3}, + {"gloopblocks_stone_brick_mossy.png"}, + S("Mossy Stone Brick Stair"), + S("Mossy Stone Brick Slab"), + default.node_sound_stone_defaults()) + + -- stairs:xxxx_cobble_road + stairs.register_stair_and_slab("cobble_road", "gloopblocks:cobble_road", + {cracky=3}, + {"gloopblocks_cobble_road.png"}, + S("Cobble Roadbed Stair"), + S("Cobble Roadbed Slab"), + default.node_sound_stone_defaults()) + + -- stairs:xxxx_cobble_road_mossy + stairs.register_stair_and_slab("cobble_road_mossy", "gloopblocks:cobble_road_mossy", + {cracky=3}, + {"gloopblocks_cobble_road_mossy.png"}, + S("Mossy Cobble Roadbed Stair"), + S("Mossy Cobble Roadbed Slab"), + default.node_sound_stone_defaults()) + + -- stairs:xxxx_cement + stairs.register_stair_and_slab("cement", "gloopblocks:cement", + {cracky=2}, + {"basic_materials_cement_block.png"}, + S("Cement Stair"), + S("Cement Slab"), + default.node_sound_stone_defaults()) + + -- stairs:xxxx_pavement + stairs.register_stair_and_slab("pavement", "gloopblocks:pavement", + {cracky=3, oddly_breakable_by_hand=3}, + {"gloopblocks_pavement.png"}, + S("Pavement Stair"), + S("Pavement Slab"), + default.node_sound_stone_defaults()) + + stairs.register_stair_and_slab("basalt", "gloopblocks:basalt", + {cracky=2}, + {"gloopblocks_basalt.png"}, + S("Basalt Stair"), + S("Basalt Slab"), + default.node_sound_stone_defaults()) + + stairs.register_stair_and_slab("pumice", "gloopblocks:pumice", + {cracky=3}, + {"gloopblocks_pumice.png"}, + S("Pumice Stair"), + S("Pumice Slab"), + default.node_sound_stone_defaults()) + + stairs.register_stair_and_slab("rainbow_block", "gloopblocks:rainbow_block", + {cracky=3}, + {"gloopblocks_rainbow_block.png"}, + S("Rainbow Block Stair"), + S("Rainbow Block Slab"), + default.node_sound_defaults()) + + if minetest.setting_getbool("gloopblocks_mossy_conversion") ~= false then + + gloopblocks_register_mossy_conversion({ + { "default:cobble", "default:mossycobble" }, + { "stairs:stair_cobble", "stairs:stair_mossycobble" }, + { "stairs:slab_cobble", "stairs:slab_mossycobble" }, + { "gloopblocks:cobble_road", "gloopblocks:cobble_road_mossy" }, + { "stairs:stair_cobble_road", "stairs:stair_cobble_road_mossy" }, + { "stairs:slab_cobble_road", "stairs:slab_cobble_road_mossy" }, + { "default:stonebrick", "gloopblocks:stone_brick_mossy" }, + { "stairs:stair_stonebrick", "stairs:stair_stone_brick_mossy" }, + { "stairs:slab_stonebrick", "stairs:slab_stone_brick_mossy" }, + { "default:stone", "gloopblocks:stone_mossy" }, + { "stairs:stair_stone", "stairs:stair_stone_mossy" }, + { "stairs:slab_stone", "stairs:slab_stone_mossy" }, + }) + end + + minetest.register_alias("default:stair_mossycobble", "stairs:stair_mossycobble") + minetest.register_alias("default:slab_mossycobble", "stairs:slab_mossycobble") + minetest.register_alias("gloopblocks:stair_cobble_road", "stairs:stair_cobble_road") + minetest.register_alias("gloopblocks:slab_cobble_road", "stairs:slab_cobble_road") + minetest.register_alias("gloopblocks:stair_cobble_road_mossy", "stairs:stair_cobble_road_mossy") + minetest.register_alias("gloopblocks:slab_cobble_road_mossy", "stairs:slab_cobble_road_mossy") + minetest.register_alias("gloopblocks:stair_stone_brick_mossy", "stairs:stair_stone_brick_mossy") + minetest.register_alias("gloopblocks:slab_stone_brick_mossy", "stairs:slab_stone_brick_mossy") + minetest.register_alias("gloopblocks:stair_stone_mossy", "stairs:stair_stone_mossy") + minetest.register_alias("gloopblocks:slab_stone_mossy", "stairs:slab_stone_mossy") + minetest.register_alias("gloopblocks:stair_cement", "stairs:stair_cement") + minetest.register_alias("gloopblocks:slab_cement", "stairs:slab_cement") + minetest.register_alias("gloopblocks:stair_pavement", "stairs:stair_pavement") + minetest.register_alias("gloopblocks:slab_pavement", "stairs:slab_pavement") + minetest.register_alias("gloopblocks:stair_pumice", "stairs:stair_pumice") + minetest.register_alias("gloopblocks:slab_pumice", "stairs:slab_pumice") + minetest.register_alias("gloopblocks:stair_basalt", "stairs:stair_basalt") + minetest.register_alias("gloopblocks:slab_basalt", "stairs:slab_basalt") + minetest.register_alias("gloopblocks:stair_rainbow_block", "stairs:stair_rainbow_block") + minetest.register_alias("gloopblocks:slab_rainbow_block", "stairs:slab_rainbow_block") +end + +-- Tools + +minetest.register_tool("gloopblocks:pick_cement", { + description = S("Cement Pickaxe"), + inventory_image = "gloopblocks_cement_pick.png", + tool_capabilities = { + full_punch_interval = 1.0, + max_drop_level=1, + groupcaps={ + cracky={times={[1]=3.50, [2]=1.40, [3]=0.90}, uses=25, maxlevel=2} + }, + damage_groups = {fleshy=4}, + }, +}) + +minetest.register_tool("gloopblocks:shovel_cement", { + description = S("Cement Shovel"), + inventory_image = "gloopblocks_cement_shovel.png", + tool_capabilities = { + full_punch_interval = 1.0, + max_drop_level=1, + groupcaps={ + crumbly={times={[1]=1.50, [2]=0.60, [3]=0.45}, uses=25, maxlevel=2} + }, + damage_groups = {fleshy=4}, + }, +}) + +minetest.register_tool("gloopblocks:axe_cement", { + description = S("Cement Axe"), + inventory_image = "gloopblocks_cement_axe.png", + tool_capabilities = { + full_punch_interval = 1.0, + max_drop_level=1, + groupcaps={ + choppy={times={[1]=3.00, [2]=1.30, [3]=0.80}, uses=25, maxlevel=2}, + fleshy={times={[2]=1.20, [3]=0.65}, uses=30, maxlevel=1} + }, + damage_groups = {fleshy=4}, + }, +}) + +minetest.register_tool("gloopblocks:sword_cement", { + description = S("Cement Sword"), + inventory_image = "gloopblocks_cement_sword.png", + tool_capabilities = { + full_punch_interval = 1.0, + max_drop_level=1, + groupcaps={ + fleshy={times={[1]=1.60, [2]=0.80, [3]=0.40}, uses=15, maxlevel=2}, + snappy={times={[2]=0.75, [3]=0.35}, uses=30, maxlevel=1}, + choppy={times={[3]=0.80}, uses=30, maxlevel=0} + }, + damage_groups = {fleshy=6}, + } +}) + +minetest.register_tool("gloopblocks:pick_evil", { + description = S("Evil Pickaxe"), + inventory_image = "gloopblocks_evil_pick.png", + tool_capabilities = { + full_punch_interval = 1.0, + max_drop_level=3, + groupcaps={ + cracky={times={[1]=0.10, [2]=0.10, [3]=0.10}, uses=10, maxlevel=2} + }, + damage_groups = {fleshy=6}, + }, +}) + +minetest.register_tool("gloopblocks:shovel_evil", { + description = S("Evil Shovel"), + inventory_image = "gloopblocks_evil_shovel.png", + tool_capabilities = { + full_punch_interval = 1.0, + max_drop_level=3, + groupcaps={ + crumbly={times={[1]=0.05, [2]=0.05, [3]=0.05}, uses=10, maxlevel=2} + }, + damage_groups = {fleshy=6}, + }, +}) + +minetest.register_tool("gloopblocks:axe_evil", { + description = S("Evil Axe"), + inventory_image = "gloopblocks_evil_axe.png", + tool_capabilities = { + full_punch_interval = 1.0, + max_drop_level=3, + groupcaps={ + choppy={times={[1]=0.15, [2]=0.15, [3]=0.15}, uses=10, maxlevel=2}, + fleshy={times={[1]=0.15, [2]=0.15, [3]=0.15}, uses=10, maxlevel=2} + }, + damage_groups = {fleshy=6}, + }, +}) + +minetest.register_tool("gloopblocks:sword_evil", { + description = S("Evil Sword"), + inventory_image = "gloopblocks_evil_sword.png", + tool_capabilities = { + full_punch_interval = 1.0, + max_drop_level=3, + groupcaps={ + fleshy={times={[1]=0.20, [2]=0.20, [3]=0.20}, uses=10, maxlevel=2}, + snappy={times={[1]=0.20, [2]=0.20, [3]=0.20}, uses=10, maxlevel=2}, + choppy={times={[1]=0.20, [2]=0.20, [3]=0.20}, uses=10, maxlevel=2} + }, + damage_groups = {fleshy=8}, + } +}) + +-- Other items + +minetest.register_craftitem("gloopblocks:evil_stick", { + description = S("Evil Stick"), + inventory_image = "gloopblocks_evil_stick.png", +}) + + +local fence_texture = + "default_fence_overlay.png^default_steel_block.png^default_fence_overlay.png^[makealpha:255,126,126" + +minetest.register_node("gloopblocks:fence_steel", { + description = S("Steel Fence"), + drawtype = "fencelike", + tiles = {"default_steel_block.png"}, + inventory_image = fence_texture, + wield_image = fence_texture, + paramtype = "light", + sunlight_propagates = true, + is_ground_content = false, + selection_box = { + type = "fixed", + fixed = {-1/7, -1/2, -1/7, 1/7, 1/2, 1/7}, + }, + groups = {choppy = 2, oddly_breakable_by_hand = 2 }, + sounds = default.node_sound_stone_defaults(), +}) + +minetest.register_alias("nyancat:nyancat_rainbow", "gloopblocks:rainbow_block_horizontal") +minetest.register_alias("default:nyancat_rainbow", "gloopblocks:rainbow_block_horizontal") diff --git a/mods/gloopblocks/models/gloopblocks_ash_pile.obj b/mods/gloopblocks/models/gloopblocks_ash_pile.obj new file mode 100644 index 00000000..5b9c084e --- /dev/null +++ b/mods/gloopblocks/models/gloopblocks_ash_pile.obj @@ -0,0 +1,197 @@ +# Blender v2.73 (sub 0) OBJ File: 'anthill.blend' +# www.blender.org +o Cylinder_Cylinder.001 +v 0.099056 -0.499969 -0.498228 +v 0.038417 -0.200463 -0.141682 +v 0.255808 -0.499933 -0.402046 +v 0.095605 -0.174690 -0.147239 +v 0.423075 -0.499913 -0.296918 +v 0.102439 -0.169033 -0.075679 +v 0.444026 -0.499843 -0.095234 +v 0.125298 -0.217477 -0.063343 +v 0.468682 -0.499958 0.074790 +v 0.157655 -0.214352 0.001348 +v 0.396548 -0.500000 0.246048 +v 0.133778 -0.189245 0.108513 +v 0.280708 -0.500000 0.383197 +v 0.070517 -0.218946 0.104754 +v 0.089852 -0.499943 0.434316 +v 0.048523 -0.205247 0.128681 +v -0.093309 -0.499902 0.467111 +v -0.039037 -0.211895 0.149030 +v -0.272965 -0.499875 0.396496 +v -0.108297 -0.175918 0.104100 +v -0.388317 -0.499877 0.239075 +v -0.139068 -0.179051 0.073370 +v -0.437531 -0.499999 0.063918 +v -0.141812 -0.255882 0.005117 +v -0.458429 -0.499805 -0.104397 +v -0.189265 -0.217436 -0.065303 +v -0.385597 -0.499914 -0.288584 +v -0.112692 -0.207830 -0.096879 +v -0.248347 -0.499927 -0.384586 +v -0.083136 -0.202256 -0.170048 +v -0.095346 -0.499958 -0.514449 +v -0.023049 -0.216681 -0.204058 +v 0.071880 -0.343843 -0.343933 +v 0.189128 -0.354687 -0.277980 +v 0.311273 -0.378789 -0.248498 +v 0.296760 -0.346318 -0.056661 +v 0.332231 -0.342427 0.044933 +v 0.259921 -0.360316 0.147910 +v 0.213270 -0.362883 0.253745 +v 0.059007 -0.360067 0.351374 +v -0.068448 -0.357957 0.335642 +v -0.164888 -0.343166 0.232553 +v -0.269761 -0.352370 0.140734 +v -0.367168 -0.370891 0.062326 +v -0.294491 -0.324099 -0.079712 +v -0.276314 -0.352585 -0.236032 +v -0.206169 -0.372829 -0.314307 +v -0.065547 -0.371444 -0.355380 +v 0.000709 -0.156135 -0.047193 +vt 0.572002 0.826281 +vt 0.535907 0.620231 +vt 0.597591 0.625892 +vt 0.604963 0.552988 +vt 0.830215 0.729053 +vt 0.629619 0.540419 +vt 0.814561 0.533613 +vt 0.664520 0.474514 +vt 0.638766 0.365335 +vt 0.774826 0.325198 +vt 0.570532 0.369165 +vt 0.724507 0.217375 +vt 0.546808 0.344788 +vt 0.452364 0.324057 +vt 0.420641 0.133939 +vt 0.377660 0.369831 +vt 0.316619 0.238965 +vt 0.344469 0.401138 +vt 0.203502 0.332509 +vt 0.341509 0.470674 +vt 0.290325 0.542416 +vt 0.176827 0.557096 +vt 0.372919 0.574586 +vt 0.196433 0.716353 +vt 0.404798 0.649130 +vt 0.469609 0.683778 +vt 0.272092 0.796098 +vt 0.770390 0.885486 +vt 0.973405 0.572910 +vt 0.591386 0.033412 +vt 0.226599 0.867698 +vt 0.423770 0.837943 +vt 0.601314 0.983475 +vt 0.078559 0.769893 +vt 0.000000 0.582245 +vt 0.098436 0.412390 +vt 0.075624 0.232320 +vt 0.200045 0.071942 +vt 0.558116 0.117912 +vt 0.922195 0.225217 +vt 0.852821 0.430110 +vt 0.698467 0.759089 +vt 0.495235 0.523967 +vt 0.391629 1.000000 +vt 0.022541 0.410768 +vt 0.797247 0.085491 +vt 0.393825 0.000000 +vt 0.950807 0.778383 +vt 1.000000 0.399692 +g Cylinder_Cylinder.001_None +s 1 +f 33/1 2/2 4/3 +f 4/3 6/4 35/5 +f 35/5 6/4 8/6 +f 36/7 8/6 10/8 +f 10/8 12/9 38/10 +f 12/9 14/11 39/12 +f 39/12 14/11 16/13 +f 16/13 18/14 41/15 +f 18/14 20/16 42/17 +f 20/16 22/18 43/19 +f 43/19 22/18 24/20 +f 24/20 26/21 45/22 +f 26/21 28/23 46/24 +f 46/24 28/23 30/25 +f 32/26 2/2 33/1 +f 47/27 30/25 32/26 +f 3/28 7/29 15/30 +f 29/31 47/27 48/32 +f 48/32 33/1 1/33 +f 27/34 46/24 47/27 +f 25/35 45/22 46/24 +f 44/36 45/22 25/35 +f 21/37 43/19 44/36 +f 42/17 43/19 21/37 +f 41/15 42/17 19/38 +f 15/30 40/39 41/15 +f 39/12 40/39 15/30 +f 11/40 38/10 39/12 +f 37/41 38/10 11/40 +f 7/29 36/7 37/41 +f 35/5 36/7 7/29 +f 3/28 34/42 35/5 +f 33/1 34/42 3/28 +f 4/3 2/2 49/43 +f 2/2 32/26 49/43 +f 32/26 30/25 49/43 +f 30/25 28/23 49/43 +f 28/23 26/21 49/43 +f 26/21 24/20 49/43 +f 24/20 22/18 49/43 +f 22/18 20/16 49/43 +f 20/16 18/14 49/43 +f 18/14 16/13 49/43 +f 16/13 14/11 49/43 +f 14/11 12/9 49/43 +f 12/9 10/8 49/43 +f 10/8 8/6 49/43 +f 8/6 6/4 49/43 +f 6/4 4/3 49/43 +f 34/42 33/1 4/3 +f 34/42 4/3 35/5 +f 36/7 35/5 8/6 +f 37/41 36/7 10/8 +f 37/41 10/8 38/10 +f 38/10 12/9 39/12 +f 40/39 39/12 16/13 +f 40/39 16/13 41/15 +f 41/15 18/14 42/17 +f 42/17 20/16 43/19 +f 44/36 43/19 24/20 +f 44/36 24/20 45/22 +f 45/22 26/21 46/24 +f 47/27 46/24 30/25 +f 48/32 32/26 33/1 +f 48/32 47/27 32/26 +f 29/31 31/44 1/33 +f 23/45 27/34 29/31 +f 27/34 23/45 25/35 +f 15/30 19/38 21/37 +f 11/40 13/46 15/30 +f 15/30 17/47 19/38 +f 3/28 23/45 29/31 +f 29/31 1/33 3/28 +f 3/28 5/48 7/29 +f 7/29 9/49 11/40 +f 23/45 15/30 21/37 +f 15/30 23/45 3/28 +f 15/30 7/29 11/40 +f 31/44 29/31 48/32 +f 31/44 48/32 1/33 +f 29/31 27/34 47/27 +f 27/34 25/35 46/24 +f 23/45 44/36 25/35 +f 23/45 21/37 44/36 +f 19/38 42/17 21/37 +f 17/47 41/15 19/38 +f 17/47 15/30 41/15 +f 13/46 39/12 15/30 +f 13/46 11/40 39/12 +f 9/49 37/41 11/40 +f 9/49 7/29 37/41 +f 5/48 35/5 7/29 +f 5/48 3/28 35/5 +f 1/33 33/1 3/28 diff --git a/mods/gloopblocks/textures/gloopblocks_ashes.png b/mods/gloopblocks/textures/gloopblocks_ashes.png new file mode 100644 index 0000000000000000000000000000000000000000..38a300087684b9804239eef4908ff554cdb6ea4d GIT binary patch literal 564 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 b end end local s = {} for k, v in pairs(t) do @@ -146,13 +146,14 @@ local function add_ores() local count drop, count = parse_drop(drop) - local probability = calculate_probability(item) / count + local probability = calculate_probability(item) if probability > 0 then + local probabilityFraction = count / probability local cur_probability = gravelsieve.ore_probability[drop] if cur_probability then - gravelsieve.ore_probability[drop] = harmonic_sum(cur_probability, probability) + gravelsieve.ore_probability[drop] = cur_probability+probabilityFraction else - gravelsieve.ore_probability[drop] = probability + gravelsieve.ore_probability[drop] = probabilityFraction end end end @@ -161,13 +162,117 @@ local function add_ores() minetest.log("action", "[gravelsieve] ore probabilties:") local overall_probability = 0.0 for name,probability in pairs_by_values(gravelsieve.ore_probability) do - minetest.log("action", ("[gravelsieve] %-32s: 1 / %.02f"):format(name, probability)) - overall_probability = overall_probability + 1.0/probability + minetest.log("action", ("[gravelsieve] %-32s: 1 / %.02f"):format(name, 1.0/probability)) + overall_probability = overall_probability + probability end minetest.log("action", ("[gravelsieve] Overall probability %f"):format(overall_probability)) end -minetest.after(1, add_ores) +local function default_configuration() + local normal_gravel = "default:gravel" + local sieved_gravel = "gravelsieve:sieved_gravel" + local gravel_probabilities = table.copy(gravelsieve.ore_probability) + local overall_probability = 0 + for _,v in pairs(gravel_probabilities) do + overall_probability = overall_probability+v + end + local remainder_probability = 0 + if overall_probability < 1 then + remainder_probability = 1-overall_probability + end + gravel_probabilities[normal_gravel] = remainder_probability/2.0 + gravel_probabilities[sieved_gravel] = remainder_probability/2.0 + + return { + [normal_gravel] = gravel_probabilities, + [sieved_gravel] = { + [sieved_gravel] = 1 + } + } +end + +local function normalize_probabilities(conf) + local total = 0 + for _,val in pairs(conf) do + if val >= 0 then + total = total + val + end + end + local normalized = {} + for key,val in pairs(conf) do + if val >= 0 then + normalized[key] = val/total + end + end + return normalized +end + +local function normalize_config(current_config) + local normalized_config = {} + -- Normalize all inputs so their output probabilities always add up to 1 + for input, output_probabilities in pairs(current_config) do + if output_probabilities then + normalized_config[input] = normalize_probabilities(output_probabilities) + end + end + return normalized_config +end + +local function merge_config(def_conf, new_conf) + local result_conf = table.copy(def_conf) + for key,val in pairs(new_conf) do + if type(val) == 'table' and type(result_conf[key]) == 'table' then + result_conf[key] = merge_config(result_conf[key], val) + else + result_conf[key] = val + end + end + return result_conf +end + +local function configure_probabilities_step(current_config, funct_or_table) + local var_type = type(funct_or_table) + local conf + if var_type == 'function' then + conf = funct_or_table() + elseif var_type == 'table' then + conf = funct_or_table + end + if conf then + return merge_config(current_config, conf) + end + return current_config +end + +local configured = false +local set_probabilities = {default_configuration} + +function gravelsieve.set_probabilities(funct_or_table) + if configured then + -- This is here so you can do hard overrides after everything has loaded if you need to + -- Otherwise the order mods are loaded may cause them to override your configs + local current_config = gravelsieve.process_probabilities + current_config = configure_probabilities_step(current_config, funct_or_table) + gravelsieve.process_probabilities = normalize_config(current_config) + else + -- Build up a list of callbacks to be run after all mods are loaded + table.insert(set_probabilities, funct_or_table) + end +end + +local function configure_probabilities() + configured = true + add_ores() + local current_config = {} + + -- Run through all configs in order and merge them + for _,funct_or_table in ipairs(set_probabilities) do + current_config = configure_probabilities_step(current_config, funct_or_table) + end + gravelsieve.process_probabilities = normalize_config(current_config) +end + +minetest.after(1, configure_probabilities) local sieve_formspec = "size[8,8]".. @@ -240,47 +345,34 @@ local function swap_node(pos, meta, start) end -- place ores to dst according to the calculated probability -local function random_ore(inv, src) - local num - for ore, probability in pairs(gravelsieve.ore_probability) do - if math.random(probability) == 1 then - local item = ItemStack(ore) - if inv:room_for_item("dst", item) then - inv:add_item("dst", item) - return true -- ore placed +local function move_random_ore(inv, item) + local running_total = 0 + local probabilities = gravelsieve.process_probabilities[item] + local chosen = math.random() + for ore, probability in pairs(probabilities) do + running_total = running_total + probability + if chosen < running_total then + local ore_item = ItemStack(ore) + if not inv:room_for_item("dst", ore_item) then + return false end + inv:add_item("dst", ore_item) + return true end end - return false -- gravel has to be moved + return false -- Failure, this shouldn't really happen but might due to floating point errors end - -local function add_gravel_to_dst(meta, inv) - -- maintain a counter for gravel kind selection - local gravel_cnt = meta:get_int("gravel_cnt") + 1 - meta:set_int("gravel_cnt", gravel_cnt) - - if (gravel_cnt % 2) == 0 then -- gravel or sieved gravel? - inv:add_item("dst", ItemStack("default:gravel")) -- add to dest - else - inv:add_item("dst", ItemStack("gravelsieve:sieved_gravel")) -- add to dest - end -end - - -- move gravel and ores to dst -local function move_src2dst(meta, pos, inv, src, dst) +local function move_src2dst(meta, pos, inv, item, dst) + local src = ItemStack(item) if inv:room_for_item("dst", dst) and inv:contains_item("src", src) then local res = swap_node(pos, meta, false) if res then -- time to move one item? - if src:get_name() == "default:gravel" then -- will we find ore? - if not random_ore(inv, src) then -- no ore found? - add_gravel_to_dst(meta, inv) - end - else - inv:add_item("dst", ItemStack("gravelsieve:sieved_gravel")) -- add to dest + local processed = move_random_ore(inv, item) + if processed then + inv:remove_item("src", src) end - inv:remove_item("src", src) end return true -- process finished end @@ -291,19 +383,16 @@ end local function sieve_node_timer(pos, elapsed) local meta = minetest.get_meta(pos) local inv = meta:get_inventory() - local gravel = ItemStack("default:gravel") - local gravel_sieved = ItemStack("gravelsieve:sieved_gravel") - if move_src2dst(meta, pos, inv, gravel) then - aging(pos, meta) - return true - elseif move_src2dst(meta, pos, inv, gravel_sieved) then - aging(pos, meta) - return true - else - minetest.get_node_timer(pos):stop() - return false + for item,probabilities in pairs(gravelsieve.process_probabilities) do + if probabilities and move_src2dst(meta, pos, inv, item) then + aging(pos, meta) + return true + end end + + minetest.get_node_timer(pos):stop() + return false end @@ -356,7 +445,7 @@ for idx = 0,4 do local meta = minetest.get_meta(pos) swap_node(pos, meta, true) else - minetest.get_node_timer(pos):start(1.0) + minetest.get_node_timer(pos):start(STEP_DELAY) end return inv:add_item("src", stack) end, @@ -425,7 +514,7 @@ for idx = 0,4 do local meta = minetest.get_meta(pos) swap_node(pos, meta, true) else - minetest.get_node_timer(pos):start(1.0) + minetest.get_node_timer(pos):start(STEP_DELAY) end end, @@ -440,7 +529,7 @@ for idx = 0,4 do meta:set_int("gravel_cnt", 0) end else - minetest.get_node_timer(pos):start(1.0) + minetest.get_node_timer(pos):start(STEP_DELAY) end end, @@ -449,7 +538,7 @@ for idx = 0,4 do local meta = minetest.get_meta(pos) swap_node(pos, meta, true) else - minetest.get_node_timer(pos):start(1.0) + minetest.get_node_timer(pos):start(STEP_DELAY) end end, @@ -559,7 +648,7 @@ if minetest.global_exists("tubelib") then return tubelib.get_item(meta, "dst") end, on_push_item = function(pos, side, item) - minetest.get_node_timer(pos):start(1.0) + minetest.get_node_timer(pos):start(STEP_DELAY) local meta = minetest.get_meta(pos) return tubelib.put_item(meta, "src", item) end, @@ -568,7 +657,7 @@ if minetest.global_exists("tubelib") then return tubelib.put_item(meta, "dst", item) end, on_node_load = function(pos) - minetest.get_node_timer(pos):start(1.0) + minetest.get_node_timer(pos):start(STEP_DELAY) end, on_node_repair = function(pos) local meta = minetest.get_meta(pos) @@ -579,7 +668,7 @@ if minetest.global_exists("tubelib") then inv:set_size('src', 1) inv:set_size('dst', 16) swap_node(pos, meta, false) - minetest.get_node_timer(pos):start(1.0) + minetest.get_node_timer(pos):start(STEP_DELAY) return true end, }) diff --git a/mods/vehicle_mash/README.md b/mods/vehicle_mash/README.md index 872184c1..82148703 100755 --- a/mods/vehicle_mash/README.md +++ b/mods/vehicle_mash/README.md @@ -1,6 +1,6 @@ # Vehicle Mash [![Build status](https://github.com/minetest-mods/vehicle_mash/workflows/build/badge.svg)](https://github.com/minetest-mods/vehicle_mash/actions) [![ContentDB](https://content.minetest.net/packages/Panquesito7/vehicle_mash/shields/downloads/)](https://content.minetest.net/packages/Panquesito7/vehicle_mash/) -- Current version: 2.2.2 +- Current version: 2.3.0 - By [blert2112](https://github.com/blert2112), and handed over to [Panquesito7](https://github.com/Panquesito7). ![Screenshot](https://raw.githubusercontent.com/minetest-mods/vehicle_mash/master/screenshot.png) @@ -67,6 +67,18 @@ There are no pending tasks to do yet. ## Changelog +v2.3.0 2/12/2021 + +- Improved formatting in `README.md`. +- Added [API Mode](https://github.com/minetest-mods/vehicle_mash/commit/6b3bdac4d880a6fde298a286b3bd5043750e904e) setting. +- Removed F1 and 126r cars due to closed-source license. +- Improved vehicle drops. + - Vehicles can now drop multiple items. +- Add option for vehicles to fly (setting per vehicle). +- Can enable/disable crash separately for each vehicle. +- Added ContentDB badge on `README.md`. +- Improved GitHub workflow. + v2.2.2 6/02/2020 - Fix passengers not detaching when driver gets out. diff --git a/mods/vehicle_mash/framework.lua b/mods/vehicle_mash/framework.lua index 5348e99f..38be829b 100644 --- a/mods/vehicle_mash/framework.lua +++ b/mods/vehicle_mash/framework.lua @@ -26,7 +26,7 @@ function vehicle_mash.register_vehicle(name, def) passenger3_eye_offset = def.passenger3_eye_offset, passenger3_detach_pos_offset = def.passenger3_detach_pos_offset, - enable_crash = def.enable_crash or true, + enable_crash = def.enable_crash, visual = def.visual, mesh = def.mesh, textures = def.textures, @@ -140,6 +140,10 @@ function vehicle_mash.register_vehicle(name, def) end end, on_step = function(self, dtime) + -- Automatically set `enable_crash` to true if there's no value found + if def.enable_crash == nil then + def.enable_crash = true + end drive(self, dtime, false, nil, nil, 0, def.can_fly, def.can_go_down, def.can_go_up, def.enable_crash) end })