Added some simple kitchen furniture elements and bedside tables

master
Andrey2470T 2019-03-12 00:03:54 +03:00
parent e2dd7413eb
commit 7a1e811de7
94 changed files with 30320 additions and 68052 deletions

View File

@ -1,3 +1,188 @@
cabs_table["simple_wooden_bedside_table"] = {
["simple_wooden_bedside_table_1"] = {
{mode="closed", button = "sw_bedt1_1", img_button = "open_button.png"},
{mode="closed", button = "sw_bedt1_2", img_button = "open_button.png"},
{mode="closed", button = "sw_bedt1_3", img_button = "open_button.png"},
},
["simple_wooden_bedside_table_2"] = {
{mode="opened", button = "sw_bedt2_1", img_button = "close_button.png", listname = "sw_bedt2_1", inv_size=6*2},
{mode="closed", button = "sw_bedt2_2", img_button = "open_button.png"},
{mode="closed", button = "sw_bedt2_3", img_button = "open_button.png"},
not_in_creative_inventory=1
},
["simple_wooden_bedside_table_3"] = {
{mode="closed", button = "sw_bedt3_1", img_button = "open_button.png"},
{mode="opened", button = "sw_bedt3_2", img_button = "close_button.png", listname = "sw_bedt3_2", inv_size=6*2},
{mode="closed", button = "sw_bedt3_3", img_button = "open_button.png"},
not_in_creative_inventory=1
},
["simple_wooden_bedside_table_4"] = {
{mode="closed", button = "sw_bedt4_1", img_button = "open_button.png"},
{mode="closed", button = "sw_bedt4_2", img_button = "open_button.png"},
{mode="opened", button = "sw_bedt4_3", img_button = "close_button.png", listname = "sw_bedt4_3", inv_size=6*2},
not_in_creative_inventory=1
},
["simple_wooden_bedside_table_5"] = {
{mode="opened", button = "sw_bedt5_1", img_button = "close_button.png", listname = "sw_bedt5_1", inv_size=6*2},
{mode="closed", button = "sw_bedt5_2", img_button = "open_button.png"},
{mode="opened", button = "sw_bedt5_3", img_button = "close_button.png", listname = "sw_bedt5_3", inv_size=6*2},
not_in_creative_inventory=1
},
["simple_wooden_bedside_table_6"] = {
{mode="opened", button = "sw_bedt6_1", img_button = "close_button.png", listname = "sw_bedt6_1", inv_size=6*2},
{mode="opened", button = "sw_bedt6_2", img_button = "close_button.png", listname = "sw_bedt6_2", inv_size=6*2},
{mode="closed", button = "sw_bedt6_3", img_button = "open_button.png"},
not_in_creative_inventory=1
},
["simple_wooden_bedside_table_7"] = {
{mode="closed", button = "sw_bedt7_1", img_button = "open_button.png"},
{mode="opened", button = "sw_bedt7_2", img_button = "close_button.png", listname = "sw_bedt7_2", inv_size=6*2},
{mode="opened", button = "sw_bedt7_3", img_button = "close_button.png", listname = "sw_bedt7_3", inv_size=6*2},
not_in_creative_inventory=1
},
["simple_wooden_bedside_table_8"] = {
{mode="opened", button = "sw_bedt8_1", img_button = "close_button.png", listname = "sw_bedt8_1", inv_size=6*2},
{mode="opened", button = "sw_bedt8_2", img_button = "close_button.png", listname = "sw_bedt8_2", inv_size=6*2},
{mode="opened", button = "sw_bedt8_3", img_button = "close_button.png", listname = "sw_bedt8_3", inv_size=6*2},
not_in_creative_inventory=1
},
inv_list = {{}, {}, {}}
}
for bedside_t, bedside_ts in pairs(cabs_table["simple_wooden_bedside_table"]) do
if bedside_t ~= "inv_list" then
minetest.register_node("luxury_decor:"..bedside_t, {
description = "Simple Wooden Bedside Table",
visual_scale = 0.5,
inventory_image = "simple_wooden_bedside_table_inv.png",
mesh = bedside_t..".b3d",
tiles = {"simple_bedside_table.png"},
paramtype = "light",
paramtype2 = "facedir",
groups = {choppy=3, not_in_creative_inventory = bedside_ts["not_in_creative_inventory"]},
drawtype = "mesh",
collision_box = {
type = "fixed",
fixed = {-0.5, -0.5, -0.5, 0.5, 0.5, 0.5}
},
selection_box = {
type = "fixed",
fixed = {-0.5, -0.5, -0.5, 0.5, 0.5, 0.5}
},
sounds = default.node_sound_wood_defaults(),
on_construct = function (pos)
local name = minetest.get_node(pos).name
local img_button1 = "image_button[0.5, 0;1, 2;" .. bedside_ts[1].img_button ..";" .. bedside_ts[1].button .. ";]"
local img_button2 = "image_button[0.5, 2.5;1, 2;" .. bedside_ts[2].img_button .. ";" .. bedside_ts[2].button .. ";]"
local img_button3 = "image_button[0.5, 5;1, 2;" .. bedside_ts[2].img_button .. ";" .. bedside_ts[3].button .. ";]"
local y = 0
local form = "size[9,11.5]" .. img_button1 .. img_button2 .. img_button3
for num, drawer in pairs(bedside_ts) do
if type(drawer) == "table" and drawer.mode == "opened" then
local str_pos = tostring(pos.x) .. ", " .. tostring(pos.y) .. ", " .. tostring(pos.z)
if not cabs_table["simple_wooden_bedside_table"].inv_list[num][str_pos] then
cabs_table["simple_wooden_bedside_table"].inv_list[num][str_pos] = {}
end
local list = "list[nodemeta:"..pos.x..","..pos.y..","..pos.z..";".. drawer.listname .. ";1.5,".. y .. ";6, 2]"
form = form .. list
end
y= y+2.5
end
form = form .. "list[current_player;main;0.5,7.5;8,4;]"
local meta = minetest.get_meta(pos)
meta:set_string("formspec", form)
local inv = meta:get_inventory()
for num2, drawer2 in pairs(bedside_ts) do
if type(drawer2) == "table" and drawer2.inv_size ~= nil and drawer2.listname ~= nil then
local str_pos = tostring(pos.x) .. ", " .. tostring(pos.y) .. ", " .. tostring(pos.z)
inv:set_list(bedside_ts[num2].listname, cabs_table["simple_wooden_bedside_table"].inv_list[num2][str_pos])
inv:set_size(bedside_ts[num2].listname, bedside_ts[num2].inv_size)
end
end
--[[local cabs_items_list = {}
local str_pos = tostring(pos.x) .. ", " .. tostring(pos.y) .. ", " .. tostring(pos.z)
local cab_num =
for num, list in pairs(kit_wood_cabs.inv_list[cab_num]) do
cabs_items_list[num] = list[str_pos]
for num2, list2 in pairs(list) do
for num3, itemstack in pairs(list2) do
if itemstack ~= nil then
minetest.debug(dump(cabs_items_list[num]))
cabs_items_list[num][num2][num3] = itemstack:get_name()
end
end
end
end
local inv_lists = {}
for num, list in pairs(inv:get_lists()) do
inv_lists[num] = list
for num2, itemstack in pairs(list) do
if itemstack ~= nil then
inv_lists[num][num2] = itemstack:get_name()
end
end
end]]
--minetest.debug(dump(cabs_items_list))
--minetest.debug(dump(inv_lists))
inv:set_size("main", 8*4)
end,
on_receive_fields = function (pos, formname, fields, sender)
local name = minetest.get_node(pos).name
local generalized_name = string.sub(name, 14, -3)
local meta = minetest.get_meta(pos)
local defined_mode = cabinets.define_mode(fields, name)
local button_name
for num, drawer in pairs(bedside_ts) do
if type(drawer) == "table" then
local name = drawer.button
if fields[name] then
button_name = name
break
end
end
end
if defined_mode == "closed" then
cabinets.open(sender, pos, "luxury_decor:" .. cabinets.define_needed_cabinet(fields, name), generalized_name, button_name, meta:get_string("formspec"), {"open_Drawer", "open_Drawer", "open_Drawer"})
elseif defined_mode == "opened" then
cabinets.close(sender, pos, "luxury_decor:" .. cabinets.define_needed_cabinet(fields, name), generalized_name, button_name, meta:get_string("formspec"), {"close_Drawer", "close_Drawer", "close_Drawer"})
end
end,
after_dig_node = function (pos, oldnode, oldmetadata, digger)
local name = string.sub(oldnode.name, 14)
local generalized_name = string.sub(name, 1, -3)
if cabs_table[generalized_name][name] then
for num, drawer_lists in pairs(cabs_table[generalized_name].inv_list) do
for cab_pos, drawer_list in pairs(drawer_lists) do
local str_pos = tostring(pos.x) .. "," .. tostring(pos.y) .. "," .. tostring(pos.z)
if cab_pos == str_pos then
cabs_table[generalized_name].inv_list[num][cab_pos] = nil
end
end
end
end
end
})
end
end
local rgb_colors = {
["black"] = "#000000",
["red"] = "#FF0000",
@ -17,10 +202,8 @@ local rgb_colors = {
}
local bed_num = 0
for color, rgb_code in pairs(rgb_colors) do
bed_num = bed_num + 1
minetest.register_node("luxury_decor:royal_single_bed_" .. bed_num, {
minetest.register_node("luxury_decor:royal_single_bed_" .. color, {
description = "Royal Single Bed",
visual_scale = 0.5,
mesh = "royal_single_bed.obj",
@ -32,36 +215,60 @@ for color, rgb_code in pairs(rgb_colors) do
collision_box = {
type = "fixed",
fixed = {
{-1.5, -0.5, -0.5, 1.5, 0.5, 0.5}
{-0.5, -0.5, -1.44, 0.5, 0.3, 0.46},
{-0.5, -0.5, 0.46, 0.5, 1.5, 0.65},
{-0.5, -0.5, -1.44, 0.5, 0.3, -1.65}
}
},
selection_box = {
type = "fixed",
fixed = {
{-1.5, -0.5, -0.5, 1.5, 0.5, 0.5}
{-0.5, -0.5, -1.44, 0.5, 0.3, 0.46},
{-0.5, -0.5, 0.46, 0.5, 1.5, 0.65},
{-0.5, -0.5, -1.44, 0.5, 1.5, -1.65}
}
},
sounds = default.node_sound_wood_defaults(),
on_rightclick = function (pos, node, clicker, itemstack, pointed_thing)
if itemstack:get_name() == "luxury_decor:royal_single_bed" then
local x1, y1, z1 = pos.x, pos.y, pos.z
local x2 = pointed_thing.above.x or pointed_thing.under.x
local y2 = pointed_thing.above.y or pointed_thing.under.y
local z2 = pointed_thing.above.z or pointed_thing.under.z
if pointed_thing.type == "node" and x1 ~= x2 and y1 == y2 and z1 == z2 then
local single_bed_coords = pointed_thing.above or pointed_thing.under
minetest.remove_node(pos)
minetest.set_node(single_bed_coords, {name="luxury_decor:royal_double_bed", param1=node.param1, param2=node.param2})
if string.find(itemstack:get_name(), "royal_single_bed") then
local color1 = string.sub(node.name, 32, -1)
local color2 = string.sub(itemstack:get_name(), 32, -1)
if color1 == color2 then
local axle
for axis, vector in pairs(minetest.facedir_to_dir(node.param2)) do
if vector ~= 0 then
axle = axis
end
end
local exact_pos = minetest.pointed_thing_to_face_pos(clicker, pointed_thing)
local new_pos = pos
for axis, val in pairs(pointed_thing.above) do
if val ~= pointed_thing.under and axis ~= axle then
if exact_pos[axis] < pos[axis] then
new_pos[axis] = new_pos[axis] -1
end
minetest.remove_node(pos)
minetest.set_node(new_pos, {name="luxury_decor:royal_double_bed_" .. color, param1=node.param1, param2=node.param2})
end
end
end
elseif string.find(itemstack:get_name(), "dye:") then
local color_dye = string.sub(itemstack:get_name(), 5)
minetest.remove_node(pos)
minetest.set_node(pos, {name="luxury_decor:royal_single_bed_" .. color_dye, param1=node.param1, param2=node.param2})
itemstack:take_item()
return itemstack
end
end
})
minetest.register_node("luxury_decor:royal_double_bed_" .. bed_num, {
minetest.register_node("luxury_decor:royal_double_bed_" .. color, {
description = "Royal Double Bed",
visual_scale = 0.5,
mesh = "royal_double_bed.obj",
mesh = "royal_double_bed.b3d",
tiles = {"royal_bed.png^(royal_bed_2.png^[colorize:"..rgb_code..")"},
paramtype = "light",
paramtype2 = "facedir",
@ -70,15 +277,29 @@ for color, rgb_code in pairs(rgb_colors) do
collision_box = {
type = "fixed",
fixed = {
{-1.1, -0.5, -1.8, 1.1, 0.5, 0.5}
{-0.5, -0.5, -1.62, 1.5, 0.3, 0.27},
{-0.5, -0.5, 0.27, 1.5, 1.5, 0.47},
{-0.5, -0.5, -1.62, 1.5, 1.5, -1.82}
}
},
selection_box = {
type = "fixed",
fixed = {
{-1.1, -0.5, -1.8, 1.1, 0.5, 0.5}
{-0.5, -0.5, -1.62, 1.5, 0.3, 0.27},
{-0.5, -0.5, 0.27, 1.5, 1.5, 0.47},
{-0.5, -0.5, -1.62, 1.5, 1.5, -1.82}
}
},
sounds = default.node_sound_wood_defaults()
sounds = default.node_sound_wood_defaults(),
on_rightclick = function (pos, node, clicker, itemstack, pointed_thing)
if string.find(itemstack:get_name(), "dye:") then
local color_dye = string.sub(itemstack:get_name(), 5)
minetest.remove_node(pos)
minetest.set_node(pos, {name="luxury_decor:royal_double_bed_" .. color_dye, param1=node.param1, param2=node.param2})
itemstack:take_item()
return itemstack
end
end
})
end

View File

@ -5,7 +5,7 @@ function chairs.attach_player_to_node (attacher, node, node_pos, pos)
attacher:set_pos(pos)
local phys_over = attacher:get_physics_override()
attacher:set_physics_override({speed=0, jump=0})
attacher:get_meta():set_string("is_attached", minetest.serialize({node, node_pos=node_pos, pos, old_phys_over = phys_over}))
attacher:get_meta():set_string("is_attached", minetest.serialize({node=node, node_pos=node_pos, pos, old_phys_over = phys_over}))
end
function chairs.disattach_player_from_node(disattacher)
@ -49,17 +49,19 @@ end
function chairs.set_look_dir(player)
local is_attached = player:get_meta():get_string("is_attached")
local is_attached = minetest.deserialize(player:get_meta():get_string("is_attached"))
if is_attached ~= nil or is_attached ~= "" then
minetest.debug(dump(is_attached))
local node_dir = is_attached.node.param2
local player_dir = player:get_look_dir()
local degrees = 0
local radians = 0
while node_dir ~= player_dir do
degrees = degrees + 57.2958
radians = degrees * math.pi / 180
degrees = degrees + 90
radians = math.floor(math.rad(degrees))
player:set_look_horizontal(radians)
player_dir = player:get_look_dir()
minetest.debug(dump(player_dir))
end
else
return
@ -129,8 +131,8 @@ minetest.register_node("luxury_decor:kitchen_wooden_chair", {
collision_box = {
type = "fixed",
fixed = {
{-0.3, -0.5, -0.25, 0.45, 0.22, 0.38},
{-0.3, -0.5, 0.38, 0.45, 1, 0.48}
{-0.43, -0.45, -0.4, 0.43, 0.39, 0.35},
{-0.43, -0.45, 0.35, 0.43, 1.3, 0.46}
--[[{-0.65, -0.3, -1.46, 0.65, 1.4, -1.66},
{-0.65, -0.3, 0.46, 0.65, 1.4, 0.66}]]
}
@ -138,8 +140,8 @@ minetest.register_node("luxury_decor:kitchen_wooden_chair", {
selection_box = {
type = "fixed",
fixed = {
{-0.3, -0.5, -0.25, 0.45, 0.22, 0.38},
{-0.3, -0.5, 0.38, 0.45, 1, 0.48}
{-0.43, -0.45, -0.4, 0.43, 0.39, 0.35},
{-0.43, -0.45, 0.35, 0.43, 1.3, 0.46}
}
},
sounds = default.node_sound_wood_defaults(),
@ -164,7 +166,6 @@ minetest.register_node("luxury_decor:kitchen_wooden_chair", {
local is_attached = minetest.deserialize(meta:get_string("is_attached"))
if is_attached == nil or is_attached == "" then
chairs.sit_player(clicker, node, pos, {{{x=81, y=81}, frame_speed=15, frame_blend=0}})
chairs.set_look_dir(clicker)
elseif is_attached ~= nil or is_attached ~= "" then
chairs.standup_player(clicker, pos)
@ -223,7 +224,6 @@ minetest.register_node("luxury_decor:luxury_wooden_chair_with_cushion", {
local is_attached = minetest.deserialize(meta:get_string("is_attached"))
if is_attached == nil or is_attached == "" then
chairs.sit_player(clicker, node, pos, {{{x=81, y=81}, frame_speed=15, frame_blend=0}})
chairs.set_look_dir(clicker)
elseif is_attached ~= nil or is_attached ~= "" then
chairs.standup_player(clicker, pos)
@ -282,7 +282,6 @@ minetest.register_node("luxury_decor:decorative_wooden_chair", {
local is_attached = minetest.deserialize(meta:get_string("is_attached"))
if is_attached == nil or is_attached == "" then
chairs.sit_player(clicker, node, pos, {{{x=81, y=81}, frame_speed=15, frame_blend=0}})
chairs.set_look_dir(clicker)
elseif is_attached ~= nil or is_attached ~= "" then
chairs.standup_player(clicker, pos)
@ -319,7 +318,7 @@ minetest.register_node("luxury_decor:round_wooden_chair", {
sounds = default.node_sound_wood_defaults(),
on_construct = function (pos)
local meta = minetest.get_meta(pos)
meta:set_string("seats_range", minetest.serialize({[1] = {is_busy={bool=false, player=nil}, pos = {x = pos.x, y = pos.y+0.2, z = pos.z}}}))
meta:set_string("seats_range", minetest.serialize({[1] = {is_busy={bool=false, player=nil}, pos = {x = pos.x, y = pos.y+0.4, z = pos.z}}}))
end,
after_dig_node = function (pos, oldnode, oldmetadata, digger)
local seats = minetest.deserialize(oldmetadata.fields.seats_range)
@ -337,7 +336,6 @@ minetest.register_node("luxury_decor:round_wooden_chair", {
local is_attached = minetest.deserialize(meta:get_string("is_attached"))
if is_attached == nil or is_attached == "" then
chairs.sit_player(clicker, node, pos, {{{x=81, y=81}, frame_speed=15, frame_blend=0}})
chairs.set_look_dir(clicker)
elseif is_attached ~= nil or is_attached ~= "" then
chairs.standup_player(clicker, pos)
@ -346,7 +344,51 @@ minetest.register_node("luxury_decor:round_wooden_chair", {
end
})
for _, material in ipairs({"", "jungle", "pine_"}) do
for i = 1, 9 do
minetest.register_craft({
type = "shapeless",
output = "luxury_decor:" .. material .. " wooden_plank",
recipe = {"default:" .. material .. "wood"}
})
end
end
minetest.register_craft({
output = "luxury_decor:kitchen_wooden_chair",
recipe = {
{"luxury_decor:wooden_plank", "default:stick", "default:stick"},
{"luxury_decor:wooden_plank", "default:stick", ""},
{"luxury_decor:wooden_plank", "default:stick", ""}
}
})
minetest.register_craft({
output = "luxury_decor:luxury_wooden_chair_with_cushion",
recipe = {
{"luxury_decor:jungle_wooden_plank", "default:stick", "default:stick"},
{"luxury_decor:jungle_wooden_plank", "default:stick", "wool:white"},
{"luxury_decor:jungle_wooden_plank", "default:stick", ""}
}
})
minetest.register_craft({
output = "luxury_decor:round_wooden_chair",
recipe = {
{"luxury_decor:pine_wooden_plank", "default:stick", "default:stick"},
{"luxury_decor:pine_wooden_plank", "default:stick", ""},
{"luxury_decor:pine_wooden_plank", "default:stick", ""}
}
})
minetest.register_craft({
output = "luxury_decor:decorative_wooden_chair",
recipe = {
{"luxury_decor:jungle_wooden_plank", "default:stick", "default:stick"},
{"luxury_decor:jungle_wooden_plank", "default:stick", ""},
{"luxury_decor:jungle_wooden_plank", "default:stick", ""}
}
})
--[[minetest.register_on_joinplayer(function (player)
local is_attached = minetest.deserialize(player:get_meta():get_string("is_attached"))
--minetest.debug(dump(is_attached))

View File

@ -1,3 +1,4 @@
cabs_table = {}
local modpath = minetest.get_modpath("luxury_decor")
dofile(modpath.."/bedroom.lua")
@ -9,3 +10,4 @@ dofile(modpath.."/music.lua")
dofile(modpath.."/redecorating.lua")
dofile(modpath.."/shelves.lua")
dofile(modpath.."/living_room.lua")
dofile(modpath.."/materials.lua")

File diff suppressed because it is too large Load Diff

View File

@ -8,13 +8,15 @@ local flowers_list = {
minetest.register_node("luxury_decor:glass_vase", {
description = "Glass Vase",
visual_scale = 0.5,
mesh = "glass_vase.b3d",
tiles = {"glass_vase.png"},
drawtype = "mesh",
mesh = "glass_vase1.b3d",
use_texture_alpha = true,
tiles = {"glass_vase.png"},
inventory_image = "glass_vase_inv.png",
sunlight_propagates = true,
paramtype = "light",
paramtype2 = "facedir",
groups = {choppy = 1.5},
drawtype = "mesh",
collision_box = {
type = "fixed",
fixed = {
@ -57,13 +59,14 @@ for ind, f in pairs(flowers_list.name) do
minetest.register_node("luxury_decor:glass_vase_with_"..f, {
description = "Glass Vase With " .. flowers_list.desc[ind],
visual_scale = 0.5,
mesh = "glass_vase.b3d",
inventory_image = "glass_vase_inv.png",
mesh = "glass_vase1.b3d",
tiles = {"glass_vase.png^flowers_"..f..".png"},
use_texture_alpha = true,
paramtype = "light",
paramtype2 = "facedir",
drop = {"luxury_decor:glass_vase", "luxury_decor:glass_vase_with_"..f},
groups = {choppy = 1.5},
groups = {choppy = 1.5, not_in_creative_inventory=1},
use_texture_alpha = true,
drawtype = "mesh",
collision_box = {
type = "fixed",
@ -86,7 +89,7 @@ for ind, f in pairs(flowers_list.name) do
minetest.remove_node(pos)
minetest.set_node(pos, {name="luxury_decor:glass_vase_with_"..flower})
itemstack:add_item("luxury_decor:glass_vase")
itemstack:add_item("flowers:" .. string.sub(node.name, 29))
itemstack:add_item("flowers:" .. string.sub(node.name, 30))
return itemstack
end
end
@ -94,7 +97,7 @@ for ind, f in pairs(flowers_list.name) do
minetest.remove_node(pos)
minetest.set_node(pos, {name="luxury_decor:glass_vase"})
itemstack:add_item("flowers:" .. string.sub(node.name, 29))
itemstack:add_item("flowers:" .. string.sub(node.name, 30))
end
})
end
@ -119,37 +122,392 @@ local sofas_rgb_colors = {
local sofas_collision_boxes = {
["1"] = {
{-0.5, -0.5, -0.5, 0.5, 0.5, 0.5},
{-0.34, -0.45, -0.4, 0.34, 0.05, 0.35}, -- Lower box
{-0.34, -0.45, 0.35, 0.34, 0.55, 0.49}, -- Back box
{-0.34, -0.45, -0.4, -0.51, 0.3, 0.49}, -- Right box
{0.34, -0.45, -0.4, 0.51, 0.3, 0.49} -- Left box
},
["2"] = {
{-0.5, -0.5, -0.5, 0.5, 0.5, 0.5},
{-0.34, -0.45, -0.4, 0.51, 0.05, 0.35},
{-0.34, -0.45, 0.35, 0.51, 0.55, 0.49},
{-0.34, -0.45, -0.4, -0.51, 0.3, 0.49}
},
["3"] = {
{-0.5, -0.5, -0.5, 0.5, 0.5, 0.5},
{-0.34, -0.45, -0.4, 0.51, 0.05, 0.35},
{-0.34, -0.45, 0.35, 0.51, 0.55, 0.49},
{0.34, -0.45, -0.4, 0.51, 0.3, 0.49}
},
["4"] = {
{-0.5, -0.5, -0.5, 0.5, 0.5, 0.5},
}
},
["5"] = {
{-0.5, -0.5, -0.5, 0.5, 0.5, 0.5},
{-0.34, -0.45, -0.4, 0.51, 0.05, 0.35},
{-0.34, -0.45, 0.35, 0.51, 0.55, 0.49},
}
}
local footstools_collision_boxes = {
["small"] = {{-0.3, -0.5, -0.3, 0.3, 0.2, 0.3}},
["middle"] = {{-0.3, -0.5, -0.3, 1.1, 0.2, 0.3}},
["long"] = {{-0.3, -0.5, -0.3, 1.8, 0.2, 0.3}}
["small"] = {{-0.3, -0.5, -0.3, 0.3, 0, 0.3}},
["middle"] = {{-0.3, -0.5, 0.3, 0.3, 0, -1.1}},
["long"] = {{-0.3, -0.5, 0.3, 0.3, 0, 1.8}}
}
function is_same_nums_sign(num1, num2)
if num1 < 0 and num2 < 0 or num1 > 0 and num2 >0 then
return true
else
return false
end
end
--"node1" contains: {name, param1, param2, pointed_thing, pos}
sofas = {}
sofas.connect_sofas = function (player, node1, node2)
local name1 = node1.name
local new_name1 = string.sub(name1, 21, "_")
local node2 = string.sub(node2, 21, "_")
if new_name1 == node2 then
sofas.define_needed_sofa_part = function (player, sofa, sofa2, replace_sofa1, replace_sofa2, pos, pointed_thing)
local ordered_axises_table = {"-x", "-z", "x", "z"}
pointed_axis = nil
node_vector = nil
local surface_pos = minetest.pointed_thing_to_face_pos(player, pointed_thing)
for axis, val in pairs(pointed_thing.above) do
if pointed_thing.under[axis] ~= val then
if surface_pos[axis] < 0 and surface_pos[axis] < pos[axis] then
pointed_axis = "-" .. tostring(axis)
elseif surface_pos[axis] < 0 and surface_pos[axis] > pos[axis] then
pointed_axis = tostring(axis)
elseif surface_pos[axis] > 0 and surface_pos[axis] < pos[axis] then
pointed_axis = "-" .. tostring(axis)
elseif surface_pos[axis] > 0 and surface_pos[axis] > pos[axis] then
pointed_axis = tostring(axis)
end
end
end
for axis2, vector in pairs(minetest.facedir_to_dir(sofa.param2)) do
if vector ~= 0 then
if vector < 0 then
node_vector = "-" .. tostring(axis2)
elseif vector > 0 then
node_vector = tostring(axis2)
end
end
end
for num, axis in pairs(ordered_axises_table) do
if axis == pointed_axis then
pointed_axis_ind = num
end
if axis == node_vector then
node_vector_ind = num
end
end
if pointed_axis_ind > node_vector_ind then
return {replace_sofa1, replace_sofa2}
elseif pointed_axis_ind < node_vector_ind then
return {replace_sofa2, replace_sofa1}
end
end
sofas.define_needed_sofa_pos = function (player, sofa, pointed_thing)
local surface_pos = minetest.pointed_thing_to_face_pos(player, pointed_thing)
local new_pos = sofa.pos
for axis, val in pairs(pointed_thing.above) do
if val ~= pointed_thing.under[axis] then
if surface_pos[axis] < sofa.pos[axis] then
new_pos[axis] = new_pos[axis] - 1
return new_pos
elseif surface_pos[axis] > sofa.pos[axis] then
new_pos[axis] = new_pos[axis] + 1
return new_pos
end
end
end
end
sofas.connect_sofas = function (player, node1, node2, pos, pointed_thing)
local node_color1 = string.sub(node1.name, 22, -6)
local node_color2 = string.sub(node2, 22, -6)
local surface_pos = minetest.pointed_thing_to_face_pos(player, pointed_thing)
-- Определяет ось, по которой грань была кликнута
for axis, val in pairs(pointed_thing.above) do
if val ~= pointed_thing.under[axis] then
used_pt_axis = {axis=axis, val=surface_pos[axis]}
end
end
for axis, vector in pairs(minetest.facedir_to_dir(node1.param2)) do
if vector ~= 0 then
node_vector = {axis=axis, vector=vector}
end
end
-- Проверяет, цвет подушки у new_name1 такой же, как и у node2
if node_color1 == node_color2 then
-- Проверяет, node2 - полный ли диван, затем находит от позиции кликнутого дивана в радиусе 1 другие диваны
if string.find(node2, "_1_") then
if string.find(node1.name, "_1_") then
if used_pt_axis.axis ~= node_vector.axis then
local node1_table = {name=node1.name, param1=node1.param1, param2=node1.param2}
local needed_sofa_parts = sofas.define_needed_sofa_part(player, node1_table, node2, string.gsub(node1.name, "1", "2"), string.gsub(node2, "1", "3"), pos, pointed_thing)
local needed_pos = sofas.define_needed_sofa_pos(player, {name=node1.name, param1=node1.param1, param2=node1.param2, pos=pos}, pointed_thing)
minetest.remove_node(pos)
minetest.set_node(needed_pos, {name = needed_sofa_parts[2], param1=node1.param1, param2=node1.param2})
minetest.set_node(pos, {name = needed_sofa_parts[1], param1=node1.param1, param2=node1.param2})
else
return
end
elseif string.find(node1.name, "_2_") or string.find(node1.name, "_3_") then
if used_pt_axis.axis ~= node_vector.axis then
local ordered_axles = {"-x", "-z", "x", "z"}
for num, axle in pairs(ordered_axles) do
local axis = string.sub(axle, -1, -1)
local executed1 = false
local executed2 = false
if used_pt_axis.val < pos[axis] and executed1 ~= true and tonumber(axis) == used_pt_axis.axis then
local used_pt_axle = "-" .. tostring(used_pt_axis.axis)
executed1 = true
else
local used_pt_axle = tostring(used_pt_axis.axis)
executed1 = true
end
if node_vector.vector < 0 and executed2 ~= true then
minetest.debug("CCCC")
local node_vect = "-" .. tostring(node_vector.axis)
executed2 = true
else
minetest.debug("DDDD")
local node_vect = tostring(node_vector.axis)
executed2 = true
end
--minetest.debug(used_pt_axle)
--minetest.debug(node_vect)
if axle == used_pt_axle then
minetest.debug("AAA")
local num1 = num
end
if axle == node_vect then
minetest.debug("BBB")
local num2 = num
if num1 < num2 and string.find(node1.name, "_3_") then
local needed_sofa_pos = sofas.define_needed_sofa_pos(player, {name=node1.name, param1=node1.param1, param2=node1.param2, pos=pos}, pointed_thing)
local rep = string.gsub(node2, "1", "5")
local rep2 = string.gsub(node2, "1", "3")
minetest.set_node(pos, {name=rep[1], param1=node1.param1, param2=node1.param2})
minetest.set_node(needed_sofa_pos, {name=rep2[1], param1=node1.param1, param2=node1.param2})
return true
elseif num1 > num2 and string.find(node1.name, "_2_") then
local needed_sofa_pos = sofas.define_needed_sofa_pos(player, {name=node1.name, param1=node1.param1, param2=node1.param2, pos=pos}, pointed_thing)
local rep = string.gsub(node2, "1", "5")
local rep2 = string.gsub(node2, "1", "2")
minetest.set_node(pos, {name=rep[1], param1=node1.param1, param2=node1.param2})
minetest.set_node(needed_sofa_pos, {name=rep2[1], param1=node1.param1, param2=node1.param2})
return true
end
end
end
elseif used_pt_axis.axis == node_vector.axis then
if is_same_nums_sign(used_pt_axis.val, node_vector.vector) then
if string.find(node1.name, "_2_") then
local ordered_axles = {"-x", "-z", "x", "z"}
for num, axle in pairs(ordered_axles) do
if used_pt_axis.val < 0 then
local used_pt_axle = "-" .. tostring(used_pt_axis.axis)
else
local used_pt_axle = tostring(used_pt_axis.axis)
end
if used_pt_axle == axle then
if #ordered_axles == num then
local needed_axis = ordered_axles[1]
local needed_axis2 = ordered_axles[2]
else
local needed_axis = ordered_axles[num+1]
if needed_axis == axle then
needed_axis2 = ordered_axles[1]
else
needed_axis2 = ordered_axles[num+2]
end
end
local new_vector = node_vector
if string.find(needed_axis, "-") then
new_vector[tonumber(string.sub(needed_axis, -1))] = -1
else
new_vector[tostring(needed_axis)] = 1
end
if string.find(needed_axis2, "-") then
new_vector[tonumber(string.sub(needed_axis2, -1))] = -1
else
new_vector[tostring(needed_axis)] = 1
end
local rep = string.gsub(node2, "1", "4")
local rep2 = string.gsub(node2, "1", "2")
minetest.set_node(pos, {name=rep[1], param1=node1.param1, param2=minetest.dir_to_facedir(new_vector)})
local needed_sofa_pos = sofas.define_needed_sofa_pos(player, {name=node1.name, param1=node1.param1, param2=node1.param2, pos=pos}, pointed_thing)
minetest.set_node(needed_sofa_pos, {name=rep2[1], param1=node1.param1, param2=minetest.dir_to_facedir(needed_axis2)})
end
end
elseif string.find(node1.name, "_3_") then
local ordered_axles = {"-x", "-z", "x", "z"}
for num, axle in pairs(ordered_axles) do
if used_pt_axis.val < 0 then
local used_pt_axle = "-" .. tostring(used_pt_axis.axis)
else
local used_pt_axle = tostring(used_pt_axis.axis)
end
if used_pt_axle == axle then
if num == 1 then
local needed_axis = ordered_axles[#ordered_axles]
else
local needed_axis = ordered_axles[num-1]
end
local new_vector = node_vector
if string.find(needed_axis, "-") then
new_vector[tonumber(string.sub(needed_axis, -1))] = -1
else
new_vector[tostring(needed_axis)] = 1
end
local rep = string.gsub(node2, "1", "4")
local rep2 = string.gsub(node2, "1", "3")
minetest.set_node(pos, {name=rep[1], param1=node1.param1, param2=node1.param2})
local needed_sofa_pos = sofas.define_needed_sofa_pos(player, {name=node1.name, param1=node1.param1, param2=node1.param2, pos=pos}, pointed_thing)
minetest.set_node(needed_sofa_pos, {name=rep2[1], param1=node1.param1, param2=minetest.dir_to_facedir(needed_axis)})
end
end
end
end
end
else
return
end
else
return
end
else
return
end
end
--[[local surface_pos = minetest.pointed_thing_to_face_pos(player, pointed_thing)
local nearby_sofas = minetest.find_nodes_in_area({x=pos.x-1, y=pos.y, z=pos.z-1}, {x=pos.x+1, y=pos.y, z=pos.z+1}, {"luxury_decor:simple_sofa_5"})
if nearby_sofas then
for _, sofa_pos in ipairs(nearby_sofas) do
local node = minetest.get_node(sofa_pos)
for axis, vector in pairs(minetest.facedir_to_dir(node.param2)) do
if vector ~= 0 then
local node2_vector = {axis=axis, vector=vector}
end
end
if node.name == "luxury_decor:simple_sofa_5" and node2_vector.axis == node_vector.axis then
for axis, val in pairs(sofa_pos) do
if val ~= used_pt_axis.val then
local p = node1.pos
local sofas = minetest.find_nodes_in_area({x=p.x-1, y=p.y, z=p.z-1}, {x=p.x+1, y=p.y, z=p.z+1},
{"luxury_decor:simple_sofa_2", "luxury_decor:simple_sofa_3", "luxury_decor:simple_sofa_4", "luxury_decor:simple_sofa_5"})
for _, sofa_pos in ipairs(sofas) do
local sofa_itemstr = minetest.get_node(sofa_pos).name
if sofa_itemstr == "luxury_decor:simple_sofa_5" then
for axis, val in pairs(sofa_pos) do
if
if minetest.get_node(sofa_pos).param2 == node1.param2 and node1.pos[axis] ==
if not string.find(node1.name, "_4_") then
for axis, val in pairs(node1.pointed_thing.above) do
if val ~= node1.pointed_thing.under[axis] and axis ~= y then
local new_pos = node1.pos
local player_dir = player:get_look_dir()
if player_dir[axis] < 0 then
new_pos[axis] = new_pos[axis] + 1
minetest.set_node(new_pos, {name=node2, param1=node1.param1, param2=node2.param2})
elseif player_dir[axis] > 0 then
new_pos[axis] = new_pos[axis] - 1
minetest.set_node(new_pos, {name=node2, param1=node1.param1, param2=node2.param2})
end
return true
end
end
else
local node_dir = node1.param2
local directed_axis
for axis, val in pairs(node_dir) do
if val ~= 0 and axis ~= y then
directed_axis = {axis, val}
elseif axis == y then
return
end
end
for axis, val in pairs(node1.pointed_thing.above) do
if val ~= node1.pointed_thing.under[axis] and axis ~= y then
local new_pos = node1.pos
local player_dir = player:get_look_dir()
if player_dir[axis] < 0 then
new_pos[axis] = new_pos[axis] + 1
if axis == directed_axis.axis and directed_axis.val ~= player_dir[axis] then
minetest.set_node(new_pos, {name=node2, param1=node1.param1, param2=node2.param2})
elseif axis ~= directed_axis.axis and directed_axis.val ~= player_dir[axis] then
local new_dir = minetest.facedir_to_dir(node1.param2)
new_dir[axis] = 1
minetest.set_node(new_pos, {name=node2, param1=node1.param1, param2= minetest.dir_to_facedir(new_dir)})
end
elseif player_dir[axis] > 0 then
new_pos[axis] = new_pos[axis] - 1
if axis == directed_axis.axis and directed_axis.val ~= player_dir[axis] then
minetest.set_node(new_pos, {name=node2, param1=node1.param1, param2=node2.param2})
elseif axis ~= directed_axis.axis and directed_axis.val ~= player_dir[axis] then
local new_dir = minetest.facedir_to_dir(node1.param2)
new_dir[axis] = -1
minetest.set_node(new_pos, {name=node2, param1=node1.param1, param2= minetest.dir_to_facedir(new_dir)})
end
end
return true
end
end
end
else
return
end
else
return
end
end
local dir = player:get_look_dir()
local new_pos = node1.pos
for axis, num in pairs(dir) do
@ -169,33 +527,38 @@ sofas.connect_sofas = function (player, node1, node2)
end
--[[if string.find(name1, "_4") then
if string.find(name1, "_4") then
local dir = node1.param2
if dir.x ~= 0 then
minetest.set_node(node2, {x=node1.pos.x, y=pos})]]
for color, rgb_color in pairs(sofas_rgb_colors) do
for _, pillow_color in ipairs({"red", "green" , "blue", "yellow", "violet"}) do
minetest.register_node("luxury_decor:simple_" .. color .. "_armchair_with_" .. pillow_color .. "_pillow", {
description = minetest.colorize(sofas_rgb_colors[color], "Simple " .. string.upper(color) .. " Armchair With " .. string.upper(pillow_color) .. " Pillow" ),
visual_scale = 0.5,
mesh = "simple_armchair.obj",
tiles = {"simple_sofa.png^(simple_sofa_2.png^[colorize:" .. rgb_code .. ")^(simple_sofa_3.png^[colorize:" .. pillow_color .. ")"},
tiles = {"simple_armchair.png^(simple_armchair_2_1.png^[colorize:" .. rgb_color .. "^simple_armchair_2.png)^(simple_armchair_3.png^[colorize:" .. pillow_color .. ")"},
paramtype = "light",
paramtype2 = "facedir",
groups = {choppy = 2.5},
groups = {choppy = 2.5, },
drawtype = "mesh",
collision_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, 0.5, 0.5}
{-0.31, -0.5, -0.45, 0.33, 0.15, 0.5},
{-0.5, -0.5, -0.45, -0.31, 0.36, 0.3},
{0.53, -0.5, -0.45, 0.33, 0.36, 0.3},
{-0.42, 0.15, 0.3, 0.44, 0.9, 0.5}
}
},
selection_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, 0.5, 0.5}
{-0.31, -0.5, -0.45, 0.33, 0.15, 0.5},
{-0.5, -0.5, -0.45, -0.31, 0.36, 0.3},
{0.53, -0.5, -0.45, 0.33, 0.36, 0.3},
{-0.42, 0.15, 0.3, 0.44, 0.9, 0.5}
}
},
sounds = default.node_sound_wood_defaults(),
@ -203,6 +566,17 @@ for color, rgb_color in pairs(sofas_rgb_colors) do
local meta = minetest.get_meta(pos)
meta:set_string("seats_range", minetest.serialize({[1] = {is_busy={bool=false, player=nil}, pos = {x = pos.x, y = pos.y+0.2, z = pos.z}}}))
end,
after_dig_node = function (pos, oldnode, oldmetadata, digger)
local seats = minetest.deserialize(oldmetadata.fields.seats_range)
if seats ~= nil then
for seat_num, seat_data in pairs(seats) do
if seat_data.is_busy.player ~= nil then
local player = minetest.get_player_by_name(seat_data.is_busy.player)
chairs.standup_player(player, pos, seats)
end
end
end
end,
on_rightclick = function (pos, node, clicker, itemstack, pointed_thing)
if string.find(itemstack:get_name(), "dye:") then
local get_player_contr = clicker:get_player_control()
@ -229,7 +603,6 @@ for color, rgb_color in pairs(sofas_rgb_colors) do
local is_attached = minetest.deserialize(meta:get_string("is_attached"))
if is_attached == nil or is_attached == "" then
chairs.sit_player(clicker, node, pos, {{{x=81, y=81}, frame_speed=15, frame_blend=0}})
chairs.set_look_dir(clicker)
elseif is_attached ~= nil or is_attached ~= "" then
chairs.standup_player(clicker, pos)
@ -243,255 +616,84 @@ for color, rgb_color in pairs(sofas_rgb_colors) do
end
for ind, sofa_count in pairs({"1", "2", "3", "4", "5"}) do
local not_in_cinv = 0
for color, rgb_color in pairs(sofas_rgb_colors) do
for _, pillow_color in ipairs({"red", "green" , "blue", "yellow", "violet"}) do
minetest.register_node("luxury_decor:simple_".. color .. "_" .. sofa_count .. "_sofa_with_" .. pillow_color .. "_pillow", {
description = minetest.colorize(sofas_rgb_colors[color], "Simple " .. string.upper(color) .. " Sofa With " .. string.upper(pillow_color) .. " Pillow" ),
visual_scale = 0.5,
mesh = "simple_sofa_" .. sofa_count .. ".obj",
tiles = {"simple_sofa.png^(simple_sofa_2.png^[colorize:" .. rgb_code .. ")^(simple_sofa_3.png^[colorize:" .. pillow_color .. ")"},
paramtype = "light",
paramtype2 = "facedir",
groups = {choppy = 2.5},
drawtype = "mesh",
collision_box = {
type = "fixed",
fixed = sofas_collision_boxes[sofa_count]
},
selection_box = {
type = "fixed",
fixed = sofas_collision_boxes[sofa_count]
},
sounds = default.node_sound_wood_defaults(),
on_construct = function (pos)
local meta = minetest.get_meta(pos)
meta:set_string("seats_range", minetest.serialize({[1] = {is_busy={bool=false, player=nil}, pos = {x = pos.x, y = pos.y+0.2, z = pos.z}}}))
end,
after_dig_node = function (pos, oldnode, oldmetadata, digger)
local seats = minetest.deserialize(oldmetadata.fields.seats_range)
if seats ~= nil then
for seat_num, seat_data in pairs(seats) do
if seat_data.is_busy.player ~= nil then
local player = minetest.get_player_by_name(seat_data.is_busy.player)
chairs.standup_player(player, pos, seats)
end
end
end
end,
on_rightclick = function (pos, node, clicker, itemstack, pointed_thing)
if string.find(itemstack:get_name(), "dye:") then
local get_player_contr = clicker:get_player_control()
if get_player_contr.sneak then
for _, p_color in ipairs({"red", "green", "blue", "yellow", "violet"}) do
if itemstack:get_name() == "dye:" .. p_color then
itemstack:take_item()
minetest.remove_node(pos)
minetest.set_node(pos, {name="luxury_decor:simple_" .. color .. "_" .. sofa_count .. "_sofa_with_" .. p_color .. "_pillow"})
end
end
else
for color2, rgb_code in pairs(sofas_rgb_colors) do
if "dye:" .. color2 == itemstack:get_name() then
itemstack:take_item()
minetest.remove_node(pos)
minetest.set_node(pos, {name="luxury_decor:simple_" .. color2 .. "_" .. sofa_count .. "_sofa_with_" .. pillow_color .. "_pillow"})
end
end
end
elseif string.find(itemstack:get_name(), "simple_sofa_") then
sofas.connect_sofas({name=node.name, param1=node.param1, param2=node.param2, pos=pos}, itemstack:get_name())
else
local meta = clicker:get_meta()
local is_attached = minetest.deserialize(meta:get_string("is_attached"))
if is_attached == nil or is_attached == "" then
chairs.sit_player(clicker, node, pos, {{{x=81, y=81}, frame_speed=15, frame_blend=0}})
chairs.set_look_dir(clicker)
elseif is_attached ~= nil or is_attached ~= "" then
chairs.standup_player(clicker, pos)
--for _, pillow_color in ipairs({"red", "green" , "blue", "yellow", "violet"}) do
if sofa_count ~= "1" then
not_in_cinv = 1
end
minetest.register_node("luxury_decor:simple_".. sofa_count .. "_" .. color .. "_sofa", {
description = minetest.colorize(sofas_rgb_colors[color], "Simple " .. string.upper(color) .. " Sofa"),
visual_scale = 0.5,
mesh = "simple_sofa_" .. sofa_count .. ".obj",
tiles = {"simple_sofa.png^(simple_sofa_2.png^[colorize:" .. rgb_color.. ")"},
paramtype = "light",
paramtype2 = "facedir",
groups = {choppy = 2.5, not_in_creative_inventory = not_in_cinv},
drawtype = "mesh",
collision_box = {
type = "fixed",
fixed = sofas_collision_boxes[sofa_count]
},
selection_box = {
type = "fixed",
fixed = sofas_collision_boxes[sofa_count]
},
sounds = default.node_sound_wood_defaults(),
on_construct = function (pos)
local meta = minetest.get_meta(pos)
meta:set_string("seats_range", minetest.serialize({[1] = {is_busy={bool=false, player=nil}, pos = {x = pos.x, y = pos.y+0.2, z = pos.z}}}))
end,
after_dig_node = function (pos, oldnode, oldmetadata, digger)
local seats = minetest.deserialize(oldmetadata.fields.seats_range)
if seats ~= nil then
for seat_num, seat_data in pairs(seats) do
if seat_data.is_busy.player ~= nil then
local player = minetest.get_player_by_name(seat_data.is_busy.player)
chairs.standup_player(player, pos, seats)
end
end
return itemstack
end
end
end
end
end
for ind, sofa_type in pairs({"small", "middle", "long", "corner_1", "corner_2"}) do
for color, rgb_code in pairs(sofas_rgb_colors) do
for _, pillow_color in ipairs({"red", "green" , "blue", "yellow", "violet"}) do
minetest.register_node("luxury_decor:simple_".. color .. "_" .. sofa_type .. "_sofa_with_" .. pillow_color .. "_pillows", {
description = minetest.colorize(sofas_rgb_colors[color], "Simple " .. string.upper(color) .. " " .. string.upper(sofa_type) .. " Sofa With " .. string.upper(pillow_color) .. " Pillows" ),
visual_scale = 0.5,
mesh = "simple_"..sofa_type.."_sofa.obj",
tiles = {"simple_sofa.png^(simple_sofa_2.png^[colorize:" .. rgb_code .. ")^(simple_sofa_3.png^[colorize:" .. pillow_color .. ")"},
paramtype = "light",
paramtype2 = "facedir",
groups = {choppy = 2.5},
drawtype = "mesh",
collision_box = {
type = "fixed",
fixed = sofas_collision_boxes[sofa_type]
},
selection_box = {
type = "fixed",
fixed = sofas_collision_boxes[sofa_type]
},
sounds = default.node_sound_wood_defaults(),
on_construct = function (pos)
local meta = minetest.get_meta(pos)
local seats_table = {
{["small"] =
{[1]=
{
is_busy = {bool=false, player=nil},
pos = {x = pos.x, y=pos.y+0.2, z = pos.z}
}
}
},
{["middle"] =
{[1]=
{
is_busy={bool=false, player=nil},
pos={x = pos.x, y = pos.y+0.2, z = pos.z}
},
[2]=
{
is_busy={bool=false, player=nil},
pos={x=pos.x+1, y=pos.y+0.2, z=pos.z}
}
}
},
{["long"] = {[1]={is_busy={bool=false, player_obj=nil}, pos={x=pos.x, y=pos.y+0.2, z=pos.z}},
[2]={is_busy={bool=false, player=nil}, pos={x=pos.x+1, y=pos.y+0.2, z=pos.z}},
[3]={is_busy={bool=false, player=nil}, pos={x=pos.x+2, y=pos.y+0.2, z=pos.z}}}},
{["corner_1"] = {[1]={is_busy={bool=false, player=nil}, pos={x=pos.x, y=pos.y+0.2, z=pos.z}},
[2]={is_busy={bool=false, player=nil}, pos={x=pos.x+1, y=pos.y+0.2, z=pos.z}},
[3]={is_busy={bool=false, player=nil}, pos={x=pos.x+2, y=pos.y+0.2, z=pos.z}},
[4]={is_busy={bool=false, player=nil}, pos={x=pos.x+2, y=pos.y+0.2, z=pos.z-1}}}},
{["corner_2"] = {[1]={is_busy={bool=false, player=nil}, pos={x=pos.x, y=pos.y+0.2, z=pos.z-1}},
[2]={is_busy={bool=false, player=nil}, pos={x=pos.x, y=pos.y+0.2, z=pos.z}},
[3]={is_busy={bool=false, player=nil}, pos={x=pos.x+1, y=pos.y+0.2, z=pos.z}},
[4]={is_busy={bool=false, player=nil}, pos={x=pos.x+2, y=pos.y+0.2, z=pos.z}}}}
}
for num, data in pairs(seats_table) do
for sf_type, sf_data in pairs(seats_table[num]) do
if minetest.get_node(pos).name == "luxury_decor:simple_" .. color .. "_" .. sf_type .. "_sofa_with_" .. pillow_color .. "_pillows" then
meta:set_string("seats_range", minetest.serialize(sf_data))
end,
on_rightclick = function (pos, node, clicker, itemstack, pointed_thing)
if string.find(itemstack:get_name(), "dye:") then
local get_player_contr = clicker:get_player_control()
--[[if get_player_contr.sneak then
for _, p_color in ipairs({"red", "green", "blue", "yellow", "violet"}) do
if itemstack:get_name() == "dye:" .. p_color then
itemstack:take_item()
minetest.remove_node(pos)
minetest.set_node(pos, {name="luxury_decor:simple_" .. sofa_count .. "_" .. color .. "_sofa_with_" .. p_color .. "_pillow"})
end
end]]
for color2, rgb_code in pairs(sofas_rgb_colors) do
if "dye:" .. color2 == itemstack:get_name() then
itemstack:take_item()
minetest.remove_node(pos)
minetest.set_node(pos, {name="luxury_decor:simple_" .. sofa_count .. "_" .. color2 .. "_sofa"})
end
end
end
end
end,
after_dig_node = function (pos, oldnode, oldmetadata, digger)
--local seats = minetest.deserialize(minetest.get_meta(pos):get_string("seats_range"))
local seats = minetest.deserialize(oldmetadata.fields.seats_range)
if seats ~= nil then
for seat_num, seat_data in pairs(seats) do
if seat_data.is_busy.player ~= nil then
local player = minetest.get_player_by_name(seat_data.is_busy.player)
chairs.standup_player(player, pos, seats)
elseif string.find(itemstack:get_name(), "luxury_decor:simple_") and string.find(itemstack:get_name(), "_sofa") then
sofas.connect_sofas(clicker, {name=node.name, param1=node.param1, param2=node.param2}, itemstack:get_name(), pos, pointed_thing)
else
local meta = clicker:get_meta()
local is_attached = minetest.deserialize(meta:get_string("is_attached"))
if is_attached == nil or is_attached == "" then
chairs.sit_player(clicker, node, pos, {{{x=81, y=81}, frame_speed=15, frame_blend=0}})
elseif is_attached ~= nil or is_attached ~= "" then
chairs.standup_player(clicker, pos)
end
end
end
end,
on_rightclick = function (pos, node, clicker, itemstack, pointed_thing)
if string.find(itemstack:get_name(), "dye:") then
local get_player_contr = clicker:get_player_control()
if get_player_contr.sneak then
for _, p_color in ipairs({"red", "green", "blue", "yellow", "violet"}) do
if itemstack:get_name() == "dye:" .. p_color then
itemstack:take_item()
minetest.remove_node(pos)
minetest.set_node(pos, {name="luxury_decor:simple_" .. color .. "_" .. sofa_type .. "_sofa_with_" .. p_color .. "_pillows"})
end
end
else
for color2, rgb_code in pairs(sofas_rgb_colors) do
if "dye:" .. color2 == itemstack:get_name() then
itemstack:take_item()
minetest.remove_node(pos)
minetest.set_node(pos, {name="luxury_decor:simple_" .. color2 .. "_" .. sofa_type .. "_sofa_with_" .. pillow_color .. "_pillows"})
end
end
end
elseif string.find(itemstack:get_name(), "luxury_decor:simple_" .. color .. "_small_sofa_with_" .. pillow_color .. "_pillows") then
local dir = clicker:get_look_dir()
local player_pos = clicker:get_pos()
if pointed_thing.under.x ~= pointed_thing.above.x and string.find(node.name, "_long_") == nil then
local sofas_types_list = {"small", "middle", "long"}
if dir.x > 0 then
itemstack:take_item()
minetest.remove_node(pos)
minetest.set_node({x=pos.x-1, y=pos.y, z=pos.z}, {name="luxury_decor:simple_" .. color .. "_" .. sofas_types_list[ind+1] .. "_sofa_with_" .. pillow_color .. "_pillows"})
elseif dir.x < 0 then
itemstack:take_item()
minetest.remove_node(pos)
minetest.set_node({x=pos.x, y=pos.y, z=pos.z}, {name="luxury_decor:simple_" .. color .. "_" .. sofas_types_list[ind+1] .. "_sofa_with_" .. pillow_color .. "_pillows"})
end
--[[elseif pointed_thing.under.x > pointed_thing.above.x and string.find(node.name, "_long_") == nil then
local sofas_types_list = {"small", "middle", "long"}
if dir.x < 0 then
itemstack:take_item()
minetest.remove_node(pos)
minetest.set_node({x=pos.x-1, y=pos.y, z=pos.z}, {name="luxury_decor:simple_" .. color .. "_" .. sofas_types_list[ind+1] .. "_sofa_with_" .. pillow_color .. "_pillows"})
elseif dir.x > 0 then
itemstack:take_item()
minetest.remove_node(pos)
minetest.set_node({x=pos.x, y=pos.y, z=pos.z}, {name="luxury_decor:simple_" .. color .. "_" .. sofas_types_list[ind+1] .. "_sofa_with_" .. pillow_color .. "_pillows"})
end]]
elseif pointed_thing.above.z ~= pointed_thing.under.z and player_pos.z < pos.z and string.find(node.name, "_long_") ~= nil then
if dir.x > 0 then
itemstack:take_item()
minetest.remove_node(pos)
minetest.set_node({x=pos.x-3, y=pos.y, z=pos.z}, {name="luxury_decor:simple_" .. color .. "_corner1_sofa_with_" .. pillow_color .. "_pillows"})
elseif dir.x < 0 then
itemstack:take_item()
minetest.remove_node(pos)
minetest.set_node(pos, {name="luxury_decor:simple_" .. color .. "_corner2_sofa_with_" .. pillow_color .. "_pillows"})
end
--elseif pointed_thing.under.x > pointed_thing.above.x and dir.y > 0 and string.find(node.name, "_long_") == nil then
--itemstack:take_item()
--minetest.remove_node(pos)
--minetest.set_node({x=pos.x-1, y=pos.y, z=pos.z}, {name="luxury_decor:simple_" .. color .. "_" .. footstools_types_list[ind+1] .. "_footstool"})
--elseif pointed_thing.under.y > pointed_thing.above.y and dir.y > 0 and string.find(node.name, "_long_") == nil then
--itemstack:take_item()
--minetest.remove_node(pos)
--minetest.set_node({x=pos.x, y=pos.y, z=pos.z-1}, {name="luxury_decor:simple_" .. color .. "_" .. footstools_types_list[ind+1] .. "_footstool"})
-- elseif pointed_thing.under.y < pointed_thing.above.y and dir.y < 0 and string.find(node.name, "_long_") == nil then
--itemstack:take_item()
--minetest.remove_node(pos)
--minetest.set_node({x=pos.x, y=pos.y, z=pos.z+1}, {name="luxury_decor:simple_" .. color .. "_" .. footstools_types_list[ind+1] .. "_footstool"})
end
else
local meta = clicker:get_meta()
local is_attached = minetest.deserialize(meta:get_string("is_attached"))
if is_attached == nil or is_attached == "" then
chairs.sit_player(clicker, node, pos, {{{x=81, y=81}, frame_speed=15, frame_blend=0}})
elseif is_attached ~= nil or is_attached ~= "" then
chairs.standup_player(clicker, pos)
end
end
return itemstack
end
})
end
})
end
end
for ind, footstool_type in pairs({"small", "middle", "long"}) do
@ -559,11 +761,15 @@ end
minetest.register_node("luxury_decor:simple_wooden_wall_clock", {
description = "Simple Wooden Wall Clock",
visual_scale = 0.5,
mesh = "simple_wooden_wall_clock.obj",
tiles = {{
name = "simple_wooden_wall_clock_animated.png",
animation = {type = "vertical_frames", aspect_w = 64, aspect_h = 64, lenght = 40.0}
}},
mesh = "simple_wooden_wall_clock.b3d",
tiles = {
{
name = "simple_wooden_wall_clock_animated.png",
animation = {type = "vertical_frames", aspect_w = 64, aspect_h = 64, length = 60.0}
}
},
inventory_image = "simple_wooden_wall_clock_inv.png",
wield_image = "simple_wooden_wall_clock_inv.png",
paramtype = "light",
paramtype2 = "facedir",
groups = {choppy = 2},

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 182 B

After

Width:  |  Height:  |  Size: 238 B

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

View File

@ -4947,7 +4947,6 @@ f 580/2141/421 516/2142/421 549/2143/421 637/2144/421
f 579/2145/422 515/2146/422 548/2147/422 638/2148/422
f 578/2149/423 514/2150/423 547/2151/423 639/2152/423
f 546/2153/424 513/2154/424 545/2155/424 640/2156/424
usemtl Material.001_NONE
f 396/2157/425 88/2158/425 397/2159/425 90/2160/425 398/2161/425 92/2162/425 399/2163/425 94/2164/425 400/2165/425 96/2166/425 528/2167/425 560/2168/425 527/2169/425 559/2170/425 526/2171/425 558/2172/425 525/2173/425 557/2174/425 524/2175/425 556/2176/425 523/2177/425 86/2178/425
f 391/2179/426 78/2180/426 392/2181/426 80/2182/426 393/2183/426 82/2184/426 394/2185/426 84/2186/426 395/2187/426 86/2188/426 523/2189/426 555/2190/426 522/2191/426 554/2192/426 521/2193/426 553/2194/426 520/2195/426 552/2196/426 519/2197/426 551/2198/426 518/2199/426 76/2200/426
f 385/2201/427 68/2202/427 387/2203/427 70/2204/427 388/2205/427 72/2206/427 389/2207/427 74/2208/427 390/2209/427 76/2210/427 518/2211/427 550/2212/427 517/2213/427 549/2214/427 516/2215/427 548/2216/427 515/2217/427 547/2218/427 514/2219/427 545/2220/427 513/2221/427 577/2222/427 544/2223/427 576/2224/427 543/2225/427 126/2226/427 416/2227/427 128/2228/427 417/2229/427 66/2230/427

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,28 +1,31 @@
minetest.register_node("luxury_decor:laminate", {
description = "Floor tile (laminate)",
tiles = {"laminate.png"},
paramtype = "light",
groups = {snappy=2},
drawtype = "nodebox",
node_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, -0.45, 0.5}
}
},
selection_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, -0.45, 0.5}
}
},
sounds = default.node_sound_leaves_defaults()
})
for _, material in ipairs({"", "jungle_", "pine_"}) do
minetest.register_node("luxury_decor:" .. material .. "laminate", {
description = "Floor tile (" .. material .. "laminate)",
tiles = {material .. "laminate.png"},
paramtype = "light",
groups = {snappy=2},
drawtype = "nodebox",
node_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, -0.45, 0.5}
}
},
selection_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, -0.45, 0.5}
}
},
sounds = default.node_sound_leaves_defaults()
})
end
minetest.register_node("luxury_decor:simple_flowerpot", {
description = "Simple Flowerpot",
visual_scale = 0.5,
mesh = "simple_flowerpot.obj",
mesh = "simple_flowerpot.b3d",
inventory_image = "simple_flowerpot_inv.png",
tiles = {"simple_flowerpot.png"},
paramtype = "light",
paramtype2 = "facedir",
@ -48,7 +51,7 @@ minetest.register_node("luxury_decor:simple_flowerpot", {
minetest.register_node("luxury_decor:luxury_flowerpot", {
description = "Luxury Flowerpot",
visual_scale = 0.5,
mesh = "luxury_flowerpot.obj",
mesh = "luxury_flowerpot.b3d",
inventory_image = "luxury_flowerpot_inv.png",
tiles = {"luxury_flowerpot.png"},
paramtype = "light",

View File

@ -125,11 +125,12 @@ minetest.register_node("luxury_decor:simple_wooden_table", {
sounds = default.node_sound_wood_defaults()
})
minetest.register_node("luxury_decor:luxury_wooden_table", {
minetest.register_node("luxury_decor:luxury_metallic_table", {
description = "Luxury Wooden Table",
visual_scale = 0.5,
mesh = "luxury_wooden_table.obj",
tiles = {"luxury_wooden_table.png"},
mesh = "luxury_metallic_table.obj",
tiles = {"luxury_metallic_table.png"},
inventory_image = "luxury_metallic_table_inv.png",
paramtype = "light",
paramtype2 = "facedir",
groups = {choppy = 2.5},
@ -150,3 +151,57 @@ minetest.register_node("luxury_decor:luxury_wooden_table", {
},
sounds = default.node_sound_wood_defaults()
})
minetest.register_node("luxury_decor:kitchen_wooden_table", {
description = "Kitchen Wooden Table",
visual_scale = 0.5,
mesh = "kitchen_wooden_table.obj",
tiles = {"bright_wood_material.png"},
inventory_image = "kitchen_wooden_table_inv.png",
paramtype = "light",
paramtype2 = "facedir",
groups = {choppy = 2},
drawtype = "mesh",
collision_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, 0.5, 0.5},
--[[{-0.65, -0.3, -1.46, 0.65, 1.4, -1.66},
{-0.65, -0.3, 0.46, 0.65, 1.4, 0.66}]]
}
},
selection_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, 0.5, 0.5}
}
},
sounds = default.node_sound_wood_defaults()
})
minetest.register_craft({
output = "luxury_decor:kitchen_wooden_table",
recipe = {
{"luxury_decor:wooden_plank", "luxury_decor:wooden_plank", "luxury_decor:wooden_plank"},
{"luxury_decor:wooden_plank", "default:stick", "luxury_decor:wooden_plank"},
{"default:stick", "", "default:stick"}
}
})
minetest.register_craft({
output = "luxury_decor:luxury_metallic_table",
recipe = {
{"luxury_decor:jungle_wooden_plank", "luxury_decor:jungle_wooden_plank", "luxury_decor:jungle_wooden_plank"},
{"default:copper_ingot", "", "default:copper_ingot"},
{"", "", ""}
}
})
minetest.register_craft({
output = "luxury_decor:simple_wooden_table",
recipe = {
{"luxury_decor:jungle_wooden_plank", "luxury_decor:jungle_wooden_plank", "luxury_decor:jungle_wooden_plank"},
{"default:stick", "luxury_decor:jungle_wooden_plank", "default:stick"},
{"", "", ""}
}
})

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.1 KiB

After

Width:  |  Height:  |  Size: 8.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 585 B

After

Width:  |  Height:  |  Size: 678 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 195 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 580 B

After

Width:  |  Height:  |  Size: 513 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 545 B

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 541 B

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB