Fix texture alpha deprecation warnings

This commit is contained in:
SmallJoker 2022-02-26 12:03:20 +01:00
parent a4c18c984b
commit 3b5b3f0c11
4 changed files with 15 additions and 0 deletions

View File

@ -1,6 +1,7 @@
local realchess = {} local realchess = {}
local S = minetest.get_translator("xdecor") local S = minetest.get_translator("xdecor")
local FS = function(...) return minetest.formspec_escape(S(...)) end 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 {} screwdriver = screwdriver or {}
local function index_to_xy(idx) local function index_to_xy(idx)
@ -1429,6 +1430,7 @@ minetest.register_node(":realchess:chessboard", {
inventory_image = "chessboard_top.png", inventory_image = "chessboard_top.png",
wield_image = "chessboard_top.png", wield_image = "chessboard_top.png",
tiles = {"chessboard_top.png", "chessboard_top.png", "chessboard_sides.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}, groups = {choppy=3, oddly_breakable_by_hand=2, flammable=3},
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
node_box = {type = "fixed", fixed = {-.375, -.5, -.375, .375, -.4375, .375}}, node_box = {type = "fixed", fixed = {-.375, -.5, -.375, .375, -.4375, .375}},

View File

@ -6,6 +6,7 @@ local plate = {}
screwdriver = screwdriver or {} screwdriver = screwdriver or {}
local S = minetest.get_translator("xdecor") 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 function door_toggle(pos_actuator, pos_door, player)
local player_name = player:get_player_name() local player_name = player:get_player_name()
@ -59,6 +60,7 @@ function plate.register(material, desc, def)
xdecor.register("pressure_" .. material .. "_off", { xdecor.register("pressure_" .. material .. "_off", {
description = def.description or (desc .. " Pressure Plate"), description = def.description or (desc .. " Pressure Plate"),
tiles = {"xdecor_pressure_" .. material .. ".png"}, tiles = {"xdecor_pressure_" .. material .. ".png"},
use_texture_alpha = ALPHA_OPAQUE,
drawtype = "nodebox", drawtype = "nodebox",
node_box = xdecor.pixelbox(16, {{1, 0, 1, 14, 1, 14}}), node_box = xdecor.pixelbox(16, {{1, 0, 1, 14, 1, 14}}),
groups = def.groups, groups = def.groups,
@ -70,6 +72,7 @@ function plate.register(material, desc, def)
}) })
xdecor.register("pressure_" .. material .. "_on", { xdecor.register("pressure_" .. material .. "_on", {
tiles = {"xdecor_pressure_" .. material .. ".png"}, tiles = {"xdecor_pressure_" .. material .. ".png"},
use_texture_alpha = ALPHA_OPAQUE,
drawtype = "nodebox", drawtype = "nodebox",
node_box = xdecor.pixelbox(16, {{1, 0, 1, 14, 0.4, 14}}), node_box = xdecor.pixelbox(16, {{1, 0, 1, 14, 0.4, 14}}),
groups = def.groups, groups = def.groups,
@ -95,6 +98,7 @@ plate.register("stone", "Stone", {
xdecor.register("lever_off", { xdecor.register("lever_off", {
description = S("Lever"), description = S("Lever"),
tiles = {"xdecor_lever_off.png"}, tiles = {"xdecor_lever_off.png"},
use_texture_alpha = ALPHA_OPAQUE,
drawtype = "nodebox", drawtype = "nodebox",
node_box = xdecor.pixelbox(16, {{2, 1, 15, 12, 14, 1}}), node_box = xdecor.pixelbox(16, {{2, 1, 15, 12, 14, 1}}),
groups = {cracky = 3, oddly_breakable_by_hand = 2}, groups = {cracky = 3, oddly_breakable_by_hand = 2},
@ -118,6 +122,7 @@ xdecor.register("lever_off", {
xdecor.register("lever_on", { xdecor.register("lever_on", {
tiles = {"xdecor_lever_on.png"}, tiles = {"xdecor_lever_on.png"},
use_texture_alpha = ALPHA_OPAQUE,
drawtype = "nodebox", drawtype = "nodebox",
node_box = xdecor.pixelbox(16, {{2, 1, 15, 12, 14, 1}}), node_box = xdecor.pixelbox(16, {{2, 1, 15, 12, 14, 1}}),
groups = {cracky = 3, oddly_breakable_by_hand = 2, not_in_creative_inventory = 1}, groups = {cracky = 3, oddly_breakable_by_hand = 2, not_in_creative_inventory = 1},

View File

@ -1,5 +1,7 @@
screwdriver = screwdriver or {} screwdriver = screwdriver or {}
local S = minetest.get_translator("xdecor") 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) local function register_pane(name, desc, def)
xpanes.register_pane(name, { xpanes.register_pane(name, {
@ -80,6 +82,7 @@ local function register_storage(name, desc, def)
inventory = {size = def.inv_size or 24}, inventory = {size = def.inv_size or 24},
infotext = desc, infotext = desc,
tiles = def.tiles, tiles = def.tiles,
use_texture_alpha = ALPHA_OPAQUE,
node_box = def.node_box, node_box = def.node_box,
on_rotate = def.on_rotate, on_rotate = def.on_rotate,
on_place = def.on_place, on_place = def.on_place,
@ -480,6 +483,7 @@ local painting_box = {
xdecor.register("painting_1", { xdecor.register("painting_1", {
description = S("Painting"), description = S("Painting"),
tiles = {"xdecor_painting_1.png"}, tiles = {"xdecor_painting_1.png"},
use_texture_alpha = ALPHA_OPAQUE,
inventory_image = "xdecor_painting_empty.png", inventory_image = "xdecor_painting_empty.png",
wield_image = "xdecor_painting_empty.png", wield_image = "xdecor_painting_empty.png",
paramtype2 = "wallmounted", paramtype2 = "wallmounted",
@ -505,6 +509,7 @@ xdecor.register("painting_1", {
for i = 2, 4 do for i = 2, 4 do
xdecor.register("painting_" .. i, { xdecor.register("painting_" .. i, {
tiles = {"xdecor_painting_" .. i .. ".png"}, tiles = {"xdecor_painting_" .. i .. ".png"},
use_texture_alpha = ALPHA_OPAQUE,
paramtype2 = "wallmounted", paramtype2 = "wallmounted",
drop = "xdecor:painting_1", drop = "xdecor:painting_1",
sunlight_propagates = true, sunlight_propagates = true,
@ -584,6 +589,7 @@ xdecor.register("tatami", {
xdecor.register("trampoline", { xdecor.register("trampoline", {
description = S("Trampoline"), description = S("Trampoline"),
tiles = {"xdecor_trampoline.png", "mailbox_blank16.png", "xdecor_trampoline_sides.png"}, 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}, groups = {cracky = 3, oddly_breakable_by_hand = 1, fall_damage_add_percent = -80, bouncy = 90},
node_box = xdecor.nodebox.slab_y(0.5), node_box = xdecor.nodebox.slab_y(0.5),
sounds = { sounds = {
@ -616,6 +622,7 @@ xdecor.register("woodframed_glass", {
drawtype = "glasslike_framed", drawtype = "glasslike_framed",
sunlight_propagates = true, sunlight_propagates = true,
tiles = {"xdecor_woodframed_glass.png", "xdecor_woodframed_glass_detail.png"}, tiles = {"xdecor_woodframed_glass.png", "xdecor_woodframed_glass_detail.png"},
use_texture_alpha = ALPHA_CLIP,
groups = {cracky = 2, oddly_breakable_by_hand = 1}, groups = {cracky = 2, oddly_breakable_by_hand = 1},
sounds = default.node_sound_glass_defaults() sounds = default.node_sound_glass_defaults()
}) })

View File

@ -310,6 +310,7 @@ for i = 1, #nodes do
drawtype = "nodebox", drawtype = "nodebox",
sounds = def.sounds, sounds = def.sounds,
tiles = tiles, tiles = tiles,
use_texture_alpha = def.use_texture_alpha,
groups = groups, groups = groups,
-- `unpack` has been changed to `table.unpack` in newest Lua versions -- `unpack` has been changed to `table.unpack` in newest Lua versions
node_box = xdecor.pixelbox(16, {unpack(d, 3)}), node_box = xdecor.pixelbox(16, {unpack(d, 3)}),