From aa9cc3931735a4ade09e83ffd76acdafcd697585 Mon Sep 17 00:00:00 2001 From: sfan5 Date: Sat, 6 Feb 2021 16:21:35 +0100 Subject: [PATCH] Update game APIs for use_texture_alpha deprecation --- mods/default/nodes.lua | 2 ++ mods/stairs/init.lua | 12 ++++++++++++ mods/xpanes/init.lua | 4 ++-- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/mods/default/nodes.lua b/mods/default/nodes.lua index 4a9fab98..1358c706 100644 --- a/mods/default/nodes.lua +++ b/mods/default/nodes.lua @@ -2800,6 +2800,7 @@ minetest.register_node("default:glass", { description = S("Glass"), drawtype = "glasslike_framed_optional", tiles = {"default_glass.png", "default_glass_detail.png"}, + use_texture_alpha = "clip", -- only needed for stairs API paramtype = "light", paramtype2 = "glasslikeliquidlevel", sunlight_propagates = true, @@ -2812,6 +2813,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 = "clip", -- only needed for stairs API paramtype = "light", paramtype2 = "glasslikeliquidlevel", is_ground_content = false, diff --git a/mods/stairs/init.lua b/mods/stairs/init.lua index 96089996..89e0d24a 100644 --- a/mods/stairs/init.lua +++ b/mods/stairs/init.lua @@ -63,6 +63,8 @@ end function stairs.register_stair(subname, recipeitem, groups, images, description, sounds, worldaligntex) + local src_def = minetest.registered_nodes[recipeitem] + -- Set backface culling and world-aligned textures local stair_images = {} for i, image in ipairs(images) do @@ -91,6 +93,7 @@ function stairs.register_stair(subname, recipeitem, groups, images, description, description = description, drawtype = "nodebox", tiles = stair_images, + use_texture_alpha = src_def and src_def.use_texture_alpha, paramtype = "light", paramtype2 = "facedir", is_ground_content = false, @@ -162,6 +165,8 @@ end function stairs.register_slab(subname, recipeitem, groups, images, description, sounds, worldaligntex) + local src_def = minetest.registered_nodes[recipeitem] + -- Set world-aligned textures local slab_images = {} for i, image in ipairs(images) do @@ -186,6 +191,7 @@ function stairs.register_slab(subname, recipeitem, groups, images, description, description = description, drawtype = "nodebox", tiles = slab_images, + use_texture_alpha = src_def and src_def.use_texture_alpha, paramtype = "light", paramtype2 = "facedir", is_ground_content = false, @@ -297,6 +303,8 @@ end function stairs.register_stair_inner(subname, recipeitem, groups, images, description, sounds, worldaligntex, full_description) + local src_def = minetest.registered_nodes[recipeitem] + -- Set backface culling and world-aligned textures local stair_images = {} for i, image in ipairs(images) do @@ -330,6 +338,7 @@ function stairs.register_stair_inner(subname, recipeitem, groups, images, description = description, drawtype = "nodebox", tiles = stair_images, + use_texture_alpha = src_def and src_def.use_texture_alpha, paramtype = "light", paramtype2 = "facedir", is_ground_content = false, @@ -384,6 +393,8 @@ end function stairs.register_stair_outer(subname, recipeitem, groups, images, description, sounds, worldaligntex, full_description) + local src_def = minetest.registered_nodes[recipeitem] + -- Set backface culling and world-aligned textures local stair_images = {} for i, image in ipairs(images) do @@ -417,6 +428,7 @@ function stairs.register_stair_outer(subname, recipeitem, groups, images, description = description, drawtype = "nodebox", tiles = stair_images, + use_texture_alpha = src_def and src_def.use_texture_alpha, paramtype = "light", paramtype2 = "facedir", is_ground_content = false, diff --git a/mods/xpanes/init.lua b/mods/xpanes/init.lua index e195dbbc..a2398dab 100644 --- a/mods/xpanes/init.lua +++ b/mods/xpanes/init.lua @@ -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 and "blend" or "clip", 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 and "blend" or "clip", node_box = { type = "connected", fixed = {{-1/32, -1/2, -1/32, 1/32, 1/2, 1/32}},