1
0
mirror of https://github.com/mt-mods/homedecor_modpack.git synced 2025-08-03 20:10:20 +02:00

Opti. code

This commit is contained in:
jp
2015-02-28 10:14:46 +01:00
parent 2d0d6c53f9
commit 546f8b501c
12 changed files with 200 additions and 507 deletions

View File

@ -448,28 +448,34 @@ homedecor.register("grandfather_clock_top", {
selection_box = homedecor.nodebox.null,
})
homedecor.register("office_chair_upscale", {
description = "Office chair (upscale)",
drawtype = "mesh",
tiles = { "homedecor_office_chair_upscale.png" },
mesh = "homedecor_office_chair_upscale.obj",
groups = { snappy = 3 },
sounds = default.node_sound_wood_defaults(),
selection_box = {
local ofchairs_sbox = {
type = "fixed",
fixed = { -8/16, -8/16, -8/16, 8/16, 29/32, 8/16 }
},
collision_box = {
}
local ofchairs_cbox = {
type = "fixed",
fixed = {
{ -5/16, 1/16, -7/16, 5/16, 4/16, 7/16 }, -- seat
{ -5/16, 4/16, 4/16, 5/16, 29/32, 15/32 }, -- seatback
{ -7/16, 1/16, -9/32, -5/16, 7/16, 6/16 }, -- right arm
{ 5/16, 1/16, -9/32, 7/16, 7/16, 6/16 }, -- left arm
{ -1/16, -11/32, -1/16, 1/16, 1/16, 1/16 }, -- cylinder
{ -8/16, -8/16, -8/16, 8/16, -11/32, 8/16 } -- legs/wheels
}
},
}
local ofchairs = {"basic", "upscale"}
for _, c in ipairs(ofchairs) do
homedecor.register("office_chair_"..c, {
description = "Office chair ("..c..")",
drawtype = "mesh",
tiles = { "homedecor_office_chair_"..c..".png" },
mesh = "homedecor_office_chair_"..c..".obj",
groups = { snappy = 3 },
sounds = default.node_sound_wood_defaults(),
selection_box = ofchairs_sbox,
collision_box = ofchairs_cbox,
expand = { top = "air" },
on_rightclick = function(pos, node, clicker)
pos.y = pos.y+0.14 -- player's sit position.
@ -477,32 +483,7 @@ homedecor.register("office_chair_upscale", {
end,
})
homedecor.register("office_chair_basic", {
description = "Office chair (basic)",
drawtype = "mesh",
tiles = { "homedecor_office_chair_basic.png" },
mesh = "homedecor_office_chair_basic.obj",
groups = { snappy = 3 },
sounds = default.node_sound_wood_defaults(),
selection_box = {
type = "fixed",
fixed = { -8/16, -8/16, -8/16, 8/16, 29/32, 8/16 }
},
collision_box = {
type = "fixed",
fixed = {
{ -5/16, 1/16, -7/16, 5/16, 4/16, 7/16 }, -- seat
{ -5/16, 4/16, 4/16, 5/16, 29/32, 15/32 }, -- seatback
{ -1/16, -11/32, -1/16, 1/16, 1/16, 1/16 }, -- cylinder
{ -8/16, -8/16, -8/16, 8/16, -11/32, 8/16 } -- legs/wheels
}
},
expand = { top = "air" },
on_rightclick = function(pos, node, clicker)
pos.y = pos.y+0.14 -- player's sit position.
homedecor.sit_exec(pos, node, clicker)
end,
})
end
-- Aliases for 3dforniture mod.