From 686fdb5c064d60146a6d343ad9dda866586a7a8b Mon Sep 17 00:00:00 2001 From: An0n3m0us Date: Sun, 16 Aug 2020 12:21:22 +0100 Subject: [PATCH] Add different woods to mese posts (#2599) --- mods/default/crafting.lua | 9 ---- mods/default/functions.lua | 45 ++++++++++++++++ mods/default/nodes.lua | 51 +++++++++++------- .../textures/default_mese_post_light_side.png | Bin 353 -> 294 bytes .../default_mese_post_light_side_dark.png | Bin 353 -> 301 bytes .../textures/default_mese_post_light_top.png | Bin 128 -> 0 bytes 6 files changed, 77 insertions(+), 28 deletions(-) delete mode 100644 mods/default/textures/default_mese_post_light_top.png diff --git a/mods/default/crafting.lua b/mods/default/crafting.lua index bc436fc5..ecbe9d12 100644 --- a/mods/default/crafting.lua +++ b/mods/default/crafting.lua @@ -300,15 +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"}, - {"", "group:wood", ""}, - } -}) - minetest.register_craft({ output = "default:obsidian", recipe = { diff --git a/mods/default/functions.lua b/mods/default/functions.lua index 3dd7a008..3a4f8fc9 100644 --- a/mods/default/functions.lua +++ b/mods/default/functions.lua @@ -421,6 +421,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:0,0,0" + local post_texture_dark = def.texture .. "^default_mese_post_light_side_dark.png^[makealpha:0,0,0" + -- 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 d2a29151..4b6fb509 100644 --- a/mods/default/nodes.lua +++ b/mods/default/nodes.lua @@ -221,6 +221,10 @@ default:brick default:meselamp default:mese_post_light +default:mese_post_light_acacia_wood +default:mese_post_light_junglewood +default:mese_post_light_pine_wood +default:mese_post_light_aspen_wood Misc ---- @@ -2836,25 +2840,34 @@ minetest.register_node("default:meselamp", { light_source = default.LIGHT_MAX, }) -minetest.register_node("default:mese_post_light", { - description = S("Mese Post Light"), - tiles = {"default_mese_post_light_top.png", "default_mese_post_light_top.png", - "default_mese_post_light_side_dark.png", "default_mese_post_light_side_dark.png", - "default_mese_post_light_side.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(), +default.register_mesepost("default:mese_post_light", { + description = S("Apple Wood Mese Post Light"), + texture = "default_fence_wood.png", + material = "default:wood", +}) + +default.register_mesepost("default:mese_post_light_acacia", { + description = S("Acacia Wood Mese Post Light"), + texture = "default_fence_acacia_wood.png", + material = "default:acacia_wood", +}) + +default.register_mesepost("default:mese_post_light_junglewood", { + description = S("Jungle Wood Mese Post Light"), + texture = "default_fence_junglewood.png", + material = "default:junglewood", +}) + +default.register_mesepost("default:mese_post_light_pine_wood", { + description = S("Pine Wood Mese Post Light"), + texture = "default_fence_pine_wood.png", + material = "default:pine_wood", +}) + +default.register_mesepost("default:mese_post_light_aspen_wood", { + description = S("Aspen Wood Mese Post Light"), + 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 c23b551a7cc0c6771679dbcfc0ff94f493ae859a..a94e8b1b4b9ef6243c513d1663a7a217966505b3 100644 GIT binary patch delta 278 zcmV+x0qOqX0;U3x8Gi-<001BJ|6u?C00eVFNmK|32nc)#WQYI&010qNS#tmY3ljhU z3ljkVnw%H_0078IL_t(Ijop$x3c^4Tg}>RvpM6qNO0kSIG&)|H38-Zs(X-tvRok2{vLpqC=Pgl_Dq`@ zLAip~+;3x)`UijxQ0?K|iX@(y05d{y>>vanLUCGt57=%-L{S7lUE2}NL*m0zHviz$ c`UAid0rowFWDke(p8x;=07*qoM6N<$f~{I`XaE2J delta 316 zcmV-C0mJ^L0^tIX8Gi!+001a04^sdD0EAFXR7C&)07^L@PCOxTRx5X2Hj!~bm2^Ui zii(kuk(`{Isi~>5va-_Debdx{)7630)q~>ZXW`{`rr5;2@>51m)mNVz-j_~oh^7Fd#^Sko% zzVY+M^7O&UlVs)q0004WQchC_Nndy$RD05ZiuS z5Pdr>5W{%R5M@($5J{R<5Pp~!5J4QR5Vqrb5Yn`I_Va diff --git a/mods/default/textures/default_mese_post_light_side_dark.png b/mods/default/textures/default_mese_post_light_side_dark.png index c4fc7ceac3c46b6186e313504f2ff17f3c40e62f..90983145a2daf1d47741215d49babe9e7fba8dda 100644 GIT binary patch delta 285 zcmV+&0pkAQ0<8j&8Gi-<001BJ|6u?C00eVFNmK|32nc)#WQYI&010qNS#tmY4#WTe z4#WYKD-Ig~007TPL_t(Ijop$lZi7$^hCe?b2?!dAJ7mk&IqKHEm*Egxrh9vXPEn+& z-J{GY35X&A?$W7xmPp2Uv;FI{f6D?W{&@M9zxqUC0m`x@&wq28rlIRPilXpNF#+ex z+h02X33y1KynxVK1?pzU(60!iFObNR;jG3;iVKe<$p+Ph2{1QMJ%9w%^*bW7>j7wu z;(!q}Gi9a)5va-_Debdx{)7630)q~>ZXW`{`rr5;2@>51m)mVf8!j_~oh^7Fd#^Sko% zzVY+M^7O$~naF$q0004WQchC`FnziMnh_`S#O6DC3Xq#!Ui{m8&Luxl; Uvi~iY_drDqp00i_>zopr0Cij<5C8xG