Skip to content

Instantly share code, notes, and snippets.

@sofar
Created December 30, 2015 16:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sofar/b381c8c192c8e53e6062 to your computer and use it in GitHub Desktop.
Save sofar/b381c8c192c8e53e6062 to your computer and use it in GitHub Desktop.
prototype connecting nodeboxes demo
--[[
Wall mod for Minetest
Copyright (C) 2015 Auke Kok <sofar@foo-projects.org>
This program is free software. It comes without any warranty, to
the extent permitted by applicable law. You can redistribute it
and/or modify it under the terms of the Do What The Fuck You Want
To Public License, Version 2, as published by Sam Hocevar. See
http://sam.zoy.org/wtfpl/COPYING for more details.
--]]
wall = {}
wall.register = function(wall_name, wall_desc, wall_texture, wall_mat, wall_sounds)
-- inventory node, and pole-type wall start item
minetest.register_node(wall_name, {
description = wall_desc,
drawtype = "nodebox",
node_box = {
type = "connected",
fixed = {{-1/4, -1/2, -1/4, 1/4, 1/2, 1/4}},
-- connect_up =
-- connect_down =
connect_n = {{-1/8, -1/2, 1/4, 1/8, 1/4, 1/2}},
connect_e = {{ 1/4, -1/2, -1/8, 1/2, 1/4, 1/8}},
connect_w = {{-1/2, -1/2, -1/8, -1/4, 1/4, 1/8}},
connect_s = {{-1/8, -1/2, -1/2, 1/8, 1/4, -1/4}},
},
paramtype = "light",
is_ground_content = false,
tiles = { wall_texture, },
walkable = true,
groups = { cracky = 3, wall = 1, stone = 2 },
sounds = wall_sounds,
})
-- crafting recipe
minetest.register_craft({
output = wall_name,
recipe = {
{ '', '', '' },
{ wall_mat, wall_mat, wall_mat},
{ wall_mat, wall_mat, wall_mat},
}
})
end
wall.register("wall:stone", "Stone Wall", "default_stone.png",
"default:stone", default.node_sound_stone_defaults())
wall.register("wall:cobble", "Cobblestone Wall", "default_cobble.png",
"default:cobble", default.node_sound_stone_defaults())
wall.register("wall:stonebrick", "Stone Brick Wall", "default_stone_brick.png",
"default:stonebrick", default.node_sound_stone_defaults())
wall.register("wall:mossycobble", "Mossy Cobblestone Wall", "default_mossycobble.png",
"default:mossycobble", default.node_sound_stone_defaults())
wall.register("wall:sandstone", "Sandstone Wall", "default_sandstone.png",
"default:sandstone", default.node_sound_stone_defaults())
wall.register("wall:sandstonebrick", "Sandstone Brick Wall", "default_sandstone_brick.png",
"default:sandstonebrick", default.node_sound_stone_defaults())
wall.register("wall:desertstone", "Desert Stone Wall", "default_desert_stone.png",
"default:desert_stone", default.node_sound_stone_defaults())
wall.register("wall:desertcobble", "Desert Cobblestone Wall", "default_desert_cobble.png",
"default:desert_cobble", default.node_sound_stone_defaults())
wall.register("wall:desertstonebrick", "Desert Stone Brick Wall", "default_desert_stone_brick.png",
"default:desert_stonebrick", default.node_sound_stone_defaults())
wall.register("wall:obsidian", "Obsidian Wall", "default_obsidian.png",
"default:obsidian", default.node_sound_stone_defaults())
wall.register("wall:obsidianbrick", "Obsidian Brick Wall", "default_obsidian_brick.png",
"default:obsidianbrick", default.node_sound_stone_defaults())
minetest.register_node("wall:fence", {
description = "New Fence",
drawtype = "nodebox",
node_box = {
type = "connected",
fixed = {{-1/8, -1/2, -1/8, 1/8, 1/2, 1/8}},
-- connect_up =
-- connect_down =
connect_n = {{-1/16,3/16,1/8,1/16,5/16,1/2},
{-1/16,-5/16,1/8,1/16,-3/16,1/2},
{-1/16,-1/16,1/8,1/16,1/16,1/2}},
connect_e = {{1/8,3/16,-1/16,1/2,5/16,1/16},
{1/8,-5/16,-1/16,1/2,-3/16,1/16},
{1/8,-1/16,-1/16,1/2,1/16,1/16}},
connect_w = {{-1/2,3/16,-1/16,-1/8,5/16,1/16},
{-1/2,-5/16,-1/16,-1/8,-3/16,1/16},
{-1/2,-1/16,-1/16,-1/8,1/16,1/16}},
connect_s = {{-1/16,3/16,-1/2,1/16,5/16,-1/8},
{-1/16,-5/16,-1/2,1/16,-3/16,-1/8},
{-1/16,-1/16,-1/2,1/16,1/16,-1/8}},
},
paramtype = "light",
is_ground_content = false,
tiles = { "default_tree.png" },
walkable = true,
groups = { choppy = 3, fence = 1, wood = 2 },
sounds = default.node_sound_wood_defaults(),
})
minetest.register_node("wall:fence_jungle", {
description = "New Fence Jungle",
drawtype = "nodebox",
node_box = {
type = "connected",
fixed = {{-1/8, -1/2, -1/8, 1/8, 1/2, 1/8}},
-- connect_up =
-- connect_down =
connect_n = {{-1/16,3/16,1/8,1/16,5/16,1/2},
{-1/16,-5/16,1/8,1/16,-3/16,1/2},
{-1/16,-1/16,1/8,1/16,1/16,1/2}},
connect_e = {{1/8,3/16,-1/16,1/2,5/16,1/16},
{1/8,-5/16,-1/16,1/2,-3/16,1/16},
{1/8,-1/16,-1/16,1/2,1/16,1/16}},
connect_w = {{-1/2,3/16,-1/16,-1/8,5/16,1/16},
{-1/2,-5/16,-1/16,-1/8,-3/16,1/16},
{-1/2,-1/16,-1/16,-1/8,1/16,1/16}},
connect_s = {{-1/16,3/16,-1/2,1/16,5/16,-1/8},
{-1/16,-5/16,-1/2,1/16,-3/16,-1/8},
{-1/16,-1/16,-1/2,1/16,1/16,-1/8}},
},
paramtype = "light",
is_ground_content = false,
tiles = { "default_jungletree.png" },
walkable = true,
groups = { choppy = 3, fence = 1, wood = 2 },
sounds = default.node_sound_wood_defaults(),
})
minetest.register_node("wall:glass_pane", {
description = "Glass pane new",
drawtype = "nodebox",
node_box = {
type = "connected",
fixed = {{-1/16, -1/2, -1/16, 1/16, 1/2, 1/16}},
-- connect_up =
-- connect_down =
connect_n = {{-1/16,-1/2,1/16,1/16,1/2,1/2}},
connect_e = {{1/16,-1/2,-1/16,1/2,1/2,1/16}},
connect_w = {{-1/2,-1/2,-1/16,-1/16,1/2,1/16}},
connect_s = {{-1/16,-1/2,-1/2,1/16,1/2,-1/16}},
},
selection_box = { type = "fixed", fixed = { -1/2, -1/2, -1/2, 1/2, 1/2, 1/2 }, },
paramtype = "light",
is_ground_content = false,
tiles = { "xpanes_pane_magenta.png" },
use_texture_alpha = true,
backface_culling = true,
walkable = true,
groups = { choppy = 3, fence = 1, wood = 2 },
sounds = default.node_sound_wood_defaults(),
})
minetest.register_node("wall:conduit", {
description = "some wire new",
drawtype = "nodebox",
node_box = {
type = "connected",
fixed = {{-1/16, -1/2, -1/16, 1/16, -7/16, 1/16}},
connect_up = {{-1/16, -7/16, -1/16, 1/16, 1/2, 1/16}},
-- connect_down =
connect_n = {{-1/16,-1/2,1/16,1/16,-7/16,1/2}},
connect_e = {{1/16,-1/2,-1/16,1/2,-7/16,1/16}},
connect_w = {{-1/2,-1/2,-1/16,-1/16,-7/16,1/16}},
connect_s = {{-1/16,-1/2,-1/2,1/16,-7/16,-1/16}},
},
selection_box = { type = "fixed", fixed = { -1/2, -1/2, -1/2, 1/2, -1/4, 1/2 }, },
paramtype = "light",
is_ground_content = false,
tiles = { "default_mese_block.png" },
walkable = true,
groups = { choppy = 3, fence = 1, wood = 2 },
sounds = default.node_sound_wood_defaults(),
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment