diff --git a/main.lua b/main.lua index 93151ef..011adad 100644 --- a/main.lua +++ b/main.lua @@ -173,33 +173,34 @@ 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") +function hidden_doors.get_painted_texture_suffix(use_default_16px_res) + local texture_suffix = "" + local texture_suffix_inv = "" -local painted_texture_suffix = "" -local painted_texture_suffix_inv = "" -if doors_are_painted then + if doors_are_painted then - local paint_opacity = 35 - local paint_opacity_inv = paint_opacity + 15 + local paint_opacity = 35 + local paint_opacity_inv = paint_opacity + 15 - if use_default_16px_res then - painted_texture_suffix = + if use_default_16px_res then + texture_suffix = "^((hidden_doors_painted_overlay.png^[opacity:" .. paint_opacity .. "^hidden_doors_hinges_overlay.png)^[resize:38x32)" - painted_texture_suffix_inv = + texture_suffix_inv = ":8,0=hidden_doors_painted_overlay.png\\^[opacity\\:" .. paint_opacity_inv .. "\\^[resize\\:38x32" - else - painted_texture_suffix = + else + texture_suffix = "^((hidden_doors_painted_overlay.png^[opacity:" .. paint_opacity .. "^hidden_doors_hinges_overlay.png)^[resize:" .. image_size .. ")" - painted_texture_suffix_inv = + texture_suffix_inv = ": " .. X1 .. ",0=hidden_doors_painted_overlay.png\\^[opacity\\:" .. paint_opacity_inv .. "\\^[resize\\:" .. image_size - end + end + end + + return texture_suffix, texture_suffix_inv end @@ -208,7 +209,9 @@ function hidden_doors.register_hidden_doors(modname, subname, recipeItem1, local texture_name = modname .. "_" .. subname .. ".png" - if (not use_default_16px_res) then + -- 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 local new_texture = "[combine:" .. image_size .. ": 0," .. "0=" .. texture_name .. ": 0," .. @@ -218,6 +221,9 @@ function hidden_doors.register_hidden_doors(modname, subname, recipeItem1, "0=" .. texture_name .. ":" .. X4 .. "," .. Y3 .. "=" .. texture_name + local painted_texture_suffix, painted_texture_suffix_inv = + hidden_doors.get_painted_texture_suffix(true) + doors.register("hidden_door_" .. subname, { description = description_1 .. desc .. description_2, @@ -250,6 +256,9 @@ function hidden_doors.register_hidden_doors(modname, subname, recipeItem1, "0=" .. texture_name .. ": 22," .. "16=" .. texture_name + local painted_texture_suffix, painted_texture_suffix_inv = + hidden_doors.get_painted_texture_suffix(false) + doors.register("hidden_door_" .. subname, { description = description_1 .. desc .. description_2,