Fix Warning spam about use_texture_alpha

* Previously the alpha value in the nodedef indicated the transparency
  the water was actually rendered with. Now only the alpha in the texture
  is respected.
* Closes and fixes https://github.com/minetest/minetest_game/issues/2819
* Backported https://github.com/minetest/minetest_game/pull/2822
* this is the same as https://github.com/minetest/minetest_game/pull/2729
This commit is contained in:
mckaygerhard 2024-04-24 13:01:57 -04:00
parent 99e163dd82
commit 46ce26ded2
9 changed files with 40 additions and 9 deletions

View File

@ -208,6 +208,11 @@ default:cloud
-- Stone -- Stone
-- --
local is_54 = minetest.has_feature("direct_velocity_on_players") or false
local alpha_use_texture_alpha = true
if is_54 then alpha_use_texture_alpha = "blend" end
minetest.register_node("default:stone", { minetest.register_node("default:stone", {
description = "Stone", description = "Stone",
tiles = {"default_stone.png"}, tiles = {"default_stone.png"},
@ -1508,6 +1513,7 @@ minetest.register_node("default:water_source", {
}, },
}, },
alpha = 160, alpha = 160,
use_texture_alpha = alpha_use_texture_alpha,
paramtype = "light", paramtype = "light",
walkable = false, walkable = false,
pointable = false, pointable = false,
@ -1552,6 +1558,7 @@ minetest.register_node("default:water_flowing", {
}, },
}, },
alpha = 160, alpha = 160,
use_texture_alpha = alpha_use_texture_alpha,
paramtype = "light", paramtype = "light",
paramtype2 = "flowingliquid", paramtype2 = "flowingliquid",
walkable = false, walkable = false,
@ -1599,6 +1606,7 @@ minetest.register_node("default:river_water_source", {
}, },
}, },
alpha = 160, alpha = 160,
use_texture_alpha = alpha_use_texture_alpha,
paramtype = "light", paramtype = "light",
walkable = false, walkable = false,
pointable = false, pointable = false,
@ -1645,6 +1653,7 @@ minetest.register_node("default:river_water_flowing", {
}, },
}, },
alpha = 160, alpha = 160,
use_texture_alpha = alpha_use_texture_alpha,
paramtype = "light", paramtype = "light",
paramtype2 = "flowingliquid", paramtype2 = "flowingliquid",
walkable = false, walkable = false,
@ -2185,6 +2194,7 @@ local function register_sign(material, desc, def)
sunlight_propagates = true, sunlight_propagates = true,
is_ground_content = false, is_ground_content = false,
walkable = false, walkable = false,
use_texture_alpha = (is_54 and "opaque" or alpha_use_texture_alpha),
node_box = { node_box = {
type = "wallmounted", type = "wallmounted",
wall_top = {-0.4375, 0.4375, -0.3125, 0.4375, 0.5, 0.3125}, wall_top = {-0.4375, 0.4375, -0.3125, 0.4375, 0.5, 0.3125},
@ -2326,6 +2336,7 @@ minetest.register_node("default:glass", {
description = "Glass", description = "Glass",
drawtype = "glasslike_framed_optional", drawtype = "glasslike_framed_optional",
tiles = {"default_glass.png", "default_glass_detail.png"}, tiles = {"default_glass.png", "default_glass_detail.png"},
use_texture_alpha = (is_54 and "clip" or alpha_use_texture_alpha),
paramtype = "light", paramtype = "light",
paramtype2 = "glasslikeliquidlevel", paramtype2 = "glasslikeliquidlevel",
sunlight_propagates = true, sunlight_propagates = true,
@ -2338,6 +2349,7 @@ minetest.register_node("default:obsidian_glass", {
description = "Obsidian Glass", description = "Obsidian Glass",
drawtype = "glasslike_framed_optional", drawtype = "glasslike_framed_optional",
tiles = {"default_obsidian_glass.png", "default_obsidian_glass_detail.png"}, tiles = {"default_obsidian_glass.png", "default_obsidian_glass_detail.png"},
use_texture_alpha = (is_54 and "clip" or alpha_use_texture_alpha),
paramtype = "light", paramtype = "light",
paramtype2 = "glasslikeliquidlevel", paramtype2 = "glasslikeliquidlevel",
is_ground_content = false, is_ground_content = false,
@ -2375,6 +2387,7 @@ minetest.register_node("default:mese_post_light", {
tiles = {"default_mese_post_light_top.png", "default_mese_post_light_top.png", tiles = {"default_mese_post_light_top.png", "default_mese_post_light_top.png",
"default_mese_post_light_side_dark.png", "default_mese_post_light_side_dark.png", "default_mese_post_light_side_dark.png", "default_mese_post_light_side_dark.png",
"default_mese_post_light_side.png", "default_mese_post_light_side.png"}, "default_mese_post_light_side.png", "default_mese_post_light_side.png"},
use_texture_alpha = (is_54 and "clip" or alpha_use_texture_alpha),
wield_image = "default_mese_post_light_side.png", wield_image = "default_mese_post_light_side.png",
drawtype = "nodebox", drawtype = "nodebox",
node_box = { node_box = {

View File

@ -35,6 +35,8 @@ See LICENSE.txt and http://www.gnu.org/licenses/lgpl-2.1.txt
--]] --]]
local is_54 = minetest.has_feature("direct_velocity_on_players") or false
minetest.register_node("default:torch", { minetest.register_node("default:torch", {
description = "Torch", description = "Torch",
drawtype = "mesh", drawtype = "mesh",
@ -94,6 +96,7 @@ minetest.register_node("default:torch_wall", {
name = "default_torch_on_floor_animated.png", name = "default_torch_on_floor_animated.png",
animation = {type = "vertical_frames", aspect_w = 16, aspect_h = 16, length = 3.3} animation = {type = "vertical_frames", aspect_w = 16, aspect_h = 16, length = 3.3}
}}, }},
use_texture_alpha = (is_54 and "clip" or true),
paramtype = "light", paramtype = "light",
paramtype2 = "wallmounted", paramtype2 = "wallmounted",
sunlight_propagates = true, sunlight_propagates = true,
@ -115,6 +118,7 @@ minetest.register_node("default:torch_ceiling", {
name = "default_torch_on_floor_animated.png", name = "default_torch_on_floor_animated.png",
animation = {type = "vertical_frames", aspect_w = 16, aspect_h = 16, length = 3.3} animation = {type = "vertical_frames", aspect_w = 16, aspect_h = 16, length = 3.3}
}}, }},
use_texture_alpha = (is_54 and "clip" or true),
paramtype = "light", paramtype = "light",
paramtype2 = "wallmounted", paramtype2 = "wallmounted",
sunlight_propagates = true, sunlight_propagates = true,

View File

@ -1,5 +1,6 @@
local is_53 = minetest.has_feature("object_step_has_moveresult") local is_53 = minetest.has_feature("object_step_has_moveresult") or false
local is_54 = minetest.has_feature("direct_velocity_on_players") or false
-- our API object -- our API object
doors = { doors = {
@ -128,7 +129,7 @@ minetest.register_node("doors:hidden", {
paramtype = "light", paramtype = "light",
paramtype2 = "facedir", paramtype2 = "facedir",
sunlight_propagates = true, sunlight_propagates = true,
use_texture_alpha = "clip", use_texture_alpha = (is_54 and "clip" or true),
-- has to be walkable for falling nodes to stop falling. -- has to be walkable for falling nodes to stop falling.
walkable = true, walkable = true,
pointable = false, pointable = false,
@ -526,7 +527,7 @@ function doors.register(name, def)
def.paramtype = "light" def.paramtype = "light"
def.paramtype2 = "facedir" def.paramtype2 = "facedir"
def.sunlight_propagates = true def.sunlight_propagates = true
def.use_texture_alpha = def.use_texture_alpha or "clip" def.use_texture_alpha = def.use_texture_alpha or (is_54 and "clip" or true)
def.walkable = true def.walkable = true
def.is_ground_content = false def.is_ground_content = false
def.buildable_to = false def.buildable_to = false
@ -737,7 +738,7 @@ function doors.register_trapdoor(name, def)
def.drawtype = "nodebox" def.drawtype = "nodebox"
def.paramtype = "light" def.paramtype = "light"
def.paramtype2 = "facedir" def.paramtype2 = "facedir"
def.use_texture_alpha = def.use_texture_alpha or "clip" def.use_texture_alpha = def.use_texture_alpha or (is_54 and "clip" or true)
def.is_ground_content = false def.is_ground_content = false
if def.protected then if def.protected then

View File

@ -3,6 +3,7 @@ local S = farming.intllib
--= Helpers --= Helpers
local is_54 = minetest.has_feature("direct_velocity_on_players") or false
local eth = minetest.get_modpath("ethereal") local eth = minetest.get_modpath("ethereal")
local alias = function(orig, new) local alias = function(orig, new)
minetest.register_alias(orig, new) minetest.register_alias(orig, new)
@ -36,6 +37,7 @@ minetest.override_item("default:apple", {
"apple_side.png", "apple_side.png",
"apple_side.png", "apple_side.png",
}, },
use_texture_alpha = (is_54 and "clip" or false),
groups = {food_apple = 1, fleshy = 3, dig_immediate = 3, flammable = 2, groups = {food_apple = 1, fleshy = 3, dig_immediate = 3, flammable = 2,
leafdecay = 3, leafdecay_drop = 1} leafdecay = 3, leafdecay_drop = 1}
}) })

View File

@ -6,6 +6,7 @@
]] ]]
local S = farming.intllib local S = farming.intllib
local is_54 = minetest.has_feature("direct_velocity_on_players") or false
-- garlic clove -- garlic clove
minetest.register_craftitem("farming:garlic_clove", { minetest.register_craftitem("farming:garlic_clove", {
@ -45,7 +46,7 @@ minetest.register_node("farming:garlic_braid", {
inventory_image = "crops_garlic_braid.png", inventory_image = "crops_garlic_braid.png",
wield_image = "crops_garlic_braid.png", wield_image = "crops_garlic_braid.png",
drawtype = "nodebox", drawtype = "nodebox",
use_texture_alpha = "clip", use_texture_alpha = (is_54 and "clip" or true),
paramtype = "light", paramtype = "light",
paramtype2 = "facedir", paramtype2 = "facedir",
tiles = { tiles = {

View File

@ -6,6 +6,7 @@
flowers = {} flowers = {}
local is_54 = minetest.has_feature("direct_velocity_on_players") or false
-- Map Generation -- Map Generation
@ -271,6 +272,7 @@ minetest.register_node("flowers:waterlily", {
tiles = {"flowers_waterlily.png", "flowers_waterlily_bottom.png"}, tiles = {"flowers_waterlily.png", "flowers_waterlily_bottom.png"},
inventory_image = "flowers_waterlily.png", inventory_image = "flowers_waterlily.png",
wield_image = "flowers_waterlily.png", wield_image = "flowers_waterlily.png",
use_texture_alpha = (is_54 and "clip" or true),
liquids_pointable = true, liquids_pointable = true,
walkable = false, walkable = false,
buildable_to = true, buildable_to = true,

View File

@ -1,4 +1,6 @@
local is_54 = minetest.has_feature("direct_velocity_on_players") or false
-- wool sounds -- wool sounds
function default.node_sound_wool_defaults(table) function default.node_sound_wool_defaults(table)
@ -24,7 +26,7 @@ stairs = {
} }
-- add new 5.x snow sounds to 0.4.x client -- add new 5.x snow sounds to 0.4.x client
--if not minetest.has_feature("object_use_texture_alpha") then if not stairs.node_sound_snow_defaults then
function stairs.node_sound_snow_defaults(table) function stairs.node_sound_snow_defaults(table)
table = table or {} table = table or {}
@ -35,7 +37,7 @@ stairs = {
return table return table
end end
--end end
-- cache creative -- cache creative
@ -136,8 +138,9 @@ local function get_node_vars(nodename)
if def then if def then
return def.light_source, def.use_texture_alpha, def.sunlight_propagates return def.light_source, def.use_texture_alpha, def.sunlight_propagates
end end
if is_54 then return 0, "clip", nil end
return nil, nil, nil return false, true, nil
end end

View File

@ -1,6 +1,7 @@
local workbench = {} local workbench = {}
local nodes = {} local nodes = {}
local is_54 = minetest.has_feature("direct_velocity_on_players") or false
screwdriver = screwdriver or {} screwdriver = screwdriver or {}
local min, ceil = math.min, math.ceil local min, ceil = math.min, math.ceil
local S = xdecor.S local S = xdecor.S
@ -343,7 +344,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, use_texture_alpha = def.use_texture_alpha or (is_54 and "clip" or true),
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)}),

View File

@ -1,4 +1,6 @@
local is_54 = minetest.has_feature("direct_velocity_on_players") or false
local function is_pane(pos) local function is_pane(pos)
return minetest.get_item_group(minetest.get_node(pos).name, "pane") > 0 return minetest.get_item_group(minetest.get_node(pos).name, "pane") > 0
end end
@ -104,6 +106,7 @@ function xpanes.register_pane(name, def)
groups = flatgroups, groups = flatgroups,
drop = "xpanes:" .. name .. "_flat", drop = "xpanes:" .. name .. "_flat",
sounds = def.sounds, sounds = def.sounds,
use_texture_alpha = def.use_texture_alpha or (is_54 and "opaque" or false),
node_box = { node_box = {
type = "fixed", type = "fixed",
fixed = {{-1/2, -1/2, -1/32, 1/2, 1/2, 1/32}}, fixed = {{-1/2, -1/2, -1/32, 1/2, 1/2, 1/32}},
@ -128,6 +131,7 @@ function xpanes.register_pane(name, def)
groups = groups, groups = groups,
drop = "xpanes:" .. name .. "_flat", drop = "xpanes:" .. name .. "_flat",
sounds = def.sounds, sounds = def.sounds,
use_texture_alpha = def.use_texture_alpha or (is_54 and "opaque" or false),
node_box = { node_box = {
type = "connected", type = "connected",
fixed = {{-1/32, -1/2, -1/32, 1/32, 1/2, 1/32}}, fixed = {{-1/32, -1/2, -1/32, 1/32, 1/2, 1/32}},