Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix node digging grouops and sounds #20

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion mod.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name = facade
depends = default
optional_depends = mychisel
optional_depends = mychisel, bakedclay, darkage, nether
description = Adds decorative clay and stone-type nodes to Minetest Game.
121 changes: 81 additions & 40 deletions shapes.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,47 @@

local wehavechisels = minetest.get_modpath("mychisel")

local node_dig_groups = {
-- General groups
"not_in_creative_inventory",

-- Minetest Game dig groups
"crumbly", "cracky", "snappy", "choppy", "fleshy", "explody", "oddly_breakable_by_hand", "dig_immediate",

-- -- MineClone2 dig groups
-- "pickaxey", "axey", "shovely", "swordly", "shearsy", "handy", "creative_breakable",

-- -- MineClone2 interaction groups
-- "flammable", "fire_encouragement", "fire_flammability",
}
local function get_dig_groups(recipeitem)
local item = minetest.registered_items[recipeitem]

-- If item not found or is not node, return default
if not item or item.type ~= "node" then
-- Removing stone = 1: This is a craft group!
return {cracky = 3, oddly_breakable_by_hand = 2}
end

-- This node don't want to be dug
if not item.groups then
return {}
end

-- Preserve known dig groups
local return_groups = {}
for _, key in ipairs(node_dig_groups) do
return_groups[key] = item.groups[key]
end

return return_groups
end

local function get_node_sound(recipeitem)
local item = minetest.registered_items[recipeitem]
return item and item.sounds or default.node_sound_stone_defaults()
end

--------------
--Bannerstones
--------------
Expand All @@ -21,8 +62,8 @@ function facade.register_bannerstone(modname, subname, recipeitem, desc)
paramtype = "light",
paramtype2 = "facedir",
is_ground_content = false,
groups = {cracky = 3, oddly_breakable_by_hand = 2, stone = 1},
sounds = default.node_sound_stone_defaults(),
groups = get_dig_groups(recipeitem),
sounds = get_node_sound(recipeitem),
node_box = {
type = "fixed",
fixed = {
Expand Down Expand Up @@ -55,8 +96,8 @@ function facade.register_bannerstone_corner(modname, subname, recipeitem, desc)
paramtype = "light",
paramtype2 = "facedir",
is_ground_content = false,
groups = {cracky = 3, oddly_breakable_by_hand = 2, stone = 1},
sounds = default.node_sound_stone_defaults(),
groups = get_dig_groups(recipeitem),
sounds = get_node_sound(recipeitem),
node_box = {
type = "fixed",
fixed = {
Expand Down Expand Up @@ -86,8 +127,8 @@ function facade.register_centerstone(modname, subname, recipeitem, desc)
tiles = {"" .. modname.. "_" .. subname .. ".png^facade_centerstone.png"},
paramtype = "light",
is_ground_content = false,
groups = {cracky = 3, oddly_breakable_by_hand = 2, stone = 1},
sounds = default.node_sound_stone_defaults(),
groups = get_dig_groups(recipeitem),
sounds = get_node_sound(recipeitem),
node_box = {
type = "fixed",
fixed = {
Expand Down Expand Up @@ -147,8 +188,8 @@ function facade.register_column(modname, subname, recipeitem, desc)
paramtype = "light",
paramtype2 = "facedir",
is_ground_content = false,
groups = {cracky = 3, oddly_breakable_by_hand = 2, stone = 1},
sounds = default.node_sound_stone_defaults(),
groups = get_dig_groups(recipeitem),
sounds = get_node_sound(recipeitem),
node_box = {
type = "fixed",
fixed = {
Expand Down Expand Up @@ -186,8 +227,8 @@ function facade.register_column_corner(modname, subname, recipeitem, desc)
paramtype = "light",
paramtype2 = "facedir",
is_ground_content = false,
groups = {cracky = 3, oddly_breakable_by_hand = 2, stone = 1},
sounds = default.node_sound_stone_defaults(),
groups = get_dig_groups(recipeitem),
sounds = get_node_sound(recipeitem),
node_box = {
type = "fixed",
fixed = {
Expand Down Expand Up @@ -224,8 +265,8 @@ function facade.register_corbel(modname, subname, recipeitem, desc)
paramtype = "light",
paramtype2 = "facedir",
is_ground_content = false,
groups = {cracky = 3, oddly_breakable_by_hand = 2, stone = 1},
sounds = default.node_sound_stone_defaults(),
groups = get_dig_groups(recipeitem),
sounds = get_node_sound(recipeitem),
node_box = {
type = "fixed",
fixed = {
Expand All @@ -252,8 +293,8 @@ function facade.register_corbel_corner(modname, subname, recipeitem, desc)
paramtype = "light",
paramtype2 = "facedir",
is_ground_content = false,
groups = {cracky = 3, oddly_breakable_by_hand = 2, stone = 1},
sounds = default.node_sound_stone_defaults(),
groups = get_dig_groups(recipeitem),
sounds = get_node_sound(recipeitem),
node_box = {
type = "fixed",
fixed = {
Expand All @@ -280,8 +321,8 @@ function facade.register_corbel_corner_inner(modname, subname, recipeitem, desc)
paramtype = "light",
paramtype2 = "facedir",
is_ground_content = false,
groups = {cracky = 3, oddly_breakable_by_hand = 2, stone = 1},
sounds = default.node_sound_stone_defaults(),
groups = get_dig_groups(recipeitem),
sounds = get_node_sound(recipeitem),
node_box = {
type = "fixed",
fixed = {
Expand Down Expand Up @@ -320,8 +361,8 @@ function facade.register_carved_stone_a(modname, subname, recipeitem, desc)
paramtype = "light",
paramtype2 = "facedir",
is_ground_content = false,
groups = {cracky = 3, oddly_breakable_by_hand = 2, stone = 1},
sounds = default.node_sound_stone_defaults(),
groups = get_dig_groups(recipeitem),
sounds = get_node_sound(recipeitem),
node_box = {
type = "fixed",
fixed = {
Expand Down Expand Up @@ -362,8 +403,8 @@ function facade.register_carved_stone_a_corner(modname, subname, recipeitem, des
paramtype = "light",
paramtype2 = "facedir",
is_ground_content = false,
groups = {cracky = 3, oddly_breakable_by_hand = 2, stone = 1},
sounds = default.node_sound_stone_defaults(),
groups = get_dig_groups(recipeitem),
sounds = get_node_sound(recipeitem),
node_box = {
type = "fixed",
fixed = {
Expand Down Expand Up @@ -417,8 +458,8 @@ function facade.register_rgspro(modname, subname, recipeitem, desc)
paramtype = "light",
paramtype2 = "facedir",
is_ground_content = false,
groups = {cracky = 3, oddly_breakable_by_hand = 2, stone = 1},
sounds = default.node_sound_stone_defaults(),
groups = get_dig_groups(recipeitem),
sounds = get_node_sound(recipeitem),
node_box = {
type = "fixed",
fixed = {
Expand Down Expand Up @@ -451,8 +492,8 @@ function facade.register_rgspro_inner_corner(modname, subname, recipeitem, desc)
paramtype = "light",
paramtype2 = "facedir",
is_ground_content = false,
groups = {cracky = 3, oddly_breakable_by_hand = 2, stone = 1},
sounds = default.node_sound_stone_defaults(),
groups = get_dig_groups(recipeitem),
sounds = get_node_sound(recipeitem),
node_box = {
type = "fixed",
fixed = {
Expand Down Expand Up @@ -489,8 +530,8 @@ function facade.register_rgspro_outer_corner(modname, subname, recipeitem, desc)
paramtype = "light",
paramtype2 = "facedir",
is_ground_content = false,
groups = {cracky = 3, oddly_breakable_by_hand = 2, stone = 1},
sounds = default.node_sound_stone_defaults(),
groups = get_dig_groups(recipeitem),
sounds = get_node_sound(recipeitem),
node_box = {
type = "fixed",
fixed = {
Expand Down Expand Up @@ -528,8 +569,8 @@ function facade.register_corner_bricks(modname, subname, recipeitem, desc)
paramtype = "light",
paramtype2 = "facedir",
is_ground_content = false,
groups = {cracky = 3, oddly_breakable_by_hand = 2, stone = 1},
sounds = default.node_sound_stone_defaults(),
groups = get_dig_groups(recipeitem),
sounds = get_node_sound(recipeitem),
node_box = {
type = "fixed",
fixed = {
Expand Down Expand Up @@ -594,8 +635,8 @@ if not minetest.get_modpath("columnia") then
paramtype = "light",
paramtype2 = "facedir",
is_ground_content = false,
groups = {cracky = 3, oddly_breakable_by_hand = 2, stone = 1},
sounds = default.node_sound_stone_defaults(),
groups = get_dig_groups(recipeitem),
sounds = get_node_sound(recipeitem),
on_place = minetest.rotate_node,
node_box = {
type = "fixed",
Expand All @@ -618,8 +659,8 @@ if not minetest.get_modpath("columnia") then
paramtype = "light",
paramtype2 = "facedir",
is_ground_content = false,
groups = {cracky = 3, oddly_breakable_by_hand = 2, stone = 1},
sounds = default.node_sound_stone_defaults(),
groups = get_dig_groups(recipeitem),
sounds = get_node_sound(recipeitem),
on_place = minetest.rotate_node,
node_box = {
type = "fixed",
Expand Down Expand Up @@ -650,8 +691,8 @@ if not minetest.get_modpath("columnia") then
paramtype = "light",
paramtype2 = "facedir",
is_ground_content = false,
groups = {cracky = 3, oddly_breakable_by_hand = 2, stone = 1},
sounds = default.node_sound_stone_defaults(),
groups = get_dig_groups(recipeitem),
sounds = get_node_sound(recipeitem),
on_place = minetest.rotate_node,
node_box = {
type = "fixed",
Expand All @@ -675,8 +716,8 @@ if not minetest.get_modpath("columnia") then
paramtype = "light",
paramtype2 = "facedir",
is_ground_content = false,
groups = {cracky = 3, oddly_breakable_by_hand = 2, stone = 1},
sounds = default.node_sound_stone_defaults(),
groups = get_dig_groups(recipeitem),
sounds = get_node_sound(recipeitem),
on_place = columnia_rotate,
node_box = {
type = "fixed",
Expand All @@ -699,8 +740,8 @@ if not minetest.get_modpath("columnia") then
paramtype = "light",
paramtype2 = "facedir",
is_ground_content = false,
groups = {cracky = 3, oddly_breakable_by_hand = 2, stone = 1},
sounds = default.node_sound_stone_defaults(),
groups = get_dig_groups(recipeitem),
sounds = get_node_sound(recipeitem),
on_place = columnia_rotate,
node_box = {
type = "fixed",
Expand All @@ -720,8 +761,8 @@ if not minetest.get_modpath("columnia") then
paramtype = "light",
paramtype2 = "facedir",
is_ground_content = false,
groups = {cracky = 3, oddly_breakable_by_hand = 2, stone = 1},
sounds = default.node_sound_stone_defaults(),
groups = get_dig_groups(recipeitem),
sounds = get_node_sound(recipeitem),
on_place = columnia_rotate,
node_box = {
type = "fixed",
Expand Down