mirror of
				https://github.com/mt-mods/pipeworks.git
				synced 2025-10-31 14:25:25 +01:00 
			
		
		
		
	Compare commits
	
		
			58 Commits
		
	
	
		
			2021-04-14
			...
			503c1190ed
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 503c1190ed | |||
|  | 75894355d4 | ||
| 5bba517b03 | |||
|  | 7b15bdbd1f | ||
|  | 90425fde95 | ||
|  | 1349ff8dd8 | ||
|  | 3b31b6f9c0 | ||
|  | 4fce320d9c | ||
|  | 55ded7e569 | ||
|  | e3d94cb3a8 | ||
|  | 97903327a5 | ||
|  | 37eef73695 | ||
|  | 3092ce771f | ||
|  | 96ccd29dd2 | ||
|  | 8e0b25fb2c | ||
|  | 8a29f8844c | ||
|  | 5aa0501872 | ||
| 66070dd801 | |||
|  | 5618003be3 | ||
|  | 06fd754216 | ||
|  | 794cae675e | ||
|  | 7d3a61e595 | ||
|  | a70115ab8d | ||
|  | 23fe215721 | ||
|  | 8f067db7cd | ||
|  | e082ea473b | ||
| 7ee74133e1 | |||
|  | cec6049dd1 | ||
|  | 047718b3c3 | ||
|  | 01f4ea066c | ||
|  | 7ba685344c | ||
|  | c39d40e940 | ||
|  | 48b082e014 | ||
| c01bd7b888 | |||
|  | 2670fd88a9 | ||
|  | 3536004667 | ||
|  | b53a1ee477 | ||
|  | 29bac67d3a | ||
| e2fdcc4fb2 | |||
| e4db1e885e | |||
| f7839444cd | |||
| 93f5fb3d87 | |||
| a535bebd2e | |||
| be2776fc46 | |||
| ee03959a65 | |||
| 4dd30df37a | |||
| 946da11206 | |||
| 77c8026400 | |||
| 70b521c721 | |||
| 6d795b7d34 | |||
| 92249b7941 | |||
| e04fb691ad | |||
| ac80224371 | |||
| 34262ed8d5 | |||
| 5cfe8d893f | |||
| 975e20f704 | |||
| 2693e2ecbb | |||
|  | c93df73a5c | 
							
								
								
									
										13
									
								
								.github/workflows/luacheck.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								.github/workflows/luacheck.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,13 @@ | ||||
| name: luacheck | ||||
| on: [push, pull_request] | ||||
| jobs: | ||||
|   build: | ||||
|     runs-on: ubuntu-latest | ||||
|     steps: | ||||
|     - uses: actions/checkout@master | ||||
|     - name: apt | ||||
|       run: sudo apt-get install -y luarocks | ||||
|     - name: luacheck install | ||||
|       run: luarocks install --local luacheck | ||||
|     - name: luacheck run | ||||
|       run: $HOME/.luarocks/bin/luacheck ./ | ||||
| @@ -1,8 +0,0 @@ | ||||
| stages: | ||||
|   - test | ||||
|  | ||||
| luacheck: | ||||
|  stage: test | ||||
|  image: pipelinecomponents/luacheck:latest | ||||
|  script: | ||||
|   - luacheck . | ||||
| @@ -19,6 +19,7 @@ read_globals = { | ||||
|  | ||||
| 	-- mods | ||||
| 	"default", "mesecon", "digiline", | ||||
| 	"screwdriver", "unified_inventory" | ||||
| 	"screwdriver", "unified_inventory", | ||||
| 	"i3", | ||||
|  | ||||
| } | ||||
|   | ||||
							
								
								
									
										2
									
								
								README
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								README
									
									
									
									
									
								
							| @@ -1,7 +1,7 @@ | ||||
| This mod uses nodeboxes to supply a complete set of 3D pipes and tubes,  | ||||
| along devices that work with them. | ||||
|  | ||||
| See https://gitlab.com/VanessaE/pipeworks/wikis/ for detailed information about usage of this mod. | ||||
| See https://github.com/mt-mods/pipeworks/wiki/ for detailed information about usage of this mod. | ||||
|  | ||||
| Unlike the previous version of this mod, these pipes are rounded, and when  | ||||
| placed, they'll automatically join together as needed.  Pipes can go vertically  | ||||
|   | ||||
| @@ -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 | ||||
| @@ -172,26 +175,47 @@ end | ||||
| local function update_meta(meta, enabled) | ||||
| 	local state = enabled and "on" or "off" | ||||
| 	meta:set_int("enabled", enabled and 1 or 0) | ||||
| 	local fs = 	"size[8,12]".. | ||||
| 			"list[context;recipe;0,0;3,3;]".. | ||||
| 			"image[3,1;1,1;gui_hb_bg.png^[colorize:#141318:255]".. | ||||
| 			"list[context;output;3,1;1,1;]".. | ||||
| 			"image_button[3,2;1,0.6;pipeworks_button_" .. state .. ".png;" .. state .. ";;;false;pipeworks_button_interm.png]" .. | ||||
| 			"list[context;src;0,4.5;8,3;]".. | ||||
| 			"list[context;dst;4,0;4,3;]".. | ||||
| 			default.gui_bg.. | ||||
| 			default.gui_bg_img.. | ||||
| 			default.gui_slots.. | ||||
| 			default.get_hotbar_bg(0,8) .. | ||||
| 			"list[current_player;main;0,8;8,4;]" .. | ||||
| 	local list_backgrounds = "" | ||||
| 	if minetest.get_modpath("i3") then | ||||
| 		list_backgrounds = "style_type[box;colors=#666]" | ||||
| 		for i=0, 2 do | ||||
| 			for j=0, 2 do | ||||
| 				list_backgrounds = list_backgrounds .. "box[".. 0.22+(i*1.25) ..",".. 0.22+(j*1.25) ..";1,1;]" | ||||
| 			end | ||||
| 		end | ||||
| 		for i=0, 3 do | ||||
| 			for j=0, 2 do | ||||
| 				list_backgrounds = list_backgrounds .. "box[".. 5.28+(i*1.25) ..",".. 0.22+(j*1.25) ..";1,1;]" | ||||
| 			end | ||||
| 		end | ||||
| 		for i=0, 7 do | ||||
| 			for j=0, 2 do | ||||
| 				list_backgrounds = list_backgrounds .. "box[".. 0.22+(i*1.25) ..",".. 5+(j*1.25) ..";1,1;]" | ||||
| 			end | ||||
| 		end | ||||
| 	end | ||||
| 	local size = "10.2,14" | ||||
| 	local fs = | ||||
| 		"formspec_version[2]".. | ||||
| 		"size["..size.."]".. | ||||
| 		pipeworks.fs_helpers.get_prepends(size).. | ||||
| 		list_backgrounds.. | ||||
| 		"list[context;recipe;0.22,0.22;3,3;]".. | ||||
| 		"image[4,1.45;1,1;[combine:16x16^[noalpha^[colorize:#141318:255]".. | ||||
| 		"list[context;output;4,1.45;1,1;]".. | ||||
| 		"image_button[4,2.6;1,0.6;pipeworks_button_" .. state .. ".png;" .. state .. ";;;false;pipeworks_button_interm.png]" .. | ||||
| 		"list[context;dst;5.28,0.22;4,3;]".. | ||||
| 		"list[context;src;0.22,5;8,3;]".. | ||||
| 		pipeworks.fs_helpers.get_inv(9).. | ||||
| 		"listring[current_player;main]".. | ||||
| 		"listring[context;src]" .. | ||||
| 		"listring[current_player;main]".. | ||||
| 		"listring[context;dst]" .. | ||||
| 		"listring[current_player;main]" | ||||
| 	if minetest.get_modpath("digilines") then | ||||
| 		fs = fs.."field[1,3.5;4,1;channel;"..S("Channel")..";${channel}]" | ||||
| 		fs = fs.."button_exit[5,3.2;2,1;save;"..S("Save").."]" | ||||
| 		fs = fs.."field[0.22,4.1;4.5,0.75;channel;"..S("Channel")..";${channel}]".. | ||||
| 			"button[5,4.1;1.5,0.75;set_channel;"..S("Set").."]".. | ||||
| 			"button_exit[6.8,4.1;2,0.75;close;"..S("Close").."]" | ||||
| 	end | ||||
| 	meta:set_string("formspec",fs) | ||||
|  | ||||
| @@ -251,7 +275,7 @@ minetest.register_node("pipeworks:autocrafter", { | ||||
| 	description = S("Autocrafter"), | ||||
| 	drawtype = "normal", | ||||
| 	tiles = {"pipeworks_autocrafter.png"}, | ||||
| 	groups = {snappy = 3, tubedevice = 1, tubedevice_receiver = 1}, | ||||
| 	groups = {snappy = 3, tubedevice = 1, tubedevice_receiver = 1, dig_generic = 1}, | ||||
| 	tube = {insert_object = function(pos, node, stack, direction) | ||||
| 			local meta = minetest.get_meta(pos) | ||||
| 			local inv = meta:get_inventory() | ||||
| @@ -276,7 +300,9 @@ minetest.register_node("pipeworks:autocrafter", { | ||||
| 		update_meta(meta, false) | ||||
| 	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 not pipeworks.may_configure(pos, sender) then | ||||
| 			return | ||||
| 		end | ||||
| 		local meta = minetest.get_meta(pos) | ||||
| 		if fields.on then | ||||
| 			update_meta(meta, false) | ||||
| @@ -285,7 +311,8 @@ minetest.register_node("pipeworks:autocrafter", { | ||||
| 			if update_meta(meta, true) then | ||||
| 				start_crafter(pos) | ||||
| 			end | ||||
| 		elseif fields.save then | ||||
| 		end | ||||
| 		if fields.channel then | ||||
| 			meta:set_string("channel", fields.channel) | ||||
| 		end | ||||
| 	end, | ||||
| @@ -424,12 +451,3 @@ minetest.register_node("pipeworks:autocrafter", { | ||||
| 	}, | ||||
| }) | ||||
| pipeworks.ui_cat_tube_list[#pipeworks.ui_cat_tube_list+1] = "pipeworks:autocrafter" | ||||
|  | ||||
| minetest.register_craft( { | ||||
| 	output = "pipeworks:autocrafter 2", | ||||
| 	recipe = { | ||||
| 	        { "default:steel_ingot", "default:mese_crystal", "default:steel_ingot" }, | ||||
| 	        { "basic_materials:plastic_sheet", "default:steel_ingot", "basic_materials:plastic_sheet" }, | ||||
| 	        { "default:steel_ingot", "default:mese_crystal", "default:steel_ingot" } | ||||
| 	}, | ||||
| }) | ||||
|   | ||||
							
								
								
									
										51
									
								
								common.lua
									
									
									
									
									
								
							
							
						
						
									
										51
									
								
								common.lua
									
									
									
									
									
								
							| @@ -143,6 +143,55 @@ function fs_helpers.cycling_button(meta, base, meta_name, values) | ||||
| 	return base..";"..(texture_name and texture_name..";" or "")..field..";"..minetest.formspec_escape(text)..(addopts and ";"..addopts or "").."]" | ||||
| end | ||||
|  | ||||
| function fs_helpers.get_inv(y) | ||||
| 	local fs = {} | ||||
| 	if minetest.get_modpath("i3") then | ||||
| 		local inv_x = i3.settings.legacy_inventory and 0.75 or 0.22 | ||||
| 		local inv_y = (y + 0.4) or 6.9 | ||||
| 		local size, spacing = 1, 0.1 | ||||
| 		local hotbar_len = i3.settings.hotbar_len | ||||
|  | ||||
| 		table.insert(fs, "style_type[box;colors=#77777710,#77777710,#777,#777]") | ||||
|  | ||||
| 		for i = 0, hotbar_len - 1 do | ||||
| 			table.insert(fs, "box["..(i * size + inv_x + (i * spacing))..","..inv_y..";"..size..","..size..";]") | ||||
| 		end | ||||
|  | ||||
| 		table.insert(fs, "style_type[list;size="..size..";spacing="..spacing.."]") | ||||
| 		table.insert(fs, "list[current_player;main;"..inv_x..","..inv_y..";"..hotbar_len..",1;]") | ||||
|  | ||||
| 		table.insert(fs, "style_type[box;colors=#666]") | ||||
| 		for i=0, 2 do | ||||
| 			for j=0, (i3.settings.legacy_inventory and 7 or 8) do | ||||
| 				table.insert(fs, "box["..0.2+(j*0.1)+(j*size)..","..(inv_y+size+spacing+0.05)+(i*0.1)+(i*size)..";"..size..","..size..";]") | ||||
| 			end | ||||
| 		end | ||||
|  | ||||
| 		table.insert(fs, "style_type[list;size="..size..";spacing="..spacing.."]") | ||||
| 		table.insert(fs, "list[current_player;main;"..inv_x..","..(inv_y + 1.15)..";"..hotbar_len..","..(i3.settings.inv_size / hotbar_len)..";"..hotbar_len.."]") | ||||
| 	else | ||||
| 		table.insert(fs, "list[current_player;main;0.22,"..y..";8,4;]") | ||||
| 	end | ||||
|  | ||||
| 	return table.concat(fs, "") | ||||
| end | ||||
|  | ||||
| function fs_helpers.get_prepends(size) | ||||
| 	local prepend = {} | ||||
|  | ||||
| 	if minetest.get_modpath("i3") then | ||||
| 		prepend = { | ||||
| 			"no_prepend[]", | ||||
| 			"bgcolor[black;neither]", | ||||
| 			"background9[0,0;"..size..";i3_bg_full.png;false;10]", | ||||
| 			"style_type[button;border=false;bgimg=[combine:16x16^[noalpha^[colorize:#6b6b6b]", | ||||
| 			"listcolors[#0000;#ffffff20]" | ||||
| 		} | ||||
| 	end | ||||
|  | ||||
| 	return table.concat(prepend, "") | ||||
| end | ||||
|  | ||||
| --------- | ||||
| -- Env -- | ||||
| --------- | ||||
| @@ -183,7 +232,7 @@ function pipeworks.create_fake_player(def, is_dynamic) | ||||
| 		is_player = delay(true), | ||||
| 		is_fake_player = true, | ||||
|  | ||||
| 		_formspec = def.formspec or default.gui_survival_form, | ||||
| 		_formspec = def.formspec or "", | ||||
| 		_hp = def.hp or 20, | ||||
| 		_breath = 11, | ||||
| 		_pos = def.position and table.copy(def.position) or vector.new(), | ||||
|   | ||||
| @@ -11,7 +11,10 @@ local tube_entry = "^pipeworks_tube_connection_wooden.png" | ||||
| -- Chest Locals | ||||
| local open_chests = {} | ||||
|  | ||||
| local function get_chest_formspec(pos) | ||||
| local get_chest_formspec | ||||
|  | ||||
| if minetest.get_modpath("default") then | ||||
| 	function get_chest_formspec(pos) | ||||
| 		local spos = pos.x .. "," .. pos.y .. "," .. pos.z | ||||
| 		local formspec = | ||||
| 			"size[8,9]" .. | ||||
| @@ -39,6 +42,42 @@ local function get_chest_formspec(pos) | ||||
|  | ||||
| 		return formspec | ||||
| 	end | ||||
| else | ||||
| 	local function get_hotbar_bg(x,y) | ||||
| 		local out = "" | ||||
| 		for i=0,7,1 do | ||||
| 			out = out .."image["..x+i..","..y..";1,1;gui_hb_bg.png]" | ||||
| 		end | ||||
| 		return out | ||||
| 	end | ||||
|  | ||||
| 	function get_chest_formspec(pos) | ||||
| 		local spos = pos.x .. "," .. pos.y .. "," .. pos.z | ||||
| 		local formspec = | ||||
| 			"size[10,9]" .. | ||||
| 			"background9[8,8;8,9;hades_chests_chestui.png;true;8]".. | ||||
| 			"list[nodemeta:" .. spos .. ";main;0,0.3;10,4;]" .. | ||||
| 			"list[current_player;main;0,4.85;10,1;]" .. | ||||
| 			"list[current_player;main;0,6.08;10,3;10]" .. | ||||
| 			"listring[nodemeta:" .. spos .. ";main]" .. | ||||
| 			"listring[current_player;main]" .. | ||||
| 			get_hotbar_bg(0,4.85) | ||||
|  | ||||
| 		-- Pipeworks Switch | ||||
| 		formspec = formspec .. | ||||
| 			fs_helpers.cycling_button( | ||||
| 				minetest.get_meta(pos), | ||||
| 				pipeworks.button_base, | ||||
| 				"splitstacks", | ||||
| 				{ | ||||
| 					pipeworks.button_off, | ||||
| 					pipeworks.button_on | ||||
| 				} | ||||
| 			)..pipeworks.button_label | ||||
|  | ||||
| 		return formspec | ||||
| 	end | ||||
| end | ||||
|  | ||||
| local function chest_lid_obstructed(pos) | ||||
| 	local above = { x = pos.x, y = pos.y + 1, z = pos.z } | ||||
| @@ -71,7 +110,9 @@ minetest.register_on_player_receive_fields(function(player, formname, fields) | ||||
| 					end | ||||
| 				end | ||||
| 				minetest.after(0.2, function() | ||||
| 					if minetest.get_modpath("default") then | ||||
| 						minetest.swap_node(pos, { name = "default:" .. swap, param2 = node.param2 }) | ||||
| 					end | ||||
|  | ||||
| 					-- Pipeworks notification | ||||
| 					pipeworks.after_place(pos) | ||||
| @@ -88,10 +129,18 @@ minetest.register_on_player_receive_fields(function(player, formname, fields) | ||||
| end) | ||||
|  | ||||
| -- Original Definitions | ||||
| local old_chest_def = table.copy(minetest.registered_items["default:chest"]) | ||||
| local old_chest_open_def = table.copy(minetest.registered_items["default:chest_open"]) | ||||
| local old_chest_locked_def = table.copy(minetest.registered_items["default:chest_locked"]) | ||||
| local old_chest_locked_open_def = table.copy(minetest.registered_items["default:chest_locked_open"]) | ||||
| local old_chest_def, old_chest_open_def, old_chest_locked_def, old_chest_locked_open_def | ||||
| if minetest.get_modpath("default") then | ||||
| 	old_chest_def = table.copy(minetest.registered_items["default:chest"]) | ||||
| 	old_chest_open_def = table.copy(minetest.registered_items["default:chest_open"]) | ||||
| 	old_chest_locked_def = table.copy(minetest.registered_items["default:chest_locked"]) | ||||
| 	old_chest_locked_open_def = table.copy(minetest.registered_items["default:chest_locked_open"]) | ||||
| elseif minetest.get_modpath("hades_chests") then | ||||
| 	old_chest_def = table.copy(minetest.registered_items["hades_chests:chest"]) | ||||
| 	old_chest_open_def = table.copy(minetest.registered_items["hades_chests:chest"]) | ||||
| 	old_chest_locked_def = table.copy(minetest.registered_items["hades_chests:chest_locked"]) | ||||
| 	old_chest_locked_open_def = table.copy(minetest.registered_items["hades_chests:chest_locked"]) | ||||
| end | ||||
|  | ||||
| -- Override Construction | ||||
| local override_protected, override, override_open, override_protected_open | ||||
| @@ -116,10 +165,12 @@ override_protected = { | ||||
| 		minetest.sound_play(old_chest_locked_def.sound_open, {gain = 0.3, | ||||
| 				pos = pos, max_hear_distance = 10}) | ||||
| 		if not chest_lid_obstructed(pos) then | ||||
| 			if minetest.get_modpath("default") then | ||||
| 				minetest.swap_node(pos, | ||||
| 						{ name = "default:" .. "chest_locked" .. "_open", | ||||
| 						param2 = node.param2 }) | ||||
| 			end | ||||
| 		end | ||||
| 		minetest.after(0.2, minetest.show_formspec, | ||||
| 				clicker:get_player_name(), | ||||
| 				"pipeworks:chest_formspec", get_chest_formspec(pos)) | ||||
| @@ -160,10 +211,12 @@ override = { | ||||
| 		minetest.sound_play(old_chest_def.sound_open, {gain = 0.3, pos = pos, | ||||
| 				max_hear_distance = 10}) | ||||
| 		if not chest_lid_obstructed(pos) then | ||||
| 			if minetest.get_modpath("default") then | ||||
| 				minetest.swap_node(pos, { | ||||
| 						name = "default:" .. "chest" .. "_open", | ||||
| 						param2 = node.param2 }) | ||||
| 			end | ||||
| 		end | ||||
| 		minetest.after(0.2, minetest.show_formspec, | ||||
| 				clicker:get_player_name(), | ||||
| 				"pipeworks:chest_formspec", get_chest_formspec(pos)) | ||||
| @@ -236,8 +289,15 @@ for _,v in ipairs({override_protected, override, override_open, override_protect | ||||
| end | ||||
|  | ||||
| -- Override with the new modifications. | ||||
| if minetest.get_modpath("default") then | ||||
| 	minetest.override_item("default:chest", override) | ||||
| 	minetest.override_item("default:chest_open", override_open) | ||||
| 	minetest.override_item("default:chest_locked", override_protected) | ||||
|   minetest.override_item("default:chest_locked_open", override_protected_open) | ||||
| elseif minetest.get_modpath("hades_chests") then | ||||
| 	minetest.override_item("hades_chests:chest", override) | ||||
| 	--minetest.override_item("hades_chests:chest_open", override_open) | ||||
| 	minetest.override_item("hades_chests:chest_locked", override_protected) | ||||
|   --minetest.override_item("hades_chests:chest_locked_open", override_protected_open) | ||||
| end | ||||
|  | ||||
|   | ||||
| @@ -1,280 +1,28 @@ | ||||
| -- this file is basically a modified copy of | ||||
| -- minetest_game/mods/default/furnaces.lua | ||||
|  | ||||
| -- translation support | ||||
| local S = minetest.get_translator("pipeworks") | ||||
| local DS = minetest.get_translator("default") | ||||
|  | ||||
| local fs_helpers = pipeworks.fs_helpers | ||||
| local def--, def_active | ||||
| if minetest.get_modpath("default") then | ||||
| 	def = table.copy(minetest.registered_nodes["default:furnace"]) | ||||
| 	--def_active = table.copy(minetest.registered_nodes["default:furnace_active"]) | ||||
| elseif minetest.get_modpath("hades_furnaces") then | ||||
| 	def = table.copy(minetest.registered_nodes["hades_furnaces:furnace"]) | ||||
| 	--def_active = table.copy(minetest.registered_nodes["hades_furnaces:furnace_active"]) | ||||
| end | ||||
|  | ||||
| local tube_entry = "^pipeworks_tube_connection_stony.png" | ||||
|  | ||||
| local function active_formspec(fuel_percent, item_percent, pos, meta) | ||||
| 	local formspec = | ||||
| 		"size[8,8.5]".. | ||||
| 		default.gui_bg.. | ||||
| 		default.gui_bg_img.. | ||||
| 		default.gui_slots.. | ||||
| 		"list[current_name;src;2.75,0.5;1,1;]".. | ||||
| 		"list[current_name;fuel;2.75,2.5;1,1;]".. | ||||
| 		"image[2.75,1.5;1,1;default_furnace_fire_bg.png^[lowpart:".. | ||||
| 		(100-fuel_percent)..":default_furnace_fire_fg.png]".. | ||||
| 		"image[3.75,1.5;1,1;gui_furnace_arrow_bg.png^[lowpart:".. | ||||
| 		(item_percent)..":gui_furnace_arrow_fg.png^[transformR270]".. | ||||
| 		"list[current_name;dst;4.75,0.96;2,2;]".. | ||||
| 		"list[current_player;main;0,4.25;8,1;]".. | ||||
| 		"list[current_player;main;0,5.5;8,3;8]".. | ||||
| 		"listring[current_name;dst]".. | ||||
| 		"listring[current_player;main]".. | ||||
| 		"listring[current_name;src]".. | ||||
| 		"listring[current_player;main]".. | ||||
| 		"listring[current_name;fuel]".. | ||||
| 		"listring[current_player;main]".. | ||||
| 		default.get_hotbar_bg(0, 4.25) .. | ||||
| 			fs_helpers.cycling_button( | ||||
| 				meta, | ||||
| 				"image_button[0,3.5;1,0.6", | ||||
| 				"split_material_stacks", | ||||
| 				{ | ||||
| 					pipeworks.button_off, | ||||
| 					pipeworks.button_on | ||||
| 				} | ||||
| 			).."label[0.9,3.51;"..S("Allow splitting incoming material (not fuel) stacks from tubes").."]" | ||||
| 	return formspec | ||||
| end | ||||
|  | ||||
| local function inactive_formspec(pos, meta) | ||||
| 	local formspec = "size[8,8.5]".. | ||||
| 	default.gui_bg.. | ||||
| 	default.gui_bg_img.. | ||||
| 	default.gui_slots.. | ||||
| 	"list[current_name;src;2.75,0.5;1,1;]".. | ||||
| 	"list[current_name;fuel;2.75,2.5;1,1;]".. | ||||
| 	"image[2.75,1.5;1,1;default_furnace_fire_bg.png]".. | ||||
| 	"image[3.75,1.5;1,1;gui_furnace_arrow_bg.png^[transformR270]".. | ||||
| 	"list[current_name;dst;4.75,0.96;2,2;]".. | ||||
| 	"list[current_player;main;0,4.25;8,1;]".. | ||||
| 	"list[current_player;main;0,5.5;8,3;8]".. | ||||
| 	"listring[current_name;dst]".. | ||||
| 	"listring[current_player;main]".. | ||||
| 	"listring[current_name;src]".. | ||||
| 	"listring[current_player;main]".. | ||||
| 	"listring[current_name;fuel]".. | ||||
| 	"listring[current_player;main]".. | ||||
| 	default.get_hotbar_bg(0, 4.25) .. | ||||
| 		fs_helpers.cycling_button( | ||||
| 			meta, | ||||
| 			"image_button[0,3.5;1,0.6", | ||||
| 			"split_material_stacks", | ||||
| 			{ | ||||
| 				pipeworks.button_off, | ||||
| 				pipeworks.button_on | ||||
| 			} | ||||
| 		).."label[0.9,3.51;"..S("Allow splitting incoming material (not fuel) stacks from tubes").."]" | ||||
| 	return formspec | ||||
| end | ||||
|  | ||||
| -- | ||||
| -- Node callback functions that are the same for active and inactive furnace | ||||
| -- | ||||
|  | ||||
| local function can_dig(pos, player) | ||||
| 	local meta = minetest.get_meta(pos); | ||||
| 	local inv = meta:get_inventory() | ||||
| 	return inv:is_empty("fuel") and inv:is_empty("dst") and inv:is_empty("src") | ||||
| end | ||||
|  | ||||
| local function allow_metadata_inventory_put(pos, listname, index, stack, player) | ||||
| 	if minetest.is_protected(pos, player:get_player_name()) then | ||||
| 		return 0 | ||||
| 	end | ||||
| 	local meta = minetest.get_meta(pos) | ||||
| 	local inv = meta:get_inventory() | ||||
| 	if listname == "fuel" then | ||||
| 		if minetest.get_craft_result({method="fuel", width=1, items={stack}}).time ~= 0 then | ||||
| 			if inv:is_empty("src") then | ||||
| 				meta:set_string("infotext", DS("Furnace is empty")) | ||||
| 			end | ||||
| 			return stack:get_count() | ||||
| 		else | ||||
| 			return 0 | ||||
| 		end | ||||
| 	elseif listname == "src" then | ||||
| 		return stack:get_count() | ||||
| 	elseif listname == "dst" then | ||||
| 		return 0 | ||||
| 	end | ||||
| end | ||||
|  | ||||
| local function allow_metadata_inventory_move(pos, from_list, from_index, to_list, to_index, count, player) | ||||
| 	local meta = minetest.get_meta(pos) | ||||
| 	local inv = meta:get_inventory() | ||||
| 	local stack = inv:get_stack(from_list, from_index) | ||||
| 	return allow_metadata_inventory_put(pos, to_list, to_index, stack, player) | ||||
| end | ||||
|  | ||||
| local function allow_metadata_inventory_take(pos, listname, index, stack, player) | ||||
| 	if minetest.is_protected(pos, player:get_player_name()) then | ||||
| 		return 0 | ||||
| 	end | ||||
| 	return stack:get_count() | ||||
| end | ||||
|  | ||||
| local function swap_node(pos, name) | ||||
| 	local node = minetest.get_node(pos) | ||||
| 	if node.name == name then | ||||
| 		return | ||||
| 	end | ||||
| 	node.name = name | ||||
| 	minetest.swap_node(pos, node) | ||||
| end | ||||
|  | ||||
| local function furnace_node_timer(pos, elapsed) | ||||
| 	-- | ||||
| 	-- Inizialize metadata | ||||
| 	-- | ||||
| 	local meta = minetest.get_meta(pos) | ||||
| 	local fuel_time = meta:get_float("fuel_time") or 0 | ||||
| 	local src_time = meta:get_float("src_time") or 0 | ||||
| 	local fuel_totaltime = meta:get_float("fuel_totaltime") or 0 | ||||
|  | ||||
| 	local inv = meta:get_inventory() | ||||
| 	local srclist, fuellist | ||||
|  | ||||
| 	local cookable, cooked | ||||
| 	local fuel | ||||
|  | ||||
| 	local update = true | ||||
| 	while update do | ||||
| 		update = false | ||||
|  | ||||
| 		srclist = inv:get_list("src") | ||||
| 		fuellist = inv:get_list("fuel") | ||||
|  | ||||
| 		-- | ||||
| 		-- Cooking | ||||
| 		-- | ||||
|  | ||||
| 		-- Check if we have cookable content | ||||
| 		local aftercooked | ||||
| 		cooked, aftercooked = minetest.get_craft_result({method = "cooking", width = 1, items = srclist}) | ||||
| 		cookable = cooked.time ~= 0 | ||||
|  | ||||
| 		-- Check if we have enough fuel to burn | ||||
| 		if fuel_time < fuel_totaltime then | ||||
| 			-- The furnace is currently active and has enough fuel | ||||
| 			fuel_time = fuel_time + elapsed | ||||
| 			-- If there is a cookable item then check if it is ready yet | ||||
| 			if cookable then | ||||
| 				src_time = src_time + elapsed | ||||
| 				if src_time >= cooked.time then | ||||
| 					-- Place result in dst list if possible | ||||
| 					if inv:room_for_item("dst", cooked.item) then | ||||
| 						inv:add_item("dst", cooked.item) | ||||
| 						inv:set_stack("src", 1, aftercooked.items[1]) | ||||
| 						src_time = src_time - cooked.time | ||||
| 						update = true | ||||
| 					end | ||||
| 				end | ||||
| 			end | ||||
| 		else | ||||
| 			-- Furnace ran out of fuel | ||||
| 			if cookable then | ||||
| 				-- We need to get new fuel | ||||
| 				local afterfuel | ||||
| 				fuel, afterfuel = minetest.get_craft_result({method = "fuel", width = 1, items = fuellist}) | ||||
|  | ||||
| 				if fuel.time == 0 then | ||||
| 					-- No valid fuel in fuel list | ||||
| 					fuel_totaltime = 0 | ||||
| 					src_time = 0 | ||||
| 				else | ||||
| 					-- Take fuel from fuel list | ||||
| 					inv:set_stack("fuel", 1, afterfuel.items[1]) | ||||
| 					update = true | ||||
| 					fuel_totaltime = fuel.time + (fuel_time - fuel_totaltime) | ||||
| 					src_time = src_time + elapsed | ||||
| 				end | ||||
| 			else | ||||
| 				-- We don't need to get new fuel since there is no cookable item | ||||
| 				fuel_totaltime = 0 | ||||
| 				src_time = 0 | ||||
| 			end | ||||
| 			fuel_time = 0 | ||||
| 		end | ||||
|  | ||||
| 		elapsed = 0 | ||||
| 	end | ||||
|  | ||||
| 	if fuel and fuel_totaltime > fuel.time then | ||||
| 		fuel_totaltime = fuel.time | ||||
| 	end | ||||
| 	if srclist[1]:is_empty() then | ||||
| 		src_time = 0 | ||||
| 	end | ||||
|  | ||||
| 	-- | ||||
| 	-- Update formspec, infotext and node | ||||
| 	-- | ||||
| 	local formspec = inactive_formspec(pos, meta) | ||||
| 	local item_state | ||||
| 	local item_percent = 0 | ||||
| 	if cookable then | ||||
| 		item_percent = math.floor(src_time / cooked.time * 100) | ||||
| 		if item_percent > 100 then | ||||
| 			item_state = DS("100% (output full)") | ||||
| 		else | ||||
| 			item_state = DS("@1%", item_percent) | ||||
| 		end | ||||
| 	else | ||||
| 		if srclist[1]:is_empty() then | ||||
| 			item_state = DS("Empty") | ||||
| 		else | ||||
| 			item_state = DS("Not cookable") | ||||
| 		end | ||||
| 	end | ||||
|  | ||||
| 	local fuel_state = DS("Empty") | ||||
| 	local active = DS("Furnace inactive") | ||||
| 	local result = false | ||||
|  | ||||
| 	if fuel_totaltime ~= 0 then | ||||
| 		active = DS("Furnace active") | ||||
| 		local fuel_percent = math.floor(fuel_time / fuel_totaltime * 100) | ||||
| 		fuel_state = DS("@1%", fuel_percent) | ||||
| 		formspec = active_formspec(fuel_percent, item_percent, pos, meta) | ||||
| 		swap_node(pos, "default:furnace_active") | ||||
| 		-- make sure timer restarts automatically | ||||
| 		result = true | ||||
| 	else | ||||
| 		if not fuellist[1]:is_empty() then | ||||
| 			fuel_state = DS("@1%", "0") | ||||
| 		end | ||||
| 		swap_node(pos, "default:furnace") | ||||
| 		-- stop timer on the inactive furnace | ||||
| 		minetest.get_node_timer(pos):stop() | ||||
| 	end | ||||
|  | ||||
| 	local infotext = active.." "..DS("(Item: @1; Fuel: @2)", item_state, fuel_state) | ||||
|  | ||||
| 	-- | ||||
| 	-- Set meta values | ||||
| 	-- | ||||
| 	meta:set_float("fuel_totaltime", fuel_totaltime) | ||||
| 	meta:set_float("fuel_time", fuel_time) | ||||
| 	meta:set_float("src_time", src_time) | ||||
| 	meta:set_string("formspec", formspec) | ||||
| 	meta:set_string("infotext", infotext) | ||||
|  | ||||
| 	return result | ||||
| end | ||||
| local groups = def.groups | ||||
| groups["tubedevice"] = 1 | ||||
| groups["tubedevice_receiver"] = 1 | ||||
| local groups_active = table.copy(groups) | ||||
| groups_active["not_in_creative_inventory"] = 1 | ||||
|  | ||||
| -- | ||||
| -- Node definitions | ||||
| -- | ||||
|  | ||||
| minetest.register_node(":default:furnace", { | ||||
| 	description = DS("Furnace"), | ||||
| local override = { | ||||
| 	tiles = { | ||||
| 		"default_furnace_top.png"..tube_entry, | ||||
| 		"default_furnace_bottom.png"..tube_entry, | ||||
| @@ -283,7 +31,7 @@ minetest.register_node(":default:furnace", { | ||||
| 		"default_furnace_side.png"..tube_entry, | ||||
| 		"default_furnace_front.png" | ||||
| 	}, | ||||
| 	groups = {cracky = 2, tubedevice = 1, tubedevice_receiver = 1}, | ||||
| 	groups = groups, | ||||
| 	tube = { | ||||
| 		insert_object = function(pos, node, stack, direction) | ||||
| 			local meta = minetest.get_meta(pos) | ||||
| @@ -313,57 +61,13 @@ minetest.register_node(":default:furnace", { | ||||
| 		input_inventory = "dst", | ||||
| 		connect_sides = {left = 1, right = 1, back = 1, front = 1, bottom = 1, top = 1} | ||||
| 	}, | ||||
| 	paramtype2 = "facedir", | ||||
| 	legacy_facedir_simple = true, | ||||
| 	is_ground_content = false, | ||||
| 	sounds = default.node_sound_stone_defaults(), | ||||
|  | ||||
| 	can_dig = can_dig, | ||||
|  | ||||
| 	on_timer = furnace_node_timer, | ||||
|  | ||||
| 	on_construct = function(pos) | ||||
| 		local meta = minetest.get_meta(pos) | ||||
| 		meta:set_string("formspec", inactive_formspec(pos, meta)) | ||||
| 		local inv = meta:get_inventory() | ||||
| 		inv:set_size('src', 1) | ||||
| 		inv:set_size('fuel', 1) | ||||
| 		inv:set_size('dst', 4) | ||||
| 	end, | ||||
|  | ||||
| 	on_metadata_inventory_move = function(pos) | ||||
| 		minetest.get_node_timer(pos):start(1.0) | ||||
| 	end, | ||||
| 	on_metadata_inventory_put = function(pos) | ||||
| 		-- start timer function, it will sort out whether furnace can burn or not. | ||||
| 		minetest.get_node_timer(pos):start(1.0) | ||||
| 	end, | ||||
| 	on_blast = function(pos) | ||||
| 		local drops = {} | ||||
| 		default.get_inventory_drops(pos, "src", drops) | ||||
| 		default.get_inventory_drops(pos, "fuel", drops) | ||||
| 		default.get_inventory_drops(pos, "dst", drops) | ||||
| 		drops[#drops+1] = "default:furnace" | ||||
| 		minetest.remove_node(pos) | ||||
| 		return drops | ||||
| 	end, | ||||
| 	allow_metadata_inventory_put = allow_metadata_inventory_put, | ||||
| 	allow_metadata_inventory_move = allow_metadata_inventory_move, | ||||
| 	allow_metadata_inventory_take = allow_metadata_inventory_take, | ||||
| 	on_receive_fields = function(pos, formname, fields, sender) | ||||
| 		if not pipeworks.may_configure(pos, sender) then return end | ||||
| 		fs_helpers.on_receive_fields(pos, fields) | ||||
| 		local meta = minetest.get_meta(pos) | ||||
| 		local formspec = inactive_formspec(pos, meta) | ||||
| 		meta:set_string("formspec", formspec) | ||||
| 	end, | ||||
| 	after_place_node = pipeworks.after_place, | ||||
| 	after_dig_node = pipeworks.after_dig, | ||||
| 	on_rotate = pipeworks.on_rotate | ||||
| }) | ||||
| } | ||||
|  | ||||
| minetest.register_node(":default:furnace_active", { | ||||
| 	description = DS("Furnace"), | ||||
| local override_active = { | ||||
| 	tiles = { | ||||
| 		"default_furnace_top.png"..tube_entry, | ||||
| 		"default_furnace_bottom.png"..tube_entry, | ||||
| @@ -381,7 +85,7 @@ minetest.register_node(":default:furnace_active", { | ||||
| 			}, | ||||
| 		} | ||||
| 	}, | ||||
| 	groups = {cracky = 2, tubedevice = 1, tubedevice_receiver = 1, not_in_creative_inventory = 1}, | ||||
| 	groups = groups_active, | ||||
| 	tube = { | ||||
| 		insert_object = function(pos,node,stack,direction) | ||||
| 			local meta = minetest.get_meta(pos) | ||||
| @@ -402,37 +106,23 @@ minetest.register_node(":default:furnace_active", { | ||||
| 			if direction.y == 1 then | ||||
| 				return inv:room_for_item("fuel", stack) | ||||
| 			else | ||||
| 				if meta:get_int("split_material_stacks") == 1 then | ||||
| 					stack = stack:peek_item(1) | ||||
| 				end | ||||
| 				return inv:room_for_item("src", stack) | ||||
| 			end | ||||
| 		end, | ||||
| 		input_inventory = "dst", | ||||
| 		connect_sides = {left = 1, right = 1, back = 1, front = 1, bottom = 1, top = 1} | ||||
| 	}, | ||||
| 	paramtype2 = "facedir", | ||||
| 	light_source = 8, | ||||
| 	drop = "default:furnace", | ||||
| 	legacy_facedir_simple = true, | ||||
| 	is_ground_content = false, | ||||
| 	sounds = default.node_sound_stone_defaults(), | ||||
| 	on_timer = furnace_node_timer, | ||||
|  | ||||
| 	can_dig = can_dig, | ||||
|  | ||||
| 	allow_metadata_inventory_put = allow_metadata_inventory_put, | ||||
| 	allow_metadata_inventory_move = allow_metadata_inventory_move, | ||||
| 	allow_metadata_inventory_take = allow_metadata_inventory_take, | ||||
| 	on_receive_fields = function(pos, formname, fields, sender) | ||||
| 		if not pipeworks.may_configure(pos, sender) then return end | ||||
| 		fs_helpers.on_receive_fields(pos, fields) | ||||
| 		local meta = minetest.get_meta(pos) | ||||
| 		local formspec = active_formspec(0, 0, pos, meta) | ||||
| 		meta:set_string("formspec", formspec) | ||||
| 	end, | ||||
| 	after_place_node = pipeworks.after_place, | ||||
| 	after_dig_node = pipeworks.after_dig, | ||||
| 	on_rotate = pipeworks.on_rotate | ||||
| }) | ||||
| } | ||||
|  | ||||
| if minetest.get_modpath("default") then | ||||
| 	minetest.override_item("default:furnace", override) | ||||
| 	minetest.override_item("default:furnace_active", override_active) | ||||
| elseif minetest.get_modpath("hades_furnaces") then | ||||
| 	minetest.override_item("hades_furnaces:furnace", override) | ||||
| 	minetest.override_item("hades_furnaces:furnace_active", override_active) | ||||
| end | ||||
|  | ||||
|   | ||||
							
								
								
									
										296
									
								
								crafts.lua
									
									
									
									
									
								
							
							
						
						
									
										296
									
								
								crafts.lua
									
									
									
									
									
								
							| @@ -1,11 +1,78 @@ | ||||
| local materials = { | ||||
| 	stone = "default:stone", | ||||
| 	desert_stone = "default:desert_stone", | ||||
| 	desert_sand = "default:desert_sand", | ||||
| 	chest = "default:chest", | ||||
| 	copper_ingot = "default:copper_ingot", | ||||
| 	steel_ingot = "default:steel_ingot", | ||||
| 	gold_ingot = "default:gold_ingot", | ||||
| 	mese = "default:mese", | ||||
| 	mese_crystal = "default:mese_crystal", | ||||
| 	mese_crystal_fragment = "default:mese_crystal_fragment", | ||||
| 	teleporter = "default:mese", | ||||
| 	glass = "default:glass", | ||||
| } | ||||
|  | ||||
| if minetest.get_modpath("mcl_core") then | ||||
| 	materials = { | ||||
| 		stone = "mcl_core:stone", | ||||
| 		desert_stone = "mcl_core:sandstone2", | ||||
| 		desert_sand = "mcl_core:sand", | ||||
| 		chest = "mcl_chests:chest_small", | ||||
| 		steel_ingot = "mcl_core:iron_ingot", | ||||
| 		gold_ingot = "mcl_core:gold_ingot", | ||||
| 		mese = "default:mese", | ||||
| 		mese_crystal = "default:mese_crystal", | ||||
| 		mese_crystal_fragment = "mesecons:redstone", | ||||
| 		teleporter = "default:mese", | ||||
| 		-- Use iron where no equivalent | ||||
| 		copper_ingot = "mcl_core:iron_ingot", | ||||
| 		glass = "default:glass", | ||||
| 	} | ||||
| elseif minetest.get_modpath("fl_ores") and minetest.get_modpath("fl_stone") then | ||||
| 	materials = { | ||||
| 		stone = "fl_stone:stone", | ||||
| 		desert_stone = "fl_stone:desert_stone", | ||||
| 		desert_sand = "fl_stone:desert_sand", | ||||
| 		chest = "fl_storage:wood_chest", | ||||
| 		steel_ingot = "fl_ores:iron_ingot", | ||||
| 		gold_ingot = "fl_ores:gold_ingot", | ||||
| 		mese = "fl_ores:iron_ingot", | ||||
| 		mese_crystal = "fl_ores:iron_ingot", | ||||
| 		mese_crystal_fragment = "fl_ores:iron_ingot", | ||||
| 		teleporter = "fl_ores:iron_ingot", | ||||
| 		copper_ingot = "fl_ores:copper_ingot", | ||||
| 		glass = "fl_glass:framed_glass", | ||||
| 	} | ||||
| elseif minetest.get_modpath("hades_core") then | ||||
| 	materials = { | ||||
| 		stone = "hades_core:stone", | ||||
| 		desert_stone = "hades_core:stone_baked", | ||||
| 		desert_sand = "hades_core:volcanic_sand", | ||||
| 		chest = "hades_chests:chest"; | ||||
| 		steel_ingot = "hades_core:steel_ingot", | ||||
| 		gold_ingot = "hades_core:gold_ingot", | ||||
| 		mese = "hades_core:mese", | ||||
| 		mese_crystal = "hades_core:mese_crystal", | ||||
| 		mese_crystal_fragment = "hades_core:mese_crystal_fragment", | ||||
| 		teleporter = "hades_materials:teleporter_device", | ||||
| 		copper_ingot = "hades_core:copper_ingot", | ||||
| 		tin_ingot = "hades_core:tin_ingot", | ||||
| 		glass = "hades_core:glass", | ||||
| 	} | ||||
|   if minetest.get_modpath("hades_default") then | ||||
| 		materials.desert_sand = "hades_default:desert_sand" | ||||
|   end | ||||
| end | ||||
|  | ||||
| -- Crafting recipes for pipes | ||||
|  | ||||
| minetest.register_craft( { | ||||
| 	output = "pipeworks:pipe_1_empty 12", | ||||
| 	recipe = { | ||||
|                 { "default:steel_ingot", "default:steel_ingot", "default:steel_ingot" }, | ||||
| 			{ materials.steel_ingot, materials.steel_ingot, materials.steel_ingot }, | ||||
| 			{ "", "", "" }, | ||||
|                 { "default:steel_ingot", "default:steel_ingot", "default:steel_ingot" } | ||||
| 			{ materials.steel_ingot, materials.steel_ingot, materials.steel_ingot } | ||||
| 	}, | ||||
| }) | ||||
|  | ||||
| @@ -27,9 +94,9 @@ minetest.register_craft( { | ||||
| minetest.register_craft( { | ||||
| output = "pipeworks:entry_panel_empty 2", | ||||
| recipe = { | ||||
| 		{ "", "default:steel_ingot", "" }, | ||||
| 	{ "", materials.steel_ingot, "" }, | ||||
| 	{ "", "pipeworks:pipe_1_empty", "" }, | ||||
| 		{ "", "default:steel_ingot", "" }, | ||||
| 	{ "", materials.steel_ingot, "" }, | ||||
| }, | ||||
| }) | ||||
|  | ||||
| @@ -38,9 +105,9 @@ minetest.register_craft( { | ||||
| minetest.register_craft( { | ||||
| 	output = "pipeworks:pump_off 2", | ||||
| 	recipe = { | ||||
|                 { "default:stone", "default:steel_ingot", "default:stone" }, | ||||
|                 { "default:copper_ingot", "default:mese_crystal_fragment", "default:copper_ingot" }, | ||||
|                 { "default:steel_ingot", "default:steel_ingot", "default:steel_ingot" } | ||||
| 			{ materials.stone, materials.steel_ingot, materials.stone }, | ||||
| 			{ materials.copper_ingot, materials.mese_crystal_fragment, materials.copper_ingot }, | ||||
| 			{ materials.steel_ingot, materials.steel_ingot, materials.steel_ingot } | ||||
| 	}, | ||||
| }) | ||||
|  | ||||
| @@ -48,26 +115,26 @@ minetest.register_craft( { | ||||
| 	output = "pipeworks:valve_off_empty 2", | ||||
| 	recipe = { | ||||
| 			{ "", "group:stick", "" }, | ||||
|                 { "default:steel_ingot", "default:steel_ingot", "default:steel_ingot" }, | ||||
|                 { "", "default:steel_ingot", "" } | ||||
| 			{ materials.steel_ingot, materials.steel_ingot, materials.steel_ingot }, | ||||
| 			{ "", materials.steel_ingot, "" } | ||||
| 	}, | ||||
| }) | ||||
|  | ||||
| minetest.register_craft( { | ||||
| 	output = "pipeworks:storage_tank_0 2", | ||||
| 	recipe = { | ||||
|                 { "", "default:steel_ingot", "default:steel_ingot" }, | ||||
|                 { "default:steel_ingot", "default:glass", "default:steel_ingot" }, | ||||
|                 { "default:steel_ingot", "default:steel_ingot", "" } | ||||
| 			{ "", materials.steel_ingot, materials.steel_ingot }, | ||||
| 			{ materials.steel_ingot, materials.glass, materials.steel_ingot }, | ||||
| 			{ materials.steel_ingot, materials.steel_ingot, "" } | ||||
| 	}, | ||||
| }) | ||||
|  | ||||
| minetest.register_craft( { | ||||
| 	output = "pipeworks:grating 2", | ||||
| 	recipe = { | ||||
|                 { "default:steel_ingot", "", "default:steel_ingot" }, | ||||
| 			{ materials.steel_ingot, "", materials.steel_ingot }, | ||||
| 			{ "", "pipeworks:pipe_1_empty", "" }, | ||||
|                 { "default:steel_ingot", "", "default:steel_ingot" } | ||||
| 			{ materials.steel_ingot, "", materials.steel_ingot } | ||||
| 	}, | ||||
| }) | ||||
|  | ||||
| @@ -85,3 +152,204 @@ minetest.register_craft( { | ||||
| 			{ "pipeworks:pipe_1_empty" } | ||||
| 	}, | ||||
| }) | ||||
|  | ||||
| -- injectors | ||||
|  | ||||
| minetest.register_craft( { | ||||
| 	output = "pipeworks:filter 2", | ||||
| 	recipe = { | ||||
| 			{ materials.steel_ingot, materials.steel_ingot, "basic_materials:plastic_sheet" }, | ||||
| 			{ "group:stick", materials.mese_crystal, "basic_materials:plastic_sheet" }, | ||||
| 			{ materials.steel_ingot, materials.steel_ingot, "basic_materials:plastic_sheet" } | ||||
| 	}, | ||||
| }) | ||||
|  | ||||
| minetest.register_craft( { | ||||
| 	output = "pipeworks:mese_filter 2", | ||||
| 	recipe = { | ||||
| 			{ materials.steel_ingot, materials.steel_ingot, "basic_materials:plastic_sheet" }, | ||||
| 			{ "group:stick", materials.mese, "basic_materials:plastic_sheet" }, | ||||
| 			{ materials.steel_ingot, materials.steel_ingot, "basic_materials:plastic_sheet" } | ||||
| 	}, | ||||
| }) | ||||
|  | ||||
| if minetest.get_modpath("digilines") then | ||||
| 	minetest.register_craft( { | ||||
| 		output = "pipeworks:digiline_filter 2", | ||||
| 		recipe = { | ||||
| 			{ materials.steel_ingot, materials.steel_ingot, "basic_materials:plastic_sheet" }, | ||||
| 			{ "group:stick", "digilines:wire_std_00000000", "basic_materials:plastic_sheet" }, | ||||
| 			{ materials.steel_ingot, materials.steel_ingot, "basic_materials:plastic_sheet" } | ||||
| 		}, | ||||
| 	}) | ||||
| end | ||||
|  | ||||
| -- other | ||||
|  | ||||
| minetest.register_craft( { | ||||
| 	output = "pipeworks:autocrafter 2", | ||||
| 	recipe = { | ||||
| 			{ materials.steel_ingot, materials.mese_crystal, materials.steel_ingot }, | ||||
| 			{ "basic_materials:plastic_sheet", materials.steel_ingot, "basic_materials:plastic_sheet" }, | ||||
| 			{ materials.steel_ingot, materials.mese_crystal, materials.steel_ingot } | ||||
| 	}, | ||||
| }) | ||||
|  | ||||
| minetest.register_craft( { | ||||
| 	output = "pipeworks:steel_block_embedded_tube 1", | ||||
| 	recipe = { | ||||
| 		{ materials.steel_ingot, materials.steel_ingot, materials.steel_ingot }, | ||||
| 		{ materials.steel_ingot, "pipeworks:tube_1", materials.steel_ingot }, | ||||
| 		{ materials.steel_ingot, materials.steel_ingot, materials.steel_ingot } | ||||
| 	}, | ||||
| }) | ||||
|  | ||||
| minetest.register_craft( { | ||||
| 	output = "pipeworks:steel_pane_embedded_tube 1", | ||||
| 	recipe = { | ||||
| 		{ "", materials.steel_ingot, "" }, | ||||
| 		{ "", "pipeworks:tube_1", "" }, | ||||
| 		{ "", materials.steel_ingot, "" } | ||||
| 	}, | ||||
| }) | ||||
|  | ||||
| minetest.register_craft({ | ||||
| 	output = "pipeworks:trashcan", | ||||
| 	recipe = { | ||||
| 		{ "basic_materials:plastic_sheet", "basic_materials:plastic_sheet", "basic_materials:plastic_sheet" }, | ||||
| 		{ materials.steel_ingot, "", materials.steel_ingot }, | ||||
| 		{ materials.steel_ingot, materials.steel_ingot, materials.steel_ingot }, | ||||
| 	}, | ||||
| }) | ||||
|  | ||||
| minetest.register_craft( { | ||||
| 	output = "pipeworks:teleport_tube_1 2", | ||||
| 	recipe = { | ||||
| 			{ "basic_materials:plastic_sheet", "basic_materials:plastic_sheet", "basic_materials:plastic_sheet" }, | ||||
| 			{ materials.desert_stone, materials.teleporter, materials.desert_stone }, | ||||
| 			{ "basic_materials:plastic_sheet", "basic_materials:plastic_sheet", "basic_materials:plastic_sheet" } | ||||
| 	}, | ||||
| }) | ||||
|  | ||||
| if pipeworks.enable_priority_tube then | ||||
| 	minetest.register_craft( { | ||||
| 		output = "pipeworks:priority_tube_1 6", | ||||
| 		recipe = { | ||||
| 			{ "basic_materials:plastic_sheet", "basic_materials:plastic_sheet", "basic_materials:plastic_sheet" }, | ||||
| 			{ materials.gold_ingot, "", materials.gold_ingot }, | ||||
| 			{ "basic_materials:plastic_sheet", "basic_materials:plastic_sheet", "basic_materials:plastic_sheet" } | ||||
| 		}, | ||||
| 	}) | ||||
| end | ||||
|  | ||||
| if pipeworks.enable_accelerator_tube then | ||||
| 	minetest.register_craft( { | ||||
| 		output = "pipeworks:accelerator_tube_1 2", | ||||
| 		recipe = { | ||||
| 			{ "basic_materials:plastic_sheet", "basic_materials:plastic_sheet", "basic_materials:plastic_sheet" }, | ||||
| 			{ materials.mese_crystal_fragment, materials.steel_ingot, materials.mese_crystal_fragment }, | ||||
| 			{ "basic_materials:plastic_sheet", "basic_materials:plastic_sheet", "basic_materials:plastic_sheet" } | ||||
| 		}, | ||||
| 	}) | ||||
| end | ||||
|  | ||||
| if pipeworks.enable_crossing_tube then | ||||
| 	minetest.register_craft( { | ||||
| 		output = "pipeworks:crossing_tube_1 5", | ||||
| 		recipe = { | ||||
| 			{ "", "pipeworks:tube_1", "" }, | ||||
| 			{ "pipeworks:tube_1", "pipeworks:tube_1", "pipeworks:tube_1" }, | ||||
| 			{ "", "pipeworks:tube_1", "" } | ||||
| 		}, | ||||
| 	}) | ||||
| end | ||||
|  | ||||
| if pipeworks.enable_one_way_tube then | ||||
| 	minetest.register_craft({ | ||||
| 		output = "pipeworks:one_way_tube 2", | ||||
| 		recipe = { | ||||
| 			{ "basic_materials:plastic_sheet", "basic_materials:plastic_sheet", "basic_materials:plastic_sheet" }, | ||||
| 			{ "group:stick", materials.mese_crystal, "basic_materials:plastic_sheet" }, | ||||
| 			{ "basic_materials:plastic_sheet", "basic_materials:plastic_sheet", "basic_materials:plastic_sheet" } | ||||
| 		}, | ||||
| 	}) | ||||
| end | ||||
|  | ||||
| if pipeworks.enable_mese_tube then | ||||
| 	minetest.register_craft( { | ||||
| 		output = "pipeworks:mese_tube_000000 2", | ||||
| 		recipe = { | ||||
| 			{ "basic_materials:plastic_sheet", "basic_materials:plastic_sheet", "basic_materials:plastic_sheet" }, | ||||
| 			{ "", materials.mese_crystal, "" }, | ||||
| 			{ "basic_materials:plastic_sheet", "basic_materials:plastic_sheet", "basic_materials:plastic_sheet" } | ||||
| 		}, | ||||
| 	}) | ||||
|  | ||||
| 	minetest.register_craft( { | ||||
| 		type = "shapeless", | ||||
| 		output = "pipeworks:mese_tube_000000", | ||||
| 		recipe = { | ||||
| 			"pipeworks:tube_1", | ||||
| 			materials.mese_crystal_fragment, | ||||
| 			materials.mese_crystal_fragment, | ||||
| 			materials.mese_crystal_fragment, | ||||
| 			materials.mese_crystal_fragment, | ||||
| 		}, | ||||
| 	}) | ||||
| end | ||||
|  | ||||
| if pipeworks.enable_mese_sand_tube then | ||||
| 	minetest.register_craft( { | ||||
| 		output = "pipeworks:mese_sand_tube_1 2", | ||||
| 		recipe = { | ||||
| 			{"basic_materials:plastic_sheet", "basic_materials:plastic_sheet", "basic_materials:plastic_sheet" }, | ||||
| 			{"group:sand",				 materials.mese_crystal,	   "group:sand" }, | ||||
| 			{"basic_materials:plastic_sheet", "basic_materials:plastic_sheet", "basic_materials:plastic_sheet" } | ||||
| 		}, | ||||
| 	}) | ||||
|  | ||||
| 	minetest.register_craft( { | ||||
| 		type = "shapeless", | ||||
| 		output = "pipeworks:mese_sand_tube_1", | ||||
| 		recipe = { | ||||
| 			"pipeworks:sand_tube_1", | ||||
| 			materials.mese_crystal_fragment, | ||||
| 			materials.mese_crystal_fragment, | ||||
| 			materials.mese_crystal_fragment, | ||||
| 			materials.mese_crystal_fragment, | ||||
| 		}, | ||||
| 	}) | ||||
| end | ||||
|  | ||||
| if pipeworks.enable_deployer then | ||||
| 	minetest.register_craft({ | ||||
| 		output = "pipeworks:deployer_off", | ||||
| 		recipe = { | ||||
| 			{ "group:wood",	materials.chest,	"group:wood"	}, | ||||
| 			{ materials.stone, "mesecons:piston",  materials.stone }, | ||||
| 			{ materials.stone, "mesecons:mesecon", materials.stone }, | ||||
| 		} | ||||
| 	}) | ||||
| end | ||||
|  | ||||
| if pipeworks.enable_dispenser then | ||||
| 	minetest.register_craft({ | ||||
| 		output = "pipeworks:dispenser_off", | ||||
| 		recipe = { | ||||
| 			{ materials.desert_sand, materials.chest,	materials.desert_sand }, | ||||
| 			{ materials.stone,	   "mesecons:piston",  materials.stone	   }, | ||||
| 			{ materials.stone,	   "mesecons:mesecon", materials.stone	  }, | ||||
| 		} | ||||
| 	}) | ||||
| end | ||||
|  | ||||
| if pipeworks.enable_node_breaker then | ||||
| 	minetest.register_craft({ | ||||
| 		output = "pipeworks:nodebreaker_off", | ||||
| 		recipe = { | ||||
| 			{ "basic_materials:gear_steel", "basic_materials:gear_steel",   "basic_materials:gear_steel"	}, | ||||
| 			{ materials.stone, "mesecons:piston",   materials.stone }, | ||||
| 			{ "group:wood",	"mesecons:mesecon",  "group:wood" }, | ||||
| 		} | ||||
| 	}) | ||||
| end | ||||
|   | ||||
| @@ -1,20 +1,24 @@ | ||||
| local S = minetest.get_translator("pipeworks") | ||||
|  | ||||
| local straight = function(pos, node, velocity, stack) return {velocity} end | ||||
| local steel_tex = "[combine:16x16^[noalpha^[colorize:#D3D3D3" | ||||
| if minetest.get_modpath("default") then steel_tex = "default_steel_block.png" end | ||||
|  | ||||
| minetest.register_node("pipeworks:steel_block_embedded_tube", { | ||||
| 	description = S("Airtight steelblock embedded tube"), | ||||
| 	tiles = { | ||||
| 		"default_steel_block.png", "default_steel_block.png", | ||||
| 		"default_steel_block.png", "default_steel_block.png", | ||||
| 		"default_steel_block.png^pipeworks_tube_connection_metallic.png", | ||||
| 		"default_steel_block.png^pipeworks_tube_connection_metallic.png", | ||||
| 		steel_tex, steel_tex, | ||||
| 		steel_tex, steel_tex, | ||||
| 		steel_tex .. "^pipeworks_tube_connection_metallic.png", | ||||
| 		steel_tex .. "^pipeworks_tube_connection_metallic.png", | ||||
| 		}, | ||||
| 	paramtype = "light", | ||||
| 	paramtype2 = "facedir", | ||||
| 	groups = {cracky=1, oddly_breakable_by_hand = 1, tubedevice = 1}, | ||||
| 	groups = {cracky=1, oddly_breakable_by_hand = 1, tubedevice = 1, dig_glass = 2}, | ||||
| 	legacy_facedir_simple = true, | ||||
| 	sounds = default.node_sound_stone_defaults(), | ||||
| 	_sound_def = { | ||||
|         key = "node_sound_stone_defaults", | ||||
|     }, | ||||
| 	tube = { | ||||
| 		connect_sides = {front = 1, back = 1,}, | ||||
| 		priority = 50, | ||||
| @@ -30,15 +34,6 @@ minetest.register_node("pipeworks:steel_block_embedded_tube", { | ||||
| }) | ||||
| pipeworks.ui_cat_tube_list[#pipeworks.ui_cat_tube_list+1] = "pipeworks:steel_block_embedded_tube" | ||||
|  | ||||
| minetest.register_craft( { | ||||
| 	output = "pipeworks:steel_block_embedded_tube 1", | ||||
| 	recipe = { | ||||
| 		{ "default:steel_ingot", "default:steel_ingot", "default:steel_ingot" }, | ||||
| 		{ "default:steel_ingot", "pipeworks:tube_1", "default:steel_ingot" }, | ||||
| 		{ "default:steel_ingot", "default:steel_ingot", "default:steel_ingot" } | ||||
| 	}, | ||||
| }) | ||||
|  | ||||
| local pane_box = { | ||||
| 	type = "fixed", | ||||
| 	fixed = { | ||||
| @@ -54,11 +49,12 @@ minetest.register_node("pipeworks:steel_pane_embedded_tube", { | ||||
| 	drawtype = "nodebox", | ||||
| 	description = S("Airtight panel embedded tube"), | ||||
| 	tiles = { | ||||
| 		"pipeworks_pane_embedded_tube_sides.png^[transformR90", | ||||
| 		"pipeworks_pane_embedded_tube_sides.png^[transformR90", | ||||
| 		"pipeworks_pane_embedded_tube_sides.png", | ||||
| 		"pipeworks_pane_embedded_tube_sides.png", | ||||
| 		"pipeworks_pane_embedded_tube_ends.png", "pipeworks_pane_embedded_tube_ends.png", | ||||
| 		pipeworks.make_tube_tile("pipeworks_pane_embedded_tube_sides.png^[transformR90"), | ||||
| 		pipeworks.make_tube_tile("pipeworks_pane_embedded_tube_sides.png^[transformR90"), | ||||
| 		pipeworks.make_tube_tile("pipeworks_pane_embedded_tube_sides.png"), | ||||
| 		pipeworks.make_tube_tile("pipeworks_pane_embedded_tube_sides.png"), | ||||
| 		pipeworks.make_tube_tile("pipeworks_pane_embedded_tube_ends.png"), | ||||
| 		pipeworks.make_tube_tile("pipeworks_pane_embedded_tube_ends.png"), | ||||
| 	}, | ||||
| 	use_texture_alpha = texture_alpha_mode, | ||||
| 	node_box = pane_box, | ||||
| @@ -66,9 +62,11 @@ minetest.register_node("pipeworks:steel_pane_embedded_tube", { | ||||
| 	collision_box = pane_box, | ||||
| 	paramtype = "light", | ||||
| 	paramtype2 = "facedir", | ||||
| 	groups = {cracky=1, oddly_breakable_by_hand = 1, tubedevice = 1}, | ||||
| 	groups = {cracky=1, oddly_breakable_by_hand = 1, tubedevice = 1, dig_glass = 2}, | ||||
| 	legacy_facedir_simple = true, | ||||
| 	sounds = default.node_sound_stone_defaults(), | ||||
| 	_sound_def = { | ||||
|         key = "node_sound_stone_defaults", | ||||
|     }, | ||||
| 	tube = { | ||||
| 		connect_sides = {front = 1, back = 1,}, | ||||
| 		priority = 50, | ||||
| @@ -83,12 +81,3 @@ minetest.register_node("pipeworks:steel_pane_embedded_tube", { | ||||
| 	on_rotate = pipeworks.on_rotate, | ||||
| }) | ||||
| pipeworks.ui_cat_tube_list[#pipeworks.ui_cat_tube_list+1] = "pipeworks:steel_pane_embedded_tube" | ||||
|  | ||||
| minetest.register_craft( { | ||||
| 	output = "pipeworks:steel_pane_embedded_tube 1", | ||||
| 	recipe = { | ||||
| 		{ "", "default:steel_ingot", "" }, | ||||
| 		{ "", "pipeworks:tube_1", "" }, | ||||
| 		{ "", "default:steel_ingot", "" } | ||||
| 	}, | ||||
| }) | ||||
|   | ||||
| @@ -27,6 +27,8 @@ local settings = { | ||||
| 	enable_cyclic_mode = true, | ||||
| 	drop_on_routing_fail = false, | ||||
| 	delete_item_on_clearobject = true, | ||||
| 	use_real_entities = true, | ||||
| 	entity_update_interval = 0, | ||||
| } | ||||
|  | ||||
| pipeworks.toggles = {} | ||||
| @@ -62,10 +64,9 @@ pipeworks.toggles.finite_water = nil | ||||
| for name, value in pairs(settings) do | ||||
| 	local setting_type = type(value) | ||||
| 	if setting_type == "boolean" then | ||||
| 		pipeworks[name] = minetest.settings:get_bool(prefix..name) | ||||
| 		if pipeworks[name] == nil then | ||||
| 			pipeworks[name] = value | ||||
| 		end | ||||
| 		pipeworks[name] = minetest.settings:get_bool(prefix..name, value) | ||||
| 	elseif setting_type == "number" then | ||||
| 		pipeworks[name] = tonumber(minetest.settings:get(prefix..name) or value) | ||||
| 	else | ||||
| 		pipeworks[name] = value | ||||
| 	end | ||||
|   | ||||
							
								
								
									
										119
									
								
								devices.lua
									
									
									
									
									
								
							
							
						
						
									
										119
									
								
								devices.lua
									
									
									
									
									
								
							| @@ -1,6 +1,8 @@ | ||||
| local S = minetest.get_translator("pipeworks") | ||||
| local new_flow_logic_register = pipeworks.flowables.register | ||||
|  | ||||
| local texture_alpha_mode = minetest.features.use_texture_alpha_string_modes | ||||
|  | ||||
| local polys = "" | ||||
| if pipeworks.enable_lowpoly then polys = "_lowpoly" end | ||||
|  | ||||
| @@ -28,7 +30,9 @@ function pipeworks.rotate_on_place(itemstack, placer, pointed_thing) | ||||
| 		if (not placer:get_player_control().sneak) | ||||
| 		  and minetest.registered_nodes[node.name] | ||||
| 		  and minetest.registered_nodes[node.name].on_rightclick then | ||||
| 			minetest.registered_nodes[node.name].on_rightclick(pointed_thing.under, node, placer, itemstack) | ||||
| 			minetest.registered_nodes[node.name].on_rightclick(pointed_thing.under, | ||||
| 				node, placer, itemstack, pointed_thing) | ||||
|  | ||||
| 		else | ||||
|  | ||||
| 			local pitch = placer:get_look_pitch() | ||||
| @@ -129,9 +133,9 @@ for s in ipairs(states) do | ||||
|  | ||||
| 	local dgroups | ||||
| 	if states[s] == "off" then | ||||
| 		dgroups = {snappy=3, pipe=1} | ||||
| 		dgroups = {snappy=3, pipe=1, dig_generic = 4} | ||||
| 	else | ||||
| 		dgroups = {snappy=3, pipe=1, not_in_creative_inventory=1} | ||||
| 		dgroups = {snappy=3, pipe=1, not_in_creative_inventory=1, dig_generic = 4} | ||||
| 	end | ||||
|  | ||||
| 	local pumpname = "pipeworks:pump_"..states[s] | ||||
| @@ -140,10 +144,13 @@ for s in ipairs(states) do | ||||
| 		drawtype = "mesh", | ||||
| 		mesh = "pipeworks_pump"..polys..".obj", | ||||
| 		tiles = { "pipeworks_pump_"..states[s]..".png" }, | ||||
| 		use_texture_alpha = texture_alpha_mode and "clip" or true, | ||||
| 		paramtype = "light", | ||||
| 		paramtype2 = "facedir", | ||||
| 		groups = dgroups, | ||||
| 		sounds = default.node_sound_metal_defaults(), | ||||
| 		_sound_def = { | ||||
| 			key = "node_sound_metal_defaults", | ||||
| 		}, | ||||
| 		walkable = true, | ||||
| 		pipe_connections = { top = 1 }, | ||||
| 		after_place_node = function(pos) | ||||
| @@ -165,7 +172,7 @@ for s in ipairs(states) do | ||||
| 			local fdir = node.param2 | ||||
| 			minetest.swap_node(pos, { name = "pipeworks:pump_"..states[3-s], param2 = fdir }) | ||||
| 		end, | ||||
| 		on_rotate = screwdriver.rotate_simple | ||||
| 		on_rotate = screwdriver and screwdriver.rotate_simple or nil | ||||
| 	}) | ||||
|  | ||||
| 	-- FIXME: this currently assumes that pumps can only rotate around the fixed axis pointing Y+. | ||||
| @@ -195,7 +202,9 @@ for s in ipairs(states) do | ||||
| 			fixed = { -5/16, -4/16, -8/16, 5/16, 5/16, 8/16 } | ||||
| 		}, | ||||
| 		groups = dgroups, | ||||
| 		sounds = default.node_sound_metal_defaults(), | ||||
| 		_sound_def = { | ||||
| 			key = "node_sound_metal_defaults", | ||||
| 		}, | ||||
| 		walkable = true, | ||||
| 		on_place = pipeworks.rotate_on_place, | ||||
| 		after_dig_node = function(pos) | ||||
| @@ -242,8 +251,10 @@ minetest.register_node(nodename_valve_loaded, { | ||||
| 		type = "fixed", | ||||
| 		fixed = { -5/16, -4/16, -8/16, 5/16, 5/16, 8/16 } | ||||
| 	}, | ||||
| 	groups = {snappy=3, pipe=1, not_in_creative_inventory=1}, | ||||
| 	sounds = default.node_sound_metal_defaults(), | ||||
| 	groups = {snappy=3, pipe=1, not_in_creative_inventory=1, dig_generic = 4}, | ||||
| 	_sound_def = { | ||||
|         key = "node_sound_metal_defaults", | ||||
|     }, | ||||
| 	walkable = true, | ||||
| 	on_place = pipeworks.rotate_on_place, | ||||
| 	after_dig_node = function(pos) | ||||
| @@ -284,6 +295,7 @@ minetest.register_node("pipeworks:grating", { | ||||
| 		"pipeworks_grating_sides.png", | ||||
| 		"pipeworks_grating_sides.png" | ||||
| 	}, | ||||
| 	use_texture_alpha = texture_alpha_mode and "clip" or true, | ||||
| 	drawtype = "nodebox", | ||||
| 	node_box = { | ||||
| 		type = "fixed", | ||||
| @@ -291,8 +303,10 @@ minetest.register_node("pipeworks:grating", { | ||||
| 	}, | ||||
| 	sunlight_propagates = true, | ||||
| 	paramtype = "light", | ||||
| 	groups = {snappy=3, pipe=1}, | ||||
| 	sounds = default.node_sound_metal_defaults(), | ||||
| 	groups = {snappy=3, pipe=1, dig_generic = 4}, | ||||
| 	_sound_def = { | ||||
|         key = "node_sound_metal_defaults", | ||||
|     }, | ||||
| 	walkable = true, | ||||
| 	pipe_connections = { top = 1 }, | ||||
| 	after_place_node = function(pos) | ||||
| @@ -316,8 +330,10 @@ minetest.register_node(nodename_spigot_empty, { | ||||
| 	sunlight_propagates = true, | ||||
| 	paramtype = "light", | ||||
| 	paramtype2 = "facedir", | ||||
| 	groups = {snappy=3, pipe=1}, | ||||
| 	sounds = default.node_sound_metal_defaults(), | ||||
| 	groups = {snappy=3, pipe=1, dig_generic = 4}, | ||||
| 	_sound_def = { | ||||
|         key = "node_sound_metal_defaults", | ||||
|     }, | ||||
| 	walkable = true, | ||||
| 	pipe_connections = { left=1, right=1, front=1, back=1, | ||||
| 						 left_param2 = 3, right_param2 = 1, front_param2 = 2, back_param2 = 0 }, | ||||
| @@ -344,22 +360,17 @@ minetest.register_node(nodename_spigot_loaded, { | ||||
| 	drawtype = "mesh", | ||||
| 	mesh = "pipeworks_spigot_pouring"..polys..".obj", | ||||
| 	tiles = { | ||||
| 		{ | ||||
| 			name = "default_water_flowing_animated.png", | ||||
| 			animation = { | ||||
| 				type = "vertical_frames", | ||||
| 				aspect_w = 16, | ||||
| 				aspect_h = 16, | ||||
| 				length = 0.8, | ||||
| 			}, | ||||
| 		}, | ||||
| 		minetest.registered_nodes[pipeworks.liquids.water.source].tiles[1], | ||||
| 		{ name = "pipeworks_spigot.png" } | ||||
| 	}, | ||||
| 	use_texture_alpha = texture_alpha_mode and "blend" or true, | ||||
| 	sunlight_propagates = true, | ||||
| 	paramtype = "light", | ||||
| 	paramtype2 = "facedir", | ||||
| 	groups = {snappy=3, pipe=1, not_in_creative_inventory=1}, | ||||
| 	sounds = default.node_sound_metal_defaults(), | ||||
| 	groups = {snappy=3, pipe=1, not_in_creative_inventory=1, dig_generic = 4}, | ||||
| 	_sound_def = { | ||||
|         key = "node_sound_metal_defaults", | ||||
|     }, | ||||
| 	walkable = true, | ||||
| 	pipe_connections = { left=1, right=1, front=1, back=1, | ||||
| 						 left_param2 = 3, right_param2 = 1, front_param2 = 2, back_param2 = 0 }, | ||||
| @@ -414,8 +425,10 @@ minetest.register_node(nodename_panel_empty, { | ||||
| 	tiles = { "pipeworks_entry_panel.png" }, | ||||
| 	paramtype = "light", | ||||
| 	paramtype2 = "facedir", | ||||
| 	groups = {snappy=3, pipe=1}, | ||||
| 	sounds = default.node_sound_metal_defaults(), | ||||
| 	groups = {snappy=3, pipe=1, dig_generic = 4}, | ||||
| 	_sound_def = { | ||||
|         key = "node_sound_metal_defaults", | ||||
|     }, | ||||
| 	walkable = true, | ||||
| 	on_place = pipeworks.rotate_on_place, | ||||
| 	after_dig_node = function(pos) | ||||
| @@ -434,8 +447,10 @@ minetest.register_node(nodename_panel_loaded, { | ||||
| 	tiles = { "pipeworks_entry_panel.png" }, | ||||
| 	paramtype = "light", | ||||
| 	paramtype2 = "facedir", | ||||
| 	groups = {snappy=3, pipe=1, not_in_creative_inventory=1}, | ||||
| 	sounds = default.node_sound_metal_defaults(), | ||||
| 	groups = {snappy=3, pipe=1, not_in_creative_inventory=1, dig_generic = 4}, | ||||
| 	_sound_def = { | ||||
|         key = "node_sound_metal_defaults", | ||||
|     }, | ||||
| 	walkable = true, | ||||
| 	on_place = pipeworks.rotate_on_place, | ||||
| 	after_dig_node = function(pos) | ||||
| @@ -464,8 +479,10 @@ minetest.register_node(nodename_sensor_empty, { | ||||
| 	sunlight_propagates = true, | ||||
| 	paramtype = "light", | ||||
| 	paramtype2 = "facedir", | ||||
| 	groups = {snappy=3, pipe=1}, | ||||
| 	sounds = default.node_sound_metal_defaults(), | ||||
| 	groups = {snappy=3, pipe=1, dig_generic = 4}, | ||||
| 	_sound_def = { | ||||
|         key = "node_sound_metal_defaults", | ||||
|     }, | ||||
| 	walkable = true, | ||||
| 	on_place = pipeworks.rotate_on_place, | ||||
| 	after_dig_node = function(pos) | ||||
| @@ -503,8 +520,10 @@ minetest.register_node(nodename_sensor_loaded, { | ||||
| 	sunlight_propagates = true, | ||||
| 	paramtype = "light", | ||||
| 	paramtype2 = "facedir", | ||||
| 	groups = {snappy=3, pipe=1, not_in_creative_inventory=1}, | ||||
| 	sounds = default.node_sound_metal_defaults(), | ||||
| 	groups = {snappy=3, pipe=1, not_in_creative_inventory=1, dig_generic = 4}, | ||||
| 	_sound_def = { | ||||
|         key = "node_sound_metal_defaults", | ||||
|     }, | ||||
| 	walkable = true, | ||||
| 	on_place = pipeworks.rotate_on_place, | ||||
| 	after_dig_node = function(pos) | ||||
| @@ -548,12 +567,12 @@ new_flow_logic_register.transition_simple_set(sensor_pressure_set, { mesecons=pi | ||||
| -- TODO flow-logic-stub: these don't currently do anything under the new flow logic. | ||||
| for fill = 0, 10 do | ||||
| 	local filldesc=S("empty") | ||||
| 	local sgroups = {snappy=3, pipe=1, tankfill=fill+1} | ||||
| 	local sgroups = {snappy=3, pipe=1, tankfill=fill+1, dig_generic = 4} | ||||
| 	local image = nil | ||||
|  | ||||
| 	if fill ~= 0 then | ||||
| 		filldesc=S("@1% full", 10*fill) | ||||
| 		sgroups = {snappy=3, pipe=1, tankfill=fill+1, not_in_creative_inventory=1} | ||||
| 		sgroups = {snappy=3, pipe=1, tankfill=fill+1, not_in_creative_inventory=1, dig_generic = 4} | ||||
| 		image = "pipeworks_storage_tank_fittings.png" | ||||
| 	end | ||||
|  | ||||
| @@ -570,8 +589,10 @@ for fill = 0, 10 do | ||||
| 		inventory_image = image, | ||||
| 		paramtype = "light", | ||||
| 		paramtype2 = "facedir", | ||||
| 		groups = {snappy=3, pipe=1, tankfill=fill+1, not_in_creative_inventory=1}, | ||||
| 		sounds = default.node_sound_metal_defaults(), | ||||
| 		groups = {snappy=3, pipe=1, tankfill=fill+1, not_in_creative_inventory=1, dig_generic = 4}, | ||||
| 		_sound_def = { | ||||
| 			key = "node_sound_metal_defaults", | ||||
| 		}, | ||||
| 		walkable = true, | ||||
| 		drop = "pipeworks:storage_tank_0", | ||||
| 		pipe_connections = { top = 1, bottom = 1}, | ||||
| @@ -599,7 +620,9 @@ for fill = 0, 10 do | ||||
| 		paramtype = "light", | ||||
| 		paramtype2 = "facedir", | ||||
| 		groups = sgroups, | ||||
| 		sounds = default.node_sound_metal_defaults(), | ||||
| 		_sound_def = { | ||||
| 			key = "node_sound_metal_defaults", | ||||
| 		}, | ||||
| 		walkable = true, | ||||
| 		drop = "pipeworks:storage_tank_0", | ||||
| 		pipe_connections = { top = 1, bottom = 1}, | ||||
| @@ -625,8 +648,10 @@ minetest.register_node(nodename_fountain_empty, { | ||||
| 	tiles = { "pipeworks_fountainhead.png" }, | ||||
| 	sunlight_propagates = true, | ||||
| 	paramtype = "light", | ||||
| 	groups = {snappy=3, pipe=1}, | ||||
| 	sounds = default.node_sound_metal_defaults(), | ||||
| 	groups = {snappy=3, pipe=1, dig_generic = 4}, | ||||
| 	_sound_def = { | ||||
|         key = "node_sound_metal_defaults", | ||||
|     }, | ||||
| 	walkable = true, | ||||
| 	pipe_connections = { bottom = 1 }, | ||||
| 	after_place_node = function(pos) | ||||
| @@ -660,8 +685,10 @@ minetest.register_node(nodename_fountain_loaded, { | ||||
| 	tiles = { "pipeworks_fountainhead.png" }, | ||||
| 	sunlight_propagates = true, | ||||
| 	paramtype = "light", | ||||
| 	groups = {snappy=3, pipe=1, not_in_creative_inventory=1}, | ||||
| 	sounds = default.node_sound_metal_defaults(), | ||||
| 	groups = {snappy=3, pipe=1, not_in_creative_inventory=1, dig_generic = 4}, | ||||
| 	_sound_def = { | ||||
|         key = "node_sound_metal_defaults", | ||||
|     }, | ||||
| 	walkable = true, | ||||
| 	pipe_connections = { bottom = 1 }, | ||||
| 	after_place_node = function(pos) | ||||
| @@ -710,8 +737,10 @@ minetest.register_node(nodename_sp_empty, { | ||||
| 	tiles = { "pipeworks_straight_pipe_empty.png" }, | ||||
| 	paramtype = "light", | ||||
| 	paramtype2 = "facedir", | ||||
| 	groups = {snappy=3, pipe=1}, | ||||
| 	sounds = default.node_sound_metal_defaults(), | ||||
| 	groups = {snappy=3, pipe=1, dig_generic = 4}, | ||||
| 	_sound_def = { | ||||
|         key = "node_sound_metal_defaults", | ||||
|     }, | ||||
| 	walkable = true, | ||||
| 	on_place = pipeworks.rotate_on_place, | ||||
| 	after_dig_node = function(pos) | ||||
| @@ -732,8 +761,10 @@ minetest.register_node(nodename_sp_loaded, { | ||||
| 	tiles = { "pipeworks_straight_pipe_loaded.png" }, | ||||
| 	paramtype = "light", | ||||
| 	paramtype2 = "facedir", | ||||
| 	groups = {snappy=3, pipe=1, not_in_creative_inventory=1}, | ||||
| 	sounds = default.node_sound_metal_defaults(), | ||||
| 	groups = {snappy=3, pipe=1, not_in_creative_inventory=1, dig_generic = 4}, | ||||
| 	_sound_def = { | ||||
|         key = "node_sound_metal_defaults", | ||||
|     }, | ||||
| 	walkable = true, | ||||
| 	on_place = pipeworks.rotate_on_place, | ||||
| 	after_dig_node = function(pos) | ||||
|   | ||||
| @@ -32,22 +32,35 @@ local function set_filter_formspec(data, meta) | ||||
| 		local exmatch_button = "" | ||||
| 		if data.stackwise then | ||||
| 			exmatch_button = | ||||
| 				fs_helpers.cycling_button(meta, "button[4,3.5;4,1", "exmatch_mode", | ||||
| 				fs_helpers.cycling_button(meta, "button["..(10.2-(0.22)-4)..",4.5;4,1", "exmatch_mode", | ||||
| 					{S("Exact match - off"), | ||||
| 					 S("Exact match - on")}) | ||||
| 		end | ||||
|  | ||||
| 		formspec = "size[8,8.5]".. | ||||
| 			"item_image[0,0;1,1;pipeworks:"..data.name.."]".. | ||||
| 			"label[1,0;"..minetest.formspec_escape(itemname).."]".. | ||||
| 			"label[0,1;"..S("Prefer item types:").."]".. | ||||
| 			"list[context;main;0,1.5;8,2;]".. | ||||
| 			fs_helpers.cycling_button(meta, "button[0,3.5;4,1", "slotseq_mode", | ||||
| 		local size = "10.2,11" | ||||
| 		local list_backgrounds = "" | ||||
| 		if minetest.get_modpath("i3") then | ||||
| 			list_backgrounds = "style_type[box;colors=#666]" | ||||
| 			for i=0, 7 do | ||||
| 				for j=0, 1 do | ||||
| 					list_backgrounds = list_backgrounds .. "box[".. 0.22+(i*1.25) ..",".. 1.75+(j*1.25) ..";1,1;]" | ||||
| 				end | ||||
| 			end | ||||
| 		end | ||||
| 		formspec = | ||||
| 			"formspec_version[2]".. | ||||
| 			"size["..size.."]".. | ||||
| 			pipeworks.fs_helpers.get_prepends(size).. | ||||
| 			"item_image[0.22,0.22;1,1;pipeworks:"..data.name.."]".. | ||||
| 			"label[1.22,0.72;"..minetest.formspec_escape(itemname).."]".. | ||||
| 			"label[0.22,1.5;"..S("Prefer item types:").."]".. | ||||
| 			list_backgrounds.. | ||||
| 			"list[context;main;0.22,1.75;8,2;]".. | ||||
| 			fs_helpers.cycling_button(meta, "button[0.22,4.5;4,1", "slotseq_mode", | ||||
| 				{S("Sequence slots by Priority"), | ||||
| 				 S("Sequence slots Randomly"), | ||||
| 				 S("Sequence slots by Rotation")}).. | ||||
| 			exmatch_button.. | ||||
| 			"list[current_player;main;0,4.5;8,4;]" .. | ||||
| 			pipeworks.fs_helpers.get_inv(6).. | ||||
| 			"listring[]" | ||||
| 	end | ||||
| 	meta:set_string("formspec", formspec) | ||||
| @@ -65,8 +78,8 @@ local function punch_filter(data, filtpos, filtnode, msg) | ||||
| 	local fromnode = minetest.get_node(frompos) | ||||
| 	if not fromnode then return end | ||||
| 	local fromdef = minetest.registered_nodes[fromnode.name] | ||||
| 	if not fromdef then return end | ||||
| 	local fromtube = fromdef.tube | ||||
| 	if not fromdef or not fromdef.tube then return end | ||||
| 	local fromtube = table.copy(fromdef.tube) | ||||
| 	local input_special_cases = { | ||||
| 		["technic:mv_electric_furnace"] = "dst", | ||||
| 		["technic:mv_electric_furnace_active"] = "dst", | ||||
| @@ -377,7 +390,9 @@ for _, data in ipairs({ | ||||
| 		paramtype2 = "facedir", | ||||
| 		groups = {snappy = 2, choppy = 2, oddly_breakable_by_hand = 2, mesecon = 2}, | ||||
| 		legacy_facedir_simple = true, | ||||
| 		sounds = default.node_sound_wood_defaults(), | ||||
| 		_sound_def = { | ||||
| 			key = "node_sound_wood_defaults", | ||||
| 		}, | ||||
| 		on_construct = function(pos) | ||||
| 			local meta = minetest.get_meta(pos) | ||||
| 			set_filter_formspec(data, meta) | ||||
| @@ -482,35 +497,6 @@ for _, data in ipairs({ | ||||
| 	pipeworks.ui_cat_tube_list[#pipeworks.ui_cat_tube_list+1] = "pipeworks:"..data.name | ||||
| end | ||||
|  | ||||
| minetest.register_craft( { | ||||
| 	output = "pipeworks:filter 2", | ||||
| 	recipe = { | ||||
| 	        { "default:steel_ingot", "default:steel_ingot", "basic_materials:plastic_sheet" }, | ||||
| 	        { "group:stick", "default:mese_crystal", "basic_materials:plastic_sheet" }, | ||||
| 	        { "default:steel_ingot", "default:steel_ingot", "basic_materials:plastic_sheet" } | ||||
| 	}, | ||||
| }) | ||||
|  | ||||
| minetest.register_craft( { | ||||
| 	output = "pipeworks:mese_filter 2", | ||||
| 	recipe = { | ||||
| 	        { "default:steel_ingot", "default:steel_ingot", "basic_materials:plastic_sheet" }, | ||||
| 	        { "group:stick", "default:mese", "basic_materials:plastic_sheet" }, | ||||
| 	        { "default:steel_ingot", "default:steel_ingot", "basic_materials:plastic_sheet" } | ||||
| 	}, | ||||
| }) | ||||
|  | ||||
| if minetest.get_modpath("digilines") then | ||||
| 	minetest.register_craft( { | ||||
| 		output = "pipeworks:digiline_filter 2", | ||||
| 		recipe = { | ||||
| 			{ "default:steel_ingot", "default:steel_ingot", "basic_materials:plastic_sheet" }, | ||||
| 			{ "group:stick", "digilines:wire_std_00000000", "basic_materials:plastic_sheet" }, | ||||
| 			{ "default:steel_ingot", "default:steel_ingot", "basic_materials:plastic_sheet" } | ||||
| 		}, | ||||
| 	}) | ||||
| end | ||||
|  | ||||
| --[[ | ||||
| In the past the filter-injectors had real items in their inventories. This code | ||||
| puts them to the input to the filter-injector if possible. Else the items are | ||||
|   | ||||
| @@ -83,7 +83,7 @@ end | ||||
|  | ||||
| pipeworks.spigot_check = function(pos, node) | ||||
| 	local belowname = minetest.get_node({x=pos.x,y=pos.y-1,z=pos.z}).name | ||||
| 	if belowname and (belowname == "air" or belowname == "default:water_flowing" or belowname == "default:water_source") then | ||||
| 	if belowname and (belowname == "air" or belowname == pipeworks.liquids.water.flowing or belowname == pipeworks.liquids.water.source) then | ||||
| 		local spigotname = minetest.get_node(pos).name | ||||
| 		local fdir=node.param2 % 4 | ||||
| 		local check = { | ||||
| @@ -96,14 +96,14 @@ pipeworks.spigot_check = function(pos, node) | ||||
| 		if near_node and string.find(near_node.name, "_loaded") then | ||||
| 			if spigotname and spigotname == "pipeworks:spigot" then | ||||
| 				minetest.add_node(pos,{name = "pipeworks:spigot_pouring", param2 = fdir}) | ||||
| 				if finitewater or belowname ~= "default:water_source" then | ||||
| 					minetest.add_node({x=pos.x,y=pos.y-1,z=pos.z},{name = "default:water_source"}) | ||||
| 				if finitewater or belowname ~= pipeworks.liquids.water.source then | ||||
| 					minetest.add_node({x=pos.x,y=pos.y-1,z=pos.z},{name = pipeworks.liquids.water.source}) | ||||
| 				end | ||||
| 			end | ||||
| 		else | ||||
| 			if spigotname == "pipeworks:spigot_pouring" then | ||||
| 				minetest.add_node({x=pos.x,y=pos.y,z=pos.z},{name = "pipeworks:spigot", param2 = fdir}) | ||||
| 				if belowname == "default:water_source" and not finitewater then | ||||
| 				if belowname == pipeworks.liquids.water.source and not finitewater then | ||||
| 					minetest.remove_node({x=pos.x,y=pos.y-1,z=pos.z}) | ||||
| 				end | ||||
| 			end | ||||
| @@ -113,20 +113,20 @@ end | ||||
|  | ||||
| pipeworks.fountainhead_check = function(pos, node) | ||||
| 	local abovename = minetest.get_node({x=pos.x,y=pos.y+1,z=pos.z}).name | ||||
| 	if abovename and (abovename == "air" or abovename == "default:water_flowing" or abovename == "default:water_source") then | ||||
| 	if abovename and (abovename == "air" or abovename == pipeworks.liquids.water.flowing or abovename == pipeworks.liquids.water.source) then | ||||
| 		local fountainhead_name = minetest.get_node(pos).name | ||||
| 		local near_node = minetest.get_node({x=pos.x,y=pos.y-1,z=pos.z}) | ||||
| 		if near_node and string.find(near_node.name, "_loaded") then | ||||
| 			if fountainhead_name and fountainhead_name == "pipeworks:fountainhead" then | ||||
| 				minetest.add_node(pos,{name = "pipeworks:fountainhead_pouring"}) | ||||
| 				if finitewater or abovename ~= "default:water_source" then | ||||
| 					minetest.add_node({x=pos.x,y=pos.y+1,z=pos.z},{name = "default:water_source"}) | ||||
| 				if finitewater or abovename ~= pipeworks.liquids.water.source then | ||||
| 					minetest.add_node({x=pos.x,y=pos.y+1,z=pos.z},{name = pipeworks.liquids.water.source}) | ||||
| 				end | ||||
| 			end | ||||
| 		else | ||||
| 			if fountainhead_name == "pipeworks:fountainhead_pouring" then | ||||
| 				minetest.add_node({x=pos.x,y=pos.y,z=pos.z},{name = "pipeworks:fountainhead"}) | ||||
| 				if abovename == "default:water_source" and not finitewater then | ||||
| 				if abovename == pipeworks.liquids.water.source and not finitewater then | ||||
| 					minetest.remove_node({x=pos.x,y=pos.y+1,z=pos.z}) | ||||
| 				end | ||||
| 			end | ||||
|   | ||||
							
								
								
									
										46
									
								
								init.lua
									
									
									
									
									
								
							
							
						
						
									
										46
									
								
								init.lua
									
									
									
									
									
								
							| @@ -11,6 +11,16 @@ pipeworks.worldpath = minetest.get_worldpath() | ||||
| pipeworks.modpath = minetest.get_modpath("pipeworks") | ||||
| local S = minetest.get_translator("pipeworks") | ||||
|  | ||||
| pipeworks.liquids = {} | ||||
| pipeworks.liquids.water = { | ||||
| 	source = minetest.registered_nodes["mapgen_water_source"].name, | ||||
| 	flowing = minetest.registered_nodes["mapgen_water_source"].liquid_alternative_flowing | ||||
| } | ||||
| pipeworks.liquids.river_water = { | ||||
| 	source = minetest.registered_nodes["mapgen_river_water_source"].name, | ||||
| 	flowing = minetest.registered_nodes["mapgen_river_water_source"].liquid_alternative_flowing | ||||
| } | ||||
|  | ||||
| dofile(pipeworks.modpath.."/default_settings.lua") | ||||
| -- Read the external config file if it exists. | ||||
| local worldsettingspath = pipeworks.worldpath.."/pipeworks_settings.txt" | ||||
| @@ -22,6 +32,9 @@ end | ||||
| if pipeworks.toggles.pipe_mode == "pressure" then | ||||
| 	minetest.log("warning", "pipeworks pressure logic mode comes with caveats and differences in behaviour, you have been warned!") | ||||
| end | ||||
| if pipeworks.entity_update_interval >= 0.2 and pipeworks.enable_accelerator_tube then | ||||
| 	minetest.log("warning", "pipeworks accelerator tubes will not entirely work with an entity update interval 0.2 or above.") | ||||
| end | ||||
|  | ||||
| -- Random variables | ||||
|  | ||||
| @@ -40,7 +53,8 @@ pipeworks.rules_all = {{x=0, y=0, z=1},{x=0, y=0, z=-1},{x=1, y=0, z=0},{x=-1, y | ||||
| pipeworks.mesecons_rules={{x=0,y=0,z=1},{x=0,y=0,z=-1},{x=1,y=0,z=0},{x=-1,y=0,z=0},{x=0,y=1,z=0},{x=0,y=-1,z=0}} | ||||
| pipeworks.digilines_rules={{x=0,y=0,z=1},{x=0,y=0,z=-1},{x=1,y=0,z=0},{x=-1,y=0,z=0},{x=0,y=1,z=0},{x=0,y=-1,z=0}} | ||||
|  | ||||
| pipeworks.liquid_texture = "default_water.png" | ||||
| pipeworks.liquid_texture = minetest.registered_nodes[pipeworks.liquids.water.flowing].tiles[1] | ||||
| if type(pipeworks.liquid_texture) == "table" then pipeworks.liquid_texture = pipeworks.liquid_texture.name end | ||||
|  | ||||
| pipeworks.button_off   = {text="", texture="pipeworks_button_off.png", addopts="false;false;pipeworks_button_interm.png"} | ||||
| pipeworks.button_on    = {text="", texture="pipeworks_button_on.png",  addopts="false;false;pipeworks_button_interm.png"} | ||||
| @@ -58,6 +72,29 @@ function pipeworks.fix_image_names(table, replacement) | ||||
| 	return outtable | ||||
| end | ||||
|  | ||||
| local function overlay_tube_texture(texture) | ||||
| 	-- The texture appears the first time to be colorized as the opaque background. | ||||
| 	return ("(%s)^[noalpha^[colorize:#dadada^(%s)"):format(texture, texture) | ||||
| end | ||||
|  | ||||
| function pipeworks.make_tube_tile(tile) | ||||
| 	if pipeworks.use_real_entities then | ||||
| 		return tile | ||||
| 	elseif type(tile) == "string" then | ||||
| 		return overlay_tube_texture(tile) | ||||
| 	else | ||||
| 		tile = table.copy(tile) | ||||
| 		if tile.color then | ||||
| 			-- Won't work 100% of the time, but good enough. | ||||
| 			tile.name = tile.name .. "^[multiply:" .. minetest.colorspec_to_colorstring(tile.color) | ||||
| 			tile.color = nil | ||||
| 		end | ||||
| 		tile.name = overlay_tube_texture(tile.name) | ||||
| 		tile.backface_culling = nil -- The texture is opaque | ||||
| 		return tile | ||||
| 	end | ||||
| end | ||||
|  | ||||
| function pipeworks.add_node_box(t, b) | ||||
| 	if not t or not b then return end | ||||
| 	for i in ipairs(b) | ||||
| @@ -113,7 +150,6 @@ dofile(pipeworks.modpath.."/autoplace_tubes.lua") | ||||
| dofile(pipeworks.modpath.."/luaentity.lua") | ||||
| dofile(pipeworks.modpath.."/item_transport.lua") | ||||
| dofile(pipeworks.modpath.."/flowing_logic.lua") | ||||
| dofile(pipeworks.modpath.."/crafts.lua") | ||||
| dofile(pipeworks.modpath.."/tube_registration.lua") | ||||
| dofile(pipeworks.modpath.."/routing_tubes.lua") | ||||
| dofile(pipeworks.modpath.."/sorting_tubes.lua") | ||||
| @@ -137,7 +173,7 @@ dofile(pipeworks.modpath..logicdir.."flowable_node_registry_install.lua") | ||||
| if pipeworks.enable_pipes then dofile(pipeworks.modpath.."/pipes.lua") end | ||||
| if pipeworks.enable_teleport_tube then dofile(pipeworks.modpath.."/teleport_tube.lua") end | ||||
| if pipeworks.enable_pipe_devices then dofile(pipeworks.modpath.."/devices.lua") end | ||||
| if pipeworks.enable_redefines then | ||||
| if pipeworks.enable_redefines and (minetest.get_modpath("default") or minetest.get_modpath("hades_core")) then | ||||
| 	dofile(pipeworks.modpath.."/compat-chests.lua") | ||||
| 	dofile(pipeworks.modpath.."/compat-furnaces.lua") | ||||
| end | ||||
| @@ -147,11 +183,13 @@ if pipeworks.enable_lua_tube and | ||||
| 	dofile(pipeworks.modpath.."/lua_tube.lua") | ||||
| end | ||||
|  | ||||
| dofile(pipeworks.modpath.."/crafts.lua") | ||||
|  | ||||
| minetest.register_alias("pipeworks:pipe", "pipeworks:pipe_110000_empty") | ||||
|  | ||||
| -- Unified Inventory categories integration | ||||
|  | ||||
| if unified_inventory and unified_inventory.registered_categories then | ||||
| if minetest.global_exists("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", | ||||
|   | ||||
| @@ -1,5 +1,5 @@ | ||||
| local luaentity = pipeworks.luaentity | ||||
| local enable_max_limit = minetest.settings:get("pipeworks_enable_items_per_tube_limit") | ||||
| local enable_max_limit = minetest.settings:get_bool("pipeworks_enable_items_per_tube_limit") | ||||
| local max_tube_limit = tonumber(minetest.settings:get("pipeworks_max_items_per_tube")) or 30 | ||||
| if enable_max_limit == nil then enable_max_limit = true end | ||||
|  | ||||
| @@ -311,8 +311,6 @@ luaentity.register_entity("pipeworks:tubed_item", { | ||||
| 			self:set_pos(pos) | ||||
| 		end | ||||
|  | ||||
| 		local stack = ItemStack(self.itemstring) | ||||
|  | ||||
| 		local velocity = self:get_velocity() | ||||
|  | ||||
| 		local moved = false | ||||
| @@ -329,9 +327,15 @@ luaentity.register_entity("pipeworks:tubed_item", { | ||||
| 			moved = true | ||||
| 		end | ||||
|  | ||||
| 		if not moved then | ||||
| 			return | ||||
| 		end | ||||
|  | ||||
| 		local stack = ItemStack(self.itemstring) | ||||
|  | ||||
| 		pipeworks.load_position(self.start_pos) | ||||
| 		local node = minetest.get_node(self.start_pos) | ||||
| 		if moved and minetest.get_item_group(node.name, "tubedevice_receiver") == 1 then | ||||
| 		if minetest.get_item_group(node.name, "tubedevice_receiver") == 1 then | ||||
| 			local leftover | ||||
| 			if minetest.registered_nodes[node.name].tube and minetest.registered_nodes[node.name].tube.insert_object then | ||||
| 				leftover = minetest.registered_nodes[node.name].tube.insert_object(self.start_pos, node, stack, vel, self.owner) | ||||
| @@ -349,7 +353,6 @@ luaentity.register_entity("pipeworks:tubed_item", { | ||||
| 			return | ||||
| 		end | ||||
|  | ||||
| 		if moved then | ||||
| 		local found_next, new_velocity, multimode = go_next(self.start_pos, velocity, stack, self.owner) -- todo: color | ||||
| 		local rev_vel = vector.multiply(velocity, -1) | ||||
| 		local rev_dir = vector.direction(self.start_pos,vector.add(self.start_pos,rev_vel)) | ||||
| @@ -389,7 +392,6 @@ luaentity.register_entity("pipeworks:tubed_item", { | ||||
| 			self:set_velocity(new_velocity) | ||||
| 		end | ||||
| 	end | ||||
| 	end | ||||
| }) | ||||
|  | ||||
| if minetest.get_modpath("mesecons_mvps") then | ||||
|   | ||||
| @@ -27,7 +27,9 @@ if not minetest.get_modpath("auto_tree_tap") and | ||||
| 		is_ground_content = true, | ||||
| 		paramtype2 = "facedir", | ||||
| 		groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2, mesecon = 2,tubedevice=1, not_in_creative_inventory=1 }, | ||||
| 		sounds = default.node_sound_stone_defaults(), | ||||
| 		_sound_def = { | ||||
| 			key = "node_sound_stone_defaults", | ||||
| 		}, | ||||
| 		tube = {connect_sides={back=1}}, | ||||
| 		on_construct = function(pos) | ||||
| 			local meta = minetest.get_meta(pos) | ||||
|   | ||||
							
								
								
									
										13
									
								
								lua_tube.lua
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								lua_tube.lua
									
									
									
									
									
								
							| @@ -666,6 +666,7 @@ local function reset_formspec(meta, code, errmsg) | ||||
| 	code = minetest.formspec_escape(code or "") | ||||
| 	errmsg = minetest.formspec_escape(tostring(errmsg or "")) | ||||
| 	meta:set_string("formspec", "size[12,10]" | ||||
| 		.."style_type[label,textarea;font=mono]" | ||||
| 		.."background[-0.2,-0.25;12.4,10.75;jeija_luac_background.png]" | ||||
| 		.."label[0.1,8.3;"..errmsg.."]" | ||||
| 		.."textarea[0.2,0.2;12.2,9.5;code;;"..code.."]" | ||||
| @@ -864,7 +865,7 @@ for white  = 0, 1 do | ||||
| 	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} | ||||
| 	local groups = {snappy = 3, tube = 1, tubedevice = 1, overheat = 1, dig_generic = 4} | ||||
| 	if red + blue + yellow + green + black + white ~= 0 then | ||||
| 		groups.not_in_creative_inventory = 1 | ||||
| 	end | ||||
| @@ -917,7 +918,9 @@ for white  = 0, 1 do | ||||
| 		node_box = node_box, | ||||
| 		on_construct = reset_meta, | ||||
| 		on_receive_fields = on_receive_fields, | ||||
| 		sounds = default.node_sound_wood_defaults(), | ||||
| 		_sound_def = { | ||||
| 			key = "node_sound_wood_defaults", | ||||
| 		}, | ||||
| 		mesecons = mesecons, | ||||
| 		digiline = digiline, | ||||
| 		-- Virtual portstates are the ports that | ||||
| @@ -1020,14 +1023,16 @@ minetest.register_node(BASENAME .. "_burnt", { | ||||
| 	is_burnt = true, | ||||
| 	paramtype = "light", | ||||
| 	is_ground_content = false, | ||||
| 	groups = {snappy = 3, tube = 1, tubedevice = 1, not_in_creative_inventory=1}, | ||||
| 	groups = {snappy = 3, tube = 1, tubedevice = 1, not_in_creative_inventory=1, dig_generic = 4}, | ||||
| 	drop = BASENAME.."000000", | ||||
| 	sunlight_propagates = true, | ||||
| 	selection_box = selection_box, | ||||
| 	node_box = node_box, | ||||
| 	on_construct = reset_meta, | ||||
| 	on_receive_fields = on_receive_fields, | ||||
| 	sounds = default.node_sound_wood_defaults(), | ||||
| 	_sound_def = { | ||||
|         key = "node_sound_wood_defaults", | ||||
|     }, | ||||
| 	virtual_portstates = {red = false, blue = false, yellow = false, | ||||
| 		green = false, black = false, white = false}, | ||||
| 	mesecons = { | ||||
|   | ||||
| @@ -73,9 +73,13 @@ local function get_blockpos(pos) | ||||
| 	        z = math.floor(pos.z / 16)} | ||||
| end | ||||
|  | ||||
| local move_entities_globalstep_part1 | ||||
| local is_active | ||||
|  | ||||
| if pipeworks.use_real_entities then | ||||
| 	local active_blocks = {} -- These only contain active blocks near players (i.e., not forceloaded ones) | ||||
|  | ||||
| local move_entities_globalstep_part1 = function(dtime) | ||||
| 	move_entities_globalstep_part1 = function(dtime) | ||||
| 		local active_block_range = tonumber(minetest.settings:get("active_block_range")) or 2 | ||||
| 		local new_active_blocks = {} | ||||
| 		for _, player in ipairs(minetest.get_connected_players()) do | ||||
| @@ -96,9 +100,17 @@ local move_entities_globalstep_part1 = function(dtime) | ||||
| 		-- todo: callbacks on block load/unload | ||||
| 	end | ||||
|  | ||||
| local function is_active(pos) | ||||
| 	is_active = function(pos) | ||||
| 		return active_blocks[minetest.hash_node_position(get_blockpos(pos))] ~= nil | ||||
| 	end | ||||
| else | ||||
| 	move_entities_globalstep_part1 = function() | ||||
| 	end | ||||
|  | ||||
| 	is_active = function() | ||||
| 		return false | ||||
| 	end | ||||
| end | ||||
|  | ||||
| local entitydef_default = { | ||||
| 	_attach = function(self, attached, attach_to) | ||||
| @@ -370,13 +382,36 @@ local move_entities_globalstep_part2 = function(dtime) | ||||
| 	end | ||||
| end | ||||
|  | ||||
| local handle_active_blocks_timer = 0.1 | ||||
| -- dtime after which there is an update (or skip). | ||||
| local dtime_threshold = pipeworks.entity_update_interval | ||||
| -- Accumulated dtime since last update (or skip). | ||||
| local dtime_accum = 0 | ||||
| -- Delayed dtime accumulated due to skipped updates. | ||||
| local dtime_delayed = 0 | ||||
| local skip_update = false | ||||
|  | ||||
| minetest.register_globalstep(function(dtime) | ||||
| 	handle_active_blocks_timer = handle_active_blocks_timer + dtime | ||||
| 	if dtime < 0.2 or handle_active_blocks_timer >= (dtime * 3) then | ||||
| 		handle_active_blocks_timer = 0.1 | ||||
| 		move_entities_globalstep_part1(dtime) | ||||
| 		move_entities_globalstep_part2(dtime) | ||||
| 	if dtime >= 0.2 and dtime_delayed < 1 then | ||||
| 		-- Reduce activity when the server is lagging. | ||||
| 		skip_update = true | ||||
| 	end | ||||
|  | ||||
| 	dtime_accum = dtime_accum + dtime | ||||
| 	if dtime_accum < dtime_threshold then | ||||
| 		return | ||||
| 	end | ||||
|  | ||||
| 	if skip_update then | ||||
| 		dtime_delayed = dtime_delayed + dtime_accum | ||||
| 		skip_update = false | ||||
| 	else | ||||
| 		move_entities_globalstep_part1(dtime_accum + dtime_delayed) | ||||
| 		move_entities_globalstep_part2(dtime_accum + dtime_delayed) | ||||
| 		dtime_delayed = 0 | ||||
| 	end | ||||
|  | ||||
| 	-- Tune the threshold so that the average interval is pipeworks.entity_update_interval. | ||||
| 	dtime_threshold = math.max(dtime_threshold + (pipeworks.entity_update_interval - dtime_accum) / 10, 0) | ||||
|  | ||||
| 	dtime_accum = 0 | ||||
| end) | ||||
|   | ||||
							
								
								
									
										4
									
								
								mod.conf
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								mod.conf
									
									
									
									
									
								
							| @@ -1,5 +1,5 @@ | ||||
| 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. | ||||
| depends = default, basic_materials, screwdriver | ||||
| optional_depends = mesecons, mesecons_mvps, digilines, signs_lib, unified_inventory | ||||
| depends = basic_materials | ||||
| optional_depends = mesecons, mesecons_mvps, digilines, signs_lib, unified_inventory, default, screwdriver, fl_mapgen, sound_api, i3, hades_core, hades_furnaces, hades_chests | ||||
| min_minetest_version = 5.2.0 | ||||
|   | ||||
							
								
								
									
										14
									
								
								pipes.lua
									
									
									
									
									
								
							
							
						
						
									
										14
									
								
								pipes.lua
									
									
									
									
									
								
							| @@ -37,11 +37,11 @@ for index, connects in ipairs(cconnects) do | ||||
| 	end | ||||
| 	--]] | ||||
|  | ||||
| 	local pgroups = {snappy = 3, pipe = 1, not_in_creative_inventory = 1} | ||||
| 	local pgroups = {snappy = 3, pipe = 1, not_in_creative_inventory = 1, dig_generic = 4} | ||||
| 	local pipedesc = S("Pipe Segment").." "..dump(connects) | ||||
|  | ||||
| 	if #connects == 0 then | ||||
| 		pgroups = {snappy = 3, tube = 1} | ||||
| 		pgroups = {snappy = 3, tube = 1, dig_generic = 4} | ||||
| 		pipedesc = S("Pipe Segment") | ||||
| 	end | ||||
|  | ||||
| @@ -76,7 +76,9 @@ for index, connects in ipairs(cconnects) do | ||||
| 			fixed = outsel | ||||
| 		}, | ||||
| 		groups = pgroups, | ||||
| 		sounds = default.node_sound_metal_defaults(), | ||||
| 		_sound_def = { | ||||
| 			key = "node_sound_metal_defaults", | ||||
| 		}, | ||||
| 		walkable = true, | ||||
| 		drop = "pipeworks:pipe_1_empty", | ||||
| 		after_place_node = function(pos) | ||||
| @@ -91,7 +93,7 @@ for index, connects in ipairs(cconnects) do | ||||
| 		pipenumber = index | ||||
| 	}) | ||||
|  | ||||
| 	local pgroups = {snappy = 3, pipe = 1, not_in_creative_inventory = 1} | ||||
| 	local pgroups = {snappy = 3, pipe = 1, not_in_creative_inventory = 1, dig_generic = 4} | ||||
|  | ||||
| 	minetest.register_node("pipeworks:pipe_"..index.."_loaded", { | ||||
| 		description = pipedesc, | ||||
| @@ -110,7 +112,9 @@ for index, connects in ipairs(cconnects) do | ||||
| 			fixed = outsel | ||||
| 		}, | ||||
| 		groups = pgroups, | ||||
| 		sounds = default.node_sound_metal_defaults(), | ||||
| 		_sound_def = { | ||||
| 			key = "node_sound_metal_defaults", | ||||
| 		}, | ||||
| 		walkable = true, | ||||
| 		drop = "pipeworks:pipe_1_empty", | ||||
| 		after_place_node = function(pos) | ||||
|   | ||||
| @@ -42,7 +42,7 @@ local check_for_liquids_v2 = function(pos, limit) | ||||
| 	for _, tpos in ipairs(coords) do | ||||
| 		if total >= limit then break end | ||||
| 		local name = minetest.get_node(tpos).name | ||||
| 		if name == "default:water_source" then | ||||
| 		if name == pipeworks.liquids.water.source then | ||||
| 			minetest.remove_node(tpos) | ||||
| 			total = total + 1 | ||||
| 		end | ||||
| @@ -247,9 +247,9 @@ flowlogic.helpers.make_neighbour_output_fixed = function(neighbours) | ||||
| 			-- in non-finite mode, pressure has to be sustained to keep the sources there. | ||||
| 			-- so in non-finite mode, placing water is dependent on the target node; | ||||
| 			-- draining pressure is not. | ||||
| 			local canplace = (name == "air") or (name == "default:water_flowing") | ||||
| 			local canplace = (name == "air") or (name == pipeworks.liquids.water.flowing) | ||||
| 			if canplace then | ||||
| 				minetest.swap_node(npos, {name="default:water_source"}) | ||||
| 				minetest.swap_node(npos, {name=pipeworks.liquids.water.source}) | ||||
| 			end | ||||
| 			if (not finitemode) or canplace then | ||||
| 				taken = taken + 1 | ||||
| @@ -268,7 +268,7 @@ flowlogic.helpers.make_neighbour_cleanup_fixed = function(neighbours) | ||||
| 		for _, offset in pairs(neighbours) do | ||||
| 			local npos = vector.add(pos, offset) | ||||
| 			local name = minetest.get_node(npos).name | ||||
| 			if (name == "default:water_source") then | ||||
| 			if (name == pipeworks.liquids.water.source) then | ||||
| 				--pipeworks.logger("neighbour_cleanup_fixed removing "..formatvec(npos)) | ||||
| 				minetest.remove_node(npos) | ||||
| 			end | ||||
|   | ||||
| @@ -83,10 +83,21 @@ pipeworks.register_tube("pipeworks:broken_tube", { | ||||
| 				end | ||||
| 				return | ||||
| 			end | ||||
| 			pipeworks.logger(log_msg.."            with "..wieldname.." to repair it.") | ||||
| 			log_msg = log_msg.."with "..wieldname.." to repair it" | ||||
| 			local nodedef = minetest.registered_nodes[was_node.name] | ||||
| 			if nodedef then | ||||
| 				pipeworks.logger(log_msg..".") | ||||
| 				if nodedef.tube and nodedef.tube.on_repair then | ||||
| 					nodedef.tube.on_repair(pos, was_node) | ||||
| 				else | ||||
| 					minetest.swap_node(pos, { name = was_node.name, param2 = was_node.param2 }) | ||||
| 					pipeworks.scan_for_tube_objects(pos) | ||||
| 				end | ||||
| 			else | ||||
| 				pipeworks.logger(log_msg.." but original node "..was_node.name.." is not registered anymore.") | ||||
| 				minetest.chat_send_player(playername, S("This tube cannot be repaired.")) | ||||
| 			end | ||||
| 		end | ||||
| 	} | ||||
| }) | ||||
|  | ||||
| @@ -106,14 +117,6 @@ if pipeworks.enable_priority_tube then | ||||
| 				tube = { priority = 150 } -- higher than tubedevices (100) | ||||
| 			}, | ||||
| 	}) | ||||
| 	minetest.register_craft( { | ||||
| 		output = "pipeworks:priority_tube_1 6", | ||||
| 		recipe = { | ||||
| 			{ "basic_materials:plastic_sheet", "basic_materials:plastic_sheet", "basic_materials:plastic_sheet" }, | ||||
| 			{ "default:gold_ingot", "", "default:gold_ingot" }, | ||||
| 			{ "basic_materials:plastic_sheet", "basic_materials:plastic_sheet", "basic_materials:plastic_sheet" } | ||||
| 		}, | ||||
| 	}) | ||||
| end | ||||
|  | ||||
| if pipeworks.enable_accelerator_tube then | ||||
| @@ -131,14 +134,6 @@ if pipeworks.enable_accelerator_tube then | ||||
| 					end} | ||||
| 			}, | ||||
| 	}) | ||||
| 	minetest.register_craft( { | ||||
| 		output = "pipeworks:accelerator_tube_1 2", | ||||
| 		recipe = { | ||||
| 			{ "basic_materials:plastic_sheet", "basic_materials:plastic_sheet", "basic_materials:plastic_sheet" }, | ||||
| 			{ "default:mese_crystal_fragment", "default:steel_ingot", "default:mese_crystal_fragment" }, | ||||
| 			{ "basic_materials:plastic_sheet", "basic_materials:plastic_sheet", "basic_materials:plastic_sheet" } | ||||
| 		}, | ||||
| 	}) | ||||
| end | ||||
|  | ||||
| if pipeworks.enable_crossing_tube then | ||||
| @@ -153,28 +148,30 @@ if pipeworks.enable_crossing_tube then | ||||
| 				tube = {can_go = function(pos, node, velocity, stack) return {velocity} end } | ||||
| 			}, | ||||
| 	}) | ||||
| 	minetest.register_craft( { | ||||
| 		output = "pipeworks:crossing_tube_1 5", | ||||
| 		recipe = { | ||||
| 			{ "", "pipeworks:tube_1", "" }, | ||||
| 			{ "pipeworks:tube_1", "pipeworks:tube_1", "pipeworks:tube_1" }, | ||||
| 			{ "", "pipeworks:tube_1", "" } | ||||
| 		}, | ||||
| 	}) | ||||
| end | ||||
|  | ||||
| local texture_alpha_mode = minetest.features.use_texture_alpha_string_modes | ||||
| 	and "clip" or true | ||||
|  | ||||
| if pipeworks.enable_one_way_tube then | ||||
| 	local tiles = {"pipeworks_one_way_tube_top.png", "pipeworks_one_way_tube_top.png", "pipeworks_one_way_tube_output.png", | ||||
| 		"pipeworks_one_way_tube_input.png", "pipeworks_one_way_tube_side.png", "pipeworks_one_way_tube_top.png"} | ||||
| 	for i, tile in ipairs(tiles) do | ||||
| 		tiles[i] = pipeworks.make_tube_tile(tile) | ||||
| 	end | ||||
| 	minetest.register_node("pipeworks:one_way_tube", { | ||||
| 		description = S("One way tube"), | ||||
| 		tiles = {"pipeworks_one_way_tube_top.png", "pipeworks_one_way_tube_top.png", "pipeworks_one_way_tube_output.png", | ||||
| 			"pipeworks_one_way_tube_input.png", "pipeworks_one_way_tube_side.png", "pipeworks_one_way_tube_top.png"}, | ||||
| 		tiles = tiles, | ||||
| 		use_texture_alpha = texture_alpha_mode, | ||||
| 		paramtype2 = "facedir", | ||||
| 		drawtype = "nodebox", | ||||
| 		paramtype = "light", | ||||
| 		node_box = {type = "fixed", | ||||
| 			fixed = {{-1/2, -9/64, -9/64, 1/2, 9/64, 9/64}}}, | ||||
| 		groups = {snappy = 2, choppy = 2, oddly_breakable_by_hand = 2, tubedevice = 1}, | ||||
| 		sounds = default.node_sound_wood_defaults(), | ||||
| 		_sound_def = { | ||||
| 			key = "node_sound_wood_defaults", | ||||
| 		}, | ||||
| 		tube = { | ||||
| 			connect_sides = {left = 1, right = 1}, | ||||
| 			can_go = function(pos, node, velocity, stack) | ||||
| @@ -193,12 +190,4 @@ if pipeworks.enable_one_way_tube then | ||||
| 		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({ | ||||
| 		output = "pipeworks:one_way_tube 2", | ||||
| 		recipe = { | ||||
| 			{ "basic_materials:plastic_sheet", "basic_materials:plastic_sheet", "basic_materials:plastic_sheet" }, | ||||
| 			{ "group:stick", "default:mese_crystal", "basic_materials:plastic_sheet" }, | ||||
| 			{ "basic_materials:plastic_sheet", "basic_materials:plastic_sheet", "basic_materials:plastic_sheet" } | ||||
| 		}, | ||||
| 	}) | ||||
| end | ||||
|   | ||||
| @@ -75,3 +75,12 @@ pipeworks_drop_on_routing_fail (Drop On Routing Fail) bool false | ||||
|  | ||||
| #Delete item on clearobject. | ||||
| pipeworks_delete_item_on_clearobject (Delete Item On Clearobject) bool true | ||||
|  | ||||
| #Use real visible entities in tubes within active areas. | ||||
| #When disabled, tubes are made opaque. | ||||
| pipeworks_use_real_entities (Use Real Entities) bool true | ||||
|  | ||||
| #Target interval between tube entity steps. | ||||
| #A high value may cause issues with tube entity visuals. | ||||
| #A value 0.2 or above may cause issues with accelerator tubes. | ||||
| pipeworks_entity_update_interval (Entity Update Interval) float 0 0 0.8 | ||||
|   | ||||
| @@ -11,7 +11,7 @@ local function after_break(pos) | ||||
| 	end | ||||
| end | ||||
|  | ||||
| if pipeworks.enable_detector_tube then | ||||
| if minetest.get_modpath("mesecons") and pipeworks.enable_detector_tube then | ||||
| 	local detector_tube_step = 5 * tonumber(minetest.settings:get("dedicated_server_step")) | ||||
| 	pipeworks.register_tube("pipeworks:detector_tube_on", { | ||||
| 			description = S("Detecting Pneumatic Tube Segment on"), | ||||
| @@ -137,7 +137,7 @@ if digiline_enabled and pipeworks.enable_digiline_detector_tube then | ||||
| 	}) | ||||
| end | ||||
|  | ||||
| if pipeworks.enable_conductor_tube then | ||||
| if minetest.get_modpath("mesecons") and pipeworks.enable_conductor_tube then | ||||
| 	pipeworks.register_tube("pipeworks:conductor_tube_off", { | ||||
| 			description = S("Conducting Pneumatic Tube Segment"), | ||||
| 			inventory_image = "pipeworks_conductor_tube_inv.png", | ||||
|   | ||||
| @@ -16,29 +16,43 @@ if pipeworks.enable_mese_tube then | ||||
| 		local buttons_formspec = "" | ||||
| 		for i = 0, 5 do | ||||
| 			buttons_formspec = buttons_formspec .. fs_helpers.cycling_button(meta, | ||||
| 				"image_button[7,"..(i+0.2)..";1,0.6", "l"..(i+1).."s", | ||||
| 				"image_button[9,"..(i+(i*0.25)+0.5)..";1,0.6", "l"..(i+1).."s", | ||||
| 				{ | ||||
| 					pipeworks.button_off, | ||||
| 					pipeworks.button_on | ||||
| 				} | ||||
| 			) | ||||
| 		end | ||||
| 		local list_backgrounds = "" | ||||
| 		if minetest.get_modpath("i3") then | ||||
| 			list_backgrounds = "style_type[box;colors=#666]" | ||||
| 			for i=0, 5 do | ||||
| 				for j=0, 5 do | ||||
| 					list_backgrounds = list_backgrounds .. "box[".. 1.5+(i*1.25) ..",".. 0.25+(j*1.25) ..";1,1;]" | ||||
| 				end | ||||
| 			end | ||||
| 		end | ||||
| 		local size = "10.2,13" | ||||
| 		meta:set_string("formspec", | ||||
| 			"size[8,11]".. | ||||
| 			"list[context;line1;1,0;6,1;]".. | ||||
| 			"list[context;line2;1,1;6,1;]".. | ||||
| 			"list[context;line3;1,2;6,1;]".. | ||||
| 			"list[context;line4;1,3;6,1;]".. | ||||
| 			"list[context;line5;1,4;6,1;]".. | ||||
| 			"list[context;line6;1,5;6,1;]".. | ||||
| 			"image[0,0;1,1;pipeworks_white.png]".. | ||||
| 			"image[0,1;1,1;pipeworks_black.png]".. | ||||
| 			"image[0,2;1,1;pipeworks_green.png]".. | ||||
| 			"image[0,3;1,1;pipeworks_yellow.png]".. | ||||
| 			"image[0,4;1,1;pipeworks_blue.png]".. | ||||
| 			"image[0,5;1,1;pipeworks_red.png]".. | ||||
| 			"formspec_version[2]".. | ||||
| 			"size["..size.."]".. | ||||
| 			pipeworks.fs_helpers.get_prepends(size).. | ||||
| 			"list[context;line1;1.5,0.25;6,1;]".. | ||||
| 			"list[context;line2;1.5,1.50;6,1;]".. | ||||
| 			"list[context;line3;1.5,2.75;6,1;]".. | ||||
| 			"list[context;line4;1.5,4.00;6,1;]".. | ||||
| 			"list[context;line5;1.5,5.25;6,1;]".. | ||||
| 			"list[context;line6;1.5,6.50;6,1;]".. | ||||
| 			list_backgrounds.. | ||||
| 			"image[0.22,0.25;1,1;pipeworks_white.png]".. | ||||
| 			"image[0.22,1.50;1,1;pipeworks_black.png]".. | ||||
| 			"image[0.22,2.75;1,1;pipeworks_green.png]".. | ||||
| 			"image[0.22,4.00;1,1;pipeworks_yellow.png]".. | ||||
| 			"image[0.22,5.25;1,1;pipeworks_blue.png]".. | ||||
| 			"image[0.22,6.50;1,1;pipeworks_red.png]".. | ||||
| 			buttons_formspec.. | ||||
| 			"list[current_player;main;0,7;8,4;]" .. | ||||
| 			--"list[current_player;main;0,8;8,4;]" .. | ||||
| 			pipeworks.fs_helpers.get_inv(8).. | ||||
| 			"listring[current_player;main]" .. | ||||
| 			"listring[current_player;main]" .. | ||||
| 			"listring[context;line1]" .. | ||||
| @@ -110,9 +124,22 @@ if pipeworks.enable_mese_tube then | ||||
| 					update_formspec(pos) | ||||
| 					meta:set_string("infotext", S("Sorting pneumatic tube")) | ||||
| 				end, | ||||
| 				after_place_node = function(pos, placer, itemstack, pointed_thing) | ||||
| 					if placer and placer:is_player() and placer:get_player_control().aux1 then | ||||
| 						local meta = minetest.get_meta(pos) | ||||
| 						for i = 1, 6 do | ||||
| 							meta:set_int("l"..tostring(i).."s", 0) | ||||
| 						end | ||||
| 						update_formspec(pos) | ||||
| 					end | ||||
| 					return pipeworks.after_place(pos, placer, itemstack, pointed_thing) | ||||
| 				end, | ||||
| 				on_punch = update_formspec, | ||||
| 				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) | ||||
| 					update_formspec(pos) | ||||
| 				end, | ||||
| @@ -150,25 +177,4 @@ if pipeworks.enable_mese_tube then | ||||
| 				end, | ||||
| 			}, | ||||
| 	}) | ||||
|  | ||||
| 	minetest.register_craft( { | ||||
| 		output = "pipeworks:mese_tube_000000 2", | ||||
| 		recipe = { | ||||
| 			{ "basic_materials:plastic_sheet", "basic_materials:plastic_sheet", "basic_materials:plastic_sheet" }, | ||||
| 			{ "", "default:mese_crystal", "" }, | ||||
| 			{ "basic_materials:plastic_sheet", "basic_materials:plastic_sheet", "basic_materials:plastic_sheet" } | ||||
| 		}, | ||||
| 	}) | ||||
|  | ||||
| 	minetest.register_craft( { | ||||
| 		type = "shapeless", | ||||
| 		output = "pipeworks:mese_tube_000000", | ||||
| 		recipe = { | ||||
| 			"pipeworks:tube_1", | ||||
| 			"default:mese_crystal_fragment", | ||||
| 			"default:mese_crystal_fragment", | ||||
| 			"default:mese_crystal_fragment", | ||||
| 			"default:mese_crystal_fragment" | ||||
| 		}, | ||||
| 	}) | ||||
| end | ||||
|   | ||||
| @@ -4,6 +4,9 @@ local filename=minetest.get_worldpath() .. "/teleport_tubes" | ||||
| local tp_tube_db = nil -- nil forces a read | ||||
| local tp_tube_db_version = 2.0 | ||||
|  | ||||
| -- cached rceiver list: hash(pos) => {receivers} | ||||
| local cache = {} | ||||
|  | ||||
| local function hash(pos) | ||||
| 	return string.format("%.30g", minetest.hash_node_position(pos)) | ||||
| end | ||||
| @@ -18,6 +21,8 @@ local function save_tube_db() | ||||
| 	else | ||||
| 		error(err) | ||||
| 	end | ||||
| 	-- reset tp-tube cache | ||||
| 	cache = {} | ||||
| end | ||||
|  | ||||
| local function migrate_tube_db() | ||||
| @@ -101,6 +106,12 @@ local function read_node_with_vm(pos) | ||||
| end | ||||
|  | ||||
| local function get_receivers(pos, channel) | ||||
| 	local hash = minetest.hash_node_position(pos) | ||||
| 	if cache[hash] then | ||||
| 		-- re-use cached result | ||||
| 		return cache[hash] | ||||
| 	end | ||||
|  | ||||
| 	local tubes = tp_tube_db or read_tube_db() | ||||
| 	local receivers = {} | ||||
| 	local dirty = false | ||||
| @@ -121,6 +132,8 @@ local function get_receivers(pos, channel) | ||||
| 	if dirty then | ||||
| 		save_tube_db() | ||||
| 	end | ||||
| 	-- cache the result for next time | ||||
| 	cache[hash] = receivers | ||||
| 	return receivers | ||||
| end | ||||
|  | ||||
| @@ -130,19 +143,19 @@ local function update_meta(meta, can_receive) | ||||
| 	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") | ||||
|  | ||||
| 	local size = "8.5,4" | ||||
| 	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) | ||||
| 		"formspec_version[2]".. | ||||
| 		"size["..size.."]".. | ||||
| 		pipeworks.fs_helpers.get_prepends(size) .. | ||||
| 		"image[0.5,o;1,1;pipeworks_teleport_tube_inv.png]".. | ||||
| 		"label[1.5,0.5;"..S("Teleporting Tube").."]".. | ||||
| 		"field[0.5,1.6;4.3,0.75;channel;"..S("Channel")..";${channel}]".. | ||||
| 		"button[4.8,1.6;1.5,0.75;set_channel;"..S("Set").."]".. | ||||
| 		"label[7.0,0.5;"..S("Receive").."]".. | ||||
| 		"image_button[7.0,0.75;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.6;2,0.75;close;"..S("Close").."]".. | ||||
| 		"label[0.5,2.7;"..itext.."]") | ||||
| end | ||||
|  | ||||
| pipeworks.register_tube("pipeworks:teleport_tube", { | ||||
| @@ -171,6 +184,18 @@ pipeworks.register_tube("pipeworks:teleport_tube", { | ||||
| 				pos.y = target[d].y | ||||
| 				pos.z = target[d].z | ||||
| 				return pipeworks.meseadjlist | ||||
| 			end, | ||||
| 			on_repair = function(pos, node) | ||||
| 				local meta = minetest.get_meta(pos) | ||||
| 				local channel = meta:get_string("channel") | ||||
| 				minetest.swap_node(pos, { name = node.name, param2 = node.param2 }) | ||||
| 				pipeworks.scan_for_tube_objects(pos) | ||||
| 				if channel ~= "" then | ||||
| 					local can_receive = meta:get_int("can_receive") | ||||
| 					set_tube(pos, channel, can_receive) | ||||
| 					local cr_description = (can_receive == 1) and "sending and receiving" or "sending" | ||||
| 					meta:set_string("infotext", S("Teleportation Tube @1 on '@2'", cr_description, channel)) | ||||
| 				end | ||||
| 			end | ||||
| 		}, | ||||
| 		on_construct = function(pos) | ||||
| @@ -249,14 +274,6 @@ pipeworks.register_tube("pipeworks:teleport_tube", { | ||||
| 		end | ||||
| 	}, | ||||
| }) | ||||
| minetest.register_craft( { | ||||
| 	output = "pipeworks:teleport_tube_1 2", | ||||
| 	recipe = { | ||||
| 	        { "basic_materials:plastic_sheet", "basic_materials:plastic_sheet", "basic_materials:plastic_sheet" }, | ||||
| 	        { "default:desert_stone", "default:mese", "default:desert_stone" }, | ||||
| 	        { "basic_materials:plastic_sheet", "basic_materials:plastic_sheet", "basic_materials:plastic_sheet" } | ||||
| 	}, | ||||
| }) | ||||
|  | ||||
| if minetest.get_modpath("mesecons_mvps") ~= nil then | ||||
| 	mesecon.register_on_mvps_move(function(moved_nodes) | ||||
| @@ -274,5 +291,7 @@ pipeworks.tptube = { | ||||
| 	hash = hash, | ||||
| 	save_tube_db = save_tube_db, | ||||
| 	get_db = function() return tp_tube_db or read_tube_db() end, | ||||
| 	set_tube = set_tube, | ||||
| 	update_meta = update_meta, | ||||
| 	tp_tube_db_version = tp_tube_db_version | ||||
| } | ||||
|   | ||||
							
								
								
									
										38
									
								
								trashcan.lua
									
									
									
									
									
								
							
							
						
						
									
										38
									
								
								trashcan.lua
									
									
									
									
									
								
							| @@ -10,7 +10,7 @@ minetest.register_node("pipeworks:trashcan", { | ||||
| 		"pipeworks_trashcan_side.png", | ||||
| 		"pipeworks_trashcan_side.png", | ||||
| 	}, | ||||
| 	groups = {snappy = 3, tubedevice = 1, tubedevice_receiver = 1}, | ||||
| 	groups = {snappy = 3, tubedevice = 1, tubedevice_receiver = 1, dig_generic = 4}, | ||||
| 	tube = { | ||||
| 		insert_object = function(pos, node, stack, direction) | ||||
| 			return ItemStack("") | ||||
| @@ -20,17 +20,24 @@ minetest.register_node("pipeworks:trashcan", { | ||||
| 	}, | ||||
| 	on_construct = function(pos) | ||||
| 		local meta = minetest.get_meta(pos) | ||||
| 		local size = "10.2,9" | ||||
| 		local list_background = "" | ||||
| 		if minetest.get_modpath("i3") then | ||||
| 			list_background = "style_type[box;colors=#666]box[4.5,2;1,1;]" | ||||
| 		end | ||||
| 		meta:set_string("formspec", | ||||
| 				"size[8,7]".. | ||||
| 				"item_image[0,0;1,1;pipeworks:trashcan]".. | ||||
| 				"label[1,0;"..S("Trash Can").."]".. | ||||
| 				"list[context;trash;3.5,1;1,1;]".. | ||||
| 				default.gui_bg.. | ||||
| 				default.gui_bg_img.. | ||||
| 				default.gui_slots.. | ||||
| 				default.get_hotbar_bg(0,3) .. | ||||
| 				"list[current_player;main;0,3;8,4;]" .. | ||||
| 				"listring[]") | ||||
| 			"formspec_version[2]" .. | ||||
| 			"size["..size.."]".. | ||||
| 			pipeworks.fs_helpers.get_prepends(size) .. | ||||
| 			"item_image[0.5,0.5;1,1;pipeworks:trashcan]".. | ||||
| 			"label[1.5,1;"..S("Trash Can").."]".. | ||||
| 			list_background.. | ||||
| 			"list[context;trash;4.5,2;1,1;]".. | ||||
| 			--"list[current_player;main;0,3;8,4;]" .. | ||||
| 			pipeworks.fs_helpers.get_inv(4).. | ||||
| 			"listring[context;trash]".. | ||||
| 			"listring[current_player;main]" | ||||
| 		) | ||||
| 		meta:set_string("infotext", S("Trash Can")) | ||||
| 		meta:get_inventory():set_size("trash", 1) | ||||
| 	end, | ||||
| @@ -41,12 +48,3 @@ minetest.register_node("pipeworks:trashcan", { | ||||
| 	end, | ||||
| }) | ||||
| pipeworks.ui_cat_tube_list[#pipeworks.ui_cat_tube_list+1] = "pipeworks:trashcan" | ||||
|  | ||||
| minetest.register_craft({ | ||||
| 	output = "pipeworks:trashcan", | ||||
| 	recipe = { | ||||
| 		{ "basic_materials:plastic_sheet", "basic_materials:plastic_sheet", "basic_materials:plastic_sheet" }, | ||||
| 		{ "default:steel_ingot", "", "default:steel_ingot" }, | ||||
| 		{ "default:steel_ingot", "default:steel_ingot", "default:steel_ingot" }, | ||||
| 	}, | ||||
| }) | ||||
|   | ||||
| @@ -61,13 +61,13 @@ local register_one_tube = function(name, tname, dropname, desc, plain, noctrs, e | ||||
| 		outimgs[vti[v]] = ends[v] | ||||
| 	end | ||||
|  | ||||
| 	local tgroups = {snappy = 3, tube = 1, tubedevice = 1, not_in_creative_inventory = 1} | ||||
| 	local tgroups = {snappy = 3, tube = 1, tubedevice = 1, not_in_creative_inventory = 1, dig_generic = 4} | ||||
| 	local tubedesc = string.format("%s %s", desc, dump(connects)) | ||||
| 	local iimg = type(plain[1]) == "table" and plain[1].name or plain[1] | ||||
| 	local wscale = {x = 1, y = 1, z = 1} | ||||
|  | ||||
| 	if #connects == 0 then | ||||
| 		tgroups = {snappy = 3, tube = 1, tubedevice = 1} | ||||
| 		tgroups = {snappy = 3, tube = 1, tubedevice = 1, dig_generic = 4} | ||||
| 		tubedesc = desc | ||||
| 		iimg=inv | ||||
| 		outimgs = { | ||||
| @@ -80,6 +80,10 @@ local register_one_tube = function(name, tname, dropname, desc, plain, noctrs, e | ||||
| 		wscale = {x = 1, y = 1, z = 0.01} | ||||
| 	end | ||||
|  | ||||
| 	for i, tile in ipairs(outimgs) do | ||||
| 		outimgs[i] = pipeworks.make_tube_tile(tile) | ||||
| 	end | ||||
|  | ||||
| 	local rname = string.format("%s_%s", name, tname) | ||||
| 	table.insert(tubenodes, rname) | ||||
|  | ||||
| @@ -102,7 +106,9 @@ local register_one_tube = function(name, tname, dropname, desc, plain, noctrs, e | ||||
| 			fixed = outboxes | ||||
| 		}, | ||||
| 		groups = tgroups, | ||||
| 		sounds = default.node_sound_wood_defaults(), | ||||
| 		_sound_def = { | ||||
| 			key = "node_sound_wood_defaults", | ||||
| 		}, | ||||
| 		walkable = true, | ||||
| 		stack_max = 99, | ||||
| 		basename = name, | ||||
|   | ||||
| @@ -39,16 +39,16 @@ if pipeworks.enable_mese_sand_tube then | ||||
| 				groups = {vacuum_tube = 1}, | ||||
| 				on_construct = function(pos) | ||||
| 					local meta = minetest.get_meta(pos) | ||||
| 					local size = "6.0,2.4" | ||||
| 					meta:set_int("dist", 0) | ||||
| 					meta:set_string("formspec", | ||||
| 						"size[6.0,2.2]".. | ||||
| 						"size["..size.."]".. | ||||
| 						pipeworks.fs_helpers.get_prepends(size) .. | ||||
| 						"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) | ||||
| 						"button_exit[3.8,1.3;2,1;close;"..S("Close").."]") | ||||
| 					meta:set_string("infotext", S("Adjustable Vacuuming Pneumatic Tube Segment")) | ||||
| 				end, | ||||
| 				on_receive_fields = function(pos,formname,fields,sender) | ||||
| @@ -69,27 +69,6 @@ if pipeworks.enable_mese_sand_tube then | ||||
| 				end, | ||||
| 			}, | ||||
| 	}) | ||||
|  | ||||
| 	minetest.register_craft( { | ||||
| 		output = "pipeworks:mese_sand_tube_1 2", | ||||
| 		recipe = { | ||||
| 			{"basic_materials:plastic_sheet", "basic_materials:plastic_sheet", "basic_materials:plastic_sheet" }, | ||||
| 			{"group:sand",                 "default:mese_crystal",       "group:sand" }, | ||||
| 			{"basic_materials:plastic_sheet", "basic_materials:plastic_sheet", "basic_materials:plastic_sheet" } | ||||
| 		}, | ||||
| 	}) | ||||
|  | ||||
| 	minetest.register_craft( { | ||||
| 		type = "shapeless", | ||||
| 		output = "pipeworks:mese_sand_tube_1", | ||||
| 		recipe = { | ||||
| 			"pipeworks:sand_tube_1", | ||||
| 			"default:mese_crystal_fragment", | ||||
| 			"default:mese_crystal_fragment", | ||||
| 			"default:mese_crystal_fragment", | ||||
| 			"default:mese_crystal_fragment" | ||||
| 		}, | ||||
| 	}) | ||||
| end | ||||
|  | ||||
| local function vacuum(pos, radius) | ||||
|   | ||||
							
								
								
									
										55
									
								
								wielder.lua
									
									
									
									
									
								
							
							
						
						
									
										55
									
								
								wielder.lua
									
									
									
									
									
								
							| @@ -6,13 +6,28 @@ local function delay(x) | ||||
| end | ||||
|  | ||||
| local function set_wielder_formspec(data, meta) | ||||
| 	local size = "10.2,"..(7+data.wield_inv_height) | ||||
| 	local list_background = "" | ||||
| 	if minetest.get_modpath("i3") then | ||||
| 		list_background = "style_type[box;colors=#666]" | ||||
| 		for i=0, data.wield_inv_height-1 do | ||||
| 			for j=0, data.wield_inv_width-1 do | ||||
| 				list_background = list_background .. "box[".. ((10-data.wield_inv_width)*0.5)+(i*1.25) ..",".. 1+(j*1.25) ..";1,1;]" | ||||
| 			end | ||||
| 		end | ||||
| 	end | ||||
| 	meta:set_string("formspec", | ||||
| 			"size[8,"..(6+data.wield_inv_height)..";]".. | ||||
| 			"item_image[0,0;1,1;"..data.name_base.."_off]".. | ||||
| 			"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_player;main;0,"..(2+data.wield_inv_height)..";8,4;]" .. | ||||
| 			"listring[]") | ||||
| 		"formspec_version[2]" .. | ||||
| 		"size["..size.."]".. | ||||
| 		pipeworks.fs_helpers.get_prepends(size).. | ||||
| 		"item_image[0.5,0.5;1,1;"..data.name_base.."_off]".. | ||||
| 		"label[1.5,1;"..minetest.formspec_escape(data.description).."]".. | ||||
| 		list_background .. | ||||
| 		"list[context;"..minetest.formspec_escape(data.wield_inv_name)..";"..((10-data.wield_inv_width)*0.5)..",1;"..data.wield_inv_width..","..data.wield_inv_height..";]".. | ||||
| 		pipeworks.fs_helpers.get_inv((2+data.wield_inv_height)) .. | ||||
| 		"listring[context;"..minetest.formspec_escape(data.wield_inv_name).."]" .. | ||||
| 		"listring[current_player;main]" | ||||
| 	) | ||||
| 	meta:set_string("infotext", data.description) | ||||
| end | ||||
|  | ||||
| @@ -184,7 +199,9 @@ local function register_wielder(data) | ||||
| 			paramtype2 = "facedir", | ||||
| 			tubelike = 1, | ||||
| 			groups = groups, | ||||
| 			sounds = default.node_sound_stone_defaults(), | ||||
| 			_sound_def = { | ||||
| 				key = "node_sound_stone_defaults", | ||||
| 			}, | ||||
| 			drop = data.name_base.."_off", | ||||
| 			on_construct = function(pos) | ||||
| 				local meta = minetest.get_meta(pos) | ||||
| @@ -372,14 +389,6 @@ if pipeworks.enable_node_breaker then | ||||
| 	} | ||||
| 	register_wielder(data) | ||||
| 	pipeworks.ui_cat_tube_list[#pipeworks.ui_cat_tube_list+1] = "pipeworks:nodebreaker_off" | ||||
| 	minetest.register_craft({ | ||||
| 		output = "pipeworks:nodebreaker_off", | ||||
| 		recipe = { | ||||
| 			{ "basic_materials:gear_steel", "basic_materials:gear_steel",   "basic_materials:gear_steel"    }, | ||||
| 			{ "default:stone", "mesecons:piston",   "default:stone" }, | ||||
| 			{ "group:wood",    "mesecons:mesecon",  "group:wood" }, | ||||
| 		} | ||||
| 	}) | ||||
| 	-- aliases for when someone had technic installed, but then uninstalled it but not pipeworks | ||||
| 	minetest.register_alias("technic:nodebreaker_off", "pipeworks:nodebreaker_off") | ||||
| 	minetest.register_alias("technic:nodebreaker_on", "pipeworks:nodebreaker_on") | ||||
| @@ -424,14 +433,6 @@ if pipeworks.enable_deployer then | ||||
| 		eject_drops = false, | ||||
| 	}) | ||||
| 	pipeworks.ui_cat_tube_list[#pipeworks.ui_cat_tube_list+1] = "pipeworks:deployer_off" | ||||
| 	minetest.register_craft({ | ||||
| 		output = "pipeworks:deployer_off", | ||||
| 		recipe = { | ||||
| 			{ "group:wood",    "default:chest",    "group:wood"    }, | ||||
| 			{ "default:stone", "mesecons:piston",  "default:stone" }, | ||||
| 			{ "default:stone", "mesecons:mesecon", "default:stone" }, | ||||
| 		} | ||||
| 	}) | ||||
| 	-- aliases for when someone had technic installed, but then uninstalled it but not pipeworks | ||||
| 	minetest.register_alias("technic:deployer_off", "pipeworks:deployer_off") | ||||
| 	minetest.register_alias("technic:deployer_on", "pipeworks:deployer_on") | ||||
| @@ -460,12 +461,4 @@ if pipeworks.enable_dispenser then | ||||
| 		eject_drops = false, | ||||
| 	}) | ||||
| 	pipeworks.ui_cat_tube_list[#pipeworks.ui_cat_tube_list+1] = "pipeworks:dispenser_off" | ||||
| 	minetest.register_craft({ | ||||
| 		output = "pipeworks:dispenser_off", | ||||
| 		recipe = { | ||||
| 			{ "default:desert_sand", "default:chest",    "default:desert_sand" }, | ||||
| 			{ "default:stone",       "mesecons:piston",  "default:stone"       }, | ||||
| 			{ "default:stone",       "mesecons:mesecon", "default:stone"       }, | ||||
| 		} | ||||
| 	}) | ||||
| end | ||||
|   | ||||
		Reference in New Issue
	
	Block a user