mirror of
				https://github.com/minetest-mods/MoreMesecons.git
				synced 2025-10-31 08:05:28 +01:00 
			
		
		
		
	Add the "wireless jammer"
This commit is contained in:
		| @@ -1,3 +1,5 @@ | ||||
| local JAMMER_MAX_DISTANCE = 15 | ||||
|  | ||||
| local wireless = {} | ||||
| local wireless_rids = {} | ||||
|  | ||||
| @@ -18,7 +20,7 @@ local wireless_activate = function(pos) | ||||
| 		meta = minetest.get_meta(pos) | ||||
| 		channel_first_wireless = meta:get_string("channel") | ||||
| 		meta = minetest.get_meta(wireless[i]) | ||||
| 		if wireless[i] ~= pos and meta:get_string("channel") == channel_first_wireless then | ||||
| 		if wireless[i] ~= pos and meta:get_string("channel") == channel_first_wireless and not minetest.find_node_near(pos, JAMMER_MAX_DISTANCE, {"moremesecons_wireless:jammer_on"}) then | ||||
| 			mesecon.receptor_on(wireless[i]) | ||||
| 		end | ||||
| 	end	 | ||||
| @@ -33,7 +35,7 @@ local wireless_deactivate = function(pos) | ||||
| 		meta = minetest.get_meta(pos) | ||||
| 		channel_first_wireless = meta:get_string("channel") | ||||
| 		meta = minetest.get_meta(wireless[i]) | ||||
| 		if wireless[i] ~= pos and meta:get_string("channel") == channel_first_wireless then | ||||
| 		if wireless[i] ~= pos and meta:get_string("channel") == channel_first_wireless and not minetest.find_node_near(pos, JAMMER_MAX_DISTANCE, {"moremesecons_wireless:jammer_on"}) then | ||||
| 			mesecon.receptor_off(wireless[i]) | ||||
| 		end | ||||
| 	end	 | ||||
| @@ -69,6 +71,33 @@ minetest.register_node("moremesecons_wireless:wireless", { | ||||
| 	end, | ||||
| }) | ||||
|  | ||||
| mesecon.register_node("moremesecons_wireless:jammer", { | ||||
| 	description="Wireless Jammer", | ||||
| 	paramtype = "light", | ||||
| },{ | ||||
| 	tiles = {"moremesecons_jammer_off.png"}, | ||||
| 	groups = {dig_immediate=2}, | ||||
| 	mesecons = {effector = { | ||||
| 		action_on = function(pos) | ||||
| 			table.foreach(pos, print) | ||||
| 			minetest.swap_node(pos, {name="moremesecons_wireless:jammer_on"}) | ||||
| 		end }} | ||||
| },{ | ||||
| 	tiles = {"moremesecons_jammer_on.png"}, | ||||
| 	groups = {dig_immediate=2, not_in_creative_inventory=1}, | ||||
| 	mesecons = {effector = { | ||||
| 		action_off = function(pos) | ||||
| 			minetest.swap_node(pos, {name="moremesecons_wireless:jammer_off"}) | ||||
| 		end }} | ||||
| }) | ||||
|  | ||||
| minetest.register_craft({ | ||||
| 	output = "moremesecons_wireless:jammer_off", | ||||
| 	recipe = { | ||||
| 		{"moremesecons_wireless:wireless", "mesecons_torch:mesecon_torch_on", "moremesecons_wireless:wireless"} | ||||
| 	} | ||||
| }) | ||||
|  | ||||
| minetest.register_craft({ | ||||
| 	output = "moremesecons_wireless:wireless 2", | ||||
| 	recipe = { | ||||
|   | ||||
							
								
								
									
										
											BIN
										
									
								
								moremesecons_wireless/textures/moremesecons_jammer_off.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								moremesecons_wireless/textures/moremesecons_jammer_off.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 196 B | 
							
								
								
									
										
											BIN
										
									
								
								moremesecons_wireless/textures/moremesecons_jammer_on.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								moremesecons_wireless/textures/moremesecons_jammer_on.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 262 B | 
		Reference in New Issue
	
	Block a user