mirror of
				https://github.com/mt-mods/pipeworks.git
				synced 2025-11-04 12:55:32 +01:00 
			
		
		
		
	Compare commits
	
		
			26 Commits
		
	
	
		
			2021-02-19
			...
			e4db1e885e
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| e4db1e885e | |||
| 
						 | 
					828c50e85d | ||
| 
						 | 
					4add40705f | ||
| 
						 | 
					a6e4f2dceb | ||
| 
						 | 
					7ad991ce40 | ||
| f7839444cd | |||
| 
						 | 
					d2954c5277 | ||
| 93f5fb3d87 | |||
| 
						 | 
					9ad6e5d07a | ||
| 
						 | 
					31e1255245 | ||
| a535bebd2e | |||
| be2776fc46 | |||
| ee03959a65 | |||
| 4dd30df37a | |||
| 946da11206 | |||
| 77c8026400 | |||
| 70b521c721 | |||
| 6d795b7d34 | |||
| 92249b7941 | |||
| e04fb691ad | |||
| ac80224371 | |||
| 34262ed8d5 | |||
| 5cfe8d893f | |||
| 975e20f704 | |||
| 2693e2ecbb | |||
| 
						 | 
					c93df73a5c | 
							
								
								
									
										8
									
								
								.gitlab-ci.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								.gitlab-ci.yml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,8 @@
 | 
			
		||||
stages:
 | 
			
		||||
  - test
 | 
			
		||||
 | 
			
		||||
luacheck:
 | 
			
		||||
 stage: test
 | 
			
		||||
 image: pipelinecomponents/luacheck:latest
 | 
			
		||||
 script:
 | 
			
		||||
  - luacheck .
 | 
			
		||||
							
								
								
									
										24
									
								
								.luacheckrc
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										24
									
								
								.luacheckrc
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,24 @@
 | 
			
		||||
unused_args = false
 | 
			
		||||
max_line_length= 240
 | 
			
		||||
redefined = false
 | 
			
		||||
 | 
			
		||||
globals = {
 | 
			
		||||
	"pipeworks",
 | 
			
		||||
	"luaentity"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
read_globals = {
 | 
			
		||||
	-- Stdlib
 | 
			
		||||
	string = {fields = {"split"}},
 | 
			
		||||
	table = {fields = {"copy", "getn"}},
 | 
			
		||||
 | 
			
		||||
	-- Minetest
 | 
			
		||||
	"vector", "ItemStack",
 | 
			
		||||
	"dump", "minetest",
 | 
			
		||||
	"VoxelManip", "VoxelArea",
 | 
			
		||||
 | 
			
		||||
	-- mods
 | 
			
		||||
	"default", "mesecon", "digiline",
 | 
			
		||||
	"screwdriver"
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -67,8 +67,11 @@ local function run_autocrafter(pos, elapsed)
 | 
			
		||||
	local inventory = meta:get_inventory()
 | 
			
		||||
	local craft = get_craft(pos, inventory)
 | 
			
		||||
	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
 | 
			
		||||
	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"))
 | 
			
		||||
		return false
 | 
			
		||||
	end
 | 
			
		||||
 
 | 
			
		||||
@@ -45,6 +45,10 @@ local pane_box = {
 | 
			
		||||
		{ -8/16, -8/16, -1/16, 8/16, 8/16, 1/16 } -- pane
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
local texture_alpha_mode = minetest.features.use_texture_alpha_string_modes
 | 
			
		||||
	and "clip" or true
 | 
			
		||||
 | 
			
		||||
minetest.register_node("pipeworks:steel_pane_embedded_tube", {
 | 
			
		||||
	drawtype = "nodebox",
 | 
			
		||||
	description = S("Airtight panel embedded tube"),
 | 
			
		||||
@@ -55,6 +59,7 @@ minetest.register_node("pipeworks:steel_pane_embedded_tube", {
 | 
			
		||||
		"pipeworks_pane_embedded_tube_sides.png",
 | 
			
		||||
		"pipeworks_pane_embedded_tube_ends.png", "pipeworks_pane_embedded_tube_ends.png",
 | 
			
		||||
		},
 | 
			
		||||
	use_texture_alpha = texture_alpha_mode,
 | 
			
		||||
	node_box = pane_box,
 | 
			
		||||
	selection_box = pane_box,
 | 
			
		||||
	collision_box = pane_box,
 | 
			
		||||
 
 | 
			
		||||
@@ -14,17 +14,20 @@ local function set_filter_formspec(data, meta)
 | 
			
		||||
 | 
			
		||||
	local formspec
 | 
			
		||||
	if data.digiline then
 | 
			
		||||
		formspec = "size[8,2.7]"..
 | 
			
		||||
			"item_image[0,0;1,1;pipeworks:"..data.name.."]"..
 | 
			
		||||
			"label[1,0;"..minetest.formspec_escape(itemname).."]"..
 | 
			
		||||
			"field[0.3,1.5;8.0,1;channel;"..S("Channel")..";${channel}]"..
 | 
			
		||||
			fs_helpers.cycling_button(meta, "button[0,2;4,1", "slotseq_mode",
 | 
			
		||||
		formspec =
 | 
			
		||||
			"size[8.5,3]"..
 | 
			
		||||
			"item_image[0.2,0;1,1;pipeworks:"..data.name.."]"..
 | 
			
		||||
			"label[1.2,0.2;"..minetest.formspec_escape(itemname).."]"..
 | 
			
		||||
			"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 Randomly"),
 | 
			
		||||
				 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 - on")})
 | 
			
		||||
				 S("Exact match - on")})..
 | 
			
		||||
			"button_exit[6.3,1.3;2,1;close;"..S("Close").."]"
 | 
			
		||||
	else
 | 
			
		||||
		local exmatch_button = ""
 | 
			
		||||
		if data.stackwise then
 | 
			
		||||
@@ -425,10 +428,14 @@ for _, data in ipairs({
 | 
			
		||||
		end
 | 
			
		||||
 | 
			
		||||
		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)
 | 
			
		||||
 | 
			
		||||
			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)
 | 
			
		||||
			end
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -55,15 +55,22 @@ end)
 | 
			
		||||
-- tube overload mechanism:
 | 
			
		||||
-- 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.
 | 
			
		||||
 | 
			
		||||
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)
 | 
			
		||||
	if enable_max_limit then
 | 
			
		||||
		local h = minetest.hash_node_position(pos)
 | 
			
		||||
		local itemcount = tube_item_count[h] or 0
 | 
			
		||||
		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..")")
 | 
			
		||||
			minetest.swap_node(pos, {name = "pipeworks:broken_tube_1"})
 | 
			
		||||
			pipeworks.scan_for_tube_objects(pos)
 | 
			
		||||
			pipeworks.break_tube(pos)
 | 
			
		||||
		end
 | 
			
		||||
	end
 | 
			
		||||
end
 | 
			
		||||
 
 | 
			
		||||
@@ -3,6 +3,10 @@
 | 
			
		||||
# License: CC-by-SA 4.0
 | 
			
		||||
# Author: Louis Royer <4259825-lroyer@users.noreply.gitlab.com>
 | 
			
		||||
 | 
			
		||||
## generic interaction
 | 
			
		||||
Set=Fixer
 | 
			
		||||
Close=Fermer
 | 
			
		||||
 | 
			
		||||
## digilines interfacing
 | 
			
		||||
Channel=Canal
 | 
			
		||||
 | 
			
		||||
@@ -86,11 +90,12 @@ Sorting pneumatic tube=Tuyau pneumatique triant
 | 
			
		||||
 | 
			
		||||
## teleport tube
 | 
			
		||||
Receive=Reception
 | 
			
		||||
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 private receivers=Utilisez <joueur>;<canal> pour une réception privée
 | 
			
		||||
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 private receivers=Utilisez <joueur>;<canal> pour une réception privée
 | 
			
		||||
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, 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'
 | 
			
		||||
@@ -102,7 +107,9 @@ Trash Can=Poubelle
 | 
			
		||||
Pneumatic tube segment (legacy)=Segment de tuyau pneumatique (obsolète)
 | 
			
		||||
 | 
			
		||||
## vacuum tubes
 | 
			
		||||
Radius=Rayon
 | 
			
		||||
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 (@1m)=Segment de tuyau pneumatique aspirant réglable (@1 m)
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -2,6 +2,10 @@
 | 
			
		||||
# License: CC-by-SA 4.0
 | 
			
		||||
# Author: pevernow <3450354617@qq.com>
 | 
			
		||||
 | 
			
		||||
## generic interaction
 | 
			
		||||
Set=
 | 
			
		||||
Cancel=
 | 
			
		||||
 | 
			
		||||
## digilines interfacing
 | 
			
		||||
Channel=频道
 | 
			
		||||
 | 
			
		||||
@@ -84,11 +88,12 @@ Sorting pneumatic tube=分类管道
 | 
			
		||||
 | 
			
		||||
## teleport tube
 | 
			
		||||
Receive=接收
 | 
			
		||||
channels are public by default=频道默认为公开
 | 
			
		||||
use <player>:<channel> for fully private channels=将<player>:<channel>用于完全私人的频道
 | 
			
		||||
use <player>;<channel> for private receivers=使用<player>;<channel>作为私人接收器
 | 
			
		||||
Channels are public by default=频道默认为公开
 | 
			
		||||
Use <player>:<channel> for fully private channels=将<player>:<channel>用于完全私人的频道
 | 
			
		||||
Use <player>;<channel> for private receivers=使用<player>;<channel>作为私人接收器
 | 
			
		||||
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, receiving from channel '@1' is reserved for @2=抱歉,从频道'@1'接收的内容已保留给'@2'
 | 
			
		||||
Teleportation Tube @1 on '@2'=传送管'@1'在'@2'上
 | 
			
		||||
@@ -100,7 +105,9 @@ Trash Can=垃圾箱
 | 
			
		||||
Pneumatic tube segment (legacy)=普通管道(旧式)
 | 
			
		||||
 | 
			
		||||
## vacuum tubes
 | 
			
		||||
Radius=
 | 
			
		||||
Vacuuming Pneumatic Tube Segment=拾取管道
 | 
			
		||||
Adjustable Vacuuming Tube=
 | 
			
		||||
Adjustable Vacuuming Pneumatic Tube Segment=高级拾取管道
 | 
			
		||||
Adjustable Vacuuming Pneumatic Tube Segment (@1m)=高级拾取管道(@1m)
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -3,6 +3,10 @@
 | 
			
		||||
# License: CC-by-SA 4.0
 | 
			
		||||
# Author:
 | 
			
		||||
 | 
			
		||||
## generic interaction
 | 
			
		||||
Set=
 | 
			
		||||
Cancel=
 | 
			
		||||
 | 
			
		||||
## digilines interfacing
 | 
			
		||||
Channel=
 | 
			
		||||
 | 
			
		||||
@@ -86,11 +90,12 @@ Sorting pneumatic tube=
 | 
			
		||||
 | 
			
		||||
## teleport tube
 | 
			
		||||
Receive=
 | 
			
		||||
channels are public by default=
 | 
			
		||||
use <player>:<channel> for fully private channels=
 | 
			
		||||
use <player>;<channel> for private receivers=
 | 
			
		||||
Channels are public by default=
 | 
			
		||||
Use <player>:<channel> for fully private channels=
 | 
			
		||||
Use <player>;<channel> for private receivers=
 | 
			
		||||
Teleporting Pneumatic Tube Segment=
 | 
			
		||||
unconfigured Teleportation Tube=
 | 
			
		||||
Teleporting Tube=
 | 
			
		||||
Unconfigured Teleportation Tube=
 | 
			
		||||
Sorry, channel '@1' is reserved for exclusive use by @2=
 | 
			
		||||
Sorry, receiving from channel '@1' is reserved for @2=
 | 
			
		||||
Teleportation Tube @1 on '@2'=
 | 
			
		||||
@@ -102,7 +107,9 @@ Trash Can=
 | 
			
		||||
Pneumatic tube segment (legacy)=
 | 
			
		||||
 | 
			
		||||
## vacuum tubes
 | 
			
		||||
Radius=
 | 
			
		||||
Vacuuming Pneumatic Tube Segment=
 | 
			
		||||
Adjustable Vacuuming Tube=
 | 
			
		||||
Adjustable Vacuuming Pneumatic Tube Segment=
 | 
			
		||||
Adjustable Vacuuming Pneumatic Tube Segment (@1m)=
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										112
									
								
								lua_tube.lua
									
									
									
									
									
								
							
							
						
						
									
										112
									
								
								lua_tube.lua
									
									
									
									
									
								
							@@ -813,82 +813,56 @@ local tiles_base = {
 | 
			
		||||
	"pipeworks_mese_tube_plain_2.png", "pipeworks_mese_tube_plain_1.png",
 | 
			
		||||
	"pipeworks_mese_tube_plain_6.png", "pipeworks_mese_tube_plain_5.png"}
 | 
			
		||||
 | 
			
		||||
local tiles_on_off = {
 | 
			
		||||
	R__0   = "^pipeworks_lua_tube_port_%s.png",
 | 
			
		||||
	R_90  = "^(pipeworks_lua_tube_port_%s.png^[transformR90)",
 | 
			
		||||
	R180 = "^(pipeworks_lua_tube_port_%s.png^[transformR180)",
 | 
			
		||||
	R270 = "^(pipeworks_lua_tube_port_%s.png^[transformR270)"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
local texture_alpha_mode = minetest.features.use_texture_alpha_string_modes
 | 
			
		||||
	and "clip" or true
 | 
			
		||||
 | 
			
		||||
for red    = 0, 1 do -- 0 = off  1 = on
 | 
			
		||||
for blue   = 0, 1 do
 | 
			
		||||
for yellow = 0, 1 do
 | 
			
		||||
for green  = 0, 1 do
 | 
			
		||||
for black  = 0, 1 do
 | 
			
		||||
for white  = 0, 1 do
 | 
			
		||||
	local cid = tostring(white)..tostring(black)..tostring(green)..
 | 
			
		||||
			tostring(yellow)..tostring(blue)..tostring(red)
 | 
			
		||||
	local cid = white..black..green..yellow..blue..red
 | 
			
		||||
	local node_name = BASENAME..cid
 | 
			
		||||
 | 
			
		||||
	local tiles = table.copy(tiles_base)
 | 
			
		||||
	if red == 1 then
 | 
			
		||||
		tiles[1] = tiles[1].."^(pipeworks_lua_tube_port_on.png^[transformR90)"
 | 
			
		||||
		tiles[2] = tiles[2].."^(pipeworks_lua_tube_port_on.png^[transformR90)"
 | 
			
		||||
		tiles[5] = tiles[5].."^(pipeworks_lua_tube_port_on.png^[transformR270)"
 | 
			
		||||
		tiles[6] = tiles[6].."^(pipeworks_lua_tube_port_on.png^[transformR90)"
 | 
			
		||||
	else
 | 
			
		||||
		tiles[1] = tiles[1].."^(pipeworks_lua_tube_port_off.png^[transformR90)"
 | 
			
		||||
		tiles[2] = tiles[2].."^(pipeworks_lua_tube_port_off.png^[transformR90)"
 | 
			
		||||
		tiles[5] = tiles[5].."^(pipeworks_lua_tube_port_off.png^[transformR270)"
 | 
			
		||||
		tiles[6] = tiles[6].."^(pipeworks_lua_tube_port_off.png^[transformR90)"
 | 
			
		||||
	end
 | 
			
		||||
	if blue == 1 then
 | 
			
		||||
		tiles[1] = tiles[1].."^(pipeworks_lua_tube_port_on.png^[transformR270)"
 | 
			
		||||
		tiles[2] = tiles[2].."^(pipeworks_lua_tube_port_on.png^[transformR270)"
 | 
			
		||||
		tiles[5] = tiles[5].."^(pipeworks_lua_tube_port_on.png^[transformR90)"
 | 
			
		||||
		tiles[6] = tiles[6].."^(pipeworks_lua_tube_port_on.png^[transformR270)"
 | 
			
		||||
	else
 | 
			
		||||
		tiles[1] = tiles[1].."^(pipeworks_lua_tube_port_off.png^[transformR270)"
 | 
			
		||||
		tiles[2] = tiles[2].."^(pipeworks_lua_tube_port_off.png^[transformR270)"
 | 
			
		||||
		tiles[5] = tiles[5].."^(pipeworks_lua_tube_port_off.png^[transformR90)"
 | 
			
		||||
		tiles[6] = tiles[6].."^(pipeworks_lua_tube_port_off.png^[transformR270)"
 | 
			
		||||
	end
 | 
			
		||||
	if yellow == 1 then
 | 
			
		||||
		tiles[3] = tiles[3].."^(pipeworks_lua_tube_port_on.png^[transformR180)"
 | 
			
		||||
		tiles[4] = tiles[4].."^(pipeworks_lua_tube_port_on.png^[transformR180)"
 | 
			
		||||
		tiles[5] = tiles[5].."^(pipeworks_lua_tube_port_on.png^[transformR180)"
 | 
			
		||||
		tiles[6] = tiles[6].."^(pipeworks_lua_tube_port_on.png^[transformR180)"
 | 
			
		||||
	else
 | 
			
		||||
		tiles[3] = tiles[3].."^(pipeworks_lua_tube_port_off.png^[transformR180)"
 | 
			
		||||
		tiles[4] = tiles[4].."^(pipeworks_lua_tube_port_off.png^[transformR180)"
 | 
			
		||||
		tiles[5] = tiles[5].."^(pipeworks_lua_tube_port_off.png^[transformR180)"
 | 
			
		||||
		tiles[6] = tiles[6].."^(pipeworks_lua_tube_port_off.png^[transformR180)"
 | 
			
		||||
	end
 | 
			
		||||
	if green == 1 then
 | 
			
		||||
		tiles[3] = tiles[3].."^pipeworks_lua_tube_port_on.png"
 | 
			
		||||
		tiles[4] = tiles[4].."^pipeworks_lua_tube_port_on.png"
 | 
			
		||||
		tiles[5] = tiles[5].."^pipeworks_lua_tube_port_on.png"
 | 
			
		||||
		tiles[6] = tiles[6].."^pipeworks_lua_tube_port_on.png"
 | 
			
		||||
	else
 | 
			
		||||
		tiles[3] = tiles[3].."^pipeworks_lua_tube_port_off.png"
 | 
			
		||||
		tiles[4] = tiles[4].."^pipeworks_lua_tube_port_off.png"
 | 
			
		||||
		tiles[5] = tiles[5].."^pipeworks_lua_tube_port_off.png"
 | 
			
		||||
		tiles[6] = tiles[6].."^pipeworks_lua_tube_port_off.png"
 | 
			
		||||
	end
 | 
			
		||||
	if black == 1 then
 | 
			
		||||
		tiles[1] = tiles[1].."^(pipeworks_lua_tube_port_on.png^[transformR180)"
 | 
			
		||||
		tiles[2] = tiles[2].."^pipeworks_lua_tube_port_on.png"
 | 
			
		||||
		tiles[3] = tiles[3].."^(pipeworks_lua_tube_port_on.png^[transformR90)"
 | 
			
		||||
		tiles[4] = tiles[4].."^(pipeworks_lua_tube_port_on.png^[transformR270)"
 | 
			
		||||
	else
 | 
			
		||||
		tiles[1] = tiles[1].."^(pipeworks_lua_tube_port_off.png^[transformR180)"
 | 
			
		||||
		tiles[2] = tiles[2].."^pipeworks_lua_tube_port_off.png"
 | 
			
		||||
		tiles[3] = tiles[3].."^(pipeworks_lua_tube_port_off.png^[transformR90)"
 | 
			
		||||
		tiles[4] = tiles[4].."^(pipeworks_lua_tube_port_off.png^[transformR270)"
 | 
			
		||||
	end
 | 
			
		||||
	if white == 1 then
 | 
			
		||||
		tiles[1] = tiles[1].."^pipeworks_lua_tube_port_on.png"
 | 
			
		||||
		tiles[2] = tiles[2].."^(pipeworks_lua_tube_port_on.png^[transformR180)"
 | 
			
		||||
		tiles[3] = tiles[3].."^(pipeworks_lua_tube_port_on.png^[transformR270)"
 | 
			
		||||
		tiles[4] = tiles[4].."^(pipeworks_lua_tube_port_on.png^[transformR90)"
 | 
			
		||||
	else
 | 
			
		||||
		tiles[1] = tiles[1].."^pipeworks_lua_tube_port_off.png"
 | 
			
		||||
		tiles[2] = tiles[2].."^(pipeworks_lua_tube_port_off.png^[transformR180)"
 | 
			
		||||
		tiles[3] = tiles[3].."^(pipeworks_lua_tube_port_off.png^[transformR270)"
 | 
			
		||||
		tiles[4] = tiles[4].."^(pipeworks_lua_tube_port_off.png^[transformR90)"
 | 
			
		||||
	end
 | 
			
		||||
	-- Red
 | 
			
		||||
	tiles[1] = tiles[1]..tiles_on_off.R_90:format(red == 1 and "on" or "off");
 | 
			
		||||
	tiles[2] = tiles[2]..tiles_on_off.R_90:format(red == 1 and "on" or "off");
 | 
			
		||||
	tiles[5] = tiles[5]..tiles_on_off.R270:format(red == 1 and "on" or "off");
 | 
			
		||||
	tiles[6] = tiles[6]..tiles_on_off.R_90:format(red == 1 and "on" or "off");
 | 
			
		||||
	-- Blue
 | 
			
		||||
	tiles[1] = tiles[1]..tiles_on_off.R270:format(blue == 1 and "on" or "off");
 | 
			
		||||
	tiles[2] = tiles[2]..tiles_on_off.R270:format(blue == 1 and "on" or "off");
 | 
			
		||||
	tiles[5] = tiles[5]..tiles_on_off.R_90:format(blue == 1 and "on" or "off");
 | 
			
		||||
	tiles[6] = tiles[6]..tiles_on_off.R270:format(blue == 1 and "on" or "off");
 | 
			
		||||
	-- Yellow
 | 
			
		||||
	tiles[1] = tiles[1]..tiles_on_off.R180:format(yellow == 1 and "on" or "off");
 | 
			
		||||
	tiles[2] = tiles[2]..tiles_on_off.R180:format(yellow == 1 and "on" or "off");
 | 
			
		||||
	tiles[5] = tiles[5]..tiles_on_off.R180:format(yellow == 1 and "on" or "off");
 | 
			
		||||
	tiles[6] = tiles[6]..tiles_on_off.R180:format(yellow == 1 and "on" or "off");
 | 
			
		||||
	-- Green
 | 
			
		||||
	tiles[3] = tiles[3]..tiles_on_off.R__0:format(green == 1 and "on" or "off");
 | 
			
		||||
	tiles[4] = tiles[4]..tiles_on_off.R__0:format(green == 1 and "on" or "off");
 | 
			
		||||
	tiles[5] = tiles[5]..tiles_on_off.R__0:format(green == 1 and "on" or "off");
 | 
			
		||||
	tiles[6] = tiles[6]..tiles_on_off.R__0:format(green == 1 and "on" or "off");
 | 
			
		||||
	-- Black
 | 
			
		||||
	tiles[1] = tiles[1]..tiles_on_off.R180:format(black == 1 and "on" or "off");
 | 
			
		||||
	tiles[2] = tiles[2]..tiles_on_off.R__0:format(black == 1 and "on" or "off");
 | 
			
		||||
	tiles[3] = tiles[3]..tiles_on_off.R_90:format(black == 1 and "on" or "off");
 | 
			
		||||
	tiles[4] = tiles[4]..tiles_on_off.R270:format(black == 1 and "on" or "off");
 | 
			
		||||
	-- White
 | 
			
		||||
	tiles[1] = tiles[1]..tiles_on_off.R__0:format(white == 1 and "on" or "off");
 | 
			
		||||
	tiles[2] = tiles[2]..tiles_on_off.R180:format(white == 1 and "on" or "off");
 | 
			
		||||
	tiles[3] = tiles[3]..tiles_on_off.R270:format(white == 1 and "on" or "off");
 | 
			
		||||
	tiles[4] = tiles[4]..tiles_on_off.R_90:format(white == 1 and "on" or "off");
 | 
			
		||||
 | 
			
		||||
	local groups = {snappy = 3, tube = 1, tubedevice = 1, overheat = 1}
 | 
			
		||||
	if red + blue + yellow + green + black + white ~= 0 then
 | 
			
		||||
@@ -933,6 +907,7 @@ for white  = 0, 1 do
 | 
			
		||||
		description = "Lua controlled Tube",
 | 
			
		||||
		drawtype = "nodebox",
 | 
			
		||||
		tiles = tiles,
 | 
			
		||||
		use_texture_alpha = texture_alpha_mode,
 | 
			
		||||
		paramtype = "light",
 | 
			
		||||
		is_ground_content = false,
 | 
			
		||||
		groups = groups,
 | 
			
		||||
@@ -1039,6 +1014,7 @@ tiles_burnt[4] = tiles_burnt[4].."^(pipeworks_lua_tube_port_burnt.png^[transform
 | 
			
		||||
minetest.register_node(BASENAME .. "_burnt", {
 | 
			
		||||
	drawtype = "nodebox",
 | 
			
		||||
	tiles = tiles_burnt,
 | 
			
		||||
	use_texture_alpha = texture_alpha_mode,
 | 
			
		||||
	is_burnt = true,
 | 
			
		||||
	paramtype = "light",
 | 
			
		||||
	is_ground_content = false,
 | 
			
		||||
 
 | 
			
		||||
@@ -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
 | 
			
		||||
 | 
			
		||||
pipeworks.register_tube("pipeworks:broken_tube", {
 | 
			
		||||
@@ -36,29 +65,27 @@ pipeworks.register_tube("pipeworks:broken_tube", {
 | 
			
		||||
			local wieldname = itemstack:get_name()
 | 
			
		||||
			local playername = puncher:get_player_name()
 | 
			
		||||
			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 was_node = minetest.deserialize(meta:get_string("the_tube_was"))
 | 
			
		||||
				if was_node and 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
 | 
			
		||||
			if not was_node then
 | 
			
		||||
				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
 | 
			
		||||
				else
 | 
			
		||||
					pipeworks.logger(log_msg.."            with "..wieldname.." but that tool is too weak.")
 | 
			
		||||
				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
 | 
			
		||||
	}
 | 
			
		||||
})
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,16 @@
 | 
			
		||||
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
 | 
			
		||||
	local detector_tube_step = 5 * tonumber(minetest.settings:get("dedicated_server_step"))
 | 
			
		||||
	pipeworks.register_tube("pipeworks:detector_tube_on", {
 | 
			
		||||
@@ -8,11 +20,10 @@ if pipeworks.enable_detector_tube then
 | 
			
		||||
			node_def = {
 | 
			
		||||
				tube = {can_go = function(pos, node, velocity, stack)
 | 
			
		||||
						 local meta = minetest.get_meta(pos)
 | 
			
		||||
						 local name = minetest.get_node(pos).name
 | 
			
		||||
						 local nitems = meta:get_int("nitems")+1
 | 
			
		||||
						 meta:set_int("nitems", nitems)
 | 
			
		||||
						 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)
 | 
			
		||||
					end},
 | 
			
		||||
				groups = {mesecon = 2, not_in_creative_inventory = 1},
 | 
			
		||||
@@ -34,9 +45,7 @@ if pipeworks.enable_detector_tube then
 | 
			
		||||
				on_construct = function(pos)
 | 
			
		||||
					 local meta = minetest.get_meta(pos)
 | 
			
		||||
					 meta:set_int("nitems", 1)
 | 
			
		||||
					 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)
 | 
			
		||||
					 minetest.after(detector_tube_step, after_break, pos)
 | 
			
		||||
				end,
 | 
			
		||||
			},
 | 
			
		||||
	})
 | 
			
		||||
@@ -87,13 +96,20 @@ if digiline_enabled and pipeworks.enable_digiline_detector_tube then
 | 
			
		||||
				on_construct = function(pos)
 | 
			
		||||
					local meta = minetest.get_meta(pos)
 | 
			
		||||
					meta:set_string("formspec",
 | 
			
		||||
						"size[8.6,2.2]"..
 | 
			
		||||
						"field[0.6,0.6;8,1;channel;"..S("Channel")..";${channel}]"..
 | 
			
		||||
						"image[0.3,1.3;1,1;pipeworks_digiline_detector_tube_inv.png]"..
 | 
			
		||||
						"label[1.6,1.2;"..S("Digiline Detecting Tube").."]"
 | 
			
		||||
						"size[8.5,2.2]"..
 | 
			
		||||
						"image[0.2,0;1,1;pipeworks_digiline_detector_tube_inv.png]"..
 | 
			
		||||
						"label[1.2,0.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,
 | 
			
		||||
				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
 | 
			
		||||
						minetest.get_meta(pos):set_string("channel", fields.channel)
 | 
			
		||||
					end
 | 
			
		||||
 
 | 
			
		||||
@@ -127,14 +127,20 @@ end
 | 
			
		||||
local function update_meta(meta, can_receive)
 | 
			
		||||
	meta:set_int("can_receive", can_receive and 1 or 0)
 | 
			
		||||
	local cr_state = can_receive and "on" or "off"
 | 
			
		||||
	meta:set_string("formspec","size[8.6,2.2]"..
 | 
			
		||||
			"field[0.6,0.6;7,1;channel;"..S("Channel")..";${channel}]"..
 | 
			
		||||
			"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]"..
 | 
			
		||||
			"image[0.3,1.3;1,1;pipeworks_teleport_tube_inv.png]"..
 | 
			
		||||
			"label[1.6,1.2;"..S("channels are public by default").."]" ..
 | 
			
		||||
			"label[1.6,1.5;"..S("use <player>:<channel> for fully private channels").."]" ..
 | 
			
		||||
			"label[1.6,1.8;"..S("use <player>\\;<channel> for private receivers").."]" ..
 | 
			
		||||
	local itext = S("Channels are public by default").."\n"..
 | 
			
		||||
		S("Use <player>:<channel> for fully private channels").."\n"..
 | 
			
		||||
		S("Use <player>\\;<channel> for private receivers")
 | 
			
		||||
 | 
			
		||||
	meta:set_string("formspec",
 | 
			
		||||
		"size[8.5,3.5]"..
 | 
			
		||||
		"image[0.2,o;1,1;pipeworks_teleport_tube_inv.png]"..
 | 
			
		||||
		"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_img)
 | 
			
		||||
end
 | 
			
		||||
@@ -170,10 +176,11 @@ pipeworks.register_tube("pipeworks:teleport_tube", {
 | 
			
		||||
		on_construct = function(pos)
 | 
			
		||||
			local meta = minetest.get_meta(pos)
 | 
			
		||||
			update_meta(meta, true)
 | 
			
		||||
			meta:set_string("infotext", S("unconfigured Teleportation Tube"))
 | 
			
		||||
			meta:set_string("infotext", S("Unconfigured Teleportation Tube"))
 | 
			
		||||
		end,
 | 
			
		||||
		on_receive_fields = function(pos,formname,fields,sender)
 | 
			
		||||
			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
 | 
			
		||||
				return
 | 
			
		||||
			end
 | 
			
		||||
@@ -207,7 +214,7 @@ pipeworks.register_tube("pipeworks:teleport_tube", {
 | 
			
		||||
 | 
			
		||||
			-- was the channel changed?
 | 
			
		||||
			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
 | 
			
		||||
				meta:set_string("channel", channel)
 | 
			
		||||
				dirty = true
 | 
			
		||||
@@ -233,7 +240,7 @@ pipeworks.register_tube("pipeworks:teleport_tube", {
 | 
			
		||||
				else
 | 
			
		||||
					-- remove empty channel tubes, to not have to search through them
 | 
			
		||||
					remove_tube(pos)
 | 
			
		||||
					meta:set_string("infotext", S("unconfigured Teleportation Tube"))
 | 
			
		||||
					meta:set_string("infotext", S("Unconfigured Teleportation Tube"))
 | 
			
		||||
				end
 | 
			
		||||
			end
 | 
			
		||||
		end,
 | 
			
		||||
 
 | 
			
		||||
@@ -26,6 +26,11 @@ local texture_mt = {
 | 
			
		||||
	end
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
-- This will remove any semi-transparent pixels
 | 
			
		||||
-- because that is still buggy in Minetest, force this as default
 | 
			
		||||
local texture_alpha_mode = minetest.features.use_texture_alpha_string_modes
 | 
			
		||||
	and "clip" or true
 | 
			
		||||
 | 
			
		||||
local register_one_tube = function(name, tname, dropname, desc, plain, noctrs, ends, short, inv, special, connects, style)
 | 
			
		||||
	noctrs = noctrs or default_noctrs
 | 
			
		||||
	setmetatable(noctrs, texture_mt)
 | 
			
		||||
@@ -82,6 +87,7 @@ local register_one_tube = function(name, tname, dropname, desc, plain, noctrs, e
 | 
			
		||||
		description = tubedesc,
 | 
			
		||||
		drawtype = "nodebox",
 | 
			
		||||
		tiles = outimgs,
 | 
			
		||||
		use_texture_alpha = texture_alpha_mode,
 | 
			
		||||
		sunlight_propagates = true,
 | 
			
		||||
		inventory_image = iimg,
 | 
			
		||||
		wield_image = iimg,
 | 
			
		||||
@@ -107,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},
 | 
			
		||||
			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_dig_node = pipeworks.after_dig,
 | 
			
		||||
		on_rotate = false,
 | 
			
		||||
 
 | 
			
		||||
@@ -40,22 +40,31 @@ if pipeworks.enable_mese_sand_tube then
 | 
			
		||||
				on_construct = function(pos)
 | 
			
		||||
					local meta = minetest.get_meta(pos)
 | 
			
		||||
					meta:set_int("dist", 0)
 | 
			
		||||
					meta:set_string("formspec", "size[2.1,0.8]"..
 | 
			
		||||
							"image[0,0;1,1;pipeworks_mese_sand_tube_inv.png]"..
 | 
			
		||||
							"field[1.3,0.4;1,1;dist;radius;${dist}]"..
 | 
			
		||||
					meta:set_string("formspec",
 | 
			
		||||
						"size[6.0,2.2]"..
 | 
			
		||||
						"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_img)
 | 
			
		||||
					meta:set_string("infotext", S("Adjustable Vacuuming Pneumatic Tube Segment"))
 | 
			
		||||
				end,
 | 
			
		||||
				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 dist = tonumber(fields.dist)
 | 
			
		||||
					if dist then
 | 
			
		||||
						dist = math.max(0, dist)
 | 
			
		||||
						dist = math.min(8, 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,
 | 
			
		||||
			},
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user