mirror of
				https://github.com/minetest-mods/MoreMesecons.git
				synced 2025-10-29 23:35:29 +01:00 
			
		
		
		
	Better fix for #16
This commit is contained in:
		| @@ -253,6 +253,9 @@ function wireless_effector_off(pos) | |||||||
| 	update_mod_storage() | 	update_mod_storage() | ||||||
| end | end | ||||||
|  |  | ||||||
|  | -- This table is required to prevent a message from being sent in loop between wireless nodes | ||||||
|  | local sending_digilines = {} | ||||||
|  |  | ||||||
| local function on_digiline_receive(pos, node, channel, msg) | local function on_digiline_receive(pos, node, channel, msg) | ||||||
| 	if is_jammed(pos) then | 	if is_jammed(pos) then | ||||||
| 		return | 		return | ||||||
| @@ -264,14 +267,18 @@ local function on_digiline_receive(pos, node, channel, msg) | |||||||
| 		return | 		return | ||||||
| 	end | 	end | ||||||
|  |  | ||||||
| 	-- Why is delaying required? https://github.com/minetest-mods/MoreMesecons/issues/16 | 	local pos_hash = minetest.hash_node_position(pos) | ||||||
| 	minetest.after(0, function() | 	if sending_digilines[pos_hash] then | ||||||
|  | 		return | ||||||
|  | 	end | ||||||
|  |  | ||||||
|  | 	sending_digilines[pos_hash] = true | ||||||
| 	for i, wl_pos in pairs(wireless[wls.owner][wls.channel].members) do | 	for i, wl_pos in pairs(wireless[wls.owner][wls.channel].members) do | ||||||
| 		if i ~= wls.id and check_wireless_exists(wl_pos) then | 		if i ~= wls.id and check_wireless_exists(wl_pos) then | ||||||
| 			digiline:receptor_send(wl_pos, digiline.rules.default, channel, msg) | 			digiline:receptor_send(wl_pos, digiline.rules.default, channel, msg) | ||||||
| 		end | 		end | ||||||
| 	end | 	end | ||||||
| 	end) | 	sending_digilines[pos_hash] = nil | ||||||
| end | end | ||||||
|  |  | ||||||
| mesecon.register_node("moremesecons_wireless:wireless", { | mesecon.register_node("moremesecons_wireless:wireless", { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user