Compare commits

...

2 Commits

Author SHA1 Message Date
16da62e7e4 Fix some placer nil checks
* backported upstream 70cf7a26fd
2024-04-24 17:01:58 -04:00
7590fea329 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
2024-04-24 16:18:26 -04:00
20 changed files with 87 additions and 20 deletions

View File

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

View File

@ -1,4 +1,7 @@
-- Fancy shaped bed -- 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", { beds.register_bed("beds:fancy_bed", {
description = "Fancy Bed", description = "Fancy Bed",
@ -22,6 +25,7 @@ beds.register_bed("beds:fancy_bed", {
"default_wood.png", "default_wood.png",
} }
}, },
use_texture_alpha = (is_54 and "clip" or true),
nodebox = { nodebox = {
bottom = { bottom = {
{-0.5, -0.5, -0.5, -0.375, -0.065, -0.4375}, {-0.5, -0.5, -0.5, -0.375, -0.065, -0.4375},
@ -73,6 +77,7 @@ beds.register_bed("beds:bed", {
"beds_transparent.png", "beds_transparent.png",
} }
}, },
use_texture_alpha = (is_54 and "clip" or true),
nodebox = { nodebox = {
bottom = {-0.5, -0.5, -0.5, 0.5, 0.06, 0.5}, 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}, top = {-0.5, -0.5, -0.5, 0.5, 0.06, 0.5},

View File

@ -65,6 +65,7 @@ function bucket.register_liquid(source, flowing, itemname, inventory_image, name
end end
local node = minetest.get_node_or_nil(pointed_thing.under) local node = minetest.get_node_or_nil(pointed_thing.under)
if not node then return end
local ndef = node and minetest.registered_nodes[node.name] local ndef = node and minetest.registered_nodes[node.name]
-- Call on_rightclick if the pointed node defines it -- Call on_rightclick if the pointed node defines it
@ -125,6 +126,7 @@ minetest.register_craftitem("bucket:bucket_empty", {
end end
-- Check if pointing to a liquid source -- Check if pointing to a liquid source
local node = minetest.get_node(pointed_thing.under) local node = minetest.get_node(pointed_thing.under)
if not node then return end
local liquiddef = bucket.liquids[node.name] local liquiddef = bucket.liquids[node.name]
local item_count = user:get_wielded_item():get_count() local item_count = user:get_wielded_item():get_count()
@ -148,7 +150,7 @@ minetest.register_craftitem("bucket:bucket_empty", {
if inv:room_for_item("main", {name=liquiddef.itemname}) then if inv:room_for_item("main", {name=liquiddef.itemname}) then
inv:add_item("main", liquiddef.itemname) inv:add_item("main", liquiddef.itemname)
else else
local pos = user:getpos() local pos = user:get_pos()
pos.y = math.floor(pos.y + 0.5) pos.y = math.floor(pos.y + 0.5)
minetest.add_item(pos, liquiddef.itemname) minetest.add_item(pos, liquiddef.itemname)
end end

View File

@ -121,7 +121,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
if inv:room_for_item("main", new_stack) then if inv:room_for_item("main", new_stack) then
inv:add_item("main", new_stack) inv:add_item("main", new_stack)
else else
minetest.add_item(player:getpos(), new_stack) minetest.add_item(player:get_pos(), new_stack)
end end
else else
stack:get_meta():from_table({ fields = data }) stack:get_meta():from_table({ fields = data })
@ -216,7 +216,8 @@ minetest.register_craftitem("default:skeleton_key", {
return itemstack return itemstack
end end
local on_skeleton_key_use = minetest.registered_nodes[node.name].on_skeleton_key_use local node_reg = minetest.registered_nodes[node.name]
local on_skeleton_key_use = node_reg and node_reg.on_skeleton_key_use
if not on_skeleton_key_use then if not on_skeleton_key_use then
return itemstack return itemstack
end end

View File

@ -562,7 +562,7 @@ minetest.register_abm({
-- --
function default.can_interact_with_node(player, pos) function default.can_interact_with_node(player, pos)
if player then if player and player:is_player() then
if minetest.check_player_privs(player, "protection_bypass") then if minetest.check_player_privs(player, "protection_bypass") then
return true return true
end end

View File

@ -48,7 +48,11 @@ local item = {
if self.ignite_timer > 10 then if self.ignite_timer > 10 then
self.ignite_timer = 0 self.ignite_timer = 0
local node = minetest.get_node_or_nil(self.object:getpos()) local pos = self.object:get_pos()
if pos == nil then
return -- object already deleted
end
local node = minetest.get_node_or_nil(pos)
if not node then if not node then
return return
end end

View File

@ -1,4 +1,5 @@
-- mods/default/legacy.lua -- 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 -- Horrible stuff to support old code registering falling nodes
-- Don't use this and never do what this does, it's completely wrong! -- 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 end
-- Liquids -- 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 WATER_VISC = minetest.registered_nodes["default:water_source"].liquid_viscosity
LAVA_VISC = minetest.registered_nodes["default:lava_source"].liquid_viscosity LAVA_VISC = minetest.registered_nodes["default:lava_source"].liquid_viscosity
LIGHT_MAX = default.LIGHT_MAX LIGHT_MAX = default.LIGHT_MAX
if is_54 then WATER_ALPHA = minetest.registered_nodes["default:water_source"].use_texture_alpha or "opaque" end
-- Formspecs -- Formspecs
default.gui_suvival_form = default.gui_survival_form default.gui_suvival_form = default.gui_survival_form
@ -47,3 +49,14 @@ else
player_api.set_animation = default.player_set_animation player_api.set_animation = default.player_set_animation
end end
-- Chests
default.register_chest = default.chest.register_chest
-- Check for a volume intersecting protection
if minetest.is_area_protected then
function default.intersects_protection(minp, maxp, player_name, interval)
minetest.log("warning", "default.intersects_protection() is " ..
"deprecated, use minetest.is_area_protected() instead.")
return minetest.is_area_protected(minp, maxp, player_name, interval)
end
end

View File

@ -208,6 +208,11 @@ default:cloud
-- Stone -- 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", { minetest.register_node("default:stone", {
description = "Stone", description = "Stone",
tiles = {"default_stone.png"}, tiles = {"default_stone.png"},
@ -1507,7 +1512,7 @@ minetest.register_node("default:water_source", {
backface_culling = false, backface_culling = false,
}, },
}, },
alpha = 160, use_texture_alpha = alpha_use_texture_alpha,
paramtype = "light", paramtype = "light",
walkable = false, walkable = false,
pointable = false, pointable = false,
@ -1551,7 +1556,7 @@ minetest.register_node("default:water_flowing", {
}, },
}, },
}, },
alpha = 160, use_texture_alpha = alpha_use_texture_alpha,
paramtype = "light", paramtype = "light",
paramtype2 = "flowingliquid", paramtype2 = "flowingliquid",
walkable = false, walkable = false,
@ -1598,7 +1603,7 @@ minetest.register_node("default:river_water_source", {
backface_culling = false, backface_culling = false,
}, },
}, },
alpha = 160, use_texture_alpha = alpha_use_texture_alpha,
paramtype = "light", paramtype = "light",
walkable = false, walkable = false,
pointable = 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", paramtype = "light",
paramtype2 = "flowingliquid", paramtype2 = "flowingliquid",
walkable = false, walkable = false,
@ -2175,6 +2180,7 @@ local function register_sign(material, desc, def)
sunlight_propagates = true, sunlight_propagates = true,
is_ground_content = false, is_ground_content = false,
walkable = false, walkable = false,
use_texture_alpha = (is_54 and "opaque" or true),
node_box = { node_box = {
type = "wallmounted", type = "wallmounted",
wall_top = {-0.4375, 0.4375, -0.3125, 0.4375, 0.5, 0.3125}, 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", description = "Glass",
drawtype = "glasslike_framed_optional", drawtype = "glasslike_framed_optional",
tiles = {"default_glass.png", "default_glass_detail.png"}, tiles = {"default_glass.png", "default_glass_detail.png"},
use_texture_alpha = (is_54 and "clip" or true),
paramtype = "light", paramtype = "light",
paramtype2 = "glasslikeliquidlevel", paramtype2 = "glasslikeliquidlevel",
sunlight_propagates = true, sunlight_propagates = true,
@ -2328,6 +2335,7 @@ minetest.register_node("default:obsidian_glass", {
description = "Obsidian Glass", description = "Obsidian Glass",
drawtype = "glasslike_framed_optional", drawtype = "glasslike_framed_optional",
tiles = {"default_obsidian_glass.png", "default_obsidian_glass_detail.png"}, tiles = {"default_obsidian_glass.png", "default_obsidian_glass_detail.png"},
use_texture_alpha = (is_54 and "clip" or true),
paramtype = "light", paramtype = "light",
paramtype2 = "glasslikeliquidlevel", paramtype2 = "glasslikeliquidlevel",
is_ground_content = false, 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", 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_dark.png", "default_mese_post_light_side_dark.png",
"default_mese_post_light_side.png", "default_mese_post_light_side.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", wield_image = "default_mese_post_light_side.png",
drawtype = "nodebox", drawtype = "nodebox",
node_box = { 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", { minetest.register_node("default:torch", {
description = "Torch", description = "Torch",
drawtype = "mesh", drawtype = "mesh",
@ -45,6 +47,7 @@ minetest.register_node("default:torch", {
name = "default_torch_on_floor_animated.png", name = "default_torch_on_floor_animated.png",
animation = {type = "vertical_frames", aspect_w = 16, aspect_h = 16, length = 3.3} animation = {type = "vertical_frames", aspect_w = 16, aspect_h = 16, length = 3.3}
}}, }},
use_texture_alpha = (is_54 and "clip" or true),
paramtype = "light", paramtype = "light",
paramtype2 = "wallmounted", paramtype2 = "wallmounted",
sunlight_propagates = true, sunlight_propagates = true,
@ -94,6 +97,7 @@ minetest.register_node("default:torch_wall", {
name = "default_torch_on_floor_animated.png", name = "default_torch_on_floor_animated.png",
animation = {type = "vertical_frames", aspect_w = 16, aspect_h = 16, length = 3.3} animation = {type = "vertical_frames", aspect_w = 16, aspect_h = 16, length = 3.3}
}}, }},
use_texture_alpha = (is_54 and "clip" or true),
paramtype = "light", paramtype = "light",
paramtype2 = "wallmounted", paramtype2 = "wallmounted",
sunlight_propagates = true, sunlight_propagates = true,
@ -106,6 +110,9 @@ minetest.register_node("default:torch_wall", {
wall_side = {-1/2, -1/2, -1/8, -1/8, 1/8, 1/8}, wall_side = {-1/2, -1/2, -1/8, -1/8, 1/8, 1/8},
}, },
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
floodable = true,
on_flood = on_flood,
on_rotate = false
}) })
minetest.register_node("default:torch_ceiling", { minetest.register_node("default:torch_ceiling", {
@ -115,6 +122,7 @@ minetest.register_node("default:torch_ceiling", {
name = "default_torch_on_floor_animated.png", name = "default_torch_on_floor_animated.png",
animation = {type = "vertical_frames", aspect_w = 16, aspect_h = 16, length = 3.3} animation = {type = "vertical_frames", aspect_w = 16, aspect_h = 16, length = 3.3}
}}, }},
use_texture_alpha = (is_54 and "clip" or true),
paramtype = "light", paramtype = "light",
paramtype2 = "wallmounted", paramtype2 = "wallmounted",
sunlight_propagates = true, sunlight_propagates = true,
@ -127,6 +135,9 @@ minetest.register_node("default:torch_ceiling", {
wall_top = {-1/8, -1/16, -5/16, 1/8, 1/2, 1/8}, wall_top = {-1/8, -1/16, -5/16, 1/8, 1/2, 1/8},
}, },
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
floodable = true,
on_flood = on_flood,
on_rotate = false
}) })
minetest.register_lbm({ minetest.register_lbm({

View File

@ -1,3 +1,5 @@
local is_54 = minetest.has_feature("direct_velocity_on_players") or false
-- our API object -- our API object
doors = {} doors = {}
@ -80,6 +82,7 @@ minetest.register_node("doors:hidden", {
paramtype = "light", paramtype = "light",
paramtype2 = "facedir", paramtype2 = "facedir",
sunlight_propagates = true, sunlight_propagates = true,
use_texture_alpha = (is_54 and "clip" or true),
-- has to be walkable for falling nodes to stop falling. -- has to be walkable for falling nodes to stop falling.
walkable = true, walkable = true,
pointable = false, pointable = false,
@ -320,6 +323,9 @@ function doors.register(name, def)
meta:set_int("state", state) meta:set_int("state", state)
if def.protected then if def.protected then
local pn = placer:get_player_name()
meta:set_string("owner", pn) meta:set_string("owner", pn)
meta:set_string("infotext", "Owned by " .. pn) meta:set_string("infotext", "Owned by " .. pn)
end end
@ -423,6 +429,7 @@ function doors.register(name, def)
def.paramtype = "light" def.paramtype = "light"
def.paramtype2 = "facedir" def.paramtype2 = "facedir"
def.sunlight_propagates = true def.sunlight_propagates = true
def.use_texture_alpha = def.use_texture_alpha or (is_54 and "clip" or true)
def.walkable = true def.walkable = true
def.is_ground_content = false def.is_ground_content = false
def.buildable_to = false def.buildable_to = false
@ -564,6 +571,7 @@ function doors.register_trapdoor(name, def)
def.drawtype = "nodebox" def.drawtype = "nodebox"
def.paramtype = "light" def.paramtype = "light"
def.paramtype2 = "facedir" def.paramtype2 = "facedir"
def.use_texture_alpha = def.use_texture_alpha or (is_54 and "clip" or true)
def.is_ground_content = false def.is_ground_content = false
if def.protected then if def.protected then

View File

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

View File

@ -6,6 +6,7 @@
flowers = {} flowers = {}
local is_54 = minetest.has_feature("direct_velocity_on_players") or false
-- Map Generation -- Map Generation
@ -271,6 +272,7 @@ minetest.register_node("flowers:waterlily", {
tiles = {"flowers_waterlily.png", "flowers_waterlily_bottom.png"}, tiles = {"flowers_waterlily.png", "flowers_waterlily_bottom.png"},
inventory_image = "flowers_waterlily.png", inventory_image = "flowers_waterlily.png",
wield_image = "flowers_waterlily.png", wield_image = "flowers_waterlily.png",
use_texture_alpha = (is_54 and "clip" or true),
liquids_pointable = true, liquids_pointable = true,
walkable = false, walkable = false,
buildable_to = true, buildable_to = true,

View File

@ -41,9 +41,8 @@ minetest.register_node("mobs:spawner", {
end, end,
on_right_click = function(pos, placer) on_right_click = function(pos, placer)
if placer and type(placer) == "userdata" then
if minetest.is_protected(pos, placer:get_player_name()) then if minetest.is_protected(pos, placer:get_player_name()) then return end
return
end end
end, end,

View File

@ -376,4 +376,4 @@ mobs:register_egg("mobs_jam:balrog",
mobs:alias_mob("mobs_balrog:balrog", "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

@ -262,8 +262,8 @@ minetest.register_node(":mobs:egg", {
}, },
groups = {food_egg = 1, snappy = 2, dig_immediate = 3}, groups = {food_egg = 1, snappy = 2, dig_immediate = 3},
after_place_node = function(pos, placer, itemstack) after_place_node = function(pos, placer, itemstack)
if placer:is_player() then if placer then
minetest.set_node(pos, {name = "mobs:egg", param2 = 1}) if placer:is_player() then minetest.set_node(pos, {name = "mobs:egg", param2 = 1}) end
end end
end, end,
on_use = mobs_shoot_egg on_use = mobs_shoot_egg

View File

@ -16,6 +16,7 @@ function place_spore(itemstack, placer, pointed_thing, name, topoint, soilblock)
end end
-- if not protected then add node and remove 1 item from the itemstack -- if not protected then add node and remove 1 item from the itemstack
if not placer then return end
if not minetest.is_protected(pt.under, placer:get_player_name()) then if not minetest.is_protected(pt.under, placer:get_player_name()) then
if (under.name == topoint) and (minetest.get_node(uu).name == soilblock) then if (under.name == topoint) and (minetest.get_node(uu).name == soilblock) then
minetest.set_node(uu, {name = name}) minetest.set_node(uu, {name = name})

View File

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

View File

@ -589,9 +589,9 @@ function tnt.register_tnt(def)
groups = {dig_immediate = 2, mesecon = 2, tnt = 1, flammable = 5}, groups = {dig_immediate = 2, mesecon = 2, tnt = 1, flammable = 5},
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
after_place_node = function(pos, placer) after_place_node = function(pos, placer)
if placer:is_player() then if placer then
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
meta:set_string("owner", placer:get_player_name()) meta:set_string("owner", placer and placer:get_player_name() or "")
end end
end, end,
on_punch = function(pos, node, puncher) on_punch = function(pos, node, puncher)

View File

@ -1,6 +1,7 @@
local workbench = {} local workbench = {}
local nodes = {} local nodes = {}
local is_54 = minetest.has_feature("direct_velocity_on_players") or false
screwdriver = screwdriver or {} screwdriver = screwdriver or {}
local min, ceil = math.min, math.ceil local min, ceil = math.min, math.ceil
local S = xdecor.S local S = xdecor.S
@ -343,7 +344,7 @@ for i = 1, #nodes do
drawtype = "nodebox", drawtype = "nodebox",
sounds = def.sounds, sounds = def.sounds,
tiles = tiles, 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, groups = groups,
-- `unpack` has been changed to `table.unpack` in newest Lua versions -- `unpack` has been changed to `table.unpack` in newest Lua versions
node_box = xdecor.pixelbox(16, {unpack(d, 3)}), 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) local function is_pane(pos)
return minetest.get_item_group(minetest.get_node(pos).name, "pane") > 0 return minetest.get_item_group(minetest.get_node(pos).name, "pane") > 0
end end
@ -104,6 +106,7 @@ function xpanes.register_pane(name, def)
groups = flatgroups, groups = flatgroups,
drop = "xpanes:" .. name .. "_flat", drop = "xpanes:" .. name .. "_flat",
sounds = def.sounds, sounds = def.sounds,
use_texture_alpha = def.use_texture_alpha or (is_54 and "opaque" or false),
node_box = { node_box = {
type = "fixed", type = "fixed",
fixed = {{-1/2, -1/2, -1/32, 1/2, 1/2, 1/32}}, 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, groups = groups,
drop = "xpanes:" .. name .. "_flat", drop = "xpanes:" .. name .. "_flat",
sounds = def.sounds, sounds = def.sounds,
use_texture_alpha = def.use_texture_alpha or (is_54 and "opaque" or false),
node_box = { node_box = {
type = "connected", type = "connected",
fixed = {{-1/32, -1/2, -1/32, 1/32, 1/2, 1/32}}, fixed = {{-1/32, -1/2, -1/32, 1/32, 1/2, 1/32}},