forked from mtcontrib/homedecor_modpack
		
	Merge remote-tracking branch 'upstream/master'
This commit is contained in:
		@@ -41,4 +41,5 @@ read_globals = {
 | 
			
		||||
    "doors",
 | 
			
		||||
    "i3",
 | 
			
		||||
    "xcompat",
 | 
			
		||||
    "player_monoids"
 | 
			
		||||
}
 | 
			
		||||
@@ -23,7 +23,6 @@ if minetest.get_modpath("vessels") then
 | 
			
		||||
		},
 | 
			
		||||
		paramtype = "light",
 | 
			
		||||
		paramtype2 = "facedir",
 | 
			
		||||
		use_texture_alpha = "blend",
 | 
			
		||||
	})
 | 
			
		||||
 | 
			
		||||
	local sbox = {
 | 
			
		||||
@@ -37,7 +36,6 @@ if minetest.get_modpath("vessels") then
 | 
			
		||||
		tiles = {"homedecor_3d_vessels_shelf_glass.png"},
 | 
			
		||||
		inventory_image = "homedecor_3d_vessels_glass_bottle_inv.png",
 | 
			
		||||
		wield_image = "homedecor_3d_vessels_glass_bottle_inv.png",
 | 
			
		||||
		use_texture_alpha = "blend",
 | 
			
		||||
		selection_box = sbox
 | 
			
		||||
	})
 | 
			
		||||
 | 
			
		||||
@@ -56,7 +54,6 @@ if minetest.get_modpath("vessels") then
 | 
			
		||||
		tiles = {"homedecor_3d_vessels_shelf_glass.png"},
 | 
			
		||||
		inventory_image = "homedecor_3d_vessels_drinking_glass_inv.png",
 | 
			
		||||
		wield_image = "homedecor_3d_vessels_drinking_glass_inv.png",
 | 
			
		||||
		use_texture_alpha = "blend",
 | 
			
		||||
		selection_box = sbox
 | 
			
		||||
	})
 | 
			
		||||
end
 | 
			
		||||
 
 | 
			
		||||
@@ -239,7 +239,6 @@ homedecor.register("toilet_open", {
 | 
			
		||||
	selection_box = toilet_sbox,
 | 
			
		||||
	collision_box = toilet_cbox,
 | 
			
		||||
	drop = "homedecor:toilet",
 | 
			
		||||
	use_texture_alpha = "blend",
 | 
			
		||||
	groups = {cracky=3, dig_stone = 2},
 | 
			
		||||
	_sound_def = {
 | 
			
		||||
		key = "node_sound_stone_defaults",
 | 
			
		||||
 
 | 
			
		||||
@@ -19,6 +19,7 @@ local door_list = {
 | 
			
		||||
		sounds = default.node_sound_wood_defaults(),
 | 
			
		||||
		sound_open = "homedecor_door_open",
 | 
			
		||||
		sound_close = "homedecor_door_close",
 | 
			
		||||
		use_texture_alpha = "opaque",
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		name = "exterior_fancy",
 | 
			
		||||
@@ -26,25 +27,29 @@ local door_list = {
 | 
			
		||||
		sounds = default.node_sound_wood_defaults(),
 | 
			
		||||
		sound_open = "homedecor_door_open",
 | 
			
		||||
		sound_close = "homedecor_door_close",
 | 
			
		||||
		mesh = "homedecor_door_fancy"
 | 
			
		||||
		mesh = "homedecor_door_fancy",
 | 
			
		||||
		use_texture_alpha = "blend",
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		name = "french_oak",
 | 
			
		||||
		description = S("French door, Oak-colored"),
 | 
			
		||||
		sounds = default.node_sound_glass_defaults(),
 | 
			
		||||
		mesh = "homedecor_door_french"
 | 
			
		||||
		mesh = "homedecor_door_french",
 | 
			
		||||
		use_texture_alpha = "blend",
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		name = "french_mahogany",
 | 
			
		||||
		description = S("French door, Mahogany-colored"),
 | 
			
		||||
		sounds = default.node_sound_glass_defaults(),
 | 
			
		||||
		mesh = "homedecor_door_french"
 | 
			
		||||
		mesh = "homedecor_door_french",
 | 
			
		||||
		use_texture_alpha = "blend",
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		name = "french_white",
 | 
			
		||||
		description = S("French door, White"),
 | 
			
		||||
		sounds = default.node_sound_glass_defaults(),
 | 
			
		||||
		mesh = "homedecor_door_french"
 | 
			
		||||
		mesh = "homedecor_door_french",
 | 
			
		||||
		use_texture_alpha = "blend",
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		name = "basic_panel",
 | 
			
		||||
@@ -52,6 +57,7 @@ local door_list = {
 | 
			
		||||
		sounds = default.node_sound_wood_defaults(),
 | 
			
		||||
		sound_open = "homedecor_door_open",
 | 
			
		||||
		sound_close = "homedecor_door_close",
 | 
			
		||||
		use_texture_alpha = "opaque",
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		name = "wrought_iron",
 | 
			
		||||
@@ -59,7 +65,8 @@ local door_list = {
 | 
			
		||||
		sounds = default.node_sound_metal_defaults(),
 | 
			
		||||
		sound_open = "doors_steel_door_open",
 | 
			
		||||
		sound_close = "doors_steel_door_close",
 | 
			
		||||
		mesh = "homedecor_door_wrought_iron"
 | 
			
		||||
		mesh = "homedecor_door_wrought_iron",
 | 
			
		||||
		use_texture_alpha = "clip",
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		name = "carolina",
 | 
			
		||||
@@ -67,6 +74,7 @@ local door_list = {
 | 
			
		||||
		sounds = default.node_sound_wood_defaults(),
 | 
			
		||||
		sound_open = "homedecor_door_open",
 | 
			
		||||
		sound_close = "homedecor_door_close",
 | 
			
		||||
		use_texture_alpha = "blend",
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		name = "woodglass",
 | 
			
		||||
@@ -74,19 +82,22 @@ local door_list = {
 | 
			
		||||
		sounds = default.node_sound_wood_defaults(),
 | 
			
		||||
		sound_open = "homedecor_door_open",
 | 
			
		||||
		sound_close = "homedecor_door_close",
 | 
			
		||||
		mesh = "homedecor_door_wood_glass_3"
 | 
			
		||||
		mesh = "homedecor_door_wood_glass_3",
 | 
			
		||||
		use_texture_alpha = "clip",
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		name = "closet_mahogany",
 | 
			
		||||
		description = S("Mahogany Closet Door"),
 | 
			
		||||
		sounds = default.node_sound_wood_defaults(),
 | 
			
		||||
		mesh = "homedecor_door_closet"
 | 
			
		||||
		mesh = "homedecor_door_closet",
 | 
			
		||||
		use_texture_alpha = "clip",
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		name = "closet_oak",
 | 
			
		||||
		description = S("Oak Closet Door"),
 | 
			
		||||
		sounds = default.node_sound_wood_defaults(),
 | 
			
		||||
		mesh = "homedecor_door_closet"
 | 
			
		||||
		mesh = "homedecor_door_closet",
 | 
			
		||||
		use_texture_alpha = "clip",
 | 
			
		||||
	},
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -99,7 +110,7 @@ local function generate_door(def)
 | 
			
		||||
	local default_settings = {
 | 
			
		||||
		tiles = {{ name = "homedecor_door_" .. def.name .. ".png", backface_culling = true }},
 | 
			
		||||
		inventory_image = "homedecor_door_" .. def.name .. "_inv.png",
 | 
			
		||||
		use_texture_alpha = "blend",
 | 
			
		||||
		use_texture_alpha = def.use_texture_alpha or "blend",
 | 
			
		||||
		groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2},
 | 
			
		||||
		mesecons = {
 | 
			
		||||
			effector = {
 | 
			
		||||
@@ -410,8 +421,8 @@ minetest.register_craft( {
 | 
			
		||||
	type = "shapeless",
 | 
			
		||||
	output = "homedecor:gate_half_door_closed 4",
 | 
			
		||||
	recipe = {
 | 
			
		||||
		"doors:homedecor_wood_plain_a",
 | 
			
		||||
		"doors:homedecor_wood_plain_a"
 | 
			
		||||
		"doors:homedecor_wood_plain",
 | 
			
		||||
		"doors:homedecor_wood_plain"
 | 
			
		||||
	},
 | 
			
		||||
})
 | 
			
		||||
 | 
			
		||||
@@ -419,8 +430,8 @@ minetest.register_craft( {
 | 
			
		||||
	type = "shapeless",
 | 
			
		||||
	output = "homedecor:gate_half_door_white_closed 4",
 | 
			
		||||
	recipe = {
 | 
			
		||||
		"doors:homedecor_bedroom_a",
 | 
			
		||||
		"doors:homedecor_bedroom_a"
 | 
			
		||||
		"doors:homedecor_basic_panel",
 | 
			
		||||
		"doors:homedecor_basic_panel"
 | 
			
		||||
	},
 | 
			
		||||
})
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -4,7 +4,7 @@ Refrigerator=Kühlschrank
 | 
			
		||||
Oven=Backofen
 | 
			
		||||
Oven (stainless steel)=Backofen (Edelstahl)
 | 
			
		||||
Microwave Oven=Mikrowelle
 | 
			
		||||
Dishwasher=Spülmachine
 | 
			
		||||
Dishwasher=Spülmaschine
 | 
			
		||||
granite=Granit
 | 
			
		||||
marble=Marmor
 | 
			
		||||
steel=Stahl
 | 
			
		||||
 
 | 
			
		||||
@@ -488,7 +488,6 @@ for brightness_level = 0, 14 do
 | 
			
		||||
		description = S("Ground Lantern/Light"),
 | 
			
		||||
		mesh = "homedecor_ground_lantern.obj",
 | 
			
		||||
		tiles = { gen_ls_tex_yellow, "homedecor_generic_metal_wrought_iron.png" },
 | 
			
		||||
		use_texture_alpha = "blend",
 | 
			
		||||
		inventory_image = "homedecor_ground_lantern_inv.png",
 | 
			
		||||
		wield_image = "homedecor_ground_lantern_inv.png",
 | 
			
		||||
		groups = {snappy=3, not_in_creative_inventory = nici, dig_glass=1},
 | 
			
		||||
@@ -515,7 +514,6 @@ for brightness_level = 0, 14 do
 | 
			
		||||
		description = S("Hanging Lantern/Light"),
 | 
			
		||||
		mesh = "homedecor_hanging_lantern.obj",
 | 
			
		||||
		tiles = { "homedecor_generic_metal_wrought_iron.png", gen_ls_tex_yellow },
 | 
			
		||||
		use_texture_alpha = "blend",
 | 
			
		||||
		inventory_image = "homedecor_hanging_lantern_inv.png",
 | 
			
		||||
		wield_image = "homedecor_hanging_lantern_inv.png",
 | 
			
		||||
		groups = {snappy=3, not_in_creative_inventory = nici, dig_glass=1},
 | 
			
		||||
@@ -951,7 +949,6 @@ for _, light_brightn_name in ipairs({"off", "on"}) do
 | 
			
		||||
			gen_ls_tex_yellow,
 | 
			
		||||
			"homedecor_generic_metal_wrought_iron.png"
 | 
			
		||||
		},
 | 
			
		||||
		use_texture_alpha = "blend",
 | 
			
		||||
		inventory_image = "homedecor_wall_lamp_inv.png",
 | 
			
		||||
		groups = {snappy=3, not_in_creative_inventory = nici, dig_glass=1},
 | 
			
		||||
		light_source = onflag and (minetest.LIGHT_MAX - 3) or nil,
 | 
			
		||||
 
 | 
			
		||||
@@ -159,7 +159,7 @@ homedecor_roofing.register_slope = function(modname, subname, recipeitem, groups
 | 
			
		||||
		paramtype2 = "facedir",
 | 
			
		||||
		selection_box = slope_cbox,
 | 
			
		||||
		collision_box = slope_cbox,
 | 
			
		||||
		use_texture_alpha = "blend",
 | 
			
		||||
		use_texture_alpha = "clip",
 | 
			
		||||
		groups = groups,
 | 
			
		||||
		is_ground_content = false,
 | 
			
		||||
		_mcl_hardness=1.6,
 | 
			
		||||
 
 | 
			
		||||
@@ -33,7 +33,9 @@ minetest.register_node(":lrfurn:armchair", {
 | 
			
		||||
	on_rotate = unifieddyes.fix_after_screwdriver_nsew,
 | 
			
		||||
	on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
 | 
			
		||||
		return lrfurn.sit(pos, node, clicker, itemstack, pointed_thing, 1)
 | 
			
		||||
	end
 | 
			
		||||
	end,
 | 
			
		||||
	on_destruct = lrfurn.on_seat_destruct,
 | 
			
		||||
	on_movenode = lrfurn.on_seat_movenode,
 | 
			
		||||
})
 | 
			
		||||
 | 
			
		||||
homedecor.register("armchair", {
 | 
			
		||||
@@ -59,7 +61,9 @@ homedecor.register("armchair", {
 | 
			
		||||
	on_rotate = unifieddyes.fix_after_screwdriver_nsew,
 | 
			
		||||
	on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
 | 
			
		||||
		return lrfurn.sit(pos, node, clicker, itemstack, pointed_thing, 1)
 | 
			
		||||
	end
 | 
			
		||||
	end,
 | 
			
		||||
	on_destruct = lrfurn.on_seat_destruct,
 | 
			
		||||
	on_movenode = lrfurn.on_seat_movenode,
 | 
			
		||||
})
 | 
			
		||||
 | 
			
		||||
-- crafts
 | 
			
		||||
 
 | 
			
		||||
@@ -78,14 +78,63 @@ function lrfurn.fix_sofa_rotation_nsew(pos, placer, itemstack, pointed_thing)
 | 
			
		||||
	minetest.swap_node(pos, { name = node.name, param2 = fdir+colorbits })
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
local physics_cache = {}
 | 
			
		||||
local seated_cache = {}
 | 
			
		||||
local offset_cache = {}
 | 
			
		||||
 | 
			
		||||
minetest.register_entity("homedecor_seating:seat", {
 | 
			
		||||
	initial_properties = {
 | 
			
		||||
		visual = "cube",
 | 
			
		||||
		--comment out the following when testing so you can see it
 | 
			
		||||
		textures = {"blank.png", "blank.png", "blank.png", "blank.png", "blank.png", "blank.png"},
 | 
			
		||||
		collisionbox = { -0.01, -0.01, -0.01, 0.01, 0.01, 0.01 },
 | 
			
		||||
		selectionbox = { -0.01, -0.01, -0.01, 0.01, 0.01, 0.01, rotate = false },
 | 
			
		||||
		static_save = false,
 | 
			
		||||
	},
 | 
			
		||||
	on_punch = function(self)
 | 
			
		||||
		self.object:remove()
 | 
			
		||||
	end,
 | 
			
		||||
})
 | 
			
		||||
 | 
			
		||||
--we only care about 4 rotations, but just in case someone worldedits, etc - do something other than crash
 | 
			
		||||
--radians are stupid, using degrees and then converting
 | 
			
		||||
local p2r = {
 | 
			
		||||
	0*math.pi/180,
 | 
			
		||||
	0*math.pi/180, --correct
 | 
			
		||||
	180*math.pi/180, --correct
 | 
			
		||||
	90*math.pi/180, --correct
 | 
			
		||||
	270*math.pi/180, --correct
 | 
			
		||||
	0*math.pi/180,
 | 
			
		||||
	0*math.pi/180,
 | 
			
		||||
	0*math.pi/180,
 | 
			
		||||
}
 | 
			
		||||
p2r[0] = p2r[1]
 | 
			
		||||
 | 
			
		||||
local p2r_sofa = {
 | 
			
		||||
	0*math.pi/180,
 | 
			
		||||
	90*math.pi/180, --correct
 | 
			
		||||
	270*math.pi/180, --correct
 | 
			
		||||
	180*math.pi/180, --correct
 | 
			
		||||
	0*math.pi/180, --correct
 | 
			
		||||
	0*math.pi/180,
 | 
			
		||||
	0*math.pi/180,
 | 
			
		||||
	0*math.pi/180,
 | 
			
		||||
}
 | 
			
		||||
p2r_sofa[0] = p2r_sofa[1]
 | 
			
		||||
 | 
			
		||||
local p2r_facedir = {
 | 
			
		||||
	[0] = 180*math.pi/180,
 | 
			
		||||
	[1] = 90*math.pi/180,
 | 
			
		||||
	[2] = 0*math.pi/180,
 | 
			
		||||
	[3] = 270*math.pi/180,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function lrfurn.sit(pos, node, clicker, itemstack, pointed_thing, seats)
 | 
			
		||||
	if not clicker:is_player() then
 | 
			
		||||
		return itemstack
 | 
			
		||||
	end
 | 
			
		||||
 | 
			
		||||
	if physics_cache[clicker:get_player_name()] then
 | 
			
		||||
	local name = clicker:get_player_name()
 | 
			
		||||
	if seated_cache[name] then --already sitting
 | 
			
		||||
		lrfurn.stand(clicker)
 | 
			
		||||
		return itemstack
 | 
			
		||||
	end
 | 
			
		||||
@@ -113,41 +162,109 @@ function lrfurn.sit(pos, node, clicker, itemstack, pointed_thing, seats)
 | 
			
		||||
 | 
			
		||||
	--see if we can find a non occupied seat
 | 
			
		||||
	local sit_pos
 | 
			
		||||
	local sit_hash
 | 
			
		||||
	for hash, spos in pairs(valid_seats) do
 | 
			
		||||
		local pstatus = false
 | 
			
		||||
		for _, ref in pairs(minetest.get_objects_inside_radius(spos, 0.5)) do
 | 
			
		||||
			if ref:is_player() then
 | 
			
		||||
			if ref:is_player() and seated_cache[ref:get_player_name()] then
 | 
			
		||||
				pstatus = true
 | 
			
		||||
			end
 | 
			
		||||
		end
 | 
			
		||||
		if not pstatus then sit_pos = spos end
 | 
			
		||||
		if not pstatus then
 | 
			
		||||
			sit_pos = spos
 | 
			
		||||
			sit_hash = hash
 | 
			
		||||
			break;
 | 
			
		||||
		end
 | 
			
		||||
	end
 | 
			
		||||
	if not sit_pos then
 | 
			
		||||
		minetest.chat_send_player(clicker:get_player_name(), "sorry, this seat is currently occupied")
 | 
			
		||||
		minetest.chat_send_player(name, "sorry, this seat is currently occupied")
 | 
			
		||||
		return itemstack
 | 
			
		||||
	end
 | 
			
		||||
 | 
			
		||||
	--seat the player
 | 
			
		||||
	clicker:set_pos(sit_pos)
 | 
			
		||||
 | 
			
		||||
	xcompat.player.player_attached[clicker:get_player_name()] = true
 | 
			
		||||
	local entity = minetest.add_entity(sit_pos, "homedecor_seating:seat")
 | 
			
		||||
	if not entity then return itemstack end --catch for when the entity fails to spawn just in case
 | 
			
		||||
 | 
			
		||||
	clicker:set_attach(entity, "", {x = 0, y = 0, z = 0}, {x = 0, y = 0, z = 0}, true)
 | 
			
		||||
	local nodedef = minetest.registered_nodes[node.name]
 | 
			
		||||
	if nodedef.paramtype2 == "facedir" then
 | 
			
		||||
		entity:set_rotation({x = 0, y = p2r_facedir[node.param2 % 4], z = 0})
 | 
			
		||||
	elseif string.find(node.name, "sofa") then
 | 
			
		||||
		entity:set_rotation({x = 0, y = p2r_sofa[node.param2 % 8], z = 0})
 | 
			
		||||
	else
 | 
			
		||||
		entity:set_rotation({x = 0, y = p2r[node.param2 % 8], z = 0})
 | 
			
		||||
	end
 | 
			
		||||
 | 
			
		||||
	xcompat.player.player_attached[name] = true
 | 
			
		||||
    xcompat.player.set_animation(clicker, "sit", 0)
 | 
			
		||||
	physics_cache[clicker:get_player_name()] = table.copy(clicker:get_physics_override())
 | 
			
		||||
	clicker:set_physics_override({speed = 0, jump = 0, gravity = 0})
 | 
			
		||||
	seated_cache[name] = minetest.hash_node_position(pos)
 | 
			
		||||
	if seated_cache[name] ~= sit_hash then
 | 
			
		||||
		offset_cache[name] = core.hash_node_position(vector.subtract(pos, sit_pos))
 | 
			
		||||
	end
 | 
			
		||||
 | 
			
		||||
	return itemstack
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
function lrfurn.stand(clicker)
 | 
			
		||||
	xcompat.player.player_attached[clicker:get_player_name()] = false
 | 
			
		||||
	if physics_cache[clicker:get_player_name()] then
 | 
			
		||||
		clicker:set_physics_override(physics_cache[clicker:get_player_name()])
 | 
			
		||||
		physics_cache[clicker:get_player_name()] = nil
 | 
			
		||||
	else --in case this is called and the cache is empty
 | 
			
		||||
		clicker:set_physics_override({speed = 1, jump = 1, gravity = 1})
 | 
			
		||||
	local name = clicker:get_player_name()
 | 
			
		||||
	xcompat.player.player_attached[name] = false
 | 
			
		||||
	if seated_cache[name] then
 | 
			
		||||
		local attached_to = clicker:get_attach()
 | 
			
		||||
		-- Check, clearobjects might have been called, etc
 | 
			
		||||
		if attached_to then
 | 
			
		||||
			-- Removing also detaches
 | 
			
		||||
			attached_to:remove()
 | 
			
		||||
		end
 | 
			
		||||
		seated_cache[name] = nil
 | 
			
		||||
		offset_cache[name] = nil
 | 
			
		||||
	end
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
-- Called when a seat is destroyed
 | 
			
		||||
function lrfurn.on_seat_destruct(pos)
 | 
			
		||||
	for name, seatpos in pairs(seated_cache) do
 | 
			
		||||
		if seatpos == minetest.hash_node_position(pos) then
 | 
			
		||||
			local player = minetest.get_player_by_name(name)
 | 
			
		||||
			if player then
 | 
			
		||||
				lrfurn.stand(player)
 | 
			
		||||
			end
 | 
			
		||||
		end
 | 
			
		||||
	end
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
function lrfurn.on_seat_movenode(from_pos, to_pos)
 | 
			
		||||
	local hashed_from_pos = core.hash_node_position(from_pos)
 | 
			
		||||
	local hashed_to_pos = core.hash_node_position(to_pos)
 | 
			
		||||
	for name, seatpos in pairs(seated_cache) do
 | 
			
		||||
		if seatpos == hashed_from_pos then
 | 
			
		||||
			local player = core.get_player_by_name(name)
 | 
			
		||||
			if player then
 | 
			
		||||
				local attached_to = player:get_attach()
 | 
			
		||||
				-- Check, clearobjects might have been called, etc
 | 
			
		||||
				if attached_to then
 | 
			
		||||
					if offset_cache[name] then
 | 
			
		||||
						-- multi-seat node aka sofas
 | 
			
		||||
						attached_to:set_pos(vector.subtract(to_pos,
 | 
			
		||||
							core.get_position_from_hash(offset_cache[name])))
 | 
			
		||||
					else
 | 
			
		||||
						attached_to:set_pos(to_pos)
 | 
			
		||||
					end
 | 
			
		||||
					seated_cache[name] = hashed_to_pos
 | 
			
		||||
				end
 | 
			
		||||
			end
 | 
			
		||||
		end
 | 
			
		||||
	end
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
--if the player gets killed in the seat, handle it
 | 
			
		||||
minetest.register_on_dieplayer(function(player)
 | 
			
		||||
	if seated_cache[player:get_player_name()] then
 | 
			
		||||
		lrfurn.stand(player)
 | 
			
		||||
	end
 | 
			
		||||
end)
 | 
			
		||||
 | 
			
		||||
dofile(modpath.."/longsofas.lua")
 | 
			
		||||
dofile(modpath.."/sofas.lua")
 | 
			
		||||
dofile(modpath.."/armchairs.lua")
 | 
			
		||||
 
 | 
			
		||||
@@ -47,7 +47,9 @@ minetest.register_node(":lrfurn:longsofa", {
 | 
			
		||||
	on_dig = unifieddyes.on_dig,
 | 
			
		||||
	on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
 | 
			
		||||
		return lrfurn.sit(pos, node, clicker, itemstack, pointed_thing, 3)
 | 
			
		||||
	end
 | 
			
		||||
	end,
 | 
			
		||||
	on_destruct = lrfurn.on_seat_destruct,
 | 
			
		||||
	on_movenode = lrfurn.on_seat_movenode,
 | 
			
		||||
})
 | 
			
		||||
 | 
			
		||||
minetest.register_craft({
 | 
			
		||||
 
 | 
			
		||||
@@ -22,7 +22,9 @@ homedecor.register("deckchair", {
 | 
			
		||||
	on_rotate = minetest.get_modpath("screwdriver") and screwdriver.disallow or nil,
 | 
			
		||||
	on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
 | 
			
		||||
		return lrfurn.sit(pos, node, clicker, itemstack, pointed_thing, 1)
 | 
			
		||||
	end
 | 
			
		||||
	end,
 | 
			
		||||
	on_destruct = lrfurn.on_seat_destruct,
 | 
			
		||||
	on_movenode = lrfurn.on_seat_movenode,
 | 
			
		||||
})
 | 
			
		||||
 | 
			
		||||
minetest.register_alias("homedecor:deckchair_foot", "homedecor:deckchair")
 | 
			
		||||
@@ -42,7 +44,9 @@ homedecor.register("deckchair_striped_blue", {
 | 
			
		||||
	on_rotate = minetest.get_modpath("screwdriver") and screwdriver.disallow or nil,
 | 
			
		||||
	on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
 | 
			
		||||
		return lrfurn.sit(pos, node, clicker, itemstack, pointed_thing, 1)
 | 
			
		||||
	end
 | 
			
		||||
	end,
 | 
			
		||||
	on_destruct = lrfurn.on_seat_destruct,
 | 
			
		||||
	on_movenode = lrfurn.on_seat_movenode,
 | 
			
		||||
})
 | 
			
		||||
 | 
			
		||||
homedecor.register("simple_bench", {
 | 
			
		||||
@@ -62,7 +66,9 @@ homedecor.register("simple_bench", {
 | 
			
		||||
	},
 | 
			
		||||
	on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
 | 
			
		||||
		return lrfurn.sit(pos, node, clicker, itemstack, pointed_thing, 1)
 | 
			
		||||
	end
 | 
			
		||||
	end,
 | 
			
		||||
	on_destruct = lrfurn.on_seat_destruct,
 | 
			
		||||
	on_movenode = lrfurn.on_seat_movenode,
 | 
			
		||||
})
 | 
			
		||||
 | 
			
		||||
local bl1_sbox = {
 | 
			
		||||
@@ -154,7 +160,9 @@ homedecor.register("kitchen_chair_wood", {
 | 
			
		||||
	on_rotate = unifieddyes.fix_after_screwdriver_nsew,
 | 
			
		||||
	on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
 | 
			
		||||
		return lrfurn.sit(pos, node, clicker, itemstack, pointed_thing, 1)
 | 
			
		||||
	end
 | 
			
		||||
	end,
 | 
			
		||||
	on_destruct = lrfurn.on_seat_destruct,
 | 
			
		||||
	on_movenode = lrfurn.on_seat_movenode,
 | 
			
		||||
})
 | 
			
		||||
 | 
			
		||||
homedecor.register("kitchen_chair_padded", {
 | 
			
		||||
@@ -180,7 +188,9 @@ homedecor.register("kitchen_chair_padded", {
 | 
			
		||||
	on_rotate = unifieddyes.fix_after_screwdriver_nsew,
 | 
			
		||||
	on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
 | 
			
		||||
		return lrfurn.sit(pos, node, clicker, itemstack, pointed_thing, 1)
 | 
			
		||||
	end
 | 
			
		||||
	end,
 | 
			
		||||
	on_destruct = lrfurn.on_seat_destruct,
 | 
			
		||||
	on_movenode = lrfurn.on_seat_movenode,
 | 
			
		||||
})
 | 
			
		||||
 | 
			
		||||
local ofchairs_sbox = {
 | 
			
		||||
@@ -219,7 +229,9 @@ for _, c in pairs(chairs) do
 | 
			
		||||
		on_rotate = minetest.get_modpath("screwdriver") and screwdriver.rotate_simple or nil,
 | 
			
		||||
		on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
 | 
			
		||||
			return lrfurn.sit(pos, node, clicker, itemstack, pointed_thing, 1)
 | 
			
		||||
		end
 | 
			
		||||
		end,
 | 
			
		||||
		on_destruct = lrfurn.on_seat_destruct,
 | 
			
		||||
		on_movenode = lrfurn.on_seat_movenode,
 | 
			
		||||
	})
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -47,7 +47,9 @@ minetest.register_node(":lrfurn:sofa", {
 | 
			
		||||
	on_dig = unifieddyes.on_dig,
 | 
			
		||||
	on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
 | 
			
		||||
		return lrfurn.sit(pos, node, clicker, itemstack, pointed_thing, 2)
 | 
			
		||||
	end
 | 
			
		||||
	end,
 | 
			
		||||
	on_destruct = lrfurn.on_seat_destruct,
 | 
			
		||||
	on_movenode = lrfurn.on_seat_movenode,
 | 
			
		||||
})
 | 
			
		||||
 | 
			
		||||
minetest.register_craft({
 | 
			
		||||
 
 | 
			
		||||
@@ -57,7 +57,7 @@ minetest.register_node(":lrfurn:coffeetable", {
 | 
			
		||||
	},
 | 
			
		||||
	paramtype = "light",
 | 
			
		||||
	paramtype2 = "facedir",
 | 
			
		||||
	use_texture_alpha = "blend",
 | 
			
		||||
	use_texture_alpha = "clip",
 | 
			
		||||
	groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=3, axey=5},
 | 
			
		||||
	is_ground_content = false,
 | 
			
		||||
	_mcl_hardness=1.6,
 | 
			
		||||
 
 | 
			
		||||
@@ -15,7 +15,7 @@ minetest.register_node(":lrfurn:endtable", {
 | 
			
		||||
	},
 | 
			
		||||
	paramtype = "light",
 | 
			
		||||
	paramtype2 = "facedir",
 | 
			
		||||
	use_texture_alpha = "blend",
 | 
			
		||||
	use_texture_alpha = "clip",
 | 
			
		||||
	groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=3, axey=5},
 | 
			
		||||
	is_ground_content = false,
 | 
			
		||||
	_mcl_hardness=1.6,
 | 
			
		||||
 
 | 
			
		||||
@@ -34,7 +34,7 @@ for _, t in ipairs(leg_materials) do
 | 
			
		||||
		inventory_image = "homedecor_table_legs_"..name..".png",
 | 
			
		||||
		wield_image = "homedecor_table_legs_"..name..".png",
 | 
			
		||||
		walkable = false,
 | 
			
		||||
		use_texture_alpha = "blend",
 | 
			
		||||
		use_texture_alpha = "clip",
 | 
			
		||||
		groups = {snappy=3, dig_tree=2},
 | 
			
		||||
		_sound_def = {
 | 
			
		||||
			key = "node_sound_wood_defaults",
 | 
			
		||||
@@ -79,7 +79,7 @@ for i, mat in ipairs(tabletop_materials) do
 | 
			
		||||
				'blank.png',
 | 
			
		||||
			},
 | 
			
		||||
			wield_image = 'homedecor_'..m..'_table_'..shape..'_inv.png',
 | 
			
		||||
			use_texture_alpha = "blend",
 | 
			
		||||
			use_texture_alpha = "clip",
 | 
			
		||||
			groups = { snappy = 3, dig_tree=2 },
 | 
			
		||||
			_sound_def = {
 | 
			
		||||
				key = s,
 | 
			
		||||
@@ -117,7 +117,7 @@ for i, mat in ipairs(tabletop_materials) do
 | 
			
		||||
					'homedecor_'..m..'_table_edges.png',
 | 
			
		||||
					"homedecor_table_legs_"..leg_mat..".png",
 | 
			
		||||
				},
 | 
			
		||||
				use_texture_alpha = "blend",
 | 
			
		||||
				use_texture_alpha = "clip",
 | 
			
		||||
				groups = { snappy = 3, dig_tree=2 },
 | 
			
		||||
				_sound_def = {
 | 
			
		||||
					key = s
 | 
			
		||||
 
 | 
			
		||||
@@ -71,9 +71,9 @@ local function set_player_skin(player, skin, save)
 | 
			
		||||
	if save and not skinsdb_mod_path then
 | 
			
		||||
 | 
			
		||||
		if skin == default_skin then
 | 
			
		||||
			player:set_attribute("homedecor:player_skin", "")
 | 
			
		||||
			player:get_meta():set_string("homedecor:player_skin", "")
 | 
			
		||||
		else
 | 
			
		||||
			player:set_attribute("homedecor:player_skin", skin)
 | 
			
		||||
			player:get_meta():set_string("homedecor:player_skin", skin)
 | 
			
		||||
		end
 | 
			
		||||
	end
 | 
			
		||||
end
 | 
			
		||||
 
 | 
			
		||||
@@ -12,7 +12,7 @@ homedecor.register("window_quartered", {
 | 
			
		||||
		"homedecor_window_quartered.png",
 | 
			
		||||
		"homedecor_window_quartered.png"
 | 
			
		||||
	},
 | 
			
		||||
	use_texture_alpha = "blend",
 | 
			
		||||
	use_texture_alpha = "clip",
 | 
			
		||||
	groups = {snappy=3, dig_glass=2},
 | 
			
		||||
	_sound_def = {
 | 
			
		||||
		key = "node_sound_glass_defaults",
 | 
			
		||||
 
 | 
			
		||||
@@ -22,7 +22,6 @@ minetest.register_node("lavalamp:lavalamp", {
 | 
			
		||||
			},
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
	use_texture_alpha = "blend",
 | 
			
		||||
	inventory_image = "lavalamp_lamp_inv.png",
 | 
			
		||||
	paramtype = "light",
 | 
			
		||||
	paramtype2 = "color",
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user