Add files via upload

master
Shad MOrdre 2018-01-19 11:47:50 -08:00 committed by GitHub
parent 304a07d833
commit e94f9b540e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 3930 additions and 0 deletions

615
architecture.lua Normal file
View File

@ -0,0 +1,615 @@
--[[ TEMPLATE
lib_shapes.register_shape(name, description, node_box, selection_box, collision_box)
Name Name of the shape within the library
Description Full Text description of above name
Node_Box node_box = {
type = "fixed",
fixed = {
{-0.25, 0, -0.5, 0.25, 0.5, 0.5},
},
},
(above example for a static node_box
OR
below example for a connected node_box)
node_box = {
type = "connected",
fixed = {
{-0.5, -0.5, -0.5, 0.5, 0.5, 0.5},
},
connect_front = {
{-0.125, -0.0625, -0.5, 0.125, 0.0625, -0.0625}, -- Front_h_zneg
},
connect_back = {
{-0.125, -0.0625, 0.0625, 0.125, 0.0625, 0.5}, -- Back_h_zpos
},
connect_left = {
{-0.5, -0.0625, -0.125, -0.0625, 0.0625, 0.125}, -- Left_h_xneg
},
connect_right = {
{0.0625, -0.0625, -0.125, 0.5, 0.0625, 0.125}, -- Right_h_xpos
},
connect_bottom = {
{-0.125, -0.5, -0.0625, 0.125, -0.0625, 0.0625}, -- Bottom_x_yneg
},
connect_top = {
{-0.125, 0.0625, -0.0625, 0.125, 0.5, 0.0625}, -- Top_x_ypos
},
},
Selection_Box Follows the same as above for fixed node_box. Standard definition.
Collision_Box Follows the same as above for fixed node_box. Standard definition.
EXAMPLE:
lib_node_shapes.register_shape(
"shape_somename", --All shape names WILL BE prefixed with 'shape_'. This allows shapes to be sorted together in inventory.
"Unique text description of the shape",
node_box = {
type = "fixed",
fixed = {
{-0.25, 0, -0.5, 0.25, 0.5, 0.5},
},
},
selection_box = {
type = "fixed",
fixed = {
{-0.25, 0, -0.5, 0.25, 0.5, 0.5},
},
},
collision_box = {
type = "fixed",
fixed = {
{ -0.25, 0, -0.5, 0.25, 0.5, 0.5},
},
},
)
--]]
local S
if minetest.get_modpath("intllib") then
S = intllib.Getter()
else
S = function(s,a,...)a={a,...}return s:gsub("@(%d+)",function(n)return a[tonumber(n)]end)end
end
lib_shapes.register_shape("column_base_050_height_100_width", {
description = "Column Base Half Height Full Width",
shape_type = "basic",
node_box = {
type = "fixed",
fixed = {
{-0.25, -0.5, -0.25, 0.25, 0.5, 0.25},
{-0.5, 0, -0.25, 0.5, 0.5, 0.25},
{-0.25, 0, -0.5, 0.25, 0.5, 0.5},
{-0.4375, 0.0625, -0.4375, 0.4375, 0.4375, 0.4375},
},
},
selection_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, 0.5, 0.5},
},
},
collision_box = {
type = "fixed",
fixed = {
{ -0.5, -0.5, -0.5, 0.5, 0.5, 0.5},
},
},
})
lib_shapes.register_shape("column_base_100_height_100_width", {
description = "Column Base Full Height Full Width",
shape_type = "basic",
node_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, 0.0, 0.5},
{-0.5, 0.0, -0.25, 0.5, 0.5, 0.25},
{-0.25, 0.0, -0.5, 0.25, 0.5, 0.5},
{-0.4375, 0.0, -0.4375, 0.4375, 0.4375, 0.4375},
},
},
selection_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, 0.5, 0.5},
},
},
collision_box = {
type = "fixed",
fixed = {
{ -0.5, -0.5, -0.5, 0.5, 0.5, 0.5},
},
},
})
lib_shapes.register_shape("column_beam", {
description = "Column Beam",
shape_type = "basic",
node_box = {
type = "fixed",
fixed = {
{-0.25, 0, -0.5, 0.25, 0.5, 0.5},
},
},
selection_box = {
type = "fixed",
fixed = {
{-0.25, 0, -0.5, 0.25, 0.5, 0.5},
},
},
collision_box = {
type = "fixed",
fixed = {
{-0.25, 0, -0.5, 0.25, 0.5, 0.5},
},
},
})
lib_shapes.register_shape("column_beam_with_support", {
description = "Column Beam with Support Column",
shape_type = "basic",
node_box = {
type = "fixed",
fixed = {
{-0.25, 0, -0.5, 0.25, 0.5, 0.5},
{-0.125, -0.5, -0.125, 0.125, 0, 0.125},
{-0.1875, -0.5, -0.1875, 0.1875, -0.375, 0.1875},
{-0.1875, -0.125, -0.1875, 0.1875, 0, 0.1875},
},
},
selection_box = {
type = "fixed",
fixed = {
{-0.25, 0, -0.5, 0.25, 0.5, 0.5},
{-0.125, -0.5, -0.125, 0.125, 0, 0.125},
},
},
collision_box = {
type = "fixed",
fixed = {
{-0.25, 0, -0.5, 0.25, 0.5, 0.5},
{-0.125, -0.5, -0.125, 0.125, 0, 0.125},
},
},
})
lib_shapes.register_shape("column_pillar_075_width", {
description = "Column Pillar Full Height 3/4 Width",
shape_type = "basic",
node_box = {
type = "fixed",
fixed = {
{-0.375, -0.5, -0.375, 0.375, 0.5, 0.375},
}
},
selection_box = {
type = "fixed",
fixed = {
{-0.375, -0.5, -0.375, 0.375, 0.5, 0.375},
},
},
collision_box = {
type = "fixed",
fixed = {
{-0.375, -0.5, -0.375, 0.375, 0.5, 0.375},
},
},
})
lib_shapes.register_shape("column_pillar_050_width", {
description = "Column Pillar Full Height 1/2 Width",
shape_type = "basic",
node_box = {
type = "fixed",
fixed = {
{-0.25, -0.5, -0.25, 0.25, 0.5, 0.25},
}
},
selection_box = {
type = "fixed",
fixed = {
{-0.25, -0.5, -0.25, 0.25, 0.5, 0.25},
},
},
collision_box = {
type = "fixed",
fixed = {
{-0.25, -0.5, -0.25, 0.25, 0.5, 0.25},
},
},
})
lib_shapes.register_shape("column_pillar_with_slab_100_height_050_width", {
description = "Column Pillar Full Height 1/2 Width",
shape_type = "basic",
node_box = {
type = "connected",
fixed = {
{-0.5, 0.0, -0.5, 0.5, 0.5, 0.5},
{-0.25, -0.5, -0.25, 0.25, 0.0, 0.25}
},
connect_front = {
{-0.25, -0.5, -0.5, 0.25, 0.0, -0.25},
},
connect_back = {
{-0.25, -0.5, 0.25, 0.25, 0.0, 0.5},
},
connect_left = {
{-0.5, -0.5, -0.25, -0.25, 0.0, 0.25},
},
connect_right = {
{0.25, -0.5, -0.25, 0.5, 0.0, 0.25},
},
},
selection_box = {
type = "connected",
fixed = {
{-0.5, 0.0, -0.5, 0.5, 0.5, 0.5},
{-0.25, -0.5, -0.25, 0.25, 0.0, 0.25}
},
connect_front = {
{-0.25, -0.5, -0.5, 0.25, 0.0, -0.25},
},
connect_back = {
{-0.25, -0.5, 0.25, 0.25, 0.0, 0.5},
},
connect_left = {
{-0.5, -0.5, -0.25, -0.25, 0.0, 0.25},
},
connect_right = {
{0.25, -0.5, -0.25, 0.5, 0.0, 0.25},
},
},
collision_box = {
type = "connected",
fixed = {
{-0.5, 0.0, -0.5, 0.5, 0.5, 0.5},
{-0.25, -0.5, -0.25, 0.25, 0.0, 0.25}
},
connect_front = {
{-0.25, -0.5, -0.5, 0.25, 0.0, -0.25},
},
connect_back = {
{-0.25, -0.5, 0.25, 0.25, 0.0, 0.5},
},
connect_left = {
{-0.5, -0.5, -0.25, -0.25, 0.0, 0.25},
},
connect_right = {
{0.25, -0.5, -0.25, 0.5, 0.0, 0.25},
},
},
})
lib_shapes.register_shape("column_pillar_with_full_wall_075_width", {
description = "Column Pillar with Full Wall 3/4 Width",
shape_type = "connected",
node_box = {
type = "connected",
fixed = {
{-0.375, -0.5, -0.375, 0.375, 0.5, 0.375},
},
connect_front = {
{-0.1875, -0.5, -0.5, 0.1875, 0.5, -0.375}
},
connect_left = {
{-0.5, -0.5, -0.1875, -0.375, 0.5, 0.1875}
},
connect_back = {
{-0.1875, -0.5, 0.375, 0.1875, 0.5, 0.5}
},
connect_right = {
{ 0.375, -0.5, -0.1875, 0.5, 0.5, 0.1875}
},
},
selection_box = {
type = "fixed",
fixed = {
{-0.375, -0.5, -0.375, 0.375, 0.5, 0.375},
},
},
collision_box = {
type = "fixed",
fixed = {
{-0.375, -0.5, -0.375, 0.375, 0.5, 0.375},
},
},
})
lib_shapes.register_shape("column_pillar_with_full_wall_050_width", {
description = "Column Pillar with Full Wall 1/2 Width",
shape_type = "connected",
node_box = {
type = "connected",
fixed = {
{-0.25, -0.5, -0.25, 0.25, 0.5, 0.25},
},
connect_front = {
{-0.1875, -0.5, -0.5, 0.1875, 0.5, -0.25}
},
connect_left = {
{-0.5, -0.5, -0.1875, -0.25, 0.5, 0.1875}
},
connect_back = {
{-0.1875, -0.5, 0.25, 0.1875, 0.5, 0.5}
},
connect_right = {
{ 0.25, -0.5, -0.1875, 0.5, 0.5, 0.1875}
},
},
selection_box = {
type = "fixed",
fixed = {
{-0.25, -0.5, -0.25, 0.25, 0.5, 0.25},
},
},
collision_box = {
type = "fixed",
fixed = {
{-0.25, -0.5, -0.25, 0.25, 0.5, 0.25},
},
},
})
lib_shapes.register_shape("steps_open_basic_01", {
description = "Steps Basic 01 (Open)",
shape_type = "basic",
node_box = {
type = "fixed",
fixed = {
{-0.5, -0.3125, -0.5, 0.5, -0.25, -0.25},
{-0.5, -0.0625, -0.25, 0.5, 0, 0},
{-0.5, 0.1875, 0, 0.5, 0.25, 0.25},
{-0.5, 0.4375, 0.25, 0.5, 0.5, 0.5},
},
},
selection_box = {
type = "fixed",
fixed = {
{-0.5, -0.3125, -0.5, 0.5, -0.25, -0.25},
{-0.5, -0.0625, -0.25, 0.5, 0, 0},
{-0.5, 0.1875, 0, 0.5, 0.25, 0.25},
{-0.5, 0.4375, 0.25, 0.5, 0.5, 0.5},
},
},
collision_box = {
type = "fixed",
fixed = {
{-0.5, -0.3125, -0.5, 0.5, -0.25, -0.25},
{-0.5, -0.0625, -0.25, 0.5, 0, 0},
{-0.5, 0.1875, 0, 0.5, 0.25, 0.25},
{-0.5, 0.4375, 0.25, 0.5, 0.5, 0.5},
},
},
})
lib_shapes.register_shape("steps_solid_basic_01", {
description = "Steps Basic 01 (Solid)",
shape_type = "basic",
node_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, -0.25, -0.25},
{-0.5, -0.25, -0.25, 0.5, 0, 0},
{-0.5, 0, 0, 0.5, 0.25, 0.25},
{-0.5, 0.25, 0.25, 0.5, 0.5, 0.5},
},
},
selection_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, -0.25, -0.25},
{-0.5, -0.25, -0.25, 0.5, 0, 0},
{-0.5, 0, 0, 0.5, 0.25, 0.25},
{-0.5, 0.25, 0.25, 0.5, 0.5, 0.5},
},
},
collision_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, -0.25, -0.25},
{-0.5, -0.25, -0.25, 0.5, 0, 0},
{-0.5, 0, 0, 0.5, 0.25, 0.25},
{-0.5, 0.25, 0.25, 0.5, 0.5, 0.5},
},
},
})
lib_shapes.register_shape("wall_100_height_075_width", {
description = "Wall Full Height 3/4 Width",
shape_type = "basic",
node_box = {
type = "fixed",
fixed = {
{-0.375, -0.5, -0.5, 0.375, 0.5, 0.5}
},
},
selection_box = {
type = "fixed",
fixed = {
{-0.375, -0.5, -0.5, 0.375, 0.5, 0.5},
},
},
collision_box = {
type = "fixed",
fixed = {
{-0.375, -0.5, -0.5, 0.375, 0.5, 0.5},
},
},
})
lib_shapes.register_shape("wall_100_height_050_width", {
description = "Wall Full Height 1/2 Width",
shape_type = "basic",
node_box = {
type = "fixed",
fixed = {
{-0.25, -0.5, -0.5, 0.25, 0.5, 0.5}
},
},
selection_box = {
type = "fixed",
fixed = {
{-0.25, -0.5, -0.5, 0.25, 0.5, 0.5},
},
},
collision_box = {
type = "fixed",
fixed = {
{-0.25, -0.5, -0.5, 0.25, 0.5, 0.5},
},
},
})
lib_shapes.register_shape("wall_100_height_025_width", {
description = "Wall Full Height 1/4 Width",
shape_type = "basic",
node_box = {
type = "fixed",
fixed = {
{-0.125, -0.5, -0.5, 0.125, 0.5, 0.5}
},
},
selection_box = {
type = "fixed",
fixed = {
{-0.125, -0.5, -0.5, 0.125, 0.5, 0.5},
},
},
collision_box = {
type = "fixed",
fixed = {
{-0.125, -0.5, -0.5, 0.125, 0.5, 0.5},
},
},
})
lib_shapes.register_shape("wall_junction_with_slab_100_height_050_width", {
description = "Wall Junction with Slab Full Height 1/2 Width",
shape_type = "basic",
node_box = {
type = "connected",
fixed = {
{-0.5, 0.0, -0.5, 0.5, 0.5, 0.5},
{-0.25, -0.5, -0.25, 0.25, 0.0, 0.25}
},
connect_front = {
{-0.25, -0.5, -0.5, 0.25, 0.0, -0.25},
},
connect_back = {
{-0.25, -0.5, 0.25, 0.25, 0.0, 0.5},
},
connect_left = {
{-0.5, -0.5, -0.25, -0.25, 0.0, 0.25},
},
connect_right = {
{0.25, -0.5, -0.25, 0.5, 0.0, 0.25},
},
},
selection_box = {
type = "connected",
fixed = {
{-0.5, 0.0, -0.5, 0.5, 0.5, 0.5},
{-0.25, -0.5, -0.25, 0.25, 0.0, 0.25}
},
connect_front = {
{-0.25, -0.5, -0.5, 0.25, 0.0, -0.25},
},
connect_back = {
{-0.25, -0.5, 0.25, 0.25, 0.0, 0.5},
},
connect_left = {
{-0.5, -0.5, -0.25, -0.25, 0.0, 0.25},
},
connect_right = {
{0.25, -0.5, -0.25, 0.5, 0.0, 0.25},
},
},
collision_box = {
type = "connected",
fixed = {
{-0.5, 0.0, -0.5, 0.5, 0.5, 0.5},
{-0.25, -0.5, -0.25, 0.25, 0.0, 0.25}
},
connect_front = {
{-0.25, -0.5, -0.5, 0.25, 0.0, -0.25},
},
connect_back = {
{-0.25, -0.5, 0.25, 0.25, 0.0, 0.5},
},
connect_left = {
{-0.5, -0.5, -0.25, -0.25, 0.0, 0.25},
},
connect_right = {
{0.25, -0.5, -0.25, 0.5, 0.0, 0.25},
},
},
})
lib_shapes.register_shape("wall_with_slab_100_height_050_width", {
description = "Wall with Slab Full Height 1/2 Width",
shape_type = "basic",
node_box = {
type = "fixed",
fixed = {
{-0.5, 0.0, -0.5, 0.5, 0.5, 0.5},
{-0.25, -0.5, -0.5, 0.25, 0.0, 0.5}
},
},
selection_box = {
type = "fixed",
fixed = {
{-0.5, 0.0, -0.5, 0.5, 0.5, 0.5},
{-0.25, -0.5, -0.5, 0.25, 0.0, 0.5}
},
},
collision_box = {
type = "fixed",
fixed = {
{-0.5, 0.0, -0.5, 0.5, 0.5, 0.5},
{-0.25, -0.5, -0.5, 0.25, 0.0, 0.5}
},
},
})
lib_shapes.register_shape("wall_with_deco_01_100_height_050_width", {
description = "Wall with Deco 01 1/2 Width",
shape_type = "basic",
node_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.25, 0.5, 0, 0.25},
{-0.5, 0, -0.3125, 0.5, 0.5, 0.5},
{-0.5, 0.375, -0.5, 0.5, 0.5, -0.3125},
{-0.375, 0.125, -0.4375, -0.125, 0.375, -0.3125},
{0.125, 0.125, -0.4375, 0.375, 0.375, -0.3125},
},
},
selection_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.25, 0.5, 0, 0.25},
{-0.5, 0, -0.3125, 0.5, 0.5, 0.5},
{-0.5, 0.375, -0.5, 0.5, 0.5, -0.3125},
{-0.375, 0.125, -0.4375, -0.125, 0.375, -0.3125},
{0.125, 0.125, -0.4375, 0.375, 0.375, -0.3125},
},
},
collision_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.25, 0.5, 0, 0.25},
{-0.5, 0, -0.3125, 0.5, 0.5, 0.5},
{-0.5, 0.375, -0.5, 0.5, 0.5, -0.3125},
{-0.375, 0.125, -0.4375, -0.125, 0.375, -0.3125},
{0.125, 0.125, -0.4375, 0.375, 0.375, -0.3125},
},
},
})

26
craftitems.lua Normal file
View File

@ -0,0 +1,26 @@
minetest.register_craftitem("lib_shapes:blueprint", {
description = "lib_shapes Blueprint",
inventory_image = "lib_node_shapes_blueprint.png",
})
minetest.register_craft({
output = 'lib_shapes:blueprint',
recipe = {
{'default:paper', 'default:paper', 'default:paper'},
{'default:paper', 'lib_shapes:pencil', 'default:paper'},
{'default:paper', 'default:paper', 'default:paper'},
}
})
minetest.register_craftitem("lib_shapes:pencil", {
description = "lib_shapes Pencil",
inventory_image = "lib_node_shapes_pencil.png",
})
minetest.register_craft({
output = 'lib_shapes:pencil',
recipe = {
{'', 'group:stick', ''},
{'', 'default:coal_lump', ''},
{'', '', ''},
}
})

1
depends.txt Normal file
View File

@ -0,0 +1 @@
default?

16
description.txt Normal file
View File

@ -0,0 +1,16 @@
lib_nodebox_shapes
Inspired by default:walls, Columnia, Castles, xdecor, and others, for their immense and invaluable creative value and the frustration of scrolling
through their countless repetitive pages of the same shaped nodes. With much love to their respective creators!
This mod provides a library of nodebox shapes. Types of shapes included are slabs, stairs, columns, fences, walls, beams, furniture, various custom shapes, as well as a library of general, simple and common shapes. Shapes are organized into various sub-mods, and currently there are 75+ shapes from which to choose. Also included are nodes that are designed to be used as drop in replacements to build L-tree trees, using connected nodeboxes.
Using a pencil and paper, one creates blueprints, which are then arranged in the craft grid to build
various shape_nodes. These shape_nodes can be placed in world, but are otherwise useless, unless used in the craft grid.
In the craft grid, placing a shape_node, (in the center), and any stone, wood, tree, or glass node, (bottom center, directly below shape_node), from a supported mod gives the user a node of that type, shaped like the shape_node.
Only the various shape_nodes appear in inventory, while the actual shaped nodes do not. This prevents adding numerous
unnecessary pages to a players inventory, while still granting additional gameplay value.
My personal hope is that is used by players to grant them more artistic freedom, and thus more elegance in Minetest architecture.

1370
doors.lua Normal file

File diff suppressed because it is too large Load Diff

186
fences.lua Normal file
View File

@ -0,0 +1,186 @@
--[[ TEMPLATE
lib_shapes.register_shape(name, description, node_box, selection_box, collision_box)
Name Name of the shape within the library
Description Full Text description of above name
Node_Box node_box = {
type = "fixed",
fixed = {
{-0.25, 0, -0.5, 0.25, 0.5, 0.5},
},
},
(above example for a static node_box
OR
below example for a connected node_box)
node_box = {
type = "connected",
fixed = {
{-0.5, -0.5, -0.5, 0.5, 0.5, 0.5},
},
connect_front = {
{-0.125, -0.0625, -0.5, 0.125, 0.0625, -0.0625}, -- Front_h_zneg
},
connect_back = {
{-0.125, -0.0625, 0.0625, 0.125, 0.0625, 0.5}, -- Back_h_zpos
},
connect_left = {
{-0.5, -0.0625, -0.125, -0.0625, 0.0625, 0.125}, -- Left_h_xneg
},
connect_right = {
{0.0625, -0.0625, -0.125, 0.5, 0.0625, 0.125}, -- Right_h_xpos
},
connect_bottom = {
{-0.125, -0.5, -0.0625, 0.125, -0.0625, 0.0625}, -- Bottom_x_yneg
},
connect_top = {
{-0.125, 0.0625, -0.0625, 0.125, 0.5, 0.0625}, -- Top_x_ypos
},
},
Selection_Box Follows the same as above for fixed node_box. Standard definition.
Collision_Box Follows the same as above for fixed node_box. Standard definition.
EXAMPLE:
lib_node_shapes.register_shape(
"shape_somename", --All shape names WILL BE prefixed with 'shape_'. This allows shapes to be sorted together in inventory.
"Unique text description of the shape",
node_box = {
type = "fixed",
fixed = {
{-0.25, 0, -0.5, 0.25, 0.5, 0.5},
},
},
selection_box = {
type = "fixed",
fixed = {
{-0.25, 0, -0.5, 0.25, 0.5, 0.5},
},
},
collision_box = {
type = "fixed",
fixed = {
{ -0.25, 0, -0.5, 0.25, 0.5, 0.5},
},
},
)
--]]
local S
if minetest.get_modpath("intllib") then
S = intllib.Getter()
else
S = function(s,a,...)a={a,...}return s:gsub("@(%d+)",function(n)return a[tonumber(n)]end)end
end
lib_shapes.register_shape("fence", {
description = "Fence",
shape_type = "connected",
node_box = {
type = "connected",
fixed = {
{-0.125, -0.5, -0.125, 0.125, 0.5, 0.125},
},
connect_front = {
{-0.0625, 0.1875, -0.5, 0.0625, 0.4375, -0.125}, -- Top
{-0.0625, -0.3125, -0.5, 0.0625, -0.125, -0.125}, -- Bottom
},
connect_back = {
{-0.0625, 0.1875, 0.125, 0.0625, 0.4375, 0.5}, -- Top
{-0.0625, -0.3125, 0.125, 0.0625, -0.125, 0.5}, -- Bottom
},
connect_left = {
{-0.5, 0.1875, -0.0625, -0.125, 0.4375, 0.0625}, -- Top
{-0.5, -0.3125, -0.0625, -0.125, -0.125, 0.0625}, -- Bottom
},
connect_right = {
{0.125, 0.1875, -0.0625, 0.5, 0.4375, 0.0625}, -- Top
{0.125, -0.3125, -0.0625, 0.5, -0.125, 0.0625}, -- Bottom
},
},
selection_box = {
type = "fixed",
fixed = {
{-0.125, -0.5, -0.125, 0.125, 0.5, 0.125},
},
},
collision_box = {
type = "fixed",
fixed = {
{ -0.5, -0.5, -0.5, 0.5, 0.5, 0.5},
},
},
})
lib_shapes.register_shape("rail", {
description = "Rail",
shape_type = "basic",
node_box = {
type = "fixed",
fixed = {
{-0.4375, -0.5, 0.4375, -0.375, 0.375, 0.5}, -- support1 from front
{-0.1875, -0.5, 0.4375, -0.125, 0.375, 0.5}, -- support2 from front
{0.0625, -0.5, 0.4375, 0.125, 0.375, 0.5}, -- support3 from front
{0.3125, -0.5, 0.4375, 0.375, 0.375, 0.5}, -- support4 from front
{-0.5, 0.375, 0.375, 0.5, 0.5, 0.5}, -- top rail
},
},
selection_box = {
type = "fixed",
fixed = {
{-0.4375, -0.5, 0.4375, -0.375, 0.375, 0.5}, -- support1 from front
{-0.1875, -0.5, 0.4375, -0.125, 0.375, 0.5}, -- support2 from front
{0.0625, -0.5, 0.4375, 0.125, 0.375, 0.5}, -- support3 from front
{0.3125, -0.5, 0.4375, 0.375, 0.375, 0.5}, -- support4 from front
{-0.5, 0.375, 0.375, 0.5, 0.5, 0.5}, -- top rail
},
},
collision_box = {
type = "fixed",
fixed = {
{-0.4375, -0.5, 0.4375, -0.375, 0.375, 0.5}, -- support1 from front
{-0.1875, -0.5, 0.4375, -0.125, 0.375, 0.5}, -- support2 from front
{0.0625, -0.5, 0.4375, 0.125, 0.375, 0.5}, -- support3 from front
{0.3125, -0.5, 0.4375, 0.375, 0.375, 0.5}, -- support4 from front
{-0.5, 0.375, 0.375, 0.5, 0.5, 0.5}, -- top rail
},
},
})
lib_shapes.register_shape("rail_post", {
description = "Rail Post",
shape_type = "basic",
node_box = {
type = "fixed",
fixed = {
{0.3125, -0.5, 0.3125, 0.5, 0.5, 0.5}, -- support1 from front
},
},
selection_box = {
type = "fixed",
fixed = {
{0.3125, -0.5, 0.3125, 0.5, 0.5, 0.5}, -- support1 from front
},
},
collision_box = {
type = "fixed",
fixed = {
{0.3125, -0.5, 0.3125, 0.5, 0.5, 0.5}, -- support1 from front
},
},
})

521
furniture.lua Normal file
View File

@ -0,0 +1,521 @@
--[[ TEMPLATE
lib_shapes.register_shape(name, description, node_box, selection_box, collision_box)
Name Name of the shape within the library
Description Full Text description of above name
Node_Box node_box = {
type = "fixed",
fixed = {
{-0.25, 0, -0.5, 0.25, 0.5, 0.5},
},
},
(above example for a static node_box
OR
below example for a connected node_box)
node_box = {
type = "connected",
fixed = {
{-0.5, -0.5, -0.5, 0.5, 0.5, 0.5},
},
connect_front = {
{-0.125, -0.0625, -0.5, 0.125, 0.0625, -0.0625}, -- Front_h_zneg
},
connect_back = {
{-0.125, -0.0625, 0.0625, 0.125, 0.0625, 0.5}, -- Back_h_zpos
},
connect_left = {
{-0.5, -0.0625, -0.125, -0.0625, 0.0625, 0.125}, -- Left_h_xneg
},
connect_right = {
{0.0625, -0.0625, -0.125, 0.5, 0.0625, 0.125}, -- Right_h_xpos
},
connect_bottom = {
{-0.125, -0.5, -0.0625, 0.125, -0.0625, 0.0625}, -- Bottom_x_yneg
},
connect_top = {
{-0.125, 0.0625, -0.0625, 0.125, 0.5, 0.0625}, -- Top_x_ypos
},
},
Selection_Box Follows the same as above for fixed node_box. Standard definition.
Collision_Box Follows the same as above for fixed node_box. Standard definition.
EXAMPLE:
lib_node_shapes.register_shape(
"shape_somename", --All shape names should begin with 'shape_'. This allows shapes to be sorted together in inventory.
"Unique text description of the shape",
node_box = {
type = "fixed",
fixed = {
{-0.25, 0, -0.5, 0.25, 0.5, 0.5},
},
},
selection_box = {
type = "fixed",
fixed = {
{-0.25, 0, -0.5, 0.25, 0.5, 0.5},
},
},
collision_box = {
type = "fixed",
fixed = {
{ -0.25, 0, -0.5, 0.25, 0.5, 0.5},
},
},
)
--]]
local S
if minetest.get_modpath("intllib") then
S = intllib.Getter()
else
S = function(s,a,...)a={a,...}return s:gsub("@(%d+)",function(n)return a[tonumber(n)]end)end
end
--[[lib_shapes.register_shape("furniture_bed_basic_01", {
description = "Bed Basic 01",
shape_type = "basic",
node_box = {
type = "fixed",
fixed = {
{-0.5, -0.375, -0.375, 0.5, 0, 1.375},
{-0.5, -0.5, 1.375, 0.5, 0.5, 1.5},
{-0.5, -0.5, -0.5, 0.5, 0.1875, -0.375},
},
},
selection_box = {
type = "fixed",
fixed = {
{-0.5, -0.375, -0.375, 0.5, 0, 1.375},
{-0.5, -0.5, 1.375, 0.5, 0.5, 1.5},
{-0.5, -0.5, -0.5, 0.5, 0.1875, -0.375},
},
},
collision_box = {
type = "fixed",
fixed = {
{-0.5, -0.375, -0.375, 0.5, 0, 1.375},
{-0.5, -0.5, 1.375, 0.5, 0.5, 1.5},
{-0.5, -0.5, -0.5, 0.5, 0.1875, -0.375},
},
},
})
--]]
lib_shapes.register_shape("chair_arm_01", {
description = "Chair (with armrests) 01",
shape_type = "seat",
node_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, 0, 0.5}, -- NodeBox1
{-0.5, 0, 0.25, 0.5, 0.5, 0.5}, -- NodeBox2
{-0.5, 0, -0.5, -0.375, 0.25, 0.25}, -- NodeBox3
{0.375, 0, -0.5, 0.5, 0.25, 0.25}, -- NodeBox4
},
},
selection_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, 0, 0.5}, -- NodeBox1
{-0.5, 0, 0.25, 0.5, 0.5, 0.5}, -- NodeBox2
{-0.5, 0, -0.5, -0.375, 0.25, 0.25}, -- NodeBox3
{0.375, 0, -0.5, 0.5, 0.25, 0.25}, -- NodeBox4
},
},
collision_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, 0, 0.5}, -- NodeBox1
{-0.5, 0, 0.25, 0.5, 0.5, 0.5}, -- NodeBox2
{-0.5, 0, -0.5, -0.375, 0.25, 0.25}, -- NodeBox3
{0.375, 0, -0.5, 0.5, 0.25, 0.25}, -- NodeBox4
},
},
})
lib_shapes.register_shape("chair_arm_02", {
description = "Chair (with armrests) 02",
shape_type = "seat",
node_box = {
type = "fixed",
fixed = {
{-0.375, -0.125, -0.5, 0.375, 0, 0.5}, -- NodeBox1
{-0.4375, 0, 0.25, 0.4375, 0.5, 0.5}, -- NodeBox2
{-0.5, -0.5, -0.5, -0.375, 0.25, 0.5}, -- NodeBox3
{0.375, -0.5, -0.5, 0.5, 0.25, 0.5}, -- NodeBox4
},
},
selection_box = {
type = "fixed",
fixed = {
{-0.375, -0.125, -0.5, 0.375, 0, 0.5}, -- NodeBox1
{-0.4375, 0, 0.25, 0.4375, 0.5, 0.5}, -- NodeBox2
{-0.5, -0.5, -0.5, -0.375, 0.25, 0.5}, -- NodeBox3
{0.375, -0.5, -0.5, 0.5, 0.25, 0.5}, -- NodeBox4
},
},
collision_box = {
type = "fixed",
fixed = {
{-0.375, -0.125, -0.5, 0.375, 0, 0.5}, -- NodeBox1
{-0.4375, 0, 0.25, 0.4375, 0.5, 0.5}, -- NodeBox2
{-0.5, -0.5, -0.5, -0.375, 0.25, 0.5}, -- NodeBox3
{0.375, -0.5, -0.5, 0.5, 0.25, 0.5}, -- NodeBox4
},
},
})
lib_shapes.register_shape("chair_basic_01", {
description = "Chair Basic 01",
shape_type = "seat",
node_box = {
type = "fixed",
fixed = {
{-0.3125, -0.0625, -0.3125, 0.3125, 0.0625, 0.3125}, -- NodeBox1
{-0.3125, 0, 0.1875, 0.3125, 0.5, 0.3125}, -- NodeBox2
{-0.3125, -0.5, -0.3125, -0.1875, -0.0625, -0.1875}, -- NodeBox3
{0.1875, -0.5, -0.3125, 0.3125, -0.0625, -0.1875}, -- NodeBox5
{-0.3125, -0.5, 0.1875, -0.1875, -0.0625, 0.3125}, -- NodeBox6
{0.1875, -0.5, 0.1875, 0.3125, -0.0625, 0.3125}, -- NodeBox7
},
},
selection_box = {
type = "fixed",
fixed = {
{-0.3125, -0.0625, -0.3125, 0.3125, 0.0625, 0.3125}, -- NodeBox1
{-0.3125, 0, 0.1875, 0.3125, 0.5, 0.3125}, -- NodeBox2
{-0.3125, -0.5, -0.3125, -0.1875, -0.0625, -0.1875}, -- NodeBox3
{0.1875, -0.5, -0.3125, 0.3125, -0.0625, -0.1875}, -- NodeBox5
{-0.3125, -0.5, 0.1875, -0.1875, -0.0625, 0.3125}, -- NodeBox6
{0.1875, -0.5, 0.1875, 0.3125, -0.0625, 0.3125}, -- NodeBox7
},
},
collision_box = {
type = "fixed",
fixed = {
{-0.3125, -0.0625, -0.3125, 0.3125, 0.0625, 0.3125}, -- NodeBox1
{-0.3125, 0, 0.1875, 0.3125, 0.5, 0.3125}, -- NodeBox2
{-0.3125, -0.5, -0.3125, -0.1875, -0.0625, -0.1875}, -- NodeBox3
{0.1875, -0.5, -0.3125, 0.3125, -0.0625, -0.1875}, -- NodeBox5
{-0.3125, -0.5, 0.1875, -0.1875, -0.0625, 0.3125}, -- NodeBox6
{0.1875, -0.5, 0.1875, 0.3125, -0.0625, 0.3125}, -- NodeBox7
},
},
})
lib_shapes.register_shape("sofa_basic_01_corner", {
description = "Sofa Corner (Basic) 01",
shape_type = "seat",
node_box = {
type = "fixed",
fixed = {
{-0.5, -0.375, -0.5, 0.25, 0, 0.25},
{-0.5, -0.5, 0.25, 0.25, 0.5, 0.5},
{0.25, -0.5, -0.5, 0.5, 0.5, 0.5},
},
},
selection_box = {
type = "fixed",
fixed = {
{-0.5, -0.375, -0.5, 0.25, 0, 0.25},
{-0.5, -0.5, 0.25, 0.25, 0.5, 0.5},
{0.25, -0.5, -0.5, 0.5, 0.5, 0.5},
},
},
collision_box = {
type = "fixed",
fixed = {
{-0.5, -0.375, -0.5, 0.25, 0, 0.25},
{-0.5, -0.5, 0.25, 0.25, 0.5, 0.5},
{0.25, -0.5, -0.5, 0.5, 0.5, 0.5},
},
},
})
lib_shapes.register_shape("sofa_basic_01_left", {
description = "Sofa Left End (Basic) 01",
shape_type = "seat",
node_box = {
type = "fixed",
fixed = {
{-0.375, -0.375, -0.5, 0.5, 0, 0.25},
{-0.375, -0.375, 0.25, 0.5, 0.5, 0.5},
{-0.5, -0.5, -0.5, -0.375, 0.25, 0.5},
},
},
selection_box = {
type = "fixed",
fixed = {
{-0.375, -0.375, -0.5, 0.5, 0, 0.25},
{-0.375, -0.375, 0.25, 0.5, 0.5, 0.5},
{-0.5, -0.5, -0.5, -0.375, 0.25, 0.5},
},
},
collision_box = {
type = "fixed",
fixed = {
{-0.375, -0.375, -0.5, 0.5, 0, 0.25},
{-0.375, -0.375, 0.25, 0.5, 0.5, 0.5},
{-0.5, -0.5, -0.5, -0.375, 0.25, 0.5},
},
},
})
lib_shapes.register_shape("sofa_basic_01_right", {
description = "Sofa Right End (Basic) 01",
shape_type = "seat",
node_box = {
type = "fixed",
fixed = {
{-0.5, -0.375, -0.5, 0.375, 0, 0.25},
{-0.5, -0.375, 0.25, 0.375, 0.5, 0.5},
{0.375, -0.5, -0.5, 0.5, 0.25, 0.5},
},
},
selection_box = {
type = "fixed",
fixed = {
{-0.5, -0.375, -0.5, 0.375, 0, 0.25},
{-0.5, -0.375, 0.25, 0.375, 0.5, 0.5},
{0.375, -0.5, -0.5, 0.5, 0.25, 0.5},
},
},
collision_box = {
type = "fixed",
fixed = {
{-0.5, -0.375, -0.5, 0.375, 0, 0.25},
{-0.5, -0.375, 0.25, 0.375, 0.5, 0.5},
{0.375, -0.5, -0.5, 0.5, 0.25, 0.5},
},
},
})
lib_shapes.register_shape("sofa_basic_01_section", {
description = "Sofa Section (Basic) 01",
shape_type = "seat",
node_box = {
type = "fixed",
fixed = {
{-0.5, -0.375, -0.5, 0.5, 0, 0.25},
{-0.5, -0.375, 0.25, 0.5, 0.5, 0.5},
},
},
selection_box = {
type = "fixed",
fixed = {
{-0.5, -0.375, -0.5, 0.5, 0, 0.25},
{-0.5, -0.375, 0.25, 0.5, 0.5, 0.5},
},
},
collision_box = {
type = "fixed",
fixed = {
{-0.5, -0.375, -0.5, 0.5, 0, 0.25},
{-0.5, -0.375, 0.25, 0.5, 0.5, 0.5},
},
},
})
lib_shapes.register_shape("table_basic_01", {
description = "Table Basic 01",
shape_type = "basic",
node_box = {
type = "fixed",
fixed = {
{-0.5, 0.375, -0.5, 0.5, 0.5, 0.5}, -- NodeBox1
{-0.375, -0.5, -0.375, -0.25, 0.375, -0.25}, -- NodeBox3
{0.25, -0.5, -0.375, 0.375, 0.375, -0.25}, -- NodeBox5
{-0.375, -0.5, 0.25, -0.25, 0.375, 0.375}, -- NodeBox6
{0.25, -0.5, 0.25, 0.375, 0.375, 0.375}, -- NodeBox7
{-0.3125, -0.125, -0.3125, 0.3125, -0.0625, 0.3125}, -- NodeBox8
},
},
selection_box = {
type = "fixed",
fixed = {
{-0.5, 0.375, -0.5, 0.5, 0.5, 0.5}, -- NodeBox1
{-0.375, -0.5, -0.375, -0.25, 0.375, -0.25}, -- NodeBox3
{0.25, -0.5, -0.375, 0.375, 0.375, -0.25}, -- NodeBox5
{-0.375, -0.5, 0.25, -0.25, 0.375, 0.375}, -- NodeBox6
{0.25, -0.5, 0.25, 0.375, 0.375, 0.375}, -- NodeBox7
{-0.3125, -0.125, -0.3125, 0.3125, -0.0625, 0.3125}, -- NodeBox8
},
},
collision_box = {
type = "fixed",
fixed = {
{-0.5, 0.375, -0.5, 0.5, 0.5, 0.5}, -- NodeBox1
{-0.375, -0.5, -0.375, -0.25, 0.375, -0.25}, -- NodeBox3
{0.25, -0.5, -0.375, 0.375, 0.375, -0.25}, -- NodeBox5
{-0.375, -0.5, 0.25, -0.25, 0.375, 0.375}, -- NodeBox6
{0.25, -0.5, 0.25, 0.375, 0.375, 0.375}, -- NodeBox7
{-0.3125, -0.125, -0.3125, 0.3125, -0.0625, 0.3125}, -- NodeBox8
},
},
})
lib_shapes.register_shape("table_basic_02", {
description = "Table Basic 01",
shape_type = "basic",
node_box = {
type = "fixed",
fixed = {
{-0.5, -0.0625, -0.5, 0.5, 0.0625, 0.5},
{-0.4000, -0.5, -0.4000, -0.1000, -0.0625, -0.1000},
{0.1000, -0.5, -0.4000, 0.4000, -0.0625, -0.1000},
{-0.4000, -0.5, 0.1000, -0.1000, -0.0625, 0.4000},
{0.1000, -0.5, 0.1000, 0.4000, -0.0625, 0.4000},
},
},
selection_box = {
type = "fixed",
fixed = {
{-0.5, -0.0625, -0.5, 0.5, 0.0625, 0.5},
{-0.4000, -0.5, -0.4000, -0.1000, -0.0625, -0.1000},
{0.1000, -0.5, -0.4000, 0.4000, -0.0625, -0.1000},
{-0.4000, -0.5, 0.1000, -0.1000, -0.0625, 0.4000},
{0.1000, -0.5, 0.1000, 0.4000, -0.0625, 0.4000},
},
},
collision_box = {
type = "fixed",
fixed = {
{-0.5, -0.0625, -0.5, 0.5, 0.0625, 0.5},
{-0.4000, -0.5, -0.4000, -0.1000, -0.0625, -0.1000},
{0.1000, -0.5, -0.4000, 0.4000, -0.0625, -0.1000},
{-0.4000, -0.5, 0.1000, -0.1000, -0.0625, 0.4000},
{0.1000, -0.5, 0.1000, 0.4000, -0.0625, 0.4000},
},
},
})
lib_shapes.register_shape("table_half_01", {
description = "Table Half 01",
shape_type = "basic",
node_box = {
type = "fixed",
fixed = {
{-0.5, 0.375, -0.5, 0.5, 0.5, 0.5}, -- NodeBox1
{-0.375, -0.5, -0.375, -0.25, 0.375, -0.25}, -- NodeBox3
{0.25, -0.5, -0.375, 0.375, 0.375, -0.25}, -- NodeBox6
},
},
selection_box = {
type = "fixed",
fixed = {
{-0.5, 0.375, -0.5, 0.5, 0.5, 0.5}, -- NodeBox1
{-0.375, -0.5, -0.375, -0.25, 0.375, -0.25}, -- NodeBox3
{0.25, -0.5, -0.375, 0.375, 0.375, -0.25}, -- NodeBox6
},
},
collision_box = {
type = "fixed",
fixed = {
{-0.5, 0.375, -0.5, 0.5, 0.5, 0.5}, -- NodeBox1
{-0.375, -0.5, -0.375, -0.25, 0.375, -0.25}, -- NodeBox3
{0.25, -0.5, -0.375, 0.375, 0.375, -0.25}, -- NodeBox6
},
},
})
lib_shapes.register_shape("table_section_01", {
description = "Table Section 01",
shape_type = "basic",
node_box = {
type = "fixed",
fixed = {
{-0.5, 0.375, -0.5, 0.5, 0.5, 0.5}, -- NodeBox1
},
},
selection_box = {
type = "fixed",
fixed = {
{-0.5, 0.375, -0.5, 0.5, 0.5, 0.5}, -- NodeBox1
},
},
collision_box = {
type = "fixed",
fixed = {
{-0.5, 0.375, -0.5, 0.5, 0.5, 0.5}, -- NodeBox1
},
},
})
lib_shapes.register_shape("stool_basic_01", {
description = "Stool Basic 01",
shape_type = "basic",
node_box = {
type = "fixed",
fixed = {
{-0.3125, -0.0625, -0.3125, 0.3125, 0.0625, 0.3125},
{-0.3125, -0.5, -0.3125, -0.1875, -0.0625, -0.1875},
{0.1875, -0.5, -0.3125, 0.3125, -0.0625, -0.1875},
{-0.3125, -0.5, 0.1875, -0.1875, -0.0625, 0.3125},
{0.1875, -0.5, 0.1875, 0.3125, -0.0625, 0.3125},
},
},
selection_box = {
type = "fixed",
fixed = {
{-0.3125, -0.0625, -0.3125, 0.3125, 0.0625, 0.3125},
{-0.3125, -0.5, -0.3125, -0.1875, -0.0625, -0.1875},
{0.1875, -0.5, -0.3125, 0.3125, -0.0625, -0.1875},
{-0.3125, -0.5, 0.1875, -0.1875, -0.0625, 0.3125},
{0.1875, -0.5, 0.1875, 0.3125, -0.0625, 0.3125},
},
},
collision_box = {
type = "fixed",
fixed = {
{-0.3125, -0.0625, -0.3125, 0.3125, 0.0625, 0.3125},
{-0.3125, -0.5, -0.3125, -0.1875, -0.0625, -0.1875},
{0.1875, -0.5, -0.3125, 0.3125, -0.0625, -0.1875},
{-0.3125, -0.5, 0.1875, -0.1875, -0.0625, 0.3125},
{0.1875, -0.5, 0.1875, 0.3125, -0.0625, 0.3125},
},
},
})
--[[lib_shapes.register_shape("furniture_cabinet_basic_01", {
description = "Cabinet Basic 01",
shape_type = "basic",
node_box = {
type = "fixed",
fixed = {
{-0.3125, -0.0625, -0.3125, 0.3125, 0.5, 0.3125},
{-0.3125, -0.5, -0.3125, -0.1875, -0.0625, -0.1875},
{0.1875, -0.5, -0.3125, 0.3125, -0.0625, -0.1875},
{-0.3125, -0.5, 0.1875, -0.1875, -0.0625, 0.3125},
{0.1875, -0.5, 0.1875, 0.3125, -0.0625, 0.3125},
},
},
selection_box = {
type = "fixed",
fixed = {
{-0.3125, -0.0625, -0.3125, 0.3125, 0.5, 0.3125},
{-0.3125, -0.5, -0.3125, -0.1875, -0.0625, -0.1875},
{0.1875, -0.5, -0.3125, 0.3125, -0.0625, -0.1875},
{-0.3125, -0.5, 0.1875, -0.1875, -0.0625, 0.3125},
{0.1875, -0.5, 0.1875, 0.3125, -0.0625, 0.3125},
},
},
collision_box = {
type = "fixed",
fixed = {
{-0.3125, -0.0625, -0.3125, 0.3125, 0.5, 0.3125},
{-0.3125, -0.5, -0.3125, -0.1875, -0.0625, -0.1875},
{0.1875, -0.5, -0.3125, 0.3125, -0.0625, -0.1875},
{-0.3125, -0.5, 0.1875, -0.1875, -0.0625, 0.3125},
{0.1875, -0.5, 0.1875, 0.3125, -0.0625, 0.3125},
},
},
})
--]]

539
general.lua Normal file
View File

@ -0,0 +1,539 @@
--[[ TEMPLATE
lib_shapes.register_shape(name, description, node_box, selection_box, collision_box)
Name Name of the shape within the library
Description Full Text description of above name
Node_Box node_box = {
type = "fixed",
fixed = {
{-0.25, 0, -0.5, 0.25, 0.5, 0.5},
},
},
(above example for a static node_box
OR
below example for a connected node_box)
node_box = {
type = "connected",
fixed = {
{-0.5, -0.5, -0.5, 0.5, 0.5, 0.5},
},
connect_front = {
{-0.125, -0.0625, -0.5, 0.125, 0.0625, -0.0625}, -- Front_h_zneg
},
connect_back = {
{-0.125, -0.0625, 0.0625, 0.125, 0.0625, 0.5}, -- Back_h_zpos
},
connect_left = {
{-0.5, -0.0625, -0.125, -0.0625, 0.0625, 0.125}, -- Left_h_xneg
},
connect_right = {
{0.0625, -0.0625, -0.125, 0.5, 0.0625, 0.125}, -- Right_h_xpos
},
connect_bottom = {
{-0.125, -0.5, -0.0625, 0.125, -0.0625, 0.0625}, -- Bottom_x_yneg
},
connect_top = {
{-0.125, 0.0625, -0.0625, 0.125, 0.5, 0.0625}, -- Top_x_ypos
},
},
Selection_Box Follows the same as above for fixed node_box. Standard definition.
Collision_Box Follows the same as above for fixed node_box. Standard definition.
EXAMPLE:
lib_node_shapes.register_shape(
"shape_somename", --All shape names WILL BE prefixed with 'shape_'. This allows shapes to be sorted together in inventory.
"Unique text description of the shape",
node_box = {
type = "fixed",
fixed = {
{-0.25, 0, -0.5, 0.25, 0.5, 0.5},
},
},
selection_box = {
type = "fixed",
fixed = {
{-0.25, 0, -0.5, 0.25, 0.5, 0.5},
},
},
collision_box = {
type = "fixed",
fixed = {
{ -0.25, 0, -0.5, 0.25, 0.5, 0.5},
},
},
)
--]]
local S
if minetest.get_modpath("intllib") then
S = intllib.Getter()
else
S = function(s,a,...)a={a,...}return s:gsub("@(%d+)",function(n)return a[tonumber(n)]end)end
end
lib_shapes.register_shape("cylinder_100_height_100_width", {
description = "Cylinder Full Height Full Width",
shape_type = "basic",
node_box = {
type = "fixed",
fixed = {
{-0.1875, -0.5, -0.5, 0.1875, 0.5, 0.5},
{-0.5, -0.5, -0.1875, 0.5, 0.5, 0.1875},
{-0.375, -0.5, -0.375, 0.375, 0.5, 0.375},
{-0.3125, -0.5, -0.4375, 0.3125, 0.5, 0.4375},
{-0.4375, -0.5, -0.3125, 0.4375, 0.5, 0.3125},
},
},
selection_box = {
type = "fixed",
fixed = {
{-0.5,-0.5,-0.5,0.5,0.5,0.5},
},
},
collision_box = {
type = "fixed",
fixed = {
{-0.5,-0.5,-0.5,0.5,0.5,0.5},
},
},
})
lib_shapes.register_shape("cylinder_100_height_075_width", {
description = "Cylinder Full Height 3/4 Width",
shape_type = "basic",
node_box = {
type = "fixed",
fixed = {
{-0.375, -0.5, -0.125, 0.375, 0.5, 0.125},
{-0.125, -0.5, -0.375, 0.125, 0.5, 0.375},
{-0.25, -0.5, -0.3125, 0.25, 0.5, 0.3125},
{-0.3125, -0.5, -0.25, 0.3125, 0.5, 0.25},
},
},
selection_box = {
type = "fixed",
fixed = {
{-0.375,-0.5,-0.375,0.375,0.5,0.375},
},
},
collision_box = {
type = "fixed",
fixed = {
{-0.375,-0.5,-0.375,0.375,0.5,0.375},
},
},
})
lib_shapes.register_shape("cylinder_100_height_050_width", {
description = "Cylinder Full Height 1/2 Width",
shape_type = "basic",
node_box = {
type = "fixed",
fixed = {
{-0.25, -0.5, -0.125, 0.25, 0.5, 0.125}, -- Front_h_zneg
{-0.125, -0.5, -0.25, 0.125, 0.5, 0.25}, -- Back_h_zpos
{-0.1875, -0.5, -0.1875, 0.1875, 0.5, 0.1875}, -- NodeBox16
},
},
selection_box = {
type = "fixed",
fixed = {
{-0.25,-0.5,-0.25,0.25,0.5,0.25},
},
},
collision_box = {
type = "fixed",
fixed = {
{-0.25,-0.5,-0.25,0.25,0.5,0.25},
},
},
})
lib_shapes.register_shape("cylinder_100_height_025_width", {
description = "Cylinder Full Height 1/4 Width",
shape_type = "basic",
node_box = {
type = "fixed",
fixed = {
{-0.125, -0.5, -0.0625, 0.125, 0.5, 0.0625}, -- Front_h_zneg
{-0.0625, -0.5, -0.125, 0.0625, 0.5, 0.125}, -- Back_h_zpos
},
},
selection_box = {
type = "fixed",
fixed = {
{-0.125,-0.5,-0.125,0.125,0.5,0.125},
},
},
collision_box = {
type = "fixed",
fixed = {
{-0.125,-0.5,-0.125,0.125,0.5,0.125},
},
},
})
lib_shapes.register_shape("linkage_050x050", {
description = "Linkage (Medium)",
shape_type = "connected",
node_box = {
type = "connected",
fixed = {
{-0.25, -0.25, -0.25, 0.25, 0.25, 0.25},
},
connect_front = {
{-0.25, -0.25, -0.5, 0.25, 0.25, -0.25},
},
connect_back = {
{-0.25, -0.25, 0.25, 0.25, 0.25, 0.5},
},
connect_left = {
{-0.5, -0.25, -0.25, -0.25, 0.25, 0.25},
},
connect_right = {
{0.25, -0.25, -0.25, 0.5, 0.25, 0.25},
},
connect_bottom = {
{-0.25, -0.5, -0.25, 0.25, -0.25, 0.25},
},
connect_top = {
{-0.25, 0.25, -0.25, 0.25, 0.5, 0.25},
},
},
selection_box = {
type = "fixed",
fixed = {
{-0.25,-0.25,-0.25,0.25,0.25,0.25},
},
},
collision_box = {
type = "fixed",
fixed = {
{-0.25,-0.25,-0.25,0.25,0.25,0.25},
},
},
})
lib_shapes.register_shape("linkage_025x025", {
description = "Linkage (Small)",
shape_type = "connected",
node_box = {
type = "connected",
fixed = {
{-0.125, -0.125, -0.125, 0.125, 0.125, 0.125},
},
connect_front = {
{-0.125, -0.125, -0.5, 0.125, 0.125, -0.125},
},
connect_back = {
{-0.125, -0.125, 0.125, 0.125, 0.125, 0.5},
},
connect_left = {
{-0.5, -0.125, -0.125, -0.125, 0.125, 0.125},
},
connect_right = {
{0.125, -0.125, -0.125, 0.5, 0.125, 0.125},
},
connect_bottom = {
{-0.125, -0.5, -0.125, 0.125, -0.125, 0.125},
},
connect_top = {
{-0.125, 0.125, -0.125, 0.125, 0.5, 0.125},
},
},
selection_box = {
type = "fixed",
fixed = {
{-0.125,-0.125,-0.125,0.125,0.125,0.125},
},
},
collision_box = {
type = "fixed",
fixed = {
{-0.125,-0.125,-0.125,0.125,0.125,0.125},
},
},
})
lib_shapes.register_shape("linkage_round_050x050", {
description = "Linkage Round(Medium)",
shape_type = "connected",
node_box = {
type = "connected",
fixed = {
{-0.25, -0.25, -0.25, 0.25, 0.25, 0.25},
},
connect_front = {
{-0.25, -0.125, -0.5, 0.25, 0.125, -0.25}, -- Front_h_zneg
{-0.125, -0.25, -0.5, 0.125, 0.25, -0.25}, -- Front_v_zneg
},
connect_back = {
{-0.25, -0.125, 0.25, 0.25, 0.125, 0.5}, -- Back_h_zpos
{-0.125, -0.25, 0.25, 0.125, 0.25, 0.5}, -- Back_v_zpos
},
connect_left = {
{-0.5, -0.125, -0.25, -0.25, 0.125, 0.25}, -- Left_h_xneg
{-0.5, -0.25, -0.125, -0.25, 0.25, 0.125}, -- Left_v_xneg
},
connect_right = {
{0.25, -0.125, -0.25, 0.5, 0.125, 0.25}, -- Right_h_xpos
{0.25, -0.25, -0.125, 0.5, 0.25, 0.125}, -- Right_v_xpos
},
connect_bottom = {
{-0.125, -0.5, -0.25, 0.125, -0.25, 0.25}, -- Bottom_z_yneg
{-0.25, -0.5, -0.125, 0.25, -0.25, 0.125}, -- Bottom_x_yneg
},
connect_top = {
{-0.125, 0.25, -0.25, 0.125, 0.5, 0.25}, -- Top_z_ypos
{-0.25, 0.25, -0.125, 0.25, 0.5, 0.125}, -- Top_x_ypos
},
},
selection_box = {
type = "fixed",
fixed = {
{-0.25,-0.25,-0.25,0.25,0.25,0.25},
},
},
collision_box = {
type = "fixed",
fixed = {
{-0.25,-0.25,-0.25,0.25,0.25,0.25},
},
},
})
lib_shapes.register_shape("linkage_round_025x025", {
description = "Linkage Round (Small)",
shape_type = "connected",
node_box = {
type = "connected",
fixed = {
{-0.125, -0.0625, -0.0625, 0.125, 0.0625, 0.0625}, -- Base_x
{-0.0625, -0.125, -0.0625, 0.0625, 0.125, 0.0625}, -- Base_y
{-0.0625, -0.0625, -0.125, 0.0625, 0.0625, 0.125}, -- Base_z
},
connect_front = {
{-0.125, -0.0625, -0.5, 0.125, 0.0625, -0.0625}, -- Front_h_zneg
{-0.0625, -0.125, -0.5, 0.0625, 0.125, -0.0625}, -- Front_v_zneg
},
connect_back = {
{-0.125, -0.0625, 0.0625, 0.125, 0.0625, 0.5}, -- Back_h_zpos
{-0.0625, -0.125, 0.0625, 0.0625, 0.125, 0.5}, -- Back_v_zpos
},
connect_left = {
{-0.5, -0.0625, -0.125, -0.0625, 0.0625, 0.125}, -- Left_h_xneg
{-0.5, -0.125, -0.0625, -0.0625, 0.125, 0.0625}, -- Left_v_xneg
},
connect_right = {
{0.0625, -0.0625, -0.125, 0.5, 0.0625, 0.125}, -- Right_h_xpos
{0.0625, -0.125, -0.0625, 0.5, 0.125, 0.0625}, -- Right_v_xpos
},
connect_bottom = {
{-0.125, -0.5, -0.0625, 0.125, -0.0625, 0.0625}, -- Bottom_x_yneg
{-0.0625, -0.5, -0.125, 0.0625, -0.0625, 0.125}, -- Bottom_z_yneg
},
connect_top = {
{-0.125, 0.0625, -0.0625, 0.125, 0.5, 0.0625}, -- Top_x_ypos
{-0.0625, 0.0625, -0.125, 0.0625, 0.5, 0.125}, -- Top_z_ypos
},
},
selection_box = {
type = "fixed",
fixed = {
{-0.125, -0.0625, -0.0625, 0.125, 0.0625, 0.0625}, -- Base_x
{-0.0625, -0.125, -0.0625, 0.0625, 0.125, 0.0625}, -- Base_y
{-0.0625, -0.0625, -0.125, 0.0625, 0.0625, 0.125}, -- Base_z
},
},
collision_box = {
type = "fixed",
fixed = {
{-0.125, -0.0625, -0.0625, 0.125, 0.0625, 0.0625}, -- Base_x
{-0.0625, -0.125, -0.0625, 0.0625, 0.125, 0.0625}, -- Base_y
{-0.0625, -0.0625, -0.125, 0.0625, 0.0625, 0.125}, -- Base_z
},
},
})
--[[lib_shapes.register_shape("crate_large", {
description = "Crate Large",
shape_type = "basic",
node_box = {
type = "fixed",
fixed = {
{-0.5, 0.375, -0.5, 0.5, 0.5, 0.5}, -- Base
{-0.4375, -0.4375, -0.4375, 0.4375, 0.4375, 0.4375}, -- Front_h_zneg
{-0.5, -0.5, -0.5, 0.5, -0.375, 0.5}, -- Back_h_zpos
{-0.5, -0.375, -0.5, -0.375, 0.375, -0.375}, -- NodeBox16
{-0.5, -0.375, 0.375, -0.375, 0.375, 0.5}, -- NodeBox17
{0.375, -0.375, -0.5, 0.5, 0.375, -0.375}, -- NodeBox18
{0.375, -0.375, 0.375, 0.5, 0.375, 0.5}, -- NodeBox19
},
},
selection_box = {
type = "fixed",
fixed = {
{-0.5,-0.5,-0.5,0.5,0.5,0.5},
},
},
collision_box = {
type = "fixed",
fixed = {
{-0.5,-0.5,-0.5,0.5,0.5,0.5},
},
},
})
--]]
--[[lib_shapes.register_shape("cylinder_to_cross", {
description = "Cylinder to Cross",
shape_type = "basic",
node_box = {
type = "fixed",
fixed = {
{-0.25, -0.5, -0.4375, 0.25, 0.25, 0.4375}, -- Middle_z
{-0.4375, -0.5, -0.25, 0.4375, 0.25, 0.25}, -- Middle_x
{-0.1875, -0.5, -0.5, 0.1875, 0.5, 0.5}, -- Outer_z
{-0.5, -0.5, -0.1875, 0.5, 0.5, 0.1875}, -- Outer_x
{-0.3125, -0.5, -0.375, 0.3125, -0.125, 0.375}, -- Inner_z
{-0.375, -0.5, -0.3125, 0.375, -0.125, 0.3125}, -- Inner_x
},
},
selection_box = {
type = "fixed",
fixed = {
{-0.5,-0.5,-0.5,0.5,0.5,0.5},
},
},
collision_box = {
type = "fixed",
fixed = {
{-0.5,-0.5,-0.5,0.5,0.5,0.5},
},
},
})
--]]
--[[lib_shapes.register_shape("octagon", {
description = "Octagon",
shape_type = "basic",
node_box = {
type = "fixed",
fixed = {
{-0.25, -0.5, -0.4375, 0.25, 0.5, 0.4375}, -- Middle_z
{-0.4375, -0.5, -0.25, 0.4375, 0.5, 0.25}, -- Middle_x
{-0.1875, -0.5, -0.5, 0.1875, 0.5, 0.5}, -- Outer_z
{-0.5, -0.5, -0.1875, 0.5, 0.5, 0.1875}, -- Outer_x
{-0.3125, -0.5, -0.375, 0.3125, 0.5, 0.375}, -- Inner_z
{-0.375, -0.5, -0.3125, 0.375, 0.5, 0.3125}, -- Inner_x
},
},
selection_box = {
type = "fixed",
fixed = {
{-0.5,-0.5,-0.5,0.5,0.5,0.5},
},
},
collision_box = {
type = "fixed",
fixed = {
{-0.5,-0.5,-0.5,0.5,0.5,0.5},
},
},
})
--]]
--[[lib_shapes.register_shape("square_to_cylinder_large", {
description = "Square to Cylinder Large",
shape_type = "basic",
node_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, 0, 0.5}, -- Base
{-0.5, -0.5, -0.1875, 0.5, 0.5, 0.1875}, -- Front_h_zneg
{-0.25, -0.5, -0.5, 0.25, 0.5, 0.5}, -- Back_h_zpos
{-0.375, -0.5, -0.4375, 0.375, 0.5, 0.4375}, -- NodeBox16
{-0.4375, -0.5, -0.375, 0.4375, 0.5, 0.375}, -- NodeBox17
},
},
selection_box = {
type = "fixed",
fixed = {
{-0.5,-0.5,-0.5,0.5,0.5,0.5},
},
},
collision_box = {
type = "fixed",
fixed = {
{-0.5,-0.5,-0.5,0.5,0.5,0.5},
},
},
})
--]]
--[[lib_shapes.register_shape("square_to_round_large", {
description = "Square to Round Large",
shape_type = "basic",
node_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.1875, 0.5, 0.5, 0.1875}, -- Front_h_zneg
{-0.1875, -0.5, -0.5, 0.1875, 0.5, 0.5}, -- Back_h_zpos
{-0.3125, -0.5, -0.4375, 0.3125, 0.5, 0.4375}, -- NodeBox16
{-0.4375, -0.5, -0.3125, 0.4375, 0.5, 0.3125}, -- NodeBox17
{-0.375, -0.5, -0.375, 0.375, 0.5, 0.375}, -- NodeBox20
{-0.5, -0.5, -0.5, 0.5, 0, 0.5}, -- NodeBox21
},
},
selection_box = {
type = "fixed",
fixed = {
{-0.5,-0.5,-0.5,0.5,0.5,0.5},
},
},
collision_box = {
type = "fixed",
fixed = {
{-0.5,-0.5,-0.5,0.5,0.5,0.5},
},
},
})
--]]
--[[lib_shapes.register_shape("square_beveled_sides_large", {
description = "Square with Beveled Sides Large",
shape_type = "basic",
node_box = {
type = "fixed",
fixed = {
{-0.4375, -0.5, -0.4375, 0.4375, 0.5, 0.4375}, -- Base
{-0.375, -0.5, -0.5, 0.375, 0.5, 0.5}, -- Front_h_zneg
{-0.5, -0.5, -0.375, 0.5, 0.5, 0.375}, -- Back_h_zpos
},
},
selection_box = {
type = "fixed",
fixed = {
{-0.5,-0.5,-0.5,0.5,0.5,0.5},
},
},
collision_box = {
type = "fixed",
fixed = {
{-0.5,-0.5,-0.5,0.5,0.5,0.5},
},
},
})
--]]

156
init.lua Normal file
View File

@ -0,0 +1,156 @@
--
--lib_shapes
--copyright 2017 ShadMOrdre@gmail.com
--
--A mod for Minetest that provides various nodeboxes that can then be applied to any "materials" type
--node. The "materials" are generally defined as stone, metal, tree, wood, and glass. The shapes are
--nodeboxes, and a shape node is created and presented in a users inventory. Shapes are created in separate
--mods, organized according to below. The entire collection is included in the modpack.
--Among the shapes provided are:
-- Columns, Pillars, Beams
-- Doors (Solid, Windowed, Sliding, and larger doors of sizes 3x1.5 and 4x2)
-- Fences (Includes railing nodes as well as standard fencing)
-- Furniture (Chairs, Tables, Sofa section pieces, a (currently) non working bed
-- Gates (Solid and Railed type gates, with attached support post. These are essentially half-height doors, thus, will be merged)
-- General (Cylinders, Linkages, various other standard shapes)
-- Lights (Dekstop, Hanging, Wall-Mounted, an Overhead strip light, and a "magic" bulb that can attach to most materials)
-- Religious (Various religous themed shapes. Currently, a cross, a tombstone, and a tomb.)
-- Slabs (Slabs of thicknesses: 1/16, 1/8, 1/4, 1/2)
-- Stairs (Includes standard 2 step stairs, and custom 4 step stairs, of various designs)
-- Tree (These nodes connect only to tree, leaves and themselves. Designed for creating more elaborate trees)
-- Wall (Walls of thicknesses: 1/16, 1/8, 1/4, 1/2, 3/4
--**LICENSING**
--For the sections of code copied from minetest_game, the code is licensed LGPL2.1.
--For the sections of code copied from xdecor, the code is licensed ###############.
--For all other code, license is MIT.
--All graphics are original works by ShadMOrdre@gmail.com, and are licensed CC-BY-SA.
lib_shapes = {}
local S
if minetest.get_modpath("intllib") then
S = intllib.Getter()
else
S = function(s,a,...)a={a,...}return s:gsub("@(%d+)",function(n)return a[tonumber(n)]end)end
end
lib_shapes.registered_shapes = {}
local modpath = minetest.get_modpath("lib_shapes")
local applicable_nodes = {}
lib_shapes.registered_doors = {}
lib_shapes.shapes_created = 0
lib_shapes.nodes_used = 0
lib_shapes.nodes_created = 0
dofile(modpath.."/craftitems.lua")
dofile(modpath.."/utility.lua")
function lib_shapes.get_shapes()
--local shape_list = {}
for shape, def in pairs(registered_shapes) do
lib_shapes.shapes_created = lib_shapes.shapes_created + 1
minetest.debug(lib_shapes.shapes_created)
end
end
lib_shapes.register_shape = function(shape_name, shape_def)
local new_shape_name = ""
local new_shape_def = {}
new_shape_name = "shape_" .. shape_name
new_shape_def = {
description = shape_def.description .. " Shape",
drawtype = "nodebox",
tiles = {
"dk_grey_noise.png^align_grid_ypos.png",
"dk_grey_noise.png^align_grid_yneg.png",
"dk_grey_noise.png^align_grid_xpos.png",
"dk_grey_noise.png^align_grid_xneg.png",
"dk_grey_noise.png^align_grid_zpos.png",
"dk_grey_noise.png^align_grid_zneg.png",
},
paramtype = "light",
paramtype2 = "facedir",
connects_to = { "group:lib_shapes_library" },
is_ground_content = false,
walkable = true,
climbable = false,
buildable_to = false,
groups = { oddly_breakable_by_hand = 3, lib_shapes_library = 3 },
node_box = shape_def.node_box,
selection_box = shape_def.selection_box,
collision_box = shape_def.collision_box,
on_place = function(itemstack, placer, pointed_thing)
if pointed_thing.type ~= "node" then
return itemstack
end
local p0 = pointed_thing.under
local p1 = pointed_thing.above
local param2 = 0
local placer_pos = placer:getpos()
if placer_pos then
local dir = {
x = p1.x - placer_pos.x,
y = p1.y - placer_pos.y,
z = p1.z - placer_pos.z
}
param2 = minetest.dir_to_facedir(dir)
end
if p0.y-1 == p1.y then
param2 = param2 + 20
if param2 == 21 then
param2 = 23
elseif param2 == 23 then
param2 = 21
end
end
return minetest.item_place(itemstack, placer, pointed_thing, param2)
end,
}
minetest.register_node("lib_shapes:" .. new_shape_name, new_shape_def)
minetest.register_craft({
output = new_shape_name .. " 1",
recipe = {
{ 'lib_shapes:blueprint', 'lib_shapes:blueprint', 'lib_shapes:blueprint' },
{ '', 'lib_shapes:blueprint', ''},
{ '', '', ''},
}
})
lib_shapes.registered_shapes[new_shape_name] = shape_def
lib_shapes.shapes_created = lib_shapes.shapes_created + 1
minetest.log("NEW SHAPE: = " .. new_shape_name)
--lib_shapes.register_shaped_nodes(shape_name, shape_def)
end
dofile(modpath.."/architecture.lua")
dofile(modpath.."/doors.lua")
dofile(modpath.."/fences.lua")
dofile(modpath.."/furniture.lua")
dofile(modpath.."/general.lua")
dofile(modpath.."/lights.lua")

314
lights.lua Normal file
View File

@ -0,0 +1,314 @@
--[[ TEMPLATE
lib_shapes.register_shape(name, description, node_box, selection_box, collision_box)
Name Name of the shape within the library
Description Full Text description of above name
Node_Box node_box = {
type = "fixed",
fixed = {
{-0.25, 0, -0.5, 0.25, 0.5, 0.5},
},
},
(above example for a static node_box
OR
below example for a connected node_box)
node_box = {
type = "connected",
fixed = {
{-0.5, -0.5, -0.5, 0.5, 0.5, 0.5},
},
connect_front = {
{-0.125, -0.0625, -0.5, 0.125, 0.0625, -0.0625}, -- Front_h_zneg
},
connect_back = {
{-0.125, -0.0625, 0.0625, 0.125, 0.0625, 0.5}, -- Back_h_zpos
},
connect_left = {
{-0.5, -0.0625, -0.125, -0.0625, 0.0625, 0.125}, -- Left_h_xneg
},
connect_right = {
{0.0625, -0.0625, -0.125, 0.5, 0.0625, 0.125}, -- Right_h_xpos
},
connect_bottom = {
{-0.125, -0.5, -0.0625, 0.125, -0.0625, 0.0625}, -- Bottom_x_yneg
},
connect_top = {
{-0.125, 0.0625, -0.0625, 0.125, 0.5, 0.0625}, -- Top_x_ypos
},
},
Selection_Box Follows the same as above for fixed node_box. Standard definition.
Collision_Box Follows the same as above for fixed node_box. Standard definition.
EXAMPLE:
lib_node_shapes.register_shape(
"shape_somename", --All shape names WILL BE prefixed with 'shape_'. This allows shapes to be sorted together in inventory.
"Unique text description of the shape",
node_box = {
type = "fixed",
fixed = {
{-0.25, 0, -0.5, 0.25, 0.5, 0.5},
},
},
selection_box = {
type = "fixed",
fixed = {
{-0.25, 0, -0.5, 0.25, 0.5, 0.5},
},
},
collision_box = {
type = "fixed",
fixed = {
{ -0.25, 0, -0.5, 0.25, 0.5, 0.5},
},
},
)
--]]
local S
if minetest.get_modpath("intllib") then
S = intllib.Getter()
else
S = function(s,a,...)a={a,...}return s:gsub("@(%d+)",function(n)return a[tonumber(n)]end)end
end
lib_shapes.register_shape("lamp_bulb", {
description = "Light Bulb",
shape_type = "light",
tiles = {
"(overlay_alpha_light_lamp_frame.png^new_node_tiles^overlay_alpha_light_lamp_frame.png^[makealpha:255,126,126)^(overlay_alpha_light_lamp_bulb.png^default_cloud.png^overlay_alpha_light_lamp_bulb.png^[makealpha:255,126,126)",
"(overlay_alpha_light_lamp_frame.png^new_node_tiles^overlay_alpha_light_lamp_frame.png^[makealpha:255,126,126)^(overlay_alpha_light_lamp_bulb.png^default_cloud.png^overlay_alpha_light_lamp_bulb.png^[makealpha:255,126,126)",
"(overlay_alpha_light_lamp_frame.png^new_node_tiles^overlay_alpha_light_lamp_frame.png^[makealpha:255,126,126)^(overlay_alpha_light_lamp_bulb.png^default_cloud.png^overlay_alpha_light_lamp_bulb.png^[makealpha:255,126,126)",
"(overlay_alpha_light_lamp_frame.png^new_node_tiles^overlay_alpha_light_lamp_frame.png^[makealpha:255,126,126)^(overlay_alpha_light_lamp_bulb.png^default_cloud.png^overlay_alpha_light_lamp_bulb.png^[makealpha:255,126,126)",
"(overlay_alpha_light_lamp_frame.png^new_node_tiles^overlay_alpha_light_lamp_frame.png^[makealpha:255,126,126)^(overlay_alpha_light_lamp_bulb.png^default_cloud.png^overlay_alpha_light_lamp_bulb.png^[makealpha:255,126,126)",
"(overlay_alpha_light_lamp_frame.png^new_node_tiles^overlay_alpha_light_lamp_frame.png^[makealpha:255,126,126)^(overlay_alpha_light_lamp_bulb.png^default_cloud.png^overlay_alpha_light_lamp_bulb.png^[makealpha:255,126,126)",
},
node_box = {
type = "connected",
fixed = {
{-0.125, -0.125, -0.125, 0.125, 0.125, 0.125},
},
connect_front = {
{-0.0625, -0.0625, -0.5, 0.0625, 0.0625, -0.125},
},
connect_back = {
{-0.0625, -0.0625, 0.125, 0.0625, 0.0625, 0.5},
},
connect_left = {
{-0.5, -0.0625, -0.0625, -0.125, 0.0625, 0.0625},
},
connect_right = {
{0.125, -0.0625, -0.0625, 0.5, 0.0625, 0.0625},
},
connect_bottom = {
{-0.0625, -0.5, -0.0625, 0.0625, -0.125, 0.0625},
},
connect_top = {
{-0.0625, 0.125, -0.0625, 0.0625, 0.5, 0.0625},
},
},
selection_box = {
type = "fixed",
fixed = {
{-0.125, -0.125, -0.125, 0.125, 0.125, 0.125},
},
},
collision_box = {
type = "fixed",
fixed = {
{-0.125, -0.125, -0.125, 0.125, 0.125, 0.125},
},
},
})
lib_shapes.register_shape("lamp_simple_01", {
description = "Simple Lamp 01",
shape_type = "light",
node_box = {
type = "connected",
fixed = {
{-0.125, -0.5, -0.125, 0.125, 0.125, 0.125},
},
},
selection_box = {
type = "fixed",
fixed = {
{-0.125, -0.5, -0.125, 0.125, 0.125, 0.125},
},
},
collision_box = {
type = "fixed",
fixed = {
{-0.125, -0.5, -0.125, 0.125, 0.125, 0.125},
},
},
})
lib_shapes.register_shape("lamp_01", {
description = "Lamp 01",
shape_type = "light",
node_box = {
type = "connected",
fixed = {
{-0.125, -0.125, -0.125, 0.125, 0.25, 0.125}, -- BASE
{-0.25, -0.5, -0.25, 0.25, -0.125, 0.25}, -- BOTTOM
{-0.25, -0.125, 0.1875, -0.1875, 0.3125, 0.25}, -- REARLEFT
{0.1875, -0.125, 0.1875, 0.25, 0.3125, 0.25}, -- REARRIGHT
{-0.25, 0.3125, -0.25, 0.25, 0.375, 0.25}, -- TOP
{-0.25, -0.125, -0.25, -0.1875, 0.3125, -0.1875}, -- FRONTLEFT
{0.1875, -0.125, -0.25, 0.25, 0.3125, -0.1875}, -- FRONTRIGHT
},
},
selection_box = {
type = "fixed",
fixed = {
{-0.125, -0.125, -0.125, 0.125, 0.25, 0.125}, -- BASE
{-0.25, -0.5, -0.25, 0.25, -0.125, 0.25}, -- BOTTOM
{-0.25, -0.125, 0.1875, -0.1875, 0.3125, 0.25}, -- REARLEFT
{0.1875, -0.125, 0.1875, 0.25, 0.3125, 0.25}, -- REARRIGHT
{-0.25, 0.3125, -0.25, 0.25, 0.375, 0.25}, -- TOP
{-0.25, -0.125, -0.25, -0.1875, 0.3125, -0.1875}, -- FRONTLEFT
{0.1875, -0.125, -0.25, 0.25, 0.3125, -0.1875}, -- FRONTRIGHT
},
},
collision_box = {
type = "fixed",
fixed = {
{-0.125, -0.125, -0.125, 0.125, 0.25, 0.125}, -- BASE
{-0.25, -0.5, -0.25, 0.25, -0.125, 0.25}, -- BOTTOM
{-0.25, -0.125, 0.1875, -0.1875, 0.3125, 0.25}, -- REARLEFT
{0.1875, -0.125, 0.1875, 0.25, 0.3125, 0.25}, -- REARRIGHT
{-0.25, 0.3125, -0.25, 0.25, 0.375, 0.25}, -- TOP
{-0.25, -0.125, -0.25, -0.1875, 0.3125, -0.1875}, -- FRONTLEFT
{0.1875, -0.125, -0.25, 0.25, 0.3125, -0.1875}, -- FRONTRIGHT
},
},
})
lib_shapes.register_shape("lamp_02", {
description = "Lamp 02",
shape_type = "light",
node_box = {
type = "connected",
fixed = {
{-0.125, -0.5, -0.125, 0.125, 0.125, 0.125},
{-0.3125, 0.125, -0.3125, 0.3125, 0.25, 0.3125},
{-0.25, 0.25, -0.25, 0.25, 0.3125, 0.25},
},
},
selection_box = {
type = "fixed",
fixed = {
{-0.125, -0.5, -0.125, 0.125, 0.125, 0.125},
{-0.3125, 0.125, -0.3125, 0.3125, 0.25, 0.3125},
{-0.25, 0.25, -0.25, 0.25, 0.3125, 0.25},
},
},
collision_box = {
type = "fixed",
fixed = {
{-0.125, -0.5, -0.125, 0.125, 0.125, 0.125},
{-0.3125, 0.125, -0.3125, 0.3125, 0.25, 0.3125},
{-0.25, 0.25, -0.25, 0.25, 0.3125, 0.25},
},
},
})
lib_shapes.register_shape("light_overhead", {
description = "Light - Overhead",
shape_type = "light",
node_box = {
type = "fixed",
fixed = {
{-0.500000,0.250000,-0.250000,0.500000,0.407216,0.250000},
{-0.500000,0.312500,-0.062500,0.500000,0.500000,0.062500},
},
},
selection_box = {
type = "fixed",
fixed = {
{-0.500000,0.250000,-0.250000,0.500000,0.407216,0.250000},
{-0.500000,0.312500,-0.062500,0.500000,0.500000,0.062500},
},
},
collision_box = {
type = "fixed",
fixed = {
{-0.500000,0.250000,-0.250000,0.500000,0.407216,0.250000},
{-0.500000,0.312500,-0.062500,0.500000,0.500000,0.062500},
},
},
})
lib_shapes.register_shape("light_chandelier_01", {
description = "Light - Lamp Desktop",
shape_type = "light",
node_box = {
type = "connected",
fixed = {
{-0.0625, -0.5, -0.0625, 0.0625, 0.5, 0.0625}, -- NodeBox1
{-0.375, -0.25, -0.5, 0.375, -0.125, -0.375}, -- NodeBox2
{-0.375, -0.25, 0.375, 0.375, -0.125, 0.5}, -- NodeBox3
{-0.5, -0.25, -0.375, -0.375, -0.125, 0.375}, -- NodeBox4
{0.375, -0.25, -0.375, 0.5, -0.125, 0.375}, -- NodeBox5
{-0.4375, -0.3125, -0.4375, -0.375, 0.0, -0.375}, -- NodeBox6
{-0.4375, -0.3125, 0.375, -0.375, 0.0, 0.4375}, -- NodeBox7
{0.375, -0.3125, 0.375, 0.4375, 0.0, 0.4375}, -- NodeBox8
{0.375, -0.3125, -0.4375, 0.4375, 0.0, -0.375}, -- NodeBox9
{-0.25, -0.3125, -0.25, -0.1875, 0.0, -0.1875}, -- NodeBox11
{-0.25, -0.3125, 0.1875, -0.1875, 0.0, 0.25}, -- NodeBox12
{0.1875, -0.3125, -0.25, 0.25, 0.0, -0.1875}, -- NodeBox10
{0.1875, -0.3125, 0.1875, 0.25, 0.0, 0.25}, -- NodeBox13
{-0.0625, -0.25, -0.375, 0.0625, -0.125, 0.375}, -- NodeBox14
{-0.375, -0.25, -0.0625, 0.375, -0.125, 0.0625}, -- NodeBox15
},
},
selection_box = {
type = "fixed",
fixed = {
{-0.0625, -0.5, -0.0625, 0.0625, 0.5, 0.0625}, -- NodeBox1
{-0.375, -0.25, -0.5, 0.375, -0.125, -0.375}, -- NodeBox2
{-0.375, -0.25, 0.375, 0.375, -0.125, 0.5}, -- NodeBox3
{-0.5, -0.25, -0.375, -0.375, -0.125, 0.375}, -- NodeBox4
{0.375, -0.25, -0.375, 0.5, -0.125, 0.375}, -- NodeBox5
{-0.4375, -0.3125, -0.4375, -0.375, 0.0, -0.375}, -- NodeBox6
{-0.4375, -0.3125, 0.375, -0.375, 0.0, 0.4375}, -- NodeBox7
{0.375, -0.3125, 0.375, 0.4375, 0.0, 0.4375}, -- NodeBox8
{0.375, -0.3125, -0.4375, 0.4375, 0.0, -0.375}, -- NodeBox9
{-0.25, -0.3125, -0.25, -0.1875, 0.0, -0.1875}, -- NodeBox11
{-0.25, -0.3125, 0.1875, -0.1875, 0.0, 0.25}, -- NodeBox12
{0.1875, -0.3125, -0.25, 0.25, 0.0, -0.1875}, -- NodeBox10
{0.1875, -0.3125, 0.1875, 0.25, 0.0, 0.25}, -- NodeBox13
{-0.0625, -0.25, -0.375, 0.0625, -0.125, 0.375}, -- NodeBox14
{-0.375, -0.25, -0.0625, 0.375, -0.125, 0.0625}, -- NodeBox15
},
},
collision_box = {
type = "fixed",
fixed = {
{-0.0625, -0.5, -0.0625, 0.0625, 0.5, 0.0625}, -- NodeBox1
{-0.375, -0.25, -0.5, 0.375, -0.125, -0.375}, -- NodeBox2
{-0.375, -0.25, 0.375, 0.375, -0.125, 0.5}, -- NodeBox3
{-0.5, -0.25, -0.375, -0.375, -0.125, 0.375}, -- NodeBox4
{0.375, -0.25, -0.375, 0.5, -0.125, 0.375}, -- NodeBox5
{-0.4375, -0.3125, -0.4375, -0.375, 0.0, -0.375}, -- NodeBox6
{-0.4375, -0.3125, 0.375, -0.375, 0.0, 0.4375}, -- NodeBox7
{0.375, -0.3125, 0.375, 0.4375, 0.0, 0.4375}, -- NodeBox8
{0.375, -0.3125, -0.4375, 0.4375, 0.0, -0.375}, -- NodeBox9
{-0.25, -0.3125, -0.25, -0.1875, 0.0, -0.1875}, -- NodeBox11
{-0.25, -0.3125, 0.1875, -0.1875, 0.0, 0.25}, -- NodeBox12
{0.1875, -0.3125, -0.25, 0.25, 0.0, -0.1875}, -- NodeBox10
{0.1875, -0.3125, 0.1875, 0.25, 0.0, 0.25}, -- NodeBox13
{-0.0625, -0.25, -0.375, 0.0625, -0.125, 0.375}, -- NodeBox14
{-0.375, -0.25, -0.0625, 0.375, -0.125, 0.0625}, -- NodeBox15
},
},
})

186
utility.lua Normal file
View File

@ -0,0 +1,186 @@
function lib_shapes.get(pos)
local node_name = minetest.get_node(pos).name
if lib_shapes.registered_doors[node_name] then
-- A normal upright door
return {
pos = pos,
open = function(self, player)
if self:state() then
return false
end
return lib_shapes.door_toggle(self.pos, nil, player)
end,
close = function(self, player)
if not self:state() then
return false
end
return lib_shapes.door_toggle(self.pos, nil, player)
end,
toggle = function(self, player)
return lib_shapes.door_toggle(self.pos, nil, player)
end,
state = function(self)
return minetest.get_node(self.pos).name:sub(-5) == "_open"
end
}
else
return nil
end
end
function lib_shapes.door_toggle(pos, node, clicker)
node = node or minetest.get_node(pos)
if clicker and not minetest.check_player_privs(clicker, "protection_bypass") then
-- is player wielding the right key?
local item = clicker:get_wielded_item()
local meta = minetest.get_meta(pos)
local owner = meta:get_string("doors_owner")
if item:get_name() == "default:key" then
local key_meta = minetest.parse_json(item:get_metadata())
local secret = meta:get_string("key_lock_secret")
if secret ~= key_meta.secret then
return false
end
elseif owner ~= "" then
if clicker:get_player_name() ~= owner then
return false
end
end
end
local def = minetest.registered_nodes[node.name]
if string.sub(node.name, -5) == "_open" then
minetest.sound_play(def.sound_close,
{pos = pos, gain = 0.3, max_hear_distance = 10})
minetest.swap_node(pos, {name = string.sub(node.name, 1,
string.len(node.name) - 5), param1 = node.param1, param2 = node.param2})
else
minetest.sound_play(def.sound_open,
{pos = pos, gain = 0.3, max_hear_distance = 10})
minetest.swap_node(pos, {name = node.name .. "_open",
param1 = node.param1, param2 = node.param2})
end
end
local function can_dig_door(pos, digger)
local digger_name = digger and digger:get_player_name()
if digger_name and minetest.get_player_privs(digger_name).protection_bypass then
return true
end
return minetest.get_meta(pos):get_string("doors_owner") == digger_name
end
local function on_place_node(place_to, newnode,
placer, oldnode, itemstack, pointed_thing)
-- Run script hook
for _, callback in ipairs(minetest.registered_on_placenodes) do
-- Deepcopy pos, node and pointed_thing because callback can modify them
local place_to_copy = {x = place_to.x, y = place_to.y, z = place_to.z}
local newnode_copy =
{name = newnode.name, param1 = newnode.param1, param2 = newnode.param2}
local oldnode_copy =
{name = oldnode.name, param1 = oldnode.param1, param2 = oldnode.param2}
local pointed_thing_copy = {
type = pointed_thing.type,
above = vector.new(pointed_thing.above),
under = vector.new(pointed_thing.under),
ref = pointed_thing.ref,
}
callback(place_to_copy, newnode_copy, placer,
oldnode_copy, itemstack, pointed_thing_copy)
end
end
local function top_face(pointed_thing)
if not pointed_thing then return end
return pointed_thing.above.y > pointed_thing.under.y
end
function lib_shapes.sit(pos, node, clicker, pointed_thing)
if not top_face(pointed_thing) then return end
local player_name = clicker:get_player_name()
local objs = minetest.get_objects_inside_radius(pos, 0.1)
local vel = clicker:get_player_velocity()
local ctrl = clicker:get_player_control()
for _, obj in pairs(objs) do
if obj:is_player() and obj:get_player_name() ~= player_name then
return
end
end
if default.player_attached[player_name] then
pos.y = pos.y - 0.5
clicker:setpos(pos)
clicker:set_eye_offset({x=0, y=0, z=0}, {x=0, y=0, z=0})
clicker:set_physics_override(1, 1, 1)
default.player_attached[player_name] = false
default.player_set_animation(clicker, "stand", 30)
elseif not default.player_attached[player_name] and node.param2 <= 3 and not
ctrl.sneak and vel.x == 0 and vel.y == 0 and vel.z == 0 then
clicker:set_eye_offset({x=0, y=-7, z=2}, {x=0, y=0, z=0})
clicker:set_physics_override(0, 0, 0)
clicker:setpos(pos)
default.player_attached[player_name] = true
default.player_set_animation(clicker, "sit", 30)
if node.param2 == 0 then clicker:set_look_yaw(3.15)
elseif node.param2 == 1 then clicker:set_look_yaw(7.9)
elseif node.param2 == 2 then clicker:set_look_yaw(6.28)
elseif node.param2 == 3 then clicker:set_look_yaw(4.75) end
end
end
function lib_shapes.sit_dig(pos, player)
local pname = player:get_player_name()
local objs = minetest.get_objects_inside_radius(pos, 0.1)
for _, p in pairs(objs) do
if not player or not player:is_player() or p:get_player_name() or
default.player_attached[pname] then
return false
end
end
return true
end
function lib_shapes.get_node_group(name, group)
if not minetest.registered_nodes[name] or not minetest.registered_nodes[name].groups[group] then
return 0
end
return minetest.registered_nodes[name]
end
function lib_shapes.get_nodedef_field(nodename, fieldname)
if not minetest.registered_items[nodename] then
if not minetest.registered_items[nodename][fieldname] then
return nil
end
end
return minetest.registered_nodes[nodename][fieldname]
end
function lib_shapes.get_item_groups(name, groups)
if not minetest.registered_items[name] or not
minetest.registered_items[name].groups[group] then
return 0
end
return minetest.registered_items[name].groups[group]
end
--[[
function minetest.get_item_group(name, group)
if not minetest.registered_items[name] or not
minetest.registered_items[name].groups[group] then
return 0
end
return minetest.registered_items[name].groups[group]
end
--]]