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
master
mckaygerhard 2024-04-24 16:18:26 -04:00
parent 5461ae70b7
commit 7590fea329
12 changed files with 48 additions and 8 deletions

View File

@ -1,5 +1,6 @@
local reverse = true
local is_54 = minetest.has_feature("direct_velocity_on_players") or false
local function destruct_bed(pos, n)
local node = minetest.get_node(pos)
@ -29,6 +30,7 @@ function beds.register_bed(name, def)
wield_image = def.wield_image,
drawtype = "nodebox",
tiles = def.tiles.bottom,
use_texture_alpha = (is_54 and "clip" or true),
paramtype = "light",
paramtype2 = "facedir",
is_ground_content = false,
@ -149,6 +151,7 @@ function beds.register_bed(name, def)
paramtype = "light",
paramtype2 = "facedir",
is_ground_content = false,
use_texture_alpha = (is_54 and "clip" or true),
pointable = false,
groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 3, bed = 2},
sounds = def.sounds or default.node_sound_wood_defaults(),

View File

@ -1,4 +1,7 @@
-- Fancy shaped bed
local is_54 = minetest.has_feature("direct_velocity_on_players") or false
print("is 54 "..(is_54 and 'x' or 'nil'))
beds.register_bed("beds:fancy_bed", {
description = "Fancy Bed",
@ -22,6 +25,7 @@ beds.register_bed("beds:fancy_bed", {
"default_wood.png",
}
},
use_texture_alpha = (is_54 and "clip" or true),
nodebox = {
bottom = {
{-0.5, -0.5, -0.5, -0.375, -0.065, -0.4375},
@ -73,6 +77,7 @@ beds.register_bed("beds:bed", {
"beds_transparent.png",
}
},
use_texture_alpha = (is_54 and "clip" or true),
nodebox = {
bottom = {-0.5, -0.5, -0.5, 0.5, 0.06, 0.5},
top = {-0.5, -0.5, -0.5, 0.5, 0.06, 0.5},

View File

@ -1,4 +1,5 @@
-- mods/default/legacy.lua
local is_54 = minetest.has_feature("direct_velocity_on_players") or false
-- Horrible stuff to support old code registering falling nodes
-- Don't use this and never do what this does, it's completely wrong!
@ -16,10 +17,11 @@ function default.spawn_falling_node(p, nodename)
end
-- Liquids
WATER_ALPHA = minetest.registered_nodes["default:water_source"].alpha
WATER_ALPHA = minetest.registered_nodes["default:water_source"].alpha or true
WATER_VISC = minetest.registered_nodes["default:water_source"].liquid_viscosity
LAVA_VISC = minetest.registered_nodes["default:lava_source"].liquid_viscosity
LIGHT_MAX = default.LIGHT_MAX
if is_54 then WATER_ALPHA = minetest.registered_nodes["default:water_source"].use_texture_alpha or "opaque" end
-- Formspecs
default.gui_suvival_form = default.gui_survival_form

View File

@ -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"},
@ -1507,7 +1512,7 @@ minetest.register_node("default:water_source", {
backface_culling = false,
},
},
alpha = 160,
use_texture_alpha = alpha_use_texture_alpha,
paramtype = "light",
walkable = false,
pointable = false,
@ -1551,7 +1556,7 @@ minetest.register_node("default:water_flowing", {
},
},
},
alpha = 160,
use_texture_alpha = alpha_use_texture_alpha,
paramtype = "light",
paramtype2 = "flowingliquid",
walkable = false,
@ -1598,7 +1603,7 @@ minetest.register_node("default:river_water_source", {
backface_culling = false,
},
},
alpha = 160,
use_texture_alpha = alpha_use_texture_alpha,
paramtype = "light",
walkable = false,
pointable = false,
@ -1644,7 +1649,7 @@ minetest.register_node("default:river_water_flowing", {
},
},
},
alpha = 160,
use_texture_alpha = alpha_use_texture_alpha,
paramtype = "light",
paramtype2 = "flowingliquid",
walkable = false,
@ -2175,6 +2180,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 true),
node_box = {
type = "wallmounted",
wall_top = {-0.4375, 0.4375, -0.3125, 0.4375, 0.5, 0.3125},
@ -2316,6 +2322,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 true),
paramtype = "light",
paramtype2 = "glasslikeliquidlevel",
sunlight_propagates = true,
@ -2328,6 +2335,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 true),
paramtype = "light",
paramtype2 = "glasslikeliquidlevel",
is_ground_content = false,
@ -2365,6 +2373,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

@ -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",
@ -45,6 +47,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,
@ -94,6 +97,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 +119,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,3 +1,5 @@
local is_54 = minetest.has_feature("direct_velocity_on_players") or false
-- our API object
doors = {}
@ -87,6 +89,7 @@ minetest.register_node("doors:hidden", {
buildable_to = false,
floodable = false,
drop = "",
use_texture_alpha = (is_54 and "clip" or true),
groups = {not_in_creative_inventory = 1},
on_blast = function() end,
tiles = {"doors_blank.png"},
@ -423,6 +426,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 (is_54 and "clip" or true)
def.walkable = true
def.is_ground_content = false
def.buildable_to = false
@ -564,6 +568,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 (is_54 and "clip" or true)
def.is_ground_content = false
if def.protected then

View File

@ -1,6 +1,7 @@
-- minetest.clear_registered_biomes() -- do not regenerate, we want to combine it!
-- Get setting or default
local is_54 = minetest.has_feature("direct_velocity_on_players") or false
local mgv7 = minetest.get_mapgen_setting("mg_name") or nil
local mgv7_spflags = minetest.get_mapgen_setting("mgv7_spflags") or "mountains, ridges, floatlands, caverns"
local captures_float = string.match(mgv7_spflags, "floatlands")
@ -70,7 +71,7 @@ minetest.register_node("floatland:sand_crystal_block", {
paramtype = "light",
paramtype2 = "glasslikeliquidlevel",
param2 = 255,
use_texture_alpha = "blend",
use_texture_alpha = (is_54 and "blend" or true),
sunlight_propagates = false,
groups = {cracky = 2},
sounds = default.node_sound_glass_defaults(),

View File

@ -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,

View File

@ -376,4 +376,4 @@ mobs:register_egg("mobs_jam:balrog",
mobs:alias_mob("mobs_balrog:balrog", "mobs_jam:balrog")
print("[Mod] Mobs Balrog (from mobs_jam) loaded.")
print("[Mod] Mobs JAM (Balrog) loaded.")

View File

@ -1,6 +1,7 @@
-- Minetest 0.4 mod: stairs
-- See README.txt for licensing and other information.
local is_54 = minetest.has_feature("direct_velocity_on_players") or false
-- Global namespace for functions
@ -70,6 +71,7 @@ function stairs.register_stair(subname, recipeitem, groups, images, description,
paramtype = "light",
paramtype2 = "facedir",
is_ground_content = false,
use_texture_alpha = (is_54 and "clip" or true),
groups = new_groups,
sounds = sounds,
selection_box = {
@ -147,6 +149,7 @@ function stairs.register_slab(subname, recipeitem, groups, images, description,
paramtype = "light",
paramtype2 = "facedir",
is_ground_content = false,
use_texture_alpha = (is_54 and "clip" or true),
groups = new_groups,
sounds = sounds,
node_box = {

View File

@ -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)}),

View File

@ -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}},