From 32f46ebf23e7ba8cd9302fbc6fdf1ae6165e0244 Mon Sep 17 00:00:00 2001 From: wsor4035 <24964441+wsor4035@users.noreply.github.com> Date: Sat, 5 Mar 2022 10:09:17 -0500 Subject: [PATCH] fix https://github.com/D00Med/scifi_nodes/issues/68 and adding additional game digging support (#69) --- doors.lua | 6 ++-- models.lua | 4 +-- nodeboxes.lua | 43 ++++++++++++++------------ nodes.lua | 84 ++++++++++++++++++++++++++------------------------- 4 files changed, 71 insertions(+), 66 deletions(-) diff --git a/doors.lua b/doors.lua index d54b716..ca667a2 100644 --- a/doors.lua +++ b/doors.lua @@ -271,7 +271,7 @@ for _, current_door in ipairs(doors) do drawtype = "nodebox", paramtype = "light", paramtype2 = "facedir", - groups = {cracky = 1}, + groups = {cracky = 1, dig_generic = 3}, node_box = { type = "fixed", fixed = { @@ -300,7 +300,7 @@ for _, current_door in ipairs(doors) do paramtype = "light", paramtype2 = "facedir", drop = closed, - groups = {cracky = 1}, + groups = {cracky = 1, dig_generic = 3}, node_box = { type = "fixed", fixed = { @@ -330,7 +330,7 @@ for _, current_door in ipairs(doors) do drawtype = "nodebox", paramtype = "light", paramtype2 = "facedir", - groups = {cracky = 1}, + groups = {cracky = 1, dig_generic = 3}, node_box = { type = "fixed", fixed = { diff --git a/models.lua b/models.lua index 3238672..4f4fdf6 100644 --- a/models.lua +++ b/models.lua @@ -31,7 +31,7 @@ minetest.register_node("scifi_nodes:slope_"..name, { paramtype2 = "facedir", use_texture_alpha = "clip", light_source = light, - groups = {cracky=1}, + groups = {cracky=1, dig_generic = 3}, on_place = minetest.rotate_node }) end @@ -164,7 +164,7 @@ if minetest.global_exists("stairsplus") then description = row[2], tiles = {"scifi_nodes_"..name..".png"}, use_texture_alpha = "clip", - groups = {cracky=1}, + groups = {cracky=1, dig_generic = 3}, paramtype = "light", paramtype2 = "facedir", light_source = row[3], diff --git a/nodeboxes.lua b/nodeboxes.lua index f744f51..a38b626 100644 --- a/nodeboxes.lua +++ b/nodeboxes.lua @@ -18,7 +18,7 @@ minetest.register_node("scifi_nodes:alienslope", { drawtype = "nodebox", paramtype = "light", paramtype2 = "facedir", - groups = {cracky=1}, + groups = {cracky=1, dig_generic = 3}, node_box = { type = "fixed", fixed = { @@ -49,7 +49,7 @@ minetest.register_node("scifi_nodes:wallpipe", { drawtype = "nodebox", paramtype = "light", paramtype2 = "facedir", - groups = {cracky=1}, + groups = {cracky=1, dig_generic = 3}, node_box = { type = "fixed", fixed = { @@ -107,7 +107,7 @@ minetest.register_node("scifi_nodes:egg", { sunlight_propagates = false, drawtype = "nodebox", paramtype = "light", - groups = {cracky=1, oddly_breakable_by_hand=1, dig_immediate=2, falling_node=1}, + groups = {cracky=1, oddly_breakable_by_hand=1, dig_immediate=2, falling_node=1, dig_generic = 3}, light_source = 5, node_box = { type = "fixed", @@ -282,7 +282,7 @@ minetest.register_node("scifi_nodes:pplwndw", { paramtype = "light", paramtype2 = "facedir", use_texture_alpha = "blend", - groups = {cracky=3}, + groups = {cracky=3, dig_generic = 4}, sounds = scifi_nodes.node_sound_glass_defaults(), node_box = { type = "fixed", @@ -378,10 +378,13 @@ local function remove_lid(pos) end end +local dirt_tex = "default_dirt.png" +if not minetest.get_modpath("default") then dirt_tex = "[combine:16x16^[noalpha^[colorize:#654321" end + minetest.register_node("scifi_nodes:pot", { description = "Metal Plant Pot (right-click for lid, sneak + right-click to plant)", tiles = { - "default_dirt.png^scifi_nodes_pot.png", + dirt_tex .. "^scifi_nodes_pot.png", "scifi_nodes_greybolts.png", "scifi_nodes_greybolts.png", "scifi_nodes_greybolts.png", @@ -390,7 +393,7 @@ minetest.register_node("scifi_nodes:pot", { }, drawtype = "nodebox", paramtype = "light", - groups = {cracky = 1, soil = 1, sand = 1}, + groups = {cracky = 1, soil = 1, sand = 1, dig_generic = 3}, selection_box = { type = "fixed", fixed = {-0.5, -0.5, -0.5, 0.5, 0.5, 0.5} @@ -413,7 +416,7 @@ minetest.register_node("scifi_nodes:pot", { minetest.register_node("scifi_nodes:pot2", { description = "Metal Plant Pot Wet (right-click for lid, sneak + right-click to plant)", tiles = { - "default_dirt.png^scifi_nodes_pot2.png", + dirt_tex .. "^scifi_nodes_pot2.png", "scifi_nodes_greybolts.png", "scifi_nodes_greybolts.png", "scifi_nodes_greybolts.png", @@ -422,7 +425,7 @@ minetest.register_node("scifi_nodes:pot2", { }, drawtype = "nodebox", paramtype = "light", - groups = {cracky = 1, soil = 3, wet = 1}, + groups = {cracky = 1, soil = 3, wet = 1, dig_generic = 3}, selection_box = { type = "fixed", fixed = {-0.5, -0.5, -0.5, 0.5, 0.5, 0.5} @@ -464,7 +467,7 @@ minetest.register_node("scifi_nodes:lightbar", { {-0.125, -0.5, -0.5, 0.125, -0.375, 0.5}, -- NodeBox1 } }, - groups = {cracky=1}, + groups = {cracky=1, dig_generic = 3}, sounds = scifi_nodes.node_sound_glass_defaults() }) @@ -546,7 +549,7 @@ minetest.register_node("scifi_nodes:lightbars", { {0.125, -0.5, -0.375, 0.375, 0.5, -0.125}, -- NodeBox4 } }, - groups = {cracky=1}, + groups = {cracky=1, dig_generic = 3}, sounds = scifi_nodes.node_sound_glass_defaults() }) @@ -567,7 +570,7 @@ tiles = {{ {-0.375, -0.5, -0.375, 0.375, 0.5, 0.375}, -- NodeBox1 } }, - groups = {cracky=1, oddly_breakable_by_hand=1}, + groups = {cracky=1, oddly_breakable_by_hand=1, dig_generic = 3}, sounds = scifi_nodes.node_sound_glass_defaults() }) @@ -761,7 +764,7 @@ minetest.register_node("scifi_nodes:table", { } }, sounds = scifi_nodes.node_sound_metal_defaults(), - groups = {cracky=1} + groups = {cracky=1, dig_generic = 3} }) minetest.register_node("scifi_nodes:laptop_open", { @@ -844,7 +847,7 @@ minetest.register_node("scifi_nodes:pipen", { {-0.5, -0.4375, -0.5, 0.5, -0.375, 0.5}, -- NodeBox9 } }, - groups = {cracky=1}, + groups = {cracky=1, dig_generic = 3}, on_place = minetest.rotate_node }) @@ -874,7 +877,7 @@ minetest.register_node("scifi_nodes:windowcorner", { {-0.0625, -0.5, -0.5, 0.0625, 0.5, 0.5}, -- NodeBox11 } }, - groups = {cracky=1}, + groups = {cracky=1, dig_generic = 3}, on_place = minetest.rotate_node, sounds = scifi_nodes.node_sound_glass_defaults(), }) @@ -901,7 +904,7 @@ minetest.register_node("scifi_nodes:windowstraight", { {-0.0625, -0.5, -0.5, 0.0625, 0.5, 0.5}, -- NodeBox11 } }, - groups = {cracky=1}, + groups = {cracky=1, dig_generic = 3}, on_place = minetest.rotate_node, sounds = scifi_nodes.node_sound_glass_defaults(), }) @@ -932,7 +935,7 @@ minetest.register_node("scifi_nodes:windowcorner2", { {-0.0625, -0.5, -0.5, 0.0625, 0.5, 0.5}, -- NodeBox11 } }, - groups = {cracky=1}, + groups = {cracky=1, dig_generic = 3}, on_place = minetest.rotate_node, sounds = scifi_nodes.node_sound_glass_defaults(), }) @@ -959,7 +962,7 @@ minetest.register_node("scifi_nodes:windowstraight2", { {-0.0625, -0.5, -0.5, 0.0625, 0.5, 0.5}, -- NodeBox11 } }, - groups = {cracky=1}, + groups = {cracky=1, dig_generic = 3}, on_place = minetest.rotate_node, sounds = scifi_nodes.node_sound_glass_defaults(), }) @@ -989,7 +992,7 @@ minetest.register_node("scifi_nodes:capsule", { {-0.3125, -0.4375, -0.1875, 0.3125, -0.0625, 0.1875}, -- NodeBox3 } }, - groups = {cracky=1, oddly_breakable_by_hand=1}, + groups = {cracky=1, oddly_breakable_by_hand=1, dig_generic = 3}, sounds = scifi_nodes.node_sound_glass_defaults(), on_rightclick = function(pos, node, clicker, item, _) minetest.set_node(pos, {name="scifi_nodes:capsule2", param2=node.param2}) @@ -1079,7 +1082,7 @@ minetest.register_node("scifi_nodes:itemholder", { {-0.25, -0.5, -0.0625, -0.1875, -0.0625, 0.0625}, -- NodeBox5 } }, - groups = {cracky=1}, + groups = {cracky=1, dig_generic = 3}, on_rotate = minetest.get_modpath("screwdriver") and screwdriver.disallow, after_place_node = function(pos, placer, itemstack) local meta = minetest.get_meta(pos) @@ -1219,7 +1222,7 @@ minetest.register_node("scifi_nodes:windowpanel", { {-0.0625, -0.5, -0.5, 0.0625, 0.5, 0.5}, -- NodeBox11 } }, - groups = {cracky=1}, + groups = {cracky=1, dig_generic = 3}, on_place = minetest.rotate_node, sounds = scifi_nodes.node_sound_glass_defaults(), }) diff --git a/nodes.lua b/nodes.lua index 9de2d34..371b542 100644 --- a/nodes.lua +++ b/nodes.lua @@ -1,14 +1,16 @@ --nodes -minetest.register_node("scifi_nodes:grassblk", { - description = "Dirt With Alien Grass", - tiles = {"default_grass.png^[colorize:cyan:80", "default_dirt.png", - {name = "default_dirt.png^(default_grass_side.png^[colorize:cyan:80)", - tileable_vertical = false}}, - light_source = 2, - groups = {crumbly=1, oddly_breakable_by_hand=1, soil=1} -}) +if minetest.get_modpath("default") then + minetest.register_node("scifi_nodes:grassblk", { + description = "Dirt With Alien Grass", + tiles = {"default_grass.png^[colorize:cyan:80", "default_dirt.png", + {name = "default_dirt.png^(default_grass_side.png^[colorize:cyan:80)", + tileable_vertical = false}}, + light_source = 2, + groups = {crumbly=1, oddly_breakable_by_hand=1, soil=1} + }) +end minetest.register_node("scifi_nodes:light", { description = "blue lightbox", @@ -23,7 +25,7 @@ minetest.register_node("scifi_nodes:light", { }, light_source = 10, paramtype = "light", - groups = {cracky=1} + groups = {cracky=1, dig_generic = 3} }) minetest.register_node("scifi_nodes:rfloor", { @@ -34,7 +36,7 @@ minetest.register_node("scifi_nodes:rfloor", { paramtype = "light", paramtype2 = "facedir", light_source = 10, - groups = {cracky=1}, + groups = {cracky=1, dig_generic = 3}, sounds = scifi_nodes.node_sound_metal_defaults() }) @@ -46,7 +48,7 @@ minetest.register_node("scifi_nodes:bfloor", { paramtype = "light", paramtype2 = "facedir", light_source = 10, - groups = {cracky=1}, + groups = {cracky=1, dig_generic = 3}, sounds = scifi_nodes.node_sound_metal_defaults() }) @@ -63,7 +65,7 @@ minetest.register_node("scifi_nodes:stripes2", { "scifi_nodes_stripes2.png" }, paramtype = "light", - groups = {cracky=1}, + groups = {cracky=1, dig_generic = 3}, sounds = scifi_nodes.node_sound_metal_defaults() }) @@ -79,7 +81,7 @@ minetest.register_node("scifi_nodes:gblock", { "scifi_nodes_gblock.png" }, paramtype = "light", - groups = {cracky=1}; + groups = {cracky=1, dig_generic = 3}; sounds = scifi_nodes.node_sound_metal_defaults() }) @@ -96,7 +98,7 @@ minetest.register_node("scifi_nodes:gblock2", { }, paramtype = "light", paramtype2 = "facedir", - groups = {cracky=1}, + groups = {cracky=1, dig_generic = 3}, sounds = scifi_nodes.node_sound_metal_defaults() }) @@ -113,7 +115,7 @@ minetest.register_node("scifi_nodes:gblock3", { }, paramtype = "light", paramtype2 = "facedir", - groups = {cracky=1}, + groups = {cracky=1, dig_generic = 3}, sounds = scifi_nodes.node_sound_metal_defaults() }) @@ -132,7 +134,7 @@ minetest.register_node("scifi_nodes:green_light", { }, light_source = 10, paramtype = "light", - groups = {cracky=1}, + groups = {cracky=1, dig_generic = 3}, sounds = scifi_nodes.node_sound_glass_defaults() }) @@ -149,7 +151,7 @@ minetest.register_node("scifi_nodes:red_light", { }, light_source = 10, paramtype = "light", - groups = {cracky=1}, + groups = {cracky=1, dig_generic = 3}, sounds = scifi_nodes.node_sound_glass_defaults() }) @@ -165,7 +167,7 @@ minetest.register_node("scifi_nodes:discs", { "scifi_nodes_discs.png" }, paramtype = "light", - groups = {cracky=1}, + groups = {cracky=1, dig_generic = 3}, sounds = scifi_nodes.node_sound_glass_defaults() }) @@ -179,7 +181,7 @@ minetest.register_node("scifi_nodes:disc", { inventory_image = "scifi_nodes_disc.png", wield_image = "scifi_nodes_disc.png", paramtype = "light", - groups = {cracky=1} + groups = {cracky=1, dig_generic = 3} }) minetest.register_node("scifi_nodes:greenbar_animated", { @@ -194,7 +196,7 @@ minetest.register_node("scifi_nodes:greenbar_animated", { }, paramtype = "light", paramtype2 = "facedir", - groups = {cracky=1}, + groups = {cracky=1, dig_generic = 3}, light_source = 10, sounds = scifi_nodes.node_sound_glass_defaults(), on_place = minetest.rotate_node @@ -208,7 +210,7 @@ minetest.register_node("scifi_nodes:blink", { animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=2.00}, }}, paramtype = "light", - groups = {cracky=1}, + groups = {cracky=1, dig_generic = 3}, light_source = 5, sounds = scifi_nodes.node_sound_glass_defaults() }) @@ -221,7 +223,7 @@ minetest.register_node("scifi_nodes:black_lights", { animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=0.50}, }}, paramtype = "light", - groups = {cracky=1}, + groups = {cracky=1, dig_generic = 3}, sounds = scifi_nodes.node_sound_glass_defaults() }) @@ -233,7 +235,7 @@ minetest.register_node("scifi_nodes:black_screen", { animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=2.00}, }}, paramtype = "light", - groups = {cracky=1}, + groups = {cracky=1, dig_generic = 3}, light_source = 1, sounds = scifi_nodes.node_sound_stone_defaults() }) @@ -246,7 +248,7 @@ minetest.register_node("scifi_nodes:screen", { animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=0.50}, }}, paramtype = "light", - groups = {cracky=1}, + groups = {cracky=1, dig_generic = 3}, light_source = 5, sounds = scifi_nodes.node_sound_glass_defaults() }) @@ -259,7 +261,7 @@ minetest.register_node("scifi_nodes:screen2", { animation={type="vertical_frames", aspect_w=16, aspect_h=16, length=0.50}, }}, paramtype = "light", - groups = {cracky=1}, + groups = {cracky=1, dig_generic = 3}, light_source = 5, sounds = scifi_nodes.node_sound_glass_defaults() }) @@ -279,7 +281,7 @@ minetest.register_node("scifi_nodes:white_pad", { }, paramtype = "light", paramtype2 = "facedir", - groups = {cracky=1}, + groups = {cracky=1, dig_generic = 3}, sounds = scifi_nodes.node_sound_glass_defaults() }) @@ -296,7 +298,7 @@ minetest.register_node("scifi_nodes:white_base", { }, paramtype = "light", paramtype2 = "facedir", - groups = {cracky=1}, + groups = {cracky=1, dig_generic = 3}, sounds = scifi_nodes.node_sound_glass_defaults() }) @@ -313,7 +315,7 @@ minetest.register_node("scifi_nodes:grnpipe", { }, paramtype = "light", paramtype2 = "facedir", - groups = {cracky=1}, + groups = {cracky=1, dig_generic = 3}, sounds = scifi_nodes.node_sound_metal_defaults(), on_place = minetest.rotate_node }) @@ -332,7 +334,7 @@ minetest.register_node("scifi_nodes:grnpipe2", { }, paramtype = "light", paramtype2 = "facedir", - groups = {cracky=1}, + groups = {cracky=1, dig_generic = 3}, sounds = scifi_nodes.node_sound_metal_defaults(), on_place = minetest.rotate_node }) @@ -348,7 +350,7 @@ minetest.register_node("scifi_nodes:octrng", { paramtype2 = "facedir", use_texture_alpha = "blend", light_source = 10, - groups = {cracky=2}, + groups = {cracky=2, dig_generic = 3}, sounds = scifi_nodes.node_sound_glass_defaults(), }) @@ -363,7 +365,7 @@ minetest.register_node("scifi_nodes:octgrn", { paramtype2 = "facedir", use_texture_alpha = "blend", light_source = 10, - groups = {cracky=2}, + groups = {cracky=2, dig_generic = 3}, sounds = scifi_nodes.node_sound_glass_defaults(), }) @@ -378,7 +380,7 @@ minetest.register_node("scifi_nodes:octbl", { paramtype2 = "facedir", use_texture_alpha = "blend", light_source = 10, - groups = {cracky=2}, + groups = {cracky=2, dig_generic = 3}, sounds = scifi_nodes.node_sound_glass_defaults(), }) @@ -393,7 +395,7 @@ minetest.register_node("scifi_nodes:octppl", { paramtype2 = "facedir", use_texture_alpha = "blend", light_source = 10, - groups = {cracky=2}, + groups = {cracky=2, dig_generic = 3}, sounds = scifi_nodes.node_sound_glass_defaults(), }) @@ -408,7 +410,7 @@ minetest.register_node("scifi_nodes:tower", { visual_scale = 2, inventory_image = "scifi_nodes_tower.png", paramtype = "light", - groups = {cracky=2}, + groups = {cracky=2, dig_generic = 3}, sounds = scifi_nodes.node_sound_metal_defaults() }) @@ -443,7 +445,7 @@ minetest.register_node("scifi_nodes:blumetlight", { }, light_source = 10, paramtype = "light", - groups = {cracky=1}, + groups = {cracky=1, dig_generic = 3}, sounds = scifi_nodes.node_sound_glass_defaults() }) @@ -456,7 +458,7 @@ minetest.register_node("scifi_nodes:lightstp", { }, light_source = minetest.LIGHT_MAX, paramtype = "light", - groups = {cracky=1}, + groups = {cracky=1, dig_generic = 3}, sounds = scifi_nodes.node_sound_glass_defaults() }) @@ -468,7 +470,7 @@ minetest.register_node("scifi_nodes:blklt2", { }, light_source = 10, paramtype = "light", - groups = {cracky=1}, + groups = {cracky=1, dig_generic = 3}, sounds = scifi_nodes.node_sound_glass_defaults() }) @@ -480,7 +482,7 @@ minetest.register_node("scifi_nodes:blumetstr", { }, light_source = 10, paramtype = "light", - groups = {cracky=1}, + groups = {cracky=1, dig_generic = 3}, sounds = scifi_nodes.node_sound_glass_defaults() }) @@ -493,7 +495,7 @@ minetest.register_node("scifi_nodes:glass", { }, use_texture_alpha = "blend", paramtype = "light", - groups = {cracky=1}, + groups = {cracky=1, dig_generic = 3}, sounds = scifi_nodes.node_sound_glass_defaults() }) @@ -505,7 +507,7 @@ minetest.register_node("scifi_nodes:whtlightbnd", { }, light_source = 10, paramtype = "light", - groups = {cracky=1}, + groups = {cracky=1, dig_generic = 3}, sounds = scifi_nodes.node_sound_glass_defaults() }) @@ -615,7 +617,7 @@ for _, row in ipairs(nodetypes) do local node_def = { description = desc, tiles = {"scifi_nodes_"..name..".png"}, - groups = {cracky=1}, + groups = {cracky=1, dig_generic = 3}, paramtype = "light", paramtype2 = "facedir", light_source = light,