2017-01-26 11:00:18 -08:00

142 lines
3.0 KiB
Lua

--[[
nodes.lua - basic node blocks for Inside The Box
]]--
-- table format:
-- [1] name, also used for texture
-- [2] true for stair/slab
-- [3] tool if diggable version needs to be added
-- [4] color versions?
local nodes = {
{"bricks_clay", true, "pickaxe"},
{"bricks_limestone", true, "pickaxe"},
{"bricks_marble", true, "pickaxe"},
{"bricks_sandstone", true, "pickaxe"},
{"bricks_stone", true, "pickaxe"},
{"cobble", true, "pickaxe"},
{"cobble_moss", true, "pickaxe"},
{"limestone", true, "pickaxe"},
{"marble", true, "pickaxe"},
{"sandstone", true, "pickaxe"},
{"stone", true, "pickaxe"},
{"stone_moss", true, "pickaxe"},
{"glass", false, "pickaxe"},
{"bronze", false, "pickaxe"},
{"gold", false, "pickaxe"},
{"iron", false, "pickaxe"},
{"clay", false, "shovel"},
{"dirt", false, "shovel"},
{"gravel", false, "shovel"},
{"sand", false, "shovel"},
{"trunk_light", false, "axe"}, -- trunks need new tops/bottoms, shouldn't be in this series.
{"trunk_medium", false, "axe"},
{"trunk_dark", false, "axe"},
{"leaves_light", false, "axe"},
{"leaves_medium", false, "axe"},
{"leaves_dark", false, "axe"},
{"wood_dark", true, "axe"},
{"wood_light", true, "axe"},
{"wood_medium", true, "axe"},
{"grass", false, false},
{"wool", false, false},
}
local function make_stair_slab(name, groups, b1, b2)
minetest.register_node("nodes:" .. name .. b1 .. "_stairs", {
description = name .. " stairs" .. b2,
tiles = {name .. ".png"},
drawtype = "mesh",
mesh = "stairs_stair.obj",
paramtype = "light",
paramtype2 = "facedir",
groups = groups,
selection_box = {
type = "fixed",
fixed = {
{-1/2, -1/2, -1/2, 1/2, 0, 1/2},
{-1/2, 0, 0, 1/2, 1/2, 1/2},
},
},
collision_box = {
type = "fixed",
fixed = {
{-1/2, -1/2, -1/2, 1/2, 0, 1/2},
{-1/2, 0, 0, 1/2, 1/2, 1/2},
},
},
})
minetest.register_node("nodes:" .. name .. b1 .. "_slab", {
description = name .. " slab" .. b2,
tiles = {name .. ".png"},
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
groups = groups,
node_box = {
type = "fixed",
fixed = {-1/2, -1/2, -1/2, 1/2, 0, 1/2},
},
})
end
for _, v in pairs(nodes) do
local groups = {node = 1}
if v[3] then
-- register diggable node version
groups[v[3]] = 3
minetest.register_node("nodes:" .. v[1] .. "_breakable", {
description = v[1] .. " (breakable)",
tiles = {v[1] .. ".png"},
groups = groups,
})
if v[2] then
make_stair_slab(v[1], groups, "_breakable", " (breakable)")
end
end
minetest.register_node("nodes:" .. v[1], {
description = v[1],
tiles = {v[1] .. ".png"},
groups = {node = 1},
})
if v[2] then
make_stair_slab(v[1], {node = 1}, "", "")
end
end
-- panes
-- iron_pane
-- glass_pane
-- walls
-- cobble_wall
-- cobble_moss_wall
-- special nodes
-- water
-- lava
-- tnt
-- fire
-- fire_permanent
-- chests:
-- empty (fake) chest
-- chest-with-key
-- chest-with-tool
-- vegetation:
-- grass variants
-- flowers
-- soil and vegetation
-- doors -> mech?