1
0
mirror of https://github.com/mt-mods/pipeworks.git synced 2025-07-18 08:10:25 +02:00

18 Commits

Author SHA1 Message Date
f7839444cd Merge remote-tracking branch 'upstream/master' 2021-03-25 21:57:03 +01:00
93f5fb3d87 Merge remote-tracking branch 'upstream/master' 2021-03-12 12:36:16 +01:00
a535bebd2e Merge remote-tracking branch 'upstream/master' 2021-02-13 14:18:53 +01:00
be2776fc46 Merge remote-tracking branch 'upstream/master' 2021-02-07 13:13:20 +01:00
ee03959a65 Merge remote-tracking branch 'upstream/master' 2020-12-20 15:26:00 +01:00
4dd30df37a Merge remote-tracking branch 'upstream/master' 2020-10-29 22:16:20 +01:00
946da11206 Merge remote-tracking branch 'upstream/master' 2020-10-18 02:13:58 +02:00
77c8026400 Merge remote-tracking branch 'upstream/master' 2020-09-26 11:40:25 +02:00
70b521c721 Merge remote-tracking branch 'upstream/master' 2020-09-11 20:50:17 +02:00
6d795b7d34 Merge remote-tracking branch 'upstream/master' 2020-08-11 20:30:19 +02:00
92249b7941 Merge remote-tracking branch 'upstream/master' 2020-07-31 22:18:16 +02:00
e04fb691ad Merge remote-tracking branch 'upstream/master' 2020-07-19 22:41:58 +02:00
ac80224371 Merge remote-tracking branch 'upstream/master' 2020-07-17 22:41:46 +02:00
34262ed8d5 Merge remote-tracking branch 'upstream/master' into nalc-1.2-dev 2020-06-14 21:11:09 +02:00
5cfe8d893f Merge branch 'master' of yunohost.local:mtcontrib/pipeworks into nalc-1.2-dev 2020-03-25 23:00:57 +01:00
975e20f704 Merge branch 'master' of yunohost.local:mtcontrib/pipeworks into nalc-1.2-dev 2019-12-22 14:33:13 +01:00
2693e2ecbb Merge branch 'master' into nalc-1.2 2019-05-04 19:56:03 +02:00
c93df73a5c Rend les items du groupe limitcraft non craftable par l'autocrafter 2019-03-02 19:29:26 +01:00
20 changed files with 81 additions and 223 deletions

View File

@ -19,6 +19,6 @@ read_globals = {
-- mods -- mods
"default", "mesecon", "digiline", "default", "mesecon", "digiline",
"screwdriver", "unified_inventory" "screwdriver"
} }

View File

@ -67,8 +67,11 @@ local function run_autocrafter(pos, elapsed)
local inventory = meta:get_inventory() local inventory = meta:get_inventory()
local craft = get_craft(pos, inventory) local craft = get_craft(pos, inventory)
local output_item = craft.output.item local output_item = craft.output.item
-- NALC: existence de limitgroup ?
local limitcraft = minetest.get_item_group(output_item:get_name(), "limitcraft") or 0
-- only use crafts that have an actual result -- only use crafts that have an actual result
if output_item:is_empty() then -- NALC: ou si l'item n'est pas dans le group limitcraft
if output_item:is_empty() or limitcraft > 0 then
meta:set_string("infotext", S("unconfigured Autocrafter: unknown recipe")) meta:set_string("infotext", S("unconfigured Autocrafter: unknown recipe"))
return false return false
end end
@ -423,7 +426,6 @@ minetest.register_node("pipeworks:autocrafter", {
}, },
}, },
}) })
pipeworks.ui_cat_tube_list[#pipeworks.ui_cat_tube_list+1] = "pipeworks:autocrafter"
minetest.register_craft( { minetest.register_craft( {
output = "pipeworks:autocrafter 2", output = "pipeworks:autocrafter 2",

View File

@ -28,7 +28,6 @@ minetest.register_node("pipeworks:steel_block_embedded_tube", {
after_dig_node = pipeworks.after_dig, after_dig_node = pipeworks.after_dig,
on_rotate = pipeworks.on_rotate, on_rotate = pipeworks.on_rotate,
}) })
pipeworks.ui_cat_tube_list[#pipeworks.ui_cat_tube_list+1] = "pipeworks:steel_block_embedded_tube"
minetest.register_craft( { minetest.register_craft( {
output = "pipeworks:steel_block_embedded_tube 1", output = "pipeworks:steel_block_embedded_tube 1",
@ -82,7 +81,6 @@ minetest.register_node("pipeworks:steel_pane_embedded_tube", {
after_dig_node = pipeworks.after_dig, after_dig_node = pipeworks.after_dig,
on_rotate = pipeworks.on_rotate, on_rotate = pipeworks.on_rotate,
}) })
pipeworks.ui_cat_tube_list[#pipeworks.ui_cat_tube_list+1] = "pipeworks:steel_pane_embedded_tube"
minetest.register_craft( { minetest.register_craft( {
output = "pipeworks:steel_pane_embedded_tube 1", output = "pipeworks:steel_pane_embedded_tube 1",

View File

@ -222,8 +222,6 @@ for s in ipairs(states) do
new_flow_logic_register.directional_horizonal_rotate(nodename_valve_empty, true) new_flow_logic_register.directional_horizonal_rotate(nodename_valve_empty, true)
end end
end end
pipeworks.ui_cat_tube_list[#pipeworks.ui_cat_tube_list+1] = "pipeworks:pump_off"
pipeworks.ui_cat_tube_list[#pipeworks.ui_cat_tube_list+1] = "pipeworks:valve_off_empty"
local nodename_valve_loaded = "pipeworks:valve_on_loaded" local nodename_valve_loaded = "pipeworks:valve_on_loaded"
minetest.register_node(nodename_valve_loaded, { minetest.register_node(nodename_valve_loaded, {
@ -303,7 +301,6 @@ minetest.register_node("pipeworks:grating", {
end, end,
on_rotate = false on_rotate = false
}) })
pipeworks.ui_cat_tube_list[#pipeworks.ui_cat_tube_list+1] = "pipeworks:grating"
-- outlet spigot -- outlet spigot
@ -381,8 +378,6 @@ minetest.register_node(nodename_spigot_loaded, {
drop = "pipeworks:spigot", drop = "pipeworks:spigot",
on_rotate = pipeworks.fix_after_rotation on_rotate = pipeworks.fix_after_rotation
}) })
pipeworks.ui_cat_tube_list[#pipeworks.ui_cat_tube_list+1] = "pipeworks:spigot"
-- new flow logic does not currently distinguish between these two visual states. -- new flow logic does not currently distinguish between these two visual states.
-- register both so existing flowing spigots continue to work (even if the visual doesn't match the spigot's behaviour). -- register both so existing flowing spigots continue to work (even if the visual doesn't match the spigot's behaviour).
new_flow_logic_register.directional_horizonal_rotate(nodename_spigot_empty, false) new_flow_logic_register.directional_horizonal_rotate(nodename_spigot_empty, false)
@ -446,9 +441,6 @@ minetest.register_node(nodename_panel_loaded, {
drop = "pipeworks:entry_panel_empty", drop = "pipeworks:entry_panel_empty",
on_rotate = pipeworks.fix_after_rotation on_rotate = pipeworks.fix_after_rotation
}) })
pipeworks.ui_cat_tube_list[#pipeworks.ui_cat_tube_list+1] = "pipeworks:entry_panel_empty"
-- TODO: AFAIK the two panels have no visual difference, so are redundant under new flow logic - alias? -- TODO: AFAIK the two panels have no visual difference, so are redundant under new flow logic - alias?
new_flow_logic_register.directional_horizonal_rotate(nodename_panel_empty, true) new_flow_logic_register.directional_horizonal_rotate(nodename_panel_empty, true)
new_flow_logic_register.directional_horizonal_rotate(nodename_panel_loaded, true) new_flow_logic_register.directional_horizonal_rotate(nodename_panel_loaded, true)
@ -533,8 +525,6 @@ minetest.register_node(nodename_sensor_loaded, {
mesecons = pipereceptor_on, mesecons = pipereceptor_on,
on_rotate = pipeworks.fix_after_rotation on_rotate = pipeworks.fix_after_rotation
}) })
pipeworks.ui_cat_tube_list[#pipeworks.ui_cat_tube_list+1] = "pipeworks:flow_sensor_empty"
new_flow_logic_register.directional_horizonal_rotate(nodename_sensor_empty, true) new_flow_logic_register.directional_horizonal_rotate(nodename_sensor_empty, true)
new_flow_logic_register.directional_horizonal_rotate(nodename_sensor_loaded, true) new_flow_logic_register.directional_horizonal_rotate(nodename_sensor_loaded, true)
-- activate flow sensor at roughly half the pressure pumps drive pipes -- activate flow sensor at roughly half the pressure pumps drive pipes
@ -613,7 +603,6 @@ for fill = 0, 10 do
on_rotate = false on_rotate = false
}) })
end end
pipeworks.ui_cat_tube_list[#pipeworks.ui_cat_tube_list+1] = "pipeworks:storage_tank_0"
-- fountainhead -- fountainhead
@ -650,7 +639,6 @@ minetest.register_node(nodename_fountain_empty, {
}, },
on_rotate = false on_rotate = false
}) })
pipeworks.ui_cat_tube_list[#pipeworks.ui_cat_tube_list+1] = "pipeworks:fountainhead"
local nodename_fountain_loaded = "pipeworks:fountainhead_pouring" local nodename_fountain_loaded = "pipeworks:fountainhead_pouring"
minetest.register_node(nodename_fountain_loaded, { minetest.register_node(nodename_fountain_loaded, {
@ -746,7 +734,6 @@ minetest.register_node(nodename_sp_loaded, {
check_for_pole = pipeworks.check_for_vert_pipe, check_for_pole = pipeworks.check_for_vert_pipe,
check_for_horiz_pole = pipeworks.check_for_horiz_pipe check_for_horiz_pole = pipeworks.check_for_horiz_pipe
}) })
pipeworks.ui_cat_tube_list[#pipeworks.ui_cat_tube_list+1] = "pipeworks:straight_pipe_empty"
new_flow_logic_register.directional_horizonal_rotate(nodename_sp_empty, true) new_flow_logic_register.directional_horizonal_rotate(nodename_sp_empty, true)
new_flow_logic_register.directional_horizonal_rotate(nodename_sp_loaded, true) new_flow_logic_register.directional_horizonal_rotate(nodename_sp_loaded, true)

View File

@ -14,20 +14,17 @@ local function set_filter_formspec(data, meta)
local formspec local formspec
if data.digiline then if data.digiline then
formspec = formspec = "size[8,2.7]"..
"size[8.5,3]".. "item_image[0,0;1,1;pipeworks:"..data.name.."]"..
"item_image[0.2,0;1,1;pipeworks:"..data.name.."]".. "label[1,0;"..minetest.formspec_escape(itemname).."]"..
"label[1.2,0.2;"..minetest.formspec_escape(itemname).."]".. "field[0.3,1.5;8.0,1;channel;"..S("Channel")..";${channel}]"..
"field[0.5,1.6;4.6,1;channel;"..S("Channel")..";${channel}]".. fs_helpers.cycling_button(meta, "button[0,2;4,1", "slotseq_mode",
"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.25,2.3;4.05,1", "exmatch_mode", fs_helpers.cycling_button(meta, "button[4,2;4,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
@ -428,14 +425,10 @@ 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 (fields.quit and not fields.key_enter_field) if not pipeworks.may_configure(pos, sender) then return end
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 and (fields.key_enter_field == "channel" or fields.set_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
@ -479,7 +472,6 @@ for _, data in ipairs({
minetest.register_node("pipeworks:"..data.name, node) minetest.register_node("pipeworks:"..data.name, node)
pipeworks.ui_cat_tube_list[#pipeworks.ui_cat_tube_list+1] = "pipeworks:"..data.name
end end
minetest.register_craft( { minetest.register_craft( {

View File

@ -5,7 +5,6 @@
-- --
pipeworks = {} pipeworks = {}
pipeworks.ui_cat_tube_list = {}
pipeworks.worldpath = minetest.get_worldpath() pipeworks.worldpath = minetest.get_worldpath()
pipeworks.modpath = minetest.get_modpath("pipeworks") pipeworks.modpath = minetest.get_modpath("pipeworks")
@ -149,16 +148,4 @@ end
minetest.register_alias("pipeworks:pipe", "pipeworks:pipe_110000_empty") minetest.register_alias("pipeworks:pipe", "pipeworks:pipe_110000_empty")
-- Unified Inventory categories integration
if unified_inventory and unified_inventory.registered_categories then
if not unified_inventory.registered_categories["automation"] then
unified_inventory.register_category("automation", {
symbol = "pipeworks:lua_tube000000",
label = "Automation components"
})
end
unified_inventory.add_category_items("automation", pipeworks.ui_cat_tube_list)
end
minetest.log("info", "Pipeworks loaded!") minetest.log("info", "Pipeworks loaded!")

View File

@ -55,22 +55,15 @@ 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..")")
pipeworks.break_tube(pos) minetest.swap_node(pos, {name = "pipeworks:broken_tube_1"})
pipeworks.scan_for_tube_objects(pos)
end end
end end
end end

View File

@ -3,10 +3,6 @@
# 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
@ -90,12 +86,11 @@ 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
Teleporting Tube=Tuyau pneumatique téléporteur unconfigured Teleportation Tube=Tuyau téléporteur non-configuré
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 à lutilisateur @2. Sorry, channel '@1' is reserved for exclusive use by @2=Désolé, le canal '@1' est réservé exclusivement à lutilisateur @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'
@ -107,9 +102,7 @@ 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)

View File

@ -2,10 +2,6 @@
# 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=频道
@ -88,12 +84,11 @@ 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=传送管道
Teleporting Tube= unconfigured Teleportation 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'上
@ -105,9 +100,7 @@ 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)

View File

@ -3,10 +3,6 @@
# License: CC-by-SA 4.0 # License: CC-by-SA 4.0
# Author: # Author:
## generic interaction
Set=
Cancel=
## digilines interfacing ## digilines interfacing
Channel= Channel=
@ -90,12 +86,11 @@ 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=
Teleporting Tube= unconfigured Teleportation 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'=
@ -107,9 +102,7 @@ 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)=

View File

@ -981,8 +981,6 @@ end
end end
end end
pipeworks.ui_cat_tube_list[#pipeworks.ui_cat_tube_list+1] = BASENAME.."000000"
------------------------------------ ------------------------------------
-- Overheated Lua controlled Tube -- -- Overheated Lua controlled Tube --
------------------------------------ ------------------------------------

View File

@ -1,5 +1,5 @@
name = pipeworks name = pipeworks
description = This mod uses mesh nodes and nodeboxes to supply a complete set of 3D pipes and tubes, along with devices that work with them. description = This mod uses mesh nodes and nodeboxes to supply a complete set of 3D pipes and tubes, along with devices that work with them.
depends = default, basic_materials, screwdriver depends = default, basic_materials, screwdriver
optional_depends = mesecons, mesecons_mvps, digilines, signs_lib, unified_inventory optional_depends = mesecons, mesecons_mvps, digilines, signs_lib
min_minetest_version = 5.2.0 min_minetest_version = 5.2.0

View File

@ -133,7 +133,7 @@ for index, connects in ipairs(cconnects) do
new_flow_logic_register.simple(emptypipe) new_flow_logic_register.simple(emptypipe)
new_flow_logic_register.simple(fullpipe) new_flow_logic_register.simple(fullpipe)
end end
pipeworks.ui_cat_tube_list[#pipeworks.ui_cat_tube_list+1] = "pipeworks:pipe_1_empty"
if REGISTER_COMPATIBILITY then if REGISTER_COMPATIBILITY then

View File

@ -10,35 +10,6 @@ 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", {
@ -65,27 +36,29 @@ 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"
local meta = minetest.get_meta(pos) if wieldname == "anvil:hammer"
local was_node = minetest.deserialize(meta:get_string("the_tube_was")) or wieldname == "cottages:hammer"
if not was_node then or wieldname == "glooptest:hammer_steel"
pipeworks.logger(log_msg.." but it can't be repaired.") or wieldname == "glooptest:hammer_bronze"
return or wieldname == "glooptest:hammer_diamond"
end or wieldname == "glooptest:hammer_mese"
if not pipeworks.check_and_wear_hammer(puncher) then or wieldname == "glooptest:hammer_alatro"
if wieldname == "" then or wieldname == "glooptest:hammer_arol" then
pipeworks.logger(log_msg.." by hand. It's not very effective.") local meta = minetest.get_meta(pos)
if minetest.settings:get_bool("enable_damage") then local was_node = minetest.deserialize(meta:get_string("the_tube_was"))
minetest.chat_send_player(playername,S("Broken tubes may be a bit sharp. Perhaps try with a hammer?")) if was_node and was_node ~= "" then
puncher:set_hp(puncher:get_hp()-1) pipeworks.logger(log_msg.." with "..wieldname.." to repair it.")
end 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 else
pipeworks.logger(log_msg.." with "..wieldname.." but that tool is too weak.") pipeworks.logger(log_msg.." but it can't be repaired.")
end end
return else
pipeworks.logger(log_msg.." with "..wieldname.." but that tool is too weak.")
end 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
} }
}) })
@ -192,7 +165,6 @@ if pipeworks.enable_one_way_tube then
check_for_pole = pipeworks.check_for_vert_tube, check_for_pole = pipeworks.check_for_vert_tube,
check_for_horiz_pole = pipeworks.check_for_horiz_tube check_for_horiz_pole = pipeworks.check_for_horiz_tube
}) })
pipeworks.ui_cat_tube_list[#pipeworks.ui_cat_tube_list+1] = "pipeworks:one_way_tube"
minetest.register_craft({ minetest.register_craft({
output = "pipeworks:one_way_tube 2", output = "pipeworks:one_way_tube 2",
recipe = { recipe = {

View File

@ -1,16 +1,4 @@
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", {
@ -20,10 +8,11 @@ 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, after_break, saved_pos) minetest.after(detector_tube_step, minetest.registered_nodes[name].item_exit, 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},
@ -45,7 +34,9 @@ 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)
minetest.after(detector_tube_step, after_break, pos) local name = minetest.get_node(pos).name
local saved_pos = vector.new(pos)
minetest.after(detector_tube_step, minetest.registered_nodes[name].item_exit, saved_pos)
end, end,
}, },
}) })
@ -96,20 +87,13 @@ 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.5,2.2]".. "size[8.6,2.2]"..
"image[0.2,0;1,1;pipeworks_digiline_detector_tube_inv.png]".. "field[0.6,0.6;8,1;channel;"..S("Channel")..";${channel}]"..
"label[1.2,0.2;"..S("Digiline Detecting Tube").."]".. "image[0.3,1.3;1,1;pipeworks_digiline_detector_tube_inv.png]"..
"field[0.5,1.6;4.6,1;channel;"..S("Channel")..";${channel}]".. "label[1.6,1.2;"..S("Digiline Detecting Tube").."]"
"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

View File

@ -127,22 +127,16 @@ 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"
local itext = S("Channels are public by default").."\n".. meta:set_string("formspec","size[8.6,2.2]"..
S("Use <player>:<channel> for fully private channels").."\n".. "field[0.6,0.6;7,1;channel;"..S("Channel")..";${channel}]"..
S("Use <player>\\;<channel> for private receivers") "label[7.3,0;"..S("Receive").."]"..
"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]"..
meta:set_string("formspec", "image[0.3,1.3;1,1;pipeworks_teleport_tube_inv.png]"..
"size[8.5,3.5]".. "label[1.6,1.2;"..S("channels are public by default").."]" ..
"image[0.2,o;1,1;pipeworks_teleport_tube_inv.png]".. "label[1.6,1.5;"..S("use <player>:<channel> for fully private channels").."]" ..
"label[1.2,0.2;"..S("Teleporting Tube").."]".. "label[1.6,1.8;"..S("use <player>\\;<channel> for private receivers").."]" ..
"field[0.5,1.6;4.6,1;channel;"..S("Channel")..";${channel}]".. default.gui_bg..
"button[4.8,1.3;1.5,1;set_channel;"..S("Set").."]".. default.gui_bg_img)
"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_img)
end end
pipeworks.register_tube("pipeworks:teleport_tube", { pipeworks.register_tube("pipeworks:teleport_tube", {
@ -176,11 +170,10 @@ 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
@ -214,7 +207,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 and (fields.key_enter_field == "channel" or fields.set_channel) then if new_channel ~= channel then
channel = new_channel channel = new_channel
meta:set_string("channel", channel) meta:set_string("channel", channel)
dirty = true dirty = true
@ -240,7 +233,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,

View File

@ -40,7 +40,6 @@ minetest.register_node("pipeworks:trashcan", {
minetest.get_meta(pos):get_inventory():set_stack(listname, index, ItemStack("")) minetest.get_meta(pos):get_inventory():set_stack(listname, index, ItemStack(""))
end, end,
}) })
pipeworks.ui_cat_tube_list[#pipeworks.ui_cat_tube_list+1] = "pipeworks:trashcan"
minetest.register_craft({ minetest.register_craft({
output = "pipeworks:trashcan", output = "pipeworks:trashcan",

View File

@ -113,18 +113,6 @@ 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,
@ -200,7 +188,6 @@ local register_all_tubes = function(name, desc, plain, noctrs, ends, short, inv,
end end
end end
end end
pipeworks.ui_cat_tube_list[#pipeworks.ui_cat_tube_list+1] = name.."_000000"
else else
-- 6d tubes: uses only 10 nodes instead of 64, but the textures must be rotated -- 6d tubes: uses only 10 nodes instead of 64, but the textures must be rotated
local cconnects = {{}, {1}, {1, 2}, {1, 3}, {1, 3, 5}, {1, 2, 3}, {1, 2, 3, 5}, {1, 2, 3, 4}, {1, 2, 3, 4, 5}, {1, 2, 3, 4, 5, 6}} local cconnects = {{}, {1}, {1, 2}, {1, 3}, {1, 3, 5}, {1, 2, 3}, {1, 2, 3, 5}, {1, 2, 3, 4}, {1, 2, 3, 4, 5}, {1, 2, 3, 4, 5, 6}}
@ -223,7 +210,6 @@ local register_all_tubes = function(name, desc, plain, noctrs, ends, short, inv,
tube = {connect_sides = {front = 1, back = 1, left = 1, right = 1, top = 1, bottom = 1}}, tube = {connect_sides = {front = 1, back = 1, left = 1, right = 1, top = 1, bottom = 1}},
drop = name.."_1", drop = name.."_1",
}) })
pipeworks.ui_cat_tube_list[#pipeworks.ui_cat_tube_list+1] = name.."_1"
table.insert(tubenodes, cname) table.insert(tubenodes, cname)
for xm = 0, 1 do for xm = 0, 1 do
for xp = 0, 1 do for xp = 0, 1 do

View File

@ -40,31 +40,22 @@ 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", meta:set_string("formspec", "size[2.1,0.8]"..
"size[6.0,2.2]".. "image[0,0;1,1;pipeworks_mese_sand_tube_inv.png]"..
"image[0.2,0;1,1;pipeworks_mese_sand_tube_inv.png]".. "field[1.3,0.4;1,1;dist;radius;${dist}]"..
"label[1.2,0.2;"..S("Adjustable Vacuuming Tube").."]".. default.gui_bg..
"field[0.5,1.6;2.1,1;dist;"..S("Radius")..";${dist}]".. default.gui_bg_img)
"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_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 (fields.quit and not fields.key_enter_field) if not pipeworks.may_configure(pos, sender) then return end
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,
}, },

View File

@ -7,7 +7,7 @@ end
local function set_wielder_formspec(data, meta) local function set_wielder_formspec(data, meta)
meta:set_string("formspec", meta:set_string("formspec",
"size[8,"..(6+data.wield_inv_height)..";]".. "invsize[8,"..(6+data.wield_inv_height)..";]"..
"item_image[0,0;1,1;"..data.name_base.."_off]".. "item_image[0,0;1,1;"..data.name_base.."_off]"..
"label[1,0;"..minetest.formspec_escape(data.description).."]".. "label[1,0;"..minetest.formspec_escape(data.description).."]"..
"list[current_name;"..minetest.formspec_escape(data.wield_inv_name)..";"..((8-data.wield_inv_width)*0.5)..",1;"..data.wield_inv_width..","..data.wield_inv_height..";]".. "list[current_name;"..minetest.formspec_escape(data.wield_inv_name)..";"..((8-data.wield_inv_width)*0.5)..",1;"..data.wield_inv_width..","..data.wield_inv_height..";]"..
@ -371,7 +371,6 @@ if pipeworks.enable_node_breaker then
eject_drops = true, eject_drops = true,
} }
register_wielder(data) register_wielder(data)
pipeworks.ui_cat_tube_list[#pipeworks.ui_cat_tube_list+1] = "pipeworks:nodebreaker_off"
minetest.register_craft({ minetest.register_craft({
output = "pipeworks:nodebreaker_off", output = "pipeworks:nodebreaker_off",
recipe = { recipe = {
@ -423,7 +422,6 @@ if pipeworks.enable_deployer then
end, end,
eject_drops = false, eject_drops = false,
}) })
pipeworks.ui_cat_tube_list[#pipeworks.ui_cat_tube_list+1] = "pipeworks:deployer_off"
minetest.register_craft({ minetest.register_craft({
output = "pipeworks:deployer_off", output = "pipeworks:deployer_off",
recipe = { recipe = {
@ -459,7 +457,6 @@ if pipeworks.enable_dispenser then
end, end,
eject_drops = false, eject_drops = false,
}) })
pipeworks.ui_cat_tube_list[#pipeworks.ui_cat_tube_list+1] = "pipeworks:dispenser_off"
minetest.register_craft({ minetest.register_craft({
output = "pipeworks:dispenser_off", output = "pipeworks:dispenser_off",
recipe = { recipe = {