1
0
mirror of https://github.com/mt-mods/homedecor_modpack.git synced 2024-11-05 09:50:26 +01:00
homedecor_modpack/homedecor/window_treatments.lua

206 lines
5.9 KiB
Lua
Raw Normal View History

local S = homedecor.gettext
homedecor.register("window_quartered", {
2015-01-20 12:13:45 +01:00
description = "Window (quartered)",
2014-06-27 02:13:16 +02:00
tiles = {
"homedecor_window_sides.png",
"homedecor_window_sides.png",
"homedecor_window_sides.png",
"homedecor_window_sides.png",
"homedecor_window_quartered.png",
"homedecor_window_quartered.png"
},
use_texture_alpha = true,
2015-01-20 12:13:45 +01:00
groups = {snappy=3},
sounds = default.node_sound_glass_defaults(),
2014-06-27 02:13:16 +02:00
node_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, 0.025, 0.5, 0.5, 0}, -- NodeBox1
{-0.5, 0.4375, -0.0625, 0.5, 0.5, 0.0625}, -- NodeBox2
{-0.5, -0.5, -0.0625, 0.5, -0.4375, 0.0625}, -- NodeBox3
2015-01-20 12:13:45 +01:00
{-0.5, -0.0625, -0.025, 0.5, 0.0625, 0.025}, -- NodeBox4
2014-06-27 02:13:16 +02:00
{0.4375, -0.5, -0.0625, 0.5, 0.5, 0.0625}, -- NodeBox5
{-0.5, -0.5, -0.0625, -0.4375, 0.5, 0.0625}, -- NodeBox6
2015-01-20 12:13:45 +01:00
{-0.0625, -0.5, -0.025, 0.0625, 0.5, 0.025}, -- NodeBox7
2015-04-30 11:48:15 +02:00
}
},
2014-06-27 02:13:16 +02:00
selection_box = {
type = "fixed",
2015-04-30 11:48:15 +02:00
fixed = {-0.5, -0.5, -0.0625, 0.5, 0.5, 0.0625}
}
2014-06-27 02:13:16 +02:00
})
homedecor.register("window_plain", {
2015-01-20 12:13:45 +01:00
description = "Window (plain)",
2014-06-27 02:13:16 +02:00
tiles = {
"homedecor_window_sides.png",
"homedecor_window_sides.png",
"homedecor_window_sides.png",
"homedecor_window_sides.png",
"homedecor_window_frame.png",
"homedecor_window_frame.png"
},
use_texture_alpha = true,
2015-01-20 12:13:45 +01:00
groups = {snappy=3},
sounds = default.node_sound_glass_defaults(),
2014-06-27 02:13:16 +02:00
node_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, 0.025, 0.5, 0.5, 0}, -- NodeBox1
{-0.5, 0.4375, -0.0625, 0.5, 0.5, 0.0625}, -- NodeBox2
{-0.5, -0.5, -0.0625, 0.5, -0.4375, 0.0625}, -- NodeBox3
2015-01-20 12:13:45 +01:00
{0.4375, -0.5, -0.0625, 0.5, 0.5, 0.0625}, -- NodeBox4
{-0.5, -0.5, -0.0625, -0.4375, 0.5, 0.0625}, -- NodeBox5
2015-04-30 11:48:15 +02:00
}
},
2014-06-27 02:13:16 +02:00
selection_box = {
type = "fixed",
2015-04-30 11:48:15 +02:00
fixed = {-0.5, -0.5, -0.0625, 0.5, 0.5, 0.0625}
}
2014-06-27 02:13:16 +02:00
})
2015-03-29 07:48:10 +02:00
local wb1_cbox = {
type = "fixed",
fixed = { -8/16, -8/16, 5/16, 8/16, 8/16, 8/16 },
}
homedecor.register("blinds_thick", {
2014-06-27 02:13:16 +02:00
description = "Window Blinds (thick)",
2015-03-29 07:48:10 +02:00
mesh = "homedecor_windowblind_thick.obj",
2015-03-29 13:13:17 +02:00
inventory_image = "homedecor_windowblind_thick_inv.png",
2015-03-29 07:48:10 +02:00
tiles = {
"homedecor_windowblind_strings.png",
"homedecor_windowblinds.png"
},
2014-06-27 02:13:16 +02:00
walkable = false,
2015-01-20 12:13:45 +01:00
groups = {snappy=3},
2015-01-20 19:49:46 +01:00
sounds = default.node_sound_wood_defaults(),
2015-04-30 11:48:15 +02:00
selection_box = wb1_cbox
2014-06-27 02:13:16 +02:00
})
2015-03-29 07:48:10 +02:00
local wb2_cbox = {
type = "fixed",
fixed = { -8/16, -8/16, 6/16, 8/16, 8/16, 8/16 },
}
homedecor.register("blinds_thin", {
2014-06-27 02:13:16 +02:00
description = "Window Blinds (thin)",
2015-03-29 07:48:10 +02:00
mesh = "homedecor_windowblind_thin.obj",
2015-03-29 13:13:17 +02:00
inventory_image = "homedecor_windowblind_thick_inv.png",
2015-03-29 07:48:10 +02:00
tiles = {
"homedecor_windowblind_strings.png",
"homedecor_windowblinds.png"
},
2014-06-27 02:13:16 +02:00
walkable = false,
2015-01-20 12:13:45 +01:00
groups = {snappy=3},
2015-01-20 19:49:46 +01:00
sounds = default.node_sound_wood_defaults(),
2015-04-30 11:48:15 +02:00
selection_box = wb2_cbox
2014-06-27 02:13:16 +02:00
})
local curtaincolors = {
{ "red", "#ad2323e0:175" },
{ "green", "#27a927e0:175" },
{ "blue", "#2626c6e0:175" },
{ "white", "#ffffffe0:175" },
{ "pink", "#ff8fb7e0:175" },
{ "violet", "#7f29d7e0:175" },
}
for c in ipairs(curtaincolors) do
local color = curtaincolors[c][1]
local hue = curtaincolors[c][2]
local color_d = S(curtaincolors[c][1])
homedecor.register("curtain_"..color, {
description = S("Curtains (%s)"):format(color_d),
tiles = { "homedecor_curtain.png^[colorize:"..hue },
inventory_image = "homedecor_curtain.png^[colorize:"..hue,
wield_image = "homedecor_curtain.png^[colorize:"..hue,
drawtype = 'signlike',
use_texture_alpha = true,
walkable = false,
groups = { snappy = 3 },
sounds = default.node_sound_leaves_defaults(),
paramtype2 = 'wallmounted',
2015-04-30 11:48:15 +02:00
selection_box = { type = "wallmounted" },
2014-08-11 08:23:26 +02:00
-- Open the curtains
on_rightclick = function(pos, node, clicker, itemstack)
local topnode = minetest.get_node({x=pos.x, y=pos.y+1.0, z=pos.z})
if string.find(topnode.name, "homedecor:curtainrod") then
2014-08-11 08:23:26 +02:00
local fdir = node.param2
minetest.set_node(pos, { name = "homedecor:curtain_open_"..color, param2 = fdir })
end
end
})
homedecor.register("curtain_open_"..color, {
description = S("Curtains (%s)"):format(color_d),
tiles = { "homedecor_curtain_open.png^[colorize:"..hue },
inventory_image = "homedecor_curtain_open.png^[colorize:"..hue,
wield_image = "homedecor_curtain_open.png^[colorize:"..hue,
drawtype = 'signlike',
use_texture_alpha = true,
walkable = false,
groups = { snappy = 3 },
sounds = default.node_sound_leaves_defaults(),
paramtype2 = 'wallmounted',
2015-04-30 11:48:15 +02:00
selection_box = { type = "wallmounted" },
2014-08-11 08:23:26 +02:00
-- Close the curtains
on_rightclick = function(pos, node, clicker, itemstack)
local topnode = minetest.get_node({x=pos.x, y=pos.y+1.0, z=pos.z})
if string.find(topnode.name, "homedecor:curtainrod") then
2014-08-11 08:23:26 +02:00
local fdir = node.param2
minetest.set_node(pos, { name = "homedecor:curtain_"..color, param2 = fdir })
end
end
})
end
local mats = {
{ "brass", "Brass", "homedecor_generic_metal_brass.png" },
{ "wrought_iron", "Wrought iron", "homedecor_generic_metal_wrought_iron.png" },
{ "wood", "Wooden", "default_wood.png" }
}
for i in ipairs(mats) do
local material = mats[i][1]
local mat_name = mats[i][2]
local texture = mats[i][3]
homedecor.register("curtainrod_"..material, {
tiles = { texture },
inventory_image = "homedecor_curtainrod_"..material.."_inv.png",
description = "Curtain Rod ("..mat_name..")",
groups = { snappy = 3 },
node_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, 0.375, 0.5, -0.4375, 0.4375},
{-0.4375, -0.5, 0.4375, -0.375, -0.4375, 0.5},
{0.375, -0.5, 0.4375, 0.4375, -0.4375, 0.5}
}
}
})
end
2014-09-11 14:01:48 +02:00
homedecor.register("window_flowerbox", {
2014-09-11 14:01:48 +02:00
description = "Window flowerbow",
tiles = {
"homedecor_flowerbox_top.png",
"homedecor_flowerbox_bottom.png",
"homedecor_flowerbox_sides.png"
},
inventory_image = "homedecor_flowerbox_inv.png",
2015-04-29 14:14:36 +02:00
sounds = default.node_sound_stone_defaults(),
2014-09-11 14:01:48 +02:00
groups = { snappy = 3 },
node_box = {
type = "fixed",
fixed = {
{-0.375, 0.25, -0.125, 0.375, 0.5, 0.375}, -- NodeBox1
2014-09-11 14:01:48 +02:00
{-0.3125, 0.4375, 0.375, -0.25, 0.4875, 0.5}, -- NodeBox2
{0.25, 0.4375, 0.375, 0.3125, 0.4875, 0.5}, -- NodeBox3
}
}
})