mirror of
				https://github.com/mt-mods/homedecor_modpack.git
				synced 2025-11-04 16:05:34 +01:00 
			
		
		
		
	Compare commits
	
		
			3 Commits
		
	
	
		
			2019-06-07
			...
			2019-06-15
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					b28f1314da | ||
| 
						 | 
					17ea2040e2 | ||
| 
						 | 
					ed9fb6a34d | 
@@ -11,6 +11,8 @@ local function is_protected(pos, clicker)
 | 
			
		||||
	return false
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
local hd_mesecons = minetest.get_modpath("mesecons")
 | 
			
		||||
 | 
			
		||||
-- control and brightness for dimmable lamps
 | 
			
		||||
 | 
			
		||||
local brightn_cycle = {
 | 
			
		||||
@@ -51,7 +53,7 @@ local rules_alldir = {
 | 
			
		||||
 | 
			
		||||
local actions
 | 
			
		||||
 | 
			
		||||
if minetest.get_modpath("mesecons") then
 | 
			
		||||
if hd_mesecons then
 | 
			
		||||
 | 
			
		||||
	actions = {
 | 
			
		||||
		action_off = function(pos, node)
 | 
			
		||||
@@ -132,7 +134,7 @@ if minetest.get_modpath("digilines") then
 | 
			
		||||
		end
 | 
			
		||||
	end)
 | 
			
		||||
 | 
			
		||||
	if minetest.get_modpath("mesecons") then
 | 
			
		||||
	if hd_mesecons then
 | 
			
		||||
		homedecor.digiline_wall_light = {
 | 
			
		||||
			effector = {
 | 
			
		||||
				action = on_digiline_receive_string,
 | 
			
		||||
@@ -182,10 +184,14 @@ function homedecor.toggle_light(pos, node, clicker, itemstack, pointed_thing)
 | 
			
		||||
	local level = string.sub(node.name, sep + 1)
 | 
			
		||||
	local n = tonumber(level) or 0
 | 
			
		||||
 | 
			
		||||
	if level == "off" or n < 4 then
 | 
			
		||||
		newsuff = "_14"
 | 
			
		||||
	else
 | 
			
		||||
	if level == "on" then
 | 
			
		||||
		newsuff = "_off"
 | 
			
		||||
	elseif level == "off" then
 | 
			
		||||
		newsuff = "_on"
 | 
			
		||||
	elseif n > 3 then
 | 
			
		||||
		newsuff = "_0"
 | 
			
		||||
	else
 | 
			
		||||
		newsuff = "_14"
 | 
			
		||||
	end
 | 
			
		||||
 | 
			
		||||
	minetest.swap_node(pos, {name = string.sub(node.name, 1, sep - 1)..newsuff, param2 = node.param2})
 | 
			
		||||
@@ -749,6 +755,15 @@ for _, light_brightn_name in ipairs({"off", "on"}) do
 | 
			
		||||
 | 
			
		||||
	local onflag = (light_brightn_name == "on")
 | 
			
		||||
	local nici = (light_brightn_name == "off") and 1 or nil
 | 
			
		||||
	local nici_m = (light_brightn_name == "off") and 1 or nil
 | 
			
		||||
	local on_rc = homedecor.toggle_light
 | 
			
		||||
	local di = "on"
 | 
			
		||||
 | 
			
		||||
	if hd_mesecons then
 | 
			
		||||
		nici_m = (light_brightn_name ~= "off") and 1 or nil
 | 
			
		||||
		on_rc = nil
 | 
			
		||||
		di = "off"
 | 
			
		||||
	end
 | 
			
		||||
 | 
			
		||||
	local gen_ls_tex_white =           "homedecor_generic_light_source_off.png"
 | 
			
		||||
	if onflag then gen_ls_tex_white =  "homedecor_generic_light_source_white.png" end
 | 
			
		||||
@@ -829,14 +844,14 @@ for _, light_brightn_name in ipairs({"off", "on"}) do
 | 
			
		||||
			"homedecor:rope_light_on_floor_off",
 | 
			
		||||
			"group:mesecon_conductor_craftable"
 | 
			
		||||
		},
 | 
			
		||||
		groups = {cracky=3, not_in_creative_inventory = nici},
 | 
			
		||||
		groups = {cracky=3, oddly_breakable_by_hand=3, not_in_creative_inventory = nici_m},
 | 
			
		||||
		sounds =  default.node_sound_stone_defaults(),
 | 
			
		||||
		on_rightclick = homedecor.toggle_light,
 | 
			
		||||
		drop = {
 | 
			
		||||
			items = {
 | 
			
		||||
				{items = {"homedecor:rope_light_on_floor_on"} },
 | 
			
		||||
				{items = {"homedecor:rope_light_on_floor_"..di} },
 | 
			
		||||
			}
 | 
			
		||||
		},
 | 
			
		||||
		on_rightclick = on_rc,
 | 
			
		||||
		mesecons = {
 | 
			
		||||
			conductor = {
 | 
			
		||||
				state = mesecon and (onflag and mesecon.state.on or mesecon.state.off),
 | 
			
		||||
@@ -875,14 +890,14 @@ for _, light_brightn_name in ipairs({"off", "on"}) do
 | 
			
		||||
			"homedecor:rope_light_on_ceiling_off",
 | 
			
		||||
			"group:mesecon_conductor_craftable"
 | 
			
		||||
		},
 | 
			
		||||
		groups = {cracky=3, not_in_creative_inventory = nici},
 | 
			
		||||
		groups = {cracky=3, oddly_breakable_by_hand=3, not_in_creative_inventory = nici_m},
 | 
			
		||||
		sounds =  default.node_sound_stone_defaults(),
 | 
			
		||||
		on_rightclick = homedecor.toggle_light,
 | 
			
		||||
		drop = {
 | 
			
		||||
			items = {
 | 
			
		||||
				{items = {"homedecor:rope_light_on_ceiling_on"}},
 | 
			
		||||
				{items = {"homedecor:rope_light_on_ceiling_"..di}},
 | 
			
		||||
			}
 | 
			
		||||
		},
 | 
			
		||||
		on_rightclick = on_rc,
 | 
			
		||||
		mesecons = {
 | 
			
		||||
			conductor = {
 | 
			
		||||
				state = mesecon and (onflag and mesecon.state.on or mesecon.state.off),
 | 
			
		||||
@@ -1837,6 +1852,11 @@ minetest.register_alias("torch_wall",                          "homedecor:torch_
 | 
			
		||||
minetest.register_alias("homedecor:plasma_ball",               "homedecor:plasma_ball_on")
 | 
			
		||||
minetest.register_alias("homedecor:wall_lamp",                 "homedecor:wall_lamp_on")
 | 
			
		||||
 | 
			
		||||
minetest.register_alias("homedecor:rope_light_on_floor_0",     "homedecor:rope_light_on_floor_off")
 | 
			
		||||
minetest.register_alias("homedecor:rope_light_on_floor_14",    "homedecor:rope_light_on_floor_on")
 | 
			
		||||
 | 
			
		||||
minetest.register_alias("homedecor:rope_light_on_ceiling_0",   "homedecor:rope_light_on_ceiling_off")
 | 
			
		||||
minetest.register_alias("homedecor:rope_light_on_ceiling_14",  "homedecor:rope_light_on_ceiling_on")
 | 
			
		||||
 | 
			
		||||
for name, level in pairs(word_to_bright) do
 | 
			
		||||
	minetest.register_alias("homedecor:glowlight_half_"..name,        "homedecor:glowlight_half_"..level)
 | 
			
		||||
 
 | 
			
		||||
@@ -106,7 +106,7 @@ minetest.register_node(":homedecor:curtain_closed", {
 | 
			
		||||
	drawtype = 'signlike',
 | 
			
		||||
	use_texture_alpha = true,
 | 
			
		||||
	walkable = false,
 | 
			
		||||
	groups = { snappy = 3, ud_param2_colorable = 1 },
 | 
			
		||||
	groups = { snappy = 3, ud_param2_colorable = 1, not_in_creative_inventory=1 },
 | 
			
		||||
	sounds = default.node_sound_leaves_defaults(),
 | 
			
		||||
	paramtype = "light",
 | 
			
		||||
	paramtype2 = "colorwallmounted",
 | 
			
		||||
@@ -116,12 +116,7 @@ minetest.register_node(":homedecor:curtain_closed", {
 | 
			
		||||
		unifieddyes.fix_rotation(pos, placer, itemstack, pointed_thing)
 | 
			
		||||
	end,
 | 
			
		||||
	on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
 | 
			
		||||
		local topnode = minetest.get_node({x=pos.x, y=pos.y+1.0, z=pos.z})
 | 
			
		||||
		if string.find(topnode.name, "homedecor:curtainrod") then
 | 
			
		||||
			-- Open the curtains
 | 
			
		||||
			local fdir = node.param2
 | 
			
		||||
			minetest.set_node(pos, { name = "homedecor:curtain_open", param2 = fdir })
 | 
			
		||||
		end
 | 
			
		||||
		minetest.set_node(pos, { name = "homedecor:curtain_open", param2 = node.param2 })
 | 
			
		||||
		return itemstack
 | 
			
		||||
	end
 | 
			
		||||
})
 | 
			
		||||
@@ -143,12 +138,7 @@ minetest.register_node(":homedecor:curtain_open", {
 | 
			
		||||
		unifieddyes.fix_rotation(pos, placer, itemstack, pointed_thing)
 | 
			
		||||
	end,
 | 
			
		||||
	on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
 | 
			
		||||
		local topnode = minetest.get_node({x=pos.x, y=pos.y+1.0, z=pos.z})
 | 
			
		||||
		if string.find(topnode.name, "homedecor:curtainrod") then
 | 
			
		||||
			-- Close the curtains
 | 
			
		||||
			local fdir = node.param2
 | 
			
		||||
			minetest.set_node(pos, { name = "homedecor:curtain_closed", param2 = fdir })
 | 
			
		||||
		end
 | 
			
		||||
		minetest.set_node(pos, { name = "homedecor:curtain_closed", param2 = node.param2 })
 | 
			
		||||
		return itemstack
 | 
			
		||||
	end
 | 
			
		||||
})
 | 
			
		||||
@@ -390,7 +380,7 @@ minetest.register_craft({
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
minetest.register_craft( {
 | 
			
		||||
	output = "homedecor:curtain_closed 4",
 | 
			
		||||
	output = "homedecor:curtain_open 4",
 | 
			
		||||
		recipe = {
 | 
			
		||||
		{ "wool:white", "", ""},
 | 
			
		||||
		{ "wool:white", "", ""},
 | 
			
		||||
@@ -399,7 +389,7 @@ minetest.register_craft( {
 | 
			
		||||
})
 | 
			
		||||
 | 
			
		||||
minetest.register_craft( {
 | 
			
		||||
	output = "homedecor:curtain_closed 4",
 | 
			
		||||
	output = "homedecor:curtain_open 4",
 | 
			
		||||
		recipe = {
 | 
			
		||||
		{ "cottages:wool", "", ""},
 | 
			
		||||
		{ "cottages:wool", "", ""},
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user