From 46ce26ded2d6d700eff644c4d35389e23d8ee6ca Mon Sep 17 00:00:00 2001 From: mckaygerhard Date: Wed, 24 Apr 2024 13:01:57 -0400 Subject: [PATCH] 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 --- mods/default/nodes.lua | 13 +++++++++++++ mods/default/torch.lua | 4 ++++ mods/doors/init.lua | 9 +++++---- mods/farming/compatibility.lua | 2 ++ mods/farming/crops/garlic.lua | 3 ++- mods/flowers/init.lua | 2 ++ mods/stairs/init.lua | 9 ++++++--- mods/xdecor/src/workbench.lua | 3 ++- mods/xpanes/init.lua | 4 ++++ 9 files changed, 40 insertions(+), 9 deletions(-) diff --git a/mods/default/nodes.lua b/mods/default/nodes.lua index 2367000..b1e0007 100644 --- a/mods/default/nodes.lua +++ b/mods/default/nodes.lua @@ -208,6 +208,11 @@ default:cloud -- 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", { description = "Stone", tiles = {"default_stone.png"}, @@ -1508,6 +1513,7 @@ minetest.register_node("default:water_source", { }, }, alpha = 160, + use_texture_alpha = alpha_use_texture_alpha, paramtype = "light", walkable = false, pointable = false, @@ -1552,6 +1558,7 @@ minetest.register_node("default:water_flowing", { }, }, alpha = 160, + use_texture_alpha = alpha_use_texture_alpha, paramtype = "light", paramtype2 = "flowingliquid", walkable = false, @@ -1599,6 +1606,7 @@ minetest.register_node("default:river_water_source", { }, }, alpha = 160, + use_texture_alpha = alpha_use_texture_alpha, paramtype = "light", walkable = false, pointable = false, @@ -1645,6 +1653,7 @@ minetest.register_node("default:river_water_flowing", { }, }, alpha = 160, + use_texture_alpha = alpha_use_texture_alpha, paramtype = "light", paramtype2 = "flowingliquid", walkable = false, @@ -2185,6 +2194,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}, @@ -2326,6 +2336,7 @@ minetest.register_node("default:glass", { description = "Glass", drawtype = "glasslike_framed_optional", tiles = {"default_glass.png", "default_glass_detail.png"}, + use_texture_alpha = (is_54 and "clip" or alpha_use_texture_alpha), paramtype = "light", paramtype2 = "glasslikeliquidlevel", sunlight_propagates = true, @@ -2338,6 +2349,7 @@ minetest.register_node("default:obsidian_glass", { description = "Obsidian Glass", drawtype = "glasslike_framed_optional", tiles = {"default_obsidian_glass.png", "default_obsidian_glass_detail.png"}, + use_texture_alpha = (is_54 and "clip" or alpha_use_texture_alpha), paramtype = "light", paramtype2 = "glasslikeliquidlevel", 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", "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 alpha_use_texture_alpha), wield_image = "default_mese_post_light_side.png", drawtype = "nodebox", node_box = { diff --git a/mods/default/torch.lua b/mods/default/torch.lua index a7b83cf..13b62ae 100644 --- a/mods/default/torch.lua +++ b/mods/default/torch.lua @@ -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", { description = "Torch", drawtype = "mesh", @@ -94,6 +96,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, @@ -115,6 +118,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, diff --git a/mods/doors/init.lua b/mods/doors/init.lua index f314929..8edf83d 100644 --- a/mods/doors/init.lua +++ b/mods/doors/init.lua @@ -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 = def.use_texture_alpha or (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 = def.use_texture_alpha or (is_54 and "clip" or true) def.is_ground_content = false if def.protected then diff --git a/mods/farming/compatibility.lua b/mods/farming/compatibility.lua index 59a8355..ae015ae 100644 --- a/mods/farming/compatibility.lua +++ b/mods/farming/compatibility.lua @@ -3,6 +3,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 +37,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} }) diff --git a/mods/farming/crops/garlic.lua b/mods/farming/crops/garlic.lua index ca2005a..604a401 100644 --- a/mods/farming/crops/garlic.lua +++ b/mods/farming/crops/garlic.lua @@ -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 = { diff --git a/mods/flowers/init.lua b/mods/flowers/init.lua index 00a82ee..aff37ce 100644 --- a/mods/flowers/init.lua +++ b/mods/flowers/init.lua @@ -6,6 +6,7 @@ flowers = {} +local is_54 = minetest.has_feature("direct_velocity_on_players") or false -- Map Generation @@ -271,6 +272,7 @@ minetest.register_node("flowers:waterlily", { 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, diff --git a/mods/stairs/init.lua b/mods/stairs/init.lua index e8956b2..10adc3e 100644 --- a/mods/stairs/init.lua +++ b/mods/stairs/init.lua @@ -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 @@ -136,8 +138,9 @@ local function get_node_vars(nodename) if def then return def.light_source, def.use_texture_alpha, def.sunlight_propagates end + if is_54 then return 0, "clip", nil end - return nil, nil, nil + return false, true, nil end diff --git a/mods/xdecor/src/workbench.lua b/mods/xdecor/src/workbench.lua index 2f7ca25..083e9af 100644 --- a/mods/xdecor/src/workbench.lua +++ b/mods/xdecor/src/workbench.lua @@ -1,6 +1,7 @@ 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 +344,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)}), diff --git a/mods/xpanes/init.lua b/mods/xpanes/init.lua index 40fddba..6b790bb 100644 --- a/mods/xpanes/init.lua +++ b/mods/xpanes/init.lua @@ -1,4 +1,6 @@ +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 end @@ -104,6 +106,7 @@ function xpanes.register_pane(name, def) groups = flatgroups, drop = "xpanes:" .. name .. "_flat", sounds = def.sounds, + 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}}, @@ -128,6 +131,7 @@ function xpanes.register_pane(name, def) groups = groups, drop = "xpanes:" .. name .. "_flat", sounds = def.sounds, + 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}},