From 5ae4204772c4222e64234a4466d26e4b7da77687 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Fri, 30 Jun 2023 17:55:22 +0200 Subject: [PATCH 1/2] Improve cut woodframed glass textures --- src/nodes.lua | 51 +++++++++++++++++- src/workbench.lua | 50 ++++++++++++++--- textures/xdecor_woodframed_glass_cube.png | Bin 0 -> 300 bytes ...decor_woodframed_glass_outer_stairside.png | Bin 0 -> 299 bytes textures/xdecor_woodframed_glass_split.png | Bin 0 -> 290 bytes .../xdecor_woodframed_glass_stairside.png | Bin 0 -> 300 bytes ...xdecor_woodframed_glass_stairside_flip.png | Bin 0 -> 302 bytes 7 files changed, 94 insertions(+), 7 deletions(-) create mode 100644 textures/xdecor_woodframed_glass_cube.png create mode 100644 textures/xdecor_woodframed_glass_outer_stairside.png create mode 100644 textures/xdecor_woodframed_glass_split.png create mode 100644 textures/xdecor_woodframed_glass_stairside.png create mode 100644 textures/xdecor_woodframed_glass_stairside_flip.png diff --git a/src/nodes.lua b/src/nodes.lua index 41e1559..3af9815 100644 --- a/src/nodes.lua +++ b/src/nodes.lua @@ -798,7 +798,56 @@ xdecor.register("woodframed_glass", { tiles = {"xdecor_woodframed_glass.png", "xdecor_woodframed_glass_detail.png"}, use_texture_alpha = ALPHA_CLIP, groups = {cracky = 2, oddly_breakable_by_hand = 1}, - sounds = default.node_sound_glass_defaults() + sounds = default.node_sound_glass_defaults(), + _xdecor_custom_noncube_tiles = { + stair = { + "xdecor_woodframed_glass_split.png", + "xdecor_woodframed_glass.png", + "xdecor_woodframed_glass_stairside_flip.png", + "xdecor_woodframed_glass_stairside.png", + "xdecor_woodframed_glass.png", + "xdecor_woodframed_glass_split.png", + }, + stair_inner = { + "xdecor_woodframed_glass_stairside.png^[transformR270", + "xdecor_woodframed_glass.png", + "xdecor_woodframed_glass_stairside_flip.png", + "xdecor_woodframed_glass.png", + "xdecor_woodframed_glass.png", + "xdecor_woodframed_glass_stairside.png", + }, + stair_outer = { + "xdecor_woodframed_glass_stairside.png^[transformR90", + "xdecor_woodframed_glass.png", + "xdecor_woodframed_glass_outer_stairside.png", + "xdecor_woodframed_glass_stairside_flip.png", + "xdecor_woodframed_glass_stairside.png^[transformR90", + "xdecor_woodframed_glass_outer_stairside.png", + }, + halfstair = { + "xdecor_woodframed_glass_cube.png", + "xdecor_woodframed_glass.png", + "xdecor_woodframed_glass_stairside_flip.png", + "xdecor_woodframed_glass_stairside.png", + "xdecor_woodframed_glass_split.png^[transformR90", + "xdecor_woodframed_glass_cube.png", + }, + slab = { + "xdecor_woodframed_glass.png", + "xdecor_woodframed_glass.png", + "xdecor_woodframed_glass_split.png", + }, + cube = { "xdecor_woodframed_glass_cube.png" }, + thinstair = { "xdecor_woodframed_glass_split.png" }, + micropanel = { "xdecor_woodframed_glass_split.png" }, + panel = { + "xdecor_woodframed_glass_split.png", + "xdecor_woodframed_glass_split.png", + "xdecor_woodframed_glass_cube.png", + "xdecor_woodframed_glass_cube.png", + "xdecor_woodframed_glass_split.png", + }, + }, }) local devices = { diff --git a/src/workbench.lua b/src/workbench.lua index ea2fc66..3bc0910 100644 --- a/src/workbench.lua +++ b/src/workbench.lua @@ -303,20 +303,58 @@ for i = 1, #nodes do end end - if not minetest.registered_nodes["stairs:slab_" .. item_name] then - stairs.register_stair_and_slab(item_name, node, - groups, tiles, S("@1 Stair", def.description), - S("@1 Slab", def.description), def.sounds) + local custom_tiles = def._xdecor_custom_noncube_tiles + if custom_tiles then + if not custom_tiles.nanoslab then + custom_tiles.nanoslab = custom_tiles.cube + end + if not custom_tiles.micropanel then + custom_tiles.micropanel = custom_tiles.micropanel + end + if not custom_tiles.doublepanel then + custom_tiles.doublepanel = custom_tiles.panel + end end - minetest.register_node(":" .. node .. "_" .. d[1], { + if not minetest.registered_nodes["stairs:slab_" .. item_name] then + if custom_tiles and (custom_tiles.slab or custom_tiles.stair) then + if custom_tiles.stair then + stairs.register_stair(item_name, node, + groups, custom_tiles.stair, S("@1 Stair", def.description), + def.sounds) + stairs.register_stair_inner(item_name, node, + groups, custom_tiles.stair_inner, "", def.sounds) + stairs.register_stair_outer(item_name, node, + groups, custom_tiles.stair_outer, "", def.sounds) + end + if custom_tiles.slab then + stairs.register_slab(item_name, node, + groups, custom_tiles.slab, S("@1 Slab", def.description), + def.sounds) + end + else + stairs.register_stair_and_slab(item_name, node, + groups, tiles, S("@1 Stair", def.description), + S("@1 Slab", def.description), def.sounds) + end + end + + local cutname = d[1] + local tiles_special_cut + if custom_tiles and custom_tiles[cutname] then + tiles_special_cut = custom_tiles[cutname] + else + tiles_special_cut = tiles + end + + minetest.register_node(":" .. node .. "_" .. cutname, { -- @1: Base node description (e.g. "Stone"); @2: modifier (e.g. "Nanoslab") description = S("@1 @2", def.description, d[4]), paramtype = "light", paramtype2 = "facedir", drawtype = "nodebox", sounds = def.sounds, - tiles = tiles, + tiles = tiles_special_cut, use_texture_alpha = def.use_texture_alpha, groups = groups, node_box = xdecor.pixelbox(16, d[3]), diff --git a/textures/xdecor_woodframed_glass_cube.png b/textures/xdecor_woodframed_glass_cube.png new file mode 100644 index 0000000000000000000000000000000000000000..9ad15285148219379a6cc855078ef08b12bc2264 GIT binary patch literal 300 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GbL!cYsfbt04o!fdh{l!;BYZI8INt z$#zy)RqR{rue!4_Jk?xo)vD`2*_}J@otO|AX&|0wr?jrz#YK((%$XMnMv~i_d=K}8 ztgCgfSL7*i*Ni&)<2BG&#*!evU4S&X~%@qUW>AtR&HIDWsqIKe0)~60Pp(l8%Fn5rca=ga3+A`)p6ti9%Oi67q-G;=EupC#-FK&{fBCDdbuj*XmF%TXLB4CeHe1W> w|L+jxxjJP+-w)<88Qz(PuW9}`S^10U`*rrZX>qP|flg!aboFyt=akR{0Eh8-JOBUy literal 0 HcmV?d00001 diff --git a/textures/xdecor_woodframed_glass_outer_stairside.png b/textures/xdecor_woodframed_glass_outer_stairside.png new file mode 100644 index 0000000000000000000000000000000000000000..9ee80852b68a90ceead706dbe10d6601824b24d2 GIT binary patch literal 299 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GbL!Uw}`D>#no)h71e`4m@rQGhUeC zI6c`W+gV{%v2U@z>dwaSRCBpitF8lOckaA*VnSr3fq0&s(z;2Np5TM zJ=_zruGYa`k*CC6^WzN*8KB9GB|(0{3=Yq3qyahIo-U3d5|?xP9`ZFCaJ1-0to7ns zmTUI?pT5Um4{>$)AWtRc77c}-wbcQU!|CLuT1LQ2%8fbaOq zi;we`PO{yysWpq|&h*oFo8``|NW1BDTVYj;v0TP0?fVzx?!4->RoE~0>5%Im+rMvi u*sBPxQkuXNsH<~yg463c%Z`6@25mw2>Hi)p36 l)l*U2i?aO;dG;moAPi8nSi4}TV z{C{%agsd=?#V5r0b7JIzQn>H;D>0ci&0amj@{YEjdxzh)mn(K$DlD93e=%&4r`o$N z_te@iU5rOwG@s>36ZMJ=OSDswi#orKFZR%h7QxC76Yk1%C#uC?*lF@S=Krzd*I(@L vJYR1kd{FSXWa)&3zgZq%h_m>bdav$n3Tsf1kJ3V*(-=Hm{an^LB{Ts55z}^1 literal 0 HcmV?d00001 diff --git a/textures/xdecor_woodframed_glass_stairside_flip.png b/textures/xdecor_woodframed_glass_stairside_flip.png new file mode 100644 index 0000000000000000000000000000000000000000..ab29527fba367bd2dee7909f72e40c7ed58d29f1 GIT binary patch literal 302 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GbL!cYsfbt04o!fdh{l!;BYZI8INt z$#zy)RqR{rue!4_Jk?xo)vD`2*_}J@otO|AX&|0wr?jrz#YK((%$XMnMv~i_d=K}8 ztgCgfSL7*i*Ni&)<2BG&#*!evUiJ8*n)LzRcK|v0d%f z^MC5H3vZivPZVXBW1M_We0Hu^{I#1ra*YaSn;9Rr$vR(&Z9CqU9kS@U(Vc=22kU*J z)z-}yg_K{Ycx3S##GCzCwQbcbaVMVk>AS>NS8nq-$1fP>>U4hN(w2J7!}2>z&0UyTbvGtk`s!|;7PsoM^vC(EL30_NIshHV;OXk;vd$@?2>@kFbOQhY literal 0 HcmV?d00001 From 43e028a425a89680bfe8eb134079d4ecdd2984b3 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Fri, 30 Jun 2023 18:37:21 +0200 Subject: [PATCH 2/2] Improve textures of cut [obsidian] glass --- src/glasscut.lua | 83 ++++++++++++++++++ src/workbench.lua | 4 +- textures/stairs_glass_cube.png | Bin 0 -> 268 bytes textures/stairs_obsidian_glass_cube.png | Bin 0 -> 148 bytes ...xdecor_woodframed_glass_stairside_flip.png | Bin 302 -> 0 bytes 5 files changed, 86 insertions(+), 1 deletion(-) create mode 100644 src/glasscut.lua create mode 100644 textures/stairs_glass_cube.png create mode 100644 textures/stairs_obsidian_glass_cube.png delete mode 100644 textures/xdecor_woodframed_glass_stairside_flip.png diff --git a/src/glasscut.lua b/src/glasscut.lua new file mode 100644 index 0000000..38231c5 --- /dev/null +++ b/src/glasscut.lua @@ -0,0 +1,83 @@ +-- Tile definitions for cut nodes of glass nodes: +-- * Woodframed Glass (this mod) +-- * Glass (Minetest Game) +-- * Obsidian Glass (Minetest Game) +-- This is done so the glass nodes still look nice +-- when cut. +-- If we would only use the base glass tile, most +-- cut nodes look horrible because there are no +-- clear contours. + +local template_suffixes = { + stair = { + "_split.png", + ".png", + "_stairside.png^[transformFX", + "_stairside.png", + ".png", + "_split.png", + }, + stair_inner = { + "_stairside.png^[transformR270", + ".png", + "_stairside.png^[transformFX", + ".png", + ".png", + "_stairside.png", + }, + stair_outer = { + "_stairside.png^[transformR90", + ".png", + "_outer_stairside.png", + "_stairside.png^[transformFX", + "_stairside.png^[transformR90", + "_outer_stairside.png", + }, + halfstair = { + "_cube.png", + ".png", + "_stairside.png^[transformFX", + "_stairside.png", + "_split.png^[transformR90", + "_cube.png", + }, + slab = { + ".png", + ".png", + "_split.png", + }, + cube = { "_cube.png" }, + thinstair = { "_split.png" }, + micropanel = { "_split.png" }, + panel = { + "_split.png", + "_split.png", + "_cube.png", + "_cube.png", + "_split.png", + }, +} + +local generate_tilenames = function(prefix, default_texture) + if not default_texture then + default_texture = prefix + end + local cuts = {} + for t, tiles in pairs(template_suffixes) do + cuts[t] = {} + for i=1, #tiles do + if tiles[i] == ".png" then + cuts[t][i] = default_texture .. tiles[i] + else + cuts[t][i] = prefix .. tiles[i] + end + end + end + return cuts +end + +xdecor.glasscuts = { + ["xdecor:woodframed_glass"] = generate_tilenames("xdecor_woodframed_glass"), + ["default:glass"] = generate_tilenames("stairs_glass", "default_glass"), + ["default:obsidian_glass"] = generate_tilenames("stairs_obsidian_glass", "default_obsidian_glass"), +} diff --git a/src/workbench.lua b/src/workbench.lua index 3bc0910..47dba11 100644 --- a/src/workbench.lua +++ b/src/workbench.lua @@ -1,3 +1,5 @@ +dofile(minetest.get_modpath("xdecor") .. "/src/glasscut.lua") + local workbench = {} local nodes = {} @@ -303,7 +305,7 @@ for i = 1, #nodes do end end - local custom_tiles = def._xdecor_custom_noncube_tiles + local custom_tiles = xdecor.glasscuts[node] if custom_tiles then if not custom_tiles.nanoslab then custom_tiles.nanoslab = custom_tiles.cube diff --git a/textures/stairs_glass_cube.png b/textures/stairs_glass_cube.png new file mode 100644 index 0000000000000000000000000000000000000000..f8182ebb0019cec407fc84e4e5e95f2b86bacd00 GIT binary patch literal 268 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GbL!O@L2`tG;w1kooiH&p&_u{Qv*| z_3PK~-o1PO{{6>~A3uHi^!fAWuV24@`}Xbo_wPV8zkdDt{rfji<-dRbfQo_!@pQ|Ia87$R{w*58wlS&?V+0oiRXjz9k=bNjql=+dRyEbfpTciA## za(AOe`?p0ghnU#4_>MC@>3xx{J%NvV%hzXLC)oE_=_gD(qvq=AC+fI%Z+iNxKQ|Vq z<{e(lyHfegG2I=VlO<~BZJxfyRsLQ?=Z$Z_V-`5Ym{v#YYUzspWm0&;!eg|OQqNz?p)Emkh!}jA5Iy{;mpj q(2KasI6-KE)q*57m87e?!dElMzLk7!|6#ux$aGIvKbLh*2~7Y|j4Rpz literal 0 HcmV?d00001 diff --git a/textures/xdecor_woodframed_glass_stairside_flip.png b/textures/xdecor_woodframed_glass_stairside_flip.png deleted file mode 100644 index ab29527fba367bd2dee7909f72e40c7ed58d29f1..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 302 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GbL!cYsfbt04o!fdh{l!;BYZI8INt z$#zy)RqR{rue!4_Jk?xo)vD`2*_}J@otO|AX&|0wr?jrz#YK((%$XMnMv~i_d=K}8 ztgCgfSL7*i*Ni&)<2BG&#*!evUiJ8*n)LzRcK|v0d%f z^MC5H3vZivPZVXBW1M_We0Hu^{I#1ra*YaSn;9Rr$vR(&Z9CqU9kS@U(Vc=22kU*J z)z-}yg_K{Ycx3S##GCzCwQbcbaVMVk>AS>NS8nq-$1fP>>U4hN(w2J7!}2>z&0UyTbvGtk`s!|;7PsoM^vC(EL30_NIshHV;OXk;vd$@?2>@kFbOQhY