V1.04, Source maintenance, minor issues fixed, Unifieddyes support for Color Lamp added

This commit is contained in:
Joachim Stolberg 2018-03-31 17:09:16 +02:00
parent 53c4074450
commit a0de294c75
34 changed files with 272 additions and 102 deletions

@ -1,4 +1,4 @@
# TechPack V1.03
# TechPack V1.04
TechPack, a Mining, Crafting, & Farming Modpack for Minetest.
@ -65,8 +65,9 @@ Textures: CC BY-SA 3.0
### Dependencies
default, doors.
Tubelib Color Lamps optional: unifieddyes
SmartLine Display optional: display_lib, font_lib
SmartLine Controller optional: mail,
SmartLine Controller optional: mail
Gravelsieve optional: moreores, hopper, pipeworks
@ -75,3 +76,4 @@ Gravelsieve optional: moreores, hopper, pipeworks
- 2018-03-24 V1.01 * Support for Ethereal added
- 2018-03-27 V1.02 * Timer improvements for unloaded areas
- 2018-03-29 V1.03 * Area protected chest added to tubelib_addons1
- 2018-03-31 V1.04 * Maintenance, minor issues, Unifieddyes support for Color Lamp

@ -813,7 +813,7 @@ minetest.register_node("smartline:controller", {
after_place_node = function(pos, placer)
local meta = minetest.get_meta(pos)
local number = tubelib.add_node(pos, "smartline:controller")
local number = tubelib.add_node(pos)
local fs_data = {}
meta:set_string("fs_data", minetest.serialize(fs_data))
meta:set_string("owner", placer:get_player_name())

@ -51,7 +51,7 @@ minetest.register_node("smartline:display", {
},
after_place_node = function(pos, placer)
local number = tubelib.add_node(pos, "smartline:display")
local number = tubelib.add_node(pos)
local meta = minetest.get_meta(pos)
meta:set_string("number", number)
meta:set_string("text", " \n \nMinetest\nSmartLine Tools\n \nDisplay\nNumber: "..number)

@ -121,7 +121,7 @@ minetest.register_node("smartline:playerdetector", {
},
},
after_place_node = function(pos, placer)
local number = tubelib.add_node(pos, "smartline:playerdetector")
local number = tubelib.add_node(pos)
local meta = minetest.get_meta(pos)
meta:set_string("number", number)
local numbers = meta:get_string("numbers") or ""

@ -45,7 +45,7 @@ minetest.register_node("smartline:repeater", {
after_place_node = function(pos, placer)
local meta = minetest.get_meta(pos)
local own_number = tubelib.add_node(pos, "smartline:repeater")
local own_number = tubelib.add_node(pos)
meta:set_string("own_number", own_number)
meta:set_string("formspec", formspec(meta))
meta:set_string("infotext", "SmartLine Repeater "..own_number..": not connected")

@ -69,7 +69,7 @@ local function stop_the_sequencer(pos)
local meta = minetest.get_meta(pos)
local number = meta:get_string("number")
meta:set_int("running", STOP_STATE)
meta:set_string("infotext", "Tubelib Sequencer "..number..": stopped")
meta:set_string("infotext", "SmartLine Sequencer "..number..": stopped")
local rules = minetest.deserialize(meta:get_string("rules"))
local endless = meta:get_int("endless") or 0
meta:set_string("formspec", formspec(tubelib.STOPPED, rules, endless))
@ -119,7 +119,7 @@ local function check_rules(pos, elapsed)
if index == 1 and offs < 1 then
offs = 2
end
meta:set_string("infotext", "Tubelib Sequencer "..number..": running ("..index.."/"..NUM_SLOTS..")")
meta:set_string("infotext", "SmartLine Sequencer "..number..": running ("..index.."/"..NUM_SLOTS..")")
meta:set_int("index", index)
if offs > 0 then
minetest.after(0, restart_timer, pos, offs)
@ -222,7 +222,7 @@ minetest.register_node("smartline:sequencer", {
},
after_place_node = function(pos, placer)
local meta = minetest.get_meta(pos)
local number = tubelib.add_node(pos, "smartline:sequencer")
local number = tubelib.add_node(pos)
local rules = {}
for idx = 1,NUM_SLOTS do
rules[idx] = {offs = "", num = "", act = 1}
@ -234,6 +234,7 @@ minetest.register_node("smartline:sequencer", {
meta:set_int("endless", 0)
meta:get_int("running", STOP_STATE)
meta:set_string("formspec", formspec(tubelib.STOPPED, rules, 0))
meta:set_string("infotext", "SmartLine Sequencer "..number)
end,
on_receive_fields = on_receive_fields,

@ -44,7 +44,7 @@ minetest.register_node("smartline:signaltower", {
},
after_place_node = function(pos, placer)
local number = tubelib.add_node(pos, "smartline:signaltower")
local number = tubelib.add_node(pos)
local meta = minetest.get_meta(pos)
meta:set_string("state", "off")
meta:set_string("infotext", "SmartLine Signal Tower "..number)

@ -152,7 +152,7 @@ minetest.register_node("smartline:timer", {
local numbers = {"0000","","","","",""}
local actions = {"","","","","",""}
local done = {false,false,false,false,false,false}
local own_num = tubelib.add_node(pos, "smartline:timer")
local own_num = tubelib.add_node(pos)
meta:set_string("own_num", own_num)
meta:set_string("placer_name", placer:get_player_name())
meta:set_string("events", minetest.serialize(events))

@ -126,6 +126,7 @@ Parameters:
The function is used to register the nodes position for the communication node
number and to update the tube surrounding.
`pos` the node position, `name` is the node name.
If 'name' is nil, the tube surrounding is not updated, which should be used for nodes without tube connection.
@ -197,18 +198,12 @@ Because several nodes could be addressed, the function don't return any response
```LUA
tubelib.send_request(number, placer_name, clicker_name, topic, payload)
tubelib.send_request(number, topic, payload)
```
In contrast to `send_message` this functions send a message to exactly one node
referenced by `number` and returns the node response.
The message is based on the topic string (e.g. "state") and
topic related payload.
The placer and clicker names are needed to check the protection rights.
`placer_name` is the name of the player, who places the node.
`clicker_name` is the name of the player, who uses the node.
`placer_name` of sending and receiving nodes have to be the same.
If every player should be able to send a message, use nil for clicker_name.
## 4. Code Snippets
@ -286,3 +281,4 @@ This file has further helper functions and is recommended for deeper study.
2017-10-02 First draft
2017-10-29 Commands start/stop replaced by on/off
2018-03-31 Corrections for 'send_request' and 'add_node'

@ -49,6 +49,7 @@ minetest.register_node("tubelib:blackhole", {
tubelib.remove_node(pos) -- <<=== tubelib
end,
on_rotate = screwdriver.disallow,
paramtype = "light",
sunlight_propagates = true,
paramtype2 = "facedir",

@ -70,7 +70,7 @@ minetest.register_node("tubelib:button", {
after_place_node = function(pos, placer)
local meta = minetest.get_meta(pos)
local own_num = tubelib.add_node(pos, "tubelib:button")
local own_num = tubelib.add_node(pos)
meta:set_string("own_num", own_num)
meta:set_string("formspec", "size[5,6]"..
"dropdown[0.2,0;3;type;switch,button 2s,button 4s,button 8s,button 16s;1]"..
@ -123,6 +123,7 @@ minetest.register_node("tubelib:button", {
end
end,
on_rotate = screwdriver.disallow,
paramtype = "light",
sunlight_propagates = true,
paramtype2 = "facedir",
@ -153,6 +154,7 @@ minetest.register_node("tubelib:button_active", {
end,
on_timer = switch_off,
on_rotate = screwdriver.disallow,
paramtype = "light",
sunlight_propagates = true,

@ -161,15 +161,19 @@ end
-- Add node to the tubelib lists and update the tube surrounding.
-- Function determines and returns the node position number,
-- needed for message communication.
-- If 'name' is nil, the tube surrounding is not updated,
-- which should be used for nodes without tube connection.
function tubelib.add_node(pos, name)
-- store position
local number = get_number(pos)
Number2Pos[number] = {
pos = pos,
name = name,
}
-- update surrounding tubes
tubelib.update_tubes(pos)
if name then
Number2Pos[number] = {
pos = pos,
name = name,
}
-- update surrounding tubes
tubelib.update_tubes(pos)
end
return number
end

@ -360,6 +360,7 @@ minetest.register_node("tubelib:distributor", {
allow_metadata_inventory_move = allow_metadata_inventory_move,
on_timer = keep_running,
on_rotate = screwdriver.disallow,
paramtype = "light",
sunlight_propagates = true,
@ -398,6 +399,7 @@ minetest.register_node("tubelib:distributor_active", {
allow_metadata_inventory_move = allow_metadata_inventory_move,
on_timer = keep_running,
on_rotate = screwdriver.disallow,
paramtype = "light",
sunlight_propagates = true,

@ -35,7 +35,7 @@ minetest.register_node("tubelib:lamp", {
},
after_place_node = function(pos, placer)
local number = tubelib.add_node(pos, "tubelib:lamp") -- <<=== tubelib
local number = tubelib.add_node(pos) -- <<=== tubelib
local meta = minetest.get_meta(pos)
meta:set_string("infotext", "Tubelib Lamp "..number)
end,

@ -136,6 +136,7 @@ minetest.register_node("tubelib:pusher", {
end,
on_timer = keep_running,
on_rotate = screwdriver.disallow,
paramtype = "light",
sunlight_propagates = true,
@ -201,6 +202,7 @@ minetest.register_node("tubelib:pusher_active", {
end,
on_timer = keep_running,
on_rotate = screwdriver.disallow,
paramtype = "light",
sunlight_propagates = true,

@ -17,19 +17,19 @@
local MAX_TUBE_LENGTH = 100
local TubeTypes = {
0,0,0,0,0,0,1,3,1,3, -- 01-10
4,5,3,1,3,1,4,5,1,3, -- 11-20
1,3,4,5,3,1,3,1,4,5, -- 21-30
2,2,2,2,0,2,2,2,5,2, -- 31-40
5,0, -- 40-41
0,0,0,0,0,0,1,3,1,3, -- 01-10
4,5,3,1,3,1,4,5,1,3, -- 11-20
1,3,4,5,3,1,3,1,4,5, -- 21-30
2,2,2,2,0,2,2,2,5,2, -- 31-40
5,0, -- 40-41
}
local TubeFacedir = {
0,0,0,0,0,0,0,2,0,1, -- 01-10
2,2,2,1,3,1,3,3,0,3, -- 11-20
0,0,0,0,1,1,0,1,1,1, -- 21-30
0,0,0,0,0,0,0,0,0,0, -- 31-40
0,0, -- 40-41
0,0,0,0,0,0,0,2,0,1, -- 01-10
2,2,2,1,3,1,3,3,0,3, -- 11-20
0,0,0,0,1,1,0,1,1,1, -- 21-30
0,0,0,0,0,0,0,0,0,0, -- 31-40
0,0, -- 40-41
}
tubelib.knownNodes = {
@ -78,14 +78,14 @@ local function remote_node(pos, npos)
local dest_pos2 = minetest.string_to_pos(minetest.get_meta(npos):get_string("dest_pos2"))
if dest_pos2 == nil then
local facedir = minetest.get_meta(npos):get_int("facedir")
return pos, facedir -- node connected with itself
return pos, facedir -- node connected with itself
else
local facedir2 = minetest.get_meta(npos):get_int("facedir2")
return dest_pos2, facedir2 -- one tube connection
return dest_pos2, facedir2 -- one tube connection
end
else
local facedir = minetest.get_meta(npos):get_int("facedir")
return dest_pos, facedir -- multi tube connection
return dest_pos, facedir -- multi tube connection
end
end
@ -252,7 +252,7 @@ local function update_head_tubes(pos)
local cnt1, peer1, dest1 = walk_to_peer(pos, pos1)
local cnt2, peer2, dest2 = walk_to_peer(pos, pos2)
if cnt1 == 0 and cnt2 == 0 then -- first tube node placed?
if cnt1 == 0 and cnt2 == 0 then -- first tube node placed?
-- we have to store both dest positions
minetest.get_meta(peer1):set_string("dest_pos", minetest.pos_to_string(dest1))
minetest.get_meta(peer1):set_int("facedir", dir_to_facedir(peer1, dest1))
@ -277,7 +277,7 @@ local function update_head_tubes(pos)
return 0
end
-- Update all tubes arround the currently placed tube
-- Update all tubes arround the currently placed tube
local function update_surrounding_tubes(pos)
update_tube({x=pos.x , y=pos.y , z=pos.z+1})
update_tube({x=pos.x+1, y=pos.y , z=pos.z })
@ -314,14 +314,14 @@ function tubelib.update_tubes(pos)
end
local DefNodeboxes = {
-- x1 y1 z1 x2 y2 z2
{ -1/4, -1/4, -1/4, 1/4, 1/4, 1/4 },
{ -1/4, -1/4, -1/4, 1/4, 1/4, 1/4 },
-- x1 y1 z1 x2 y2 z2
{ -1/4, -1/4, -1/4, 1/4, 1/4, 1/4 },
{ -1/4, -1/4, -1/4, 1/4, 1/4, 1/4 },
}
local DirCorrections = {
{3, 6}, {2, 5}, -- standard tubes
{3, 1}, {3, 2}, {3, 5}, -- knees from front to..
{3, 6}, {2, 5}, -- standard tubes
{3, 1}, {3, 2}, {3, 5}, -- knees from front to..
}
local SelectBoxes = {
@ -350,37 +350,37 @@ local TilesData = {
"tubelib_tube.png^[transformR90",
"tubelib_tube.png^[transformR90",
},
{
"tubelib_knee.png^[transformR270",
"tubelib_knee.png^[transformR180",
"tubelib_knee2.png^[transformR270",
"tubelib_hole2.png^[transformR90",
"tubelib_knee2.png^[transformR90",
"tubelib_hole2.png^[transformR270",
},
{
"tubelib_knee2.png",
"tubelib_hole2.png^[transformR180",
"tubelib_knee.png^[transformR270",
"tubelib_knee.png",
"tubelib_knee2.png",
"tubelib_hole2.png",
},
{
"tubelib_hole2.png",
"tubelib_knee2.png^[transformR180",
"tubelib_knee.png^[transformR180",
"tubelib_knee.png^[transformR90",
"tubelib_knee2.png^[transformR180",
"tubelib_hole2.png^[transformR180",
},
{
"tubelib_knee.png^[transformR270",
"tubelib_knee.png^[transformR180",
"tubelib_knee2.png^[transformR270",
"tubelib_hole2.png^[transformR90",
"tubelib_knee2.png^[transformR90",
"tubelib_hole2.png^[transformR270",
},
{
"tubelib_knee2.png",
"tubelib_hole2.png^[transformR180",
"tubelib_knee.png^[transformR270",
"tubelib_knee.png",
"tubelib_knee2.png",
"tubelib_hole2.png",
},
{
"tubelib_hole2.png",
"tubelib_knee2.png^[transformR180",
"tubelib_knee.png^[transformR180",
"tubelib_knee.png^[transformR90",
"tubelib_knee2.png^[transformR180",
"tubelib_hole2.png^[transformR180",
},
}
for idx,pos in ipairs(DirCorrections) do
node_box_data = table.copy(DefNodeboxes)
node_box_data[1][pos[1]] = node_box_data[1][pos[1]] * 2
node_box_data[2][pos[2]] = node_box_data[2][pos[2]] * 2
node_box_data = table.copy(DefNodeboxes)
node_box_data[1][pos[1]] = node_box_data[1][pos[1]] * 2
node_box_data[2][pos[2]] = node_box_data[2][pos[2]] * 2
tiles_data = TilesData[idx]
@ -389,14 +389,14 @@ for idx,pos in ipairs(DirCorrections) do
else
hidden = 1
end
minetest.register_node("tubelib:tube"..idx, {
description = "Tubelib Tube",
tiles = tiles_data,
drawtype = "nodebox",
node_box = {
type = "fixed",
fixed = node_box_data,
},
minetest.register_node("tubelib:tube"..idx, {
description = "Tubelib Tube",
tiles = tiles_data,
drawtype = "nodebox",
node_box = {
type = "fixed",
fixed = node_box_data,
},
selection_box = {
type = "fixed",
fixed = SelectBoxes[idx],
@ -417,10 +417,12 @@ for idx,pos in ipairs(DirCorrections) do
after_dig_node = function(pos, oldnode, oldmetadata, digger)
after_tube_removed(pos, oldnode)
end,
paramtype2 = "facedir",
paramtype = "light",
sunlight_propagates = true,
is_ground_content = false,
on_rotate = screwdriver.disallow,
paramtype2 = "facedir",
paramtype = "light",
sunlight_propagates = true,
is_ground_content = false,
groups = {choppy=2, cracky=3, stone=1, not_in_creative_inventory=hidden},
drop = "tubelib:tube1",
sounds = default.node_sound_wood_defaults(),

@ -235,6 +235,7 @@ minetest.register_node("tubelib_addons1:fermenter", {
end
end,
on_rotate = screwdriver.disallow,
on_timer = keep_running,
on_receive_fields = on_receive_fields,
allow_metadata_inventory_put = allow_metadata_inventory_put,

@ -91,24 +91,27 @@ minetest.register_node("tubelib_addons1:funnel", {
end,
after_place_node = function(pos, placer)
tubelib.add_node(pos, "tubelib_addons1:funnel")
local meta = minetest.get_meta(pos)
meta:set_string("formspec", formspec())
minetest.get_node_timer(pos):start(1)
end,
on_timer = scan_for_objects,
on_rotate = screwdriver.disallow,
can_dig = function(pos,player)
if minetest.is_protected(pos, player:get_player_name()) then
return false
end
local meta = minetest.get_meta(pos);
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
return inv:is_empty("main")
end,
on_dig = function(pos, node, puncher, pointed_thing)
minetest.node_dig(pos, node, puncher, pointed_thing)
tubelib.remove_node(pos)
end,
allow_metadata_inventory_put = allow_metadata_inventory_put,

@ -203,6 +203,7 @@ minetest.register_node("tubelib_addons1:grinder", {
end
end,
on_rotate = screwdriver.disallow,
on_timer = keep_running,
on_receive_fields = on_receive_fields,
allow_metadata_inventory_put = allow_metadata_inventory_put,
@ -240,6 +241,7 @@ minetest.register_node("tubelib_addons1:grinder_active", {
"tubelib_front.png",
},
on_rotate = screwdriver.disallow,
on_timer = keep_running,
on_receive_fields = on_receive_fields,
allow_metadata_inventory_put = allow_metadata_inventory_put,

@ -369,6 +369,7 @@ minetest.register_node("tubelib_addons1:harvester_base", {
end
end,
on_rotate = screwdriver.disallow,
on_receive_fields = on_receive_fields,
on_timer = keep_running,
allow_metadata_inventory_put = allow_metadata_inventory_put,
@ -389,6 +390,7 @@ minetest.register_node("tubelib_addons1:harvester_base_active", {
'tubelib_addons1_harvester.png',
},
on_rotate = screwdriver.disallow,
on_receive_fields = on_receive_fields,
on_timer = keep_running,
allow_metadata_inventory_put = allow_metadata_inventory_put,

@ -136,6 +136,7 @@ minetest.register_node("tubelib_addons1:pusher_fast", {
end,
on_timer = keep_running,
on_rotate = screwdriver.disallow,
paramtype = "light",
sunlight_propagates = true,
@ -201,6 +202,7 @@ minetest.register_node("tubelib_addons1:pusher_fast_active", {
end,
on_timer = keep_running,
on_rotate = screwdriver.disallow,
paramtype = "light",
sunlight_propagates = true,

@ -320,6 +320,7 @@ minetest.register_node("tubelib_addons1:quarry", {
end,
on_receive_fields = on_receive_fields,
on_rotate = screwdriver.disallow,
on_dig = function(pos, node, puncher, pointed_thing)
if minetest.is_protected(pos, puncher:get_player_name()) then
@ -370,6 +371,7 @@ minetest.register_node("tubelib_addons1:quarry_active", {
on_receive_fields = on_receive_fields,
on_timer = keep_running,
on_rotate = screwdriver.disallow,
allow_metadata_inventory_put = allow_metadata_inventory_put,
allow_metadata_inventory_take = allow_metadata_inventory_take,

@ -230,6 +230,7 @@ minetest.register_node("tubelib_addons1:reformer", {
end
end,
on_rotate = screwdriver.disallow,
on_timer = keep_running,
on_receive_fields = on_receive_fields,
allow_metadata_inventory_put = allow_metadata_inventory_put,

@ -79,7 +79,7 @@ minetest.register_node("tubelib_addons2:accesscontrol", {
},
after_place_node = function(pos, placer)
local number = tubelib.add_node(pos, "tubelib_addons2:accesscontrol")
local number = tubelib.add_node(pos)
local meta = minetest.get_meta(pos)
meta:set_string("number", number)
local numbers = meta:get_string("numbers") or ""

@ -3,7 +3,7 @@
Tubelib Addons 2
================
Copyright (C) 2017 Joachim Stolberg
Copyright (C) 2017-2018 Joachim Stolberg
LGPLv2.1+
See LICENSE.txt for more information
@ -23,6 +23,7 @@ local function switch_node(pos, num, player)
node.name = "tubelib_addons2:lamp"..num
minetest.swap_node(pos, node)
local number = meta:get_int("number")
number = string.format("%.04u", number)
meta:set_string("infotext", "Tubelib Color Lamp "..number)
if num ~= "" then
meta:set_int("color", num)
@ -32,12 +33,10 @@ end
minetest.register_node("tubelib_addons2:lamp", {
description = "Tubelib Color Lamp",
tiles = {
"tubelib_addons2_lamp.png^[colorize:#FFFFFF:120",
},
tiles = {"tubelib_addons2_lamp.png^[colorize:#000000:100"},
after_place_node = function(pos, placer)
local number = tubelib.add_node(pos, "tubelib_addons2:lamp")
local number = tubelib.add_node(pos)
local meta = minetest.get_meta(pos)
meta:set_int("number", number)
switch_node(pos, "", placer)
@ -100,7 +99,6 @@ for idx,color in ipairs(tColors) do
description = "Tubelib Color Lamp",
tiles = {
"tubelib_addons2_lamp.png^[colorize:"..color..":120",
--"tubelib_lamp.png^[colorize:"..color,
},
on_receive_fields = function(pos, formname, fields, player)
@ -119,7 +117,8 @@ for idx,color in ipairs(tColors) do
paramtype = 'light',
light_source = LIGHT_MAX,
groups = {crumbly=0, not_in_creative_inventory=1},
groups = {choppy=2, cracky=1, not_in_creative_inventory=1},
is_ground_content = false,
drop = "tubelib_addons2:lamp"
})
end

@ -0,0 +1,140 @@
--[[
Tubelib Addons 2
================
Copyright (C) 2017-2018 Joachim Stolberg
LGPLv2.1+
See LICENSE.txt for more information
colorlamp_ud.lua which requires the mod unifieddyes:
]]--
local function switch_on(pos, node, player)
if player == nil or not minetest.is_protected(pos, player:get_player_name()) then
node.name = "tubelib_addons2:lamp_on"
minetest.swap_node(pos, node)
end
end
local function switch_off(pos, node, player)
if player == nil or not minetest.is_protected(pos, player:get_player_name()) then
node.name = "tubelib_addons2:lamp_off"
minetest.swap_node(pos, node)
end
end
minetest.register_node("tubelib_addons2:lamp_off", {
description = "Tubelib Color Lamp",
tiles = {"tubelib_addons2_lamp.png^[colorize:#000000:100"},
after_place_node = function(pos, placer, itemstack, pointed_thing)
local number = tubelib.add_node(pos)
local meta = minetest.get_meta(pos)
meta:set_string("infotext", "Tubelib Color Lamp "..number)
unifieddyes.recolor_on_place(pos, placer, itemstack, pointed_thing)
end,
on_rightclick = switch_on,
after_dig_node = function(pos, oldnode, oldmetadata, digger)
tubelib.remove_node(pos)
unifieddyes.after_dig_node(pos, oldnode, oldmetadata, digger)
end,
on_construct = unifieddyes.on_construct,
paramtype = "light",
paramtype2 = "color",
palette = "unifieddyes_palette_extended.png",
place_param2 = 241,
sunlight_propagates = true,
sounds = default.node_sound_stone_defaults(),
groups = {choppy=2, cracky=1, ud_param2_colorable = 1},
is_ground_content = false,
})
tubelib.register_node("tubelib_addons2:lamp", {}, {
on_recv_message = function(pos, topic, payload)
if topic == "on" then
local node = minetest.get_node(pos)
switch_on(pos, node, nil)
elseif topic == "off" then
local node = minetest.get_node(pos)
switch_off(pos, node, nil)
end
end,
})
minetest.register_craft({
output = "tubelib_addons2:lamp 2",
recipe = {
{"wool:green", "wool:red", "wool:blue"},
{"tubelib:wlanchip", "default:coal_lump", "tubelib:wlanchip"},
{"group:wood", "", "group:wood"},
},
})
for idx=1,12 do
minetest.register_node("tubelib_addons2:lamp"..idx, {
description = "Tubelib Color Lamp "..idx,
tiles = {"tubelib_addons2_lamp.png"},
paramtype = 'light',
groups = {choppy=2, cracky=1, not_in_creative_inventory=1},
is_ground_content = false,
drop = "tubelib_addons2:lamp_off"
})
end
minetest.register_node("tubelib_addons2:lamp_on", {
description = "Tubelib Color Lamp",
tiles = {"tubelib_addons2_lamp.png"},
on_rightclick = switch_off,
paramtype = "light",
paramtype2 = "color",
palette = "unifieddyes_palette_extended.png",
groups = {choppy=2, cracky=1, not_in_creative_inventory=1, ud_param2_colorable = 1},
on_construct = unifieddyes.on_construct,
after_place_node = unifieddyes.recolor_on_place,
after_dig_node = unifieddyes.after_dig_node,
light_source = LIGHT_MAX,
is_ground_content = false,
drop = "tubelib_addons2:lamp_off"
})
minetest.register_lbm({
label = "[Tubelib] Color Lamp update",
name = "tubelib_addons2:update",
nodenames = {
"tubelib_addons2:lamp",
"tubelib_addons2:lamp1", "tubelib_addons2:lamp2", "tubelib_addons2:lamp3",
"tubelib_addons2:lamp4", "tubelib_addons2:lamp5", "tubelib_addons2:lamp6",
"tubelib_addons2:lamp7", "tubelib_addons2:lamp8", "tubelib_addons2:lamp9",
"tubelib_addons2:lamp10", "tubelib_addons2:lamp11", "tubelib_addons2:lamp12",
},
run_at_every_load = true,
action = function(pos, node)
local color = {112, 108, 104, 100, 96, 115, 240, 255, 80, 120, 99, 20}
local meta = minetest.get_meta(pos)
local num = meta:get_int("color")
if node.name == "tubelib_addons2:lamp" then
node.param2 = color[tonumber(num)]
node.name = "tubelib_addons2:lamp_off"
else
node.param2 = color[tonumber(num)]
node.name = "tubelib_addons2:lamp_on"
end
minetest.swap_node(pos, node)
local number = meta:get_int("number") or 0
number = string.format("%.04u", number)
meta:set_string("infotext", "Tubelib Color Lamp "..number)
end
})

@ -1,3 +1,4 @@
default
tubelib
mesecons?
mesecons?
unifieddyes?

@ -52,7 +52,7 @@ for idx,pgn in ipairs(tPgns) do
after_place_node = function(pos, placer)
local meta = minetest.get_meta(pos)
local node = minetest.get_node(pos)
local number = tubelib.add_node(pos, node.name)
local number = tubelib.add_node(pos)
tubelib.set_data(number, "facedir", node.param2)
meta:set_string("number", number)
meta:set_string("infotext", "Tubelib Door Block "..number)

@ -36,7 +36,7 @@ for idx,pgn in ipairs(tPgns) do
after_place_node = function(pos, placer)
local meta = minetest.get_meta(pos)
local node = minetest.get_node(pos)
local number = tubelib.add_node(pos, node.name)
local number = tubelib.add_node(pos)
meta:set_string("infotext", "Tubelib Gate Block "..number)
meta:set_string("formspec", "size[3,2]"..
"label[0,0;Select texture]"..

@ -14,10 +14,14 @@ dofile(minetest.get_modpath("tubelib_addons2") .. "/timer.lua")
dofile(minetest.get_modpath("tubelib_addons2") .. "/sequencer.lua")
dofile(minetest.get_modpath("tubelib_addons2") .. "/gateblock.lua")
dofile(minetest.get_modpath("tubelib_addons2") .. "/doorblock.lua")
dofile(minetest.get_modpath("tubelib_addons2") .. "/colorlamp.lua")
dofile(minetest.get_modpath("tubelib_addons2") .. "/repeater.lua")
dofile(minetest.get_modpath("tubelib_addons2") .. "/programmer.lua")
dofile(minetest.get_modpath("tubelib_addons2") .. "/accesscontrol.lua")
if mesecon then
if minetest.get_modpath("mesecons") and mesecon then
dofile(minetest.get_modpath("tubelib_addons2") .. "/mesecons_converter.lua")
end
if minetest.get_modpath("unifieddyes") and unifieddyes then
dofile(minetest.get_modpath("tubelib_addons2") .. "/colorlamp_ud.lua")
else
dofile(minetest.get_modpath("tubelib_addons2") .. "/colorlamp.lua")
end

@ -52,7 +52,7 @@ minetest.register_node("tubelib_addons2:mesecons_converter", {
after_place_node = function(pos, placer)
local meta = minetest.get_meta(pos)
local own_number = tubelib.add_node(pos, "tubelib_addons2:mesecons_converter")
local own_number = tubelib.add_node(pos)
meta:set_string("own_number", own_number)
meta:set_string("formspec", formspec(meta))
meta:set_string("infotext", "Tubelib Mesecons Converter "..own_number..": not connected")

@ -32,7 +32,7 @@ minetest.register_node("tubelib_addons2:repeater", {
after_place_node = function(pos, placer)
local meta = minetest.get_meta(pos)
local own_number = tubelib.add_node(pos, "tubelib_addons2:repeater")
local own_number = tubelib.add_node(pos)
meta:set_string("own_number", own_number)
meta:set_string("formspec", formspec(meta))
meta:set_string("infotext", "Tubelib Repeater "..own_number..": not connected")

@ -201,7 +201,7 @@ minetest.register_node("tubelib_addons2:sequencer", {
after_place_node = function(pos, placer)
local meta = minetest.get_meta(pos)
local number = tubelib.add_node(pos, "tubelib_addons2:sequencer")
local number = tubelib.add_node(pos)
local rules = {}
for idx = 1,NUM_SLOTS do
rules[idx] = {offs = "", num = "", act = 1}
@ -213,6 +213,7 @@ minetest.register_node("tubelib_addons2:sequencer", {
meta:set_int("endless", 0)
meta:get_int("running", STOP_STATE)
meta:set_string("formspec", formspec(tubelib.STOPPED, rules, 0))
meta:set_string("infotext", "Tubelib Sequencer "..number)
end,
on_receive_fields = on_receive_fields,

Binary file not shown.

Before

Width:  |  Height:  |  Size: 994 B

After

Width:  |  Height:  |  Size: 629 B