From 3b5b3f0c11c441b9667949194b671fc6aa72b843 Mon Sep 17 00:00:00 2001 From: SmallJoker Date: Sat, 26 Feb 2022 12:03:20 +0100 Subject: [PATCH] Fix texture alpha deprecation warnings --- src/chess.lua | 2 ++ src/mechanisms.lua | 5 +++++ src/nodes.lua | 7 +++++++ src/workbench.lua | 1 + 4 files changed, 15 insertions(+) diff --git a/src/chess.lua b/src/chess.lua index d9db38e..fd34859 100644 --- a/src/chess.lua +++ b/src/chess.lua @@ -1,6 +1,7 @@ local realchess = {} local S = minetest.get_translator("xdecor") local FS = function(...) return minetest.formspec_escape(S(...)) end +local ALPHA_OPAQUE = minetest.features.use_texture_alpha_string_modes and "opaque" or false screwdriver = screwdriver or {} local function index_to_xy(idx) @@ -1429,6 +1430,7 @@ minetest.register_node(":realchess:chessboard", { inventory_image = "chessboard_top.png", wield_image = "chessboard_top.png", tiles = {"chessboard_top.png", "chessboard_top.png", "chessboard_sides.png"}, + use_texture_alpha = ALPHA_OPAQUE, groups = {choppy=3, oddly_breakable_by_hand=2, flammable=3}, sounds = default.node_sound_wood_defaults(), node_box = {type = "fixed", fixed = {-.375, -.5, -.375, .375, -.4375, .375}}, diff --git a/src/mechanisms.lua b/src/mechanisms.lua index c6e8cd0..f96720f 100644 --- a/src/mechanisms.lua +++ b/src/mechanisms.lua @@ -6,6 +6,7 @@ local plate = {} screwdriver = screwdriver or {} local S = minetest.get_translator("xdecor") +local ALPHA_OPAQUE = minetest.features.use_texture_alpha_string_modes and "opaque" or false local function door_toggle(pos_actuator, pos_door, player) local player_name = player:get_player_name() @@ -59,6 +60,7 @@ function plate.register(material, desc, def) xdecor.register("pressure_" .. material .. "_off", { description = def.description or (desc .. " Pressure Plate"), tiles = {"xdecor_pressure_" .. material .. ".png"}, + use_texture_alpha = ALPHA_OPAQUE, drawtype = "nodebox", node_box = xdecor.pixelbox(16, {{1, 0, 1, 14, 1, 14}}), groups = def.groups, @@ -70,6 +72,7 @@ function plate.register(material, desc, def) }) xdecor.register("pressure_" .. material .. "_on", { tiles = {"xdecor_pressure_" .. material .. ".png"}, + use_texture_alpha = ALPHA_OPAQUE, drawtype = "nodebox", node_box = xdecor.pixelbox(16, {{1, 0, 1, 14, 0.4, 14}}), groups = def.groups, @@ -95,6 +98,7 @@ plate.register("stone", "Stone", { xdecor.register("lever_off", { description = S("Lever"), tiles = {"xdecor_lever_off.png"}, + use_texture_alpha = ALPHA_OPAQUE, drawtype = "nodebox", node_box = xdecor.pixelbox(16, {{2, 1, 15, 12, 14, 1}}), groups = {cracky = 3, oddly_breakable_by_hand = 2}, @@ -118,6 +122,7 @@ xdecor.register("lever_off", { xdecor.register("lever_on", { tiles = {"xdecor_lever_on.png"}, + use_texture_alpha = ALPHA_OPAQUE, drawtype = "nodebox", node_box = xdecor.pixelbox(16, {{2, 1, 15, 12, 14, 1}}), groups = {cracky = 3, oddly_breakable_by_hand = 2, not_in_creative_inventory = 1}, diff --git a/src/nodes.lua b/src/nodes.lua index f4dd20c..256e819 100644 --- a/src/nodes.lua +++ b/src/nodes.lua @@ -1,5 +1,7 @@ screwdriver = screwdriver or {} local S = minetest.get_translator("xdecor") +local ALPHA_CLIP = minetest.features.use_texture_alpha_string_modes and "clip" or true +local ALPHA_OPAQUE = minetest.features.use_texture_alpha_string_modes and "opaque" or false local function register_pane(name, desc, def) xpanes.register_pane(name, { @@ -80,6 +82,7 @@ local function register_storage(name, desc, def) inventory = {size = def.inv_size or 24}, infotext = desc, tiles = def.tiles, + use_texture_alpha = ALPHA_OPAQUE, node_box = def.node_box, on_rotate = def.on_rotate, on_place = def.on_place, @@ -480,6 +483,7 @@ local painting_box = { xdecor.register("painting_1", { description = S("Painting"), tiles = {"xdecor_painting_1.png"}, + use_texture_alpha = ALPHA_OPAQUE, inventory_image = "xdecor_painting_empty.png", wield_image = "xdecor_painting_empty.png", paramtype2 = "wallmounted", @@ -505,6 +509,7 @@ xdecor.register("painting_1", { for i = 2, 4 do xdecor.register("painting_" .. i, { tiles = {"xdecor_painting_" .. i .. ".png"}, + use_texture_alpha = ALPHA_OPAQUE, paramtype2 = "wallmounted", drop = "xdecor:painting_1", sunlight_propagates = true, @@ -584,6 +589,7 @@ xdecor.register("tatami", { xdecor.register("trampoline", { description = S("Trampoline"), tiles = {"xdecor_trampoline.png", "mailbox_blank16.png", "xdecor_trampoline_sides.png"}, + use_texture_alpha = ALPHA_CLIP, groups = {cracky = 3, oddly_breakable_by_hand = 1, fall_damage_add_percent = -80, bouncy = 90}, node_box = xdecor.nodebox.slab_y(0.5), sounds = { @@ -616,6 +622,7 @@ xdecor.register("woodframed_glass", { drawtype = "glasslike_framed", sunlight_propagates = true, 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() }) diff --git a/src/workbench.lua b/src/workbench.lua index b2252dd..4c87c3e 100644 --- a/src/workbench.lua +++ b/src/workbench.lua @@ -310,6 +310,7 @@ for i = 1, #nodes do drawtype = "nodebox", sounds = def.sounds, tiles = tiles, + use_texture_alpha = def.use_texture_alpha, groups = groups, -- `unpack` has been changed to `table.unpack` in newest Lua versions node_box = xdecor.pixelbox(16, {unpack(d, 3)}),