mirror of
https://github.com/mt-mods/pipeworks.git
synced 2024-12-28 20:00:27 +01:00
Get rid of most 5.4.0 texture warnings
This commit also shortens the lua_tube.lua code a bit
This commit is contained in:
parent
9ad6e5d07a
commit
d2954c5277
@ -45,6 +45,10 @@ local pane_box = {
|
|||||||
{ -8/16, -8/16, -1/16, 8/16, 8/16, 1/16 } -- pane
|
{ -8/16, -8/16, -1/16, 8/16, 8/16, 1/16 } -- pane
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
local texture_alpha_mode = minetest.features.use_texture_alpha_string_modes
|
||||||
|
and "clip" or true
|
||||||
|
|
||||||
minetest.register_node("pipeworks:steel_pane_embedded_tube", {
|
minetest.register_node("pipeworks:steel_pane_embedded_tube", {
|
||||||
drawtype = "nodebox",
|
drawtype = "nodebox",
|
||||||
description = S("Airtight panel embedded tube"),
|
description = S("Airtight panel embedded tube"),
|
||||||
@ -55,6 +59,7 @@ minetest.register_node("pipeworks:steel_pane_embedded_tube", {
|
|||||||
"pipeworks_pane_embedded_tube_sides.png",
|
"pipeworks_pane_embedded_tube_sides.png",
|
||||||
"pipeworks_pane_embedded_tube_ends.png", "pipeworks_pane_embedded_tube_ends.png",
|
"pipeworks_pane_embedded_tube_ends.png", "pipeworks_pane_embedded_tube_ends.png",
|
||||||
},
|
},
|
||||||
|
use_texture_alpha = texture_alpha_mode,
|
||||||
node_box = pane_box,
|
node_box = pane_box,
|
||||||
selection_box = pane_box,
|
selection_box = pane_box,
|
||||||
collision_box = pane_box,
|
collision_box = pane_box,
|
||||||
|
112
lua_tube.lua
112
lua_tube.lua
@ -813,82 +813,56 @@ local tiles_base = {
|
|||||||
"pipeworks_mese_tube_plain_2.png", "pipeworks_mese_tube_plain_1.png",
|
"pipeworks_mese_tube_plain_2.png", "pipeworks_mese_tube_plain_1.png",
|
||||||
"pipeworks_mese_tube_plain_6.png", "pipeworks_mese_tube_plain_5.png"}
|
"pipeworks_mese_tube_plain_6.png", "pipeworks_mese_tube_plain_5.png"}
|
||||||
|
|
||||||
|
local tiles_on_off = {
|
||||||
|
R__0 = "^pipeworks_lua_tube_port_%s.png",
|
||||||
|
R_90 = "^(pipeworks_lua_tube_port_%s.png^[transformR90)",
|
||||||
|
R180 = "^(pipeworks_lua_tube_port_%s.png^[transformR180)",
|
||||||
|
R270 = "^(pipeworks_lua_tube_port_%s.png^[transformR270)"
|
||||||
|
}
|
||||||
|
|
||||||
|
local texture_alpha_mode = minetest.features.use_texture_alpha_string_modes
|
||||||
|
and "clip" or true
|
||||||
|
|
||||||
for red = 0, 1 do -- 0 = off 1 = on
|
for red = 0, 1 do -- 0 = off 1 = on
|
||||||
for blue = 0, 1 do
|
for blue = 0, 1 do
|
||||||
for yellow = 0, 1 do
|
for yellow = 0, 1 do
|
||||||
for green = 0, 1 do
|
for green = 0, 1 do
|
||||||
for black = 0, 1 do
|
for black = 0, 1 do
|
||||||
for white = 0, 1 do
|
for white = 0, 1 do
|
||||||
local cid = tostring(white)..tostring(black)..tostring(green)..
|
local cid = white..black..green..yellow..blue..red
|
||||||
tostring(yellow)..tostring(blue)..tostring(red)
|
|
||||||
local node_name = BASENAME..cid
|
local node_name = BASENAME..cid
|
||||||
|
|
||||||
local tiles = table.copy(tiles_base)
|
local tiles = table.copy(tiles_base)
|
||||||
if red == 1 then
|
-- Red
|
||||||
tiles[1] = tiles[1].."^(pipeworks_lua_tube_port_on.png^[transformR90)"
|
tiles[1] = tiles[1]..tiles_on_off.R_90:format(red == 1 and "on" or "off");
|
||||||
tiles[2] = tiles[2].."^(pipeworks_lua_tube_port_on.png^[transformR90)"
|
tiles[2] = tiles[2]..tiles_on_off.R_90:format(red == 1 and "on" or "off");
|
||||||
tiles[5] = tiles[5].."^(pipeworks_lua_tube_port_on.png^[transformR270)"
|
tiles[5] = tiles[5]..tiles_on_off.R270:format(red == 1 and "on" or "off");
|
||||||
tiles[6] = tiles[6].."^(pipeworks_lua_tube_port_on.png^[transformR90)"
|
tiles[6] = tiles[6]..tiles_on_off.R_90:format(red == 1 and "on" or "off");
|
||||||
else
|
-- Blue
|
||||||
tiles[1] = tiles[1].."^(pipeworks_lua_tube_port_off.png^[transformR90)"
|
tiles[1] = tiles[1]..tiles_on_off.R270:format(blue == 1 and "on" or "off");
|
||||||
tiles[2] = tiles[2].."^(pipeworks_lua_tube_port_off.png^[transformR90)"
|
tiles[2] = tiles[2]..tiles_on_off.R270:format(blue == 1 and "on" or "off");
|
||||||
tiles[5] = tiles[5].."^(pipeworks_lua_tube_port_off.png^[transformR270)"
|
tiles[5] = tiles[5]..tiles_on_off.R_90:format(blue == 1 and "on" or "off");
|
||||||
tiles[6] = tiles[6].."^(pipeworks_lua_tube_port_off.png^[transformR90)"
|
tiles[6] = tiles[6]..tiles_on_off.R270:format(blue == 1 and "on" or "off");
|
||||||
end
|
-- Yellow
|
||||||
if blue == 1 then
|
tiles[1] = tiles[1]..tiles_on_off.R180:format(yellow == 1 and "on" or "off");
|
||||||
tiles[1] = tiles[1].."^(pipeworks_lua_tube_port_on.png^[transformR270)"
|
tiles[2] = tiles[2]..tiles_on_off.R180:format(yellow == 1 and "on" or "off");
|
||||||
tiles[2] = tiles[2].."^(pipeworks_lua_tube_port_on.png^[transformR270)"
|
tiles[5] = tiles[5]..tiles_on_off.R180:format(yellow == 1 and "on" or "off");
|
||||||
tiles[5] = tiles[5].."^(pipeworks_lua_tube_port_on.png^[transformR90)"
|
tiles[6] = tiles[6]..tiles_on_off.R180:format(yellow == 1 and "on" or "off");
|
||||||
tiles[6] = tiles[6].."^(pipeworks_lua_tube_port_on.png^[transformR270)"
|
-- Green
|
||||||
else
|
tiles[3] = tiles[3]..tiles_on_off.R__0:format(green == 1 and "on" or "off");
|
||||||
tiles[1] = tiles[1].."^(pipeworks_lua_tube_port_off.png^[transformR270)"
|
tiles[4] = tiles[4]..tiles_on_off.R__0:format(green == 1 and "on" or "off");
|
||||||
tiles[2] = tiles[2].."^(pipeworks_lua_tube_port_off.png^[transformR270)"
|
tiles[5] = tiles[5]..tiles_on_off.R__0:format(green == 1 and "on" or "off");
|
||||||
tiles[5] = tiles[5].."^(pipeworks_lua_tube_port_off.png^[transformR90)"
|
tiles[6] = tiles[6]..tiles_on_off.R__0:format(green == 1 and "on" or "off");
|
||||||
tiles[6] = tiles[6].."^(pipeworks_lua_tube_port_off.png^[transformR270)"
|
-- Black
|
||||||
end
|
tiles[1] = tiles[1]..tiles_on_off.R180:format(black == 1 and "on" or "off");
|
||||||
if yellow == 1 then
|
tiles[2] = tiles[2]..tiles_on_off.R__0:format(black == 1 and "on" or "off");
|
||||||
tiles[3] = tiles[3].."^(pipeworks_lua_tube_port_on.png^[transformR180)"
|
tiles[3] = tiles[3]..tiles_on_off.R_90:format(black == 1 and "on" or "off");
|
||||||
tiles[4] = tiles[4].."^(pipeworks_lua_tube_port_on.png^[transformR180)"
|
tiles[4] = tiles[4]..tiles_on_off.R270:format(black == 1 and "on" or "off");
|
||||||
tiles[5] = tiles[5].."^(pipeworks_lua_tube_port_on.png^[transformR180)"
|
-- White
|
||||||
tiles[6] = tiles[6].."^(pipeworks_lua_tube_port_on.png^[transformR180)"
|
tiles[1] = tiles[1]..tiles_on_off.R__0:format(white == 1 and "on" or "off");
|
||||||
else
|
tiles[2] = tiles[2]..tiles_on_off.R180:format(white == 1 and "on" or "off");
|
||||||
tiles[3] = tiles[3].."^(pipeworks_lua_tube_port_off.png^[transformR180)"
|
tiles[3] = tiles[3]..tiles_on_off.R270:format(white == 1 and "on" or "off");
|
||||||
tiles[4] = tiles[4].."^(pipeworks_lua_tube_port_off.png^[transformR180)"
|
tiles[4] = tiles[4]..tiles_on_off.R_90:format(white == 1 and "on" or "off");
|
||||||
tiles[5] = tiles[5].."^(pipeworks_lua_tube_port_off.png^[transformR180)"
|
|
||||||
tiles[6] = tiles[6].."^(pipeworks_lua_tube_port_off.png^[transformR180)"
|
|
||||||
end
|
|
||||||
if green == 1 then
|
|
||||||
tiles[3] = tiles[3].."^pipeworks_lua_tube_port_on.png"
|
|
||||||
tiles[4] = tiles[4].."^pipeworks_lua_tube_port_on.png"
|
|
||||||
tiles[5] = tiles[5].."^pipeworks_lua_tube_port_on.png"
|
|
||||||
tiles[6] = tiles[6].."^pipeworks_lua_tube_port_on.png"
|
|
||||||
else
|
|
||||||
tiles[3] = tiles[3].."^pipeworks_lua_tube_port_off.png"
|
|
||||||
tiles[4] = tiles[4].."^pipeworks_lua_tube_port_off.png"
|
|
||||||
tiles[5] = tiles[5].."^pipeworks_lua_tube_port_off.png"
|
|
||||||
tiles[6] = tiles[6].."^pipeworks_lua_tube_port_off.png"
|
|
||||||
end
|
|
||||||
if black == 1 then
|
|
||||||
tiles[1] = tiles[1].."^(pipeworks_lua_tube_port_on.png^[transformR180)"
|
|
||||||
tiles[2] = tiles[2].."^pipeworks_lua_tube_port_on.png"
|
|
||||||
tiles[3] = tiles[3].."^(pipeworks_lua_tube_port_on.png^[transformR90)"
|
|
||||||
tiles[4] = tiles[4].."^(pipeworks_lua_tube_port_on.png^[transformR270)"
|
|
||||||
else
|
|
||||||
tiles[1] = tiles[1].."^(pipeworks_lua_tube_port_off.png^[transformR180)"
|
|
||||||
tiles[2] = tiles[2].."^pipeworks_lua_tube_port_off.png"
|
|
||||||
tiles[3] = tiles[3].."^(pipeworks_lua_tube_port_off.png^[transformR90)"
|
|
||||||
tiles[4] = tiles[4].."^(pipeworks_lua_tube_port_off.png^[transformR270)"
|
|
||||||
end
|
|
||||||
if white == 1 then
|
|
||||||
tiles[1] = tiles[1].."^pipeworks_lua_tube_port_on.png"
|
|
||||||
tiles[2] = tiles[2].."^(pipeworks_lua_tube_port_on.png^[transformR180)"
|
|
||||||
tiles[3] = tiles[3].."^(pipeworks_lua_tube_port_on.png^[transformR270)"
|
|
||||||
tiles[4] = tiles[4].."^(pipeworks_lua_tube_port_on.png^[transformR90)"
|
|
||||||
else
|
|
||||||
tiles[1] = tiles[1].."^pipeworks_lua_tube_port_off.png"
|
|
||||||
tiles[2] = tiles[2].."^(pipeworks_lua_tube_port_off.png^[transformR180)"
|
|
||||||
tiles[3] = tiles[3].."^(pipeworks_lua_tube_port_off.png^[transformR270)"
|
|
||||||
tiles[4] = tiles[4].."^(pipeworks_lua_tube_port_off.png^[transformR90)"
|
|
||||||
end
|
|
||||||
|
|
||||||
local groups = {snappy = 3, tube = 1, tubedevice = 1, overheat = 1}
|
local groups = {snappy = 3, tube = 1, tubedevice = 1, overheat = 1}
|
||||||
if red + blue + yellow + green + black + white ~= 0 then
|
if red + blue + yellow + green + black + white ~= 0 then
|
||||||
@ -933,6 +907,7 @@ for white = 0, 1 do
|
|||||||
description = "Lua controlled Tube",
|
description = "Lua controlled Tube",
|
||||||
drawtype = "nodebox",
|
drawtype = "nodebox",
|
||||||
tiles = tiles,
|
tiles = tiles,
|
||||||
|
use_texture_alpha = texture_alpha_mode,
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
is_ground_content = false,
|
is_ground_content = false,
|
||||||
groups = groups,
|
groups = groups,
|
||||||
@ -1039,6 +1014,7 @@ tiles_burnt[4] = tiles_burnt[4].."^(pipeworks_lua_tube_port_burnt.png^[transform
|
|||||||
minetest.register_node(BASENAME .. "_burnt", {
|
minetest.register_node(BASENAME .. "_burnt", {
|
||||||
drawtype = "nodebox",
|
drawtype = "nodebox",
|
||||||
tiles = tiles_burnt,
|
tiles = tiles_burnt,
|
||||||
|
use_texture_alpha = texture_alpha_mode,
|
||||||
is_burnt = true,
|
is_burnt = true,
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
is_ground_content = false,
|
is_ground_content = false,
|
||||||
|
@ -26,6 +26,11 @@ local texture_mt = {
|
|||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|
||||||
|
-- This will remove any semi-transparent pixels
|
||||||
|
-- because that is still buggy in Minetest, force this as default
|
||||||
|
local texture_alpha_mode = minetest.features.use_texture_alpha_string_modes
|
||||||
|
and "clip" or true
|
||||||
|
|
||||||
local register_one_tube = function(name, tname, dropname, desc, plain, noctrs, ends, short, inv, special, connects, style)
|
local register_one_tube = function(name, tname, dropname, desc, plain, noctrs, ends, short, inv, special, connects, style)
|
||||||
noctrs = noctrs or default_noctrs
|
noctrs = noctrs or default_noctrs
|
||||||
setmetatable(noctrs, texture_mt)
|
setmetatable(noctrs, texture_mt)
|
||||||
@ -82,6 +87,7 @@ local register_one_tube = function(name, tname, dropname, desc, plain, noctrs, e
|
|||||||
description = tubedesc,
|
description = tubedesc,
|
||||||
drawtype = "nodebox",
|
drawtype = "nodebox",
|
||||||
tiles = outimgs,
|
tiles = outimgs,
|
||||||
|
use_texture_alpha = texture_alpha_mode,
|
||||||
sunlight_propagates = true,
|
sunlight_propagates = true,
|
||||||
inventory_image = iimg,
|
inventory_image = iimg,
|
||||||
wield_image = iimg,
|
wield_image = iimg,
|
||||||
|
Loading…
Reference in New Issue
Block a user