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-23 18:04:16 -04:00
parent ab354d538d
commit 8c07924bf1
9 changed files with 41 additions and 19 deletions

View File

@ -238,6 +238,11 @@ default:cloud
--]]
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
-- Required wrapper to allow customization of default.after_place_leaves
local function after_place_leaves(...)
return default.after_place_leaves(...)
@ -2213,7 +2218,7 @@ minetest.register_node("default:water_source", {
},
},
},
alpha = 191,
use_texture_alpha = alpha_use_texture_alpha,
paramtype = "light",
walkable = false,
pointable = false,
@ -2258,7 +2263,7 @@ minetest.register_node("default:water_flowing", {
},
},
},
alpha = 191,
use_texture_alpha = alpha_use_texture_alpha,
paramtype = "light",
paramtype2 = "flowingliquid",
walkable = false,
@ -2304,7 +2309,7 @@ minetest.register_node("default:river_water_source", {
},
},
},
alpha = 160,
use_texture_alpha = alpha_use_texture_alpha,
paramtype = "light",
walkable = false,
pointable = false,
@ -2354,7 +2359,7 @@ minetest.register_node("default:river_water_flowing", {
},
},
},
alpha = 160,
use_texture_alpha = alpha_use_texture_alpha,
paramtype = "light",
paramtype2 = "flowingliquid",
walkable = false,
@ -2570,6 +2575,7 @@ minetest.register_node("default:bookshelf", {
})
local function register_sign(material, desc, def)
minetest.register_node("default:sign_wall_" .. material, {
description = desc,
drawtype = "nodebox",
@ -2581,6 +2587,7 @@ local function register_sign(material, desc, def)
sunlight_propagates = true,
is_ground_content = false,
walkable = false,
use_texture_alpha = (is_54 and "opaque" or alpha_use_texture_alpha),
node_box = {
type = "wallmounted",
wall_top = {-0.4375, 0.4375, -0.3125, 0.4375, 0.5, 0.3125},
@ -2805,6 +2812,7 @@ minetest.register_node("default:glass", {
description = S("Glass"),
drawtype = "glasslike_framed_optional",
tiles = {"default_glass.png", "default_glass_detail.png"},
use_texture_alpha = (is_54 and "clip" or true),
paramtype = "light",
sunlight_propagates = true,
is_ground_content = false,
@ -2816,6 +2824,7 @@ minetest.register_node("default:obsidian_glass", {
description = S("Obsidian Glass"),
drawtype = "glasslike_framed_optional",
tiles = {"default_obsidian_glass.png", "default_obsidian_glass_detail.png"},
use_texture_alpha = (is_54 and "clip" or true),
paramtype = "light",
is_ground_content = false,
sunlight_propagates = true,
@ -2852,6 +2861,7 @@ minetest.register_node("default:mese_post_light", {
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.png", "default_mese_post_light_side.png"},
use_texture_alpha = (is_54 and "clip" or true),
wield_image = "default_mese_post_light_side.png",
drawtype = "nodebox",
node_box = {

View File

@ -2,6 +2,7 @@
-- support for MT game translation.
local S = default.get_translator
local is_54 = minetest.has_feature("direct_velocity_on_players") or false
local function on_flood(pos, oldnode, newnode)
minetest.add_item(pos, ItemStack("default:torch 1"))
@ -29,6 +30,7 @@ minetest.register_node("default:torch", {
name = "default_torch_on_floor_animated.png",
animation = {type = "vertical_frames", aspect_w = 16, aspect_h = 16, length = 3.3}
}},
use_texture_alpha = (is_54 and "clip" or true),
paramtype = "light",
paramtype2 = "wallmounted",
sunlight_propagates = true,
@ -81,6 +83,7 @@ minetest.register_node("default:torch_wall", {
name = "default_torch_on_floor_animated.png",
animation = {type = "vertical_frames", aspect_w = 16, aspect_h = 16, length = 3.3}
}},
use_texture_alpha = (is_54 and "clip" or true),
paramtype = "light",
paramtype2 = "wallmounted",
sunlight_propagates = true,
@ -105,6 +108,7 @@ minetest.register_node("default:torch_ceiling", {
name = "default_torch_on_floor_animated.png",
animation = {type = "vertical_frames", aspect_w = 16, aspect_h = 16, length = 3.3}
}},
use_texture_alpha = (is_54 and "clip" or true),
paramtype = "light",
paramtype2 = "wallmounted",
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
doors = {
@ -128,7 +129,7 @@ minetest.register_node("doors:hidden", {
paramtype = "light",
paramtype2 = "facedir",
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.
walkable = true,
pointable = false,
@ -526,7 +527,7 @@ function doors.register(name, def)
def.paramtype = "light"
def.paramtype2 = "facedir"
def.sunlight_propagates = true
def.use_texture_alpha = def.use_texture_alpha or "clip"
def.use_texture_alpha = (is_54 and "clip" or true)
def.walkable = true
def.is_ground_content = false
def.buildable_to = false
@ -737,7 +738,7 @@ function doors.register_trapdoor(name, def)
def.drawtype = "nodebox"
def.paramtype = "light"
def.paramtype2 = "facedir"
def.use_texture_alpha = def.use_texture_alpha or "clip"
def.use_texture_alpha = (is_54 and "clip" or true)
def.is_ground_content = false
if def.protected then

View File

@ -2,7 +2,7 @@
local S = farming.intllib
--= Helpers
local is_54 = minetest.has_feature("direct_velocity_on_players") or false
local eth = minetest.get_modpath("ethereal")
local alias = function(orig, new)
minetest.register_alias(orig, new)
@ -36,6 +36,7 @@ minetest.override_item("default:apple", {
"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,
leafdecay = 3, leafdecay_drop = 1}
})

View File

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

View File

@ -10,7 +10,7 @@ flowers = {}
-- Load support for MT game translation.
local S = minetest.get_translator("flowers")
local is_54 = minetest.has_feature("direct_velocity_on_players") or false
-- Map Generation
@ -279,6 +279,7 @@ local waterlily_def = {
tiles = {"flowers_waterlily.png", "flowers_waterlily_bottom.png"},
inventory_image = "flowers_waterlily.png",
wield_image = "flowers_waterlily.png",
use_texture_alpha = (is_54 and "clip" or true),
liquids_pointable = true,
walkable = false,
buildable_to = true,

View File

@ -1,4 +1,6 @@
local is_54 = minetest.has_feature("direct_velocity_on_players") or false
-- wool sounds
function default.node_sound_wool_defaults(table)
@ -24,7 +26,7 @@ stairs = {
}
-- 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)
table = table or {}
@ -35,7 +37,7 @@ stairs = {
return table
end
--end
end
-- cache creative
@ -137,7 +139,9 @@ local function get_node_vars(nodename)
return def.light_source, def.use_texture_alpha, def.sunlight_propagates
end
return nil, nil, nil
if is_54 then return 0, "clip", nil end
return false, true, false
end

View File

@ -1,6 +1,6 @@
local workbench = {}
local nodes = {}
local is_54 = minetest.has_feature("direct_velocity_on_players") or false
screwdriver = screwdriver or {}
local min, ceil = math.min, math.ceil
local S = xdecor.S
@ -343,7 +343,7 @@ for i = 1, #nodes do
drawtype = "nodebox",
sounds = def.sounds,
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,
-- `unpack` has been changed to `table.unpack` in newest Lua versions
node_box = xdecor.pixelbox(16, {unpack(d, 3)}),

View File

@ -2,7 +2,7 @@
-- Load support for MT game translation.
local S = minetest.get_translator("xpanes")
local is_54 = minetest.has_feature("direct_velocity_on_players") or false
local function is_pane(pos)
return minetest.get_item_group(minetest.get_node(pos).name, "pane") > 0
@ -116,7 +116,7 @@ function xpanes.register_pane(name, def)
groups = flatgroups,
drop = "xpanes:" .. name .. "_flat",
sounds = def.sounds,
use_texture_alpha = def.use_texture_alpha or false,
use_texture_alpha = def.use_texture_alpha or (is_54 and "opaque" or false),
node_box = {
type = "fixed",
fixed = {{-1/2, -1/2, -1/32, 1/2, 1/2, 1/32}},
@ -145,7 +145,7 @@ function xpanes.register_pane(name, def)
groups = groups,
drop = "xpanes:" .. name .. "_flat",
sounds = def.sounds,
use_texture_alpha = def.use_texture_alpha or false,
use_texture_alpha = def.use_texture_alpha or (is_54 and "opaque" or false),
node_box = {
type = "connected",
fixed = {{-1/32, -1/2, -1/32, 1/32, 1/2, 1/32}},