Walls: add full wall, add sandstone walls, improve inventory image

This commit is contained in:
MoNTE48 2020-03-07 17:08:21 +01:00
parent 69ca984283
commit 176e26b01d
7 changed files with 104 additions and 26 deletions

View File

@ -163,8 +163,7 @@ Mossy Stone Brick = Мшистый Каменный Кирпич
Sandstone = Песчаник
Smooth Sandstone = Гладкий Песчаник
Red Sandstone = Красный Песчаник
Red Sandstone Smooth = Красный Гладкий Песчаник
Red Sandstone Carved = Красный Нарезной Песчаник
Red Sandstone Smooth = Гладкий Красный Песчаник
Obsidian = Обсидиан
Bedrock = Коренная Порода
Dirt = Земля
@ -480,7 +479,6 @@ Black Mode = Чёрный Режим
Light Mode = Светлый Режим
#throwing
Bow = Лук
Bow with arrow = Лук со Стрелой
@ -490,6 +488,8 @@ Arrow = Стрела
#walls
Cobblestone Wall = Стена из Булыжника
Mossy Cobblestone Wall = Стена из Мшистого Булыжника
Sandstone Wall = Стена из Песчаника
Red Sandstone Wall = Стена из Красного Песчаника
#watch

View File

@ -33,7 +33,7 @@ function update_wall(pos)
local node = minetest.get_node({x = pos.x, y = pos.y+1, z = pos.z})
if sum == 5 or sum == 10 then
if minetest.registered_nodes[node.name].walkable or node.name == "torches:floor" then
if minetest.registered_nodes[node.name].walkable then
sum = sum + 11
end
end
@ -169,16 +169,15 @@ minetest.register_node("wallet:wall", {
description = "Cobblestone Wall",
paramtype = "light",
tiles = {"default_cobble.png"},
inventory_image = "cobblestone_wallet.png",
groups = {cracky = 3, wall = 1, stone = 2},
drawtype = "nodebox",
node_box = {
type = "fixed",
fixed = pillar
},
collision_box = {
type = "fixed",
fixed = collision
fixed = {
pillar,
half_blocks[1],
half_blocks[3],
}
},
on_construct = update_wall
})
@ -294,12 +293,15 @@ minetest.register_node("wallet:wallmossy", {
fixed = collision
},
tiles = {"default_mossycobble.png"},
inventory_image = "cobblestonemossy_wallet.png",
groups = {cracky = 3, wall = 1, stone = 2},
drawtype = "nodebox",
node_box = {
type = "fixed",
fixed = pillar
fixed = {
pillar,
half_blocks[1],
half_blocks[3],
}
},
on_construct = update_wall
})

Binary file not shown.

Before

Width:  |  Height:  |  Size: 494 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 928 B

View File

@ -5,3 +5,5 @@ See license.txt for license information.
Authors of source code
----------------------
Auke Kok <sofar@foo-projects.org> (LGPLv3.0+)
Shara RedCat (LGPLv3.0+)
MultiCraft Development Team (LGPLv3.0+)

View File

@ -1,21 +1,17 @@
walls = {}
walls.register = function(wall_name, wall_desc, wall_texture_table, wall_mat, wall_sounds)
--make wall_texture_table paramenter backwards compatible for mods passing single texture
if type(wall_texture_table) ~= "table" then
wall_texture_table = { wall_texture_table }
end
walls.register = function(wall_name, wall_desc, wall_texture_table, wall_mat, wall_sounds, not_in_cinv)
-- 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_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}}
fixed = {-1/4, -1/2, -1/4, 1/4, 1/2, 1/4},
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}
},
collision_box = {
type = "connected",
@ -31,12 +27,82 @@ walls.register = function(wall_name, wall_desc, wall_texture_table, wall_mat, wa
tiles = wall_texture_table,
walkable = true,
groups = {cracky = 3, wall = 1, stone = 2, not_in_creative_inventory = 1},
sounds = wall_sounds
sounds = wall_sounds,
drop = wall_name .. "_inv",
after_place_node = function(pos, placer, itemstack, pointed_thing)
local pos_under = {x = pos.x, y = pos.y - 1, z = pos.z}
local pos_above = {x = pos.x, y = pos.y + 1, z = pos.z}
local node_under = minetest.get_node(pos_under).name
if minetest.get_item_group(node_under, "wall") == 1 then
local node_under_can = node_under:gsub("_full$", "")
minetest.set_node(pos_under, {name = node_under_can .. "_full"})
end
local node_above = minetest.get_node(pos_above).name
if minetest.get_item_group(node_above, "wall") == 1 then
minetest.set_node(pos, {name = wall_name .. "_full"})
end
end,
after_dig_node = function(pos, oldnode, oldmetadata, digger)
local pos_under = {x = pos.x, y = pos.y - 1, z = pos.z}
local node_under = string.gsub(minetest.get_node(pos_under).name, "_full$", "")
if minetest.get_item_group(node_under, "wall") == 1 and
digger and digger:is_player() then
minetest.set_node(pos_under, {name = node_under})
end
end
})
minetest.register_node(wall_name .. "_full", {
drawtype = "nodebox",
node_box = {
type = "connected",
fixed = {-1/4, -1/2, -1/4, 1/4, 1/2, 1/4},
connect_front = {-3/16, -1/2, -1/2, 3/16, 1/2, -1/4},
connect_left = {-1/2, -1/2, -3/16, -1/4, 1/2, 3/16},
connect_back = {-3/16, -1/2, 1/4, 3/16, 1/2, 1/2},
connect_right = { 1/4, -1/2, -3/16, 1/2, 1/2, 3/16},
},
connects_to = {"group:wall", "group:stone", "group:fence"},
paramtype = "light",
is_ground_content = false,
tiles = wall_texture_table,
groups = {cracky = 3, wall = 1, stone = 2, not_in_creative_inventory = 1},
sounds = wall_sounds,
drop = wall_name .. "_inv",
after_dig_node = function(pos, oldnode, oldmetadata, digger)
local pos_under = {x = pos.x, y = pos.y - 1, z = pos.z}
local node_under = (minetest.get_node(pos_under).name):gsub("_full$", "")
if minetest.get_item_group(node_under, "wall") == 1 and
digger and digger:is_player() then
minetest.set_node(pos_under, {name = node_under})
end
end
})
minetest.register_node(wall_name .. "_inv", {
description = wall_desc,
drawtype = "nodebox",
node_box = {
type = "fixed",
fixed = {
{-1/4, -1/2, -1/4, 1/4, 1/2, 1/4},
{-1/2, -1/2, -3/16, -1/4, 3/8, 3/16},
{ 1/4, -1/2, -3/16, 1/2, 3/8, 3/16}
}
},
paramtype = "light",
tiles = wall_texture_table,
groups = {cracky = 3, wall = 1, stone = 2, not_in_creative_inventory = not_in_cinv and 1 or 0},
on_construct = function(pos)
minetest.set_node(pos, {name = wall_name})
end
})
-- crafting recipe
minetest.register_craft({
output = wall_name .. " 6",
output = wall_name .. "_inv 6",
recipe = {
{"", "", ""},
{wall_mat, wall_mat, wall_mat},
@ -47,7 +113,13 @@ walls.register = function(wall_name, wall_desc, wall_texture_table, wall_mat, wa
end
walls.register("walls:cobble", "Cobblestone Wall", {"default_cobble.png"},
"default:cobble", default.node_sound_stone_defaults())
"default:cobble", default.node_sound_stone_defaults(), true)
walls.register("walls:mossycobble", "Mossy Cobblestone Wall", {"default_mossycobble.png"},
"default:mossycobble", default.node_sound_stone_defaults())
"default:mossycobble", default.node_sound_stone_defaults(), true)
walls.register("walls:sandstone", "Sandstone Wall", {"default_sandstone_normal.png"},
"default:sandstone", default.node_sound_stone_defaults())
walls.register("walls:redsandstone", "Red Sandstone Wall", {"default_redsandstone_normal.png"},
"default:redsandstone", default.node_sound_stone_defaults())

View File

@ -3,6 +3,8 @@ License of source code
GNU Lesser General Public License, version 3.0
Copyright (C) 2015 Auke Kok <sofar@foo-projects.org>
Copyright (C) 2018 Shara RedCat
Copyright (C) 2019-2020 MultiCraft Development Team
This program is free software; you can redistribute it and/or modify it under the terms
of the GNU Lesser General Public License as published by the Free Software Foundation;