mirror of
				https://github.com/sys4-fr/server-nalc.git
				synced 2025-10-31 12:35:22 +01:00 
			
		
		
		
	[pipeworks] Update and fix for #426
This commit is contained in:
		| @@ -223,7 +223,7 @@ local function upgrade_autocrafter(pos, meta) | |||||||
| 			if not recipe then return end | 			if not recipe then return end | ||||||
| 			for idx, stack in ipairs(recipe) do | 			for idx, stack in ipairs(recipe) do | ||||||
| 				if not stack:is_empty() then | 				if not stack:is_empty() then | ||||||
| 					minetest.item_drop(stack, "", pos) | 					minetest.add_item(pos, stack) | ||||||
| 					stack:set_count(1) | 					stack:set_count(1) | ||||||
| 					stack:set_wear(0) | 					stack:set_wear(0) | ||||||
| 					inv:set_stack("recipe", idx, stack) | 					inv:set_stack("recipe", idx, stack) | ||||||
|   | |||||||
| @@ -15,6 +15,10 @@ minetest.override_item("default:furnace", { | |||||||
| 		insert_object = function(pos, node, stack, direction) | 		insert_object = function(pos, node, stack, direction) | ||||||
| 			local meta = minetest.get_meta(pos) | 			local meta = minetest.get_meta(pos) | ||||||
| 			local inv = meta:get_inventory() | 			local inv = meta:get_inventory() | ||||||
|  | 			local timer = minetest.get_node_timer(pos) | ||||||
|  | 			if not timer:is_started() then | ||||||
|  | 				timer:start(1.0) | ||||||
|  | 			end | ||||||
| 			if direction.y == 1 then | 			if direction.y == 1 then | ||||||
| 				return inv:add_item("fuel",stack) | 				return inv:add_item("fuel",stack) | ||||||
| 			else | 			else | ||||||
| @@ -60,6 +64,10 @@ minetest.override_item("default:furnace_active", { | |||||||
| 		insert_object = function(pos,node,stack,direction) | 		insert_object = function(pos,node,stack,direction) | ||||||
| 			local meta = minetest.get_meta(pos) | 			local meta = minetest.get_meta(pos) | ||||||
| 			local inv = meta:get_inventory() | 			local inv = meta:get_inventory() | ||||||
|  | 			local timer = minetest.get_node_timer(pos) | ||||||
|  | 			if not timer:is_started() then | ||||||
|  | 				timer:start(1.0) | ||||||
|  | 			end | ||||||
| 			if direction.y == 1 then | 			if direction.y == 1 then | ||||||
| 				return inv:add_item("fuel", stack) | 				return inv:add_item("fuel", stack) | ||||||
| 			else | 			else | ||||||
|   | |||||||
							
								
								
									
										1
									
								
								mods/pipeworks/description.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								mods/pipeworks/description.txt
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1 @@ | |||||||
|  | This mod uses nodeboxes to supply a complete set of 3D pipes and tubes, along devices that work with them. | ||||||
| @@ -28,7 +28,7 @@ end | |||||||
| -- todo SOON: this function has *way too many* parameters | -- todo SOON: this function has *way too many* parameters | ||||||
| local function grabAndFire(data,slotseq_mode,filtmeta,frominv,frominvname,frompos,fromnode,filterfor,fromtube,fromdef,dir,fakePlayer,all) | local function grabAndFire(data,slotseq_mode,filtmeta,frominv,frominvname,frompos,fromnode,filterfor,fromtube,fromdef,dir,fakePlayer,all) | ||||||
| 	local sposes = {} | 	local sposes = {} | ||||||
| 	for spos,stack in ipairs(frominv:get_list(frominvname)) do | 	for spos,stack in ipairs(frominv:get_list(frominvname) or {}) do -- Modification made for https://github.com/MinetestForFun/server-minetestforfun/issues/426 (Mg|06/04/2016) | ||||||
| 		local matches | 		local matches | ||||||
| 		if filterfor == "" then | 		if filterfor == "" then | ||||||
| 			matches = stack:get_name() ~= "" | 			matches = stack:get_name() ~= "" | ||||||
|   | |||||||
| @@ -249,7 +249,10 @@ luaentity.register_entity("pipeworks:tubed_item", { | |||||||
| 			if not found_next then | 			if not found_next then | ||||||
| 				drop_pos = minetest.find_node_near(vector.add(self.start_pos, velocity), 1, "air") | 				drop_pos = minetest.find_node_near(vector.add(self.start_pos, velocity), 1, "air") | ||||||
| 				if drop_pos then | 				if drop_pos then | ||||||
| 					minetest.item_drop(stack, "", drop_pos) | 					-- Using add_item instead of item_drop since this makes pipeworks backward | ||||||
|  | 					-- compatible with Minetest 0.4.13. | ||||||
|  | 					-- Using item_drop here makes Minetest 0.4.13 crash. | ||||||
|  | 					minetest.add_item(drop_pos, stack) | ||||||
| 					self:remove() | 					self:remove() | ||||||
| 					return | 					return | ||||||
| 				end | 				end | ||||||
|   | |||||||
							
								
								
									
										1
									
								
								mods/pipeworks/mod.conf
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								mods/pipeworks/mod.conf
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1 @@ | |||||||
|  | name = pipeworks | ||||||
							
								
								
									
										
											BIN
										
									
								
								mods/pipeworks/screenshot.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								mods/pipeworks/screenshot.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 90 KiB | 
| @@ -6,7 +6,7 @@ if pipeworks.enable_mese_tube then | |||||||
| 			local inv = meta:get_inventory() | 			local inv = meta:get_inventory() | ||||||
| 			for i = 1, 6 do | 			for i = 1, 6 do | ||||||
| 				for _, stack in ipairs(inv:get_list("line"..i)) do | 				for _, stack in ipairs(inv:get_list("line"..i)) do | ||||||
| 					minetest.item_drop(stack, "", pos) | 					minetest.add_item(pos, stack) | ||||||
| 				end | 				end | ||||||
| 			end | 			end | ||||||
| 		end | 		end | ||||||
|   | |||||||
| @@ -87,14 +87,9 @@ local tube_inject_item = pipeworks.tube_inject_item | |||||||
| local get_objects_inside_radius = minetest.get_objects_inside_radius | local get_objects_inside_radius = minetest.get_objects_inside_radius | ||||||
| local function vacuum(pos, radius) | local function vacuum(pos, radius) | ||||||
| 	radius = radius + 0.5 | 	radius = radius + 0.5 | ||||||
| 	local max_items = 0 |  | ||||||
| 	for _, object in pairs(get_objects_inside_radius(pos, sqrt_3 * radius)) do | 	for _, object in pairs(get_objects_inside_radius(pos, sqrt_3 * radius)) do | ||||||
| 		local lua_entity = object:get_luaentity() | 		local lua_entity = object:get_luaentity() | ||||||
| 		if not object:is_player() and lua_entity and lua_entity.name == "__builtin:item" then | 		if not object:is_player() and lua_entity and lua_entity.name == "__builtin:item" then | ||||||
| 			max_items = max_items + 1 |  | ||||||
| 			if max_items > 50 then |  | ||||||
| 				object:remove() |  | ||||||
| 			else |  | ||||||
| 			local obj_pos = object:getpos() | 			local obj_pos = object:getpos() | ||||||
| 			local x1, y1, z1 = pos.x, pos.y, pos.z | 			local x1, y1, z1 = pos.x, pos.y, pos.z | ||||||
| 			local x2, y2, z2 = obj_pos.x, obj_pos.y, obj_pos.z | 			local x2, y2, z2 = obj_pos.x, obj_pos.y, obj_pos.z | ||||||
| @@ -110,7 +105,6 @@ local function vacuum(pos, radius) | |||||||
| 			end | 			end | ||||||
| 		end | 		end | ||||||
| 	end | 	end | ||||||
| 	end |  | ||||||
| end | end | ||||||
|  |  | ||||||
| minetest.register_abm({nodenames = {"group:vacuum_tube"}, | minetest.register_abm({nodenames = {"group:vacuum_tube"}, | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user