From 5a79a60e0f592e34433139c16bb02aca65e38d63 Mon Sep 17 00:00:00 2001 From: Tim Date: Thu, 29 Jan 2015 22:36:16 +0100 Subject: [PATCH] use the default tube textures as fallback for any missing textures during tube registration --- routing_tubes.lua | 11 +++++++++++ signal_tubes.lua | 8 ++++---- tubes.lua | 39 +++++++++++++++++---------------------- 3 files changed, 32 insertions(+), 26 deletions(-) diff --git a/routing_tubes.lua b/routing_tubes.lua index acd93af..3533bad 100644 --- a/routing_tubes.lua +++ b/routing_tubes.lua @@ -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 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"} diff --git a/signal_tubes.lua b/signal_tubes.lua index cf93876..aff486f 100644 --- a/signal_tubes.lua +++ b/signal_tubes.lua @@ -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"} local detector_inv_texture = "pipeworks_detector_tube_inv.png" 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.end_textures, pipeworks.short_texture, detector_inv_texture, + pipeworks.register_tube("pipeworks:detector_tube_on", "Detecting Pneumatic Tube Segment on (you hacker you)", + detector_plain_textures, nil, nil, nil, detector_inv_texture, {tube = {can_go = function(pos, node, velocity, stack) local meta = minetest.get_meta(pos) 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) end }) - pipeworks.register_tube("pipeworks:detector_tube_off", "Detecting Pneumatic Tube Segment", detector_plain_textures, pipeworks.noctr_textures, - pipeworks.end_textures, pipeworks.short_texture, detector_inv_texture, + pipeworks.register_tube("pipeworks:detector_tube_off", "Detecting Pneumatic Tube Segment", + detector_plain_textures, nil, nil, nil, detector_inv_texture, {tube = {can_go = function(pos, node, velocity, stack) local node = minetest.get_node(pos) local name = node.name diff --git a/tubes.lua b/tubes.lua index 3aa4a0e..6ef4fee 100644 --- a/tubes.lua +++ b/tubes.lua @@ -10,7 +10,24 @@ local REGISTER_COMPATIBILITY = true 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) + 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 outsel = {} local outimgs = {} @@ -215,25 +232,3 @@ if REGISTER_COMPATIBILITY then 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" } - }, -})