Add `use_texture_alpha` compatibility code

master
luk3yx 2021-09-01 17:09:36 +12:00 committed by MoNTE48
parent b112040114
commit 03d7d8d5ce
1 changed files with 20 additions and 0 deletions

View File

@ -216,6 +216,26 @@ end
function core.register_node(name, nodedef)
nodedef.type = "node"
-- Reference: https://github.com/minetest/minetest/pull/10819
if type(nodedef.use_texture_alpha) == "string" then
local drawtype = nodedef.drawtype
if not drawtype or drawtype == "normal" then
nodedef.use_texture_alpha = nodedef.use_texture_alpha ~= "opaque"
elseif drawtype ~= "liquid" then
-- All drawtypes other than normal and liquid
nodedef.use_texture_alpha = nodedef.use_texture_alpha == "blend"
elseif nodedef.alpha == nil then
-- Liquids have a separate alpha field,
if nodedef.use_texture_alpha == "opaque" then
nodedef.alpha = 255
else
nodedef.alpha = 0
end
nodedef.use_texture_alpha = nil
end
end
core.register_item(name, nodedef)
end