Skip to content

Commit

Permalink
Update game APIs for use_texture_alpha deprecation
Browse files Browse the repository at this point in the history
  • Loading branch information
sfan5 committed Feb 7, 2021
1 parent 08b13c9 commit aa9cc39
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
2 changes: 2 additions & 0 deletions mods/default/nodes.lua
Expand Up @@ -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,
Expand All @@ -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,
Expand Down
12 changes: 12 additions & 0 deletions mods/stairs/init.lua
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand All @@ -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,
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions mods/xpanes/init.lua
Expand Up @@ -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}},
Expand Down Expand Up @@ -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}},
Expand Down

0 comments on commit aa9cc39

Please sign in to comment.