forked from nalc/homedecor_modpack
		
	simplify mesecons/digilines rules
replaced all "xz" and "toponly" with "alldir" made on-floor rope lights use "alldir"
This commit is contained in:
		@@ -31,13 +31,6 @@ local word_to_bright = {
 | 
				
			|||||||
	["max"] = 14,
 | 
						["max"] = 14,
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
local rules_xz = {
 | 
					 | 
				
			||||||
	{x = -1, y = 0, z =  0}, -- borrowed from extrawires crossing
 | 
					 | 
				
			||||||
	{x =  1, y = 0, z =  0},
 | 
					 | 
				
			||||||
	{x =  0, y = 0, z = -1},
 | 
					 | 
				
			||||||
	{x =  0, y = 0, z =  1},
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
local rules_alldir = {
 | 
					local rules_alldir = {
 | 
				
			||||||
	{x =  0, y =  0, z = -1},  -- borrowed from lightstones
 | 
						{x =  0, y =  0, z = -1},  -- borrowed from lightstones
 | 
				
			||||||
	{x =  1, y =  0, z =  0},
 | 
						{x =  1, y =  0, z =  0},
 | 
				
			||||||
@@ -54,13 +47,6 @@ local rules_alldir = {
 | 
				
			|||||||
	{x =  0, y = -1, z =  0},
 | 
						{x =  0, y = -1, z =  0},
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
local rules_toponly = {
 | 
					 | 
				
			||||||
	{x =  1, y =  1, z =  0},
 | 
					 | 
				
			||||||
	{x = -1, y =  1, z =  0},
 | 
					 | 
				
			||||||
	{x =  0, y =  1, z =  1},
 | 
					 | 
				
			||||||
	{x =  0, y =  1, z = -1},
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
-- mesecons compatibility
 | 
					-- mesecons compatibility
 | 
				
			||||||
 | 
					
 | 
				
			||||||
local actions
 | 
					local actions
 | 
				
			||||||
@@ -94,21 +80,10 @@ if minetest.get_modpath("mesecons") then
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
	homedecor.mesecon_wall_light.effector.rules = mesecon.rules.wallmounted_get
 | 
						homedecor.mesecon_wall_light.effector.rules = mesecon.rules.wallmounted_get
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	homedecor.mesecon_xz_light = {
 | 
					 | 
				
			||||||
		effector = table.copy(actions)
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	homedecor.mesecon_xz_light.effector.rules = rules_xz
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	homedecor.mesecon_alldir_light = {
 | 
						homedecor.mesecon_alldir_light = {
 | 
				
			||||||
		effector = table.copy(actions),
 | 
							effector = table.copy(actions),
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	homedecor.mesecon_alldir_light.effector.rules = rules_alldir
 | 
						homedecor.mesecon_alldir_light.effector.rules = rules_alldir
 | 
				
			||||||
 | 
					 | 
				
			||||||
	homedecor.mesecon_toponly_light = {
 | 
					 | 
				
			||||||
		effector = table.copy(actions)
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	homedecor.mesecon_toponly_light.effector.rules = rules_toponly
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
-- digilines compatibility
 | 
					-- digilines compatibility
 | 
				
			||||||
@@ -177,15 +152,6 @@ if minetest.get_modpath("digilines") then
 | 
				
			|||||||
		}
 | 
							}
 | 
				
			||||||
	end
 | 
						end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	homedecor.digiline_xz_light = {
 | 
					 | 
				
			||||||
		effector = {
 | 
					 | 
				
			||||||
			action = on_digiline_receive_string,
 | 
					 | 
				
			||||||
		},
 | 
					 | 
				
			||||||
		wire = {
 | 
					 | 
				
			||||||
			rules = rules_xz
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	homedecor.digiline_alldir_light = {
 | 
						homedecor.digiline_alldir_light = {
 | 
				
			||||||
		effector = {
 | 
							effector = {
 | 
				
			||||||
			action = on_digiline_receive_string,
 | 
								action = on_digiline_receive_string,
 | 
				
			||||||
@@ -195,15 +161,6 @@ if minetest.get_modpath("digilines") then
 | 
				
			|||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	homedecor.digiline_toponly_light = {
 | 
					 | 
				
			||||||
		effector = {
 | 
					 | 
				
			||||||
			action = on_digiline_receive_string,
 | 
					 | 
				
			||||||
		},
 | 
					 | 
				
			||||||
		wire = {
 | 
					 | 
				
			||||||
			rules = rules_toponly
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	function digiline_on_punch(pos, node, puncher, pointed_thing)
 | 
						function digiline_on_punch(pos, node, puncher, pointed_thing)
 | 
				
			||||||
		if is_protected(pos, puncher) then return end
 | 
							if is_protected(pos, puncher) then return end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -524,8 +481,8 @@ for brightness_level = 0, 14 do
 | 
				
			|||||||
				{items = {"homedecor:ground_lantern_on"}},
 | 
									{items = {"homedecor:ground_lantern_on"}},
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
		mesecons = homedecor.mesecon_xz_light,
 | 
							mesecons = homedecor.mesecon_alldir_light,
 | 
				
			||||||
		digiline = homedecor.digiline_xz_light,
 | 
							digiline = homedecor.digiline_alldir_light,
 | 
				
			||||||
		on_punch = digiline_on_punch
 | 
							on_punch = digiline_on_punch
 | 
				
			||||||
	})
 | 
						})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -578,8 +535,8 @@ for brightness_level = 0, 14 do
 | 
				
			|||||||
				{items = {"homedecor:ceiling_lantern_on"}},
 | 
									{items = {"homedecor:ceiling_lantern_on"}},
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
		mesecons = homedecor.mesecon_toponly_light,
 | 
							mesecons = homedecor.mesecon_alldir_light,
 | 
				
			||||||
		digiline = homedecor.digiline_toponly_light,
 | 
							digiline = homedecor.digiline_alldir_light,
 | 
				
			||||||
		on_punch = digiline_on_punch
 | 
							on_punch = digiline_on_punch
 | 
				
			||||||
	})
 | 
						})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -681,8 +638,8 @@ for brightness_level = 0, 14 do
 | 
				
			|||||||
				{items = {"homedecor:desk_lamp_on"}, inherit_color = true },
 | 
									{items = {"homedecor:desk_lamp_on"}, inherit_color = true },
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
		mesecons = homedecor.mesecon_xz_light,
 | 
							mesecons = homedecor.mesecon_alldir_light,
 | 
				
			||||||
		digiline = homedecor.digiline_xz_light,
 | 
							digiline = homedecor.digiline_alldir_light,
 | 
				
			||||||
		on_punch = digiline_on_punch
 | 
							on_punch = digiline_on_punch
 | 
				
			||||||
	})
 | 
						})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -707,8 +664,8 @@ for brightness_level = 0, 14 do
 | 
				
			|||||||
				{items = {"homedecor:ceiling_lamp_on"}},
 | 
									{items = {"homedecor:ceiling_lamp_on"}},
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
		mesecons = homedecor.mesecon_toponly_light,
 | 
							mesecons = homedecor.mesecon_alldir_light,
 | 
				
			||||||
		digiline = homedecor.digiline_toponly_light,
 | 
							digiline = homedecor.digiline_alldir_light,
 | 
				
			||||||
		on_punch = digiline_on_punch
 | 
							on_punch = digiline_on_punch
 | 
				
			||||||
	})
 | 
						})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -747,7 +704,7 @@ for brightness_level = 0, 14 do
 | 
				
			|||||||
				{items = {"homedecor:table_lamp_hi"}, inherit_color = true },
 | 
									{items = {"homedecor:table_lamp_hi"}, inherit_color = true },
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
		digiline =      homedecor.digiline_xz_light,
 | 
							digiline =      homedecor.digiline_alldir_light,
 | 
				
			||||||
		mesecons =      homedecor.mesecon_wall_light,
 | 
							mesecons =      homedecor.mesecon_wall_light,
 | 
				
			||||||
		on_rightclick = homedecor.toggle_light,
 | 
							on_rightclick = homedecor.toggle_light,
 | 
				
			||||||
		on_punch =      digiline_on_punch
 | 
							on_punch =      digiline_on_punch
 | 
				
			||||||
@@ -778,7 +735,7 @@ for brightness_level = 0, 14 do
 | 
				
			|||||||
				{items = {"homedecor:standing_lamp_hi"}, inherit_color = true },
 | 
									{items = {"homedecor:standing_lamp_hi"}, inherit_color = true },
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
		digiline =      homedecor.digiline_xz_light,
 | 
							digiline =      homedecor.digiline_alldir_light,
 | 
				
			||||||
		mesecons =      homedecor.mesecon_wall_light,
 | 
							mesecons =      homedecor.mesecon_wall_light,
 | 
				
			||||||
		on_rightclick = homedecor.toggle_light,
 | 
							on_rightclick = homedecor.toggle_light,
 | 
				
			||||||
		on_punch =      digiline_on_punch
 | 
							on_punch =      digiline_on_punch
 | 
				
			||||||
@@ -832,8 +789,8 @@ for _, light_brightn_name in ipairs({"off", "on"}) do
 | 
				
			|||||||
				{items = {"homedecor:plasma_ball_on"}},
 | 
									{items = {"homedecor:plasma_ball_on"}},
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
		mesecons = homedecor.mesecon_xz_light,
 | 
							mesecons = homedecor.mesecon_alldir_light,
 | 
				
			||||||
		digiline = homedecor.digiline_xz_light,
 | 
							digiline = homedecor.digiline_alldir_light,
 | 
				
			||||||
		on_punch = digiline_on_punch
 | 
							on_punch = digiline_on_punch
 | 
				
			||||||
	})
 | 
						})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -885,7 +842,7 @@ for _, light_brightn_name in ipairs({"off", "on"}) do
 | 
				
			|||||||
				state = mesecon and (onflag and mesecon.state.on or mesecon.state.off),
 | 
									state = mesecon and (onflag and mesecon.state.on or mesecon.state.off),
 | 
				
			||||||
				onstate =  "homedecor:rope_light_on_floor_on",
 | 
									onstate =  "homedecor:rope_light_on_floor_on",
 | 
				
			||||||
				offstate = "homedecor:rope_light_on_floor_off",
 | 
									offstate = "homedecor:rope_light_on_floor_off",
 | 
				
			||||||
				rules = rules_xz
 | 
									rules = rules_alldir
 | 
				
			||||||
			},
 | 
								},
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	})
 | 
						})
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user