mirror of
https://github.com/joe7575/techpack.git
synced 2024-11-22 07:13:48 +01:00
Add minetest.translator support (issue #56)
This commit is contained in:
parent
51fdab3c8a
commit
8f35b0793b
@ -5,6 +5,8 @@
|
|||||||
|
|
||||||
]]--
|
]]--
|
||||||
|
|
||||||
|
-- Load support for I18n
|
||||||
|
local S = gravelsieve.S
|
||||||
|
|
||||||
gravelsieve.disallow = function(pos, node, user, mode, new_param2)
|
gravelsieve.disallow = function(pos, node, user, mode, new_param2)
|
||||||
return false
|
return false
|
||||||
@ -40,7 +42,7 @@ gravelsieve.handler = function(itemstack, user, pointed_thing)
|
|||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_tool("gravelsieve:hammer", {
|
minetest.register_tool("gravelsieve:hammer", {
|
||||||
description = "Hammer converts Cobblestone into Gravel",
|
description = S("Hammer converts Cobblestone into Gravel"),
|
||||||
inventory_image = "gravelsieve_hammer.png",
|
inventory_image = "gravelsieve_hammer.png",
|
||||||
on_use = function(itemstack, user, pointed_thing)
|
on_use = function(itemstack, user, pointed_thing)
|
||||||
return gravelsieve.handler(itemstack, user, pointed_thing)
|
return gravelsieve.handler(itemstack, user, pointed_thing)
|
||||||
|
@ -42,6 +42,10 @@
|
|||||||
gravelsieve = {
|
gravelsieve = {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
-- Load support for I18n
|
||||||
|
gravelsieve.S = minetest.get_translator("gravelsieve")
|
||||||
|
local S = gravelsieve.S
|
||||||
|
|
||||||
dofile(minetest.get_modpath("gravelsieve") .. "/hammer.lua")
|
dofile(minetest.get_modpath("gravelsieve") .. "/hammer.lua")
|
||||||
|
|
||||||
local settings_get
|
local settings_get
|
||||||
@ -320,7 +324,7 @@ for idx = 0,4 do
|
|||||||
local tube_info
|
local tube_info
|
||||||
if automatic == 0 then
|
if automatic == 0 then
|
||||||
node_name = "gravelsieve:sieve"
|
node_name = "gravelsieve:sieve"
|
||||||
description = "Gravel Sieve"
|
description = S("Gravel Sieve")
|
||||||
tiles_data = {
|
tiles_data = {
|
||||||
-- up, down, right, left, back, front
|
-- up, down, right, left, back, front
|
||||||
"gravelsieve_gravel.png",
|
"gravelsieve_gravel.png",
|
||||||
@ -332,7 +336,7 @@ for idx = 0,4 do
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
node_name = "gravelsieve:auto_sieve"
|
node_name = "gravelsieve:auto_sieve"
|
||||||
description = "Automatic Gravel Sieve"
|
description = S("Automatic Gravel Sieve")
|
||||||
tiles_data = {
|
tiles_data = {
|
||||||
-- up, down, right, left, back, front
|
-- up, down, right, left, back, front
|
||||||
"gravelsieve_gravel.png",
|
"gravelsieve_gravel.png",
|
||||||
@ -366,6 +370,7 @@ for idx = 0,4 do
|
|||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local not_in_creative_inventory
|
||||||
if idx == 3 then
|
if idx == 3 then
|
||||||
tiles_data[1] = "gravelsieve_top.png"
|
tiles_data[1] = "gravelsieve_top.png"
|
||||||
not_in_creative_inventory = 0
|
not_in_creative_inventory = 0
|
||||||
@ -522,7 +527,7 @@ if minetest.global_exists("tubelib") then
|
|||||||
|
|
||||||
after_place_node = function(pos, placer)
|
after_place_node = function(pos, placer)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
meta:set_string("infotext", "Gravel Sieve")
|
meta:set_string("infotext", S("Gravel Sieve"))
|
||||||
end,
|
end,
|
||||||
|
|
||||||
on_dig = function(pos, node, puncher, pointed_thing)
|
on_dig = function(pos, node, puncher, pointed_thing)
|
||||||
@ -581,14 +586,14 @@ if minetest.global_exists("tubelib") then
|
|||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_node("gravelsieve:sieved_gravel", {
|
minetest.register_node("gravelsieve:sieved_gravel", {
|
||||||
description = "Sieved Gravel",
|
description = S("Sieved Gravel"),
|
||||||
tiles = {"default_gravel.png"},
|
tiles = {"default_gravel.png"},
|
||||||
groups = {crumbly=2, falling_node=1, not_in_creative_inventory=1},
|
groups = {crumbly=2, falling_node=1, not_in_creative_inventory=1},
|
||||||
sounds = default.node_sound_gravel_defaults(),
|
sounds = default.node_sound_gravel_defaults(),
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("gravelsieve:compressed_gravel", {
|
minetest.register_node("gravelsieve:compressed_gravel", {
|
||||||
description = "Compressed Gravel",
|
description = S("Compressed Gravel"),
|
||||||
tiles = {"gravelsieve_compressed_gravel.png"},
|
tiles = {"gravelsieve_compressed_gravel.png"},
|
||||||
groups = {cracky=2, crumbly = 2, cracky = 2},
|
groups = {cracky=2, crumbly = 2, cracky = 2},
|
||||||
sounds = default.node_sound_gravel_defaults(),
|
sounds = default.node_sound_gravel_defaults(),
|
||||||
@ -654,7 +659,7 @@ end
|
|||||||
if minetest.get_modpath("moreblocks") then
|
if minetest.get_modpath("moreblocks") then
|
||||||
|
|
||||||
stairsplus:register_all("gravelsieve", "compressed_gravel", "gravelsieve:compressed_gravel", {
|
stairsplus:register_all("gravelsieve", "compressed_gravel", "gravelsieve:compressed_gravel", {
|
||||||
description="Compressed Gravel",
|
description=S("Compressed Gravel"),
|
||||||
groups={cracky=2, crumbly=2, choppy=2, not_in_creative_inventory=1},
|
groups={cracky=2, crumbly=2, choppy=2, not_in_creative_inventory=1},
|
||||||
tiles = {"gravelsieve_compressed_gravel.png"},
|
tiles = {"gravelsieve_compressed_gravel.png"},
|
||||||
sounds = default.node_sound_stone_defaults(),
|
sounds = default.node_sound_stone_defaults(),
|
||||||
|
@ -13,6 +13,8 @@
|
|||||||
|
|
||||||
]]--
|
]]--
|
||||||
|
|
||||||
|
-- Load support for I18n
|
||||||
|
local S = smartline.S
|
||||||
|
|
||||||
local function switch_on(pos, node)
|
local function switch_on(pos, node)
|
||||||
if tubelib.data_not_corrupted(pos) then
|
if tubelib.data_not_corrupted(pos) then
|
||||||
@ -64,7 +66,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
minetest.register_node("smartline:button", {
|
minetest.register_node("smartline:button", {
|
||||||
description = "SmartLine Button/Switch",
|
description = S("SmartLine Button/Switch"),
|
||||||
inventory_image = "smartline_button_inventory.png",
|
inventory_image = "smartline_button_inventory.png",
|
||||||
tiles = {
|
tiles = {
|
||||||
-- up, down, right, left, back, front
|
-- up, down, right, left, back, front
|
||||||
@ -89,22 +91,23 @@ minetest.register_node("smartline:button", {
|
|||||||
local own_num = tubelib.add_node(pos, "smartline:button")
|
local own_num = tubelib.add_node(pos, "smartline:button")
|
||||||
meta:set_string("own_num", own_num)
|
meta:set_string("own_num", own_num)
|
||||||
meta:set_string("formspec", "size[5,6]"..
|
meta:set_string("formspec", "size[5,6]"..
|
||||||
"dropdown[0.2,0;3;type;switch,button 2s,button 4s,button 8s,button 16s;1]"..
|
"dropdown[0.2,0;3;type;"..S("switch,button 2s,button 4s,button 8s,button 16s")..";1]"..
|
||||||
"field[0.5,2;3,1;numbers;Insert destination block number(s);]" ..
|
"field[0.5,2;3,1;numbers;"..S("Insert destination block number(s)")..";]" ..
|
||||||
"checkbox[1,3;public;public;false]"..
|
"checkbox[1,3;public;public;false]"..
|
||||||
"button_exit[1,4;2,1;exit;Save]")
|
"button_exit[1,4;2,1;exit;"..S("Save").."]")
|
||||||
meta:set_string("placer_name", placer:get_player_name())
|
meta:set_string("placer_name", placer:get_player_name())
|
||||||
meta:set_string("public", "false")
|
meta:set_string("public", "false")
|
||||||
meta:set_int("cycle_time", 0)
|
meta:set_int("cycle_time", 0)
|
||||||
meta:set_string("infotext", "SmartLine Button "..own_num)
|
meta:set_string("infotext", S("SmartLine Button").." "..own_num)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
on_receive_fields = function(pos, formname, fields, player)
|
on_receive_fields = function(pos, formname, fields, player)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
|
print(dump(fields))
|
||||||
if tubelib.check_numbers(fields.numbers) then
|
if tubelib.check_numbers(fields.numbers) then
|
||||||
meta:set_string("numbers", fields.numbers)
|
meta:set_string("numbers", fields.numbers)
|
||||||
local own_num = meta:get_string("own_num")
|
local own_num = meta:get_string("own_num")
|
||||||
meta:set_string("infotext", "SmartLine Button "..own_num..", connected with block "..fields.numbers)
|
meta:set_string("infotext", S("SmartLine Button").." "..own_num..", "..S("connected with block").." "..fields.numbers)
|
||||||
else
|
else
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
@ -153,7 +156,7 @@ minetest.register_node("smartline:button", {
|
|||||||
|
|
||||||
|
|
||||||
minetest.register_node("smartline:button_active", {
|
minetest.register_node("smartline:button_active", {
|
||||||
description = "SmartLine Button/Switch",
|
description = S("SmartLine Button/Switch"),
|
||||||
tiles = {
|
tiles = {
|
||||||
-- up, down, right, left, back, front
|
-- up, down, right, left, back, front
|
||||||
"smartline.png",
|
"smartline.png",
|
||||||
|
@ -14,6 +14,9 @@
|
|||||||
|
|
||||||
]]--
|
]]--
|
||||||
|
|
||||||
|
-- Load support for I18n
|
||||||
|
local S = smartline.S
|
||||||
|
|
||||||
local CYCLE_TIME = 1
|
local CYCLE_TIME = 1
|
||||||
|
|
||||||
local tStates = {stopped = 0, running = 0, standby = 1, blocked = 2, fault = 3, defect = 4}
|
local tStates = {stopped = 0, running = 0, standby = 1, blocked = 2, fault = 3, defect = 4}
|
||||||
@ -30,11 +33,11 @@ local function formspec(meta)
|
|||||||
default.gui_bg..
|
default.gui_bg..
|
||||||
default.gui_bg_img..
|
default.gui_bg_img..
|
||||||
default.gui_slots..
|
default.gui_slots..
|
||||||
"field[0.3,0.6;9,1;poll_numbers;Node numbers to read the states from:;"..poll_numbers.."]" ..
|
"field[0.3,0.6;9,1;poll_numbers;"..S("Node numbers to read the states from:")..";"..poll_numbers.."]" ..
|
||||||
"field[0.3,2;9,1;event_number;Node number to send the events to:;"..event_number.."]" ..
|
"field[0.3,2;9,1;event_number;"..S("Node number to send the events to:")..";"..event_number.."]" ..
|
||||||
"label[1.3,2.8;Send an event if state is equal or larget than:]"..
|
"label[1.3,2.8;"..S("Send an event if state is equal or larget than:").."]"..
|
||||||
"dropdown[1.2,3.4;7,4;severity;1 standby,2 blocked,3 fault,4 defect;"..dropdown_pos.."]"..
|
"dropdown[1.2,3.4;7,4;severity;1 standby,2 blocked,3 fault,4 defect;"..dropdown_pos.."]"..
|
||||||
"button_exit[3,5;2,1;exit;Save]"
|
"button_exit[3,5;2,1;exit;"..S("Save").."]"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@ -50,7 +53,7 @@ local function send_event(meta)
|
|||||||
else
|
else
|
||||||
tubelib.send_message(event_number, owner, nil, "off", own_number)
|
tubelib.send_message(event_number, owner, nil, "off", own_number)
|
||||||
end
|
end
|
||||||
meta:set_string("infotext", "SmartLine State Collector "..own_number..': "'..lStates[state]..'"')
|
meta:set_string("infotext", S("SmartLine State Collector").." "..own_number..': "'..lStates[state]..'"')
|
||||||
meta:set_int("stored_state", state)
|
meta:set_int("stored_state", state)
|
||||||
meta:set_int("state", 0)
|
meta:set_int("state", 0)
|
||||||
end
|
end
|
||||||
@ -74,7 +77,7 @@ local function on_timer(pos,elapsed)
|
|||||||
|
|
||||||
if poll_numbers == "" then
|
if poll_numbers == "" then
|
||||||
local own_number = meta:get_string("own_number")
|
local own_number = meta:get_string("own_number")
|
||||||
meta:set_string("infotext", "SmartLine State Collector "..own_number..": stopped")
|
meta:set_string("infotext", S("SmartLine State Collector").." "..own_number..": stopped")
|
||||||
meta:set_int("state", 0)
|
meta:set_int("state", 0)
|
||||||
meta:set_int("stored_state", 0)
|
meta:set_int("stored_state", 0)
|
||||||
return false
|
return false
|
||||||
@ -94,7 +97,7 @@ local function on_timer(pos,elapsed)
|
|||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_node("smartline:collector", {
|
minetest.register_node("smartline:collector", {
|
||||||
description = "SmartLine State Collector",
|
description = S("SmartLine State Collector"),
|
||||||
inventory_image = "smartline_collector_inventory.png",
|
inventory_image = "smartline_collector_inventory.png",
|
||||||
tiles = {
|
tiles = {
|
||||||
-- up, down, right, left, back, front
|
-- up, down, right, left, back, front
|
||||||
@ -121,7 +124,7 @@ minetest.register_node("smartline:collector", {
|
|||||||
meta:set_string("poll_numbers", "")
|
meta:set_string("poll_numbers", "")
|
||||||
meta:set_string("event_number", "")
|
meta:set_string("event_number", "")
|
||||||
meta:set_string("formspec", formspec(meta))
|
meta:set_string("formspec", formspec(meta))
|
||||||
meta:set_string("infotext", "SmartLine State Collector "..own_number)
|
meta:set_string("infotext", S("SmartLine State Collector").." "..own_number)
|
||||||
meta:set_string("owner", placer:get_player_name())
|
meta:set_string("owner", placer:get_player_name())
|
||||||
end,
|
end,
|
||||||
|
|
||||||
@ -145,7 +148,7 @@ minetest.register_node("smartline:collector", {
|
|||||||
if not timer:is_started() then
|
if not timer:is_started() then
|
||||||
timer:start(CYCLE_TIME)
|
timer:start(CYCLE_TIME)
|
||||||
end
|
end
|
||||||
meta:set_string("infotext", "SmartLine State Collector "..own_number..": running")
|
meta:set_string("infotext", S("SmartLine State Collector").." "..own_number..": running")
|
||||||
else
|
else
|
||||||
if timer:is_started() then
|
if timer:is_started() then
|
||||||
timer:stop()
|
timer:stop()
|
||||||
|
@ -12,6 +12,8 @@
|
|||||||
|
|
||||||
]]--
|
]]--
|
||||||
|
|
||||||
|
-- Load support for I18n
|
||||||
|
local S = smartline.S
|
||||||
|
|
||||||
|
|
||||||
lcdlib.register_display_entity("smartline:entity")
|
lcdlib.register_display_entity("smartline:entity")
|
||||||
@ -42,7 +44,7 @@ local lcd_box = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
minetest.register_node("smartline:display", {
|
minetest.register_node("smartline:display", {
|
||||||
description = "SmartLine Display",
|
description = S("SmartLine Display"),
|
||||||
inventory_image = 'smartline_display_inventory.png',
|
inventory_image = 'smartline_display_inventory.png',
|
||||||
tiles = {"smartline_display.png"},
|
tiles = {"smartline_display.png"},
|
||||||
drawtype = "nodebox",
|
drawtype = "nodebox",
|
||||||
|
@ -12,6 +12,9 @@
|
|||||||
|
|
||||||
smartline = {}
|
smartline = {}
|
||||||
|
|
||||||
|
-- Load support for I18n
|
||||||
|
smartline.S = minetest.get_translator("smartline")
|
||||||
|
|
||||||
local MP = minetest.get_modpath("smartline")
|
local MP = minetest.get_modpath("smartline")
|
||||||
|
|
||||||
dofile(MP.."/display.lua")
|
dofile(MP.."/display.lua")
|
||||||
|
@ -12,6 +12,9 @@
|
|||||||
|
|
||||||
]]--
|
]]--
|
||||||
|
|
||||||
|
-- Load support for I18n
|
||||||
|
local S = smartline.S
|
||||||
|
|
||||||
local function switch_on(pos)
|
local function switch_on(pos)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
local node = minetest.get_node(pos)
|
local node = minetest.get_node(pos)
|
||||||
@ -56,15 +59,19 @@ local function scan_for_player(pos)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function formspec_help()
|
local function formspec_help()
|
||||||
|
local help = table.concat({
|
||||||
|
S("Input the number(s) of the receiving node(s)."),
|
||||||
|
S("Separate numbers via blanks, like '0123 0234'."),
|
||||||
|
S("Input the player name(s) separated by blanks,"),
|
||||||
|
S("or leave it blank for all players.")
|
||||||
|
}, "\n")
|
||||||
return "size[10,9]"..
|
return "size[10,9]"..
|
||||||
default.gui_bg..
|
default.gui_bg..
|
||||||
default.gui_bg_img..
|
default.gui_bg_img..
|
||||||
default.gui_slots..
|
default.gui_slots..
|
||||||
"label[3,0;Player Detector Help]"..
|
"label[3,0;"..S("Player Detector Help").."]"..
|
||||||
"label[0,1;Input the number(s) of the receiving node(s).\n"..
|
"label[0,1;"..help.."]"..
|
||||||
"Separate numbers via blanks, like '0123 0234'.\n\n"..
|
"button_exit[4,8;2,1;exit;"..S("close").."]"
|
||||||
"Input the player name(s) separated by blanks,\nor empty for all players.]"..
|
|
||||||
"button_exit[4,8;2,1;exit;close]"
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@ -73,11 +80,11 @@ local function formspec(numbers, names)
|
|||||||
default.gui_bg..
|
default.gui_bg..
|
||||||
default.gui_bg_img..
|
default.gui_bg_img..
|
||||||
default.gui_slots..
|
default.gui_slots..
|
||||||
"label[2,0;Player Detector]"..
|
"label[2,0;"..S("Player Detector").."]"..
|
||||||
"field[0.3,1;8,1;numbers;Receiver node numbers:;"..numbers.."]" ..
|
"field[0.3,1;8,1;numbers;"..S("Receiver node numbers:")..";"..numbers.."]" ..
|
||||||
"field[0.3,2.5;8,1;names;Player name(s):;"..names.."]" ..
|
"field[0.3,2.5;8,1;names;"..S("Player name(s):")..";"..names.."]" ..
|
||||||
"button_exit[5,3.5;2,1;exit;Save]"..
|
"button_exit[5,3.5;2,1;exit;"..S("Save").."]"..
|
||||||
"button[1,3.5;1,1;help;help]"
|
"button[1,3.5;1,1;help;"..S("help").."]"
|
||||||
end
|
end
|
||||||
|
|
||||||
local function on_receive_fields(pos, formname, fields, player)
|
local function on_receive_fields(pos, formname, fields, player)
|
||||||
@ -101,7 +108,7 @@ local function on_receive_fields(pos, formname, fields, player)
|
|||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_node("smartline:playerdetector", {
|
minetest.register_node("smartline:playerdetector", {
|
||||||
description = "SmartLine Player Detector",
|
description = S("SmartLine Player Detector"),
|
||||||
inventory_image = "smartline_detector_inventory.png",
|
inventory_image = "smartline_detector_inventory.png",
|
||||||
tiles = {
|
tiles = {
|
||||||
-- up, down, right, left, back, front
|
-- up, down, right, left, back, front
|
||||||
@ -127,7 +134,7 @@ minetest.register_node("smartline:playerdetector", {
|
|||||||
local numbers = meta:get_string("numbers") or ""
|
local numbers = meta:get_string("numbers") or ""
|
||||||
local names = meta:get_string("names") or ""
|
local names = meta:get_string("names") or ""
|
||||||
meta:set_string("formspec", formspec(numbers, names))
|
meta:set_string("formspec", formspec(numbers, names))
|
||||||
meta:set_string("infotext", "SmartLine Player Detector "..number)
|
meta:set_string("infotext", S("SmartLine Player Detector").." "..number)
|
||||||
meta:set_string("owner", placer:get_player_name())
|
meta:set_string("owner", placer:get_player_name())
|
||||||
minetest.get_node_timer(pos):start(1)
|
minetest.get_node_timer(pos):start(1)
|
||||||
end,
|
end,
|
||||||
@ -159,7 +166,7 @@ minetest.register_node("smartline:playerdetector", {
|
|||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("smartline:playerdetector_active", {
|
minetest.register_node("smartline:playerdetector_active", {
|
||||||
description = "SmartLine Player Detector",
|
description = S("SmartLine Player Detector"),
|
||||||
tiles = {
|
tiles = {
|
||||||
-- up, down, right, left, back, front
|
-- up, down, right, left, back, front
|
||||||
"smartline.png",
|
"smartline.png",
|
||||||
|
@ -13,17 +13,20 @@
|
|||||||
|
|
||||||
]]--
|
]]--
|
||||||
|
|
||||||
|
-- Load support for I18n
|
||||||
|
local S = smartline.S
|
||||||
|
|
||||||
local OVER_LOAD_MAX = 5
|
local OVER_LOAD_MAX = 5
|
||||||
|
|
||||||
local function formspec(meta)
|
local function formspec(meta)
|
||||||
local numbers = meta:get_string("numbers")
|
local numbers = meta:get_string("numbers")
|
||||||
return "size[7,5]"..
|
return "size[7,5]"..
|
||||||
"field[0.5,2;6,1;number;Destination node numbers;"..numbers.."]" ..
|
"field[0.5,2;6,1;number;"..S("Destination node numbers")..";"..numbers.."]" ..
|
||||||
"button_exit[1,3;2,1;exit;Save]"
|
"button_exit[1,3;2,1;exit;"..S("Save").."]"
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_node("smartline:repeater", {
|
minetest.register_node("smartline:repeater", {
|
||||||
description = "SmartLine Repeater",
|
description = S("SmartLine Repeater"),
|
||||||
inventory_image = "smartline_repeater_inventory.png",
|
inventory_image = "smartline_repeater_inventory.png",
|
||||||
tiles = {
|
tiles = {
|
||||||
-- up, down, right, left, back, front
|
-- up, down, right, left, back, front
|
||||||
@ -48,7 +51,7 @@ minetest.register_node("smartline:repeater", {
|
|||||||
local own_number = tubelib.add_node(pos, "smartline:repeater")
|
local own_number = tubelib.add_node(pos, "smartline:repeater")
|
||||||
meta:set_string("own_number", own_number)
|
meta:set_string("own_number", own_number)
|
||||||
meta:set_string("formspec", formspec(meta))
|
meta:set_string("formspec", formspec(meta))
|
||||||
meta:set_string("infotext", "SmartLine Repeater "..own_number..": not connected")
|
meta:set_string("infotext", S("SmartLine Repeater").." "..own_number..": "..S("not connected"))
|
||||||
meta:set_string("owner", placer:get_player_name())
|
meta:set_string("owner", placer:get_player_name())
|
||||||
meta:set_int("overload_cnt", 0)
|
meta:set_int("overload_cnt", 0)
|
||||||
minetest.get_node_timer(pos):start(1)
|
minetest.get_node_timer(pos):start(1)
|
||||||
@ -64,7 +67,7 @@ minetest.register_node("smartline:repeater", {
|
|||||||
if tubelib.check_numbers(fields.number) then
|
if tubelib.check_numbers(fields.number) then
|
||||||
meta:set_string("numbers", fields.number)
|
meta:set_string("numbers", fields.number)
|
||||||
local own_number = meta:get_string("own_number")
|
local own_number = meta:get_string("own_number")
|
||||||
meta:set_string("infotext", "SmartLine Repeater "..own_number..": connected with "..fields.number)
|
meta:set_string("infotext", S("SmartLine Repeater").." "..own_number..": "..S("connected with").." "..fields.number)
|
||||||
meta:set_string("formspec", formspec(meta))
|
meta:set_string("formspec", formspec(meta))
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -114,12 +117,12 @@ tubelib.register_node("smartline:repeater", {}, {
|
|||||||
meta:set_int("overload_cnt", overload_cnt)
|
meta:set_int("overload_cnt", overload_cnt)
|
||||||
if overload_cnt > OVER_LOAD_MAX then
|
if overload_cnt > OVER_LOAD_MAX then
|
||||||
local own_number = meta:get_string("own_number")
|
local own_number = meta:get_string("own_number")
|
||||||
meta:set_string("infotext", "SmartLine Repeater "..own_number..": fault (overloaded)")
|
meta:set_string("infotext", S("SmartLine Repeater").." "..own_number..": "..S("fault (overloaded)"))
|
||||||
minetest.get_node_timer(pos):stop()
|
minetest.get_node_timer(pos):stop()
|
||||||
return false
|
return false
|
||||||
elseif topic == "set_numbers" then
|
elseif topic == "set_numbers" then
|
||||||
local own_number = meta:get_string("own_number")
|
local own_number = meta:get_string("own_number")
|
||||||
meta:set_string("infotext", "SmartLine Repeater "..own_number..": connected with "..payload)
|
meta:set_string("infotext", S("SmartLine Repeater").." "..own_number..": "..S("connected with").." "..payload)
|
||||||
meta:set_string("numbers", payload)
|
meta:set_string("numbers", payload)
|
||||||
meta:set_string("formspec", formspec(meta))
|
meta:set_string("formspec", formspec(meta))
|
||||||
return true
|
return true
|
||||||
|
@ -13,11 +13,15 @@
|
|||||||
|
|
||||||
]]--
|
]]--
|
||||||
|
|
||||||
|
-- Load support for I18n
|
||||||
|
local S = smartline.S
|
||||||
|
|
||||||
local RUNNING_STATE = 1
|
local RUNNING_STATE = 1
|
||||||
local STOP_STATE = 0
|
local STOP_STATE = 0
|
||||||
local NUM_SLOTS = 8
|
local NUM_SLOTS = 8
|
||||||
|
|
||||||
local sHELP = [[label[0,0;SmartLine Sequencer Help
|
local sHELP = "label[0,0;"..
|
||||||
|
S([[SmartLine Sequencer Help
|
||||||
|
|
||||||
Define a sequence of commands to control other machines.
|
Define a sequence of commands to control other machines.
|
||||||
Numbers(s) are the node numbers, the command shall sent to.
|
Numbers(s) are the node numbers, the command shall sent to.
|
||||||
@ -25,8 +29,8 @@ The commands 'on'/'off' are used for machines and other nodes.
|
|||||||
Offset is the time to the next line in seconds (1..999).
|
Offset is the time to the next line in seconds (1..999).
|
||||||
If endless is set, the Sequencer restarts again and again.
|
If endless is set, the Sequencer restarts again and again.
|
||||||
The command ' ' does nothing, only consuming the offset time.
|
The command ' ' does nothing, only consuming the offset time.
|
||||||
]
|
]])..
|
||||||
]]
|
"]"
|
||||||
|
|
||||||
|
|
||||||
local sAction = ",on,off"
|
local sAction = ",on,off"
|
||||||
@ -39,15 +43,15 @@ local function formspec(state, rules, endless)
|
|||||||
default.gui_bg..
|
default.gui_bg..
|
||||||
default.gui_bg_img..
|
default.gui_bg_img..
|
||||||
default.gui_slots..
|
default.gui_slots..
|
||||||
"label[0,0;Number(s)]label[2.1,0;Command]label[6.4,0;Offset/s]"}
|
"label[0,0;"..S("Number(s)").."]label[2.1,0;"..S("Command").."]label[6.4,0;"..S("Offset/s").."]"}
|
||||||
|
|
||||||
for idx, rule in ipairs(rules or {}) do
|
for idx, rule in ipairs(rules or {}) do
|
||||||
tbl[#tbl+1] = "field[0.2,"..(-0.2+idx)..";2,1;num"..idx..";;"..(rule.num or "").."]"
|
tbl[#tbl+1] = "field[0.2,"..(-0.2+idx)..";2,1;num"..idx..";;"..(rule.num or "").."]"
|
||||||
tbl[#tbl+1] = "dropdown[2,"..(-0.4+idx)..";3.9,1;act"..idx..";"..sAction..";"..(rule.act or "").."]"
|
tbl[#tbl+1] = "dropdown[2,"..(-0.4+idx)..";3.9,1;act"..idx..";"..sAction..";"..(rule.act or "").."]"
|
||||||
tbl[#tbl+1] = "field[6.2,"..(-0.2+idx)..";2,1;offs"..idx..";;"..(rule.offs or "").."]"
|
tbl[#tbl+1] = "field[6.2,"..(-0.2+idx)..";2,1;offs"..idx..";;"..(rule.offs or "").."]"
|
||||||
end
|
end
|
||||||
tbl[#tbl+1] = "checkbox[0,8.5;endless;Run endless;"..endless.."]"
|
tbl[#tbl+1] = "checkbox[0,8.5;endless;"..S("Run endless")..";"..endless.."]"
|
||||||
tbl[#tbl+1] = "button[4.5,8.5;1.5,1;help;help]"
|
tbl[#tbl+1] = "button[4.5,8.5;1.5,1;help;"..S("help").."]"
|
||||||
tbl[#tbl+1] = "image_button[6.5,8.5;1,1;".. tubelib.state_button(state) ..";button;]"
|
tbl[#tbl+1] = "image_button[6.5,8.5;1,1;".. tubelib.state_button(state) ..";button;]"
|
||||||
|
|
||||||
return table.concat(tbl)
|
return table.concat(tbl)
|
||||||
@ -58,10 +62,10 @@ local function formspec_help()
|
|||||||
default.gui_bg..
|
default.gui_bg..
|
||||||
default.gui_bg_img..
|
default.gui_bg_img..
|
||||||
default.gui_slots..
|
default.gui_slots..
|
||||||
"field[0,0;0,0;_type_;;help]"..
|
"field[0,0;0,0;_type_;;"..S("help").."]"..
|
||||||
sHELP..
|
sHELP..
|
||||||
--"label[0.2,0;test]"..
|
--"label[0.2,0;test]"..
|
||||||
"button[11.5,9;1.5,1;close;close]"
|
"button[11.5,9;1.5,1;close;"..S("close").."]"
|
||||||
end
|
end
|
||||||
|
|
||||||
local function stop_the_sequencer(pos)
|
local function stop_the_sequencer(pos)
|
||||||
@ -69,7 +73,7 @@ local function stop_the_sequencer(pos)
|
|||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
local number = meta:get_string("number")
|
local number = meta:get_string("number")
|
||||||
meta:set_int("running", STOP_STATE)
|
meta:set_int("running", STOP_STATE)
|
||||||
meta:set_string("infotext", "SmartLine Sequencer "..number..": stopped")
|
meta:set_string("infotext", S("SmartLine Sequencer").." "..number..": "..S("stopped"))
|
||||||
local rules = minetest.deserialize(meta:get_string("rules"))
|
local rules = minetest.deserialize(meta:get_string("rules"))
|
||||||
local endless = meta:get_int("endless") or 0
|
local endless = meta:get_int("endless") or 0
|
||||||
meta:set_string("formspec", formspec(tubelib.STOPPED, rules, endless))
|
meta:set_string("formspec", formspec(tubelib.STOPPED, rules, endless))
|
||||||
@ -120,7 +124,7 @@ local function check_rules(pos, elapsed)
|
|||||||
if index == 1 and offs < 1 then
|
if index == 1 and offs < 1 then
|
||||||
offs = 2
|
offs = 2
|
||||||
end
|
end
|
||||||
meta:set_string("infotext", "SmartLine Sequencer "..number..": running ("..index.."/"..NUM_SLOTS..")")
|
meta:set_string("infotext", S("SmartLine Sequencer").." "..number..": "..S("running").." ("..index.."/"..NUM_SLOTS..")")
|
||||||
meta:set_int("index", index)
|
meta:set_int("index", index)
|
||||||
if offs > 0 then
|
if offs > 0 then
|
||||||
minetest.after(0, restart_timer, pos, offs)
|
minetest.after(0, restart_timer, pos, offs)
|
||||||
@ -142,7 +146,7 @@ local function start_the_sequencer(pos)
|
|||||||
local number = meta:get_string("number")
|
local number = meta:get_string("number")
|
||||||
meta:set_int("running", RUNNING_STATE)
|
meta:set_int("running", RUNNING_STATE)
|
||||||
meta:set_int("index", 1)
|
meta:set_int("index", 1)
|
||||||
meta:set_string("infotext", "SmartLine Sequencer "..number..": running (1/"..NUM_SLOTS..")")
|
meta:set_string("infotext", S("SmartLine Sequencer").." "..number..": "..S("running").." (1/"..NUM_SLOTS..")")
|
||||||
local rules = minetest.deserialize(meta:get_string("rules"))
|
local rules = minetest.deserialize(meta:get_string("rules"))
|
||||||
local endless = meta:get_int("endless") or 0
|
local endless = meta:get_int("endless") or 0
|
||||||
meta:set_string("formspec", formspec(tubelib.RUNNING, rules, endless))
|
meta:set_string("formspec", formspec(tubelib.RUNNING, rules, endless))
|
||||||
@ -202,7 +206,7 @@ local function on_receive_fields(pos, formname, fields, player)
|
|||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_node("smartline:sequencer", {
|
minetest.register_node("smartline:sequencer", {
|
||||||
description = "SmartLine Sequencer",
|
description = S("SmartLine Sequencer"),
|
||||||
inventory_image = "smartline_sequencer_inventory.png",
|
inventory_image = "smartline_sequencer_inventory.png",
|
||||||
wield_image = "smartline_sequencer_inventory.png",
|
wield_image = "smartline_sequencer_inventory.png",
|
||||||
stack_max = 1,
|
stack_max = 1,
|
||||||
@ -237,7 +241,7 @@ minetest.register_node("smartline:sequencer", {
|
|||||||
meta:set_int("endless", 0)
|
meta:set_int("endless", 0)
|
||||||
meta:get_int("running", STOP_STATE)
|
meta:get_int("running", STOP_STATE)
|
||||||
meta:set_string("formspec", formspec(tubelib.STOPPED, rules, 0))
|
meta:set_string("formspec", formspec(tubelib.STOPPED, rules, 0))
|
||||||
meta:set_string("infotext", "SmartLine Sequencer "..number)
|
meta:set_string("infotext", S("SmartLine Sequencer").." "..number)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
on_receive_fields = on_receive_fields,
|
on_receive_fields = on_receive_fields,
|
||||||
|
@ -12,6 +12,8 @@
|
|||||||
|
|
||||||
]]--
|
]]--
|
||||||
|
|
||||||
|
-- Load support for I18n
|
||||||
|
local S = smartline.S
|
||||||
|
|
||||||
local function switch_on(pos, node, color)
|
local function switch_on(pos, node, color)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
@ -28,7 +30,7 @@ local function switch_off(pos, node)
|
|||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_node("smartline:signaltower", {
|
minetest.register_node("smartline:signaltower", {
|
||||||
description = "SmartLine Signal Tower",
|
description = S("SmartLine Signal Tower"),
|
||||||
tiles = {
|
tiles = {
|
||||||
'smartline_signaltower_top.png',
|
'smartline_signaltower_top.png',
|
||||||
'smartline_signaltower_top.png',
|
'smartline_signaltower_top.png',
|
||||||
@ -47,7 +49,7 @@ minetest.register_node("smartline:signaltower", {
|
|||||||
local number = tubelib.add_node(pos, "smartline:signaltower")
|
local number = tubelib.add_node(pos, "smartline:signaltower")
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
meta:set_string("state", "off")
|
meta:set_string("state", "off")
|
||||||
meta:set_string("infotext", "SmartLine Signal Tower "..number)
|
meta:set_string("infotext", S("SmartLine Signal Tower").." "..number)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
on_rightclick = function(pos, node, clicker)
|
on_rightclick = function(pos, node, clicker)
|
||||||
@ -71,7 +73,7 @@ minetest.register_node("smartline:signaltower", {
|
|||||||
|
|
||||||
for _,color in ipairs({"green", "amber", "red"}) do
|
for _,color in ipairs({"green", "amber", "red"}) do
|
||||||
minetest.register_node("smartline:signaltower_"..color, {
|
minetest.register_node("smartline:signaltower_"..color, {
|
||||||
description = "SmartLine Signal Tower",
|
description = S("SmartLine Signal Tower"),
|
||||||
tiles = {
|
tiles = {
|
||||||
'smartline_signaltower_top.png',
|
'smartline_signaltower_top.png',
|
||||||
'smartline_signaltower_top.png',
|
'smartline_signaltower_top.png',
|
||||||
|
@ -13,13 +13,20 @@
|
|||||||
|
|
||||||
]]--
|
]]--
|
||||||
|
|
||||||
|
-- Load support for I18n
|
||||||
|
local S = smartline.S
|
||||||
|
|
||||||
local CYCLE_TIME = 8
|
local CYCLE_TIME = 8
|
||||||
|
|
||||||
local sHELP = [[label[0,0;SmartLine Timer Help
|
local sHELP = "label[0,0;"..
|
||||||
|
S([[SmartLine Timer Help
|
||||||
|
|
||||||
tbd
|
The Timer is for a daytime controlled sending of commands
|
||||||
]
|
e.g. to turn street lights on/off. The timer checks the
|
||||||
]]
|
time every few seconds. If the block was just loaded,
|
||||||
|
the timer will check the last 4 hours for commands
|
||||||
|
that still need to be executed.]])..
|
||||||
|
"]"
|
||||||
|
|
||||||
|
|
||||||
local tTime = {
|
local tTime = {
|
||||||
@ -45,7 +52,7 @@ local function formspec(events, numbers, actions)
|
|||||||
default.gui_bg_img..
|
default.gui_bg_img..
|
||||||
default.gui_slots..
|
default.gui_slots..
|
||||||
|
|
||||||
"label[0,0;Time]label[2.3,0;Number(s)]label[4.5,0;Command]"..
|
"label[0,0;"..S("Time").."]label[2.3,0;"..S("Number(s)").."]label[4.5,0;"..S("Command").."]"..
|
||||||
"dropdown[0,1;2,1;e1;"..sTime..";"..events[1].."]"..
|
"dropdown[0,1;2,1;e1;"..sTime..";"..events[1].."]"..
|
||||||
"field[2.3,1.2;2,1;n1;;"..numbers[1].."]" ..
|
"field[2.3,1.2;2,1;n1;;"..numbers[1].."]" ..
|
||||||
"dropdown[4.5,1;3,1;a1;"..sAction..";"..tAction[actions[1]].."]"..
|
"dropdown[4.5,1;3,1;a1;"..sAction..";"..tAction[actions[1]].."]"..
|
||||||
@ -70,8 +77,8 @@ local function formspec(events, numbers, actions)
|
|||||||
"field[2.3,6.2;2,1;n6;;"..numbers[6].."]" ..
|
"field[2.3,6.2;2,1;n6;;"..numbers[6].."]" ..
|
||||||
"dropdown[4.5,6;3,1;a6;"..sAction..";"..tAction[actions[6]].."]"..
|
"dropdown[4.5,6;3,1;a6;"..sAction..";"..tAction[actions[6]].."]"..
|
||||||
|
|
||||||
"button[4.5,7;1.5,1;help;help]"..
|
"button[4.5,7;1.5,1;help;"..S("help").."]"..
|
||||||
"button_exit[6.5,7;1.5,1;exit;close]"
|
"button_exit[6.5,7;1.5,1;exit;"..S("close").."]"
|
||||||
end
|
end
|
||||||
|
|
||||||
local function formspec_help()
|
local function formspec_help()
|
||||||
@ -79,10 +86,10 @@ local function formspec_help()
|
|||||||
default.gui_bg..
|
default.gui_bg..
|
||||||
default.gui_bg_img..
|
default.gui_bg_img..
|
||||||
default.gui_slots..
|
default.gui_slots..
|
||||||
"field[0,0;0,0;_type_;;help]"..
|
"field[0,0;0,0;_type_;;"..S("help").."]"..
|
||||||
sHELP..
|
sHELP..
|
||||||
--"label[0.2,0;test]"..
|
--"label[0.2,0;test]"..
|
||||||
"button[11.5,9;1.5,1;close;close]"
|
"button[11.5,9;1.5,1;close;"..S("close").."]"
|
||||||
end
|
end
|
||||||
|
|
||||||
local function check_rules(pos,elapsed)
|
local function check_rules(pos,elapsed)
|
||||||
@ -120,7 +127,7 @@ local function check_rules(pos,elapsed)
|
|||||||
done = {false,false,false,false,false,false}
|
done = {false,false,false,false,false,false}
|
||||||
end
|
end
|
||||||
meta:set_string("done", minetest.serialize(done))
|
meta:set_string("done", minetest.serialize(done))
|
||||||
meta:set_string("infotext","SmartLine Timer ("..own_num..")"..hour..":00")
|
meta:set_string("infotext", S("SmartLine Timer").." "..own_num..": "..hour..":00")
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
return false
|
return false
|
||||||
@ -128,7 +135,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
minetest.register_node("smartline:timer", {
|
minetest.register_node("smartline:timer", {
|
||||||
description = "SmartLine Timer",
|
description = S("SmartLine Timer"),
|
||||||
inventory_image = "smartline_timer_inventory.png",
|
inventory_image = "smartline_timer_inventory.png",
|
||||||
wield_image = "smartline_timer_inventory.png",
|
wield_image = "smartline_timer_inventory.png",
|
||||||
stack_max = 1,
|
stack_max = 1,
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
TechPack Stairway
|
TechPack Stairway
|
||||||
=================
|
=================
|
||||||
|
|
||||||
Copyright (C) 2019 Joachim Stolberg
|
Copyright (C) 2019-2020 Joachim Stolberg
|
||||||
|
|
||||||
LGPLv2.1+
|
LGPLv2.1+
|
||||||
See LICENSE.txt for more information
|
See LICENSE.txt for more information
|
||||||
@ -11,8 +11,11 @@
|
|||||||
init.lua
|
init.lua
|
||||||
|
|
||||||
]]--
|
]]--
|
||||||
|
|
||||||
|
S = minetest.get_translator("techpack_stairway")
|
||||||
|
|
||||||
minetest.register_node("techpack_stairway:grating", {
|
minetest.register_node("techpack_stairway:grating", {
|
||||||
description = "TechPack Grating",
|
description = S("TechPack Grating"),
|
||||||
tiles = {
|
tiles = {
|
||||||
'techpack_stairway_bottom.png',
|
'techpack_stairway_bottom.png',
|
||||||
'techpack_stairway_bottom.png',
|
'techpack_stairway_bottom.png',
|
||||||
@ -43,7 +46,7 @@ minetest.register_node("techpack_stairway:grating", {
|
|||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("techpack_stairway:handrail1", {
|
minetest.register_node("techpack_stairway:handrail1", {
|
||||||
description = "TechPack Handrail 1",
|
description = S("TechPack Handrail 1"),
|
||||||
tiles = {
|
tiles = {
|
||||||
'techpack_stairway_bottom.png',
|
'techpack_stairway_bottom.png',
|
||||||
'techpack_stairway_bottom.png',
|
'techpack_stairway_bottom.png',
|
||||||
@ -74,7 +77,7 @@ minetest.register_node("techpack_stairway:handrail1", {
|
|||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("techpack_stairway:handrail2", {
|
minetest.register_node("techpack_stairway:handrail2", {
|
||||||
description = "TechPack Handrail 2",
|
description = S("TechPack Handrail 2"),
|
||||||
tiles = {
|
tiles = {
|
||||||
'techpack_stairway_bottom.png',
|
'techpack_stairway_bottom.png',
|
||||||
'techpack_stairway_bottom.png',
|
'techpack_stairway_bottom.png',
|
||||||
@ -107,7 +110,7 @@ minetest.register_node("techpack_stairway:handrail2", {
|
|||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("techpack_stairway:handrail3", {
|
minetest.register_node("techpack_stairway:handrail3", {
|
||||||
description = "TechPack Handrail 3",
|
description = S("TechPack Handrail 3"),
|
||||||
tiles = {
|
tiles = {
|
||||||
'techpack_stairway_bottom.png',
|
'techpack_stairway_bottom.png',
|
||||||
'techpack_stairway_bottom.png',
|
'techpack_stairway_bottom.png',
|
||||||
@ -140,7 +143,7 @@ minetest.register_node("techpack_stairway:handrail3", {
|
|||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("techpack_stairway:handrail4", {
|
minetest.register_node("techpack_stairway:handrail4", {
|
||||||
description = "TechPack Handrail 4",
|
description = S("TechPack Handrail 4"),
|
||||||
tiles = {
|
tiles = {
|
||||||
'techpack_stairway_bottom.png',
|
'techpack_stairway_bottom.png',
|
||||||
'techpack_stairway_bottom.png',
|
'techpack_stairway_bottom.png',
|
||||||
@ -175,7 +178,7 @@ minetest.register_node("techpack_stairway:handrail4", {
|
|||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("techpack_stairway:bridge1", {
|
minetest.register_node("techpack_stairway:bridge1", {
|
||||||
description = "TechPack Bridge 1",
|
description = S("TechPack Bridge 1"),
|
||||||
tiles = {
|
tiles = {
|
||||||
'techpack_stairway_bottom.png',
|
'techpack_stairway_bottom.png',
|
||||||
'techpack_stairway_bottom.png',
|
'techpack_stairway_bottom.png',
|
||||||
@ -207,7 +210,7 @@ minetest.register_node("techpack_stairway:bridge1", {
|
|||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("techpack_stairway:bridge2", {
|
minetest.register_node("techpack_stairway:bridge2", {
|
||||||
description = "TechPack Bridge 2",
|
description = S("TechPack Bridge 2"),
|
||||||
tiles = {
|
tiles = {
|
||||||
'techpack_stairway_bottom.png',
|
'techpack_stairway_bottom.png',
|
||||||
'techpack_stairway_bottom.png',
|
'techpack_stairway_bottom.png',
|
||||||
@ -240,7 +243,7 @@ minetest.register_node("techpack_stairway:bridge2", {
|
|||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("techpack_stairway:bridge3", {
|
minetest.register_node("techpack_stairway:bridge3", {
|
||||||
description = "TechPack Bridge 3",
|
description = S("TechPack Bridge 3"),
|
||||||
tiles = {
|
tiles = {
|
||||||
'techpack_stairway_bottom.png',
|
'techpack_stairway_bottom.png',
|
||||||
'techpack_stairway_bottom.png',
|
'techpack_stairway_bottom.png',
|
||||||
@ -273,7 +276,7 @@ minetest.register_node("techpack_stairway:bridge3", {
|
|||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("techpack_stairway:bridge4", {
|
minetest.register_node("techpack_stairway:bridge4", {
|
||||||
description = "TechPack Bridge 4",
|
description = S("TechPack Bridge 4"),
|
||||||
tiles = {
|
tiles = {
|
||||||
'techpack_stairway_bottom.png',
|
'techpack_stairway_bottom.png',
|
||||||
'techpack_stairway_bottom.png',
|
'techpack_stairway_bottom.png',
|
||||||
@ -307,7 +310,7 @@ minetest.register_node("techpack_stairway:bridge4", {
|
|||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("techpack_stairway:stairway", {
|
minetest.register_node("techpack_stairway:stairway", {
|
||||||
description = "TechPack Stairway",
|
description = S("TechPack Stairway"),
|
||||||
tiles = {
|
tiles = {
|
||||||
'techpack_stairway_steps.png',
|
'techpack_stairway_steps.png',
|
||||||
'techpack_stairway_steps.png',
|
'techpack_stairway_steps.png',
|
||||||
@ -345,7 +348,7 @@ minetest.register_node("techpack_stairway:stairway", {
|
|||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("techpack_stairway:ladder1", {
|
minetest.register_node("techpack_stairway:ladder1", {
|
||||||
description = "TechPack Ladder 1",
|
description = S("TechPack Ladder 1"),
|
||||||
tiles = {
|
tiles = {
|
||||||
'techpack_stairway_steps.png',
|
'techpack_stairway_steps.png',
|
||||||
'techpack_stairway_steps.png',
|
'techpack_stairway_steps.png',
|
||||||
@ -376,7 +379,7 @@ minetest.register_node("techpack_stairway:ladder1", {
|
|||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("techpack_stairway:ladder2", {
|
minetest.register_node("techpack_stairway:ladder2", {
|
||||||
description = "TechPack Ladder 2",
|
description = S("TechPack Ladder 2"),
|
||||||
tiles = {
|
tiles = {
|
||||||
'techpack_stairway_steps.png',
|
'techpack_stairway_steps.png',
|
||||||
'techpack_stairway_steps.png',
|
'techpack_stairway_steps.png',
|
||||||
@ -408,7 +411,7 @@ minetest.register_node("techpack_stairway:ladder2", {
|
|||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("techpack_stairway:ladder3", {
|
minetest.register_node("techpack_stairway:ladder3", {
|
||||||
description = "TechPack Ladder 3",
|
description = S("TechPack Ladder 3"),
|
||||||
tiles = {
|
tiles = {
|
||||||
'techpack_stairway_steps.png',
|
'techpack_stairway_steps.png',
|
||||||
'techpack_stairway_steps.png',
|
'techpack_stairway_steps.png',
|
||||||
@ -439,8 +442,39 @@ minetest.register_node("techpack_stairway:ladder3", {
|
|||||||
sounds = default.node_sound_metal_defaults(),
|
sounds = default.node_sound_metal_defaults(),
|
||||||
})
|
})
|
||||||
|
|
||||||
|
minetest.register_node("techpack_stairway:ladder4", {
|
||||||
|
description = S("TechPack Ladder 4"),
|
||||||
|
tiles = {
|
||||||
|
'techpack_stairway_ladder.png',
|
||||||
|
},
|
||||||
|
drawtype = "nodebox",
|
||||||
|
node_box = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = {
|
||||||
|
{-17/32, -17/32, 15/32, 17/32, 17/32, 17/32},
|
||||||
|
--{-17/32, -17/32, -17/32, -15/32, 17/32, 17/32},
|
||||||
|
--{-17/32, -17/32, -17/32, 17/32, 17/32, -15/32},
|
||||||
|
--{ 15/32, -17/32, -17/32, 17/32, 17/32, 17/32},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
selection_box = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = {-8/16, -8/16, 6/16, 8/16, 8/16, 8/16},
|
||||||
|
},
|
||||||
|
|
||||||
|
climbable = true,
|
||||||
|
paramtype2 = "facedir",
|
||||||
|
paramtype = "light",
|
||||||
|
sunlight_propagates = true,
|
||||||
|
is_ground_content = false,
|
||||||
|
groups = {cracky = 2},
|
||||||
|
sounds = default.node_sound_metal_defaults(),
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
minetest.register_node("techpack_stairway:lattice", {
|
minetest.register_node("techpack_stairway:lattice", {
|
||||||
description = "TechPack Lattice",
|
description = S("TechPack Lattice"),
|
||||||
tiles = {
|
tiles = {
|
||||||
'techpack_stairway_lattice.png',
|
'techpack_stairway_lattice.png',
|
||||||
},
|
},
|
||||||
@ -470,6 +504,53 @@ minetest.register_node("techpack_stairway:lattice", {
|
|||||||
sounds = default.node_sound_metal_defaults(),
|
sounds = default.node_sound_metal_defaults(),
|
||||||
})
|
})
|
||||||
|
|
||||||
|
minetest.register_node("techpack_stairway:lattice_slop", {
|
||||||
|
description = S("TechPack Lattice Slope"),
|
||||||
|
tiles = {
|
||||||
|
'techpack_stairway_lattice.png',
|
||||||
|
},
|
||||||
|
drawtype = "mesh",
|
||||||
|
mesh="techpack_stairway_slope.obj",
|
||||||
|
|
||||||
|
selection_box = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = {
|
||||||
|
{-8/16, 4/16, 4/16, 8/16, 8/16, 8/16},
|
||||||
|
{-8/16, 0/16, 0/16, 8/16, 4/16, 8/16},
|
||||||
|
{-8/16, -4/16, -4/16, 8/16, 0/16, 8/16},
|
||||||
|
{-8/16, -8/16, -8/16, 8/16, -4/16, 8/16},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
collision_box = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = {
|
||||||
|
{-8/16, 4/16, 4/16, 8/16, 8/16, 8/16},
|
||||||
|
{-8/16, 0/16, 0/16, 8/16, 4/16, 8/16},
|
||||||
|
{-8/16, -4/16, -4/16, 8/16, 0/16, 8/16},
|
||||||
|
{-8/16, -8/16, -8/16, 8/16, -4/16, 8/16},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
after_place_node = function(pos, placer, itemstack, pointed_thing)
|
||||||
|
local node = minetest.get_node(pos)
|
||||||
|
local dir = minetest.facedir_to_dir(node.param2)
|
||||||
|
if pointed_thing.under.y >= pointed_thing.above.y then
|
||||||
|
local newparam2 = ({[0] = 8, [1] = 17, [2] = 22, [3] = 15})[node.param2]
|
||||||
|
if newparam2 then
|
||||||
|
node.param2 = newparam2
|
||||||
|
minetest.swap_node(pos, node)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
|
||||||
|
paramtype2 = "facedir",
|
||||||
|
paramtype = "light",
|
||||||
|
sunlight_propagates = true,
|
||||||
|
is_ground_content = false,
|
||||||
|
groups = {cracky = 2},
|
||||||
|
sounds = default.node_sound_metal_defaults(),
|
||||||
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = "techpack_stairway:grating 4",
|
output = "techpack_stairway:grating 4",
|
||||||
@ -516,6 +597,15 @@ minetest.register_craft({
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
output = "techpack_stairway:ladder4 8",
|
||||||
|
recipe = {
|
||||||
|
{"dye:dark_grey", "default:tin_ingot", "default:coal_lump"},
|
||||||
|
{"", "default:steel_ingot", ""},
|
||||||
|
{"", "default:steel_ingot", ""},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = "techpack_stairway:lattice 2",
|
output = "techpack_stairway:lattice 2",
|
||||||
recipe = {
|
recipe = {
|
||||||
@ -525,6 +615,10 @@ minetest.register_craft({
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
output = "techpack_stairway:lattice_slop 2",
|
||||||
|
recipe = {{"techpack_stairway:lattice"}},
|
||||||
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = "techpack_stairway:handrail2",
|
output = "techpack_stairway:handrail2",
|
||||||
|
@ -12,14 +12,16 @@
|
|||||||
|
|
||||||
]]--
|
]]--
|
||||||
|
|
||||||
|
-- Load support for I18n
|
||||||
|
local S = techpack_warehouse.S
|
||||||
|
|
||||||
--- for lazy programmers
|
--- for lazy programmers
|
||||||
local S = function(pos) if pos then return minetest.pos_to_string(pos) end end
|
|
||||||
local P = minetest.string_to_pos
|
local P = minetest.string_to_pos
|
||||||
local M = minetest.get_meta
|
local M = minetest.get_meta
|
||||||
local wh = techpack_warehouse
|
local wh = techpack_warehouse
|
||||||
|
|
||||||
local NODE_NAME = "techpack_warehouse:box_copper"
|
local NODE_NAME = "techpack_warehouse:box_copper"
|
||||||
local DESCRIPTION = "Warehouse Box Copper"
|
local DESCRIPTION = S("Warehouse Box Copper")
|
||||||
local INV_SIZE = 1200
|
local INV_SIZE = 1200
|
||||||
local BACKGROUND_IMG = "default_copper_block.png"
|
local BACKGROUND_IMG = "default_copper_block.png"
|
||||||
|
|
||||||
|
@ -12,14 +12,16 @@
|
|||||||
|
|
||||||
]]--
|
]]--
|
||||||
|
|
||||||
|
-- Load support for I18n
|
||||||
|
local S = techpack_warehouse.S
|
||||||
|
|
||||||
--- for lazy programmers
|
--- for lazy programmers
|
||||||
local S = function(pos) if pos then return minetest.pos_to_string(pos) end end
|
|
||||||
local P = minetest.string_to_pos
|
local P = minetest.string_to_pos
|
||||||
local M = minetest.get_meta
|
local M = minetest.get_meta
|
||||||
local wh = techpack_warehouse
|
local wh = techpack_warehouse
|
||||||
|
|
||||||
local NODE_NAME = "techpack_warehouse:box_gold"
|
local NODE_NAME = "techpack_warehouse:box_gold"
|
||||||
local DESCRIPTION = "Warehouse Box Gold"
|
local DESCRIPTION = S("Warehouse Box Gold")
|
||||||
local INV_SIZE = 3600
|
local INV_SIZE = 3600
|
||||||
local BACKGROUND_IMG = "default_gold_block.png"
|
local BACKGROUND_IMG = "default_gold_block.png"
|
||||||
|
|
||||||
|
@ -12,14 +12,16 @@
|
|||||||
|
|
||||||
]]--
|
]]--
|
||||||
|
|
||||||
|
-- Load support for I18n
|
||||||
|
local S = techpack_warehouse.S
|
||||||
|
|
||||||
--- for lazy programmers
|
--- for lazy programmers
|
||||||
local S = function(pos) if pos then return minetest.pos_to_string(pos) end end
|
|
||||||
local P = minetest.string_to_pos
|
local P = minetest.string_to_pos
|
||||||
local M = minetest.get_meta
|
local M = minetest.get_meta
|
||||||
local wh = techpack_warehouse
|
local wh = techpack_warehouse
|
||||||
|
|
||||||
local NODE_NAME = "techpack_warehouse:box_steel"
|
local NODE_NAME = "techpack_warehouse:box_steel"
|
||||||
local DESCRIPTION = "Warehouse Box Steel"
|
local DESCRIPTION = S("Warehouse Box Steel")
|
||||||
local INV_SIZE = 400
|
local INV_SIZE = 400
|
||||||
local BACKGROUND_IMG = "default_steel_block.png"
|
local BACKGROUND_IMG = "default_steel_block.png"
|
||||||
|
|
||||||
|
@ -12,8 +12,10 @@
|
|||||||
|
|
||||||
]]--
|
]]--
|
||||||
|
|
||||||
|
-- Load support for I18n
|
||||||
|
local S = techpack_warehouse.S
|
||||||
|
|
||||||
--- for lazy programmers
|
--- for lazy programmers
|
||||||
local S = function(pos) if pos then return minetest.pos_to_string(pos) end end
|
|
||||||
local P = minetest.string_to_pos
|
local P = minetest.string_to_pos
|
||||||
local M = minetest.get_meta
|
local M = minetest.get_meta
|
||||||
|
|
||||||
@ -49,10 +51,10 @@ local function formspec(self, pos, meta)
|
|||||||
"list[context;input;1,3.6;8,1;]"..
|
"list[context;input;1,3.6;8,1;]"..
|
||||||
"image_button[9,3.6;1,1;techpack_warehouse_input_inv.png;input;;true;false;]"..
|
"image_button[9,3.6;1,1;techpack_warehouse_input_inv.png;input;;true;false;]"..
|
||||||
|
|
||||||
"tooltip[shift;Pass-through storage for unconfigured items (turn on/off)]"..
|
"tooltip[shift;"..S("Pass-through storage for unconfigured items (turn on/off)").."]"..
|
||||||
"tooltip[filter;Filter: To configure the 8 storages]"..
|
"tooltip[filter;"..S("Filter: To configure the 8 storages").."]"..
|
||||||
"tooltip[storage;Storage: All items will be stored here]"..
|
"tooltip[storage;"..S("Storage: All items will be stored here").."]"..
|
||||||
"tooltip[input;Input: Put items will be moved to the storage, if configured]"..
|
"tooltip[input;"..S("Input: Put items will be moved to the storage, if configured").."]"..
|
||||||
|
|
||||||
"list[current_player;main;1,5.3;8,4;]"..
|
"list[current_player;main;1,5.3;8,4;]"..
|
||||||
"listring[context;shift]"..
|
"listring[context;shift]"..
|
||||||
|
@ -14,6 +14,10 @@
|
|||||||
|
|
||||||
techpack_warehouse = {}
|
techpack_warehouse = {}
|
||||||
|
|
||||||
|
-- Load support for I18n
|
||||||
|
techpack_warehouse.S = minetest.get_translator("techpack_warehouse")
|
||||||
|
|
||||||
|
|
||||||
dofile(minetest.get_modpath("techpack_warehouse") .. "/common.lua")
|
dofile(minetest.get_modpath("techpack_warehouse") .. "/common.lua")
|
||||||
dofile(minetest.get_modpath("techpack_warehouse") .. "/box_steel.lua")
|
dofile(minetest.get_modpath("techpack_warehouse") .. "/box_steel.lua")
|
||||||
dofile(minetest.get_modpath("techpack_warehouse") .. "/box_copper.lua")
|
dofile(minetest.get_modpath("techpack_warehouse") .. "/box_copper.lua")
|
||||||
|
@ -12,6 +12,9 @@
|
|||||||
|
|
||||||
]]--
|
]]--
|
||||||
|
|
||||||
|
-- Load support for I18n
|
||||||
|
local S = tubelib.S
|
||||||
|
|
||||||
if tubelib.basalt_stone_enabled then
|
if tubelib.basalt_stone_enabled then
|
||||||
-- Replace default:stone with tubelib:basalt which is useless for ore generation.
|
-- Replace default:stone with tubelib:basalt which is useless for ore generation.
|
||||||
default.cool_lava = function(pos, node)
|
default.cool_lava = function(pos, node)
|
||||||
@ -25,14 +28,14 @@ if tubelib.basalt_stone_enabled then
|
|||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_node("tubelib:basalt_stone", {
|
minetest.register_node("tubelib:basalt_stone", {
|
||||||
description = "Basalt Stone",
|
description = S("Basalt Stone"),
|
||||||
tiles = {"default_stone.png^[brighten"},
|
tiles = {"default_stone.png^[brighten"},
|
||||||
groups = {cracky = 3, stone = 1},
|
groups = {cracky = 3, stone = 1},
|
||||||
drop = "default:silver_sand",
|
drop = "default:silver_sand",
|
||||||
sounds = default.node_sound_stone_defaults(),
|
sounds = default.node_sound_stone_defaults(),
|
||||||
})
|
})
|
||||||
minetest.register_node("tubelib:basalt_stone_brick", {
|
minetest.register_node("tubelib:basalt_stone_brick", {
|
||||||
description = "Basalt Stone Brick",
|
description = S("Basalt Stone Brick"),
|
||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
place_param2 = 0,
|
place_param2 = 0,
|
||||||
tiles = {"default_stone_brick.png^[brighten"},
|
tiles = {"default_stone_brick.png^[brighten"},
|
||||||
@ -42,7 +45,7 @@ if tubelib.basalt_stone_enabled then
|
|||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("tubelib:basalt_stone_block", {
|
minetest.register_node("tubelib:basalt_stone_block", {
|
||||||
description = "Basalt Stone Block",
|
description = S("Basalt Stone Block"),
|
||||||
tiles = {"default_stone_block.png^[brighten"},
|
tiles = {"default_stone_block.png^[brighten"},
|
||||||
is_ground_content = false,
|
is_ground_content = false,
|
||||||
groups = {cracky = 2, stone = 1},
|
groups = {cracky = 2, stone = 1},
|
||||||
|
@ -24,9 +24,11 @@
|
|||||||
-- | |/
|
-- | |/
|
||||||
-- +--------+
|
-- +--------+
|
||||||
|
|
||||||
|
-- Load support for I18n
|
||||||
|
local S = tubelib.S
|
||||||
|
|
||||||
minetest.register_node("tubelib:blackhole", {
|
minetest.register_node("tubelib:blackhole", {
|
||||||
description = "Tubelib Black Hole",
|
description = S("Tubelib Black Hole"),
|
||||||
tiles = {
|
tiles = {
|
||||||
-- up, down, right, left, back, front
|
-- up, down, right, left, back, front
|
||||||
'tubelib_front.png',
|
'tubelib_front.png',
|
||||||
@ -42,7 +44,7 @@ minetest.register_node("tubelib:blackhole", {
|
|||||||
local number = tubelib.add_node(pos, "tubelib:blackhole") -- <<=== tubelib
|
local number = tubelib.add_node(pos, "tubelib:blackhole") -- <<=== tubelib
|
||||||
meta:set_string("number", number)
|
meta:set_string("number", number)
|
||||||
meta:set_int("disappeared", 0)
|
meta:set_int("disappeared", 0)
|
||||||
meta:set_string("infotext","0 items disappeared")
|
meta:set_string("infotext", "0 "..S("items disappeared"))
|
||||||
end,
|
end,
|
||||||
|
|
||||||
after_dig_node = function(pos)
|
after_dig_node = function(pos)
|
||||||
@ -79,7 +81,7 @@ tubelib.register_node("tubelib:blackhole", {}, {
|
|||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
local disappeared = meta:get_int("disappeared") + item:get_count()
|
local disappeared = meta:get_int("disappeared") + item:get_count()
|
||||||
meta:set_int("disappeared", disappeared)
|
meta:set_int("disappeared", disappeared)
|
||||||
meta:set_string("infotext", disappeared.." items disappeared")
|
meta:set_string("infotext", disappeared.." "..S("items disappeared"))
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
return false
|
return false
|
||||||
|
@ -14,6 +14,8 @@
|
|||||||
|
|
||||||
]]--
|
]]--
|
||||||
|
|
||||||
|
-- Load support for I18n
|
||||||
|
local S = tubelib.S
|
||||||
|
|
||||||
local function switch_on(pos, node)
|
local function switch_on(pos, node)
|
||||||
if tubelib.data_not_corrupted(pos) then
|
if tubelib.data_not_corrupted(pos) then
|
||||||
@ -65,7 +67,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
minetest.register_node("tubelib:button", {
|
minetest.register_node("tubelib:button", {
|
||||||
description = "Tubelib Button/Switch",
|
description = S("Tubelib Button/Switch"),
|
||||||
tiles = {
|
tiles = {
|
||||||
-- up, down, right, left, back, front
|
-- up, down, right, left, back, front
|
||||||
'tubelib_front.png',
|
'tubelib_front.png',
|
||||||
@ -81,14 +83,14 @@ minetest.register_node("tubelib:button", {
|
|||||||
local own_num = tubelib.add_node(pos, "tubelib:button")
|
local own_num = tubelib.add_node(pos, "tubelib:button")
|
||||||
meta:set_string("own_num", own_num)
|
meta:set_string("own_num", own_num)
|
||||||
meta:set_string("formspec", "size[7.5,6]"..
|
meta:set_string("formspec", "size[7.5,6]"..
|
||||||
"dropdown[0.2,0;3;type;switch,button 2s,button 4s,button 8s,button 16s;1]"..
|
"dropdown[0.2,0;3;type;"..S("switch,button 2s,button 4s,button 8s,button 16s")..";1]"..
|
||||||
"field[0.5,2;7,1;numbers;Insert destination node number(s);]" ..
|
"field[0.5,2;7,1;numbers;"..S("Insert destination node number(s)")..";]" ..
|
||||||
"checkbox[1,3;public;public;false]"..
|
"checkbox[1,3;public;"..S("public")..";false]"..
|
||||||
"button_exit[2,4;3,1;exit;Save]")
|
"button_exit[2,4;3,1;exit;"..S("Save").."]")
|
||||||
meta:set_string("placer_name", placer:get_player_name())
|
meta:set_string("placer_name", placer:get_player_name())
|
||||||
meta:set_string("public", "false")
|
meta:set_string("public", "false")
|
||||||
meta:set_int("cycle_time", 0)
|
meta:set_int("cycle_time", 0)
|
||||||
meta:set_string("infotext", "Tubelib Button "..own_num)
|
meta:set_string("infotext", S("Tubelib Button").." "..own_num)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
on_receive_fields = function(pos, formname, fields, player)
|
on_receive_fields = function(pos, formname, fields, player)
|
||||||
@ -96,7 +98,7 @@ minetest.register_node("tubelib:button", {
|
|||||||
if tubelib.check_numbers(fields.numbers) then -- <<=== tubelib
|
if tubelib.check_numbers(fields.numbers) then -- <<=== tubelib
|
||||||
meta:set_string("numbers", fields.numbers)
|
meta:set_string("numbers", fields.numbers)
|
||||||
local own_num = meta:get_string("own_num")
|
local own_num = meta:get_string("own_num")
|
||||||
meta:set_string("infotext", "Tubelib Button "..own_num..", connected with block "..fields.numbers)
|
meta:set_string("infotext", S("Tubelib Button").." "..own_num..", "..S("connected with block").." "..fields.numbers)
|
||||||
else
|
else
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
@ -142,7 +144,7 @@ minetest.register_node("tubelib:button", {
|
|||||||
|
|
||||||
|
|
||||||
minetest.register_node("tubelib:button_active", {
|
minetest.register_node("tubelib:button_active", {
|
||||||
description = "Tubelib Button/Switch",
|
description = S("Tubelib Button/Switch"),
|
||||||
tiles = {
|
tiles = {
|
||||||
-- up, down, right, left, back, front
|
-- up, down, right, left, back, front
|
||||||
'tubelib_front.png',
|
'tubelib_front.png',
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
|
-- Load support for I18n
|
||||||
|
local S = tubelib.S
|
||||||
|
|
||||||
minetest.register_node("tubelib:defect_dummy", {
|
minetest.register_node("tubelib:defect_dummy", {
|
||||||
description = "Corrupted Tubelib Node",
|
description = S("Corrupted Tubelib Node"),
|
||||||
tiles = {
|
tiles = {
|
||||||
"tubelib_front.png",
|
"tubelib_front.png",
|
||||||
"tubelib_front.png",
|
"tubelib_front.png",
|
||||||
|
@ -19,8 +19,10 @@
|
|||||||
response is "running", "stopped", "standby", "defect", or "not supported"
|
response is "running", "stopped", "standby", "defect", or "not supported"
|
||||||
]]--
|
]]--
|
||||||
|
|
||||||
|
-- Load support for I18n
|
||||||
|
local S = tubelib.S
|
||||||
|
|
||||||
-- for lazy programmers
|
-- for lazy programmers
|
||||||
local S = function(pos) if pos then return minetest.pos_to_string(pos) end end
|
|
||||||
local P = minetest.string_to_pos
|
local P = minetest.string_to_pos
|
||||||
local M = minetest.get_meta
|
local M = minetest.get_meta
|
||||||
|
|
||||||
@ -62,7 +64,7 @@ local State = tubelib.NodeStates:new({
|
|||||||
node_name_passive = "tubelib:distributor",
|
node_name_passive = "tubelib:distributor",
|
||||||
node_name_active = "tubelib:distributor_active",
|
node_name_active = "tubelib:distributor_active",
|
||||||
node_name_defect = "tubelib:distributor_defect",
|
node_name_defect = "tubelib:distributor_defect",
|
||||||
infotext_name = "Tubelib Distributor",
|
infotext_name = S("Tubelib Distributor"),
|
||||||
cycle_time = CYCLE_TIME,
|
cycle_time = CYCLE_TIME,
|
||||||
standby_ticks = STANDBY_TICKS,
|
standby_ticks = STANDBY_TICKS,
|
||||||
aging_factor = 10,
|
aging_factor = 10,
|
||||||
@ -353,7 +355,7 @@ local function change_filter_settings(pos, slot, val)
|
|||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_node("tubelib:distributor", {
|
minetest.register_node("tubelib:distributor", {
|
||||||
description = "Tubelib Distributor",
|
description = S("Tubelib Distributor"),
|
||||||
tiles = {
|
tiles = {
|
||||||
-- up, down, right, left, back, front
|
-- up, down, right, left, back, front
|
||||||
'tubelib_distributor.png',
|
'tubelib_distributor.png',
|
||||||
@ -413,7 +415,7 @@ minetest.register_node("tubelib:distributor", {
|
|||||||
|
|
||||||
|
|
||||||
minetest.register_node("tubelib:distributor_active", {
|
minetest.register_node("tubelib:distributor_active", {
|
||||||
description = "Tubelib Distributor",
|
description = S("Tubelib Distributor"),
|
||||||
tiles = {
|
tiles = {
|
||||||
-- up, down, right, left, back, front
|
-- up, down, right, left, back, front
|
||||||
{
|
{
|
||||||
@ -451,7 +453,7 @@ minetest.register_node("tubelib:distributor_active", {
|
|||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("tubelib:distributor_defect", {
|
minetest.register_node("tubelib:distributor_defect", {
|
||||||
description = "Tubelib Distributor",
|
description = S("Tubelib Distributor"),
|
||||||
tiles = {
|
tiles = {
|
||||||
-- up, down, right, left, back, front
|
-- up, down, right, left, back, front
|
||||||
'tubelib_distributor.png',
|
'tubelib_distributor.png',
|
||||||
|
@ -12,8 +12,11 @@
|
|||||||
|
|
||||||
]]--
|
]]--
|
||||||
|
|
||||||
|
-- Load support for I18n
|
||||||
|
local S = tubelib.S
|
||||||
|
|
||||||
-- for lazy programmers
|
-- for lazy programmers
|
||||||
local S = function(pos) if pos then return minetest.pos_to_string(pos) end end
|
local P2S = function(pos) if pos then return minetest.pos_to_string(pos) end end
|
||||||
local P = minetest.string_to_pos
|
local P = minetest.string_to_pos
|
||||||
local M = minetest.get_meta
|
local M = minetest.get_meta
|
||||||
|
|
||||||
@ -109,22 +112,22 @@ local function formspec(player)
|
|||||||
default.gui_bg..
|
default.gui_bg..
|
||||||
default.gui_bg_img..
|
default.gui_bg_img..
|
||||||
default.gui_slots..
|
default.gui_slots..
|
||||||
"label[0,0;List of your Forceload Blocks:]"
|
"label[0,0;"..S("List of your Forceload Blocks")..":]"
|
||||||
|
|
||||||
for idx,pos in ipairs(lPos) do
|
for idx,pos in ipairs(lPos) do
|
||||||
local pos1, pos2 = calc_area(pos)
|
local pos1, pos2 = calc_area(pos)
|
||||||
local ypos = 0.2 + idx * 0.4
|
local ypos = 0.2 + idx * 0.4
|
||||||
tRes[#tRes+1] = "label[0,"..ypos..";"..idx.."]"
|
tRes[#tRes+1] = "label[0,"..ypos..";"..idx.."]"
|
||||||
tRes[#tRes+1] = "label[0.8,"..ypos..";"..S(pos1).."]"
|
tRes[#tRes+1] = "label[0.8,"..ypos..";"..P2S(pos1).."]"
|
||||||
tRes[#tRes+1] = "label[3.2,"..ypos..";to]"
|
tRes[#tRes+1] = "label[3.2,"..ypos..";to]"
|
||||||
tRes[#tRes+1] = "label[4,"..ypos..";"..S(pos2).."]"
|
tRes[#tRes+1] = "label[4,"..ypos..";"..P2S(pos2).."]"
|
||||||
end
|
end
|
||||||
return table.concat(tRes)
|
return table.concat(tRes)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
minetest.register_node("tubelib:forceload", {
|
minetest.register_node("tubelib:forceload", {
|
||||||
description = "Tubelib Forceload Block",
|
description = S("Tubelib Forceload Block"),
|
||||||
tiles = {
|
tiles = {
|
||||||
-- up, down, right, left, back, front
|
-- up, down, right, left, back, front
|
||||||
'tubelib_front.png',
|
'tubelib_front.png',
|
||||||
@ -145,13 +148,13 @@ minetest.register_node("tubelib:forceload", {
|
|||||||
if add_pos(pos, placer) then
|
if add_pos(pos, placer) then
|
||||||
minetest.forceload_block(pos, true)
|
minetest.forceload_block(pos, true)
|
||||||
local pos1, pos2, num, max = get_data(pos, placer)
|
local pos1, pos2, num, max = get_data(pos, placer)
|
||||||
M(pos):set_string("infotext", "Area "..S(pos1).." to "..S(pos2).." loaded!\n"..
|
M(pos):set_string("infotext", S("Area").." "..P2S(pos1).." to "..P2S(pos2).." "..S("loaded!").."\n"..
|
||||||
"Punch the block to make the area visible.")
|
S("Punch the block to make the area visible."))
|
||||||
chat(placer, "Area ("..num.."/"..max..") "..S(pos1).." to "..S(pos2).." loaded!")
|
chat(placer, S("Area").." ("..num.."/"..max..") "..P2S(pos1).." "..S("to").." "..P2S(pos2).." "..S("loaded!"))
|
||||||
tubelib.mark_region(placer:get_player_name(), pos1, pos2)
|
tubelib.mark_region(placer:get_player_name(), pos1, pos2)
|
||||||
M(pos):set_string("owner", placer:get_player_name())
|
M(pos):set_string("owner", placer:get_player_name())
|
||||||
else
|
else
|
||||||
chat(placer, "Area already loaded or max. number of Forceload Blocks reached!")
|
chat(placer, S("Area already loaded or max. number of Forceload Blocks reached!"))
|
||||||
minetest.remove_node(pos)
|
minetest.remove_node(pos)
|
||||||
return itemstack
|
return itemstack
|
||||||
end
|
end
|
||||||
|
@ -34,6 +34,10 @@ tubelib = {
|
|||||||
NodeDef = {}, -- node registration info
|
NodeDef = {}, -- node registration info
|
||||||
}
|
}
|
||||||
|
|
||||||
|
-- Load support for I18n
|
||||||
|
tubelib.S = minetest.get_translator("tubelib")
|
||||||
|
local S = tubelib.S
|
||||||
|
|
||||||
tubelib.version = 2.00
|
tubelib.version = 2.00
|
||||||
|
|
||||||
tubelib.max_num_forceload_blocks = tonumber(minetest.setting_get("tubelib_max_num_forceload_blocks")) or 10
|
tubelib.max_num_forceload_blocks = tonumber(minetest.setting_get("tubelib_max_num_forceload_blocks")) or 10
|
||||||
@ -78,7 +82,7 @@ minetest.register_lbm({
|
|||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craftitem("tubelib:wlanchip", {
|
minetest.register_craftitem("tubelib:wlanchip", {
|
||||||
description = "Tubelib WLAN Chip",
|
description = S("Tubelib WLAN Chip"),
|
||||||
inventory_image = "tubelib_wlanchip.png",
|
inventory_image = "tubelib_wlanchip.png",
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -18,6 +18,9 @@
|
|||||||
|
|
||||||
]]--
|
]]--
|
||||||
|
|
||||||
|
-- Load support for I18n
|
||||||
|
local S = tubelib.S
|
||||||
|
|
||||||
local function switch_on(pos, node)
|
local function switch_on(pos, node)
|
||||||
node.name = "tubelib:lamp_on"
|
node.name = "tubelib:lamp_on"
|
||||||
minetest.swap_node(pos, node)
|
minetest.swap_node(pos, node)
|
||||||
@ -29,7 +32,7 @@ local function switch_off(pos, node)
|
|||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_node("tubelib:lamp", {
|
minetest.register_node("tubelib:lamp", {
|
||||||
description = "Tubelib Lamp",
|
description = S("Tubelib Lamp"),
|
||||||
tiles = {
|
tiles = {
|
||||||
'tubelib_lamp.png',
|
'tubelib_lamp.png',
|
||||||
},
|
},
|
||||||
@ -37,7 +40,7 @@ minetest.register_node("tubelib:lamp", {
|
|||||||
after_place_node = function(pos, placer)
|
after_place_node = function(pos, placer)
|
||||||
local number = tubelib.add_node(pos, "tubelib:lamp") -- <<=== tubelib
|
local number = tubelib.add_node(pos, "tubelib:lamp") -- <<=== tubelib
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
meta:set_string("infotext", "Tubelib Lamp "..number)
|
meta:set_string("infotext", S("Tubelib Lamp").." "..number)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
on_rightclick = function(pos, node, clicker)
|
on_rightclick = function(pos, node, clicker)
|
||||||
@ -60,7 +63,7 @@ minetest.register_node("tubelib:lamp", {
|
|||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("tubelib:lamp_on", {
|
minetest.register_node("tubelib:lamp_on", {
|
||||||
description = "Tubelib Lamp",
|
description = S("Tubelib Lamp"),
|
||||||
tiles = {
|
tiles = {
|
||||||
'tubelib_lamp.png',
|
'tubelib_lamp.png',
|
||||||
},
|
},
|
||||||
|
@ -29,8 +29,10 @@
|
|||||||
-- | |/
|
-- | |/
|
||||||
-- +--------+
|
-- +--------+
|
||||||
|
|
||||||
|
-- Load support for I18n
|
||||||
|
local S = tubelib.S
|
||||||
|
|
||||||
-- for lazy programmers
|
-- for lazy programmers
|
||||||
local S = function(pos) if pos then return minetest.pos_to_string(pos) end end
|
|
||||||
local P = minetest.string_to_pos
|
local P = minetest.string_to_pos
|
||||||
local M = minetest.get_meta
|
local M = minetest.get_meta
|
||||||
|
|
||||||
@ -42,7 +44,7 @@ local State = tubelib.NodeStates:new({
|
|||||||
node_name_passive = "tubelib:pusher",
|
node_name_passive = "tubelib:pusher",
|
||||||
node_name_active = "tubelib:pusher_active",
|
node_name_active = "tubelib:pusher_active",
|
||||||
node_name_defect = "tubelib:pusher_defect",
|
node_name_defect = "tubelib:pusher_defect",
|
||||||
infotext_name = "Tubelib Pusher",
|
infotext_name = S("Tubelib Pusher"),
|
||||||
cycle_time = CYCLE_TIME,
|
cycle_time = CYCLE_TIME,
|
||||||
standby_ticks = STANDBY_TICKS,
|
standby_ticks = STANDBY_TICKS,
|
||||||
has_item_meter = true,
|
has_item_meter = true,
|
||||||
@ -75,7 +77,7 @@ local function keep_running(pos, elapsed)
|
|||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_node("tubelib:pusher", {
|
minetest.register_node("tubelib:pusher", {
|
||||||
description = "Tubelib Pusher",
|
description = S("Tubelib Pusher"),
|
||||||
tiles = {
|
tiles = {
|
||||||
-- up, down, right, left, back, front
|
-- up, down, right, left, back, front
|
||||||
'tubelib_pusher1.png',
|
'tubelib_pusher1.png',
|
||||||
@ -117,7 +119,7 @@ minetest.register_node("tubelib:pusher", {
|
|||||||
|
|
||||||
|
|
||||||
minetest.register_node("tubelib:pusher_active", {
|
minetest.register_node("tubelib:pusher_active", {
|
||||||
description = "Tubelib Pusher",
|
description = S("Tubelib Pusher"),
|
||||||
tiles = {
|
tiles = {
|
||||||
-- up, down, right, left, back, front
|
-- up, down, right, left, back, front
|
||||||
{
|
{
|
||||||
@ -182,7 +184,7 @@ minetest.register_node("tubelib:pusher_active", {
|
|||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("tubelib:pusher_defect", {
|
minetest.register_node("tubelib:pusher_defect", {
|
||||||
description = "Tubelib Pusher",
|
description = S("Tubelib Pusher"),
|
||||||
tiles = {
|
tiles = {
|
||||||
-- up, down, right, left, back, front
|
-- up, down, right, left, back, front
|
||||||
'tubelib_pusher1.png',
|
'tubelib_pusher1.png',
|
||||||
|
@ -11,8 +11,10 @@
|
|||||||
repairkit.lua:
|
repairkit.lua:
|
||||||
]]--
|
]]--
|
||||||
|
|
||||||
|
-- Load support for I18n
|
||||||
|
local S = tubelib.S
|
||||||
|
|
||||||
-- for lazy programmers
|
-- for lazy programmers
|
||||||
local S = function(pos) if pos then return minetest.pos_to_string(pos) end end
|
|
||||||
local P = minetest.string_to_pos
|
local P = minetest.string_to_pos
|
||||||
local M = minetest.get_meta
|
local M = minetest.get_meta
|
||||||
|
|
||||||
@ -29,7 +31,7 @@ local function repair_node(itemstack, user, pointed_thing)
|
|||||||
local pos = pointed_thing.under
|
local pos = pointed_thing.under
|
||||||
if pos then
|
if pos then
|
||||||
if tubelib.repair_node(pos) then
|
if tubelib.repair_node(pos) then
|
||||||
minetest.chat_send_player(user:get_player_name(), "[Tubelib] Node repaired")
|
minetest.chat_send_player(user:get_player_name(), S("[Tubelib] Node repaired"))
|
||||||
itemstack:take_item()
|
itemstack:take_item()
|
||||||
return itemstack
|
return itemstack
|
||||||
end
|
end
|
||||||
@ -47,14 +49,14 @@ local function read_state(itemstack, user, pointed_thing)
|
|||||||
local aging = tubelib.send_request(number, "aging", nil)
|
local aging = tubelib.send_request(number, "aging", nil)
|
||||||
if state and counter and aging then
|
if state and counter and aging then
|
||||||
if type(counter) ~= "number" then counter = "unknown" end
|
if type(counter) ~= "number" then counter = "unknown" end
|
||||||
minetest.chat_send_player(user:get_player_name(), "[Tubelib] state ="..state..", counter = "..counter..", aging = "..aging)
|
minetest.chat_send_player(user:get_player_name(), S("[Tubelib] state").." ="..state..", "..S("counter").." = "..counter..", "..S("aging").." = "..aging)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_craftitem("tubelib:repairkit", {
|
minetest.register_craftitem("tubelib:repairkit", {
|
||||||
description = "Tubelib Repair Kit",
|
description = S("Tubelib Repair Kit"),
|
||||||
inventory_image = "tubelib_repairkit.png",
|
inventory_image = "tubelib_repairkit.png",
|
||||||
wield_image = "tubelib_repairkit.png^[transformR270",
|
wield_image = "tubelib_repairkit.png^[transformR270",
|
||||||
groups = {cracky=1, book=1},
|
groups = {cracky=1, book=1},
|
||||||
@ -64,7 +66,7 @@ minetest.register_craftitem("tubelib:repairkit", {
|
|||||||
|
|
||||||
|
|
||||||
minetest.register_node("tubelib:end_wrench", {
|
minetest.register_node("tubelib:end_wrench", {
|
||||||
description = "Tubelib End Wrench (use = read status, place = destroy)",
|
description = S("Tubelib End Wrench (use = read status, place = destroy)"),
|
||||||
inventory_image = "tubelib_end_wrench.png",
|
inventory_image = "tubelib_end_wrench.png",
|
||||||
wield_image = "tubelib_end_wrench.png",
|
wield_image = "tubelib_end_wrench.png",
|
||||||
groups = {cracky=1, book=1},
|
groups = {cracky=1, book=1},
|
||||||
|
@ -12,6 +12,9 @@
|
|||||||
|
|
||||||
]]--
|
]]--
|
||||||
|
|
||||||
|
-- Load support for I18n
|
||||||
|
local S = tubelib.S
|
||||||
|
|
||||||
-- used for registered nodes
|
-- used for registered nodes
|
||||||
tubelib.KnownNodes = {
|
tubelib.KnownNodes = {
|
||||||
["tubelib:tubeS"] = true,
|
["tubelib:tubeS"] = true,
|
||||||
@ -33,7 +36,7 @@ local Tube = tubelib2.Tube:new({
|
|||||||
tubelib.Tube = Tube
|
tubelib.Tube = Tube
|
||||||
|
|
||||||
minetest.register_node("tubelib:tubeS", {
|
minetest.register_node("tubelib:tubeS", {
|
||||||
description = "Tubelib Tube",
|
description = S("Tubelib Tube"),
|
||||||
tiles = { -- Top, base, right, left, front, back
|
tiles = { -- Top, base, right, left, front, back
|
||||||
"tubelib_tube.png^[transformR90",
|
"tubelib_tube.png^[transformR90",
|
||||||
"tubelib_tube.png^[transformR90",
|
"tubelib_tube.png^[transformR90",
|
||||||
@ -80,7 +83,7 @@ minetest.register_node("tubelib:tubeS", {
|
|||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("tubelib:tubeA", {
|
minetest.register_node("tubelib:tubeA", {
|
||||||
description = "Tubelib Tube",
|
description = S("Tubelib Tube"),
|
||||||
tiles = { -- Top, base, right, left, front, back
|
tiles = { -- Top, base, right, left, front, back
|
||||||
"tubelib_knee2.png",
|
"tubelib_knee2.png",
|
||||||
"tubelib_hole2.png^[transformR180",
|
"tubelib_hole2.png^[transformR180",
|
||||||
|
@ -15,8 +15,10 @@
|
|||||||
|
|
||||||
]]--
|
]]--
|
||||||
|
|
||||||
|
-- Load support for I18n
|
||||||
|
local S = tubelib_addons1.S
|
||||||
|
|
||||||
-- for lazy programmers
|
-- for lazy programmers
|
||||||
local S = function(pos) if pos then return minetest.pos_to_string(pos) end end
|
|
||||||
local P = minetest.string_to_pos
|
local P = minetest.string_to_pos
|
||||||
local M = minetest.get_meta
|
local M = minetest.get_meta
|
||||||
|
|
||||||
@ -47,7 +49,7 @@ local State = tubelib.NodeStates:new({
|
|||||||
node_name_passive = "tubelib_addons1:autocrafter",
|
node_name_passive = "tubelib_addons1:autocrafter",
|
||||||
node_name_active = "tubelib_addons1:autocrafter_active",
|
node_name_active = "tubelib_addons1:autocrafter_active",
|
||||||
node_name_defect = "tubelib_addons1:autocrafter_defect",
|
node_name_defect = "tubelib_addons1:autocrafter_defect",
|
||||||
infotext_name = "Tubelib Autocrafter",
|
infotext_name = S("Tubelib Autocrafter"),
|
||||||
cycle_time = CYCLE_TIME,
|
cycle_time = CYCLE_TIME,
|
||||||
standby_ticks = STANDBY_TICKS,
|
standby_ticks = STANDBY_TICKS,
|
||||||
has_item_meter = true,
|
has_item_meter = true,
|
||||||
@ -287,7 +289,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
minetest.register_node("tubelib_addons1:autocrafter", {
|
minetest.register_node("tubelib_addons1:autocrafter", {
|
||||||
description = "Tubelib Autocrafter",
|
description = S("Tubelib Autocrafter"),
|
||||||
drawtype = "normal",
|
drawtype = "normal",
|
||||||
tiles = {
|
tiles = {
|
||||||
'tubelib_front.png',
|
'tubelib_front.png',
|
||||||
@ -335,7 +337,7 @@ minetest.register_node("tubelib_addons1:autocrafter", {
|
|||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("tubelib_addons1:autocrafter_active", {
|
minetest.register_node("tubelib_addons1:autocrafter_active", {
|
||||||
description = "Tubelib Autocrafter",
|
description = S("Tubelib Autocrafter"),
|
||||||
drawtype = "normal",
|
drawtype = "normal",
|
||||||
tiles = {
|
tiles = {
|
||||||
'tubelib_front.png',
|
'tubelib_front.png',
|
||||||
@ -368,7 +370,7 @@ minetest.register_node("tubelib_addons1:autocrafter_active", {
|
|||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("tubelib_addons1:autocrafter_defect", {
|
minetest.register_node("tubelib_addons1:autocrafter_defect", {
|
||||||
description = "Tubelib Autocrafter",
|
description = S("Tubelib Autocrafter"),
|
||||||
drawtype = "normal",
|
drawtype = "normal",
|
||||||
tiles = {
|
tiles = {
|
||||||
'tubelib_front.png',
|
'tubelib_front.png',
|
||||||
|
@ -12,6 +12,9 @@
|
|||||||
|
|
||||||
]]--
|
]]--
|
||||||
|
|
||||||
|
-- Load support for I18n
|
||||||
|
local S = tubelib_addons1.S
|
||||||
|
|
||||||
local PlayerActions = {}
|
local PlayerActions = {}
|
||||||
local InventoryState = {}
|
local InventoryState = {}
|
||||||
|
|
||||||
@ -74,7 +77,7 @@ local function formspec()
|
|||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_node("tubelib_addons1:chest", {
|
minetest.register_node("tubelib_addons1:chest", {
|
||||||
description = "Tubelib Protected Chest",
|
description = S("Tubelib Protected Chest"),
|
||||||
tiles = {
|
tiles = {
|
||||||
-- up, down, right, left, back, front
|
-- up, down, right, left, back, front
|
||||||
"default_chest_top.png^tubelib_addons1_frame.png",
|
"default_chest_top.png^tubelib_addons1_frame.png",
|
||||||
@ -97,7 +100,7 @@ minetest.register_node("tubelib_addons1:chest", {
|
|||||||
meta:set_string("number", number)
|
meta:set_string("number", number)
|
||||||
meta:set_string("owner", placer:get_player_name())
|
meta:set_string("owner", placer:get_player_name())
|
||||||
meta:set_string("formspec", formspec())
|
meta:set_string("formspec", formspec())
|
||||||
meta:set_string("infotext", "Tubelib Protected Chest "..number)
|
meta:set_string("infotext", S("Tubelib Protected Chest").." "..number)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
can_dig = function(pos, player)
|
can_dig = function(pos, player)
|
||||||
@ -157,7 +160,7 @@ tubelib.register_node("tubelib_addons1:chest", {}, {
|
|||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
meta:set_string("dest_num", payload)
|
meta:set_string("dest_num", payload)
|
||||||
local number = meta:get_string("number")
|
local number = meta:get_string("number")
|
||||||
meta:set_string("infotext", "Tubelib Protected Chest "..number.." connected with "..payload)
|
meta:set_string("infotext", S("Tubelib Protected Chest").." "..number.." "..S("connected with").." "..payload)
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
@ -12,6 +12,8 @@
|
|||||||
|
|
||||||
]]--
|
]]--
|
||||||
|
|
||||||
|
-- Load support for I18n
|
||||||
|
local S = tubelib_addons1.S
|
||||||
|
|
||||||
local function switch_on(pos)
|
local function switch_on(pos)
|
||||||
if tubelib.data_not_corrupted(pos) then
|
if tubelib.data_not_corrupted(pos) then
|
||||||
@ -42,7 +44,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
minetest.register_node("tubelib_addons1:detector", {
|
minetest.register_node("tubelib_addons1:detector", {
|
||||||
description = "Tubelib Detector",
|
description = S("Tubelib Detector"),
|
||||||
tiles = {
|
tiles = {
|
||||||
-- up, down, right, left, back, front
|
-- up, down, right, left, back, front
|
||||||
'tubelib_front.png',
|
'tubelib_front.png',
|
||||||
@ -58,10 +60,10 @@ minetest.register_node("tubelib_addons1:detector", {
|
|||||||
local own_num = tubelib.add_node(pos, "tubelib_addons1:detector")
|
local own_num = tubelib.add_node(pos, "tubelib_addons1:detector")
|
||||||
meta:set_string("own_num", own_num)
|
meta:set_string("own_num", own_num)
|
||||||
meta:set_string("formspec", "size[7.5,3]"..
|
meta:set_string("formspec", "size[7.5,3]"..
|
||||||
"field[0.5,1;7,1;numbers;Insert destination node number(s);]" ..
|
"field[0.5,1;7,1;numbers;"..S("Insert destination node number(s)")..";]" ..
|
||||||
"button_exit[2,2;3,1;exit;Save]")
|
"button_exit[2,2;3,1;exit;"..S("Save").."]")
|
||||||
meta:set_string("placer_name", placer:get_player_name())
|
meta:set_string("placer_name", placer:get_player_name())
|
||||||
meta:set_string("infotext", "Tubelib Detector, unconfigured")
|
meta:set_string("infotext", S("Tubelib Detector, unconfigured"))
|
||||||
end,
|
end,
|
||||||
|
|
||||||
on_receive_fields = function(pos, formname, fields, player)
|
on_receive_fields = function(pos, formname, fields, player)
|
||||||
@ -69,10 +71,10 @@ minetest.register_node("tubelib_addons1:detector", {
|
|||||||
if tubelib.check_numbers(fields.numbers) then
|
if tubelib.check_numbers(fields.numbers) then
|
||||||
meta:set_string("numbers", fields.numbers)
|
meta:set_string("numbers", fields.numbers)
|
||||||
local own_num = meta:get_string("own_num")
|
local own_num = meta:get_string("own_num")
|
||||||
meta:set_string("infotext", "Tubelib Detector, connected")
|
meta:set_string("infotext", S("Tubelib Detector, connected"))
|
||||||
meta:set_string("formspec", "size[7.5,3]"..
|
meta:set_string("formspec", "size[7.5,3]"..
|
||||||
"field[0.5,1;7,1;numbers;Insert destination node number(s);"..fields.numbers.."]" ..
|
"field[0.5,1;7,1;numbers;"..S("Insert destination node number(s)")..";"..fields.numbers.."]" ..
|
||||||
"button_exit[2,2;3,1;exit;Save]")
|
"button_exit[2,2;3,1;exit;"..S("Save").."]")
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
|
||||||
@ -91,7 +93,7 @@ minetest.register_node("tubelib_addons1:detector", {
|
|||||||
|
|
||||||
|
|
||||||
minetest.register_node("tubelib_addons1:detector_active", {
|
minetest.register_node("tubelib_addons1:detector_active", {
|
||||||
description = "Tubelib Detector",
|
description = S("Tubelib Detector"),
|
||||||
tiles = {
|
tiles = {
|
||||||
-- up, down, right, left, back, front
|
-- up, down, right, left, back, front
|
||||||
'tubelib_front.png',
|
'tubelib_front.png',
|
||||||
|
@ -15,8 +15,10 @@
|
|||||||
|
|
||||||
]]--
|
]]--
|
||||||
|
|
||||||
|
-- Load support for I18n
|
||||||
|
local S = tubelib_addons1.S
|
||||||
|
|
||||||
-- for lazy programmers
|
-- for lazy programmers
|
||||||
local S = function(pos) if pos then return minetest.pos_to_string(pos) end end
|
|
||||||
local P = minetest.string_to_pos
|
local P = minetest.string_to_pos
|
||||||
local M = minetest.get_meta
|
local M = minetest.get_meta
|
||||||
|
|
||||||
@ -46,7 +48,7 @@ end
|
|||||||
local State = tubelib.NodeStates:new({
|
local State = tubelib.NodeStates:new({
|
||||||
node_name_passive = "tubelib_addons1:fermenter",
|
node_name_passive = "tubelib_addons1:fermenter",
|
||||||
node_name_defect = "tubelib_addons1:fermenter_defect",
|
node_name_defect = "tubelib_addons1:fermenter_defect",
|
||||||
infotext_name = "Tubelib Fermenter",
|
infotext_name = S("Tubelib Fermenter"),
|
||||||
cycle_time = CYCLE_TIME,
|
cycle_time = CYCLE_TIME,
|
||||||
standby_ticks = STANDBY_TICKS,
|
standby_ticks = STANDBY_TICKS,
|
||||||
has_item_meter = true,
|
has_item_meter = true,
|
||||||
@ -161,7 +163,7 @@ local function on_receive_fields(pos, formname, fields, player)
|
|||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_node("tubelib_addons1:fermenter", {
|
minetest.register_node("tubelib_addons1:fermenter", {
|
||||||
description = "Tubelib Fermenter",
|
description = S("Tubelib Fermenter"),
|
||||||
inventory_image = "tubelib_addons1_fermenter_inventory.png",
|
inventory_image = "tubelib_addons1_fermenter_inventory.png",
|
||||||
tiles = {
|
tiles = {
|
||||||
-- up, down, right, left, back, front
|
-- up, down, right, left, back, front
|
||||||
@ -192,7 +194,7 @@ minetest.register_node("tubelib_addons1:fermenter", {
|
|||||||
State:node_init(pos, number)
|
State:node_init(pos, number)
|
||||||
else
|
else
|
||||||
minetest.remove_node(pos)
|
minetest.remove_node(pos)
|
||||||
minetest.chat_send_player(placer:get_player_name(), "Fermenter will not fit there")
|
minetest.chat_send_player(placer:get_player_name(), S("Fermenter will not fit there"))
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
@ -231,7 +233,7 @@ minetest.register_node("tubelib_addons1:fermenter", {
|
|||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("tubelib_addons1:fermenter_defect", {
|
minetest.register_node("tubelib_addons1:fermenter_defect", {
|
||||||
description = "Tubelib Fermenter defect",
|
description = S("Tubelib Fermenter defect"),
|
||||||
inventory_image = "tubelib_addons1_fermenter_inventory.png",
|
inventory_image = "tubelib_addons1_fermenter_inventory.png",
|
||||||
tiles = {
|
tiles = {
|
||||||
-- up, down, right, left, back, front
|
-- up, down, right, left, back, front
|
||||||
@ -263,7 +265,7 @@ minetest.register_node("tubelib_addons1:fermenter_defect", {
|
|||||||
State:defect(pos, M(pos))
|
State:defect(pos, M(pos))
|
||||||
else
|
else
|
||||||
minetest.remove_node(pos)
|
minetest.remove_node(pos)
|
||||||
minetest.chat_send_player(placer:get_player_name(), "Fermenter will not fit there")
|
minetest.chat_send_player(placer:get_player_name(), S("Fermenter will not fit there"))
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
@ -303,7 +305,7 @@ minetest.register_node("tubelib_addons1:fermenter_defect", {
|
|||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("tubelib_addons1:fermenter_top", {
|
minetest.register_node("tubelib_addons1:fermenter_top", {
|
||||||
description = "Tubelib Fermenter Top",
|
description = S("Tubelib Fermenter Top"),
|
||||||
tiles = {
|
tiles = {
|
||||||
-- up, down, right, left, back, front
|
-- up, down, right, left, back, front
|
||||||
'tubelib_front.png',
|
'tubelib_front.png',
|
||||||
@ -323,19 +325,19 @@ minetest.register_node("tubelib_addons1:fermenter_top", {
|
|||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craftitem("tubelib_addons1:biogas", {
|
minetest.register_craftitem("tubelib_addons1:biogas", {
|
||||||
description = "Bio Gas",
|
description = S("Bio Gas"),
|
||||||
inventory_image = "tubelib_addons1_biogas.png",
|
inventory_image = "tubelib_addons1_biogas.png",
|
||||||
})
|
})
|
||||||
|
|
||||||
if minetest.global_exists("unified_inventory") then
|
if minetest.global_exists("unified_inventory") then
|
||||||
unified_inventory.register_craft_type("fermenting", {
|
unified_inventory.register_craft_type("fermenting", {
|
||||||
description = "Fermenter",
|
description = S("Fermenter"),
|
||||||
icon = "tubelib_addons1_fermenter_inventory.png",
|
icon = "tubelib_addons1_fermenter_inventory.png",
|
||||||
width = 2,
|
width = 2,
|
||||||
height = 2,
|
height = 2,
|
||||||
})
|
})
|
||||||
unified_inventory.register_craft_type("reforming", {
|
unified_inventory.register_craft_type("reforming", {
|
||||||
description = "Reformer",
|
description = S("Reformer"),
|
||||||
icon = "tubelib_addons1_reformer_inventory.png",
|
icon = "tubelib_addons1_reformer_inventory.png",
|
||||||
width = 2,
|
width = 2,
|
||||||
height = 2,
|
height = 2,
|
||||||
|
@ -12,6 +12,9 @@
|
|||||||
|
|
||||||
]]--
|
]]--
|
||||||
|
|
||||||
|
-- Load support for I18n
|
||||||
|
local S = tubelib_addons1.S
|
||||||
|
|
||||||
local function allow_metadata_inventory_put(pos, listname, index, stack, player)
|
local function allow_metadata_inventory_put(pos, listname, index, stack, player)
|
||||||
if minetest.is_protected(pos, player:get_player_name()) then
|
if minetest.is_protected(pos, player:get_player_name()) then
|
||||||
return 0
|
return 0
|
||||||
@ -60,7 +63,7 @@ local function scan_for_objects(pos, elapsed)
|
|||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_node("tubelib_addons1:funnel", {
|
minetest.register_node("tubelib_addons1:funnel", {
|
||||||
description = "Tubelib Funnel",
|
description = S("Tubelib Funnel"),
|
||||||
tiles = {
|
tiles = {
|
||||||
-- up, down, right, left, back, front
|
-- up, down, right, left, back, front
|
||||||
'tubelib_addons1_funnel_top.png',
|
'tubelib_addons1_funnel_top.png',
|
||||||
|
@ -14,8 +14,10 @@
|
|||||||
|
|
||||||
]]--
|
]]--
|
||||||
|
|
||||||
|
-- Load support for I18n
|
||||||
|
local S = tubelib_addons1.S
|
||||||
|
|
||||||
-- for lazy programmers
|
-- for lazy programmers
|
||||||
local S = function(pos) if pos then return minetest.pos_to_string(pos) end end
|
|
||||||
local P = minetest.string_to_pos
|
local P = minetest.string_to_pos
|
||||||
local M = minetest.get_meta
|
local M = minetest.get_meta
|
||||||
|
|
||||||
@ -49,7 +51,7 @@ local State = tubelib.NodeStates:new({
|
|||||||
node_name_passive = "tubelib_addons1:grinder",
|
node_name_passive = "tubelib_addons1:grinder",
|
||||||
node_name_active = "tubelib_addons1:grinder_active",
|
node_name_active = "tubelib_addons1:grinder_active",
|
||||||
node_name_defect = "tubelib_addons1:grinder_defect",
|
node_name_defect = "tubelib_addons1:grinder_defect",
|
||||||
infotext_name = "Tubelib Grinder",
|
infotext_name = S("Tubelib Grinder"),
|
||||||
cycle_time = CYCLE_TIME,
|
cycle_time = CYCLE_TIME,
|
||||||
standby_ticks = STANDBY_TICKS,
|
standby_ticks = STANDBY_TICKS,
|
||||||
has_item_meter = true,
|
has_item_meter = true,
|
||||||
@ -120,7 +122,7 @@ local function on_receive_fields(pos, formname, fields, player)
|
|||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_node("tubelib_addons1:grinder", {
|
minetest.register_node("tubelib_addons1:grinder", {
|
||||||
description = "Tubelib Grinder",
|
description = S("Tubelib Grinder"),
|
||||||
tiles = {
|
tiles = {
|
||||||
-- up, down, right, left, back, front
|
-- up, down, right, left, back, front
|
||||||
'tubelib_addons1_grinder.png',
|
'tubelib_addons1_grinder.png',
|
||||||
@ -170,7 +172,7 @@ minetest.register_node("tubelib_addons1:grinder", {
|
|||||||
|
|
||||||
|
|
||||||
minetest.register_node("tubelib_addons1:grinder_active", {
|
minetest.register_node("tubelib_addons1:grinder_active", {
|
||||||
description = "Tubelib Grinder",
|
description = S("Tubelib Grinder"),
|
||||||
tiles = {
|
tiles = {
|
||||||
-- up, down, right, left, back, front
|
-- up, down, right, left, back, front
|
||||||
{
|
{
|
||||||
@ -207,7 +209,7 @@ minetest.register_node("tubelib_addons1:grinder_active", {
|
|||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("tubelib_addons1:grinder_defect", {
|
minetest.register_node("tubelib_addons1:grinder_defect", {
|
||||||
description = "Tubelib Grinder",
|
description = S("Tubelib Grinder"),
|
||||||
tiles = {
|
tiles = {
|
||||||
-- up, down, right, left, back, front
|
-- up, down, right, left, back, front
|
||||||
'tubelib_addons1_grinder.png',
|
'tubelib_addons1_grinder.png',
|
||||||
@ -296,7 +298,7 @@ tubelib.register_node("tubelib_addons1:grinder",
|
|||||||
|
|
||||||
if minetest.global_exists("unified_inventory") then
|
if minetest.global_exists("unified_inventory") then
|
||||||
unified_inventory.register_craft_type("grinding", {
|
unified_inventory.register_craft_type("grinding", {
|
||||||
description = "Grinding",
|
description = S("Grinding"),
|
||||||
icon = 'tubelib_addons1_grinder.png',
|
icon = 'tubelib_addons1_grinder.png',
|
||||||
width = 1,
|
width = 1,
|
||||||
height = 1,
|
height = 1,
|
||||||
|
@ -19,8 +19,10 @@
|
|||||||
|
|
||||||
]]--
|
]]--
|
||||||
|
|
||||||
|
-- Load support for I18n
|
||||||
|
local S = tubelib_addons1.S
|
||||||
|
|
||||||
-- for lazy programmers
|
-- for lazy programmers
|
||||||
local S = function(pos) if pos then return minetest.pos_to_string(pos) end end
|
|
||||||
local P = minetest.string_to_pos
|
local P = minetest.string_to_pos
|
||||||
local M = minetest.get_meta
|
local M = minetest.get_meta
|
||||||
|
|
||||||
@ -56,8 +58,8 @@ local function formspec(self, pos, meta)
|
|||||||
default.gui_bg_img..
|
default.gui_bg_img..
|
||||||
default.gui_slots..
|
default.gui_slots..
|
||||||
"dropdown[0,0;1.5;radius;4,6,8,10,12,14,16;"..radius.."]"..
|
"dropdown[0,0;1.5;radius;4,6,8,10,12,14,16;"..radius.."]"..
|
||||||
"label[1.6,0.2;Area radius]"..
|
"label[1.6,0.2;"..S("Area radius").."]"..
|
||||||
"checkbox[0,1;endless;Run endless;"..endless.."]"..
|
"checkbox[0,1;endless;"..S("Run endless")..";"..endless.."]"..
|
||||||
"list[context;main;5,0;4,4;]"..
|
"list[context;main;5,0;4,4;]"..
|
||||||
"list[context;fuel;1.5,3;1,1;]"..
|
"list[context;fuel;1.5,3;1,1;]"..
|
||||||
"item_image[1.5,3;1,1;tubelib_addons1:biofuel]"..
|
"item_image[1.5,3;1,1;tubelib_addons1:biofuel]"..
|
||||||
@ -72,7 +74,7 @@ end
|
|||||||
local State = tubelib.NodeStates:new({
|
local State = tubelib.NodeStates:new({
|
||||||
node_name_passive = "tubelib_addons1:harvester_base",
|
node_name_passive = "tubelib_addons1:harvester_base",
|
||||||
node_name_defect = "tubelib_addons1:harvester_defect",
|
node_name_defect = "tubelib_addons1:harvester_defect",
|
||||||
infotext_name = "Tubelib Harvester",
|
infotext_name = S("Tubelib Harvester"),
|
||||||
cycle_time = CYCLE_TIME,
|
cycle_time = CYCLE_TIME,
|
||||||
standby_ticks = STANDBY_TICKS,
|
standby_ticks = STANDBY_TICKS,
|
||||||
has_item_meter = true,
|
has_item_meter = true,
|
||||||
@ -254,8 +256,8 @@ local function keep_running(pos, elapsed)
|
|||||||
if harvest_field(this, meta) then
|
if harvest_field(this, meta) then
|
||||||
meta:set_string("this", minetest.serialize(this))
|
meta:set_string("this", minetest.serialize(this))
|
||||||
meta:set_string("infotext",
|
meta:set_string("infotext",
|
||||||
"Tubelib Harvester "..this.number..
|
S("Tubelib Harvester").." "..this.number..
|
||||||
": running ("..this.idx.."/"..this.max..")")
|
S(": running (")..this.idx.."/"..this.max..")")
|
||||||
State:keep_running(pos, meta, COUNTDOWN_TICKS, this.num_items)
|
State:keep_running(pos, meta, COUNTDOWN_TICKS, this.num_items)
|
||||||
else
|
else
|
||||||
State:blocked(pos, meta)
|
State:blocked(pos, meta)
|
||||||
@ -300,7 +302,7 @@ local function on_receive_fields(pos, formname, fields, player)
|
|||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_node("tubelib_addons1:harvester_base", {
|
minetest.register_node("tubelib_addons1:harvester_base", {
|
||||||
description = "Tubelib Harvester Base",
|
description = S("Tubelib Harvester Base"),
|
||||||
tiles = {
|
tiles = {
|
||||||
-- up, down, right, left, back, front
|
-- up, down, right, left, back, front
|
||||||
'tubelib_front.png',
|
'tubelib_front.png',
|
||||||
@ -356,7 +358,7 @@ minetest.register_node("tubelib_addons1:harvester_base", {
|
|||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("tubelib_addons1:harvester_defect", {
|
minetest.register_node("tubelib_addons1:harvester_defect", {
|
||||||
description = "Tubelib Harvester Base",
|
description = S("Tubelib Harvester Base"),
|
||||||
tiles = {
|
tiles = {
|
||||||
-- up, down, right, left, back, front
|
-- up, down, right, left, back, front
|
||||||
'tubelib_front.png',
|
'tubelib_front.png',
|
||||||
|
@ -10,6 +10,10 @@
|
|||||||
|
|
||||||
]]--
|
]]--
|
||||||
|
|
||||||
|
tubelib_addons1 = {}
|
||||||
|
|
||||||
|
-- Load support for I18n
|
||||||
|
tubelib_addons1.S = minetest.get_translator("tubelib_addons1")
|
||||||
|
|
||||||
dofile(minetest.get_modpath("tubelib_addons1") .. "/quarry.lua")
|
dofile(minetest.get_modpath("tubelib_addons1") .. "/quarry.lua")
|
||||||
dofile(minetest.get_modpath("tubelib_addons1") .. "/grinder.lua")
|
dofile(minetest.get_modpath("tubelib_addons1") .. "/grinder.lua")
|
||||||
|
@ -12,8 +12,10 @@
|
|||||||
|
|
||||||
]]--
|
]]--
|
||||||
|
|
||||||
|
-- Load support for I18n
|
||||||
|
local S = tubelib_addons1.S
|
||||||
|
|
||||||
-- for lazy programmers
|
-- for lazy programmers
|
||||||
local S = function(pos) if pos then return minetest.pos_to_string(pos) end end
|
|
||||||
local P = minetest.string_to_pos
|
local P = minetest.string_to_pos
|
||||||
local M = minetest.get_meta
|
local M = minetest.get_meta
|
||||||
|
|
||||||
@ -43,7 +45,7 @@ local State = tubelib.NodeStates:new({
|
|||||||
node_name_passive = "tubelib_addons1:liquidsampler",
|
node_name_passive = "tubelib_addons1:liquidsampler",
|
||||||
node_name_active = "tubelib_addons1:liquidsampler_active",
|
node_name_active = "tubelib_addons1:liquidsampler_active",
|
||||||
node_name_defect = "tubelib_addons1:liquidsampler_defect",
|
node_name_defect = "tubelib_addons1:liquidsampler_defect",
|
||||||
infotext_name = "Liquid Sampler",
|
infotext_name = S("Liquid Sampler"),
|
||||||
cycle_time = CYCLE_TIME,
|
cycle_time = CYCLE_TIME,
|
||||||
standby_ticks = STANDBY_TICKS,
|
standby_ticks = STANDBY_TICKS,
|
||||||
has_item_meter = true,
|
has_item_meter = true,
|
||||||
@ -128,7 +130,7 @@ local function on_receive_fields(pos, formname, fields, player)
|
|||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_node("tubelib_addons1:liquidsampler", {
|
minetest.register_node("tubelib_addons1:liquidsampler", {
|
||||||
description = "Liquid Sampler",
|
description = S("Liquid Sampler"),
|
||||||
tiles = {
|
tiles = {
|
||||||
-- up, down, right, left, back, front
|
-- up, down, right, left, back, front
|
||||||
'tubelib_front.png',
|
'tubelib_front.png',
|
||||||
@ -180,7 +182,7 @@ minetest.register_node("tubelib_addons1:liquidsampler", {
|
|||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("tubelib_addons1:liquidsampler_active", {
|
minetest.register_node("tubelib_addons1:liquidsampler_active", {
|
||||||
description = "Liquid Sampler",
|
description = S("Liquid Sampler"),
|
||||||
tiles = {
|
tiles = {
|
||||||
-- up, down, right, left, back, front
|
-- up, down, right, left, back, front
|
||||||
'tubelib_front.png',
|
'tubelib_front.png',
|
||||||
@ -216,7 +218,7 @@ minetest.register_node("tubelib_addons1:liquidsampler_active", {
|
|||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("tubelib_addons1:liquidsampler_defect", {
|
minetest.register_node("tubelib_addons1:liquidsampler_defect", {
|
||||||
description = "Liquid Sampler",
|
description = S("Liquid Sampler"),
|
||||||
tiles = {
|
tiles = {
|
||||||
-- up, down, right, left, back, front
|
-- up, down, right, left, back, front
|
||||||
'tubelib_front.png',
|
'tubelib_front.png',
|
||||||
|
@ -10,8 +10,6 @@
|
|||||||
|
|
||||||
]]--
|
]]--
|
||||||
|
|
||||||
tubelib_addons1 = {}
|
|
||||||
|
|
||||||
-- tables needed for Harvester
|
-- tables needed for Harvester
|
||||||
tubelib_addons1.FarmingNodes = {}
|
tubelib_addons1.FarmingNodes = {}
|
||||||
tubelib_addons1.Flowers = {}
|
tubelib_addons1.Flowers = {}
|
||||||
|
@ -29,8 +29,10 @@
|
|||||||
-- | |/
|
-- | |/
|
||||||
-- +--------+
|
-- +--------+
|
||||||
|
|
||||||
|
-- Load support for I18n
|
||||||
|
local S = tubelib_addons1.S
|
||||||
|
|
||||||
-- for lazy programmers
|
-- for lazy programmers
|
||||||
local S = function(pos) if pos then return minetest.pos_to_string(pos) end end
|
|
||||||
local P = minetest.string_to_pos
|
local P = minetest.string_to_pos
|
||||||
local M = minetest.get_meta
|
local M = minetest.get_meta
|
||||||
|
|
||||||
@ -42,7 +44,7 @@ local State = tubelib.NodeStates:new({
|
|||||||
node_name_passive = "tubelib_addons1:pusher_fast",
|
node_name_passive = "tubelib_addons1:pusher_fast",
|
||||||
node_name_active = "tubelib_addons1:pusher_fast_active",
|
node_name_active = "tubelib_addons1:pusher_fast_active",
|
||||||
node_name_defect = "tubelib_addons1:pusher_fast_defect",
|
node_name_defect = "tubelib_addons1:pusher_fast_defect",
|
||||||
infotext_name = "Fast Pusher",
|
infotext_name = S("Fast Pusher"),
|
||||||
cycle_time = CYCLE_TIME,
|
cycle_time = CYCLE_TIME,
|
||||||
standby_ticks = STANDBY_TICKS,
|
standby_ticks = STANDBY_TICKS,
|
||||||
has_item_meter = true,
|
has_item_meter = true,
|
||||||
@ -75,7 +77,7 @@ local function keep_running(pos, elapsed)
|
|||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_node("tubelib_addons1:pusher_fast", {
|
minetest.register_node("tubelib_addons1:pusher_fast", {
|
||||||
description = "Fast Pusher",
|
description = S("Fast Pusher"),
|
||||||
tiles = {
|
tiles = {
|
||||||
-- up, down, right, left, back, front
|
-- up, down, right, left, back, front
|
||||||
'tubelib_addons1_pusher.png',
|
'tubelib_addons1_pusher.png',
|
||||||
@ -117,7 +119,7 @@ minetest.register_node("tubelib_addons1:pusher_fast", {
|
|||||||
|
|
||||||
|
|
||||||
minetest.register_node("tubelib_addons1:pusher_fast_active", {
|
minetest.register_node("tubelib_addons1:pusher_fast_active", {
|
||||||
description = "Fast Pusher",
|
description = S("Fast Pusher"),
|
||||||
tiles = {
|
tiles = {
|
||||||
-- up, down, right, left, back, front
|
-- up, down, right, left, back, front
|
||||||
{
|
{
|
||||||
@ -182,7 +184,7 @@ minetest.register_node("tubelib_addons1:pusher_fast_active", {
|
|||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("tubelib_addons1:pusher_fast_defect", {
|
minetest.register_node("tubelib_addons1:pusher_fast_defect", {
|
||||||
description = "Fast Pusher",
|
description = S("Fast Pusher"),
|
||||||
tiles = {
|
tiles = {
|
||||||
-- up, down, right, left, back, front
|
-- up, down, right, left, back, front
|
||||||
'tubelib_addons1_pusher.png',
|
'tubelib_addons1_pusher.png',
|
||||||
|
@ -20,8 +20,11 @@
|
|||||||
|
|
||||||
]]--
|
]]--
|
||||||
|
|
||||||
|
-- Load support for I18n
|
||||||
|
local S = tubelib_addons1.S
|
||||||
|
|
||||||
-- for lazy programmers
|
-- for lazy programmers
|
||||||
local S = function(pos) if pos then return minetest.pos_to_string(pos) end end
|
local P2S = function(pos) if pos then return minetest.pos_to_string(pos) end end
|
||||||
local P = minetest.string_to_pos
|
local P = minetest.string_to_pos
|
||||||
local M = minetest.get_meta
|
local M = minetest.get_meta
|
||||||
|
|
||||||
@ -55,10 +58,10 @@ local function formspec(self, pos, meta)
|
|||||||
default.gui_bg_img..
|
default.gui_bg_img..
|
||||||
default.gui_slots..
|
default.gui_slots..
|
||||||
"dropdown[0,0;1.5;level;2,1,0,-1,-2,-3,-5,-10,-15,-20;"..Level2Idx[start_level].."]"..
|
"dropdown[0,0;1.5;level;2,1,0,-1,-2,-3,-5,-10,-15,-20;"..Level2Idx[start_level].."]"..
|
||||||
"label[1.6,0.2;Start level]"..
|
"label[1.6,0.2;"..S("Start level").."]"..
|
||||||
"dropdown[0,1;1.5;depth;1,2,3,5,10,15,20,25,50,100;"..Depth2Idx[depth].."]"..
|
"dropdown[0,1;1.5;depth;1,2,3,5,10,15,20,25,50,100;"..Depth2Idx[depth].."]"..
|
||||||
"label[1.6,1.2;Digging depth]"..
|
"label[1.6,1.2;"..S("Digging depth").."]"..
|
||||||
"checkbox[0,2;endless;Run endless;"..endless.."]"..
|
"checkbox[0,2;endless;"..S("Run endless")..";"..endless.."]"..
|
||||||
"list[context;main;5,0;4,4;]"..
|
"list[context;main;5,0;4,4;]"..
|
||||||
"list[context;fuel;1.5,3;1,1;]"..
|
"list[context;fuel;1.5,3;1,1;]"..
|
||||||
"item_image[1.5,3;1,1;tubelib_addons1:biofuel]"..
|
"item_image[1.5,3;1,1;tubelib_addons1:biofuel]"..
|
||||||
@ -74,7 +77,7 @@ local State = tubelib.NodeStates:new({
|
|||||||
node_name_passive = "tubelib_addons1:quarry",
|
node_name_passive = "tubelib_addons1:quarry",
|
||||||
node_name_active = "tubelib_addons1:quarry_active",
|
node_name_active = "tubelib_addons1:quarry_active",
|
||||||
node_name_defect = "tubelib_addons1:quarry_defect",
|
node_name_defect = "tubelib_addons1:quarry_defect",
|
||||||
infotext_name = "Tubelib Quarry",
|
infotext_name = S("Tubelib Quarry"),
|
||||||
cycle_time = CYCLE_TIME,
|
cycle_time = CYCLE_TIME,
|
||||||
standby_ticks = STANDBY_TICKS,
|
standby_ticks = STANDBY_TICKS,
|
||||||
has_item_meter = true,
|
has_item_meter = true,
|
||||||
@ -209,10 +212,10 @@ local function quarry_next_node(pos, meta)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
meta:set_int("idx", idx)
|
meta:set_int("idx", idx)
|
||||||
meta:set_string("quarry_pos", S(quarry_pos))
|
meta:set_string("quarry_pos", P2S(quarry_pos))
|
||||||
|
|
||||||
if minetest.is_protected(quarry_pos, owner) then
|
if minetest.is_protected(quarry_pos, owner) then
|
||||||
minetest.chat_send_player(owner, "[Tubelib Quarry] Area is protected!")
|
minetest.chat_send_player(owner, S("[Tubelib Quarry] Area is protected!"))
|
||||||
State:fault(pos, meta)
|
State:fault(pos, meta)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
@ -226,15 +229,15 @@ local function quarry_next_node(pos, meta)
|
|||||||
if inv:room_for_item("main", ItemStack(order.drop)) then
|
if inv:room_for_item("main", ItemStack(order.drop)) then
|
||||||
minetest.remove_node(quarry_pos)
|
minetest.remove_node(quarry_pos)
|
||||||
inv:add_item("main", ItemStack(order.drop))
|
inv:add_item("main", ItemStack(order.drop))
|
||||||
meta:set_string("infotext", "Tubelib Quarry "..number..
|
meta:set_string("infotext", S("Tubelib Quarry").." "..number..
|
||||||
": running "..idx.."/"..(start_y-quarry_pos.y+1))
|
": "..S("running").." "..idx.."/"..(start_y-quarry_pos.y+1))
|
||||||
State:keep_running(pos, meta, COUNTDOWN_TICKS, 1)
|
State:keep_running(pos, meta, COUNTDOWN_TICKS, 1)
|
||||||
else
|
else
|
||||||
State:blocked(pos, meta)
|
State:blocked(pos, meta)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
meta:set_string("infotext", "Tubelib Quarry "..number..
|
meta:set_string("infotext", S("Tubelib Quarry").." "..number..
|
||||||
": running "..idx.."/"..(start_y-quarry_pos.y+1))
|
": "..S("running").." "..idx.."/"..(start_y-quarry_pos.y+1))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -284,7 +287,7 @@ local function on_receive_fields(pos, formname, fields, player)
|
|||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_node("tubelib_addons1:quarry", {
|
minetest.register_node("tubelib_addons1:quarry", {
|
||||||
description = "Tubelib Quarry",
|
description = S("Tubelib Quarry"),
|
||||||
tiles = {
|
tiles = {
|
||||||
-- up, down, right, left, back, front
|
-- up, down, right, left, back, front
|
||||||
'tubelib_front.png',
|
'tubelib_front.png',
|
||||||
@ -336,7 +339,7 @@ minetest.register_node("tubelib_addons1:quarry", {
|
|||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("tubelib_addons1:quarry_active", {
|
minetest.register_node("tubelib_addons1:quarry_active", {
|
||||||
description = "Tubelib Quarry",
|
description = S("Tubelib Quarry"),
|
||||||
tiles = {
|
tiles = {
|
||||||
-- up, down, right, left, back, front
|
-- up, down, right, left, back, front
|
||||||
|
|
||||||
@ -374,7 +377,7 @@ minetest.register_node("tubelib_addons1:quarry_active", {
|
|||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("tubelib_addons1:quarry_defect", {
|
minetest.register_node("tubelib_addons1:quarry_defect", {
|
||||||
description = "Tubelib Quarry",
|
description = S("Tubelib Quarry"),
|
||||||
tiles = {
|
tiles = {
|
||||||
-- up, down, right, left, back, front
|
-- up, down, right, left, back, front
|
||||||
'tubelib_front.png',
|
'tubelib_front.png',
|
||||||
|
@ -15,8 +15,10 @@
|
|||||||
|
|
||||||
]]--
|
]]--
|
||||||
|
|
||||||
|
-- Load support for I18n
|
||||||
|
local S = tubelib_addons1.S
|
||||||
|
|
||||||
-- for lazy programmers
|
-- for lazy programmers
|
||||||
local S = function(pos) if pos then return minetest.pos_to_string(pos) end end
|
|
||||||
local P = minetest.string_to_pos
|
local P = minetest.string_to_pos
|
||||||
local M = minetest.get_meta
|
local M = minetest.get_meta
|
||||||
|
|
||||||
@ -46,7 +48,7 @@ end
|
|||||||
local State = tubelib.NodeStates:new({
|
local State = tubelib.NodeStates:new({
|
||||||
node_name_passive = "tubelib_addons1:reformer",
|
node_name_passive = "tubelib_addons1:reformer",
|
||||||
node_name_defect = "tubelib_addons1:reformer_defect",
|
node_name_defect = "tubelib_addons1:reformer_defect",
|
||||||
infotext_name = "Tubelib Reformer",
|
infotext_name = S("Tubelib Reformer"),
|
||||||
cycle_time = CYCLE_TIME,
|
cycle_time = CYCLE_TIME,
|
||||||
standby_ticks = STANDBY_TICKS,
|
standby_ticks = STANDBY_TICKS,
|
||||||
has_item_meter = true,
|
has_item_meter = true,
|
||||||
@ -157,7 +159,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
minetest.register_node("tubelib_addons1:reformer", {
|
minetest.register_node("tubelib_addons1:reformer", {
|
||||||
description = "Tubelib Reformer",
|
description = S("Tubelib Reformer"),
|
||||||
inventory_image = "tubelib_addons1_reformer_inventory.png",
|
inventory_image = "tubelib_addons1_reformer_inventory.png",
|
||||||
tiles = {
|
tiles = {
|
||||||
-- up, down, right, left, back, front
|
-- up, down, right, left, back, front
|
||||||
@ -188,7 +190,7 @@ minetest.register_node("tubelib_addons1:reformer", {
|
|||||||
State:node_init(pos, number)
|
State:node_init(pos, number)
|
||||||
else
|
else
|
||||||
minetest.remove_node(pos)
|
minetest.remove_node(pos)
|
||||||
minetest.chat_send_player(placer:get_player_name(), "Reformer will not fit there")
|
minetest.chat_send_player(placer:get_player_name(), S("Reformer will not fit there"))
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
@ -227,7 +229,7 @@ minetest.register_node("tubelib_addons1:reformer", {
|
|||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("tubelib_addons1:reformer_defect", {
|
minetest.register_node("tubelib_addons1:reformer_defect", {
|
||||||
description = "Tubelib Reformer defect",
|
description = S("Tubelib Reformer defect"),
|
||||||
inventory_image = "tubelib_addons1_reformer_inventory.png",
|
inventory_image = "tubelib_addons1_reformer_inventory.png",
|
||||||
tiles = {
|
tiles = {
|
||||||
-- up, down, right, left, back, front
|
-- up, down, right, left, back, front
|
||||||
@ -259,7 +261,7 @@ minetest.register_node("tubelib_addons1:reformer_defect", {
|
|||||||
State:defect(pos, M(pos))
|
State:defect(pos, M(pos))
|
||||||
else
|
else
|
||||||
minetest.remove_node(pos)
|
minetest.remove_node(pos)
|
||||||
minetest.chat_send_player(placer:get_player_name(), "Reformer will not fit there")
|
minetest.chat_send_player(placer:get_player_name(), S("Reformer will not fit there"))
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
@ -300,7 +302,7 @@ minetest.register_node("tubelib_addons1:reformer_defect", {
|
|||||||
|
|
||||||
|
|
||||||
minetest.register_node("tubelib_addons1:reformer_top", {
|
minetest.register_node("tubelib_addons1:reformer_top", {
|
||||||
description = "Tubelib Reformer Top",
|
description = S("Tubelib Reformer Top"),
|
||||||
tiles = {
|
tiles = {
|
||||||
-- up, down, right, left, back, front
|
-- up, down, right, left, back, front
|
||||||
'tubelib_front.png',
|
'tubelib_front.png',
|
||||||
@ -320,7 +322,7 @@ minetest.register_node("tubelib_addons1:reformer_top", {
|
|||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craftitem("tubelib_addons1:biofuel", {
|
minetest.register_craftitem("tubelib_addons1:biofuel", {
|
||||||
description = "Bio Fuel",
|
description = S("Bio Fuel"),
|
||||||
inventory_image = "tubelib_addons1_biofuel.png",
|
inventory_image = "tubelib_addons1_biofuel.png",
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -12,6 +12,9 @@
|
|||||||
|
|
||||||
]]--
|
]]--
|
||||||
|
|
||||||
|
-- Load support for I18n
|
||||||
|
local S = tubelib_addons2.S
|
||||||
|
|
||||||
local function switch_on(pos, meta)
|
local function switch_on(pos, meta)
|
||||||
if tubelib.data_not_corrupted(pos) then
|
if tubelib.data_not_corrupted(pos) then
|
||||||
minetest.sound_play("tubelib_addons2_door", {
|
minetest.sound_play("tubelib_addons2_door", {
|
||||||
@ -47,9 +50,9 @@ local function formspec1(numbers)
|
|||||||
default.gui_bg..
|
default.gui_bg..
|
||||||
default.gui_bg_img..
|
default.gui_bg_img..
|
||||||
default.gui_slots..
|
default.gui_slots..
|
||||||
"field[0.5,1;5,1;numbers;Door block numbers:;"..numbers.."]" ..
|
"field[0.5,1;5,1;numbers;"..S("Door block numbers:")..";"..numbers.."]" ..
|
||||||
"field[0.5,2.5;5,1;code;Access code (4 digits):;]" ..
|
"field[0.5,2.5;5,1;code;"..S("Access code (4 digits):")..";]" ..
|
||||||
"button_exit[1.5,3.5;2,1;exit;Save]"
|
"button_exit[1.5,3.5;2,1;exit;"..S("Save").."]"
|
||||||
end
|
end
|
||||||
|
|
||||||
local function formspec2(code)
|
local function formspec2(code)
|
||||||
@ -57,7 +60,7 @@ local function formspec2(code)
|
|||||||
default.gui_bg..
|
default.gui_bg..
|
||||||
default.gui_bg_img..
|
default.gui_bg_img..
|
||||||
default.gui_slots..
|
default.gui_slots..
|
||||||
"field[0.5,1;3.6,1;code;Enter access code;"..code.."]" ..
|
"field[0.5,1;3.6,1;code;"..S("Enter access code")..";"..code.."]" ..
|
||||||
"button[0.4,2;1,1;b1;1]" ..
|
"button[0.4,2;1,1;b1;1]" ..
|
||||||
"button[1.6,2;1,1;b2;2]" ..
|
"button[1.6,2;1,1;b2;2]" ..
|
||||||
"button[2.8,2;1,1;b3;3]" ..
|
"button[2.8,2;1,1;b3;3]" ..
|
||||||
@ -67,11 +70,11 @@ local function formspec2(code)
|
|||||||
"button[0.4,4;1,1;b7;7]" ..
|
"button[0.4,4;1,1;b7;7]" ..
|
||||||
"button[1.6,4;1,1;b8;8]" ..
|
"button[1.6,4;1,1;b8;8]" ..
|
||||||
"button[2.8,4;1,1;b9;9]" ..
|
"button[2.8,4;1,1;b9;9]" ..
|
||||||
"button_exit[1.6,5;1,1;ok;OK]"
|
"button_exit[1.6,5;1,1;ok;"..S("OK").."]"
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_node("tubelib_addons2:accesscontrol", {
|
minetest.register_node("tubelib_addons2:accesscontrol", {
|
||||||
description = "Tubelib Access Lock",
|
description = S("Tubelib Access Lock"),
|
||||||
tiles = {
|
tiles = {
|
||||||
-- up, down, right, left, back, front
|
-- up, down, right, left, back, front
|
||||||
'default_steel_block.png',
|
'default_steel_block.png',
|
||||||
@ -99,7 +102,7 @@ minetest.register_node("tubelib_addons2:accesscontrol", {
|
|||||||
meta:set_string("numbers", fields.numbers)
|
meta:set_string("numbers", fields.numbers)
|
||||||
meta:set_string("code", fields.code)
|
meta:set_string("code", fields.code)
|
||||||
meta:mark_as_private("code")
|
meta:mark_as_private("code")
|
||||||
meta:set_string("infotext", "Tubelib Access Lock, Enter access code")
|
meta:set_string("infotext", S("Tubelib Access Lock, Enter access code"))
|
||||||
meta:set_string("formspec", formspec2(""))
|
meta:set_string("formspec", formspec2(""))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -12,6 +12,8 @@
|
|||||||
|
|
||||||
]]--
|
]]--
|
||||||
|
|
||||||
|
-- Load support for I18n
|
||||||
|
local S = tubelib_addons2.S
|
||||||
|
|
||||||
local function switch_on(pos, node)
|
local function switch_on(pos, node)
|
||||||
node.name = "tubelib_addons2:ceilinglamp_on"
|
node.name = "tubelib_addons2:ceilinglamp_on"
|
||||||
@ -27,7 +29,7 @@ local function switch_off(pos, node)
|
|||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_node("tubelib_addons2:ceilinglamp", {
|
minetest.register_node("tubelib_addons2:ceilinglamp", {
|
||||||
description = "Tubelib Ceiling Lamp",
|
description = S("Tubelib Ceiling Lamp"),
|
||||||
tiles = {
|
tiles = {
|
||||||
-- up, down, right, left, back, front
|
-- up, down, right, left, back, front
|
||||||
'tubelib_addons2_ceilinglamp_top.png',
|
'tubelib_addons2_ceilinglamp_top.png',
|
||||||
@ -53,7 +55,7 @@ minetest.register_node("tubelib_addons2:ceilinglamp", {
|
|||||||
after_place_node = function(pos, placer)
|
after_place_node = function(pos, placer)
|
||||||
local number = tubelib.add_node(pos, "tubelib_addons2:ceilinglamp")
|
local number = tubelib.add_node(pos, "tubelib_addons2:ceilinglamp")
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
meta:set_string("infotext", "Tubelib Ceiling Lamp "..number)
|
meta:set_string("infotext", S("Tubelib Ceiling Lamp").." "..number)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
on_rightclick = function(pos, node, clicker)
|
on_rightclick = function(pos, node, clicker)
|
||||||
@ -76,7 +78,7 @@ minetest.register_node("tubelib_addons2:ceilinglamp", {
|
|||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("tubelib_addons2:ceilinglamp_on", {
|
minetest.register_node("tubelib_addons2:ceilinglamp_on", {
|
||||||
description = "Tubelib Ceiling Lamp",
|
description = S("Tubelib Ceiling Lamp"),
|
||||||
tiles = {
|
tiles = {
|
||||||
-- up, down, right, left, back, front
|
-- up, down, right, left, back, front
|
||||||
'tubelib_addons2_ceilinglamp_top.png',
|
'tubelib_addons2_ceilinglamp_top.png',
|
||||||
|
@ -12,6 +12,9 @@
|
|||||||
|
|
||||||
]]--
|
]]--
|
||||||
|
|
||||||
|
-- Load support for I18n
|
||||||
|
local S = tubelib_addons2.S
|
||||||
|
|
||||||
local tColors = {"#0000FF", "#00FFFF", "#00FF00", "#FFFF00", "#FF0000", "#FF00FF",
|
local tColors = {"#0000FF", "#00FFFF", "#00FF00", "#FFFF00", "#FF0000", "#FF00FF",
|
||||||
"#FFFFFF", "#000000", "#3BC23B", "#CA3131", "#FFA500", "#FFC0CB"}
|
"#FFFFFF", "#000000", "#3BC23B", "#CA3131", "#FFA500", "#FFC0CB"}
|
||||||
local sColor = "1,2,3,4,5,6,7,8,9,10,11,12"
|
local sColor = "1,2,3,4,5,6,7,8,9,10,11,12"
|
||||||
@ -24,7 +27,7 @@ local function switch_node(pos, num, player)
|
|||||||
minetest.swap_node(pos, node)
|
minetest.swap_node(pos, node)
|
||||||
local number = meta:get_int("number")
|
local number = meta:get_int("number")
|
||||||
number = string.format("%.04u", number)
|
number = string.format("%.04u", number)
|
||||||
meta:set_string("infotext", "Tubelib Color Lamp "..number)
|
meta:set_string("infotext", S("Tubelib Color Lamp").." "..number)
|
||||||
if num ~= "" then
|
if num ~= "" then
|
||||||
meta:set_int("color", num)
|
meta:set_int("color", num)
|
||||||
end
|
end
|
||||||
@ -32,7 +35,7 @@ local function switch_node(pos, num, player)
|
|||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_node("tubelib_addons2:lamp", {
|
minetest.register_node("tubelib_addons2:lamp", {
|
||||||
description = "Tubelib Color Lamp",
|
description = S("Tubelib Color Lamp"),
|
||||||
tiles = {"tubelib_addons2_lamp.png^[colorize:#000000:100"},
|
tiles = {"tubelib_addons2_lamp.png^[colorize:#000000:100"},
|
||||||
|
|
||||||
after_place_node = function(pos, placer)
|
after_place_node = function(pos, placer)
|
||||||
@ -43,7 +46,7 @@ minetest.register_node("tubelib_addons2:lamp", {
|
|||||||
meta:set_string("formspec", "size[3,2]"..
|
meta:set_string("formspec", "size[3,2]"..
|
||||||
"label[0,0;Select color]"..
|
"label[0,0;Select color]"..
|
||||||
"dropdown[0,0.5;3;type;"..sColor..";1]"..
|
"dropdown[0,0.5;3;type;"..sColor..";1]"..
|
||||||
"button_exit[0.5,1.5;2,1;exit;Save]")
|
"button_exit[0.5,1.5;2,1;exit;"..S("Save").."]")
|
||||||
meta:set_int("color", 1)
|
meta:set_int("color", 1)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
@ -96,7 +99,7 @@ minetest.register_craft({
|
|||||||
|
|
||||||
for idx,color in ipairs(tColors) do
|
for idx,color in ipairs(tColors) do
|
||||||
minetest.register_node("tubelib_addons2:lamp"..idx, {
|
minetest.register_node("tubelib_addons2:lamp"..idx, {
|
||||||
description = "Tubelib Color Lamp",
|
description = S("Tubelib Color Lamp"),
|
||||||
tiles = {
|
tiles = {
|
||||||
"tubelib_addons2_lamp.png^[colorize:"..color..":120",
|
"tubelib_addons2_lamp.png^[colorize:"..color..":120",
|
||||||
},
|
},
|
||||||
|
@ -12,6 +12,9 @@
|
|||||||
|
|
||||||
]]--
|
]]--
|
||||||
|
|
||||||
|
-- Load support for I18n
|
||||||
|
local S = tubelib_addons2.S
|
||||||
|
|
||||||
local function switch_on(pos, node, player)
|
local function switch_on(pos, node, player)
|
||||||
if player == nil or not minetest.is_protected(pos, player:get_player_name()) then
|
if player == nil or not minetest.is_protected(pos, player:get_player_name()) then
|
||||||
node.name = "tubelib_addons2:lamp_on"
|
node.name = "tubelib_addons2:lamp_on"
|
||||||
@ -27,13 +30,13 @@ local function switch_off(pos, node, player)
|
|||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_node("tubelib_addons2:lamp_off", {
|
minetest.register_node("tubelib_addons2:lamp_off", {
|
||||||
description = "Tubelib Color Lamp",
|
description = S("Tubelib Color Lamp"),
|
||||||
tiles = {"tubelib_addons2_lamp.png^[colorize:#000000:100"},
|
tiles = {"tubelib_addons2_lamp.png^[colorize:#000000:100"},
|
||||||
|
|
||||||
after_place_node = function(pos, placer, itemstack, pointed_thing)
|
after_place_node = function(pos, placer, itemstack, pointed_thing)
|
||||||
local number = tubelib.add_node(pos, "tubelib_addons2:lamp_off")
|
local number = tubelib.add_node(pos, "tubelib_addons2:lamp_off")
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
meta:set_string("infotext", "Tubelib Color Lamp "..number)
|
meta:set_string("infotext", S("Tubelib Color Lamp").." "..number)
|
||||||
unifieddyes.recolor_on_place(pos, placer, itemstack, pointed_thing)
|
unifieddyes.recolor_on_place(pos, placer, itemstack, pointed_thing)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
@ -60,7 +63,7 @@ minetest.register_node("tubelib_addons2:lamp_off", {
|
|||||||
|
|
||||||
|
|
||||||
minetest.register_node("tubelib_addons2:lamp_on", {
|
minetest.register_node("tubelib_addons2:lamp_on", {
|
||||||
description = "Tubelib Color Lamp",
|
description = S("Tubelib Color Lamp"),
|
||||||
tiles = {"tubelib_addons2_lamp.png"},
|
tiles = {"tubelib_addons2_lamp.png"},
|
||||||
|
|
||||||
on_rightclick = switch_off,
|
on_rightclick = switch_off,
|
||||||
@ -108,7 +111,7 @@ minetest.register_craft({
|
|||||||
--
|
--
|
||||||
for idx=1,12 do
|
for idx=1,12 do
|
||||||
minetest.register_node("tubelib_addons2:lamp"..idx, {
|
minetest.register_node("tubelib_addons2:lamp"..idx, {
|
||||||
description = "Tubelib Color Lamp "..idx,
|
description = S("Tubelib Color Lamp").." "..idx,
|
||||||
tiles = {"tubelib_addons2_lamp.png"},
|
tiles = {"tubelib_addons2_lamp.png"},
|
||||||
paramtype = 'light',
|
paramtype = 'light',
|
||||||
groups = {choppy=2, cracky=1, not_in_creative_inventory=1},
|
groups = {choppy=2, cracky=1, not_in_creative_inventory=1},
|
||||||
@ -143,7 +146,7 @@ minetest.register_lbm({
|
|||||||
minetest.swap_node(pos, node)
|
minetest.swap_node(pos, node)
|
||||||
local number = meta:get_int("number") or 0
|
local number = meta:get_int("number") or 0
|
||||||
number = string.format("%.04u", number)
|
number = string.format("%.04u", number)
|
||||||
meta:set_string("infotext", "Tubelib Color Lamp "..number)
|
meta:set_string("infotext", S("Tubelib Color Lamp").." "..number)
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -12,6 +12,9 @@
|
|||||||
|
|
||||||
]]--
|
]]--
|
||||||
|
|
||||||
|
-- Load support for I18n
|
||||||
|
local S = tubelib_addons2.S
|
||||||
|
|
||||||
local sTextures = "Gate Wood,Aspen Wood,Jungle Wood,Pine Wood,"..
|
local sTextures = "Gate Wood,Aspen Wood,Jungle Wood,Pine Wood,"..
|
||||||
"Cobblestone,Sandstone,Stone,Desert Sandstone,"..
|
"Cobblestone,Sandstone,Stone,Desert Sandstone,"..
|
||||||
"Copper,Steel,Tin,Coral,"..
|
"Copper,Steel,Tin,Coral,"..
|
||||||
@ -32,7 +35,7 @@ local tPgns = {"tubelib_addon2_door.png", "default_aspen_wood.png", "default_jun
|
|||||||
local not_in_inventory=nil
|
local not_in_inventory=nil
|
||||||
for idx,pgn in ipairs(tPgns) do
|
for idx,pgn in ipairs(tPgns) do
|
||||||
minetest.register_node("tubelib_addons2:doorblock"..idx, {
|
minetest.register_node("tubelib_addons2:doorblock"..idx, {
|
||||||
description = "Tubelib Door Block",
|
description = S("Tubelib Door Block"),
|
||||||
tiles = {
|
tiles = {
|
||||||
pgn.."^[transformR90",
|
pgn.."^[transformR90",
|
||||||
pgn,
|
pgn,
|
||||||
@ -54,11 +57,11 @@ for idx,pgn in ipairs(tPgns) do
|
|||||||
local node = minetest.get_node(pos)
|
local node = minetest.get_node(pos)
|
||||||
local number = tubelib.add_node(pos, node.name)
|
local number = tubelib.add_node(pos, node.name)
|
||||||
meta:set_string("number", number)
|
meta:set_string("number", number)
|
||||||
meta:set_string("infotext", "Tubelib Door Block "..number)
|
meta:set_string("infotext", S("Tubelib Door Block").." "..number)
|
||||||
meta:set_string("formspec", "size[3,2]"..
|
meta:set_string("formspec", "size[3,2]"..
|
||||||
"label[0,0;Select texture]"..
|
"label[0,0;"..S("Select texture").."]"..
|
||||||
"dropdown[0,0.5;3;type;"..sTextures..";1]"..
|
"dropdown[0,0.5;3;type;"..sTextures..";1]"..
|
||||||
"button_exit[0.5,1.5;2,1;exit;Save]")
|
"button_exit[0.5,1.5;2,1;exit;"..S("Save").."]")
|
||||||
end,
|
end,
|
||||||
|
|
||||||
on_receive_fields = function(pos, formname, fields, player)
|
on_receive_fields = function(pos, formname, fields, player)
|
||||||
|
@ -12,6 +12,9 @@
|
|||||||
|
|
||||||
]]--
|
]]--
|
||||||
|
|
||||||
|
-- Load support for I18n
|
||||||
|
local S = tubelib_addons2.S
|
||||||
|
|
||||||
local NUM_TEXTURES = 20
|
local NUM_TEXTURES = 20
|
||||||
|
|
||||||
local sTextures = "Wood,Aspen Wood,Jungle Wood,Pine Wood,"..
|
local sTextures = "Wood,Aspen Wood,Jungle Wood,Pine Wood,"..
|
||||||
@ -37,18 +40,18 @@ local tPgns = {"default_wood.png", "default_aspen_wood.png", "default_junglewood
|
|||||||
local not_in_inventory=nil
|
local not_in_inventory=nil
|
||||||
for idx,pgn in ipairs(tPgns) do
|
for idx,pgn in ipairs(tPgns) do
|
||||||
minetest.register_node("tubelib_addons2:gateblock"..idx, {
|
minetest.register_node("tubelib_addons2:gateblock"..idx, {
|
||||||
description = "Tubelib Gate Block",
|
description = S("Tubelib Gate Block"),
|
||||||
tiles = {pgn},
|
tiles = {pgn},
|
||||||
after_place_node = function(pos, placer)
|
after_place_node = function(pos, placer)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
local node = minetest.get_node(pos)
|
local node = minetest.get_node(pos)
|
||||||
local number = tubelib.add_node(pos, node.name)
|
local number = tubelib.add_node(pos, node.name)
|
||||||
meta:set_string("number", number)
|
meta:set_string("number", number)
|
||||||
meta:set_string("infotext", "Tubelib Gate Block "..number)
|
meta:set_string("infotext", S("Tubelib Gate Block").." "..number)
|
||||||
meta:set_string("formspec", "size[3,2]"..
|
meta:set_string("formspec", "size[3,2]"..
|
||||||
"label[0,0;Select texture]"..
|
"label[0,0;Select texture]"..
|
||||||
"dropdown[0,0.5;3;type;"..sTextures..";"..NUM_TEXTURES.."]"..
|
"dropdown[0,0.5;3;type;"..sTextures..";"..NUM_TEXTURES.."]"..
|
||||||
"button_exit[0.5,1.5;2,1;exit;Save]")
|
"button_exit[0.5,1.5;2,1;exit;"..S("Save").."]")
|
||||||
end,
|
end,
|
||||||
|
|
||||||
on_receive_fields = function(pos, formname, fields, player)
|
on_receive_fields = function(pos, formname, fields, player)
|
||||||
|
@ -12,6 +12,9 @@
|
|||||||
|
|
||||||
]]--
|
]]--
|
||||||
|
|
||||||
|
-- Load support for I18n
|
||||||
|
local S = tubelib_addons2.S
|
||||||
|
|
||||||
local function switch_on(pos, node)
|
local function switch_on(pos, node)
|
||||||
if string.sub(node.name, -3) ~= "_on" then
|
if string.sub(node.name, -3) ~= "_on" then
|
||||||
node.name = node.name.."_on"
|
node.name = node.name.."_on"
|
||||||
@ -32,7 +35,7 @@ end
|
|||||||
local function register_lamp(tbl)
|
local function register_lamp(tbl)
|
||||||
local num, tiles, tiles_on, node_box, size = tbl.num, tbl.tiles, tbl.tiles_on, tbl.node_box, tbl.size
|
local num, tiles, tiles_on, node_box, size = tbl.num, tbl.tiles, tbl.tiles_on, tbl.node_box, tbl.size
|
||||||
minetest.register_node("tubelib_addons2:industriallamp"..num, {
|
minetest.register_node("tubelib_addons2:industriallamp"..num, {
|
||||||
description = "Tubelib Industrial Lamp "..num,
|
description = S("Tubelib Industrial Lamp").." "..num,
|
||||||
tiles = tiles,
|
tiles = tiles,
|
||||||
drawtype = "nodebox",
|
drawtype = "nodebox",
|
||||||
node_box = node_box,
|
node_box = node_box,
|
||||||
@ -48,7 +51,7 @@ local function register_lamp(tbl)
|
|||||||
after_place_node = function(pos, placer)
|
after_place_node = function(pos, placer)
|
||||||
local number = tubelib.add_node(pos, "tubelib_addons2:industriallamp"..num)
|
local number = tubelib.add_node(pos, "tubelib_addons2:industriallamp"..num)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
meta:set_string("infotext", "Tubelib Industrial Lamp "..num..": "..number)
|
meta:set_string("infotext", S("Tubelib Industrial Lamp").." "..num..": "..number)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
on_rightclick = function(pos, node, clicker)
|
on_rightclick = function(pos, node, clicker)
|
||||||
@ -72,7 +75,7 @@ local function register_lamp(tbl)
|
|||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("tubelib_addons2:industriallamp"..num.."_on", {
|
minetest.register_node("tubelib_addons2:industriallamp"..num.."_on", {
|
||||||
description = "Tubelib Industrial Lamp "..num,
|
description = S("Tubelib Industrial Lamp").." "..num,
|
||||||
tiles = tiles_on,
|
tiles = tiles_on,
|
||||||
drawtype = "nodebox",
|
drawtype = "nodebox",
|
||||||
node_box = node_box,
|
node_box = node_box,
|
||||||
@ -87,7 +90,7 @@ local function register_lamp(tbl)
|
|||||||
after_place_node = function(pos, placer)
|
after_place_node = function(pos, placer)
|
||||||
local number = tubelib.add_node(pos, "tubelib_addons2:industriallamp"..num)
|
local number = tubelib.add_node(pos, "tubelib_addons2:industriallamp"..num)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
meta:set_string("infotext", "Tubelib Industrial Lamp "..num..": "..number)
|
meta:set_string("infotext", S("Tubelib Industrial Lamp").." "..num..": "..number)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
on_rightclick = function(pos, node, clicker)
|
on_rightclick = function(pos, node, clicker)
|
||||||
|
@ -10,6 +10,12 @@
|
|||||||
|
|
||||||
]]--
|
]]--
|
||||||
|
|
||||||
|
tubelib_addons2 = {}
|
||||||
|
|
||||||
|
|
||||||
|
-- Load support for I18n
|
||||||
|
tubelib_addons2.S = minetest.get_translator("tubelib_addons2")
|
||||||
|
|
||||||
dofile(minetest.get_modpath("tubelib_addons2") .. "/timer.lua")
|
dofile(minetest.get_modpath("tubelib_addons2") .. "/timer.lua")
|
||||||
dofile(minetest.get_modpath("tubelib_addons2") .. "/sequencer.lua")
|
dofile(minetest.get_modpath("tubelib_addons2") .. "/sequencer.lua")
|
||||||
dofile(minetest.get_modpath("tubelib_addons2") .. "/gateblock.lua")
|
dofile(minetest.get_modpath("tubelib_addons2") .. "/gateblock.lua")
|
||||||
@ -23,7 +29,7 @@ dofile(minetest.get_modpath("tubelib_addons2") .. "/ceilinglamp.lua")
|
|||||||
dofile(minetest.get_modpath("tubelib_addons2") .. "/invisiblelamp.lua")
|
dofile(minetest.get_modpath("tubelib_addons2") .. "/invisiblelamp.lua")
|
||||||
dofile(minetest.get_modpath("tubelib_addons2") .. "/industriallamp.lua")
|
dofile(minetest.get_modpath("tubelib_addons2") .. "/industriallamp.lua")
|
||||||
|
|
||||||
if minetest.get_modpath("mesecons") and mesecon then
|
if minetest.get_modpath("mesecons") and minetest.mesecon then
|
||||||
dofile(minetest.get_modpath("tubelib_addons2") .. "/mesecons_converter.lua")
|
dofile(minetest.get_modpath("tubelib_addons2") .. "/mesecons_converter.lua")
|
||||||
end
|
end
|
||||||
if minetest.get_modpath("unifieddyes") and unifieddyes then
|
if minetest.get_modpath("unifieddyes") and unifieddyes then
|
||||||
|
@ -12,6 +12,8 @@
|
|||||||
|
|
||||||
]]--
|
]]--
|
||||||
|
|
||||||
|
-- Load support for I18n
|
||||||
|
local S = tubelib_addons2.S
|
||||||
|
|
||||||
local function switch_on(pos, node)
|
local function switch_on(pos, node)
|
||||||
node.name = "tubelib_addons2:invisiblelamp_on"
|
node.name = "tubelib_addons2:invisiblelamp_on"
|
||||||
@ -27,7 +29,7 @@ local function switch_off(pos, node)
|
|||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_node("tubelib_addons2:invisiblelamp", {
|
minetest.register_node("tubelib_addons2:invisiblelamp", {
|
||||||
description = "Tubelib Invisible Lamp",
|
description = S("Tubelib Invisible Lamp"),
|
||||||
drawtype = "glasslike_framed_optional",
|
drawtype = "glasslike_framed_optional",
|
||||||
tiles = {"tubelib_addons2_invisiblelamp.png"},
|
tiles = {"tubelib_addons2_invisiblelamp.png"},
|
||||||
inventory_image = 'tubelib_addons2_invisiblelamp_inventory.png',
|
inventory_image = 'tubelib_addons2_invisiblelamp_inventory.png',
|
||||||
@ -35,7 +37,7 @@ minetest.register_node("tubelib_addons2:invisiblelamp", {
|
|||||||
after_place_node = function(pos, placer)
|
after_place_node = function(pos, placer)
|
||||||
local number = tubelib.add_node(pos, "tubelib_addons2:invisiblelamp")
|
local number = tubelib.add_node(pos, "tubelib_addons2:invisiblelamp")
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
meta:set_string("infotext", "Tubelib Invisible Lamp "..number)
|
meta:set_string("infotext", S("Tubelib Invisible Lamp").." "..number)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
on_rightclick = function(pos, node, clicker)
|
on_rightclick = function(pos, node, clicker)
|
||||||
@ -58,7 +60,7 @@ minetest.register_node("tubelib_addons2:invisiblelamp", {
|
|||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("tubelib_addons2:invisiblelamp_on", {
|
minetest.register_node("tubelib_addons2:invisiblelamp_on", {
|
||||||
description = "Tubelib Invisible Lamp",
|
description = S("Tubelib Invisible Lamp"),
|
||||||
drawtype = "glasslike_framed_optional",
|
drawtype = "glasslike_framed_optional",
|
||||||
tiles = {"tubelib_addons2_invisiblelamp.png"},
|
tiles = {"tubelib_addons2_invisiblelamp.png"},
|
||||||
|
|
||||||
|
@ -12,15 +12,18 @@
|
|||||||
|
|
||||||
]]--
|
]]--
|
||||||
|
|
||||||
|
-- Load support for I18n
|
||||||
|
local S = tubelib_addons2.S
|
||||||
|
|
||||||
local function formspec(meta)
|
local function formspec(meta)
|
||||||
local numbers = meta:get_string("numbers")
|
local numbers = meta:get_string("numbers")
|
||||||
return "size[7,5]"..
|
return "size[7,5]"..
|
||||||
"field[0.5,2;6,1;number;Destination node numbers;"..numbers.."]" ..
|
"field[0.5,2;6,1;number;"..S("Destination node numbers")..";"..numbers.."]" ..
|
||||||
"button_exit[1,3;2,1;exit;Save]"
|
"button_exit[1,3;2,1;exit;"..S("Save").."]"
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_node("tubelib_addons2:logic_not", {
|
minetest.register_node("tubelib_addons2:logic_not", {
|
||||||
description = "Tubelib Logic Not",
|
description = S("Tubelib Logic Not"),
|
||||||
tiles = {
|
tiles = {
|
||||||
-- up, down, right, left, back, front
|
-- up, down, right, left, back, front
|
||||||
'tubelib_front.png',
|
'tubelib_front.png',
|
||||||
@ -33,7 +36,7 @@ minetest.register_node("tubelib_addons2:logic_not", {
|
|||||||
local own_number = tubelib.add_node(pos, "tubelib_addons2:logic_not")
|
local own_number = tubelib.add_node(pos, "tubelib_addons2:logic_not")
|
||||||
meta:set_string("own_number", own_number)
|
meta:set_string("own_number", own_number)
|
||||||
meta:set_string("formspec", formspec(meta))
|
meta:set_string("formspec", formspec(meta))
|
||||||
meta:set_string("infotext", "Tubelib Logic Not "..own_number..": not connected")
|
meta:set_string("infotext", S("Tubelib Logic Not").." "..own_number..S(": not connected"))
|
||||||
meta:set_string("owner", placer:get_player_name())
|
meta:set_string("owner", placer:get_player_name())
|
||||||
end,
|
end,
|
||||||
|
|
||||||
@ -47,7 +50,7 @@ minetest.register_node("tubelib_addons2:logic_not", {
|
|||||||
if tubelib.check_numbers(fields.number) then
|
if tubelib.check_numbers(fields.number) then
|
||||||
meta:set_string("numbers", fields.number)
|
meta:set_string("numbers", fields.number)
|
||||||
local own_number = meta:get_string("own_number")
|
local own_number = meta:get_string("own_number")
|
||||||
meta:set_string("infotext", "Tubelib Logic Not "..own_number..": connected with "..fields.number)
|
meta:set_string("infotext", S("Tubelib Logic Not").." "..own_number..S(": connected with").." "..fields.number)
|
||||||
meta:set_string("formspec", formspec(meta))
|
meta:set_string("formspec", formspec(meta))
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
@ -82,7 +85,7 @@ tubelib.register_node("tubelib_addons2:logic_not", {}, {
|
|||||||
local numbers = meta:get_string("numbers")
|
local numbers = meta:get_string("numbers")
|
||||||
local own_number = meta:get_string("own_number")
|
local own_number = meta:get_string("own_number")
|
||||||
if topic == "set_numbers" then
|
if topic == "set_numbers" then
|
||||||
meta:set_string("infotext", "Tubelib Logic Not "..own_number..": connected with "..payload)
|
meta:set_string("infotext", S("Tubelib Logic Not").." "..own_number..S(": connected with").." "..payload)
|
||||||
meta:set_string("numbers", payload)
|
meta:set_string("numbers", payload)
|
||||||
meta:set_string("formspec", formspec(meta))
|
meta:set_string("formspec", formspec(meta))
|
||||||
return true
|
return true
|
||||||
|
@ -12,13 +12,16 @@
|
|||||||
|
|
||||||
]]--
|
]]--
|
||||||
|
|
||||||
|
-- Load support for I18n
|
||||||
|
local S = tubelib_addons2.S
|
||||||
|
|
||||||
local OVER_LOAD_MAX = 5
|
local OVER_LOAD_MAX = 5
|
||||||
|
|
||||||
local function formspec(meta)
|
local function formspec(meta)
|
||||||
local numbers = meta:get_string("numbers")
|
local numbers = meta:get_string("numbers")
|
||||||
return "size[7,5]"..
|
return "size[7,5]"..
|
||||||
"field[0.5,2;6,1;number;Destination node numbers;"..numbers.."]" ..
|
"field[0.5,2;6,1;number;"..S("Destination node numbers")..";"..numbers.."]" ..
|
||||||
"button_exit[1,3;2,1;exit;Save]"
|
"button_exit[1,3;2,1;exit;"..S("Save").."]"
|
||||||
end
|
end
|
||||||
|
|
||||||
local function send_message(pos, topic, payload)
|
local function send_message(pos, topic, payload)
|
||||||
@ -29,7 +32,7 @@ local function send_message(pos, topic, payload)
|
|||||||
meta:set_int("overload_cnt", overload_cnt)
|
meta:set_int("overload_cnt", overload_cnt)
|
||||||
if overload_cnt > OVER_LOAD_MAX then
|
if overload_cnt > OVER_LOAD_MAX then
|
||||||
local own_number = meta:get_string("own_number")
|
local own_number = meta:get_string("own_number")
|
||||||
meta:set_string("infotext", "Tubelib Mesecons Converter "..own_number..": fault (overloaded)")
|
meta:set_string("infotext", S("Tubelib Mesecons Converter").." "..own_number..S(": fault (overloaded)"))
|
||||||
minetest.get_node_timer(pos):stop()
|
minetest.get_node_timer(pos):stop()
|
||||||
return
|
return
|
||||||
else
|
else
|
||||||
@ -42,7 +45,7 @@ local function send_message(pos, topic, payload)
|
|||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_node("tubelib_addons2:mesecons_converter", {
|
minetest.register_node("tubelib_addons2:mesecons_converter", {
|
||||||
description = "Tubelib Mesecons Converter",
|
description = S("Tubelib Mesecons Converter"),
|
||||||
tiles = {
|
tiles = {
|
||||||
-- up, down, right, left, back, front
|
-- up, down, right, left, back, front
|
||||||
'tubelib_front.png',
|
'tubelib_front.png',
|
||||||
@ -55,7 +58,7 @@ minetest.register_node("tubelib_addons2:mesecons_converter", {
|
|||||||
local own_number = tubelib.add_node(pos, "tubelib_addons2:mesecons_converter")
|
local own_number = tubelib.add_node(pos, "tubelib_addons2:mesecons_converter")
|
||||||
meta:set_string("own_number", own_number)
|
meta:set_string("own_number", own_number)
|
||||||
meta:set_string("formspec", formspec(meta))
|
meta:set_string("formspec", formspec(meta))
|
||||||
meta:set_string("infotext", "Tubelib Mesecons Converter "..own_number..": not connected")
|
meta:set_string("infotext", S("Tubelib Mesecons Converter").." "..own_number..S(": not connected"))
|
||||||
meta:set_string("owner", placer:get_player_name())
|
meta:set_string("owner", placer:get_player_name())
|
||||||
-- send_message is called 24 times after the node is placed
|
-- send_message is called 24 times after the node is placed
|
||||||
meta:set_int("overload_cnt", -24)
|
meta:set_int("overload_cnt", -24)
|
||||||
@ -72,7 +75,7 @@ minetest.register_node("tubelib_addons2:mesecons_converter", {
|
|||||||
if tubelib.check_numbers(fields.number) then
|
if tubelib.check_numbers(fields.number) then
|
||||||
meta:set_string("numbers", fields.number)
|
meta:set_string("numbers", fields.number)
|
||||||
local own_number = meta:get_string("own_number")
|
local own_number = meta:get_string("own_number")
|
||||||
meta:set_string("infotext", "Tubelib Mesecons Converter "..own_number..": connected with "..fields.number)
|
meta:set_string("infotext", S("Tubelib Mesecons Converter").." "..own_number..S(": connected with").." "..fields.number)
|
||||||
meta:set_string("formspec", formspec(meta))
|
meta:set_string("formspec", formspec(meta))
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -145,7 +148,7 @@ tubelib.register_node("tubelib_addons2:mesecons_converter", {}, {
|
|||||||
elseif topic == "set_numbers" then
|
elseif topic == "set_numbers" then
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
local own_number = meta:get_string("own_number")
|
local own_number = meta:get_string("own_number")
|
||||||
meta:set_string("infotext", "Tubelib Mesecons Converter "..own_number..": connected with "..payload)
|
meta:set_string("infotext", S("Tubelib Mesecons Converter").." "..own_number..S(": connected with").." "..payload)
|
||||||
meta:set_string("numbers", payload)
|
meta:set_string("numbers", payload)
|
||||||
meta:set_string("formspec", formspec(meta))
|
meta:set_string("formspec", formspec(meta))
|
||||||
end
|
end
|
||||||
|
@ -12,6 +12,9 @@
|
|||||||
|
|
||||||
]]--
|
]]--
|
||||||
|
|
||||||
|
-- Load support for I18n
|
||||||
|
local S = tubelib_addons2.S
|
||||||
|
|
||||||
local function join_to_string(tbl)
|
local function join_to_string(tbl)
|
||||||
local t = {}
|
local t = {}
|
||||||
for key,_ in pairs(tbl) do
|
for key,_ in pairs(tbl) do
|
||||||
@ -23,7 +26,7 @@ end
|
|||||||
|
|
||||||
local function reset_programmer(itemstack, user, pointed_thing)
|
local function reset_programmer(itemstack, user, pointed_thing)
|
||||||
user:set_attribute("tubelib_prog_numbers", nil)
|
user:set_attribute("tubelib_prog_numbers", nil)
|
||||||
minetest.chat_send_player(user:get_player_name(), "[Tubelib Programmer] programmer reset")
|
minetest.chat_send_player(user:get_player_name(), S("[Tubelib Programmer] programmer reset"))
|
||||||
return itemstack
|
return itemstack
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -35,9 +38,9 @@ local function read_number(itemstack, user, pointed_thing)
|
|||||||
local numbers = minetest.deserialize(user:get_attribute("tubelib_prog_numbers")) or {}
|
local numbers = minetest.deserialize(user:get_attribute("tubelib_prog_numbers")) or {}
|
||||||
numbers[number] = true
|
numbers[number] = true
|
||||||
user:set_attribute("tubelib_prog_numbers", minetest.serialize(numbers))
|
user:set_attribute("tubelib_prog_numbers", minetest.serialize(numbers))
|
||||||
minetest.chat_send_player(user:get_player_name(), "[Tubelib Programmer] number "..number.." read")
|
minetest.chat_send_player(user:get_player_name(), S("[Tubelib Programmer] number").." "..number.." "..S("read"))
|
||||||
else
|
else
|
||||||
minetest.chat_send_player(user:get_player_name(), "[Tubelib Programmer] Unknown node on "..minetest.pos_to_string(pos))
|
minetest.chat_send_player(user:get_player_name(), S("[Tubelib Programmer] Unknown node on").." "..minetest.pos_to_string(pos))
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
return reset_programmer(itemstack, user, pointed_thing)
|
return reset_programmer(itemstack, user, pointed_thing)
|
||||||
@ -55,14 +58,14 @@ local function program_numbers(itemstack, placer, pointed_thing)
|
|||||||
local text = join_to_string(numbers)
|
local text = join_to_string(numbers)
|
||||||
local player_name = placer:get_player_name()
|
local player_name = placer:get_player_name()
|
||||||
if meta and meta:get_string("owner") ~= player_name then
|
if meta and meta:get_string("owner") ~= player_name then
|
||||||
minetest.chat_send_player(player_name, "[Tubelib Programmer] foreign or unknown node!")
|
minetest.chat_send_player(player_name, S("[Tubelib Programmer] foreign or unknown node!"))
|
||||||
return itemstack
|
return itemstack
|
||||||
end
|
end
|
||||||
local res = tubelib.send_request(node_number, "set_numbers", text)
|
local res = tubelib.send_request(node_number, "set_numbers", text)
|
||||||
if res == true then
|
if res == true then
|
||||||
minetest.chat_send_player(player_name, "[Tubelib Programmer] node programmed!")
|
minetest.chat_send_player(player_name, S("[Tubelib Programmer] node programmed!"))
|
||||||
else
|
else
|
||||||
minetest.chat_send_player(player_name, "[Tubelib Programmer] Error: programmer not supported!")
|
minetest.chat_send_player(player_name, S("[Tubelib Programmer] Error: programmer not supported!"))
|
||||||
end
|
end
|
||||||
return itemstack
|
return itemstack
|
||||||
else
|
else
|
||||||
@ -71,7 +74,7 @@ local function program_numbers(itemstack, placer, pointed_thing)
|
|||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_craftitem("tubelib_addons2:programmer", {
|
minetest.register_craftitem("tubelib_addons2:programmer", {
|
||||||
description = "Tubelib Programmer",
|
description = S("Tubelib Programmer"),
|
||||||
inventory_image = "tubelib_addons2_programmer.png",
|
inventory_image = "tubelib_addons2_programmer.png",
|
||||||
stack_max = 1,
|
stack_max = 1,
|
||||||
wield_image = "tubelib_addons2_programmer_wield.png",
|
wield_image = "tubelib_addons2_programmer_wield.png",
|
||||||
|
@ -12,17 +12,20 @@
|
|||||||
|
|
||||||
]]--
|
]]--
|
||||||
|
|
||||||
|
-- Load support for I18n
|
||||||
|
local S = tubelib_addons2.S
|
||||||
|
|
||||||
local OVER_LOAD_MAX = 5
|
local OVER_LOAD_MAX = 5
|
||||||
|
|
||||||
local function formspec(meta)
|
local function formspec(meta)
|
||||||
local numbers = meta:get_string("numbers")
|
local numbers = meta:get_string("numbers")
|
||||||
return "size[7,5]"..
|
return "size[7,5]"..
|
||||||
"field[0.5,2;6,1;number;Destination node numbers;"..numbers.."]" ..
|
"field[0.5,2;6,1;number;"..S("Destination node numbers")..";"..numbers.."]" ..
|
||||||
"button_exit[1,3;2,1;exit;Save]"
|
"button_exit[1,3;2,1;exit;"..S("Save").."]"
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_node("tubelib_addons2:repeater", {
|
minetest.register_node("tubelib_addons2:repeater", {
|
||||||
description = "Tubelib Repeater",
|
description = S("Tubelib Repeater"),
|
||||||
tiles = {
|
tiles = {
|
||||||
-- up, down, right, left, back, front
|
-- up, down, right, left, back, front
|
||||||
'tubelib_front.png',
|
'tubelib_front.png',
|
||||||
@ -35,7 +38,7 @@ minetest.register_node("tubelib_addons2:repeater", {
|
|||||||
local own_number = tubelib.add_node(pos, "tubelib_addons2:repeater")
|
local own_number = tubelib.add_node(pos, "tubelib_addons2:repeater")
|
||||||
meta:set_string("own_number", own_number)
|
meta:set_string("own_number", own_number)
|
||||||
meta:set_string("formspec", formspec(meta))
|
meta:set_string("formspec", formspec(meta))
|
||||||
meta:set_string("infotext", "Tubelib Repeater "..own_number..": not connected")
|
meta:set_string("infotext", S("Tubelib Repeater").." "..own_number..S(": not connected"))
|
||||||
meta:set_string("owner", placer:get_player_name())
|
meta:set_string("owner", placer:get_player_name())
|
||||||
meta:set_int("overload_cnt", 0)
|
meta:set_int("overload_cnt", 0)
|
||||||
minetest.get_node_timer(pos):start(1)
|
minetest.get_node_timer(pos):start(1)
|
||||||
@ -51,7 +54,7 @@ minetest.register_node("tubelib_addons2:repeater", {
|
|||||||
if tubelib.check_numbers(fields.number) then
|
if tubelib.check_numbers(fields.number) then
|
||||||
meta:set_string("numbers", fields.number)
|
meta:set_string("numbers", fields.number)
|
||||||
local own_number = meta:get_string("own_number")
|
local own_number = meta:get_string("own_number")
|
||||||
meta:set_string("infotext", "Tubelib Repeater "..own_number..": connected with "..fields.number)
|
meta:set_string("infotext", S("Tubelib Repeater").." "..own_number..S(": connected with").." "..fields.number)
|
||||||
meta:set_string("formspec", formspec(meta))
|
meta:set_string("formspec", formspec(meta))
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -101,12 +104,12 @@ tubelib.register_node("tubelib_addons2:repeater", {}, {
|
|||||||
meta:set_int("overload_cnt", overload_cnt)
|
meta:set_int("overload_cnt", overload_cnt)
|
||||||
if overload_cnt > OVER_LOAD_MAX then
|
if overload_cnt > OVER_LOAD_MAX then
|
||||||
local own_number = meta:get_string("own_number")
|
local own_number = meta:get_string("own_number")
|
||||||
meta:set_string("infotext", "Tubelib Repeater "..own_number..": fault (overloaded)")
|
meta:set_string("infotext", S("Tubelib Repeater").." "..own_number..S(": fault (overloaded)"))
|
||||||
minetest.get_node_timer(pos):stop()
|
minetest.get_node_timer(pos):stop()
|
||||||
return false
|
return false
|
||||||
elseif topic == "set_numbers" then
|
elseif topic == "set_numbers" then
|
||||||
local own_number = meta:get_string("own_number")
|
local own_number = meta:get_string("own_number")
|
||||||
meta:set_string("infotext", "Tubelib Repeater "..own_number..": connected with "..payload)
|
meta:set_string("infotext", S("Tubelib Repeater").." "..own_number..S(": connected with").." "..payload)
|
||||||
meta:set_string("numbers", payload)
|
meta:set_string("numbers", payload)
|
||||||
meta:set_string("formspec", formspec(meta))
|
meta:set_string("formspec", formspec(meta))
|
||||||
return true
|
return true
|
||||||
|
@ -12,6 +12,9 @@
|
|||||||
|
|
||||||
]]--
|
]]--
|
||||||
|
|
||||||
|
-- Load support for I18n
|
||||||
|
local S = tubelib_addons2.S
|
||||||
|
|
||||||
local RUNNING_STATE = 1
|
local RUNNING_STATE = 1
|
||||||
local STOP_STATE = 0
|
local STOP_STATE = 0
|
||||||
local NUM_SLOTS = 8
|
local NUM_SLOTS = 8
|
||||||
@ -26,16 +29,16 @@ local function formspec(state, rules, endless)
|
|||||||
default.gui_bg..
|
default.gui_bg..
|
||||||
default.gui_bg_img..
|
default.gui_bg_img..
|
||||||
default.gui_slots..
|
default.gui_slots..
|
||||||
"label[0,0;Number(s)]label[2.1,0;Command]label[6.4,0;Offset/s]"}
|
"label[0,0;Number(s)]label[2.1,0;"..S("Command").."]label[6.4,0;Offset/s]"}
|
||||||
|
|
||||||
for idx, rule in ipairs(rules or {}) do
|
for idx, rule in ipairs(rules or {}) do
|
||||||
tbl[#tbl+1] = "field[0.2,"..(-0.2+idx)..";2,1;num"..idx..";;"..(rule.num or "").."]"
|
tbl[#tbl+1] = "field[0.2,"..(-0.2+idx)..";2,1;num"..idx..";;"..(rule.num or "").."]"
|
||||||
tbl[#tbl+1] = "dropdown[2,"..(-0.4+idx)..";3.9,1;act"..idx..";"..sAction..";"..(rule.act or "").."]"
|
tbl[#tbl+1] = "dropdown[2,"..(-0.4+idx)..";3.9,1;act"..idx..";"..sAction..";"..(rule.act or "").."]"
|
||||||
tbl[#tbl+1] = "field[6.2,"..(-0.2+idx)..";2,1;offs"..idx..";;"..(rule.offs or "").."]"
|
tbl[#tbl+1] = "field[6.2,"..(-0.2+idx)..";2,1;offs"..idx..";;"..(rule.offs or "").."]"
|
||||||
end
|
end
|
||||||
tbl[#tbl+1] = "checkbox[0,8.5;endless;Run endless;"..endless.."]"
|
tbl[#tbl+1] = "checkbox[0,8.5;endless;"..S("Run endless")..";"..endless.."]"
|
||||||
tbl[#tbl+1] = "image_button[5,8.5;1,1;".. tubelib.state_button(state) ..";button;]"
|
tbl[#tbl+1] = "image_button[5,8.5;1,1;".. tubelib.state_button(state) ..";button;]"
|
||||||
tbl[#tbl+1] = "button[6.2,8.5;1.5,1;help;help]"
|
tbl[#tbl+1] = "button[6.2,8.5;1.5,1;"..S("help")..";help]"
|
||||||
|
|
||||||
return table.concat(tbl)
|
return table.concat(tbl)
|
||||||
end
|
end
|
||||||
@ -45,14 +48,14 @@ local function formspec_help()
|
|||||||
default.gui_bg..
|
default.gui_bg..
|
||||||
default.gui_bg_img..
|
default.gui_bg_img..
|
||||||
default.gui_slots..
|
default.gui_slots..
|
||||||
"label[2,0;Sequencer Help]"..
|
"label[2,0;"..S("Sequencer Help").."]"..
|
||||||
"label[0,1;Define a sequence of commands\nto control other machines.]"..
|
"label[0,1;"..S("Define a sequence of commands\nto control other machines.").."]"..
|
||||||
"label[0,2.2;Numbers(s) are the node numbers,\nthe command shall sent to.]"..
|
"label[0,2.2;"..S("Numbers(s) are the node numbers,\nthe command shall sent to.").."]"..
|
||||||
"label[0,3.4;The commands 'on'/'off' are used\n for machines and other nodes.]"..
|
"label[0,3.4;"..S("The commands 'on'/'off' are used\n for machines and other nodes.").."]"..
|
||||||
"label[0,4.6;Offset is the time to the\nnext line in seconds (1..999).]"..
|
"label[0,4.6;"..S("Offset is the time to the\nnext line in seconds (1..999).").."]"..
|
||||||
"label[0,5.8;If endless is set, the Sequencer\nrestarts again and again.]"..
|
"label[0,5.8;"..S("If endless is set, the Sequencer\nrestarts again and again.").."]"..
|
||||||
"label[0,7;The command ' ' does nothing,\nonly consuming the offset time.]"..
|
"label[0,7;"..S("The command ' ' does nothing,\nonly consuming the offset time.").."]"..
|
||||||
"button[3,8;2,1;exit;close]"
|
"button[3,8;2,1;"..S("exit")..";close]"
|
||||||
end
|
end
|
||||||
|
|
||||||
local function stop_the_sequencer(pos)
|
local function stop_the_sequencer(pos)
|
||||||
@ -60,7 +63,7 @@ local function stop_the_sequencer(pos)
|
|||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
local number = meta:get_string("number")
|
local number = meta:get_string("number")
|
||||||
meta:set_int("running", STOP_STATE)
|
meta:set_int("running", STOP_STATE)
|
||||||
meta:set_string("infotext", "Tubelib Sequencer "..number..": stopped")
|
meta:set_string("infotext", S("Tubelib Sequencer").." "..number..": stopped")
|
||||||
local rules = minetest.deserialize(meta:get_string("rules"))
|
local rules = minetest.deserialize(meta:get_string("rules"))
|
||||||
local endless = meta:get_int("endless") or 0
|
local endless = meta:get_int("endless") or 0
|
||||||
meta:set_string("formspec", formspec(tubelib.STOPPED, rules, endless))
|
meta:set_string("formspec", formspec(tubelib.STOPPED, rules, endless))
|
||||||
@ -111,7 +114,7 @@ local function check_rules(pos, elapsed)
|
|||||||
if index == 1 and offs < 1 then
|
if index == 1 and offs < 1 then
|
||||||
offs = 1
|
offs = 1
|
||||||
end
|
end
|
||||||
meta:set_string("infotext", "Tubelib Sequencer "..number..": running ("..index.."/"..NUM_SLOTS..")")
|
meta:set_string("infotext", S("Tubelib Sequencer").." "..number..": running ("..index.."/"..NUM_SLOTS..")")
|
||||||
meta:set_int("index", index)
|
meta:set_int("index", index)
|
||||||
if offs > 0 then
|
if offs > 0 then
|
||||||
minetest.after(0, restart_timer, pos, offs)
|
minetest.after(0, restart_timer, pos, offs)
|
||||||
@ -133,7 +136,7 @@ local function start_the_sequencer(pos)
|
|||||||
local number = meta:get_string("number")
|
local number = meta:get_string("number")
|
||||||
meta:set_int("running", 1)
|
meta:set_int("running", 1)
|
||||||
meta:set_int("index", 1)
|
meta:set_int("index", 1)
|
||||||
meta:set_string("infotext", "Tubelib Sequencer "..number..": running (1/"..NUM_SLOTS..")")
|
meta:set_string("infotext", S("Tubelib Sequencer").." "..number..": running (1/"..NUM_SLOTS..")")
|
||||||
local rules = minetest.deserialize(meta:get_string("rules"))
|
local rules = minetest.deserialize(meta:get_string("rules"))
|
||||||
local endless = meta:get_int("endless") or 0
|
local endless = meta:get_int("endless") or 0
|
||||||
meta:set_string("formspec", formspec(tubelib.RUNNING, rules, endless))
|
meta:set_string("formspec", formspec(tubelib.RUNNING, rules, endless))
|
||||||
@ -196,7 +199,7 @@ local function on_receive_fields(pos, formname, fields, player)
|
|||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_node("tubelib_addons2:sequencer", {
|
minetest.register_node("tubelib_addons2:sequencer", {
|
||||||
description = "Tubelib Sequencer",
|
description = S("Tubelib Sequencer"),
|
||||||
tiles = {
|
tiles = {
|
||||||
-- up, down, right, left, back, front
|
-- up, down, right, left, back, front
|
||||||
'tubelib_front.png',
|
'tubelib_front.png',
|
||||||
|
@ -12,6 +12,8 @@
|
|||||||
|
|
||||||
]]--
|
]]--
|
||||||
|
|
||||||
|
-- Load support for I18n
|
||||||
|
local S = tubelib_addons2.S
|
||||||
|
|
||||||
local function switch_on(pos, node)
|
local function switch_on(pos, node)
|
||||||
node.name = "tubelib_addons2:streetlamp_on"
|
node.name = "tubelib_addons2:streetlamp_on"
|
||||||
@ -24,7 +26,7 @@ local function switch_off(pos, node)
|
|||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_node("tubelib_addons2:streetlamp", {
|
minetest.register_node("tubelib_addons2:streetlamp", {
|
||||||
description = "Tubelib Street Lamp",
|
description = S("Tubelib Street Lamp"),
|
||||||
tiles = {
|
tiles = {
|
||||||
-- up, down, right, left, back, front
|
-- up, down, right, left, back, front
|
||||||
'tubelib_addons2_streetlamp_top.png',
|
'tubelib_addons2_streetlamp_top.png',
|
||||||
@ -50,7 +52,7 @@ minetest.register_node("tubelib_addons2:streetlamp", {
|
|||||||
after_place_node = function(pos, placer)
|
after_place_node = function(pos, placer)
|
||||||
local number = tubelib.add_node(pos, "tubelib_addons2:streetlamp")
|
local number = tubelib.add_node(pos, "tubelib_addons2:streetlamp")
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
meta:set_string("infotext", "Tubelib Street Lamp "..number)
|
meta:set_string("infotext", S("Tubelib Street Lamp").." "..number)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
on_rightclick = function(pos, node, clicker)
|
on_rightclick = function(pos, node, clicker)
|
||||||
@ -73,7 +75,7 @@ minetest.register_node("tubelib_addons2:streetlamp", {
|
|||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("tubelib_addons2:streetlamp_on", {
|
minetest.register_node("tubelib_addons2:streetlamp_on", {
|
||||||
description = "Tubelib Street Lamp",
|
description = S("Tubelib Street Lamp"),
|
||||||
tiles = {
|
tiles = {
|
||||||
-- up, down, right, left, back, front
|
-- up, down, right, left, back, front
|
||||||
'tubelib_addons2_streetlamp_top.png',
|
'tubelib_addons2_streetlamp_top.png',
|
||||||
|
@ -12,6 +12,9 @@
|
|||||||
|
|
||||||
]]--
|
]]--
|
||||||
|
|
||||||
|
-- Load support for I18n
|
||||||
|
local S = tubelib_addons2.S
|
||||||
|
|
||||||
local CYCLE_TIME = 8
|
local CYCLE_TIME = 8
|
||||||
|
|
||||||
local tTime = {
|
local tTime = {
|
||||||
@ -37,7 +40,7 @@ local function formspec(events, numbers, actions)
|
|||||||
default.gui_bg_img..
|
default.gui_bg_img..
|
||||||
default.gui_slots..
|
default.gui_slots..
|
||||||
|
|
||||||
"label[0,0;Time]label[2.3,0;Number(s)]label[4.5,0;Command]"..
|
"label[0,0;"..S("Time").."]label[2.3,0;"..S("Number(s)").."]label[4.5,0;"..S("Command").."]"..
|
||||||
"dropdown[0,1;2,1;e1;"..sTime..";"..events[1].."]"..
|
"dropdown[0,1;2,1;e1;"..sTime..";"..events[1].."]"..
|
||||||
"field[2.3,1.2;2,1;n1;;"..numbers[1].."]" ..
|
"field[2.3,1.2;2,1;n1;;"..numbers[1].."]" ..
|
||||||
"dropdown[4.5,1;3,1;a1;"..sAction..";"..tAction[actions[1]].."]"..
|
"dropdown[4.5,1;3,1;a1;"..sAction..";"..tAction[actions[1]].."]"..
|
||||||
@ -97,7 +100,7 @@ local function check_rules(pos,elapsed)
|
|||||||
done = {false,false,false,false,false,false}
|
done = {false,false,false,false,false,false}
|
||||||
end
|
end
|
||||||
meta:set_string("done", minetest.serialize(done))
|
meta:set_string("done", minetest.serialize(done))
|
||||||
meta:set_string("infotext","Tubelib Timer "..hour..":00")
|
meta:set_string("infotext", S("Tubelib Timer").." "..hour..":00")
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
return false
|
return false
|
||||||
@ -105,7 +108,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
minetest.register_node("tubelib_addons2:timer", {
|
minetest.register_node("tubelib_addons2:timer", {
|
||||||
description = "Tubelib Timer",
|
description = S("Tubelib Timer"),
|
||||||
tiles = {
|
tiles = {
|
||||||
-- up, down, right, left, back, front
|
-- up, down, right, left, back, front
|
||||||
'tubelib_front.png',
|
'tubelib_front.png',
|
||||||
|
@ -14,6 +14,9 @@
|
|||||||
|
|
||||||
]]--
|
]]--
|
||||||
|
|
||||||
|
-- Load support for I18n
|
||||||
|
local S = tubelib_addons3.S
|
||||||
|
|
||||||
local PlayerActions = {}
|
local PlayerActions = {}
|
||||||
local InventoryState = {}
|
local InventoryState = {}
|
||||||
|
|
||||||
@ -76,7 +79,7 @@ local function formspec()
|
|||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_node("tubelib_addons3:chest", {
|
minetest.register_node("tubelib_addons3:chest", {
|
||||||
description = "HighPerf Chest",
|
description = S("HighPerf Chest"),
|
||||||
tiles = {
|
tiles = {
|
||||||
-- up, down, right, left, back, front
|
-- up, down, right, left, back, front
|
||||||
'tubelib_addons3_chest_bottom.png',
|
'tubelib_addons3_chest_bottom.png',
|
||||||
@ -99,7 +102,7 @@ minetest.register_node("tubelib_addons3:chest", {
|
|||||||
meta:set_string("number", number)
|
meta:set_string("number", number)
|
||||||
meta:set_string("owner", placer:get_player_name())
|
meta:set_string("owner", placer:get_player_name())
|
||||||
meta:set_string("formspec", formspec())
|
meta:set_string("formspec", formspec())
|
||||||
meta:set_string("infotext", "HighPerf Chest "..number)
|
meta:set_string("infotext", S("HighPerf Chest").." "..number)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
can_dig = function(pos,player)
|
can_dig = function(pos,player)
|
||||||
@ -168,7 +171,7 @@ tubelib.register_node("tubelib_addons3:chest", {}, {
|
|||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
meta:set_string("dest_num", payload)
|
meta:set_string("dest_num", payload)
|
||||||
local number = meta:get_string("number")
|
local number = meta:get_string("number")
|
||||||
meta:set_string("infotext", "HighPerf Chest "..number.." connected with "..payload)
|
meta:set_string("infotext", S("HighPerf Chest").." "..number.." "..S("connected with").." "..payload)
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
@ -13,8 +13,10 @@
|
|||||||
A high performance distributor
|
A high performance distributor
|
||||||
]]--
|
]]--
|
||||||
|
|
||||||
|
-- Load support for I18n
|
||||||
|
local S = tubelib_addons3.S
|
||||||
|
|
||||||
-- for lazy programmers
|
-- for lazy programmers
|
||||||
local S = function(pos) if pos then return minetest.pos_to_string(pos) end end
|
|
||||||
local P = minetest.string_to_pos
|
local P = minetest.string_to_pos
|
||||||
local M = minetest.get_meta
|
local M = minetest.get_meta
|
||||||
|
|
||||||
@ -55,7 +57,7 @@ local State = tubelib.NodeStates:new({
|
|||||||
node_name_passive = "tubelib_addons3:distributor",
|
node_name_passive = "tubelib_addons3:distributor",
|
||||||
node_name_active = "tubelib_addons3:distributor_active",
|
node_name_active = "tubelib_addons3:distributor_active",
|
||||||
node_name_defect = "tubelib_addons3:distributor_defect",
|
node_name_defect = "tubelib_addons3:distributor_defect",
|
||||||
infotext_name = "HighPerf Distributor",
|
infotext_name = S("HighPerf Distributor"),
|
||||||
cycle_time = CYCLE_TIME,
|
cycle_time = CYCLE_TIME,
|
||||||
standby_ticks = STANDBY_TICKS,
|
standby_ticks = STANDBY_TICKS,
|
||||||
aging_factor = 50,
|
aging_factor = 50,
|
||||||
@ -322,7 +324,7 @@ local function change_filter_settings(pos, slot, val)
|
|||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_node("tubelib_addons3:distributor", {
|
minetest.register_node("tubelib_addons3:distributor", {
|
||||||
description = "HighPerf Distributor",
|
description = S("HighPerf Distributor"),
|
||||||
tiles = {
|
tiles = {
|
||||||
-- up, down, right, left, back, front
|
-- up, down, right, left, back, front
|
||||||
'tubelib_distributor.png^tubelib_addons3_node_frame.png',
|
'tubelib_distributor.png^tubelib_addons3_node_frame.png',
|
||||||
@ -382,7 +384,7 @@ minetest.register_node("tubelib_addons3:distributor", {
|
|||||||
|
|
||||||
|
|
||||||
minetest.register_node("tubelib_addons3:distributor_active", {
|
minetest.register_node("tubelib_addons3:distributor_active", {
|
||||||
description = "HighPerf Distributor",
|
description = S("HighPerf Distributor"),
|
||||||
tiles = {
|
tiles = {
|
||||||
-- up, down, right, left, back, front
|
-- up, down, right, left, back, front
|
||||||
{
|
{
|
||||||
@ -420,7 +422,7 @@ minetest.register_node("tubelib_addons3:distributor_active", {
|
|||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("tubelib_addons3:distributor_defect", {
|
minetest.register_node("tubelib_addons3:distributor_defect", {
|
||||||
description = "HighPerf Distributor",
|
description = S("HighPerf Distributor"),
|
||||||
tiles = {
|
tiles = {
|
||||||
-- up, down, right, left, back, front
|
-- up, down, right, left, back, front
|
||||||
'tubelib_distributor.png^tubelib_addons3_node_frame.png',
|
'tubelib_distributor.png^tubelib_addons3_node_frame.png',
|
||||||
|
@ -14,6 +14,9 @@
|
|||||||
|
|
||||||
]]--
|
]]--
|
||||||
|
|
||||||
|
-- Load support for I18n
|
||||||
|
local S = tubelib_addons3.S
|
||||||
|
|
||||||
local function allow_metadata_inventory_put(pos, listname, index, stack, player)
|
local function allow_metadata_inventory_put(pos, listname, index, stack, player)
|
||||||
if minetest.is_protected(pos, player:get_player_name()) then
|
if minetest.is_protected(pos, player:get_player_name()) then
|
||||||
return 0
|
return 0
|
||||||
@ -62,7 +65,7 @@ local function scan_for_objects(pos, elapsed)
|
|||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_node("tubelib_addons3:funnel", {
|
minetest.register_node("tubelib_addons3:funnel", {
|
||||||
description = "HighPerf Funnel",
|
description = S("HighPerf Funnel"),
|
||||||
tiles = {
|
tiles = {
|
||||||
-- up, down, right, left, back, front
|
-- up, down, right, left, back, front
|
||||||
'tubelib_addons1_funnel_top.png^tubelib_addons3_node_frame4.png',
|
'tubelib_addons1_funnel_top.png^tubelib_addons3_node_frame4.png',
|
||||||
|
@ -10,6 +10,11 @@
|
|||||||
|
|
||||||
]]--
|
]]--
|
||||||
|
|
||||||
|
tubelib_addons3 = {}
|
||||||
|
|
||||||
|
-- Load support for I18n
|
||||||
|
tubelib_addons3.S = minetest.get_translator("tubelib_addons3")
|
||||||
|
|
||||||
dofile(minetest.get_modpath("tubelib_addons3") .. '/chest.lua')
|
dofile(minetest.get_modpath("tubelib_addons3") .. '/chest.lua')
|
||||||
dofile(minetest.get_modpath("tubelib_addons3") .. '/pusher.lua')
|
dofile(minetest.get_modpath("tubelib_addons3") .. '/pusher.lua')
|
||||||
dofile(minetest.get_modpath("tubelib_addons3") .. '/distributor.lua')
|
dofile(minetest.get_modpath("tubelib_addons3") .. '/distributor.lua')
|
||||||
|
@ -14,8 +14,10 @@
|
|||||||
|
|
||||||
]]--
|
]]--
|
||||||
|
|
||||||
|
-- Load support for I18n
|
||||||
|
local S = tubelib_addons3.S
|
||||||
|
|
||||||
-- for lazy programmers
|
-- for lazy programmers
|
||||||
local S = function(pos) if pos then return minetest.pos_to_string(pos) end end
|
|
||||||
local P = minetest.string_to_pos
|
local P = minetest.string_to_pos
|
||||||
local M = minetest.get_meta
|
local M = minetest.get_meta
|
||||||
|
|
||||||
@ -27,7 +29,7 @@ local State = tubelib.NodeStates:new({
|
|||||||
node_name_passive = "tubelib_addons3:pusher",
|
node_name_passive = "tubelib_addons3:pusher",
|
||||||
node_name_active = "tubelib_addons3:pusher_active",
|
node_name_active = "tubelib_addons3:pusher_active",
|
||||||
node_name_defect = "tubelib_addons3:pusher_defect",
|
node_name_defect = "tubelib_addons3:pusher_defect",
|
||||||
infotext_name = "HighPerf Pusher",
|
infotext_name = S("HighPerf Pusher"),
|
||||||
cycle_time = CYCLE_TIME,
|
cycle_time = CYCLE_TIME,
|
||||||
standby_ticks = STANDBY_TICKS,
|
standby_ticks = STANDBY_TICKS,
|
||||||
has_item_meter = true,
|
has_item_meter = true,
|
||||||
@ -60,7 +62,7 @@ local function keep_running(pos, elapsed)
|
|||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_node("tubelib_addons3:pusher", {
|
minetest.register_node("tubelib_addons3:pusher", {
|
||||||
description = "HighPerf Pusher",
|
description = S("HighPerf Pusher"),
|
||||||
tiles = {
|
tiles = {
|
||||||
-- up, down, right, left, back, front
|
-- up, down, right, left, back, front
|
||||||
'tubelib_pusher1.png^tubelib_addons3_node_frame4.png',
|
'tubelib_pusher1.png^tubelib_addons3_node_frame4.png',
|
||||||
@ -102,7 +104,7 @@ minetest.register_node("tubelib_addons3:pusher", {
|
|||||||
|
|
||||||
|
|
||||||
minetest.register_node("tubelib_addons3:pusher_active", {
|
minetest.register_node("tubelib_addons3:pusher_active", {
|
||||||
description = "HighPerf Pusher",
|
description = S("HighPerf Pusher"),
|
||||||
tiles = {
|
tiles = {
|
||||||
-- up, down, right, left, back, front
|
-- up, down, right, left, back, front
|
||||||
{
|
{
|
||||||
@ -167,7 +169,7 @@ minetest.register_node("tubelib_addons3:pusher_active", {
|
|||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("tubelib_addons3:pusher_defect", {
|
minetest.register_node("tubelib_addons3:pusher_defect", {
|
||||||
description = "HighPerf Pusher",
|
description = S("HighPerf Pusher"),
|
||||||
tiles = {
|
tiles = {
|
||||||
-- up, down, right, left, back, front
|
-- up, down, right, left, back, front
|
||||||
'tubelib_pusher1.png^tubelib_addons3_node_frame4.png',
|
'tubelib_pusher1.png^tubelib_addons3_node_frame4.png',
|
||||||
|
@ -14,6 +14,9 @@
|
|||||||
|
|
||||||
]]--
|
]]--
|
||||||
|
|
||||||
|
-- Load support for I18n
|
||||||
|
local S = tubelib_addons3.S
|
||||||
|
|
||||||
-- tubelib aging feature
|
-- tubelib aging feature
|
||||||
local AGING_LEVEL1 = 50 * tubelib.machine_aging_value
|
local AGING_LEVEL1 = 50 * tubelib.machine_aging_value
|
||||||
local AGING_LEVEL2 = 150 * tubelib.machine_aging_value
|
local AGING_LEVEL2 = 150 * tubelib.machine_aging_value
|
||||||
@ -78,7 +81,7 @@ end
|
|||||||
|
|
||||||
local function set_state(meta, state)
|
local function set_state(meta, state)
|
||||||
local number = meta:get_string("number")
|
local number = meta:get_string("number")
|
||||||
meta:set_string("infotext", "HighPerf Pushing Chest "..number..": "..state)
|
meta:set_string("infotext", S("HighPerf Pushing Chest").." "..number..": "..state)
|
||||||
meta:set_string("state", state)
|
meta:set_string("state", state)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -175,7 +178,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
minetest.register_node("tubelib_addons3:pushing_chest", {
|
minetest.register_node("tubelib_addons3:pushing_chest", {
|
||||||
description = "HighPerf Pushing Chest",
|
description = S("HighPerf Pushing Chest"),
|
||||||
tiles = {
|
tiles = {
|
||||||
-- up, down, right, left, back, front
|
-- up, down, right, left, back, front
|
||||||
{
|
{
|
||||||
@ -244,7 +247,7 @@ minetest.register_node("tubelib_addons3:pushing_chest", {
|
|||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("tubelib_addons3:pushing_chest_defect", {
|
minetest.register_node("tubelib_addons3:pushing_chest_defect", {
|
||||||
description = "HighPerf Pushing Chest",
|
description = S("HighPerf Pushing Chest"),
|
||||||
tiles = {
|
tiles = {
|
||||||
-- up, down, right, left, back, front
|
-- up, down, right, left, back, front
|
||||||
'tubelib_pusher1.png^tubelib_addons3_node_frame4.png',
|
'tubelib_pusher1.png^tubelib_addons3_node_frame4.png',
|
||||||
|
@ -14,14 +14,17 @@
|
|||||||
|
|
||||||
]]--
|
]]--
|
||||||
|
|
||||||
|
-- Load support for I18n
|
||||||
|
local S = tubelib_addons3.S
|
||||||
|
|
||||||
local Tube = tubelib.Tube
|
local Tube = tubelib.Tube
|
||||||
|
|
||||||
local sFormspec = "size[7.5,3]"..
|
local sFormspec = "size[7.5,3]"..
|
||||||
"field[0.5,1;7,1;channel;Enter channel string;]" ..
|
"field[0.5,1;7,1;channel;"..S("Enter channel string")..";]" ..
|
||||||
"button_exit[2,2;3,1;exit;Save]"
|
"button_exit[2,2;3,1;exit;"..S("Save").."]"
|
||||||
|
|
||||||
minetest.register_node("tubelib_addons3:teleporter", {
|
minetest.register_node("tubelib_addons3:teleporter", {
|
||||||
description = "Tubelib Teleporter",
|
description = S("Tubelib Teleporter"),
|
||||||
tiles = {
|
tiles = {
|
||||||
-- up, down, right, left, back, front
|
-- up, down, right, left, back, front
|
||||||
'tubelib_addons3_chest_bottom.png',
|
'tubelib_addons3_chest_bottom.png',
|
||||||
|
Loading…
Reference in New Issue
Block a user