1
0
mirror of https://github.com/mt-mods/pipeworks.git synced 2024-12-26 10:50:27 +01:00

use the default tube textures as fallback for any missing textures during tube registration

This commit is contained in:
Tim 2015-01-29 22:36:16 +01:00
parent a98af7bf15
commit 5a79a60e0f
3 changed files with 32 additions and 26 deletions

View File

@ -1,3 +1,14 @@
-- the default tube and default textures
pipeworks.register_tube("pipeworks:tube", "Pneumatic tube segment")
minetest.register_craft( {
output = "pipeworks:tube_1 6",
recipe = {
{ "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting" },
{ "", "", "" },
{ "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting" }
},
})
if pipeworks.enable_accelerator_tube then if pipeworks.enable_accelerator_tube then
local accelerator_noctr_textures = {"pipeworks_accelerator_tube_noctr.png", "pipeworks_accelerator_tube_noctr.png", "pipeworks_accelerator_tube_noctr.png", local accelerator_noctr_textures = {"pipeworks_accelerator_tube_noctr.png", "pipeworks_accelerator_tube_noctr.png", "pipeworks_accelerator_tube_noctr.png",
"pipeworks_accelerator_tube_noctr.png", "pipeworks_accelerator_tube_noctr.png", "pipeworks_accelerator_tube_noctr.png"} "pipeworks_accelerator_tube_noctr.png", "pipeworks_accelerator_tube_noctr.png", "pipeworks_accelerator_tube_noctr.png"}

View File

@ -3,8 +3,8 @@ if pipeworks.enable_detector_tube then
"pipeworks_detector_tube_plain.png", "pipeworks_detector_tube_plain.png", "pipeworks_detector_tube_plain.png"} "pipeworks_detector_tube_plain.png", "pipeworks_detector_tube_plain.png", "pipeworks_detector_tube_plain.png"}
local detector_inv_texture = "pipeworks_detector_tube_inv.png" local detector_inv_texture = "pipeworks_detector_tube_inv.png"
local detector_tube_step = 2 * tonumber(minetest.setting_get("dedicated_server_step")) local detector_tube_step = 2 * tonumber(minetest.setting_get("dedicated_server_step"))
pipeworks.register_tube("pipeworks:detector_tube_on", "Detecting Pneumatic Tube Segment on (you hacker you)", detector_plain_textures, pipeworks.noctr_textures, pipeworks.register_tube("pipeworks:detector_tube_on", "Detecting Pneumatic Tube Segment on (you hacker you)",
pipeworks.end_textures, pipeworks.short_texture, detector_inv_texture, detector_plain_textures, nil, nil, nil, detector_inv_texture,
{tube = {can_go = function(pos, node, velocity, stack) {tube = {can_go = function(pos, node, velocity, stack)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local name = minetest.get_node(pos).name local name = minetest.get_node(pos).name
@ -39,8 +39,8 @@ if pipeworks.enable_detector_tube then
minetest.after(detector_tube_step, minetest.registered_nodes[name].item_exit, saved_pos) minetest.after(detector_tube_step, minetest.registered_nodes[name].item_exit, saved_pos)
end end
}) })
pipeworks.register_tube("pipeworks:detector_tube_off", "Detecting Pneumatic Tube Segment", detector_plain_textures, pipeworks.noctr_textures, pipeworks.register_tube("pipeworks:detector_tube_off", "Detecting Pneumatic Tube Segment",
pipeworks.end_textures, pipeworks.short_texture, detector_inv_texture, detector_plain_textures, nil, nil, nil, detector_inv_texture,
{tube = {can_go = function(pos, node, velocity, stack) {tube = {can_go = function(pos, node, velocity, stack)
local node = minetest.get_node(pos) local node = minetest.get_node(pos)
local name = node.name local name = node.name

View File

@ -10,7 +10,24 @@ local REGISTER_COMPATIBILITY = true
local vti = {4, 3, 2, 1, 6, 5} local vti = {4, 3, 2, 1, 6, 5}
local default_textures = {
noctrs = { "pipeworks_tube_noctr.png", "pipeworks_tube_noctr.png", "pipeworks_tube_noctr.png",
"pipeworks_tube_noctr.png", "pipeworks_tube_noctr.png", "pipeworks_tube_noctr.png"},
plain = { "pipeworks_tube_plain.png", "pipeworks_tube_plain.png", "pipeworks_tube_plain.png",
"pipeworks_tube_plain.png", "pipeworks_tube_plain.png", "pipeworks_tube_plain.png"},
ends = { "pipeworks_tube_end.png", "pipeworks_tube_end.png", "pipeworks_tube_end.png",
"pipeworks_tube_end.png", "pipeworks_tube_end.png", "pipeworks_tube_end.png"},
short = "pipeworks_tube_short.png",
inv = "pipeworks_tube_inv.png",
}
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_textures.noctrs
plain = plain or default_textures.plain
ends = ends or default_textures.ends
short = short or default_textures.short
inv = inv or default_textures.inv
local outboxes = {} local outboxes = {}
local outsel = {} local outsel = {}
local outimgs = {} local outimgs = {}
@ -215,25 +232,3 @@ if REGISTER_COMPATIBILITY then
end end
}) })
end end
-- the default tube and default textures
pipeworks.noctr_textures = {"pipeworks_tube_noctr.png", "pipeworks_tube_noctr.png", "pipeworks_tube_noctr.png",
"pipeworks_tube_noctr.png", "pipeworks_tube_noctr.png", "pipeworks_tube_noctr.png"}
pipeworks.plain_textures = {"pipeworks_tube_plain.png", "pipeworks_tube_plain.png", "pipeworks_tube_plain.png",
"pipeworks_tube_plain.png", "pipeworks_tube_plain.png", "pipeworks_tube_plain.png"}
pipeworks.end_textures = {"pipeworks_tube_end.png", "pipeworks_tube_end.png", "pipeworks_tube_end.png",
"pipeworks_tube_end.png", "pipeworks_tube_end.png", "pipeworks_tube_end.png"}
pipeworks.short_texture = "pipeworks_tube_short.png"
pipeworks.inv_texture = "pipeworks_tube_inv.png"
pipeworks.register_tube("pipeworks:tube", "Pneumatic tube segment", pipeworks.plain_textures, pipeworks.noctr_textures, pipeworks.end_textures, pipeworks.short_texture, pipeworks.inv_texture)
minetest.register_craft( {
output = "pipeworks:tube_1 6",
recipe = {
{ "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting" },
{ "", "", "" },
{ "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting" }
},
})