From 33baa3ba7648be8863726be2a361d8c75faafd29 Mon Sep 17 00:00:00 2001 From: An0n3m0us Date: Tue, 17 Mar 2020 19:52:31 +0000 Subject: [PATCH] Fix texture overlaying; Add registry for mese posts --- mods/default/crafting.lua | 45 ------- mods/default/functions.lua | 45 +++++++ mods/default/nodes.lua | 120 +++--------------- .../textures/default_mese_post_light_side.png | Bin 276 -> 314 bytes .../default_mese_post_light_side_dark.png | Bin 258 -> 320 bytes 5 files changed, 60 insertions(+), 150 deletions(-) diff --git a/mods/default/crafting.lua b/mods/default/crafting.lua index 520ea6de..ecbe9d12 100644 --- a/mods/default/crafting.lua +++ b/mods/default/crafting.lua @@ -300,51 +300,6 @@ minetest.register_craft({ } }) -minetest.register_craft({ - output = "default:mese_post_light 3", - recipe = { - {"", "default:glass", ""}, - {"default:mese_crystal", "default:mese_crystal", "default:mese_crystal"}, - {"", "default:wood", ""}, - } -}) - -minetest.register_craft({ - output = "default:mese_post_light_acaciawood 3", - recipe = { - {"", "default:glass", ""}, - {"default:mese_crystal", "default:mese_crystal", "default:mese_crystal"}, - {"", "default:acacia_wood", ""}, - } -}) - -minetest.register_craft({ - output = "default:mese_post_light_junglewood 3", - recipe = { - {"", "default:glass", ""}, - {"default:mese_crystal", "default:mese_crystal", "default:mese_crystal"}, - {"", "default:junglewood", ""}, - } -}) - -minetest.register_craft({ - output = "default:mese_post_light_pine_wood 3", - recipe = { - {"", "default:glass", ""}, - {"default:mese_crystal", "default:mese_crystal", "default:mese_crystal"}, - {"", "default:pine_wood", ""}, - } -}) - -minetest.register_craft({ - output = "default:mese_post_light_aspen_wood 3", - recipe = { - {"", "default:glass", ""}, - {"default:mese_crystal", "default:mese_crystal", "default:mese_crystal"}, - {"", "default:aspen_wood", ""}, - } -}) - minetest.register_craft({ output = "default:obsidian", recipe = { diff --git a/mods/default/functions.lua b/mods/default/functions.lua index f67eadff..b8f2aa85 100644 --- a/mods/default/functions.lua +++ b/mods/default/functions.lua @@ -406,6 +406,51 @@ function default.register_fence_rail(name, def) minetest.register_node(name, def) end +-- +-- Mese post registration helper +-- + +function default.register_mesepost(name, def) + minetest.register_craft({ + output = name .. " 4", + recipe = { + {'', 'default:glass', ''}, + {'default:mese_crystal', 'default:mese_crystal', 'default:mese_crystal'}, + {' ', def.material, ''}, + } + }) + + local post_texture = def.texture .. "^default_mese_post_light_side.png^[makealpha:255,126,126" + local post_texture_dark = def.texture .. "^default_mese_post_light_side_dark.png^[makealpha:255,126,126" + -- Allow almost everything to be overridden + local default_fields = { + wield_image = post_texture, + drawtype = "nodebox", + node_box = { + type = "fixed", + fixed = { + {-2 / 16, -8 / 16, -2 / 16, 2 / 16, 8 / 16, 2 / 16}, + }, + }, + paramtype = "light", + tiles = {def.texture, def.texture, post_texture_dark, post_texture_dark, post_texture, post_texture}, + light_source = default.LIGHT_MAX, + sunlight_propagates = true, + is_ground_content = false, + groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2}, + sounds = default.node_sound_wood_defaults(), + } + for k, v in pairs(default_fields) do + if def[k] == nil then + def[k] = v + end + end + + 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 f78bea50..c6a6cae3 100644 --- a/mods/default/nodes.lua +++ b/mods/default/nodes.lua @@ -2839,124 +2839,34 @@ minetest.register_node("default:meselamp", { light_source = default.LIGHT_MAX, }) -minetest.register_node("default:mese_post_light", { +default.register_mesepost("default:mese_post_light", { description = S("Apple Wood Mese Post Light"), - tiles = {"default_wood.png", "default_wood.png", - "default_wood.png^default_mese_post_light_side_dark.png", - "default_wood.png^default_mese_post_light_side_dark.png", - "default_wood.png^default_mese_post_light_side.png", - "default_wood.png^default_mese_post_light_side.png" - }, - wield_image = "default_mese_post_light_side.png", - drawtype = "nodebox", - node_box = { - type = "fixed", - fixed = { - {-2 / 16, -8 / 16, -2 / 16, 2 / 16, 8 / 16, 2 / 16}, - }, - }, - paramtype = "light", - light_source = default.LIGHT_MAX, - sunlight_propagates = true, - is_ground_content = false, - groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2}, - sounds = default.node_sound_wood_defaults(), + texture = "default_fence_wood.png", + material = "default:wood", }) -minetest.register_node("default:mese_post_light_acaciawood", { +default.register_mesepost("default:mese_post_light_acacia", { description = S("Acacia Wood Mese Post Light"), - tiles = {"default_acacia_wood.png", "default_acacia_wood.png", - "default_acacia_wood.png^default_mese_post_light_side_dark.png", - "default_acacia_wood.png^default_mese_post_light_side_dark.png", - "default_acacia_wood.png^default_mese_post_light_side.png", - "default_acacia_wood.png^default_mese_post_light_side.png" - }, - wield_image = "default_mese_post_light_side.png", - drawtype = "nodebox", - node_box = { - type = "fixed", - fixed = { - {-2 / 16, -8 / 16, -2 / 16, 2 / 16, 8 / 16, 2 / 16}, - }, - }, - paramtype = "light", - light_source = default.LIGHT_MAX, - sunlight_propagates = true, - is_ground_content = false, - groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2}, - sounds = default.node_sound_wood_defaults(), + texture = "default_fence_acacia_wood.png", + material = "default:acacia_wood", }) -minetest.register_node("default:mese_post_light_junglewood", { +default.register_mesepost("default:mese_post_light_junglewood", { description = S("Jungle Wood Mese Post Light"), - tiles = {"default_junglewood.png", "default_junglewood.png", - "default_junglewood.png^default_mese_post_light_side_dark.png", - "default_junglewood.png^default_mese_post_light_side_dark.png", - "default_junglewood.png^default_mese_post_light_side.png", - "default_junglewood.png^default_mese_post_light_side.png" - }, - wield_image = "default_mese_post_light_side.png", - drawtype = "nodebox", - node_box = { - type = "fixed", - fixed = { - {-2 / 16, -8 / 16, -2 / 16, 2 / 16, 8 / 16, 2 / 16}, - }, - }, - paramtype = "light", - light_source = default.LIGHT_MAX, - sunlight_propagates = true, - is_ground_content = false, - groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2}, - sounds = default.node_sound_wood_defaults(), + texture = "default_fence_junglewood.png", + material = "default:junglewood", }) -minetest.register_node("default:mese_post_light_pine_wood", { +default.register_mesepost("default:mese_post_light_pine_wood", { description = S("Pine Wood Mese Post Light"), - tiles = {"default_pine_wood.png", "default_pine_wood.png", - "default_pine_wood.png^default_mese_post_light_side_dark.png", - "default_pine_wood.png^default_mese_post_light_side_dark.png", - "default_pine_wood.png^default_mese_post_light_side.png", - "default_pine_wood.png^default_mese_post_light_side.png" - }, - wield_image = "default_mese_post_light_side.png", - drawtype = "nodebox", - node_box = { - type = "fixed", - fixed = { - {-2 / 16, -8 / 16, -2 / 16, 2 / 16, 8 / 16, 2 / 16}, - }, - }, - paramtype = "light", - light_source = default.LIGHT_MAX, - sunlight_propagates = true, - is_ground_content = false, - groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2}, - sounds = default.node_sound_wood_defaults(), + texture = "default_fence_pine_wood.png", + material = "default:pine_wood", }) -minetest.register_node("default:mese_post_light_aspen_wood", { +default.register_mesepost("default:mese_post_light_aspen_wood", { description = S("Aspen Wood Mese Post Light"), - tiles = {"default_aspen_wood.png", "default_aspen_wood.png", - "default_aspen_wood.png^default_mese_post_light_side_dark.png", - "default_aspen_wood.png^default_mese_post_light_side_dark.png", - "default_aspen_wood.png^default_mese_post_light_side.png", - "default_aspen_wood.png^default_mese_post_light_side.png" - }, - wield_image = "default_mese_post_light_side.png", - drawtype = "nodebox", - node_box = { - type = "fixed", - fixed = { - {-2 / 16, -8 / 16, -2 / 16, 2 / 16, 8 / 16, 2 / 16}, - }, - }, - paramtype = "light", - light_source = default.LIGHT_MAX, - sunlight_propagates = true, - is_ground_content = false, - groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2}, - sounds = default.node_sound_wood_defaults(), + texture = "default_fence_aspen_wood.png", + material = "default:aspen_wood", }) -- diff --git a/mods/default/textures/default_mese_post_light_side.png b/mods/default/textures/default_mese_post_light_side.png index 0e169fecd03f676360fefcc567ce51cc0292e3a4..c05af0073d32772f039fff512001439a552240b1 100644 GIT binary patch delta 249 zcmV)Qh$KmwA0-wp#pbKur3NJl4-5rvU+7I0^VOL9NR^CwiNR?O}|^$d~_ z!aE}4;Q$&?9B>CM%x29IlrPZ8t$Rd?<~uf^b5skQ+cV3bO~4%CdYK?3Aj0)?$9yPo ztXE`N20)CFCG{|%s;XbB{9>%K`3HZke*k;~$rVG@yAjAt00000NkvXXu0mjf++lN$ delta 211 zcmV;^04)Ey0+a%fNq@FUL_t(IjqQ&;4uW71MBjdZ3IR>HgPonVvGYhAf+Oh-tc;1# z-dHONK@xN=Y~8}2(rIV%G7r9tSVf-anx-jLRnasJS(d%rnt=0VuFu*7@#x3Xms{Tg zl+~JBJH!umAc3jitm00L^AAMP1l67iFdwMyK|IQGfk@|l08CnA>0B!2{RLP=Bz2nYy#2xN!=000SaNLh0L01m_e01m_fl`9S#0002u zNkl=cqnfF}nlRFOUfDcZfXn2T+gV zfE#FLHfxTcoIwNE%M2x$@7REjQO$7fjZwNV0ds`YVTcfc2&dyKRQ-I7Sz)1mYp~3_gKNM>03XmgT#8Brm4npOi>h6RYj5{wX7*PU*`H6 zdmtX&Xk5$smLMAj0_v!f=FY+Z31^s9)|uJo0>jNb`FEnxi=2 z0opM!GlFsjExF%@DCG|V?V;MixfM}3F$HFX?ASu^K!ohH{9dr#3kBn1{rN gr)>Vgr}YPdCz}2{i2VhPZ2$lO07*qoM6N<$g7}wjnE(I)