mirror of
				https://github.com/SmallJoker/exchange_shop.git
				synced 2025-10-27 04:35:35 +01:00 
			
		
		
		
	Add tubelib compatibility
This commit is contained in:
		| @@ -2,3 +2,5 @@ default | |||||||
| currency? | currency? | ||||||
| bitchange? | bitchange? | ||||||
| wrench? | wrench? | ||||||
|  | pipeworks? | ||||||
|  | tubelib? | ||||||
|   | |||||||
							
								
								
									
										1
									
								
								init.lua
									
									
									
									
									
								
							
							
						
						
									
										1
									
								
								init.lua
									
									
									
									
									
								
							| @@ -23,6 +23,7 @@ else | |||||||
| 	dofile(modpath .. "/shop_functions.lua") | 	dofile(modpath .. "/shop_functions.lua") | ||||||
| 	dofile(modpath .. "/shop.lua") | 	dofile(modpath .. "/shop.lua") | ||||||
| end | end | ||||||
|  | dofile(modpath .. "/pipes.lua") | ||||||
|  |  | ||||||
| if has_currency then | if has_currency then | ||||||
| 	local new_groups = table.copy(minetest.registered_nodes["currency:shop"].groups) | 	local new_groups = table.copy(minetest.registered_nodes["currency:shop"].groups) | ||||||
|   | |||||||
							
								
								
									
										3
									
								
								mod.conf
									
									
									
									
									
								
							
							
						
						
									
										3
									
								
								mod.conf
									
									
									
									
									
								
							| @@ -1,3 +1,4 @@ | |||||||
| name = exchange_shop | name = exchange_shop | ||||||
|  | description = An improved currency-compatible exchange shop | ||||||
| depends = default | depends = default | ||||||
| optional_depends = currency, bitchange, wrench | optional_depends = currency, bitchange, wrench, pipeworks, tubelib | ||||||
|   | |||||||
							
								
								
									
										38
									
								
								pipes.lua
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										38
									
								
								pipes.lua
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,38 @@ | |||||||
|  | if minetest.get_modpath("pipeworks") then | ||||||
|  | 	minetest.override_item(exchange_shop.shopname, { | ||||||
|  | 		groups = {choppy=2, oddly_breakable_by_hand=2, | ||||||
|  | 			tubedevice=1, tubedevice_receiver=1}, | ||||||
|  | 		tube = { | ||||||
|  | 			insert_object = function(pos, node, stack, direction) | ||||||
|  | 				local meta = minetest.get_meta(pos) | ||||||
|  | 				local inv = meta:get_inventory() | ||||||
|  | 				return inv:add_item("stock", stack) | ||||||
|  | 			end, | ||||||
|  | 			can_insert = function(pos, node, stack, direction) | ||||||
|  | 				local meta = minetest.get_meta(pos) | ||||||
|  | 				local inv = meta:get_inventory() | ||||||
|  | 				return inv:room_for_item("stock", stack) | ||||||
|  | 			end, | ||||||
|  | 			input_inventory = "custm", | ||||||
|  | 			connect_sides = {left=1, right=1, back=1, top=1, bottom=1} | ||||||
|  | 		} | ||||||
|  | 	}) | ||||||
|  | end | ||||||
|  |  | ||||||
|  | if minetest.get_modpath("tubelib") then | ||||||
|  | 	tubelib.register_node(exchange_shop.shopname, {}, { | ||||||
|  | 		on_pull_item = function(pos, side) | ||||||
|  | 			local meta = minetest.get_meta(pos) | ||||||
|  | 			return tubelib.get_item(meta, "custm") | ||||||
|  | 		end, | ||||||
|  | 		on_push_item = function(pos, side, item) | ||||||
|  | 			local meta = minetest.get_meta(pos) | ||||||
|  | 			return tubelib.put_item(meta, "stock", item) | ||||||
|  | 		end, | ||||||
|  | 		on_unpull_item = function(pos, side, item) | ||||||
|  | 			local meta = minetest.get_meta(pos) | ||||||
|  | 			return tubelib.put_item(meta, "stock", item) | ||||||
|  | 		end, | ||||||
|  | 	}) | ||||||
|  |  | ||||||
|  | end | ||||||
							
								
								
									
										17
									
								
								shop.lua
									
									
									
									
									
								
							
							
						
						
									
										17
									
								
								shop.lua
									
									
									
									
									
								
							| @@ -165,22 +165,7 @@ minetest.register_node(exchange_shop.shopname, { | |||||||
| 		"shop_side.png", "shop_front.png" | 		"shop_side.png", "shop_front.png" | ||||||
| 	}, | 	}, | ||||||
| 	paramtype2 = "facedir", | 	paramtype2 = "facedir", | ||||||
| 	groups = {choppy=2, oddly_breakable_by_hand=2,  | 	groups = {choppy=2, oddly_breakable_by_hand=2}, | ||||||
| 		tubedevice=1, tubedevice_receiver=1}, |  | ||||||
| 	tube = { |  | ||||||
| 		insert_object = function(pos, node, stack, direction) |  | ||||||
| 			local meta = minetest.get_meta(pos) |  | ||||||
| 			local inv = meta:get_inventory() |  | ||||||
| 			return inv:add_item("stock", stack) |  | ||||||
| 		end, |  | ||||||
| 		can_insert = function(pos, node, stack, direction) |  | ||||||
| 			local meta = minetest.get_meta(pos) |  | ||||||
| 			local inv = meta:get_inventory() |  | ||||||
| 			return inv:room_for_item("stock", stack) |  | ||||||
| 		end, |  | ||||||
| 		input_inventory = "custm", |  | ||||||
| 		connect_sides = {left=1, right=1, back=1, top=1, bottom=1} |  | ||||||
| 	}, |  | ||||||
| 	sounds = default.node_sound_wood_defaults(), | 	sounds = default.node_sound_wood_defaults(), | ||||||
| 	after_place_node = function(pos, placer) | 	after_place_node = function(pos, placer) | ||||||
| 		local meta = minetest.get_meta(pos) | 		local meta = minetest.get_meta(pos) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user