From 7e1b07fdddae7a397d82d446d4a37577c1527b7b Mon Sep 17 00:00:00 2001 From: TumeniNodes Date: Sat, 7 Jul 2018 14:03:33 -0400 Subject: [PATCH] Add fence rails Dedicated fence rail textures coming in a follow-up PR. --- mods/default/crafting.lua | 31 ++++++ mods/default/functions.lua | 67 ++++++++++++- mods/default/nodes.lua | 90 ++++++++++++++++-- .../textures/default_fence_rail_overlay.png | Bin 0 -> 141 bytes mods/walls/init.lua | 2 +- 5 files changed, 178 insertions(+), 12 deletions(-) create mode 100644 mods/default/textures/default_fence_rail_overlay.png diff --git a/mods/default/crafting.lua b/mods/default/crafting.lua index 428c0f45..c0f2252f 100644 --- a/mods/default/crafting.lua +++ b/mods/default/crafting.lua @@ -1015,6 +1015,37 @@ minetest.register_craft({ }) +minetest.register_craft({ + type = "fuel", + recipe = "default:fence_rail_aspen_wood", + burntime = 3, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:fence_rail_pine_wood", + burntime = 4, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:fence_rail_wood", + burntime = 5, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:fence_rail_acacia_wood", + burntime = 6, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:fence_rail_junglewood", + burntime = 7, +}) + + minetest.register_craft({ type = "fuel", recipe = "default:bush_stem", diff --git a/mods/default/functions.lua b/mods/default/functions.lua index d43ab7b9..5dd0d2c8 100644 --- a/mods/default/functions.lua +++ b/mods/default/functions.lua @@ -303,7 +303,7 @@ function default.register_fence(name, def) connect_right = {{1/8,3/16,-1/16,1/2,5/16,1/16}, {1/8,-5/16,-1/16,1/2,-3/16,1/16}}, }, - connects_to = {"group:fence", "group:wood", "group:tree"}, + connects_to = {"group:fence", "group:wood", "group:tree", "group:wall"}, inventory_image = fence_texture, wield_image = fence_texture, tiles = {def.texture}, @@ -327,6 +327,71 @@ function default.register_fence(name, def) end +-- +-- Fence rail registration helper +-- + +function default.register_fence_rail(name, def) + minetest.register_craft({ + output = name .. " 16", + recipe = { + { def.material, def.material }, + { "", ""}, + { def.material, def.material }, + } + }) + + local fence_rail_texture = "default_fence_rail_overlay.png^" .. def.texture .. + "^default_fence_rail_overlay.png^[makealpha:255,126,126" + -- Allow almost everything to be overridden + local default_fields = { + paramtype = "light", + drawtype = "nodebox", + node_box = { + type = "connected", + fixed = { + {-1/16, 3/16, -1/16, 1/16, 5/16, 1/16}, + {-1/16, -3/16, -1/16, 1/16, -5/16, 1/16} + }, + -- connect_top = + -- connect_bottom = + connect_front = { + {-1/16, 3/16, -1/2, 1/16, 5/16, -1/16}, + {-1/16, -5/16, -1/2, 1/16, -3/16, -1/16}}, + connect_left = { + {-1/2, 3/16, -1/16, -1/16, 5/16, 1/16}, + {-1/2, -5/16, -1/16, -1/16, -3/16, 1/16}}, + connect_back = { + {-1/16, 3/16, 1/16, 1/16, 5/16, 1/2}, + {-1/16, -5/16, 1/16, 1/16, -3/16, 1/2}}, + connect_right = { + {1/16, 3/16, -1/16, 1/2, 5/16, 1/16}, + {1/16, -5/16, -1/16, 1/2, -3/16, 1/16}}, + }, + connects_to = {"group:fence", "group:wood", "group:tree", "group:wall"}, + inventory_image = fence_rail_texture, + wield_image = fence_rail_texture, + tiles = {def.texture}, + sunlight_propagates = true, + is_ground_content = false, + groups = {}, + } + for k, v in pairs(default_fields) do + if def[k] == nil then + def[k] = v + end + end + + -- Always add to the fence group, even if no group provided + def.groups.fence = 1 + + def.texture = nil + def.material = nil + + minetest.register_node(name, def) +end + + -- -- Leafdecay -- diff --git a/mods/default/nodes.lua b/mods/default/nodes.lua index 6b0785e2..2ef3b93b 100644 --- a/mods/default/nodes.lua +++ b/mods/default/nodes.lua @@ -2590,8 +2590,10 @@ minetest.register_node("default:ladder_steel", { default.register_fence("default:fence_wood", { description = "Apple Wood Fence", texture = "default_fence_wood.png", - inventory_image = "default_fence_overlay.png^default_wood.png^default_fence_overlay.png^[makealpha:255,126,126", - wield_image = "default_fence_overlay.png^default_wood.png^default_fence_overlay.png^[makealpha:255,126,126", + inventory_image = "default_fence_overlay.png^default_wood.png^" .. + "default_fence_overlay.png^[makealpha:255,126,126", + wield_image = "default_fence_overlay.png^default_wood.png^" .. + "default_fence_overlay.png^[makealpha:255,126,126", material = "default:wood", groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2}, sounds = default.node_sound_wood_defaults() @@ -2600,8 +2602,10 @@ default.register_fence("default:fence_wood", { default.register_fence("default:fence_acacia_wood", { description = "Acacia Wood Fence", texture = "default_fence_acacia_wood.png", - inventory_image = "default_fence_overlay.png^default_acacia_wood.png^default_fence_overlay.png^[makealpha:255,126,126", - wield_image = "default_fence_overlay.png^default_acacia_wood.png^default_fence_overlay.png^[makealpha:255,126,126", + inventory_image = "default_fence_overlay.png^default_acacia_wood.png^" .. + "default_fence_overlay.png^[makealpha:255,126,126", + wield_image = "default_fence_overlay.png^default_acacia_wood.png^" .. + "default_fence_overlay.png^[makealpha:255,126,126", material = "default:acacia_wood", groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2}, sounds = default.node_sound_wood_defaults() @@ -2610,8 +2614,10 @@ default.register_fence("default:fence_acacia_wood", { default.register_fence("default:fence_junglewood", { description = "Jungle Wood Fence", texture = "default_fence_junglewood.png", - inventory_image = "default_fence_overlay.png^default_junglewood.png^default_fence_overlay.png^[makealpha:255,126,126", - wield_image = "default_fence_overlay.png^default_junglewood.png^default_fence_overlay.png^[makealpha:255,126,126", + inventory_image = "default_fence_overlay.png^default_junglewood.png^" .. + "default_fence_overlay.png^[makealpha:255,126,126", + wield_image = "default_fence_overlay.png^default_junglewood.png^" .. + "default_fence_overlay.png^[makealpha:255,126,126", material = "default:junglewood", groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2}, sounds = default.node_sound_wood_defaults() @@ -2620,8 +2626,10 @@ default.register_fence("default:fence_junglewood", { default.register_fence("default:fence_pine_wood", { description = "Pine Wood Fence", texture = "default_fence_pine_wood.png", - inventory_image = "default_fence_overlay.png^default_pine_wood.png^default_fence_overlay.png^[makealpha:255,126,126", - wield_image = "default_fence_overlay.png^default_pine_wood.png^default_fence_overlay.png^[makealpha:255,126,126", + inventory_image = "default_fence_overlay.png^default_pine_wood.png^" .. + "default_fence_overlay.png^[makealpha:255,126,126", + wield_image = "default_fence_overlay.png^default_pine_wood.png^" .. + "default_fence_overlay.png^[makealpha:255,126,126", material = "default:pine_wood", groups = {choppy = 3, oddly_breakable_by_hand = 2, flammable = 3}, sounds = default.node_sound_wood_defaults() @@ -2630,13 +2638,75 @@ default.register_fence("default:fence_pine_wood", { default.register_fence("default:fence_aspen_wood", { description = "Aspen Wood Fence", texture = "default_fence_aspen_wood.png", - inventory_image = "default_fence_overlay.png^default_aspen_wood.png^default_fence_overlay.png^[makealpha:255,126,126", - wield_image = "default_fence_overlay.png^default_aspen_wood.png^default_fence_overlay.png^[makealpha:255,126,126", + inventory_image = "default_fence_overlay.png^default_aspen_wood.png^" .. + "default_fence_overlay.png^[makealpha:255,126,126", + wield_image = "default_fence_overlay.png^default_aspen_wood.png^" .. + "default_fence_overlay.png^[makealpha:255,126,126", material = "default:aspen_wood", groups = {choppy = 3, oddly_breakable_by_hand = 2, flammable = 3}, sounds = default.node_sound_wood_defaults() }) +default.register_fence_rail("default:fence_rail_wood", { + description = "Apple Wood Fence Rail", + texture = "default_wood.png", + inventory_image = "default_fence_rail_overlay.png^default_wood.png^" .. + "default_fence_rail_overlay.png^[makealpha:255,126,126", + wield_image = "default_fence_rail_overlay.png^default_wood.png^" .. + "default_fence_rail_overlay.png^[makealpha:255,126,126", + material = "default:wood", + groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2}, + sounds = default.node_sound_wood_defaults() +}) + +default.register_fence_rail("default:fence_rail_acacia_wood", { + description = "Acacia Wood Fence Rail", + texture = "default_acacia_wood.png", + inventory_image = "default_fence_rail_overlay.png^default_acacia_wood.png^" .. + "default_fence_rail_overlay.png^[makealpha:255,126,126", + wield_image = "default_fence_rail_overlay.png^default_acacia_wood.png^" .. + "default_fence_rail_overlay.png^[makealpha:255,126,126", + material = "default:acacia_wood", + groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2}, + sounds = default.node_sound_wood_defaults() +}) + +default.register_fence_rail("default:fence_rail_junglewood", { + description = "Jungle Wood Fence Rail", + texture = "default_junglewood.png", + inventory_image = "default_fence_rail_overlay.png^default_junglewood.png^" .. + "default_fence_rail_overlay.png^[makealpha:255,126,126", + wield_image = "default_fence_rail_overlay.png^default_junglewood.png^" .. + "default_fence_rail_overlay.png^[makealpha:255,126,126", + material = "default:junglewood", + groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2}, + sounds = default.node_sound_wood_defaults() +}) + +default.register_fence_rail("default:fence_rail_pine_wood", { + description = "Pine Wood Fence Rail", + texture = "default_pine_wood.png", + inventory_image = "default_fence_rail_overlay.png^default_pine_wood.png^" .. + "default_fence_rail_overlay.png^[makealpha:255,126,126", + wield_image = "default_fence_rail_overlay.png^default_pine_wood.png^" .. + "default_fence_rail_overlay.png^[makealpha:255,126,126", + material = "default:pine_wood", + groups = {choppy = 3, oddly_breakable_by_hand = 2, flammable = 3}, + sounds = default.node_sound_wood_defaults() +}) + +default.register_fence_rail("default:fence_rail_aspen_wood", { + description = "Aspen Wood Fence Rail", + texture = "default_aspen_wood.png", + inventory_image = "default_fence_rail_overlay.png^default_aspen_wood.png^" .. + "default_fence_rail_overlay.png^[makealpha:255,126,126", + wield_image = "default_fence_rail_overlay.png^default_aspen_wood.png^" .. + "default_fence_rail_overlay.png^[makealpha:255,126,126", + material = "default:aspen_wood", + groups = {choppy = 3, oddly_breakable_by_hand = 2, flammable = 2}, + sounds = default.node_sound_wood_defaults() +}) + minetest.register_node("default:glass", { description = "Glass", drawtype = "glasslike_framed_optional", diff --git a/mods/default/textures/default_fence_rail_overlay.png b/mods/default/textures/default_fence_rail_overlay.png new file mode 100644 index 0000000000000000000000000000000000000000..4da47aecf1e334627c721be3a72123cb12c7c0c4 GIT binary patch literal 141 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!73?$#)eFPFv3GfMVWnp1v1hN?z{{R2a!~|mg z|MLgP{s%;VfaIV5b#(_dn)rYcj3q&S!3+-1ZlnP@;+`&!Asp9}Z}776R7glm9B7a} dxL~Fp!!#vNUbiLR6M#w>JYD@<);T3K0RXa;E`$I8 literal 0 HcmV?d00001 diff --git a/mods/walls/init.lua b/mods/walls/init.lua index bee8e465..564d6df0 100644 --- a/mods/walls/init.lua +++ b/mods/walls/init.lua @@ -14,7 +14,7 @@ walls.register = function(wall_name, wall_desc, wall_texture, wall_mat, wall_sou connect_back = {{-3/16, -1/2, 1/4, 3/16, 3/8, 1/2}}, connect_right = {{ 1/4, -1/2, -3/16, 1/2, 3/8, 3/16}}, }, - connects_to = { "group:wall", "group:stone" }, + connects_to = { "group:wall", "group:stone", "group:fence" }, paramtype = "light", is_ground_content = false, tiles = { wall_texture, }, -- 2.25.1