mirror of
				https://github.com/mt-mods/pipeworks.git
				synced 2025-10-31 05:45:29 +01:00 
			
		
		
		
	Compare commits
	
		
			14 Commits
		
	
	
		
			2019-06-07
			...
			5cfe8d893f
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 5cfe8d893f | |||
|  | 99cb3a5d9d | ||
|  | 728d4e179a | ||
|  | 760e9e383c | ||
|  | 62bc13078f | ||
|  | 84d7104c66 | ||
|  | 2ca825f991 | ||
|  | 0fa88b7054 | ||
|  | 8f03c0e684 | ||
| 975e20f704 | |||
|  | 75cfac34e6 | ||
|  | d5fe933456 | ||
| 2693e2ecbb | |||
|  | c93df73a5c | 
| @@ -1,3 +1,4 @@ | ||||
| local S = minetest.get_translator("pipeworks") | ||||
| local autocrafterCache = {}  -- caches some recipe data to avoid to call the slow function minetest.get_craft_result() every second | ||||
|  | ||||
| local craft_time = 1 | ||||
| @@ -16,7 +17,7 @@ end | ||||
| local function get_item_info(stack) | ||||
| 	local name = stack:get_name() | ||||
| 	local def = minetest.registered_items[name] | ||||
| 	local description = def and def.description or "Unknown item" | ||||
| 	local description = def and def.description or S("Unknown item") | ||||
| 	return description, name | ||||
| end | ||||
|  | ||||
| @@ -66,9 +67,12 @@ 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 | ||||
| 		meta:set_string("infotext", "unconfigured Autocrafter: unknown recipe") | ||||
| 	-- 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 | ||||
|  | ||||
| @@ -101,7 +105,7 @@ local function after_recipe_change(pos, inventory) | ||||
| 	if inventory:is_empty("recipe") then | ||||
| 		minetest.get_node_timer(pos):stop() | ||||
| 		autocrafterCache[minetest.hash_node_position(pos)] = nil | ||||
| 		meta:set_string("infotext", "unconfigured Autocrafter") | ||||
| 		meta:set_string("infotext", S("unconfigured Autocrafter")) | ||||
| 		inventory:set_stack("output", 1, "") | ||||
| 		return | ||||
| 	end | ||||
| @@ -126,7 +130,7 @@ local function after_recipe_change(pos, inventory) | ||||
| 	craft = craft or get_craft(pos, inventory, hash) | ||||
| 	local output_item = craft.output.item | ||||
| 	local description, name = get_item_info(output_item) | ||||
| 	meta:set_string("infotext", string.format("'%s' Autocrafter (%s)", description, name)) | ||||
| 	meta:set_string("infotext", S("'@1' Autocrafter (@2)", description, name)) | ||||
| 	inventory:set_stack("output", 1, output_item) | ||||
|  | ||||
| 	after_inventory_change(pos) | ||||
| @@ -190,8 +194,8 @@ local function update_meta(meta, enabled) | ||||
| 			"listring[context;dst]" .. | ||||
| 			"listring[current_player;main]" | ||||
| 	if minetest.get_modpath("digilines") then | ||||
| 		fs = fs.."field[1,3.5;4,1;channel;Channel;${channel}]" | ||||
| 		fs = fs.."button_exit[5,3.2;2,1;save;Save]" | ||||
| 		fs = fs.."field[1,3.5;4,1;channel;"..S("Channel")..";${channel}]" | ||||
| 		fs = fs.."button_exit[5,3.2;2,1;save;"..S("Save").."]" | ||||
| 	end | ||||
| 	meta:set_string("formspec",fs) | ||||
|  | ||||
| @@ -200,13 +204,13 @@ local function update_meta(meta, enabled) | ||||
| 	-- this might be more written code, but actually executes less | ||||
| 	local output = meta:get_inventory():get_stack("output", 1) | ||||
| 	if output:is_empty() then -- doesn't matter if paused or not | ||||
| 		meta:set_string("infotext", "unconfigured Autocrafter") | ||||
| 		meta:set_string("infotext", S("unconfigured Autocrafter")) | ||||
| 		return false | ||||
| 	end | ||||
|  | ||||
| 	local description, name = get_item_info(output) | ||||
| 	local infotext = enabled and string.format("'%s' Autocrafter (%s)", description, name) | ||||
| 				or string.format("paused '%s' Autocrafter", description) | ||||
| 	local infotext = enabled and S("'@1' Autocrafter (@2)", description, name) | ||||
| 				or S("paused '@1' Autocrafter", description) | ||||
|  | ||||
| 	meta:set_string("infotext", infotext) | ||||
| 	return enabled | ||||
| @@ -226,7 +230,7 @@ local function upgrade_autocrafter(pos, meta) | ||||
| 		update_meta(meta, true) | ||||
|  | ||||
| 		if meta:get_string("virtual_items") == "1" then -- we are version 2 | ||||
| 			-- we allready dropped stuff, so lets remove the metadatasetting (we are not being called again for this node) | ||||
| 			-- we already dropped stuff, so lets remove the metadatasetting (we are not being called again for this node) | ||||
| 			meta:set_string("virtual_items", "") | ||||
| 		else -- we are version 1 | ||||
| 			local recipe = inv:get_list("recipe") | ||||
| @@ -248,7 +252,7 @@ local function upgrade_autocrafter(pos, meta) | ||||
| end | ||||
|  | ||||
| minetest.register_node("pipeworks:autocrafter", { | ||||
| 	description = "Autocrafter", | ||||
| 	description = S("Autocrafter"), | ||||
| 	drawtype = "normal", | ||||
| 	tiles = {"pipeworks_autocrafter.png"}, | ||||
| 	groups = {snappy = 3, tubedevice = 1, tubedevice_receiver = 1}, | ||||
|   | ||||
| @@ -1,7 +1,10 @@ | ||||
|  | ||||
| -- 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 | ||||
|  | ||||
| tube_entry = "^pipeworks_tube_connection_stony.png" | ||||
| @@ -36,7 +39,7 @@ local function active_formspec(fuel_percent, item_percent, pos, meta) | ||||
| 					pipeworks.button_off, | ||||
| 					pipeworks.button_on | ||||
| 				} | ||||
| 			).."label[0.9,3.51;Allow splitting incoming material (not fuel) stacks from tubes]" | ||||
| 			).."label[0.9,3.51;"..S("Allow splitting incoming material (not fuel) stacks from tubes").."]" | ||||
| 	return formspec | ||||
| end | ||||
|  | ||||
| @@ -67,7 +70,7 @@ local function inactive_formspec(pos, meta) | ||||
| 				pipeworks.button_off, | ||||
| 				pipeworks.button_on | ||||
| 			} | ||||
| 		).."label[0.9,3.51;Allow splitting incoming material (not fuel) stacks from tubes]" | ||||
| 		).."label[0.9,3.51;"..S("Allow splitting incoming material (not fuel) stacks from tubes").."]" | ||||
| 	return formspec | ||||
| end | ||||
|  | ||||
| @@ -90,7 +93,7 @@ local function allow_metadata_inventory_put(pos, listname, index, stack, player) | ||||
| 	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", "Furnace is empty") | ||||
| 				meta:set_string("infotext", DS("Furnace is empty")) | ||||
| 			end | ||||
| 			return stack:get_count() | ||||
| 		else | ||||
| @@ -219,40 +222,40 @@ local function furnace_node_timer(pos, elapsed) | ||||
| 	if cookable then | ||||
| 		item_percent = math.floor(src_time / cooked.time * 100) | ||||
| 		if item_percent > 100 then | ||||
| 			item_state = "100% (output full)" | ||||
| 			item_state = DS("100% (output full)") | ||||
| 		else | ||||
| 			item_state = item_percent .. "%" | ||||
| 			item_state = DS("@1%", item_percent) | ||||
| 		end | ||||
| 	else | ||||
| 		if srclist[1]:is_empty() then | ||||
| 			item_state = "Empty" | ||||
| 			item_state = DS("Empty") | ||||
| 		else | ||||
| 			item_state = "Not cookable" | ||||
| 			item_state = DS("Not cookable") | ||||
| 		end | ||||
| 	end | ||||
|  | ||||
| 	local fuel_state = "Empty" | ||||
| 	local active = "inactive " | ||||
| 	local fuel_state = DS("Empty") | ||||
| 	local active = DS("Furnace inactive") | ||||
| 	local result = false | ||||
|  | ||||
| 	if fuel_totaltime ~= 0 then | ||||
| 		active = "active " | ||||
| 		active = DS("Furnace active") | ||||
| 		local fuel_percent = math.floor(fuel_time / fuel_totaltime * 100) | ||||
| 		fuel_state = fuel_percent .. "%" | ||||
| 		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 = "0%" | ||||
| 			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 = "Furnace " .. active .. "(Item: " .. item_state .. "; Fuel: " .. fuel_state .. ")" | ||||
| 	local infotext = active.." "..DS("(Item: @1; Fuel: @2)", item_state, fuel_state) | ||||
|  | ||||
| 	-- | ||||
| 	-- Set meta values | ||||
| @@ -271,7 +274,7 @@ end | ||||
| -- | ||||
|  | ||||
| minetest.register_node(":default:furnace", { | ||||
| 	description = "Furnace", | ||||
| 	description = DS("Furnace"), | ||||
| 	tiles = { | ||||
| 		"default_furnace_top.png"..tube_entry, | ||||
| 		"default_furnace_bottom.png"..tube_entry, | ||||
| @@ -360,7 +363,7 @@ minetest.register_node(":default:furnace", { | ||||
| }) | ||||
|  | ||||
| minetest.register_node(":default:furnace_active", { | ||||
| 	description = "Furnace", | ||||
| 	description = DS("Furnace"), | ||||
| 	tiles = { | ||||
| 		"default_furnace_top.png"..tube_entry, | ||||
| 		"default_furnace_bottom.png"..tube_entry, | ||||
|   | ||||
| @@ -1,7 +1,9 @@ | ||||
| local S = minetest.get_translator("pipeworks") | ||||
|  | ||||
| local straight = function(pos, node, velocity, stack) return {velocity} end | ||||
|  | ||||
| minetest.register_node("pipeworks:steel_block_embedded_tube", { | ||||
| 	description = "Airtight steelblock 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", | ||||
| @@ -45,7 +47,7 @@ local pane_box = { | ||||
| } | ||||
| minetest.register_node("pipeworks:steel_pane_embedded_tube", { | ||||
| 	drawtype = "nodebox", | ||||
| 	description = "Airtight panel embedded tube ", | ||||
| 	description = S("Airtight panel embedded tube"), | ||||
| 	tiles = { | ||||
| 		"pipeworks_pane_embedded_tube_sides.png^[transformR90", | ||||
| 		"pipeworks_pane_embedded_tube_sides.png^[transformR90", | ||||
|   | ||||
| @@ -1,6 +0,0 @@ | ||||
| default | ||||
| basic_materials | ||||
| screwdriver | ||||
| mesecons? | ||||
| mesecons_mvps? | ||||
| digilines? | ||||
| @@ -1 +0,0 @@ | ||||
| This mod uses mesh nodes and nodeboxes to supply a complete set of 3D pipes and tubes, along with devices that work with them. | ||||
							
								
								
									
										77
									
								
								devices.lua
									
									
									
									
									
								
							
							
						
						
									
										77
									
								
								devices.lua
									
									
									
									
									
								
							| @@ -1,3 +1,4 @@ | ||||
| local S = minetest.get_translator("pipeworks") | ||||
| local new_flow_logic_register = pipeworks.flowables.register | ||||
|  | ||||
| local polys = "" | ||||
| @@ -135,14 +136,14 @@ for s in ipairs(states) do | ||||
|  | ||||
| 	local pumpname = "pipeworks:pump_"..states[s] | ||||
| 	minetest.register_node(pumpname, { | ||||
| 		description = "Pump/Intake Module", | ||||
| 		description = S("Pump/Intake Module"), | ||||
| 		drawtype = "mesh", | ||||
| 		mesh = "pipeworks_pump"..polys..".obj", | ||||
| 		tiles = { "pipeworks_pump_"..states[s]..".png" }, | ||||
| 		paramtype = "light", | ||||
| 		paramtype2 = "facedir", | ||||
| 		groups = dgroups, | ||||
| 		sounds = default.node_sound_wood_defaults(), | ||||
| 		sounds = default.node_sound_metal_defaults(), | ||||
| 		walkable = true, | ||||
| 		pipe_connections = { top = 1 }, | ||||
| 		after_place_node = function(pos) | ||||
| @@ -178,7 +179,7 @@ for s in ipairs(states) do | ||||
|  | ||||
| 	local nodename_valve_empty = "pipeworks:valve_"..states[s].."_empty" | ||||
| 	minetest.register_node(nodename_valve_empty, { | ||||
| 		description = "Valve", | ||||
| 		description = S("Valve"), | ||||
| 		drawtype = "mesh", | ||||
| 		mesh = "pipeworks_valve_"..states[s]..polys..".obj", | ||||
| 		tiles = { "pipeworks_valve.png" }, | ||||
| @@ -194,7 +195,7 @@ 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_wood_defaults(), | ||||
| 		sounds = default.node_sound_metal_defaults(), | ||||
| 		walkable = true, | ||||
| 		on_place = pipeworks.rotate_on_place, | ||||
| 		after_dig_node = function(pos) | ||||
| @@ -224,7 +225,7 @@ end | ||||
|  | ||||
| local nodename_valve_loaded = "pipeworks:valve_on_loaded" | ||||
| minetest.register_node(nodename_valve_loaded, { | ||||
| 	description = "Valve", | ||||
| 	description = S("Valve"), | ||||
| 	drawtype = "mesh", | ||||
| 	mesh = "pipeworks_valve_on"..polys..".obj", | ||||
| 	tiles = { "pipeworks_valve.png" }, | ||||
| @@ -240,7 +241,7 @@ minetest.register_node(nodename_valve_loaded, { | ||||
| 		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_wood_defaults(), | ||||
| 	sounds = default.node_sound_metal_defaults(), | ||||
| 	walkable = true, | ||||
| 	on_place = pipeworks.rotate_on_place, | ||||
| 	after_dig_node = function(pos) | ||||
| @@ -272,7 +273,7 @@ new_flow_logic_register.directional_horizonal_rotate(nodename_valve_loaded, true | ||||
|  | ||||
| -- FIXME: should this do anything useful in the new flow logic? | ||||
| minetest.register_node("pipeworks:grating", { | ||||
| 	description = "Decorative grating", | ||||
| 	description = S("Decorative grating"), | ||||
| 	tiles = { | ||||
| 		"pipeworks_grating_top.png", | ||||
| 		"pipeworks_grating_sides.png", | ||||
| @@ -289,7 +290,7 @@ minetest.register_node("pipeworks:grating", { | ||||
| 	sunlight_propagates = true, | ||||
| 	paramtype = "light", | ||||
| 	groups = {snappy=3, pipe=1}, | ||||
| 	sounds = default.node_sound_wood_defaults(), | ||||
| 	sounds = default.node_sound_metal_defaults(), | ||||
| 	walkable = true, | ||||
| 	pipe_connections = { top = 1 }, | ||||
| 	after_place_node = function(pos) | ||||
| @@ -305,7 +306,7 @@ minetest.register_node("pipeworks:grating", { | ||||
|  | ||||
| local nodename_spigot_empty = "pipeworks:spigot" | ||||
| minetest.register_node(nodename_spigot_empty, { | ||||
| 	description = "Spigot outlet", | ||||
| 	description = S("Spigot outlet"), | ||||
| 	drawtype = "mesh", | ||||
| 	mesh = "pipeworks_spigot"..polys..".obj", | ||||
| 	tiles = { "pipeworks_spigot.png" }, | ||||
| @@ -313,7 +314,7 @@ minetest.register_node(nodename_spigot_empty, { | ||||
| 	paramtype = "light", | ||||
| 	paramtype2 = "facedir", | ||||
| 	groups = {snappy=3, pipe=1}, | ||||
| 	sounds = default.node_sound_wood_defaults(), | ||||
| 	sounds = default.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 }, | ||||
| @@ -336,7 +337,7 @@ minetest.register_node(nodename_spigot_empty, { | ||||
|  | ||||
| local nodename_spigot_loaded = "pipeworks:spigot_pouring" | ||||
| minetest.register_node(nodename_spigot_loaded, { | ||||
| 	description = "Spigot outlet", | ||||
| 	description = S("Spigot outlet"), | ||||
| 	drawtype = "mesh", | ||||
| 	mesh = "pipeworks_spigot_pouring"..polys..".obj", | ||||
| 	tiles = { | ||||
| @@ -355,7 +356,7 @@ minetest.register_node(nodename_spigot_loaded, { | ||||
| 	paramtype = "light", | ||||
| 	paramtype2 = "facedir", | ||||
| 	groups = {snappy=3, pipe=1, not_in_creative_inventory=1}, | ||||
| 	sounds = default.node_sound_wood_defaults(), | ||||
| 	sounds = default.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 }, | ||||
| @@ -402,14 +403,14 @@ local panel_cbox = { | ||||
|  | ||||
| local nodename_panel_empty = "pipeworks:entry_panel_empty" | ||||
| minetest.register_node(nodename_panel_empty, { | ||||
| 	description = "Airtight Pipe entry/exit", | ||||
| 	description = S("Airtight Pipe entry/exit"), | ||||
| 	drawtype = "mesh", | ||||
| 	mesh = "pipeworks_entry_panel"..polys..".obj", | ||||
| 	tiles = { "pipeworks_entry_panel.png" }, | ||||
| 	paramtype = "light", | ||||
| 	paramtype2 = "facedir", | ||||
| 	groups = {snappy=3, pipe=1}, | ||||
| 	sounds = default.node_sound_wood_defaults(), | ||||
| 	sounds = default.node_sound_metal_defaults(), | ||||
| 	walkable = true, | ||||
| 	on_place = pipeworks.rotate_on_place, | ||||
| 	after_dig_node = function(pos) | ||||
| @@ -422,14 +423,14 @@ minetest.register_node(nodename_panel_empty, { | ||||
|  | ||||
| local nodename_panel_loaded = "pipeworks:entry_panel_loaded" | ||||
| minetest.register_node(nodename_panel_loaded, { | ||||
| 	description = "Airtight Pipe entry/exit", | ||||
| 	description = S("Airtight Pipe entry/exit"), | ||||
| 	drawtype = "mesh", | ||||
| 	mesh = "pipeworks_entry_panel"..polys..".obj", | ||||
| 	tiles = { "pipeworks_entry_panel.png" }, | ||||
| 	paramtype = "light", | ||||
| 	paramtype2 = "facedir", | ||||
| 	groups = {snappy=3, pipe=1, not_in_creative_inventory=1}, | ||||
| 	sounds = default.node_sound_wood_defaults(), | ||||
| 	sounds = default.node_sound_metal_defaults(), | ||||
| 	walkable = true, | ||||
| 	on_place = pipeworks.rotate_on_place, | ||||
| 	after_dig_node = function(pos) | ||||
| @@ -448,7 +449,7 @@ new_flow_logic_register.directional_horizonal_rotate(nodename_panel_loaded, true | ||||
|  | ||||
| local nodename_sensor_empty = "pipeworks:flow_sensor_empty" | ||||
| minetest.register_node(nodename_sensor_empty, { | ||||
| 	description = "Flow Sensor", | ||||
| 	description = S("Flow Sensor"), | ||||
| 	drawtype = "mesh", | ||||
| 	mesh = "pipeworks_flow_sensor"..polys..".obj", | ||||
| 	tiles = { "pipeworks_flow_sensor_off.png" }, | ||||
| @@ -456,7 +457,7 @@ minetest.register_node(nodename_sensor_empty, { | ||||
| 	paramtype = "light", | ||||
| 	paramtype2 = "facedir", | ||||
| 	groups = {snappy=3, pipe=1}, | ||||
| 	sounds = default.node_sound_wood_defaults(), | ||||
| 	sounds = default.node_sound_metal_defaults(), | ||||
| 	walkable = true, | ||||
| 	on_place = pipeworks.rotate_on_place, | ||||
| 	after_dig_node = function(pos) | ||||
| @@ -487,7 +488,7 @@ minetest.register_node(nodename_sensor_empty, { | ||||
|  | ||||
| local nodename_sensor_loaded = "pipeworks:flow_sensor_loaded" | ||||
| minetest.register_node(nodename_sensor_loaded, { | ||||
| 	description = "Flow sensor (on)", | ||||
| 	description = S("Flow sensor (on)"), | ||||
| 	drawtype = "mesh", | ||||
| 	mesh = "pipeworks_flow_sensor"..polys..".obj", | ||||
| 	tiles = { "pipeworks_flow_sensor_on.png" }, | ||||
| @@ -495,7 +496,7 @@ minetest.register_node(nodename_sensor_loaded, { | ||||
| 	paramtype = "light", | ||||
| 	paramtype2 = "facedir", | ||||
| 	groups = {snappy=3, pipe=1, not_in_creative_inventory=1}, | ||||
| 	sounds = default.node_sound_wood_defaults(), | ||||
| 	sounds = default.node_sound_metal_defaults(), | ||||
| 	walkable = true, | ||||
| 	on_place = pipeworks.rotate_on_place, | ||||
| 	after_dig_node = function(pos) | ||||
| @@ -536,18 +537,18 @@ 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="empty" | ||||
| 	local filldesc=S("empty") | ||||
| 	local sgroups = {snappy=3, pipe=1, tankfill=fill+1} | ||||
| 	local image = nil | ||||
|  | ||||
| 	if fill ~= 0 then | ||||
| 		filldesc=fill.."0% full" | ||||
| 		filldesc=S("@1% full", 10*fill) | ||||
| 		sgroups = {snappy=3, pipe=1, tankfill=fill+1, not_in_creative_inventory=1} | ||||
| 		image = "pipeworks_storage_tank_fittings.png" | ||||
| 	end | ||||
|  | ||||
| 	minetest.register_node("pipeworks:expansion_tank_"..fill, { | ||||
| 		description = "Expansion Tank ("..filldesc..")... You hacker, you.", | ||||
| 		description = S("Expansion Tank (@1)", filldesc), | ||||
| 		tiles = { | ||||
| 			"pipeworks_storage_tank_fittings.png", | ||||
| 			"pipeworks_storage_tank_fittings.png", | ||||
| @@ -560,7 +561,7 @@ for fill = 0, 10 do | ||||
| 		paramtype = "light", | ||||
| 		paramtype2 = "facedir", | ||||
| 		groups = {snappy=3, pipe=1, tankfill=fill+1, not_in_creative_inventory=1}, | ||||
| 		sounds = default.node_sound_wood_defaults(), | ||||
| 		sounds = default.node_sound_metal_defaults(), | ||||
| 		walkable = true, | ||||
| 		drop = "pipeworks:storage_tank_0", | ||||
| 		pipe_connections = { top = 1, bottom = 1}, | ||||
| @@ -575,7 +576,7 @@ for fill = 0, 10 do | ||||
| 	}) | ||||
|  | ||||
| 	minetest.register_node("pipeworks:storage_tank_"..fill, { | ||||
| 		description = "Fluid Storage Tank ("..filldesc..")", | ||||
| 		description = S("Fluid Storage Tank (@1)", filldesc), | ||||
| 		tiles = { | ||||
| 			"pipeworks_storage_tank_fittings.png", | ||||
| 			"pipeworks_storage_tank_fittings.png", | ||||
| @@ -588,7 +589,7 @@ for fill = 0, 10 do | ||||
| 		paramtype = "light", | ||||
| 		paramtype2 = "facedir", | ||||
| 		groups = sgroups, | ||||
| 		sounds = default.node_sound_wood_defaults(), | ||||
| 		sounds = default.node_sound_metal_defaults(), | ||||
| 		walkable = true, | ||||
| 		drop = "pipeworks:storage_tank_0", | ||||
| 		pipe_connections = { top = 1, bottom = 1}, | ||||
| @@ -607,14 +608,14 @@ end | ||||
|  | ||||
| local nodename_fountain_empty = "pipeworks:fountainhead" | ||||
| minetest.register_node(nodename_fountain_empty, { | ||||
| 	description = "Fountainhead", | ||||
| 	description = S("Fountainhead"), | ||||
| 	drawtype = "mesh", | ||||
| 	mesh = "pipeworks_fountainhead"..polys..".obj", | ||||
| 	tiles = { "pipeworks_fountainhead.png" }, | ||||
| 	sunlight_propagates = true, | ||||
| 	paramtype = "light", | ||||
| 	groups = {snappy=3, pipe=1}, | ||||
| 	sounds = default.node_sound_wood_defaults(), | ||||
| 	sounds = default.node_sound_metal_defaults(), | ||||
| 	walkable = true, | ||||
| 	pipe_connections = { bottom = 1 }, | ||||
| 	after_place_node = function(pos) | ||||
| @@ -641,14 +642,14 @@ minetest.register_node(nodename_fountain_empty, { | ||||
|  | ||||
| local nodename_fountain_loaded = "pipeworks:fountainhead_pouring" | ||||
| minetest.register_node(nodename_fountain_loaded, { | ||||
| 	description = "Fountainhead", | ||||
| 	description = S("Fountainhead"), | ||||
| 	drawtype = "mesh", | ||||
| 	mesh = "pipeworks_fountainhead"..polys..".obj", | ||||
| 	tiles = { "pipeworks_fountainhead.png" }, | ||||
| 	sunlight_propagates = true, | ||||
| 	paramtype = "light", | ||||
| 	groups = {snappy=3, pipe=1, not_in_creative_inventory=1}, | ||||
| 	sounds = default.node_sound_wood_defaults(), | ||||
| 	sounds = default.node_sound_metal_defaults(), | ||||
| 	walkable = true, | ||||
| 	pipe_connections = { bottom = 1 }, | ||||
| 	after_place_node = function(pos) | ||||
| @@ -691,14 +692,14 @@ local sp_cbox = { | ||||
|  | ||||
| local nodename_sp_empty = "pipeworks:straight_pipe_empty" | ||||
| minetest.register_node(nodename_sp_empty, { | ||||
| 	description = "Straight-only Pipe", | ||||
| 	description = S("Straight-only Pipe"), | ||||
| 	drawtype = "mesh", | ||||
| 	mesh = "pipeworks_straight_pipe"..polys..".obj", | ||||
| 	tiles = { "pipeworks_straight_pipe_empty.png" }, | ||||
| 	paramtype = "light", | ||||
| 	paramtype2 = "facedir", | ||||
| 	groups = {snappy=3, pipe=1}, | ||||
| 	sounds = default.node_sound_wood_defaults(), | ||||
| 	sounds = default.node_sound_metal_defaults(), | ||||
| 	walkable = true, | ||||
| 	on_place = pipeworks.rotate_on_place, | ||||
| 	after_dig_node = function(pos) | ||||
| @@ -706,19 +707,21 @@ minetest.register_node(nodename_sp_empty, { | ||||
| 	end, | ||||
| 	selection_box = sp_cbox, | ||||
| 	collision_box = sp_cbox, | ||||
| 	on_rotate = pipeworks.fix_after_rotation | ||||
| 	on_rotate = pipeworks.fix_after_rotation, | ||||
| 	check_for_pole = pipeworks.check_for_vert_pipe, | ||||
| 	check_for_horiz_pole = pipeworks.check_for_horiz_pipe | ||||
| }) | ||||
|  | ||||
| local nodename_sp_loaded = "pipeworks:straight_pipe_loaded" | ||||
| minetest.register_node(nodename_sp_loaded, { | ||||
| 	description = "Straight-only Pipe", | ||||
| 	description = S("Straight-only Pipe"), | ||||
| 	drawtype = "mesh", | ||||
| 	mesh = "pipeworks_straight_pipe"..polys..".obj", | ||||
| 	tiles = { "pipeworks_straight_pipe_loaded.png" }, | ||||
| 	paramtype = "light", | ||||
| 	paramtype2 = "facedir", | ||||
| 	groups = {snappy=3, pipe=1, not_in_creative_inventory=1}, | ||||
| 	sounds = default.node_sound_wood_defaults(), | ||||
| 	sounds = default.node_sound_metal_defaults(), | ||||
| 	walkable = true, | ||||
| 	on_place = pipeworks.rotate_on_place, | ||||
| 	after_dig_node = function(pos) | ||||
| @@ -727,7 +730,9 @@ minetest.register_node(nodename_sp_loaded, { | ||||
| 	selection_box = sp_cbox, | ||||
| 	collision_box = sp_cbox, | ||||
| 	drop = "pipeworks:straight_pipe_empty", | ||||
| 	on_rotate = pipeworks.fix_after_rotation | ||||
| 	on_rotate = pipeworks.fix_after_rotation, | ||||
| 	check_for_pole = pipeworks.check_for_vert_pipe, | ||||
| 	check_for_horiz_pole = pipeworks.check_for_horiz_pipe | ||||
| }) | ||||
|  | ||||
| new_flow_logic_register.directional_horizonal_rotate(nodename_sp_empty, true) | ||||
|   | ||||
| @@ -1,3 +1,4 @@ | ||||
| local S = minetest.get_translator("pipeworks") | ||||
| local fs_helpers = pipeworks.fs_helpers | ||||
|  | ||||
| local function delay(x) | ||||
| @@ -5,47 +6,47 @@ local function delay(x) | ||||
| end | ||||
|  | ||||
| local function set_filter_infotext(data, meta) | ||||
| 	local infotext = data.wise_desc.." Filter-Injector" | ||||
| 	local infotext = S("@1 Filter-Injector", data.wise_desc) | ||||
| 	if meta:get_int("slotseq_mode") == 2 then | ||||
| 		infotext = infotext .. " (slot #"..meta:get_int("slotseq_index").." next)" | ||||
| 		infotext = infotext .. " "..S("(slot #@1 next)", meta:get_int("slotseq_index")) | ||||
| 	end | ||||
| 	meta:set_string("infotext", infotext) | ||||
| end | ||||
|  | ||||
| local function set_filter_formspec(data, meta) | ||||
| 	local itemname = data.wise_desc.." Filter-Injector" | ||||
| 	local itemname = S("@1 Filter-Injector", data.wise_desc) | ||||
|  | ||||
| 	local formspec | ||||
| 	if data.digiline then | ||||
| 		formspec = "size[8,2.7]".. | ||||
| 			"item_image[0,0;1,1;pipeworks:"..data.name.."]".. | ||||
| 			"label[1,0;"..minetest.formspec_escape(itemname).."]".. | ||||
| 			"field[0.3,1.5;8.0,1;channel;Channel;${channel}]".. | ||||
| 			"field[0.3,1.5;8.0,1;channel;"..S("Channel")..";${channel}]".. | ||||
| 			fs_helpers.cycling_button(meta, "button[0,2;4,1", "slotseq_mode", | ||||
| 				{"Sequence slots by Priority", | ||||
| 				 "Sequence slots Randomly", | ||||
| 				 "Sequence slots by Rotation"}).. | ||||
| 				{S("Sequence slots by Priority"), | ||||
| 				 S("Sequence slots Randomly"), | ||||
| 				 S("Sequence slots by Rotation")}).. | ||||
| 			fs_helpers.cycling_button(meta, "button[4,2;4,1", "exmatch_mode", | ||||
| 				{"Exact match - off", | ||||
| 				 "Exact match - on "}) | ||||
| 				{S("Exact match - off"), | ||||
| 				 S("Exact match - on")}) | ||||
| 	else | ||||
| 		local exmatch_button = "" | ||||
| 		if data.stackwise then | ||||
| 			exmatch_button = | ||||
| 				fs_helpers.cycling_button(meta, "button[4,3.5;4,1", "exmatch_mode", | ||||
| 					{"Exact match - off", | ||||
| 					 "Exact match - on "}) | ||||
| 					{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;Prefer item types:]".. | ||||
| 			"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", | ||||
| 				{"Sequence slots by Priority", | ||||
| 				 "Sequence slots Randomly", | ||||
| 				 "Sequence slots by Rotation"}).. | ||||
| 				{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;]" .. | ||||
| 			"listring[]" | ||||
| @@ -53,116 +54,6 @@ local function set_filter_formspec(data, meta) | ||||
| 	meta:set_string("formspec", formspec) | ||||
| end | ||||
|  | ||||
| -- todo SOON: this function has *way too many* parameters | ||||
| local function grabAndFire(data,slotseq_mode,exmatch_mode,filtmeta,frominv,frominvname,frompos,fromnode,filterfor,fromtube,fromdef,dir,fakePlayer,all,digiline) | ||||
| 	local sposes = {} | ||||
| 	if not frominvname or not frominv:get_list(frominvname) then return end | ||||
| 	for spos,stack in ipairs(frominv:get_list(frominvname)) do | ||||
| 		local matches | ||||
| 		if filterfor == "" then | ||||
| 			matches = stack:get_name() ~= "" | ||||
| 		else | ||||
| 			local fname = filterfor.name | ||||
| 			local fgroup = filterfor.group | ||||
| 			local fwear = filterfor.wear | ||||
| 			local fmetadata = filterfor.metadata | ||||
| 			matches = (not fname                                             -- If there's a name filter, | ||||
| 			           or stack:get_name() == fname)                         --  it must match. | ||||
|  | ||||
| 			          and (not fgroup                                        -- If there's a group filter, | ||||
| 			               or (type(fgroup) == "string"                      --  it must be a string | ||||
| 			                   and minetest.get_item_group(                  --  and it must match. | ||||
| 			                                stack:get_name(), fgroup) ~= 0)) | ||||
|  | ||||
| 			          and (not fwear                                         -- If there's a wear filter: | ||||
| 			               or (type(fwear) == "number"                       --  If it's a number, | ||||
| 			                   and stack:get_wear() == fwear)                --   it must match. | ||||
| 			               or (type(fwear) == "table"                        --  If it's a table: | ||||
| 			                   and (not fwear[1]                             --   If there's a lower bound, | ||||
| 			                        or (type(fwear[1]) == "number"           --    it must be a number | ||||
| 			                            and fwear[1] <= stack:get_wear()))   --    and it must be <= the actual wear. | ||||
| 			                   and (not fwear[2]                             --   If there's an upper bound | ||||
| 			                        or (type(fwear[2]) == "number"           --    it must be a number | ||||
| 			                            and stack:get_wear() < fwear[2]))))  --    and it must be > the actual wear. | ||||
| 			                                                                 --  If the wear filter is of any other type, fail. | ||||
| 			                                                                 -- | ||||
| 			          and (not fmetadata                                     -- If there's a matadata filter, | ||||
| 			               or (type(fmetadata) == "string"                   --  it must be a string | ||||
| 			                   and stack:get_metadata() == fmetadata))       --  and it must match. | ||||
| 		end | ||||
| 		if matches then table.insert(sposes, spos) end | ||||
| 	end | ||||
| 	if #sposes == 0 then return false end | ||||
| 	if slotseq_mode == 1 then | ||||
| 		for i = #sposes, 2, -1 do | ||||
| 			local j = math.random(i) | ||||
| 			local t = sposes[j] | ||||
| 			sposes[j] = sposes[i] | ||||
| 			sposes[i] = t | ||||
| 		end | ||||
| 	elseif slotseq_mode == 2 then | ||||
| 		local headpos = filtmeta:get_int("slotseq_index") | ||||
| 		table.sort(sposes, function (a, b) | ||||
| 			if a >= headpos then | ||||
| 				if b < headpos then return true end | ||||
| 			else | ||||
| 				if b >= headpos then return false end | ||||
| 			end | ||||
| 			return a < b | ||||
| 		end) | ||||
| 	end | ||||
| 	for _, spos in ipairs(sposes) do | ||||
| 			local stack = frominv:get_stack(frominvname, spos) | ||||
| 			local doRemove = stack:get_count() | ||||
| 			if fromtube.can_remove then | ||||
| 				doRemove = fromtube.can_remove(frompos, fromnode, stack, dir, frominvname, spos) | ||||
| 			elseif fromdef.allow_metadata_inventory_take then | ||||
| 				doRemove = fromdef.allow_metadata_inventory_take(frompos, frominvname,spos, stack, fakePlayer) | ||||
| 			end | ||||
| 			-- stupid lack of continue statements grumble | ||||
| 			if doRemove > 0 then | ||||
| 				if slotseq_mode == 2 then | ||||
| 					local nextpos = spos + 1 | ||||
| 					if nextpos > frominv:get_size(frominvname) then | ||||
| 						nextpos = 1 | ||||
| 					end | ||||
| 					filtmeta:set_int("slotseq_index", nextpos) | ||||
| 					set_filter_infotext(data, filtmeta) | ||||
| 				end | ||||
| 				local item | ||||
| 				local count | ||||
| 				if all then | ||||
| 					count = math.min(stack:get_count(), doRemove) | ||||
| 					if filterfor.count and (filterfor.count > 1 or digiline) then | ||||
| 						if exmatch_mode ~= 0 and filterfor.count > count then | ||||
| 							return false -- not enough, fail | ||||
| 						else | ||||
| 							-- limit quantity to filter amount | ||||
| 							count = math.min(filterfor.count, count) | ||||
| 						end | ||||
| 					end | ||||
| 				else | ||||
| 					count = 1 | ||||
| 				end | ||||
| 				if fromtube.remove_items then | ||||
| 					-- it could be the entire stack... | ||||
| 					item = fromtube.remove_items(frompos, fromnode, stack, dir, count, frominvname, spos) | ||||
| 				else | ||||
| 					item = stack:take_item(count) | ||||
| 					frominv:set_stack(frominvname, spos, stack) | ||||
| 					if fromdef.on_metadata_inventory_take then | ||||
| 						fromdef.on_metadata_inventory_take(frompos, frominvname, spos, item, fakePlayer) | ||||
| 					end | ||||
| 				end | ||||
| 				local pos = vector.add(frompos, vector.multiply(dir, 1.4)) | ||||
| 				local start_pos = vector.add(frompos, dir) | ||||
| 				local item1 = pipeworks.tube_inject_item(pos, start_pos, dir, item, fakePlayer:get_player_name()) | ||||
| 				return true-- only fire one item, please | ||||
| 			end | ||||
| 	end | ||||
| 	return false | ||||
| end | ||||
|  | ||||
| local function punch_filter(data, filtpos, filtnode, msg) | ||||
| 	local filtmeta = minetest.get_meta(filtpos) | ||||
| 	local filtinv = filtmeta:get_inventory() | ||||
| @@ -178,8 +69,6 @@ local function punch_filter(data, filtpos, filtnode, msg) | ||||
| 	if not fromdef then return end | ||||
| 	local fromtube = fromdef.tube | ||||
| 	local input_special_cases = { | ||||
| 		["technic:mv_furnace"] = "dst", | ||||
| 		["technic:mv_furnace_active"] = "dst", | ||||
| 		["technic:mv_electric_furnace"] = "dst", | ||||
| 		["technic:mv_electric_furnace_active"] = "dst", | ||||
| 		["technic:mv_alloy_furnace"] = "dst", | ||||
| @@ -194,7 +83,13 @@ local function punch_filter(data, filtpos, filtnode, msg) | ||||
| 		["technic:mv_grinder_active"] = "dst", | ||||
| 		["technic:tool_workshop"] = "src", | ||||
| 		["technic:mv_freezer"] = "dst", | ||||
| 		["technic:mv_freezer_active"] = "dst" | ||||
| 		["technic:mv_freezer_active"] = "dst", | ||||
| 		["technic:hv_electric_furnace"] = "dst", | ||||
| 		["technic:hv_electric_furnace_active"] = "dst", | ||||
| 		["technic:hv_compressor"] = "dst", | ||||
| 		["technic:hv_compressor_active"] = "dst", | ||||
| 		["technic:hv_grinder"] = "dst", | ||||
| 		["technic:hv_grinder_active"] = "dst" | ||||
| 	} | ||||
|  | ||||
| 	-- make sure there's something appropriate to inject the item into | ||||
| @@ -214,7 +109,7 @@ local function punch_filter(data, filtpos, filtnode, msg) | ||||
| 	if not (fromtube and fromtube.input_inventory) then return end | ||||
|  | ||||
| 	local slotseq_mode | ||||
| 	local exact_match | ||||
| 	local exmatch_mode | ||||
|  | ||||
| 	local filters = {} | ||||
| 	if data.digiline then | ||||
| @@ -251,10 +146,10 @@ local function punch_filter(data, filtpos, filtnode, msg) | ||||
|  | ||||
| 			local exmatch = msg.exmatch | ||||
| 			local t_exmatch = type(exmatch) | ||||
| 			if t_exmatch == "number" and exmatch >= 0 and exmatch <= 1 then | ||||
| 				exact_match = exmatch | ||||
| 			if t_exmatch == "number" and (exmatch == 0 or exmatch == 1) then | ||||
| 				exmatch_mode = exmatch | ||||
| 			elseif t_exmatch == "boolean" then | ||||
| 				exact_match = exmatch and 1 or 0 | ||||
| 				exmatch_mode = exmatch and 1 or 0 | ||||
| 			end | ||||
|  | ||||
| 			local slotseq_index = msg.slotseq_index | ||||
| @@ -271,11 +166,11 @@ local function punch_filter(data, filtpos, filtnode, msg) | ||||
| 				filtmeta:set_int("slotseq_mode", slotseq_mode) | ||||
| 			end | ||||
|  | ||||
| 			if exact_match ~= nil then | ||||
| 				filtmeta:set_int("exmatch_mode", exact_match) | ||||
| 			if exmatch_mode ~= nil then | ||||
| 				filtmeta:set_int("exmatch_mode", exmatch_mode) | ||||
| 			end | ||||
|  | ||||
| 			if slotseq_mode ~= nil or exact_match ~= nil then | ||||
| 			if slotseq_mode ~= nil or exmatch_mode ~= nil then | ||||
| 				set_filter_formspec(data, filtmeta) | ||||
| 			end | ||||
|  | ||||
| @@ -313,8 +208,8 @@ local function punch_filter(data, filtpos, filtnode, msg) | ||||
| 		slotseq_mode = filtmeta:get_int("slotseq_mode") | ||||
| 	end | ||||
|  | ||||
| 	if exact_match == nil then | ||||
| 		exact_match = filtmeta:get_int("exmatch_mode") | ||||
| 	if exmatch_mode == nil then | ||||
| 		exmatch_mode = filtmeta:get_int("exmatch_mode") | ||||
| 	end | ||||
|  | ||||
| 	local frominv | ||||
| @@ -328,10 +223,120 @@ local function punch_filter(data, filtpos, filtnode, msg) | ||||
| 		frominv = frommeta:get_inventory() | ||||
| 	end | ||||
| 	if fromtube.before_filter then fromtube.before_filter(frompos) end | ||||
|  | ||||
| 	local function grabAndFire(frominvname, filterfor) | ||||
| 		local sposes = {} | ||||
| 		if not frominvname or not frominv:get_list(frominvname) then return end | ||||
| 		for spos,stack in ipairs(frominv:get_list(frominvname)) do | ||||
| 			local matches | ||||
| 			if filterfor == "" then | ||||
| 				matches = stack:get_name() ~= "" | ||||
| 			else | ||||
| 				local fname = filterfor.name | ||||
| 				local fgroup = filterfor.group | ||||
| 				local fwear = filterfor.wear | ||||
| 				local fmetadata = filterfor.metadata | ||||
| 				matches = (not fname                                             -- If there's a name filter, | ||||
| 				           or stack:get_name() == fname)                         --  it must match. | ||||
|  | ||||
| 				          and (not fgroup                                        -- If there's a group filter, | ||||
| 				               or (type(fgroup) == "string"                      --  it must be a string | ||||
| 				                   and minetest.get_item_group(                  --  and it must match. | ||||
| 				                                stack:get_name(), fgroup) ~= 0)) | ||||
|  | ||||
| 				          and (not fwear                                         -- If there's a wear filter: | ||||
| 				               or (type(fwear) == "number"                       --  If it's a number, | ||||
| 				                   and stack:get_wear() == fwear)                --   it must match. | ||||
| 				               or (type(fwear) == "table"                        --  If it's a table: | ||||
| 				                   and (not fwear[1]                             --   If there's a lower bound, | ||||
| 				                        or (type(fwear[1]) == "number"           --    it must be a number | ||||
| 				                            and fwear[1] <= stack:get_wear()))   --    and it must be <= the actual wear. | ||||
| 				                   and (not fwear[2]                             --   If there's an upper bound | ||||
| 				                        or (type(fwear[2]) == "number"           --    it must be a number | ||||
| 				                            and stack:get_wear() < fwear[2]))))  --    and it must be > the actual wear. | ||||
| 				                                                                 --  If the wear filter is of any other type, fail. | ||||
|  | ||||
| 				          and (not fmetadata                                     -- If there's a metadata filter, | ||||
| 				               or (type(fmetadata) == "string"                   --  it must be a string | ||||
| 				                   and stack:get_metadata() == fmetadata))       --  and it must match. | ||||
| 			end | ||||
| 			if matches then table.insert(sposes, spos) end | ||||
| 		end | ||||
| 		if #sposes == 0 then return false end | ||||
| 		if slotseq_mode == 1 then | ||||
| 			for i = #sposes, 2, -1 do | ||||
| 				local j = math.random(i) | ||||
| 				local t = sposes[j] | ||||
| 				sposes[j] = sposes[i] | ||||
| 				sposes[i] = t | ||||
| 			end | ||||
| 		elseif slotseq_mode == 2 then | ||||
| 			local headpos = filtmeta:get_int("slotseq_index") | ||||
| 			table.sort(sposes, function (a, b) | ||||
| 				if a >= headpos then | ||||
| 					if b < headpos then return true end | ||||
| 				else | ||||
| 					if b >= headpos then return false end | ||||
| 				end | ||||
| 				return a < b | ||||
| 			end) | ||||
| 		end | ||||
| 		for _, spos in ipairs(sposes) do | ||||
| 			local stack = frominv:get_stack(frominvname, spos) | ||||
| 			local doRemove = stack:get_count() | ||||
| 			if fromtube.can_remove then | ||||
| 				doRemove = fromtube.can_remove(frompos, fromnode, stack, dir, frominvname, spos) | ||||
| 			elseif fromdef.allow_metadata_inventory_take then | ||||
| 				doRemove = fromdef.allow_metadata_inventory_take(frompos, frominvname,spos, stack, fakePlayer) | ||||
| 			end | ||||
| 			-- stupid lack of continue statements grumble | ||||
| 			if doRemove > 0 then | ||||
| 				if slotseq_mode == 2 then | ||||
| 					local nextpos = spos + 1 | ||||
| 					if nextpos > frominv:get_size(frominvname) then | ||||
| 						nextpos = 1 | ||||
| 					end | ||||
| 					filtmeta:set_int("slotseq_index", nextpos) | ||||
| 					set_filter_infotext(data, filtmeta) | ||||
| 				end | ||||
| 				local item | ||||
| 				local count | ||||
| 				if data.stackwise then | ||||
| 					count = math.min(stack:get_count(), doRemove) | ||||
| 					if filterfor.count and (filterfor.count > 1 or data.digiline) then | ||||
| 						if exmatch_mode ~= 0 and filterfor.count > count then | ||||
| 							return false -- not enough, fail | ||||
| 						else | ||||
| 							-- limit quantity to filter amount | ||||
| 							count = math.min(filterfor.count, count) | ||||
| 						end | ||||
| 					end | ||||
| 				else | ||||
| 					count = 1 | ||||
| 				end | ||||
| 				if fromtube.remove_items then | ||||
| 					-- it could be the entire stack... | ||||
| 					item = fromtube.remove_items(frompos, fromnode, stack, dir, count, frominvname, spos) | ||||
| 				else | ||||
| 					item = stack:take_item(count) | ||||
| 					frominv:set_stack(frominvname, spos, stack) | ||||
| 					if fromdef.on_metadata_inventory_take then | ||||
| 						fromdef.on_metadata_inventory_take(frompos, frominvname, spos, item, fakePlayer) | ||||
| 					end | ||||
| 				end | ||||
| 				local pos = vector.add(frompos, vector.multiply(dir, 1.4)) | ||||
| 				local start_pos = vector.add(frompos, dir) | ||||
| 				local item1 = pipeworks.tube_inject_item(pos, start_pos, dir, item, fakePlayer:get_player_name()) | ||||
| 				return true -- only fire one item, please | ||||
| 			end | ||||
| 		end | ||||
| 		return false | ||||
| 	end | ||||
|  | ||||
| 	for _, frominvname in ipairs(type(fromtube.input_inventory) == "table" and fromtube.input_inventory or {fromtube.input_inventory}) do | ||||
| 		local done = false | ||||
| 		for _, filterfor in ipairs(filters) do | ||||
| 			if grabAndFire(data, slotseq_mode, exact_match, filtmeta, frominv, frominvname, frompos, fromnode, filterfor, fromtube, fromdef, dir, fakePlayer, data.stackwise, data.digiline) then | ||||
| 			if grabAndFire(frominvname, filterfor) then | ||||
| 				done = true | ||||
| 				break | ||||
| 			end | ||||
| @@ -344,23 +349,23 @@ end | ||||
| for _, data in ipairs({ | ||||
| 	{ | ||||
| 		name = "filter", | ||||
| 		wise_desc = "Itemwise", | ||||
| 		wise_desc = S("Itemwise"), | ||||
| 		stackwise = false, | ||||
| 	}, | ||||
| 	{ | ||||
| 		name = "mese_filter", | ||||
| 		wise_desc = "Stackwise", | ||||
| 		wise_desc = S("Stackwise"), | ||||
| 		stackwise = true, | ||||
| 	}, | ||||
| 	{ -- register even if no digilines | ||||
| 		name = "digiline_filter", | ||||
| 		wise_desc = "Digiline", | ||||
| 		wise_desc = S("Digiline"), | ||||
| 		stackwise = true, | ||||
| 		digiline = true, | ||||
| 	}, | ||||
| }) do | ||||
| 	local node = { | ||||
| 		description = data.wise_desc.." Filter-Injector", | ||||
| 		description = S("@1 Filter-Injector", data.wise_desc), | ||||
| 		tiles = { | ||||
| 			"pipeworks_"..data.name.."_top.png", | ||||
| 			"pipeworks_"..data.name.."_top.png", | ||||
|   | ||||
							
								
								
									
										7
									
								
								init.lua
									
									
									
									
									
								
							
							
						
						
									
										7
									
								
								init.lua
									
									
									
									
									
								
							| @@ -10,6 +10,7 @@ local DEBUG = false | ||||
|  | ||||
| pipeworks.worldpath = minetest.get_worldpath() | ||||
| pipeworks.modpath = minetest.get_modpath("pipeworks") | ||||
| local S = minetest.get_translator("pipeworks") | ||||
|  | ||||
| dofile(pipeworks.modpath.."/default_settings.lua") | ||||
| -- Read the external config file if it exists. | ||||
| @@ -45,7 +46,7 @@ pipeworks.liquid_texture = "default_water.png" | ||||
| 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"} | ||||
| pipeworks.button_base  = "image_button[0,4.3;1,0.6" | ||||
| pipeworks.button_label = "label[0.9,4.31;Allow splitting incoming stacks from tubes]" | ||||
| pipeworks.button_label = "label[0.9,4.31;"..S("Allow splitting incoming stacks from tubes").."]" | ||||
|  | ||||
| -- Helper functions | ||||
|  | ||||
| @@ -102,6 +103,10 @@ if pipeworks.toggles.finite_water == nil then | ||||
| 	dofile(pipeworks.modpath.."/autodetect-finite-water.lua") | ||||
| end | ||||
|  | ||||
| if minetest.get_modpath("signs_lib") then | ||||
| 	dofile(pipeworks.modpath.."/signs_compat.lua") | ||||
| end | ||||
|  | ||||
| dofile(pipeworks.modpath.."/common.lua") | ||||
| dofile(pipeworks.modpath.."/models.lua") | ||||
| dofile(pipeworks.modpath.."/autoplace_pipes.lua") | ||||
|   | ||||
| @@ -61,7 +61,7 @@ local crunch_tube = function(pos, cnode, cmeta) | ||||
| 		local itemcount = tube_item_count[h] or 0 | ||||
| 		if itemcount > max_tube_limit then | ||||
| 			cmeta:set_string("the_tube_was", minetest.serialize(cnode)) | ||||
| 			print("[Pipeworks] Warning - a tube at "..minetest.pos_to_string(pos).." broke due to too many items ("..itemcount..")") | ||||
| 			pipeworks.logger("Warning - a tube at "..minetest.pos_to_string(pos).." broke due to too many items ("..itemcount..")") | ||||
| 			minetest.swap_node(pos, {name = "pipeworks:broken_tube_1"}) | ||||
| 			pipeworks.scan_for_tube_objects(pos) | ||||
| 		end | ||||
|   | ||||
| @@ -1,3 +1,4 @@ | ||||
| local S = minetest.get_translator("pipeworks") | ||||
|  | ||||
| if not minetest.get_modpath("auto_tree_tap") and  | ||||
|   minetest.get_modpath("technic") then | ||||
| @@ -20,7 +21,7 @@ if not minetest.get_modpath("auto_tree_tap") and | ||||
| 	}) | ||||
|  | ||||
| 	minetest.register_node(":auto_tree_tap:off", { | ||||
| 		description = "Auto-Tap", | ||||
| 		description = S("Auto-Tap"), | ||||
| 		tiles = {"pipeworks_nodebreaker_top_off.png","pipeworks_nodebreaker_bottom_off.png","pipeworks_nodebreaker_side2_off.png","pipeworks_nodebreaker_side1_off.png", | ||||
| 			"pipeworks_nodebreaker_back.png","pipeworks_nodebreaker_front_off.png"}, | ||||
| 		is_ground_content = true, | ||||
|   | ||||
							
								
								
									
										112
									
								
								locale/pipeworks.fr.tr
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										112
									
								
								locale/pipeworks.fr.tr
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,112 @@ | ||||
| # textdomain: pipeworks | ||||
|  | ||||
| # License: CC-by-SA 4.0 | ||||
| # Author: Louis Royer <4259825-lroyer@users.noreply.gitlab.com> | ||||
|  | ||||
| ## digilines interfacing | ||||
| Channel=Canal | ||||
|  | ||||
| ## init | ||||
| Allow splitting incoming stacks from tubes=Séparer les piles venant des tubes | ||||
|  | ||||
| ## autocrafter | ||||
| Unknown item=Item inconnu | ||||
| unconfigured Autocrafter: unknown recipe=Autocrafteur non-configuré : recette inconnue | ||||
| unconfigured Autocrafter=Autocrafteur non-configuré | ||||
| '@1' Autocrafter (@2)=Autocrafteur de '@1' (@2) | ||||
| Save=Valider | ||||
| paused '@1' Autocrafter=Autocrafteur de '@1' en pause | ||||
| Autocrafter=Autocrafteur | ||||
|  | ||||
| ## compat-furnaces | ||||
| Allow splitting incoming material (not fuel) stacks from tubes=Séparer les piles (sauf le carburant) venant des tubes | ||||
|  | ||||
| ## decorative tubes | ||||
| Airtight steelblock embedded tube=Tube hermétique intégré à un bloc d’acier | ||||
| Airtight panel embedded tube=Tube hermétique intégré à un panneau | ||||
|  | ||||
| ## devices | ||||
| Pump/Intake Module=Module de pompage et d’admission | ||||
| Valve=Vanne | ||||
| Decorative grating=Grillage décoratif | ||||
| Spigot outlet=Sortie de robinet | ||||
| Airtight Pipe entry/exit=Extrémité de tube hermétique | ||||
| Flow Sensor=Détecteur de débit | ||||
| Flow sensor (on)=Détecteur de débit (actif) | ||||
| empty=vide | ||||
| @1% full=plein à @1 % | ||||
| Expansion Tank (@1)=Réservoir d’expansion (@1) | ||||
| Fluid Storage Tank (@1)=Réservoir de liquides (@1) | ||||
| Fountainhead=Tête de fontaine | ||||
| Straight-only Pipe=Tuyau droit | ||||
|  | ||||
| ## filter-injector | ||||
| (slot #@1 next)=(slot suivant : #@1) | ||||
| @1 Filter-Injector=Filtre-injecteur @1 | ||||
| Sequence slots by Priority=Ordonner par priorité | ||||
| Sequence slots Randomly=Ordonner aléatoirement | ||||
| Sequence slots by Rotation=Ordonner en rotation | ||||
| Exact match - off=Filtrage inactif | ||||
| Exact match - on=Filtrage actif | ||||
| Prefer item types:=Items à filtrer : | ||||
| Itemwise=par item | ||||
| Stackwise=par piles d’items | ||||
| Digiline=digiline | ||||
|  | ||||
| ## legacy | ||||
| Auto-Tap=Robinet d’arbre automatique | ||||
|  | ||||
| ## pipes | ||||
| Pipe Segment=Segment de tuyau | ||||
| Pipe Segment (legacy)=Segment de tuyau (obsolète) | ||||
|  | ||||
|  | ||||
| ## routing tubes | ||||
| Pneumatic tube segment=Segment de tuyau pneumatique | ||||
| Broken Tube=Tuyau cassé | ||||
| High Priority Tube Segment=Segment de tuyau haute priorité | ||||
| Accelerating Pneumatic Tube Segment=Segment de tuyau pneumatique accélérante | ||||
| Crossing Pneumatic Tube Segment=Intersection de tuyau pneumatique | ||||
| One way tube=Tuyau unidirectionnel | ||||
|  | ||||
| ## signal tubes | ||||
| Detecting Pneumatic Tube Segment on=Segment de tuyau pneumatique avec détecteur (actif) | ||||
| Detecting Pneumatic Tube Segment=Segment de tuyau pneumatique avec détecteur | ||||
| Digiline Detecting Pneumatic Tube Segment=Segment de tuyau pneumatique avec détecteur digiline | ||||
| Digiline Detecting Tube=Tuyau avec détecteur digiline | ||||
| Conducting Pneumatic Tube Segment=Segment de tuyau pneumatique conducteur | ||||
| Conducting Pneumatic Tube Segment on=Segment de tuyau pneumatique conducteur actif | ||||
| Digiline Conducting Pneumatic Tube Segment=Segment de tuyau pneumatique conducteur digiline | ||||
| Mesecon and Digiline Conducting Pneumatic Tube Segment=Segment de tuyau pneumatique conducteur mesecon et digiline | ||||
| Mesecon and Digiline Conducting Pneumatic Tube Segment on=Segment de tuyau pneumatique conducteur mesecon et digiline (actif) | ||||
|  | ||||
| ## sorting tubes | ||||
| Sorting Pneumatic Tube Segment=Segment de tuyau pneumatique triant | ||||
| Sorting pneumatic tube=Tuyau pneumatique triant | ||||
|  | ||||
| ## teleport tube | ||||
| Receive=Reception | ||||
| channels are public by default=Les canaux sont publics par défaut | ||||
| use <player>:<channel> for fully private channels=Utilisez <joueur>:<canal> pour un canal entièrement privé | ||||
| use <player>;<channel> for private receivers=Utilisez <joueur>;<canal> pour une réception privée | ||||
| Teleporting Pneumatic Tube Segment=Segment de tuyau pneumatique téléporteur | ||||
| unconfigured Teleportation Tube=Tuyau téléporteur non-configuré | ||||
| Sorry, channel '@1' is reserved for exclusive use by @2=Désolé, le canal '@1' est réservé exclusivement à l’utilisateur @2. | ||||
| Sorry, receiving from channel '@1' is reserved for @2=Désolé, la réception depuis le canal '@1' est réservée pour @2. | ||||
| Teleportation Tube @1 on '@2'=Tuyau de téléportation @1 sur '@2' | ||||
|  | ||||
| ## trashcan | ||||
| Trash Can=Poubelle | ||||
|  | ||||
| ## tube registration | ||||
| Pneumatic tube segment (legacy)=Segment de tuyau pneumatique (obsolète) | ||||
|  | ||||
| ## vacuum tubes | ||||
| Vacuuming Pneumatic Tube Segment=Segment de tuyau pneumatique aspirant | ||||
| Adjustable Vacuuming Pneumatic Tube Segment=Segment de tuyau pneumatique aspirant réglable | ||||
| Adjustable Vacuuming Pneumatic Tube Segment (@1m)=Segment de tuyau pneumatique aspirant réglable (@1 m) | ||||
|  | ||||
| ## wielder | ||||
| Node Breaker=Casseur de blocs | ||||
| Deployer=Poseur de blocs | ||||
| Dispenser=Distributeur | ||||
							
								
								
									
										112
									
								
								locale/template.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										112
									
								
								locale/template.txt
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,112 @@ | ||||
| # textdomain: pipeworks | ||||
|  | ||||
| # License: CC-by-SA 4.0 | ||||
| # Author: | ||||
|  | ||||
| ## digilines interfacing | ||||
| Channel= | ||||
|  | ||||
| ## init | ||||
| Allow splitting incoming stacks from tubes= | ||||
|  | ||||
| ## autocrafter | ||||
| Unknown item= | ||||
| unconfigured Autocrafter: unknown recipe= | ||||
| unconfigured Autocrafter= | ||||
| '@1' Autocrafter (@2)= | ||||
| Save= | ||||
| paused '@1' Autocrafter= | ||||
| Autocrafter= | ||||
|  | ||||
| ## compat-furnaces | ||||
| Allow splitting incoming material (not fuel) stacks from tubes= | ||||
|  | ||||
| ## decorative tubes | ||||
| Airtight steelblock embedded tube= | ||||
| Airtight panel embedded tube= | ||||
|  | ||||
| ## devices | ||||
| Pump/Intake Module= | ||||
| Valve= | ||||
| Decorative grating= | ||||
| Spigot outlet= | ||||
| Airtight Pipe entry/exit= | ||||
| Flow Sensor= | ||||
| Flow sensor (on)= | ||||
| empty= | ||||
| @1% full= | ||||
| Expansion Tank (@1)= | ||||
| Fluid Storage Tank (@1)= | ||||
| Fountainhead= | ||||
| Straight-only Pipe= | ||||
|  | ||||
| ## filter-injector | ||||
| (slot #@1 next)= | ||||
| @1 Filter-Injector= | ||||
| Sequence slots by Priority= | ||||
| Sequence slots Randomly= | ||||
| Sequence slots by Rotation= | ||||
| Exact match - off= | ||||
| Exact match - on= | ||||
| Prefer item types:= | ||||
| Itemwise= | ||||
| Stackwise= | ||||
| Digiline= | ||||
|  | ||||
| ## legacy | ||||
| Auto-Tap= | ||||
|  | ||||
| ## pipes | ||||
| Pipe Segment= | ||||
| Pipe Segment (legacy)= | ||||
|  | ||||
|  | ||||
| ## routing tubes | ||||
| Pneumatic tube segment= | ||||
| Broken Tube= | ||||
| High Priority Tube Segment= | ||||
| Accelerating Pneumatic Tube Segment= | ||||
| Crossing Pneumatic Tube Segment= | ||||
| One way tube= | ||||
|  | ||||
| ## signal tubes | ||||
| Detecting Pneumatic Tube Segment on= | ||||
| Detecting Pneumatic Tube Segment= | ||||
| Digiline Detecting Pneumatic Tube Segment= | ||||
| Digiline Detecting Tube= | ||||
| Conducting Pneumatic Tube Segment= | ||||
| Conducting Pneumatic Tube Segment on= | ||||
| Digiline Conducting Pneumatic Tube Segment= | ||||
| Mesecon and Digiline Conducting Pneumatic Tube Segment= | ||||
| Mesecon and Digiline Conducting Pneumatic Tube Segment on= | ||||
|  | ||||
| ## sorting tubes | ||||
| Sorting Pneumatic Tube Segment= | ||||
| Sorting pneumatic tube= | ||||
|  | ||||
| ## teleport tube | ||||
| Receive= | ||||
| channels are public by default= | ||||
| use <player>:<channel> for fully private channels= | ||||
| use <player>;<channel> for private receivers= | ||||
| Teleporting Pneumatic Tube Segment= | ||||
| unconfigured Teleportation Tube= | ||||
| Sorry, channel '@1' is reserved for exclusive use by @2= | ||||
| Sorry, receiving from channel '@1' is reserved for @2= | ||||
| Teleportation Tube @1 on '@2'= | ||||
|  | ||||
| ## trashcan | ||||
| Trash Can= | ||||
|  | ||||
| ## tube registration | ||||
| Pneumatic tube segment (legacy)= | ||||
|  | ||||
| ## vacuum tubes | ||||
| Vacuuming Pneumatic Tube Segment= | ||||
| Adjustable Vacuuming Pneumatic Tube Segment= | ||||
| Adjustable Vacuuming Pneumatic Tube Segment (@1m)= | ||||
|  | ||||
| ## wielder | ||||
| Node Breaker= | ||||
| Deployer= | ||||
| Dispenser= | ||||
| @@ -24,7 +24,7 @@ | ||||
| -- use too much memory from the sandbox. | ||||
| -- You can add more functions to the environment | ||||
| -- (see where local env is defined) | ||||
| -- Something nice to play is is appending minetest.env to it. | ||||
| -- Something nice to play is appending minetest.env to it. | ||||
|  | ||||
| local BASENAME = "pipeworks:lua_tube" | ||||
|  | ||||
|   | ||||
							
								
								
									
										3
									
								
								mod.conf
									
									
									
									
									
								
							
							
						
						
									
										3
									
								
								mod.conf
									
									
									
									
									
								
							| @@ -1 +1,4 @@ | ||||
| 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 | ||||
|   | ||||
							
								
								
									
										21
									
								
								pipes.lua
									
									
									
									
									
								
							
							
						
						
									
										21
									
								
								pipes.lua
									
									
									
									
									
								
							| @@ -1,4 +1,5 @@ | ||||
| -- This file supplies the steel pipes | ||||
| local S = minetest.get_translator("pipeworks") | ||||
|  | ||||
| local REGISTER_COMPATIBILITY = true | ||||
|  | ||||
| @@ -35,11 +36,11 @@ for index, connects in ipairs(cconnects) do | ||||
| 	end | ||||
| 	 | ||||
| 	local pgroups = {snappy = 3, pipe = 1, not_in_creative_inventory = 1} | ||||
| 	local pipedesc = "Pipe segement".." "..dump(connects).."... You hacker, you." | ||||
| 	local pipedesc = S("Pipe Segment").." "..dump(connects) | ||||
|  | ||||
| 	if #connects == 0 then | ||||
| 		pgroups = {snappy = 3, tube = 1} | ||||
| 		pipedesc = "Pipe segment" | ||||
| 		pipedesc = S("Pipe Segment") | ||||
| 	end | ||||
| 	 | ||||
| 	local outimg_e = { "pipeworks_pipe_plain.png" } | ||||
| @@ -73,7 +74,7 @@ for index, connects in ipairs(cconnects) do | ||||
| 			fixed = outsel | ||||
| 		}, | ||||
| 		groups = pgroups, | ||||
| 		sounds = default.node_sound_wood_defaults(), | ||||
| 		sounds = default.node_sound_metal_defaults(), | ||||
| 		walkable = true, | ||||
| 		drop = "pipeworks:pipe_1_empty", | ||||
| 		after_place_node = function(pos) | ||||
| @@ -82,7 +83,10 @@ for index, connects in ipairs(cconnects) do | ||||
| 		after_dig_node = function(pos) | ||||
| 			pipeworks.scan_for_pipe_objects(pos) | ||||
| 		end, | ||||
| 		on_rotate = false | ||||
| 		on_rotate = false, | ||||
| 		check_for_pole = pipeworks.check_for_vert_pipe, | ||||
| 		check_for_horiz_pole = pipeworks.check_for_horiz_pipe, | ||||
| 		pipenumber = index | ||||
| 	}) | ||||
| 	 | ||||
| 	local pgroups = {snappy = 3, pipe = 1, not_in_creative_inventory = 1} | ||||
| @@ -104,7 +108,7 @@ for index, connects in ipairs(cconnects) do | ||||
| 			fixed = outsel | ||||
| 		}, | ||||
| 		groups = pgroups, | ||||
| 		sounds = default.node_sound_wood_defaults(), | ||||
| 		sounds = default.node_sound_metal_defaults(), | ||||
| 		walkable = true, | ||||
| 		drop = "pipeworks:pipe_1_empty", | ||||
| 		after_place_node = function(pos) | ||||
| @@ -114,7 +118,10 @@ for index, connects in ipairs(cconnects) do | ||||
| 		after_dig_node = function(pos) | ||||
| 			pipeworks.scan_for_pipe_objects(pos) | ||||
| 		end, | ||||
| 		on_rotate = false | ||||
| 		on_rotate = false, | ||||
| 		check_for_pole = pipeworks.check_for_vert_pipe, | ||||
| 		check_for_horiz_pole = pipeworks.check_for_horiz_pipe, | ||||
| 		pipenumber = index | ||||
| 	}) | ||||
| 	 | ||||
| 	local emptypipe = "pipeworks:pipe_"..index.."_empty" | ||||
| @@ -134,7 +141,7 @@ if REGISTER_COMPATIBILITY then | ||||
| 		drawtype = "airlike", | ||||
| 		sunlight_propagates = true, | ||||
| 		paramtype = "light", | ||||
| 		description = "Pipe Segment (legacy)", | ||||
| 		description = S("Pipe Segment (legacy)"), | ||||
| 		groups = {not_in_creative_inventory = 1, pipe_to_update = 1}, | ||||
| 		drop = "pipeworks:pipe_1_empty", | ||||
| 		after_place_node = function(pos) | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
|  | ||||
| local S = minetest.get_translator("pipeworks") | ||||
| -- the default tube and default textures | ||||
| pipeworks.register_tube("pipeworks:tube", "Pneumatic tube segment") | ||||
| pipeworks.register_tube("pipeworks:tube", S("Pneumatic tube segment")) | ||||
| minetest.register_craft( { | ||||
| 	output = "pipeworks:tube_1 6", | ||||
| 	recipe = { | ||||
| @@ -13,7 +13,7 @@ minetest.register_craft( { | ||||
| local nodecolor = 0xffff3030 | ||||
|  | ||||
| pipeworks.register_tube("pipeworks:broken_tube", { | ||||
| 	description = "Broken Tube (you hacker you)", | ||||
| 	description = S("Broken Tube"), | ||||
| 	plain = { { name = "pipeworks_broken_tube_plain.png", backface_culling = false, color = nodecolor } }, | ||||
| 	noctr = { { name = "pipeworks_broken_tube_plain.png", backface_culling = false, color = nodecolor } }, | ||||
| 	ends  = { { name = "pipeworks_broken_tube_end.png",   color = nodecolor } }, | ||||
| @@ -35,7 +35,7 @@ pipeworks.register_tube("pipeworks:broken_tube", { | ||||
| 			local itemstack = puncher:get_wielded_item() | ||||
| 			local wieldname = itemstack:get_name() | ||||
| 			local playername = puncher:get_player_name() | ||||
| 			print("[Pipeworks] "..playername.." struck a broken tube at "..minetest.pos_to_string(pos)) | ||||
| 			local log_msg = playername.." struck a broken tube at "..minetest.pos_to_string(pos).."\n" | ||||
| 			if   wieldname == "anvil:hammer" | ||||
| 			  or wieldname == "cottages:hammer" | ||||
| 			  or wieldname == "glooptest:hammer_steel" | ||||
| @@ -47,17 +47,17 @@ pipeworks.register_tube("pipeworks:broken_tube", { | ||||
| 				local meta = minetest.get_meta(pos) | ||||
| 				local was_node = minetest.deserialize(meta:get_string("the_tube_was")) | ||||
| 				if was_node and was_node ~= "" then | ||||
| 					print("            with "..wieldname.." to repair it.") | ||||
| 					pipeworks.logger(log_msg.."            with "..wieldname.." to repair it.") | ||||
| 					minetest.swap_node(pos, { name = was_node.name, param2 = was_node.param2 }) | ||||
| 					pipeworks.scan_for_tube_objects(pos) | ||||
| 					itemstack:add_wear(1000) | ||||
| 					puncher:set_wielded_item(itemstack) | ||||
| 					return itemstack | ||||
| 				else | ||||
| 					print("            but it can't be repaired.") | ||||
| 					pipeworks.logger(log_msg.."            but it can't be repaired.") | ||||
| 				end | ||||
| 			else | ||||
| 				print("            with "..wieldname.." but that tool is too weak.") | ||||
| 				pipeworks.logger(log_msg.."            with "..wieldname.." but that tool is too weak.") | ||||
| 			end | ||||
| 		end | ||||
| 	} | ||||
| @@ -69,7 +69,7 @@ pipeworks.register_tube("pipeworks:broken_tube", { | ||||
| if pipeworks.enable_priority_tube then | ||||
| 	local color = "#ff3030:128" | ||||
| 	pipeworks.register_tube("pipeworks:priority_tube", { | ||||
| 			description = "High Priority Tube Segment", | ||||
| 			description = S("High Priority Tube Segment"), | ||||
| 			inventory_image = "pipeworks_tube_inv.png^[colorize:" .. color, | ||||
| 			plain = { { name = "pipeworks_tube_plain.png", color = nodecolor } }, | ||||
| 			noctr = { { name = "pipeworks_tube_noctr.png", color = nodecolor } }, | ||||
| @@ -91,7 +91,7 @@ end | ||||
|  | ||||
| if pipeworks.enable_accelerator_tube then | ||||
| 	pipeworks.register_tube("pipeworks:accelerator_tube", { | ||||
| 			description = "Accelerating Pneumatic Tube Segment", | ||||
| 			description = S("Accelerating Pneumatic Tube Segment"), | ||||
| 			inventory_image = "pipeworks_accelerator_tube_inv.png", | ||||
| 			plain = { "pipeworks_accelerator_tube_plain.png" }, | ||||
| 			noctr = { "pipeworks_accelerator_tube_noctr.png" }, | ||||
| @@ -116,7 +116,7 @@ end | ||||
|  | ||||
| if pipeworks.enable_crossing_tube then | ||||
| 	pipeworks.register_tube("pipeworks:crossing_tube", { | ||||
| 			description = "Crossing Pneumatic Tube Segment", | ||||
| 			description = S("Crossing Pneumatic Tube Segment"), | ||||
| 			inventory_image = "pipeworks_crossing_tube_inv.png", | ||||
| 			plain = { "pipeworks_crossing_tube_plain.png" }, | ||||
| 			noctr = { "pipeworks_crossing_tube_noctr.png" }, | ||||
| @@ -138,7 +138,7 @@ end | ||||
|  | ||||
| if pipeworks.enable_one_way_tube then | ||||
| 	minetest.register_node("pipeworks:one_way_tube", { | ||||
| 		description = "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"}, | ||||
| 		paramtype2 = "facedir", | ||||
| @@ -162,6 +162,8 @@ if pipeworks.enable_one_way_tube then | ||||
| 		after_place_node = pipeworks.after_place, | ||||
| 		after_dig_node = pipeworks.after_dig, | ||||
| 		on_rotate = pipeworks.on_rotate, | ||||
| 		check_for_pole = pipeworks.check_for_vert_tube, | ||||
| 		check_for_horiz_pole = pipeworks.check_for_horiz_tube | ||||
| 	}) | ||||
| 	minetest.register_craft({ | ||||
| 		output = "pipeworks:one_way_tube 2", | ||||
|   | ||||
| @@ -1,7 +1,8 @@ | ||||
| local S = minetest.get_translator("pipeworks") | ||||
| if pipeworks.enable_detector_tube then | ||||
| 	local detector_tube_step = 5 * tonumber(minetest.settings:get("dedicated_server_step")) | ||||
| 	pipeworks.register_tube("pipeworks:detector_tube_on", { | ||||
| 			description = "Detecting Pneumatic Tube Segment on (you hacker you)", | ||||
| 			description = S("Detecting Pneumatic Tube Segment on"), | ||||
| 			inventory_image = "pipeworks_detector_tube_inv.png", | ||||
| 			plain = { "pipeworks_detector_tube_plain.png" }, | ||||
| 			node_def = { | ||||
| @@ -40,7 +41,7 @@ if pipeworks.enable_detector_tube then | ||||
| 			}, | ||||
| 	}) | ||||
| 	pipeworks.register_tube("pipeworks:detector_tube_off", { | ||||
| 			description = "Detecting Pneumatic Tube Segment", | ||||
| 			description = S("Detecting Pneumatic Tube Segment"), | ||||
| 			inventory_image = "pipeworks_detector_tube_inv.png", | ||||
| 			plain = { "pipeworks_detector_tube_plain.png" }, | ||||
| 			node_def = { | ||||
| @@ -70,7 +71,7 @@ end | ||||
| local digiline_enabled = minetest.get_modpath("digilines") ~= nil | ||||
| if digiline_enabled and pipeworks.enable_digiline_detector_tube then | ||||
| 	pipeworks.register_tube("pipeworks:digiline_detector_tube", { | ||||
| 			description = "Digiline Detecting Pneumatic Tube Segment", | ||||
| 			description = S("Digiline Detecting Pneumatic Tube Segment"), | ||||
| 			inventory_image = "pipeworks_digiline_detector_tube_inv.png", | ||||
| 			plain = { "pipeworks_digiline_detector_tube_plain.png" }, | ||||
| 			node_def = { | ||||
| @@ -87,9 +88,9 @@ if digiline_enabled and pipeworks.enable_digiline_detector_tube then | ||||
| 					local meta = minetest.get_meta(pos) | ||||
| 					meta:set_string("formspec", | ||||
| 						"size[8.6,2.2]".. | ||||
| 						"field[0.6,0.6;8,1;channel;Channel:;${channel}]".. | ||||
| 						"field[0.6,0.6;8,1;channel;"..S("Channel")..";${channel}]".. | ||||
| 						"image[0.3,1.3;1,1;pipeworks_digiline_detector_tube_inv.png]".. | ||||
| 						"label[1.6,1.2;Digiline Detecting Tube]" | ||||
| 						"label[1.6,1.2;"..S("Digiline Detecting Tube").."]" | ||||
| 					) | ||||
| 				end, | ||||
| 				on_receive_fields = function(pos, formname, fields, sender) | ||||
| @@ -122,7 +123,7 @@ end | ||||
|  | ||||
| if pipeworks.enable_conductor_tube then | ||||
| 	pipeworks.register_tube("pipeworks:conductor_tube_off", { | ||||
| 			description = "Conducting Pneumatic Tube Segment", | ||||
| 			description = S("Conducting Pneumatic Tube Segment"), | ||||
| 			inventory_image = "pipeworks_conductor_tube_inv.png", | ||||
| 			short = "pipeworks_conductor_tube_short.png", | ||||
| 			plain = { "pipeworks_conductor_tube_plain.png" }, | ||||
| @@ -136,7 +137,7 @@ if pipeworks.enable_conductor_tube then | ||||
| 			}, | ||||
| 	}) | ||||
| 	pipeworks.register_tube("pipeworks:conductor_tube_on", { | ||||
| 			description = "Conducting Pneumatic Tube Segment on (you hacker you)", | ||||
| 			description = S("Conducting Pneumatic Tube Segment on"), | ||||
| 			inventory_image = "pipeworks_conductor_tube_inv.png", | ||||
| 			short = "pipeworks_conductor_tube_short.png", | ||||
| 			plain = { "pipeworks_conductor_tube_on_plain.png" }, | ||||
| @@ -160,7 +161,7 @@ end | ||||
|  | ||||
| if digiline_enabled and pipeworks.enable_digiline_conductor_tube then | ||||
| 	pipeworks.register_tube("pipeworks:digiline_conductor_tube", { | ||||
| 		description = "Digiline Conducting Pneumatic Tube Segment", | ||||
| 		description = S("Digiline Conducting Pneumatic Tube Segment"), | ||||
| 		inventory_image = "pipeworks_tube_inv.png^pipeworks_digiline_conductor_tube_inv.png", | ||||
| 		short = "pipeworks_tube_short.png^pipeworks_digiline_conductor_tube_short.png", | ||||
| 		plain = {"pipeworks_tube_plain.png^pipeworks_digiline_conductor_tube_plain.png"}, | ||||
| @@ -178,7 +179,7 @@ end | ||||
| if digiline_enabled and pipeworks.enable_digiline_conductor_tube and | ||||
| 		pipeworks.enable_conductor_tube then | ||||
| 	pipeworks.register_tube("pipeworks:mesecon_and_digiline_conductor_tube_off", { | ||||
| 		description = "Mesecon and Digiline Conducting Pneumatic Tube Segment", | ||||
| 		description = S("Mesecon and Digiline Conducting Pneumatic Tube Segment"), | ||||
| 		inventory_image = "pipeworks_conductor_tube_inv.png^pipeworks_digiline_conductor_tube_inv.png", | ||||
| 		short = "pipeworks_conductor_tube_short.png^pipeworks_digiline_conductor_tube_short.png", | ||||
| 		plain = {"pipeworks_conductor_tube_plain.png^pipeworks_digiline_conductor_tube_plain.png"}, | ||||
| @@ -195,7 +196,7 @@ if digiline_enabled and pipeworks.enable_digiline_conductor_tube and | ||||
| 		}, | ||||
| 	}) | ||||
| 	pipeworks.register_tube("pipeworks:mesecon_and_digiline_conductor_tube_on", { | ||||
| 		description = "Mesecon and Digiline Conducting Pneumatic Tube Segment on (you hacker you)", | ||||
| 		description = S("Mesecon and Digiline Conducting Pneumatic Tube Segment on"), | ||||
| 		inventory_image = "pipeworks_conductor_tube_inv.png^pipeworks_digiline_conductor_tube_inv.png", | ||||
| 		short = "pipeworks_conductor_tube_short.png^pipeworks_digiline_conductor_tube_short.png", | ||||
| 		plain = {"pipeworks_conductor_tube_on_plain.png^pipeworks_digiline_conductor_tube_plain.png"}, | ||||
|   | ||||
							
								
								
									
										241
									
								
								signs_compat.lua
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										241
									
								
								signs_compat.lua
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,241 @@ | ||||
| -- This file adds placement rules for signs_lib, if present | ||||
|  | ||||
| local spv = { | ||||
| 	[4] = true, | ||||
| 	[6] = true, | ||||
| 	[8] = true, | ||||
| 	[10] = true, | ||||
| 	[13] = true, | ||||
| 	[15] = true, | ||||
| 	[17] = true, | ||||
| 	[19] = true | ||||
| } | ||||
|  | ||||
| local sphns = { | ||||
| 	[1] = true, | ||||
| 	[3] = true, | ||||
| 	[5] = true, | ||||
| 	[7] = true, | ||||
| 	[9] = true, | ||||
| 	[11] = true, | ||||
| 	[21] = true, | ||||
| 	[23] = true | ||||
| } | ||||
|  | ||||
| local sphew = { | ||||
| 	[0] = true, | ||||
| 	[2] = true, | ||||
| 	[12] = true, | ||||
| 	[14] = true, | ||||
| 	[16] = true, | ||||
| 	[18] = true, | ||||
| 	[20] = true, | ||||
| 	[22] = true | ||||
| } | ||||
|  | ||||
| local owtv = { | ||||
| 	[5] = true, | ||||
| 	[7] = true, | ||||
| 	[9] = true, | ||||
| 	[11] = true, | ||||
| 	[12] = true, | ||||
| 	[14] = true, | ||||
| 	[16] = true, | ||||
| 	[18] = true | ||||
| } | ||||
|  | ||||
| local owtns = { | ||||
| 	[0] = true, | ||||
| 	[2] = true, | ||||
| 	[4] = true, | ||||
| 	[6] = true, | ||||
| 	[8] = true, | ||||
| 	[10] = true, | ||||
| 	[20] = true, | ||||
| 	[22] = true | ||||
| } | ||||
|  | ||||
| local owtew = { | ||||
| 	[1] = true, | ||||
| 	[3] = true, | ||||
| 	[13] = true, | ||||
| 	[15] = true, | ||||
| 	[17] = true, | ||||
| 	[19] = true, | ||||
| 	[21] = true, | ||||
| 	[23] = true | ||||
| } | ||||
|  | ||||
| local vert_n = { | ||||
| 	[3] = {[5] = true}, | ||||
| 	[6] = {[9] = true, [12] = true, [16] = true}, | ||||
| 	[7] = {[9] = true, [11] = true}, | ||||
| } | ||||
|  | ||||
| local vert_e = { | ||||
| 	[3] = {[5] = true}, | ||||
| 	[6] = {[5] = true, [9] = true, [16] = true}, | ||||
| 	[7] = {[7] = true, [11] = true}, | ||||
| } | ||||
|  | ||||
| local vert_s = { | ||||
| 	[3] = {[5] = true}, | ||||
| 	[6] = {[5] = true, [12] = true, [16] = true}, | ||||
| 	[7] = {[5] = true, [7] = true}, | ||||
| } | ||||
|  | ||||
| local vert_w = { | ||||
| 	[3] = {[5] = true}, | ||||
| 	[6] = {[5] = true, [9] = true, [12] = true}, | ||||
| 	[7] = {[5] = true, [9] = true}, | ||||
| } | ||||
|  | ||||
| local horiz_n = { | ||||
| 	[3] = {[0] = true}, | ||||
| 	[6] = {[0] = true, [4] = true, [20] = true}, | ||||
| 	[7] = {[2] = true, [10] = true}, | ||||
| 	[8] = {[0] = true}, | ||||
| 	[9] = {[2] = true}, | ||||
| } | ||||
|  | ||||
| local horiz_e = { | ||||
| 	[3] = {[1] = true}, | ||||
| 	[6] = {[1] = true, [17] = true, [21] = true}, | ||||
| 	[7] = {[3] = true, [19] = true}, | ||||
| 	[8] = {[1] = true}, | ||||
| 	[9] = {[3] = true}, | ||||
| } | ||||
|  | ||||
| local horiz_s = { | ||||
| 	[3] = {[0] = true}, | ||||
| 	[6] = {[0] = true, [8] = true, [20] = true}, | ||||
| 	[7] = {[0] = true, [4] = true}, | ||||
| 	[8] = {[0] = true}, | ||||
| 	[9] = {[0] = true}, | ||||
| } | ||||
|  | ||||
| local horiz_w = { | ||||
| 	[3] = {[1] = true}, | ||||
| 	[6] = {[1] = true, [13] = true, [21] = true}, | ||||
| 	[7] = {[1] = true, [13] = true}, | ||||
| 	[8] = {[1] = true}, | ||||
| 	[9] = {[1] = true}, | ||||
| } | ||||
|  | ||||
| local function get_sign_dir(node, def) | ||||
| 	if (node.param2 == 4 and def.paramtype2 == "wallmounted") | ||||
| 	  or (node.param2 == 0 and def.paramtype2 ~= "wallmounted") then | ||||
| 		return {["N"] = true} | ||||
| 	elseif (node.param2 == 2 and def.paramtype2 == "wallmounted") | ||||
| 	  or (node.param2 == 1 and def.paramtype2 ~= "wallmounted") then | ||||
| 		return {["E"] = true} | ||||
| 	elseif (node.param2 == 5 and def.paramtype2 == "wallmounted") | ||||
| 	  or (node.param2 == 2 and def.paramtype2 ~= "wallmounted") then | ||||
| 		return {["S"] = true} | ||||
| 	elseif node.param2 == 3 then | ||||
| 		return {["W"] = true} | ||||
| 	end | ||||
| 	return {} | ||||
| end | ||||
|  | ||||
| --[[ | ||||
| In the functions below: | ||||
|  | ||||
|  pos: the (real) position of the placed sign | ||||
|  node: the sign node itself | ||||
|  def: its definition | ||||
|  | ||||
|  ppos: the position of the pointed node (pipe/tube) | ||||
|  pnode: the node itself | ||||
|  pdef: its definition | ||||
|  | ||||
| --]] | ||||
|  | ||||
|  | ||||
| -- pipes | ||||
|  | ||||
| function pipeworks.check_for_vert_pipe(pos, node, def, ppos, pnode, pdef) | ||||
| 	local signdir = get_sign_dir(node, def) | ||||
| 	local pipenumber = pdef.pipenumber | ||||
| 	local pipedir = pnode.param2 | ||||
| 	if string.find(pnode.name, "straight_pipe") and spv[pipedir] then | ||||
| 		return true | ||||
| 	elseif signdir["N"] and vert_n[pipenumber] and vert_n[pipenumber][pipedir] then | ||||
| 		return true | ||||
| 	elseif signdir["E"] and vert_e[pipenumber] and vert_e[pipenumber][pipedir] then | ||||
| 		return true | ||||
| 	elseif signdir["S"] and vert_s[pipenumber] and vert_s[pipenumber][pipedir] then | ||||
| 		return true | ||||
| 	elseif signdir["W"] and vert_w[pipenumber] and vert_w[pipenumber][pipedir] then | ||||
| 		return true | ||||
| 	end | ||||
| end | ||||
|  | ||||
| function pipeworks.check_for_horiz_pipe(pos, node, def, ppos, pnode, pdef) | ||||
| 	local signdir = get_sign_dir(node, def) | ||||
| 	local pipenumber = pdef.pipenumber | ||||
| 	local pipedir = pnode.param2 | ||||
| 	if string.find(pnode.name, "straight_pipe") then | ||||
| 		if (signdir["N"] or signdir["S"]) and sphns[pipedir] then | ||||
| 			return true | ||||
| 		elseif (signdir["E"] or signdir["W"]) and sphew[pipedir] then | ||||
| 			return true | ||||
| 		end | ||||
| 	elseif signdir["N"] and horiz_n[pipenumber] and horiz_n[pipenumber][pipedir] then | ||||
| 		return true | ||||
| 	elseif signdir["E"] and horiz_e[pipenumber] and horiz_e[pipenumber][pipedir] then | ||||
| 		return true | ||||
| 	elseif signdir["S"] and horiz_s[pipenumber] and horiz_s[pipenumber][pipedir] then | ||||
| 		return true | ||||
| 	elseif signdir["W"] and horiz_w[pipenumber] and horiz_w[pipenumber][pipedir] then | ||||
| 		return true | ||||
| 	end | ||||
| end | ||||
|  | ||||
| -- tubes | ||||
|  | ||||
| function pipeworks.check_for_vert_tube(pos, node, def, ppos, pnode, pdef) | ||||
| 	local signdir = get_sign_dir(node, def) | ||||
| 	local tubenumber = pdef.tubenumber | ||||
| 	local tubedir = pnode.param2 | ||||
| 	if pnode.name == "pipeworks:one_way_tube" and owtv[tubedir] then | ||||
| 		return true | ||||
| 	elseif tubenumber == 2 and (tubedir == 5 or tubedir == 7) then -- it's a stub pointing up or down | ||||
| 		return true | ||||
| 	elseif signdir["N"] and vert_n[tubenumber] and vert_n[tubenumber][tubedir] then | ||||
| 		return true | ||||
| 	elseif signdir["E"] and vert_e[tubenumber] and vert_e[tubenumber][tubedir] then | ||||
| 		return true | ||||
| 	elseif signdir["S"] and vert_s[tubenumber] and vert_s[tubenumber][tubedir] then | ||||
| 		return true | ||||
| 	elseif signdir["W"] and vert_w[tubenumber] and vert_w[tubenumber][tubedir] then | ||||
| 		return true | ||||
| 	end | ||||
| end | ||||
|  | ||||
| function pipeworks.check_for_horiz_tube(pos, node, def, ppos, pnode, pdef) | ||||
| 	local signdir = get_sign_dir(node, def) | ||||
| 	local tubenumber = pdef.tubenumber | ||||
| 	local tubedir = pnode.param2 | ||||
| 	if tubenumber == 2 then -- it'a a stub pointing sideways | ||||
| 		if (tubedir == 0 or tubedir == 2) and (signdir["N"] or signdir["S"]) then | ||||
| 			return true | ||||
| 		elseif (tubedir == 1 or tubedir == 3) and (signdir["E"] or signdir["W"]) then | ||||
| 			return true | ||||
| 		end | ||||
| 	elseif pnode.name == "pipeworks:one_way_tube" then | ||||
| 		if (signdir["N"] or signdir["S"]) and owtns[tubedir] then | ||||
| 			return true | ||||
| 		elseif (signdir["E"] or signdir["W"]) and owtew[tubedir] then | ||||
| 			return true | ||||
| 		end | ||||
| 	elseif signdir["N"] and horiz_n[tubenumber] and horiz_n[tubenumber][tubedir] then | ||||
| 		return true | ||||
| 	elseif signdir["E"] and horiz_e[tubenumber] and horiz_e[tubenumber][tubedir] then | ||||
| 		return true | ||||
| 	elseif signdir["S"] and horiz_s[tubenumber] and horiz_s[tubenumber][tubedir] then | ||||
| 		return true | ||||
| 	elseif signdir["W"] and horiz_w[tubenumber] and horiz_w[tubenumber][tubedir] then | ||||
| 		return true | ||||
| 	end | ||||
| end | ||||
| @@ -1,3 +1,4 @@ | ||||
| local S = minetest.get_translator("pipeworks") | ||||
| local fs_helpers = pipeworks.fs_helpers | ||||
|  | ||||
| if pipeworks.enable_mese_tube then | ||||
| @@ -55,7 +56,7 @@ if pipeworks.enable_mese_tube then | ||||
| 	end | ||||
|  | ||||
| 	pipeworks.register_tube("pipeworks:mese_tube", { | ||||
| 			description = "Sorting Pneumatic Tube Segment", | ||||
| 			description = S("Sorting Pneumatic Tube Segment"), | ||||
| 			inventory_image = "pipeworks_mese_tube_inv.png", | ||||
| 			noctr = {"pipeworks_mese_tube_noctr_1.png", "pipeworks_mese_tube_noctr_2.png", "pipeworks_mese_tube_noctr_3.png", | ||||
| 				"pipeworks_mese_tube_noctr_4.png", "pipeworks_mese_tube_noctr_5.png", "pipeworks_mese_tube_noctr_6.png"}, | ||||
| @@ -107,7 +108,7 @@ if pipeworks.enable_mese_tube then | ||||
| 						inv:set_size("line"..tostring(i), 6*1) | ||||
| 					end | ||||
| 					update_formspec(pos) | ||||
| 					meta:set_string("infotext", "Sorting pneumatic tube") | ||||
| 					meta:set_string("infotext", S("Sorting pneumatic tube")) | ||||
| 				end, | ||||
| 				on_punch = update_formspec, | ||||
| 				on_receive_fields = function(pos, formname, fields, sender) | ||||
|   | ||||
| @@ -1,3 +1,4 @@ | ||||
| local S = minetest.get_translator("pipeworks") | ||||
| local filename=minetest.get_worldpath() .. "/teleport_tubes" | ||||
|  | ||||
| local tp_tube_db = nil -- nil forces a read | ||||
| @@ -127,19 +128,19 @@ local function update_meta(meta, can_receive) | ||||
| 	meta:set_int("can_receive", can_receive and 1 or 0) | ||||
| 	local cr_state = can_receive and "on" or "off" | ||||
| 	meta:set_string("formspec","size[8.6,2.2]".. | ||||
| 			"field[0.6,0.6;7,1;channel;Channel:;${channel}]".. | ||||
| 			"label[7.3,0;Receive]".. | ||||
| 			"field[0.6,0.6;7,1;channel;"..S("Channel")..";${channel}]".. | ||||
| 			"label[7.3,0;"..S("Receive").."]".. | ||||
| 			"image_button[7.3,0.3;1,0.6;pipeworks_button_" .. cr_state .. ".png;cr" .. (can_receive and 0 or 1) .. ";;;false;pipeworks_button_interm.png]".. | ||||
| 			"image[0.3,1.3;1,1;pipeworks_teleport_tube_inv.png]".. | ||||
| 			"label[1.6,1.2;channels are public by default]" .. | ||||
| 			"label[1.6,1.5;use <player>:<channel> for fully private channels]" .. | ||||
| 			"label[1.6,1.8;use <player>\\;<channel> for private receivers]" .. | ||||
| 			"label[1.6,1.2;"..S("channels are public by default").."]" .. | ||||
| 			"label[1.6,1.5;"..S("use <player>:<channel> for fully private channels").."]" .. | ||||
| 			"label[1.6,1.8;"..S("use <player>\\;<channel> for private receivers").."]" .. | ||||
| 			default.gui_bg.. | ||||
| 			default.gui_bg_img) | ||||
| end | ||||
|  | ||||
| pipeworks.register_tube("pipeworks:teleport_tube", { | ||||
| 	description = "Teleporting Pneumatic Tube Segment", | ||||
| 	description = S("Teleporting Pneumatic Tube Segment"), | ||||
| 	inventory_image = "pipeworks_teleport_tube_inv.png", | ||||
| 	noctr = { "pipeworks_teleport_tube_noctr.png" }, | ||||
| 	plain = { "pipeworks_teleport_tube_plain.png" }, | ||||
| @@ -169,7 +170,7 @@ pipeworks.register_tube("pipeworks:teleport_tube", { | ||||
| 		on_construct = function(pos) | ||||
| 			local meta = minetest.get_meta(pos) | ||||
| 			update_meta(meta, true) | ||||
| 			meta:set_string("infotext", "unconfigured Teleportation Tube") | ||||
| 			meta:set_string("infotext", S("unconfigured Teleportation Tube")) | ||||
| 		end, | ||||
| 		on_receive_fields = function(pos,formname,fields,sender) | ||||
| 			if not fields.channel -- ignore escaping or clientside manipulation of the form | ||||
| @@ -189,12 +190,14 @@ pipeworks.register_tube("pipeworks:teleport_tube", { | ||||
| 				if name and mode and name ~= sender_name then | ||||
| 					--channels starting with '[name]:' can only be used by the named player | ||||
| 					if mode == ":" then | ||||
| 						minetest.chat_send_player(sender_name, "Sorry, channel '"..new_channel.."' is reserved for exclusive use by "..name) | ||||
| 						minetest.chat_send_player(sender_name, S("Sorry, channel '@1' is reserved for exclusive use by @2", | ||||
| 							new_channel, name)) | ||||
| 						return | ||||
| 				 | ||||
| 					--channels starting with '[name];' can be used by other players, but cannot be received from | ||||
| 					elseif mode == ";" and (fields.cr1 or (can_receive ~= 0 and not fields.cr0)) then | ||||
| 						minetest.chat_send_player(sender_name, "Sorry, receiving from channel '"..new_channel.."' is reserved for "..name) | ||||
| 						minetest.chat_send_player(sender_name, S("Sorry, receiving from channel '@1' is reserved for @2", | ||||
| 							new_channel, name)) | ||||
| 						return | ||||
| 					end | ||||
| 				end | ||||
| @@ -226,11 +229,11 @@ pipeworks.register_tube("pipeworks:teleport_tube", { | ||||
| 				if channel ~= "" then | ||||
| 					set_tube(pos, channel, can_receive) | ||||
| 					local cr_description = (can_receive == 1) and "sending and receiving" or "sending" | ||||
| 					meta:set_string("infotext", string.format("Teleportation Tube %s on '%s'", cr_description, channel)) | ||||
| 					meta:set_string("infotext", S("Teleportation Tube @1 on '@2'", cr_description, channel)) | ||||
| 				else | ||||
| 					-- remove empty channel tubes, to not have to search through them | ||||
| 					remove_tube(pos) | ||||
| 					meta:set_string("infotext", "unconfigured Teleportation Tube") | ||||
| 					meta:set_string("infotext", S("unconfigured Teleportation Tube")) | ||||
| 				end | ||||
| 			end | ||||
| 		end, | ||||
|   | ||||
| @@ -1,5 +1,6 @@ | ||||
| local S = minetest.get_translator("pipeworks") | ||||
| minetest.register_node("pipeworks:trashcan", { | ||||
| 	description = "Trash Can",  | ||||
| 	description = S("Trash Can"),  | ||||
| 	drawtype = "normal",  | ||||
| 	tiles = { | ||||
| 		"pipeworks_trashcan_bottom.png", | ||||
| @@ -22,7 +23,7 @@ minetest.register_node("pipeworks:trashcan", { | ||||
| 		meta:set_string("formspec", | ||||
| 				"size[8,7]".. | ||||
| 				"item_image[0,0;1,1;pipeworks:trashcan]".. | ||||
| 				"label[1,0;Trash Can]".. | ||||
| 				"label[1,0;"..S("Trash Can").."]".. | ||||
| 				"list[context;trash;3.5,1;1,1;]".. | ||||
| 				default.gui_bg.. | ||||
| 				default.gui_bg_img.. | ||||
| @@ -30,7 +31,7 @@ minetest.register_node("pipeworks:trashcan", { | ||||
| 				default.get_hotbar_bg(0,3) .. | ||||
| 				"list[current_player;main;0,3;8,4;]" .. | ||||
| 				"listring[]") | ||||
| 		meta:set_string("infotext", "Trash Can") | ||||
| 		meta:set_string("infotext", S("Trash Can")) | ||||
| 		meta:get_inventory():set_size("trash", 1) | ||||
| 	end,  | ||||
| 	after_place_node = pipeworks.after_place, | ||||
|   | ||||
| @@ -1,4 +1,5 @@ | ||||
| -- This file supplies the various kinds of pneumatic tubes | ||||
| local S = minetest.get_translator("pipeworks") | ||||
|  | ||||
| local tubenodes = {} | ||||
| pipeworks.tubenodes = tubenodes | ||||
| @@ -56,7 +57,7 @@ local register_one_tube = function(name, tname, dropname, desc, plain, noctrs, e | ||||
| 	end | ||||
|  | ||||
| 	local tgroups = {snappy = 3, tube = 1, tubedevice = 1, not_in_creative_inventory = 1} | ||||
| 	local tubedesc = string.format("%s %s... You hacker, you.", desc, dump(connects)) | ||||
| 	local tubedesc = string.format("%s %s", desc, dump(connects)) | ||||
| 	local iimg = plain[1] | ||||
| 	local wscale = {x = 1, y = 1, z = 1} | ||||
|  | ||||
| @@ -116,7 +117,10 @@ local register_one_tube = function(name, tname, dropname, desc, plain, noctrs, e | ||||
| 			end | ||||
| 			minetest.swap_node(pos, {name = "pipeworks:broken_tube_1"}) | ||||
| 			pipeworks.scan_for_tube_objects(pos) | ||||
| 		end | ||||
| 		end, | ||||
| 		check_for_pole = pipeworks.check_for_vert_tube, | ||||
| 		check_for_horiz_pole = pipeworks.check_for_horiz_tube, | ||||
| 		tubenumber = tonumber(tname) | ||||
| 	} | ||||
| 	if style == "6d" then | ||||
| 		nodedef.paramtype2 = "facedir" | ||||
| @@ -194,7 +198,7 @@ local register_all_tubes = function(name, desc, plain, noctrs, ends, short, inv, | ||||
| 				wield_image = inv, | ||||
| 				paramtype = "light", | ||||
| 				sunlight_propagates = true, | ||||
| 				description = "Pneumatic tube segment (legacy)", | ||||
| 				description = S("Pneumatic tube segment (legacy)"), | ||||
| 				after_place_node = pipeworks.after_place, | ||||
| 				groups = {not_in_creative_inventory = 1, tube_to_update = 1, tube = 1}, | ||||
| 				tube = {connect_sides = {front = 1, back = 1, left = 1, right = 1, top = 1, bottom = 1}}, | ||||
|   | ||||
| @@ -1,6 +1,7 @@ | ||||
| local S = minetest.get_translator("pipeworks") | ||||
| if pipeworks.enable_sand_tube then | ||||
| 	pipeworks.register_tube("pipeworks:sand_tube", { | ||||
| 		description = "Vacuuming Pneumatic Tube Segment", | ||||
| 		description = S("Vacuuming Pneumatic Tube Segment"), | ||||
| 		inventory_image = "pipeworks_sand_tube_inv.png", | ||||
| 		short = "pipeworks_sand_tube_short.png", | ||||
| 		noctr = {"pipeworks_sand_tube_noctr.png"}, | ||||
| @@ -28,7 +29,7 @@ end | ||||
|  | ||||
| if pipeworks.enable_mese_sand_tube then | ||||
| 	pipeworks.register_tube("pipeworks:mese_sand_tube", { | ||||
| 			description = "Adjustable Vacuuming Pneumatic Tube Segment", | ||||
| 			description = S("Adjustable Vacuuming Pneumatic Tube Segment"), | ||||
| 			inventory_image = "pipeworks_mese_sand_tube_inv.png", | ||||
| 			short = "pipeworks_mese_sand_tube_short.png", | ||||
| 			noctr = {"pipeworks_mese_sand_tube_noctr.png"}, | ||||
| @@ -44,7 +45,7 @@ if pipeworks.enable_mese_sand_tube then | ||||
| 							"field[1.3,0.4;1,1;dist;radius;${dist}]".. | ||||
| 							default.gui_bg.. | ||||
| 							default.gui_bg_img) | ||||
| 					meta:set_string("infotext", "Adjustable Vacuuming Pneumatic Tube Segment") | ||||
| 					meta:set_string("infotext", S("Adjustable Vacuuming Pneumatic Tube Segment")) | ||||
| 				end, | ||||
| 				on_receive_fields = function(pos,formname,fields,sender) | ||||
| 					if not pipeworks.may_configure(pos, sender) then return end | ||||
| @@ -54,7 +55,7 @@ if pipeworks.enable_mese_sand_tube then | ||||
| 						dist = math.max(0, dist) | ||||
| 						dist = math.min(8, dist) | ||||
| 						meta:set_int("dist", dist) | ||||
| 						meta:set_string("infotext", ("Adjustable Vacuuming Pneumatic Tube Segment (%dm)"):format(dist)) | ||||
| 						meta:set_string("infotext", (S("Adjustable Vacuuming Pneumatic Tube Segment (@1m)", dist))) | ||||
| 					end | ||||
| 				end, | ||||
| 			}, | ||||
|   | ||||
| @@ -1,3 +1,4 @@ | ||||
| local S = minetest.get_translator("pipeworks") | ||||
| local assumed_eye_pos = vector.new(0, 1.5, 0) | ||||
|  | ||||
| local function vector_copy(v) | ||||
| @@ -259,7 +260,7 @@ if pipeworks.enable_node_breaker then | ||||
| 	local wield_inv_name = "pick" | ||||
| 	data = { | ||||
| 		name_base = name_base, | ||||
| 		description = "Node Breaker", | ||||
| 		description = S("Node Breaker"), | ||||
| 		texture_base = "pipeworks_nodebreaker", | ||||
| 		texture_stateful = { top = true, bottom = true, side2 = true, side1 = true, front = true }, | ||||
| 		tube_connect_sides = { top=1, bottom=1, left=1, right=1, back=1 }, | ||||
| @@ -408,7 +409,7 @@ end | ||||
| if pipeworks.enable_deployer then | ||||
| 	register_wielder({ | ||||
| 		name_base = "pipeworks:deployer", | ||||
| 		description = "Deployer", | ||||
| 		description = S("Deployer"), | ||||
| 		texture_base = "pipeworks_deployer", | ||||
| 		texture_stateful = { front = true }, | ||||
| 		tube_connect_sides = { back=1 }, | ||||
| @@ -441,7 +442,7 @@ end | ||||
| if pipeworks.enable_dispenser then | ||||
| 	register_wielder({ | ||||
| 		name_base = "pipeworks:dispenser", | ||||
| 		description = "Dispenser", | ||||
| 		description = S("Dispenser"), | ||||
| 		texture_base = "pipeworks_dispenser", | ||||
| 		texture_stateful = { front = true }, | ||||
| 		tube_connect_sides = { back=1 }, | ||||
|   | ||||
		Reference in New Issue
	
	Block a user