[1.11.3] Walls: some fixes

This commit is contained in:
MoNTE48 2020-09-17 10:44:44 +02:00
parent 054f8008b1
commit e2de86c500
2 changed files with 26 additions and 23 deletions

View File

@ -13,7 +13,6 @@ 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 = walls.S(wall_desc),
drawtype = "nodebox",
node_box = {
type = "connected",
@ -39,20 +38,6 @@ walls.register = function(wall_name, wall_desc, wall_texture_table, wall_mat, wa
groups = {cracky = 3, wall = 1, stone = 2, not_in_creative_inventory = 1},
sounds = wall_sounds,
drop = wall_name .. "_inv",
after_place_node = function(pos)
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, _, _, 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$", "")
@ -107,6 +92,22 @@ walls.register = function(wall_name, wall_desc, wall_texture_table, wall_mat, wa
on_construct = function(pos)
minetest.set_node(pos, {name = wall_name})
end,
after_place_node = function(pos)
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
local node_above = minetest.get_node(pos_above).name
if minetest.get_item_group(node_under, "wall") == 1 and
minetest.get_item_group(node_above, "wall_not_full") ~= 1 then
local node_under_can = node_under:gsub("_full$", "")
minetest.set_node(pos_under, {name = node_under_can .. "_full"})
end
if minetest.get_item_group(node_above, "wall") == 1 and
minetest.get_item_group(node_above, "wall_not_full") ~= 1 then
minetest.set_node(pos, {name = wall_name .. "_full"})
end
end
})

View File

@ -68,6 +68,8 @@ local collision = {
{-1/4, -0.5, -1/4, 1/4, 1, 1/4}
}
local groups = {cracky = 3, wall = 1, stone = 2, wall_not_full = 1}
local floor = math.floor
for i = 1, 15 do
local need = {}
@ -109,7 +111,7 @@ for i = 1, 15 do
tiles = {"default_cobble.png"},
paramtype = "light",
sunlight_propagates = true,
groups = {cracky = 3, wall = 1, stone = 2},
groups = groups,
drop = "wallet:wall",
node_box = {
type = "fixed",
@ -128,7 +130,7 @@ for i = 1, 15 do
paramtype = "light",
sunlight_propagates = true,
is_ground_content = false,
groups = {cracky = 3, wall = 1, stone = 2},
groups = groups,
drop = "wallet:wallmossy",
node_box = {
type = "fixed",
@ -151,7 +153,7 @@ minetest.register_node(":wallet:wall_16", {
paramtype = "light",
sunlight_propagates = true,
is_ground_content = false,
groups = {cracky = 3, wall = 1, stone = 2},
groups = groups,
drop = "wallet:wall",
node_box = {
type = "fixed",
@ -169,7 +171,7 @@ minetest.register_node(":wallet:wall_21", {
paramtype = "light",
sunlight_propagates = true,
is_ground_content = false,
groups = {cracky = 3, wall = 1, stone = 2},
groups = groups,
drop = "wallet:wall",
node_box = {
type = "fixed",
@ -181,7 +183,7 @@ minetest.register_node(":wallet:wall", {
description = walls.S"Cobblestone Wall",
paramtype = "light",
tiles = {"default_cobble.png"},
groups = {cracky = 3, wall = 1, stone = 2},
groups = groups,
drawtype = "nodebox",
node_box = {
type = "fixed",
@ -213,7 +215,7 @@ minetest.register_node(":wallet:wallmossy_16", {
paramtype = "light",
sunlight_propagates = true,
is_ground_content = false,
groups = {cracky = 3, wall = 1, stone = 2},
groups = groups,
drop = "wallet:wallmossy",
node_box = {
type = "fixed",
@ -231,7 +233,7 @@ minetest.register_node(":wallet:wallmossy_21", {
paramtype = "light",
sunlight_propagates = true,
is_ground_content = false,
groups = {cracky = 3, wall = 1, stone = 2},
groups = groups,
drop = "wallet:wallmossy",
node_box = {
type = "fixed",
@ -249,7 +251,7 @@ minetest.register_node(":wallet:wallmossy", {
tiles = {"default_mossycobble.png"},
sunlight_propagates = true,
is_ground_content = false,
groups = {cracky = 3, wall = 1, stone = 2},
groups = groups,
drawtype = "nodebox",
node_box = {
type = "fixed",