mirror of
https://github.com/joe7575/techpack.git
synced 2024-11-22 07:13:48 +01:00
V1.04, Source maintenance, minor issues fixed, Unifieddyes support for Color Lamp added
This commit is contained in:
parent
a0de294c75
commit
ed3035a183
3
.gitignore
vendored
3
.gitignore
vendored
@ -39,3 +39,6 @@ luac.out
|
||||
*.x86_64
|
||||
*.hex
|
||||
|
||||
.buildpath
|
||||
.project
|
||||
org.eclipse.*
|
||||
|
@ -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)
|
||||
local number = tubelib.add_node(pos, "smartline:controller")
|
||||
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)
|
||||
local number = tubelib.add_node(pos, "smartline:display")
|
||||
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)
|
||||
local number = tubelib.add_node(pos, "smartline:playerdetector")
|
||||
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)
|
||||
local own_number = tubelib.add_node(pos, "smartline:repeater")
|
||||
meta:set_string("own_number", own_number)
|
||||
meta:set_string("formspec", formspec(meta))
|
||||
meta:set_string("infotext", "SmartLine Repeater "..own_number..": not connected")
|
||||
|
@ -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)
|
||||
local number = tubelib.add_node(pos, "smartline:sequencer")
|
||||
local rules = {}
|
||||
for idx = 1,NUM_SLOTS do
|
||||
rules[idx] = {offs = "", num = "", act = 1}
|
||||
|
@ -44,7 +44,7 @@ minetest.register_node("smartline:signaltower", {
|
||||
},
|
||||
|
||||
after_place_node = function(pos, placer)
|
||||
local number = tubelib.add_node(pos)
|
||||
local number = tubelib.add_node(pos, "smartline:signaltower")
|
||||
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)
|
||||
local own_num = tubelib.add_node(pos, "smartline:timer")
|
||||
meta:set_string("own_num", own_num)
|
||||
meta:set_string("placer_name", placer:get_player_name())
|
||||
meta:set_string("events", minetest.serialize(events))
|
||||
|
@ -126,7 +126,6 @@ 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.
|
||||
|
||||
|
||||
|
||||
|
@ -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)
|
||||
local own_num = tubelib.add_node(pos, "tubelib:button")
|
||||
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]"..
|
||||
|
@ -161,19 +161,15 @@ 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)
|
||||
if name then
|
||||
Number2Pos[number] = {
|
||||
pos = pos,
|
||||
name = name,
|
||||
}
|
||||
-- update surrounding tubes
|
||||
tubelib.update_tubes(pos)
|
||||
end
|
||||
return number
|
||||
end
|
||||
|
||||
@ -226,7 +222,6 @@ function tubelib.send_message(numbers, placer_name, clicker_name, topic, payload
|
||||
local data = Number2Pos[num]
|
||||
if placer_name and not minetest.is_protected(data.pos, placer_name) then
|
||||
if clicker_name == nil or not minetest.is_protected(data.pos, clicker_name) then
|
||||
if data and data.name then
|
||||
if tubelib_NodeDef[data.name] and tubelib_NodeDef[data.name].on_recv_message then
|
||||
tubelib_NodeDef[data.name].on_recv_message(data.pos, topic, payload)
|
||||
end
|
||||
@ -234,18 +229,15 @@ function tubelib.send_message(numbers, placer_name, clicker_name, topic, payload
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function tubelib.send_request(number, topic, payload)
|
||||
if Number2Pos[number] and Number2Pos[number].name then
|
||||
local data = Number2Pos[number]
|
||||
if data and data.name then
|
||||
if tubelib_NodeDef[data.name] and tubelib_NodeDef[data.name].on_recv_message then
|
||||
return tubelib_NodeDef[data.name].on_recv_message(data.pos, topic, payload)
|
||||
end
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
|
@ -35,7 +35,7 @@ minetest.register_node("tubelib:lamp", {
|
||||
},
|
||||
|
||||
after_place_node = function(pos, placer)
|
||||
local number = tubelib.add_node(pos) -- <<=== tubelib
|
||||
local number = tubelib.add_node(pos, "tubelib:lamp") -- <<=== tubelib
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_string("infotext", "Tubelib Lamp "..number)
|
||||
end,
|
||||
|
@ -79,7 +79,7 @@ minetest.register_node("tubelib_addons2:accesscontrol", {
|
||||
},
|
||||
|
||||
after_place_node = function(pos, placer)
|
||||
local number = tubelib.add_node(pos)
|
||||
local number = tubelib.add_node(pos, "tubelib_addons2:accesscontrol")
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_string("number", number)
|
||||
local numbers = meta:get_string("numbers") or ""
|
||||
|
@ -36,7 +36,7 @@ minetest.register_node("tubelib_addons2:lamp", {
|
||||
tiles = {"tubelib_addons2_lamp.png^[colorize:#000000:100"},
|
||||
|
||||
after_place_node = function(pos, placer)
|
||||
local number = tubelib.add_node(pos)
|
||||
local number = tubelib.add_node(pos, "tubelib_addons2:lamp")
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_int("number", number)
|
||||
switch_node(pos, "", placer)
|
||||
|
@ -31,7 +31,7 @@ minetest.register_node("tubelib_addons2:lamp_off", {
|
||||
tiles = {"tubelib_addons2_lamp.png^[colorize:#000000:100"},
|
||||
|
||||
after_place_node = function(pos, placer, itemstack, pointed_thing)
|
||||
local number = tubelib.add_node(pos)
|
||||
local number = tubelib.add_node(pos, "tubelib_addons2:lamp_off")
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_string("infotext", "Tubelib Color Lamp "..number)
|
||||
unifieddyes.recolor_on_place(pos, placer, itemstack, pointed_thing)
|
||||
|
@ -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)
|
||||
local number = tubelib.add_node(pos, "tubelib_addons2:doorblock"..idx)
|
||||
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)
|
||||
local number = tubelib.add_node(pos, "tubelib_addons2:gateblock"..idx)
|
||||
meta:set_string("infotext", "Tubelib Gate Block "..number)
|
||||
meta:set_string("formspec", "size[3,2]"..
|
||||
"label[0,0;Select texture]"..
|
||||
|
@ -17,6 +17,7 @@ dofile(minetest.get_modpath("tubelib_addons2") .. "/doorblock.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")
|
||||
dofile(minetest.get_modpath("tubelib_addons2") .. "/streetlamp.lua")
|
||||
if minetest.get_modpath("mesecons") and mesecon then
|
||||
dofile(minetest.get_modpath("tubelib_addons2") .. "/mesecons_converter.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)
|
||||
local own_number = tubelib.add_node(pos, "tubelib_addons2:mesecons_converter")
|
||||
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)
|
||||
local own_number = tubelib.add_node(pos, "tubelib_addons2:repeater")
|
||||
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)
|
||||
local number = tubelib.add_node(pos, "tubelib_addons2:sequencer")
|
||||
local rules = {}
|
||||
for idx = 1,NUM_SLOTS do
|
||||
rules[idx] = {offs = "", num = "", act = 1}
|
||||
|
Loading…
Reference in New Issue
Block a user