From 8c07924bf1b503e756d53571624df255077ce0f6 Mon Sep 17 00:00:00 2001 From: mckaygerhard Date: Tue, 23 Apr 2024 18:04:16 -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 | 18 ++++++++++++++---- mods/default/torch.lua | 4 ++++ mods/doors/init.lua | 9 +++++---- mods/farming/compatibility.lua | 3 ++- mods/farming/crops/garlic.lua | 3 ++- mods/flowers/init.lua | 3 ++- mods/stairs/init.lua | 10 +++++++--- mods/xdecor/src/workbench.lua | 4 ++-- mods/xpanes/init.lua | 6 +++--- 9 files changed, 41 insertions(+), 19 deletions(-) diff --git a/mods/default/nodes.lua b/mods/default/nodes.lua index a90e573..a89662a 100644 --- a/mods/default/nodes.lua +++ b/mods/default/nodes.lua @@ -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 = { diff --git a/mods/default/torch.lua b/mods/default/torch.lua index c06dee8..8f59e7f 100644 --- a/mods/default/torch.lua +++ b/mods/default/torch.lua @@ -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, diff --git a/mods/doors/init.lua b/mods/doors/init.lua index f314929..5dda9c3 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 = (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 diff --git a/mods/farming/compatibility.lua b/mods/farming/compatibility.lua index f6cf439..b9ed93a 100644 --- a/mods/farming/compatibility.lua +++ b/mods/farming/compatibility.lua @@ -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} }) 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 9731750..889e126 100644 --- a/mods/flowers/init.lua +++ b/mods/flowers/init.lua @@ -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, diff --git a/mods/stairs/init.lua b/mods/stairs/init.lua index e8956b2..ecce2b6 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 @@ -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 diff --git a/mods/xdecor/src/workbench.lua b/mods/xdecor/src/workbench.lua index 2f7ca25..2cfe7af 100644 --- a/mods/xdecor/src/workbench.lua +++ b/mods/xdecor/src/workbench.lua @@ -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)}), diff --git a/mods/xpanes/init.lua b/mods/xpanes/init.lua index 4f4f0f5..564addb 100644 --- a/mods/xpanes/init.lua +++ b/mods/xpanes/init.lua @@ -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}},