From f5979ecb1d973215fcf1899e744d3cc8e80d458d Mon Sep 17 00:00:00 2001 From: Treer Date: Wed, 12 Sep 2018 02:55:20 +1000 Subject: [PATCH] Add painted door option. Enabling the "Painted doors - visible but camouflaged" option in the mod settings lets you choose to have concealed doors remain slightly visible - wooden doors which have been painted to match their surroundings. This allows players that pay attention to find concealed doors, as well as providing decor-matched doors for interior decoration. --- locale/it.po | 4 ++ locale/template.pot | 4 ++ main.lua | 43 +++++++++++++++++----- settingtypes.txt | 6 +++ textures/hidden_doors_hinges_overlay.png | Bin 0 -> 377 bytes textures/hidden_doors_painted_overlay.png | Bin 0 -> 621 bytes 6 files changed, 48 insertions(+), 9 deletions(-) create mode 100644 textures/hidden_doors_hinges_overlay.png create mode 100644 textures/hidden_doors_painted_overlay.png diff --git a/locale/it.po b/locale/it.po index 4783ec8..a259547 100644 --- a/locale/it.po +++ b/locale/it.po @@ -22,6 +22,10 @@ msgstr "" msgid "Concealed " msgstr "Porta camuffata di " +#: init.lua +msgid "Painted " +msgstr "Porta dipinto di " + #: init.lua msgid " Door" msgstr " " diff --git a/locale/template.pot b/locale/template.pot index cbcd119..c6feddb 100644 --- a/locale/template.pot +++ b/locale/template.pot @@ -21,6 +21,10 @@ msgstr "" msgid "Concealed " msgstr "" +#: init.lua +msgid "Painted " +msgstr "" + #: init.lua msgid " Door" msgstr "" diff --git a/main.lua b/main.lua index 27a71b7..bdf5074 100644 --- a/main.lua +++ b/main.lua @@ -31,6 +31,13 @@ hidden_doors = {} local description_1 = S("Concealed ") local description_2 = S(" Door") +-- 'painted' doors are not fully concealed, they are wooden doors painted to blend in +local doors_are_painted = minetest.settings:get_bool("hidden_doors_painted", false) + +if doors_are_painted then + description_1 = S("Painted ") +end + -- Hidden Doors' sounds local hidden_doors_vol = tonumber(minetest.settings:get("hidden_doors_vol")) @@ -166,14 +173,30 @@ else end +-- If the door uses textures from Darkage then use the default 16px res. +-- Do the same for Moreblocks. +local use_default_16px_res = (modname == "darkage") or (modname == "moreblocks") + + +local painted_texture_suffix = "" +local painted_texture_suffix_inv = "" +if doors_are_painted then + if use_default_16px_res then + painted_texture_suffix = "^(hidden_doors_painted_overlay.png^[opacity:50^[resize:38x32)^hidden_doors_hinges_overlay.png" + painted_texture_suffix_inv = ":8,0=hidden_doors_painted_overlay.png\\^[opacity\\:60\\^[resize\\:38x32" + else + painted_texture_suffix = "^(hidden_doors_painted_overlay.png^[opacity:50^[resize:" .. image_size .. ")^hidden_doors_hinges_overlay.png" + painted_texture_suffix_inv = ": " .. X1 .. ",0=hidden_doors_painted_overlay.png\\^[opacity\\:60\\^[resize\\:" .. image_size + end +end + + function hidden_doors.register_hidden_doors(modname, subname, recipeItem1, recipeItem2, recipeItem3, desc, sounds, sound_open, sound_close) local texture_name = modname .. "_" .. subname .. ".png" - -- If the door uses textures from Darkage then use the default 16px res. - -- Do the same for Moreblocks. - if (modname ~= "darkage") and (modname ~= "moreblocks") then + if (not use_default_16px_res) then local new_texture = "[combine:" .. image_size .. ": 0," .. "0=" .. texture_name .. ": 0," .. @@ -188,13 +211,14 @@ function hidden_doors.register_hidden_doors(modname, subname, recipeItem1, description = description_1 .. desc .. description_2, tiles = {{ name = "(" .. new_texture .. - "^[transformFX)^[combine:" .. image_size.. ":" ..X3.. "," .. + "^[transformFX)^([combine:" .. image_size.. ":" ..X3.. "," .. "0=" .. texture_name .. ":" .. X3 .. "," .. - Y3 .. "=" .. texture_name , backface_culling = true }}, + Y3 .. "=" .. texture_name .. ")" .. painted_texture_suffix, + backface_culling = true }}, inventory_image = "[combine:" .. inv_size .. ":" .. X1 .. "," .. "0=" .. texture_name .. ":" .. X1 .. "," .. - Y1 .. "=" ..texture_name, + Y1 .. "=" ..texture_name .. painted_texture_suffix_inv, groups = {cracky = 1, level = 2}, sounds = sounds, @@ -219,13 +243,14 @@ function hidden_doors.register_hidden_doors(modname, subname, recipeItem1, description = description_1 .. desc .. description_2, tiles = {{ name = "(" .. new_texture .. - "^[transformFX)^[combine:" .. "38x32" .. ": 16," .. + "^[transformFX)^([combine:" .. "38x32" .. ": 16," .. "0=" .. texture_name .. ": 16," .. - "16=" .. texture_name , backface_culling = true }}, + "16=" .. texture_name .. ")" .. painted_texture_suffix, + backface_culling = true }}, inventory_image = "[combine:" .. "32x32" .. ": 8," .. "0=" .. texture_name .. ": 8," .. - "16=" .. texture_name, + "16=" .. texture_name .. painted_texture_suffix_inv, groups = {cracky = 1, level = 2}, sounds = sounds, diff --git a/settingtypes.txt b/settingtypes.txt index c947159..59ea056 100644 --- a/settingtypes.txt +++ b/settingtypes.txt @@ -7,6 +7,12 @@ hidden_doors_res (Resolution in pixels for the textures) int 16 # doors' opening and closing sounds, the default value is 5.0 hidden_doors_vol (Opening and closing sounds' volume in float) float 5.0 +# You can choose to have concealed doors remain slightly visible - wooden +# doors which have been painted to match their surroundings. +# This allows players that pay attention to find concealed doors, as well +# as providing decor-matched doors for interior decoration. +hidden_doors_painted (Painted doors - visible but camouflaged) bool false + # Disable the module's nodes and activate the # L.B.M. based module's nodes remover. hidden_doors_remover (Disable and remove this mod's nodes) bool false \ No newline at end of file diff --git a/textures/hidden_doors_hinges_overlay.png b/textures/hidden_doors_hinges_overlay.png new file mode 100644 index 0000000000000000000000000000000000000000..a0ddb9d61cda945cf498fba0938aa735657dc4fe GIT binary patch literal 377 zcmeAS@N?(olHy`uVBq!ia0vp^YCx>O!2%?&p z0*}aI1_o|n5N2eUHAey{$X?><>&pI!lZTO=^ZCKfEkL0hPZ!4!kK=Er8gexl@VLe= zX@1~%$N7CdOZj<4R`E{u6}lo#-jhGpS8#I9?|2yAt^7KC#w@-!ieKLvnan)G$Yf@! z!??on;gnlp&5xb$=PoW2I&k>zi>v3-64!1yk#>OT+RB`p@AKoFC;Lu1E8eRrdgI>5 zC%Qm;RZCnWN>UO_QmvAUQh^kMk%6Iwu7Rblp;3r|k(H65m8r3|p@EfwLEqDW^C%i} k^HVa@Dp52TS{ayI8CXIz{GK2q2-Lvf>FVdQ&MBb@0BZ_(kpKVy literal 0 HcmV?d00001 diff --git a/textures/hidden_doors_painted_overlay.png b/textures/hidden_doors_painted_overlay.png new file mode 100644 index 0000000000000000000000000000000000000000..0f620654a234466f5caa5ef9bcaa79631bbee9c8 GIT binary patch literal 621 zcmeAS@N?(olHy`uVBq!ia0vp^YCx>O!2%?&p z0*}aI1_o|n5N2eUHAey{$X?><>&pI!lZR14tT({lUEyy&tK&x|b$XFRyyT@&k`yzI0~yW}jr%h&Q0nD+fj+W+xxWO?LCXHm5s z2Q&pG%Wv9eY>BBho5=m-{>>`}G8~s@osCHst6r1t7h=Y2pK81!=hcooQ}=yQ;F!lN zvMcp gt3=UYXk}z#Wo!Y_kYFs-0@T3Z>FVdQ&MBb@0QW)ZZ~y=R literal 0 HcmV?d00001