forked from mtcontrib/pipeworks
Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
e4db1e885e
@ -14,17 +14,20 @@ local function set_filter_formspec(data, meta)
|
|||||||
|
|
||||||
local formspec
|
local formspec
|
||||||
if data.digiline then
|
if data.digiline then
|
||||||
formspec = "size[8,2.7]"..
|
formspec =
|
||||||
"item_image[0,0;1,1;pipeworks:"..data.name.."]"..
|
"size[8.5,3]"..
|
||||||
"label[1,0;"..minetest.formspec_escape(itemname).."]"..
|
"item_image[0.2,0;1,1;pipeworks:"..data.name.."]"..
|
||||||
"field[0.3,1.5;8.0,1;channel;"..S("Channel")..";${channel}]"..
|
"label[1.2,0.2;"..minetest.formspec_escape(itemname).."]"..
|
||||||
fs_helpers.cycling_button(meta, "button[0,2;4,1", "slotseq_mode",
|
"field[0.5,1.6;4.6,1;channel;"..S("Channel")..";${channel}]"..
|
||||||
|
"button[4.8,1.3;1.5,1;set_channel;"..S("Set").."]"..
|
||||||
|
fs_helpers.cycling_button(meta, "button[0.2,2.3;4.05,1", "slotseq_mode",
|
||||||
{S("Sequence slots by Priority"),
|
{S("Sequence slots by Priority"),
|
||||||
S("Sequence slots Randomly"),
|
S("Sequence slots Randomly"),
|
||||||
S("Sequence slots by Rotation")})..
|
S("Sequence slots by Rotation")})..
|
||||||
fs_helpers.cycling_button(meta, "button[4,2;4,1", "exmatch_mode",
|
fs_helpers.cycling_button(meta, "button[4.25,2.3;4.05,1", "exmatch_mode",
|
||||||
{S("Exact match - off"),
|
{S("Exact match - off"),
|
||||||
S("Exact match - on")})
|
S("Exact match - on")})..
|
||||||
|
"button_exit[6.3,1.3;2,1;close;"..S("Close").."]"
|
||||||
else
|
else
|
||||||
local exmatch_button = ""
|
local exmatch_button = ""
|
||||||
if data.stackwise then
|
if data.stackwise then
|
||||||
@ -425,10 +428,14 @@ for _, data in ipairs({
|
|||||||
end
|
end
|
||||||
|
|
||||||
node.on_receive_fields = function(pos, formname, fields, sender)
|
node.on_receive_fields = function(pos, formname, fields, sender)
|
||||||
if not pipeworks.may_configure(pos, sender) then return end
|
if (fields.quit and not fields.key_enter_field)
|
||||||
|
or not pipeworks.may_configure(pos, sender) then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
fs_helpers.on_receive_fields(pos, fields)
|
fs_helpers.on_receive_fields(pos, fields)
|
||||||
|
|
||||||
if fields.channel then
|
if fields.channel and (fields.key_enter_field == "channel" or fields.set_channel) then
|
||||||
minetest.get_meta(pos):set_string("channel", fields.channel)
|
minetest.get_meta(pos):set_string("channel", fields.channel)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -55,15 +55,22 @@ end)
|
|||||||
-- tube overload mechanism:
|
-- tube overload mechanism:
|
||||||
-- when the tube's item count (tracked in the above tube_item_count table)
|
-- when the tube's item count (tracked in the above tube_item_count table)
|
||||||
-- exceeds the limit configured per tube, replace it with a broken one.
|
-- exceeds the limit configured per tube, replace it with a broken one.
|
||||||
|
|
||||||
|
function pipeworks.break_tube(pos)
|
||||||
|
local node = minetest.get_node(pos)
|
||||||
|
local meta = minetest.get_meta(pos)
|
||||||
|
meta:set_string("the_tube_was", minetest.serialize(node))
|
||||||
|
minetest.swap_node(pos, {name = "pipeworks:broken_tube_1"})
|
||||||
|
pipeworks.scan_for_tube_objects(pos)
|
||||||
|
end
|
||||||
|
|
||||||
local crunch_tube = function(pos, cnode, cmeta)
|
local crunch_tube = function(pos, cnode, cmeta)
|
||||||
if enable_max_limit then
|
if enable_max_limit then
|
||||||
local h = minetest.hash_node_position(pos)
|
local h = minetest.hash_node_position(pos)
|
||||||
local itemcount = tube_item_count[h] or 0
|
local itemcount = tube_item_count[h] or 0
|
||||||
if itemcount > max_tube_limit then
|
if itemcount > max_tube_limit then
|
||||||
cmeta:set_string("the_tube_was", minetest.serialize(cnode))
|
|
||||||
pipeworks.logger("Warning - a tube at "..minetest.pos_to_string(pos).." broke due to too many items ("..itemcount..")")
|
pipeworks.logger("Warning - a tube at "..minetest.pos_to_string(pos).." broke due to too many items ("..itemcount..")")
|
||||||
minetest.swap_node(pos, {name = "pipeworks:broken_tube_1"})
|
pipeworks.break_tube(pos)
|
||||||
pipeworks.scan_for_tube_objects(pos)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -3,6 +3,10 @@
|
|||||||
# License: CC-by-SA 4.0
|
# License: CC-by-SA 4.0
|
||||||
# Author: Louis Royer <4259825-lroyer@users.noreply.gitlab.com>
|
# Author: Louis Royer <4259825-lroyer@users.noreply.gitlab.com>
|
||||||
|
|
||||||
|
## generic interaction
|
||||||
|
Set=Fixer
|
||||||
|
Close=Fermer
|
||||||
|
|
||||||
## digilines interfacing
|
## digilines interfacing
|
||||||
Channel=Canal
|
Channel=Canal
|
||||||
|
|
||||||
@ -86,11 +90,12 @@ Sorting pneumatic tube=Tuyau pneumatique triant
|
|||||||
|
|
||||||
## teleport tube
|
## teleport tube
|
||||||
Receive=Reception
|
Receive=Reception
|
||||||
channels are public by default=Les canaux sont publics par défaut
|
Channels are public by default=Les canaux sont publics par défaut
|
||||||
use <player>:<channel> for fully private channels=Utilisez <joueur>:<canal> pour un canal entièrement privé
|
Use <player>:<channel> for fully private channels=Utilisez <joueur>:<canal> pour un canal entièrement privé
|
||||||
use <player>;<channel> for private receivers=Utilisez <joueur>;<canal> pour une réception privée
|
Use <player>;<channel> for private receivers=Utilisez <joueur>;<canal> pour une réception privée
|
||||||
Teleporting Pneumatic Tube Segment=Segment de tuyau pneumatique téléporteur
|
Teleporting Pneumatic Tube Segment=Segment de tuyau pneumatique téléporteur
|
||||||
unconfigured Teleportation Tube=Tuyau téléporteur non-configuré
|
Teleporting Tube=Tuyau pneumatique téléporteur
|
||||||
|
Unconfigured Teleportation Tube=Tuyau téléporteur non-configuré
|
||||||
Sorry, channel '@1' is reserved for exclusive use by @2=Désolé, le canal '@1' est réservé exclusivement à l’utilisateur @2.
|
Sorry, channel '@1' is reserved for exclusive use by @2=Désolé, le canal '@1' est réservé exclusivement à l’utilisateur @2.
|
||||||
Sorry, receiving from channel '@1' is reserved for @2=Désolé, la réception depuis le canal '@1' est réservée pour @2.
|
Sorry, receiving from channel '@1' is reserved for @2=Désolé, la réception depuis le canal '@1' est réservée pour @2.
|
||||||
Teleportation Tube @1 on '@2'=Tuyau de téléportation @1 sur '@2'
|
Teleportation Tube @1 on '@2'=Tuyau de téléportation @1 sur '@2'
|
||||||
@ -102,7 +107,9 @@ Trash Can=Poubelle
|
|||||||
Pneumatic tube segment (legacy)=Segment de tuyau pneumatique (obsolète)
|
Pneumatic tube segment (legacy)=Segment de tuyau pneumatique (obsolète)
|
||||||
|
|
||||||
## vacuum tubes
|
## vacuum tubes
|
||||||
|
Radius=Rayon
|
||||||
Vacuuming Pneumatic Tube Segment=Segment de tuyau pneumatique aspirant
|
Vacuuming Pneumatic Tube Segment=Segment de tuyau pneumatique aspirant
|
||||||
|
Adjustable Vacuuming Tube=Tuyau pneumatique aspirant réglable
|
||||||
Adjustable Vacuuming Pneumatic Tube Segment=Segment de tuyau pneumatique aspirant réglable
|
Adjustable Vacuuming Pneumatic Tube Segment=Segment de tuyau pneumatique aspirant réglable
|
||||||
Adjustable Vacuuming Pneumatic Tube Segment (@1m)=Segment de tuyau pneumatique aspirant réglable (@1 m)
|
Adjustable Vacuuming Pneumatic Tube Segment (@1m)=Segment de tuyau pneumatique aspirant réglable (@1 m)
|
||||||
|
|
||||||
|
@ -2,6 +2,10 @@
|
|||||||
# License: CC-by-SA 4.0
|
# License: CC-by-SA 4.0
|
||||||
# Author: pevernow <3450354617@qq.com>
|
# Author: pevernow <3450354617@qq.com>
|
||||||
|
|
||||||
|
## generic interaction
|
||||||
|
Set=
|
||||||
|
Cancel=
|
||||||
|
|
||||||
## digilines interfacing
|
## digilines interfacing
|
||||||
Channel=频道
|
Channel=频道
|
||||||
|
|
||||||
@ -84,11 +88,12 @@ Sorting pneumatic tube=分类管道
|
|||||||
|
|
||||||
## teleport tube
|
## teleport tube
|
||||||
Receive=接收
|
Receive=接收
|
||||||
channels are public by default=频道默认为公开
|
Channels are public by default=频道默认为公开
|
||||||
use <player>:<channel> for fully private channels=将<player>:<channel>用于完全私人的频道
|
Use <player>:<channel> for fully private channels=将<player>:<channel>用于完全私人的频道
|
||||||
use <player>;<channel> for private receivers=使用<player>;<channel>作为私人接收器
|
Use <player>;<channel> for private receivers=使用<player>;<channel>作为私人接收器
|
||||||
Teleporting Pneumatic Tube Segment=传送管道
|
Teleporting Pneumatic Tube Segment=传送管道
|
||||||
unconfigured Teleportation Tube=未配置的传送管道
|
Teleporting Tube=
|
||||||
|
Unconfigured Teleportation Tube=未配置的传送管道
|
||||||
Sorry, channel '@1' is reserved for exclusive use by @2=抱歉,频道‘@1’保留供‘@2’专用
|
Sorry, channel '@1' is reserved for exclusive use by @2=抱歉,频道‘@1’保留供‘@2’专用
|
||||||
Sorry, receiving from channel '@1' is reserved for @2=抱歉,从频道'@1'接收的内容已保留给'@2'
|
Sorry, receiving from channel '@1' is reserved for @2=抱歉,从频道'@1'接收的内容已保留给'@2'
|
||||||
Teleportation Tube @1 on '@2'=传送管'@1'在'@2'上
|
Teleportation Tube @1 on '@2'=传送管'@1'在'@2'上
|
||||||
@ -100,7 +105,9 @@ Trash Can=垃圾箱
|
|||||||
Pneumatic tube segment (legacy)=普通管道(旧式)
|
Pneumatic tube segment (legacy)=普通管道(旧式)
|
||||||
|
|
||||||
## vacuum tubes
|
## vacuum tubes
|
||||||
|
Radius=
|
||||||
Vacuuming Pneumatic Tube Segment=拾取管道
|
Vacuuming Pneumatic Tube Segment=拾取管道
|
||||||
|
Adjustable Vacuuming Tube=
|
||||||
Adjustable Vacuuming Pneumatic Tube Segment=高级拾取管道
|
Adjustable Vacuuming Pneumatic Tube Segment=高级拾取管道
|
||||||
Adjustable Vacuuming Pneumatic Tube Segment (@1m)=高级拾取管道(@1m)
|
Adjustable Vacuuming Pneumatic Tube Segment (@1m)=高级拾取管道(@1m)
|
||||||
|
|
||||||
|
@ -3,6 +3,10 @@
|
|||||||
# License: CC-by-SA 4.0
|
# License: CC-by-SA 4.0
|
||||||
# Author:
|
# Author:
|
||||||
|
|
||||||
|
## generic interaction
|
||||||
|
Set=
|
||||||
|
Cancel=
|
||||||
|
|
||||||
## digilines interfacing
|
## digilines interfacing
|
||||||
Channel=
|
Channel=
|
||||||
|
|
||||||
@ -86,11 +90,12 @@ Sorting pneumatic tube=
|
|||||||
|
|
||||||
## teleport tube
|
## teleport tube
|
||||||
Receive=
|
Receive=
|
||||||
channels are public by default=
|
Channels are public by default=
|
||||||
use <player>:<channel> for fully private channels=
|
Use <player>:<channel> for fully private channels=
|
||||||
use <player>;<channel> for private receivers=
|
Use <player>;<channel> for private receivers=
|
||||||
Teleporting Pneumatic Tube Segment=
|
Teleporting Pneumatic Tube Segment=
|
||||||
unconfigured Teleportation Tube=
|
Teleporting Tube=
|
||||||
|
Unconfigured Teleportation Tube=
|
||||||
Sorry, channel '@1' is reserved for exclusive use by @2=
|
Sorry, channel '@1' is reserved for exclusive use by @2=
|
||||||
Sorry, receiving from channel '@1' is reserved for @2=
|
Sorry, receiving from channel '@1' is reserved for @2=
|
||||||
Teleportation Tube @1 on '@2'=
|
Teleportation Tube @1 on '@2'=
|
||||||
@ -102,7 +107,9 @@ Trash Can=
|
|||||||
Pneumatic tube segment (legacy)=
|
Pneumatic tube segment (legacy)=
|
||||||
|
|
||||||
## vacuum tubes
|
## vacuum tubes
|
||||||
|
Radius=
|
||||||
Vacuuming Pneumatic Tube Segment=
|
Vacuuming Pneumatic Tube Segment=
|
||||||
|
Adjustable Vacuuming Tube=
|
||||||
Adjustable Vacuuming Pneumatic Tube Segment=
|
Adjustable Vacuuming Pneumatic Tube Segment=
|
||||||
Adjustable Vacuuming Pneumatic Tube Segment (@1m)=
|
Adjustable Vacuuming Pneumatic Tube Segment (@1m)=
|
||||||
|
|
||||||
|
@ -10,6 +10,35 @@ minetest.register_craft( {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
-- The hammers that can be used to break/repair tubes
|
||||||
|
local allowed_hammers = {
|
||||||
|
"anvil:hammer",
|
||||||
|
"cottages:hammer",
|
||||||
|
"glooptest:hammer_steel",
|
||||||
|
"glooptest:hammer_bronze",
|
||||||
|
"glooptest:hammer_diamond",
|
||||||
|
"glooptest:hammer_mese",
|
||||||
|
"glooptest:hammer_alatro",
|
||||||
|
"glooptest:hammer_arol"
|
||||||
|
}
|
||||||
|
|
||||||
|
-- Convert the above list to a format that's easier to look up
|
||||||
|
for _,hammer in ipairs(allowed_hammers) do
|
||||||
|
allowed_hammers[hammer] = true
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Check if the player is holding a suitable hammer or not - if they are, apply wear to it
|
||||||
|
function pipeworks.check_and_wear_hammer(player)
|
||||||
|
local itemstack = player:get_wielded_item()
|
||||||
|
local wieldname = itemstack:get_name()
|
||||||
|
if allowed_hammers[wieldname] then
|
||||||
|
itemstack:add_wear(1000)
|
||||||
|
player:set_wielded_item(itemstack)
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
local nodecolor = 0xffff3030
|
local nodecolor = 0xffff3030
|
||||||
|
|
||||||
pipeworks.register_tube("pipeworks:broken_tube", {
|
pipeworks.register_tube("pipeworks:broken_tube", {
|
||||||
@ -36,29 +65,27 @@ pipeworks.register_tube("pipeworks:broken_tube", {
|
|||||||
local wieldname = itemstack:get_name()
|
local wieldname = itemstack:get_name()
|
||||||
local playername = puncher:get_player_name()
|
local playername = puncher:get_player_name()
|
||||||
local log_msg = playername.." struck a broken tube at "..minetest.pos_to_string(pos).."\n"
|
local log_msg = playername.." struck a broken tube at "..minetest.pos_to_string(pos).."\n"
|
||||||
if wieldname == "anvil:hammer"
|
|
||||||
or wieldname == "cottages:hammer"
|
|
||||||
or wieldname == "glooptest:hammer_steel"
|
|
||||||
or wieldname == "glooptest:hammer_bronze"
|
|
||||||
or wieldname == "glooptest:hammer_diamond"
|
|
||||||
or wieldname == "glooptest:hammer_mese"
|
|
||||||
or wieldname == "glooptest:hammer_alatro"
|
|
||||||
or wieldname == "glooptest:hammer_arol" then
|
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
local was_node = minetest.deserialize(meta:get_string("the_tube_was"))
|
local was_node = minetest.deserialize(meta:get_string("the_tube_was"))
|
||||||
if was_node and was_node ~= "" then
|
if not was_node then
|
||||||
pipeworks.logger(log_msg.." with "..wieldname.." to repair it.")
|
|
||||||
minetest.swap_node(pos, { name = was_node.name, param2 = was_node.param2 })
|
|
||||||
pipeworks.scan_for_tube_objects(pos)
|
|
||||||
itemstack:add_wear(1000)
|
|
||||||
puncher:set_wielded_item(itemstack)
|
|
||||||
return itemstack
|
|
||||||
else
|
|
||||||
pipeworks.logger(log_msg.." but it can't be repaired.")
|
pipeworks.logger(log_msg.." but it can't be repaired.")
|
||||||
|
return
|
||||||
|
end
|
||||||
|
if not pipeworks.check_and_wear_hammer(puncher) then
|
||||||
|
if wieldname == "" then
|
||||||
|
pipeworks.logger(log_msg.." by hand. It's not very effective.")
|
||||||
|
if minetest.settings:get_bool("enable_damage") then
|
||||||
|
minetest.chat_send_player(playername,S("Broken tubes may be a bit sharp. Perhaps try with a hammer?"))
|
||||||
|
puncher:set_hp(puncher:get_hp()-1)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
pipeworks.logger(log_msg.." with "..wieldname.." but that tool is too weak.")
|
pipeworks.logger(log_msg.." with "..wieldname.." but that tool is too weak.")
|
||||||
end
|
end
|
||||||
|
return
|
||||||
|
end
|
||||||
|
pipeworks.logger(log_msg.." with "..wieldname.." to repair it.")
|
||||||
|
minetest.swap_node(pos, { name = was_node.name, param2 = was_node.param2 })
|
||||||
|
pipeworks.scan_for_tube_objects(pos)
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -1,4 +1,16 @@
|
|||||||
local S = minetest.get_translator("pipeworks")
|
local S = minetest.get_translator("pipeworks")
|
||||||
|
|
||||||
|
-- the minetest.after() calls below can sometimes trigger after a tube
|
||||||
|
-- breaks, at which point item_exit() is no longer valid, so we have to make
|
||||||
|
-- sure that there even IS a callback to run, first.
|
||||||
|
|
||||||
|
local function after_break(pos)
|
||||||
|
local name = minetest.get_node(pos).name
|
||||||
|
if minetest.registered_nodes[name].item_exit then
|
||||||
|
minetest.registered_nodes[name].item_exit(pos)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
if pipeworks.enable_detector_tube then
|
if pipeworks.enable_detector_tube then
|
||||||
local detector_tube_step = 5 * tonumber(minetest.settings:get("dedicated_server_step"))
|
local detector_tube_step = 5 * tonumber(minetest.settings:get("dedicated_server_step"))
|
||||||
pipeworks.register_tube("pipeworks:detector_tube_on", {
|
pipeworks.register_tube("pipeworks:detector_tube_on", {
|
||||||
@ -8,11 +20,10 @@ if pipeworks.enable_detector_tube then
|
|||||||
node_def = {
|
node_def = {
|
||||||
tube = {can_go = function(pos, node, velocity, stack)
|
tube = {can_go = function(pos, node, velocity, stack)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
local name = minetest.get_node(pos).name
|
|
||||||
local nitems = meta:get_int("nitems")+1
|
local nitems = meta:get_int("nitems")+1
|
||||||
meta:set_int("nitems", nitems)
|
meta:set_int("nitems", nitems)
|
||||||
local saved_pos = vector.new(pos)
|
local saved_pos = vector.new(pos)
|
||||||
minetest.after(detector_tube_step, minetest.registered_nodes[name].item_exit, saved_pos)
|
minetest.after(detector_tube_step, after_break, saved_pos)
|
||||||
return pipeworks.notvel(pipeworks.meseadjlist,velocity)
|
return pipeworks.notvel(pipeworks.meseadjlist,velocity)
|
||||||
end},
|
end},
|
||||||
groups = {mesecon = 2, not_in_creative_inventory = 1},
|
groups = {mesecon = 2, not_in_creative_inventory = 1},
|
||||||
@ -34,9 +45,7 @@ if pipeworks.enable_detector_tube then
|
|||||||
on_construct = function(pos)
|
on_construct = function(pos)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
meta:set_int("nitems", 1)
|
meta:set_int("nitems", 1)
|
||||||
local name = minetest.get_node(pos).name
|
minetest.after(detector_tube_step, after_break, pos)
|
||||||
local saved_pos = vector.new(pos)
|
|
||||||
minetest.after(detector_tube_step, minetest.registered_nodes[name].item_exit, saved_pos)
|
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
@ -87,13 +96,20 @@ if digiline_enabled and pipeworks.enable_digiline_detector_tube then
|
|||||||
on_construct = function(pos)
|
on_construct = function(pos)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
meta:set_string("formspec",
|
meta:set_string("formspec",
|
||||||
"size[8.6,2.2]"..
|
"size[8.5,2.2]"..
|
||||||
"field[0.6,0.6;8,1;channel;"..S("Channel")..";${channel}]"..
|
"image[0.2,0;1,1;pipeworks_digiline_detector_tube_inv.png]"..
|
||||||
"image[0.3,1.3;1,1;pipeworks_digiline_detector_tube_inv.png]"..
|
"label[1.2,0.2;"..S("Digiline Detecting Tube").."]"..
|
||||||
"label[1.6,1.2;"..S("Digiline Detecting Tube").."]"
|
"field[0.5,1.6;4.6,1;channel;"..S("Channel")..";${channel}]"..
|
||||||
|
"button[4.8,1.3;1.5,1;set_channel;"..S("Set").."]"..
|
||||||
|
"button_exit[6.3,1.3;2,1;close;"..S("Close").."]"
|
||||||
)
|
)
|
||||||
end,
|
end,
|
||||||
on_receive_fields = function(pos, formname, fields, sender)
|
on_receive_fields = function(pos, formname, fields, sender)
|
||||||
|
if (fields.quit and not fields.key_enter_field)
|
||||||
|
or (fields.key_enter_field ~= "channel" and not fields.set_channel)
|
||||||
|
or not pipeworks.may_configure(pos, sender) then
|
||||||
|
return
|
||||||
|
end
|
||||||
if fields.channel then
|
if fields.channel then
|
||||||
minetest.get_meta(pos):set_string("channel", fields.channel)
|
minetest.get_meta(pos):set_string("channel", fields.channel)
|
||||||
end
|
end
|
||||||
|
@ -127,14 +127,20 @@ end
|
|||||||
local function update_meta(meta, can_receive)
|
local function update_meta(meta, can_receive)
|
||||||
meta:set_int("can_receive", can_receive and 1 or 0)
|
meta:set_int("can_receive", can_receive and 1 or 0)
|
||||||
local cr_state = can_receive and "on" or "off"
|
local cr_state = can_receive and "on" or "off"
|
||||||
meta:set_string("formspec","size[8.6,2.2]"..
|
local itext = S("Channels are public by default").."\n"..
|
||||||
"field[0.6,0.6;7,1;channel;"..S("Channel")..";${channel}]"..
|
S("Use <player>:<channel> for fully private channels").."\n"..
|
||||||
"label[7.3,0;"..S("Receive").."]"..
|
S("Use <player>\\;<channel> for private receivers")
|
||||||
"image_button[7.3,0.3;1,0.6;pipeworks_button_" .. cr_state .. ".png;cr" .. (can_receive and 0 or 1) .. ";;;false;pipeworks_button_interm.png]"..
|
|
||||||
"image[0.3,1.3;1,1;pipeworks_teleport_tube_inv.png]"..
|
meta:set_string("formspec",
|
||||||
"label[1.6,1.2;"..S("channels are public by default").."]" ..
|
"size[8.5,3.5]"..
|
||||||
"label[1.6,1.5;"..S("use <player>:<channel> for fully private channels").."]" ..
|
"image[0.2,o;1,1;pipeworks_teleport_tube_inv.png]"..
|
||||||
"label[1.6,1.8;"..S("use <player>\\;<channel> for private receivers").."]" ..
|
"label[1.2,0.2;"..S("Teleporting Tube").."]"..
|
||||||
|
"field[0.5,1.6;4.6,1;channel;"..S("Channel")..";${channel}]"..
|
||||||
|
"button[4.8,1.3;1.5,1;set_channel;"..S("Set").."]"..
|
||||||
|
"label[7.0,0;"..S("Receive").."]"..
|
||||||
|
"image_button[7.0,0.5;1,0.6;pipeworks_button_" .. cr_state .. ".png;cr" .. (can_receive and 0 or 1) .. ";;;false;pipeworks_button_interm.png]"..
|
||||||
|
"button_exit[6.3,1.3;2,1;close;"..S("Close").."]"..
|
||||||
|
"label[0.2,2.3;"..itext.."]"..
|
||||||
default.gui_bg..
|
default.gui_bg..
|
||||||
default.gui_bg_img)
|
default.gui_bg_img)
|
||||||
end
|
end
|
||||||
@ -170,10 +176,11 @@ pipeworks.register_tube("pipeworks:teleport_tube", {
|
|||||||
on_construct = function(pos)
|
on_construct = function(pos)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
update_meta(meta, true)
|
update_meta(meta, true)
|
||||||
meta:set_string("infotext", S("unconfigured Teleportation Tube"))
|
meta:set_string("infotext", S("Unconfigured Teleportation Tube"))
|
||||||
end,
|
end,
|
||||||
on_receive_fields = function(pos,formname,fields,sender)
|
on_receive_fields = function(pos,formname,fields,sender)
|
||||||
if not fields.channel -- ignore escaping or clientside manipulation of the form
|
if not fields.channel -- ignore escaping or clientside manipulation of the form
|
||||||
|
or (fields.quit and not fields.key_enter_field)
|
||||||
or not pipeworks.may_configure(pos, sender) then
|
or not pipeworks.may_configure(pos, sender) then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
@ -207,7 +214,7 @@ pipeworks.register_tube("pipeworks:teleport_tube", {
|
|||||||
|
|
||||||
-- was the channel changed?
|
-- was the channel changed?
|
||||||
local channel = meta:get_string("channel")
|
local channel = meta:get_string("channel")
|
||||||
if new_channel ~= channel then
|
if new_channel ~= channel and (fields.key_enter_field == "channel" or fields.set_channel) then
|
||||||
channel = new_channel
|
channel = new_channel
|
||||||
meta:set_string("channel", channel)
|
meta:set_string("channel", channel)
|
||||||
dirty = true
|
dirty = true
|
||||||
@ -233,7 +240,7 @@ pipeworks.register_tube("pipeworks:teleport_tube", {
|
|||||||
else
|
else
|
||||||
-- remove empty channel tubes, to not have to search through them
|
-- remove empty channel tubes, to not have to search through them
|
||||||
remove_tube(pos)
|
remove_tube(pos)
|
||||||
meta:set_string("infotext", S("unconfigured Teleportation Tube"))
|
meta:set_string("infotext", S("Unconfigured Teleportation Tube"))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
@ -113,6 +113,18 @@ local register_one_tube = function(name, tname, dropname, desc, plain, noctrs, e
|
|||||||
connect_sides = {front = 1, back = 1, left = 1, right = 1, top = 1, bottom = 1},
|
connect_sides = {front = 1, back = 1, left = 1, right = 1, top = 1, bottom = 1},
|
||||||
priority = 50
|
priority = 50
|
||||||
},
|
},
|
||||||
|
on_punch = function(pos, node, player, pointed)
|
||||||
|
local playername = player:get_player_name()
|
||||||
|
if minetest.is_protected(pos, playername) and not minetest.check_player_privs(playername, {protection_bypass=true}) then
|
||||||
|
return minetest.node_punch(pos, node, player, pointed)
|
||||||
|
end
|
||||||
|
if pipeworks.check_and_wear_hammer(player) then
|
||||||
|
local wieldname = player:get_wielded_item():get_name()
|
||||||
|
pipeworks.logger(string.format("%s struck a tube at %s with %s to break it.", playername, minetest.pos_to_string(pos), wieldname))
|
||||||
|
pipeworks.break_tube(pos)
|
||||||
|
end
|
||||||
|
return minetest.node_punch(pos, node, player, pointed)
|
||||||
|
end,
|
||||||
after_place_node = pipeworks.after_place,
|
after_place_node = pipeworks.after_place,
|
||||||
after_dig_node = pipeworks.after_dig,
|
after_dig_node = pipeworks.after_dig,
|
||||||
on_rotate = false,
|
on_rotate = false,
|
||||||
|
@ -40,22 +40,31 @@ if pipeworks.enable_mese_sand_tube then
|
|||||||
on_construct = function(pos)
|
on_construct = function(pos)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
meta:set_int("dist", 0)
|
meta:set_int("dist", 0)
|
||||||
meta:set_string("formspec", "size[2.1,0.8]"..
|
meta:set_string("formspec",
|
||||||
"image[0,0;1,1;pipeworks_mese_sand_tube_inv.png]"..
|
"size[6.0,2.2]"..
|
||||||
"field[1.3,0.4;1,1;dist;radius;${dist}]"..
|
"image[0.2,0;1,1;pipeworks_mese_sand_tube_inv.png]"..
|
||||||
|
"label[1.2,0.2;"..S("Adjustable Vacuuming Tube").."]"..
|
||||||
|
"field[0.5,1.6;2.1,1;dist;"..S("Radius")..";${dist}]"..
|
||||||
|
"button[2.3,1.3;1.5,1;set_dist;"..S("Set").."]"..
|
||||||
|
"button_exit[3.8,1.3;2,1;close;"..S("Close").."]"..
|
||||||
default.gui_bg..
|
default.gui_bg..
|
||||||
default.gui_bg_img)
|
default.gui_bg_img)
|
||||||
meta:set_string("infotext", S("Adjustable Vacuuming Pneumatic Tube Segment"))
|
meta:set_string("infotext", S("Adjustable Vacuuming Pneumatic Tube Segment"))
|
||||||
end,
|
end,
|
||||||
on_receive_fields = function(pos,formname,fields,sender)
|
on_receive_fields = function(pos,formname,fields,sender)
|
||||||
if not pipeworks.may_configure(pos, sender) then return end
|
if (fields.quit and not fields.key_enter_field)
|
||||||
|
or (fields.key_enter_field ~= "dist" and not fields.set_dist)
|
||||||
|
or not pipeworks.may_configure(pos, sender) then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
local dist = tonumber(fields.dist)
|
local dist = tonumber(fields.dist)
|
||||||
if dist then
|
if dist then
|
||||||
dist = math.max(0, dist)
|
dist = math.max(0, dist)
|
||||||
dist = math.min(8, dist)
|
dist = math.min(8, dist)
|
||||||
meta:set_int("dist", dist)
|
meta:set_int("dist", dist)
|
||||||
meta:set_string("infotext", (S("Adjustable Vacuuming Pneumatic Tube Segment (@1m)", dist)))
|
meta:set_string("infotext", S("Adjustable Vacuuming Pneumatic Tube Segment (@1m)", dist))
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user