From f8f7502e3253d50e4e0829fdd6e2ad7aab2e4cd3 Mon Sep 17 00:00:00 2001 From: Auke Kok Date: Mon, 11 Jan 2016 21:53:38 -0800 Subject: [PATCH] Basic stone walls, using NDT_CONNECTED. These basic connected wall nodes automatically connect to neigboring stone blocks, other wall blocks and anything that's "cracky". The do not connect to wood (fences will do that). The walls are generated using a new walls.register() API. Documentation on the API is included in game_api.txt. This change requires minetest/minetest#3503. Walls are added for all cobble stone materials. They generally look best and are the natural use cases for these materials. --- game_api.txt | 11 ++++++++ mods/walls/depends.txt | 1 + mods/walls/init.lua | 61 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 73 insertions(+) create mode 100644 mods/walls/depends.txt create mode 100644 mods/walls/init.lua diff --git a/game_api.txt b/game_api.txt index 6944d580..a32f8d5c 100644 --- a/game_api.txt +++ b/game_api.txt @@ -139,6 +139,17 @@ Allows creation of new fences with "fencelike" drawtype. groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2}, sounds = default.node_sound_wood_defaults(), +#Walls API +--------- +The walls API allows easy addition of stone auto-connecting wall nodes. + +walls.register(name, desc, texture, mat, sounds) +^ name = "walls:stone_wall". Node name. +^ desc = "A Stone wall" +^ texture = "default_stone.png" +^ mat = "default:stone". Used to auto-generate crafting recipe. +^ sounds = sounds: see [#Default sounds] + Farming API ----------- diff --git a/mods/walls/depends.txt b/mods/walls/depends.txt new file mode 100644 index 00000000..4ad96d51 --- /dev/null +++ b/mods/walls/depends.txt @@ -0,0 +1 @@ +default diff --git a/mods/walls/init.lua b/mods/walls/init.lua new file mode 100644 index 00000000..e3c1d68f --- /dev/null +++ b/mods/walls/init.lua @@ -0,0 +1,61 @@ + +--[[ + +Walls mod for Minetest + +Copyright (C) 2015 Auke Kok + +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. + +--]] + +walls = {} + +walls.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_bottom = + connect_front = {{-3/16, -1/2, -1/2, 3/16, 3/8, -1/4}}, + connect_left = {{-1/2, -1/2, -3/16, -1/4, 3/8, 3/16}}, + connect_back = {{-3/16, -1/2, 1/4, 3/16, 3/8, 1/2}}, + connect_right = {{ 1/4, -1/2, -3/16, 1/2, 3/8, 3/16}}, + }, + connects_to = { "group:cracky", "group:wall", "group:stone" }, + 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 .. " 6", + recipe = { + { '', '', '' }, + { wall_mat, wall_mat, wall_mat}, + { wall_mat, wall_mat, wall_mat}, + } + }) + +end + +walls.register("walls:cobble", "Cobblestone Wall", "default_cobble.png", + "default:cobble", default.node_sound_stone_defaults()) + +walls.register("walls:mossycobble", "Mossy Cobblestone Wall", "default_mossycobble.png", + "default:mossycobble", default.node_sound_stone_defaults()) + +walls.register("walls:desertcobble", "Desert Cobblestone Wall", "default_desert_cobble.png", + "default:desert_cobble", default.node_sound_stone_defaults()) +