Improve doorcontroller2 to be able to exchange nodes

This commit is contained in:
Joachim Stolberg 2021-02-23 21:48:45 +01:00
parent fdfc8a2d96
commit 434ae78be3
3 changed files with 6 additions and 3 deletions

View File

@ -90,7 +90,8 @@ for idx,pgn in ipairs(tPgns) do
use_texture_alpha = true,
sunlight_propagates = true,
sounds = default.node_sound_stone_defaults(),
groups = {cracky=2, choppy=2, crumbly=2, not_in_creative_inventory = idx==NUM_TEXTURES and 0 or 1},
groups = {cracky=2, choppy=2, crumbly=2, techage_door = 1,
not_in_creative_inventory = idx==NUM_TEXTURES and 0 or 1},
is_ground_content = false,
drop = "techage:doorblock"..NUM_TEXTURES,
},

View File

@ -129,7 +129,8 @@ end
local function exchange_node(pos, item, param2)
local node = minetest.get_node_or_nil(pos)
local meta = minetest.get_meta(pos)
if node and (not meta or not next((meta:to_table()).fields)) then
if node and (not meta or not next((meta:to_table()).fields)) or
minetest.get_item_group(node.name, "techage_door") then
if item and item:get_name() ~= "" and param2 then
minetest.swap_node(pos, {name = item:get_name(), param2 = param2})
else

View File

@ -76,7 +76,8 @@ for idx,pgn in ipairs(tPgns) do
use_texture_alpha = true,
sunlight_propagates = true,
sounds = default.node_sound_stone_defaults(),
groups = {cracky=2, choppy=2, crumbly=2, not_in_creative_inventory = idx==NUM_TEXTURES and 0 or 1},
groups = {cracky=2, choppy=2, crumbly=2, techage_door = 1,
not_in_creative_inventory = idx==NUM_TEXTURES and 0 or 1},
is_ground_content = false,
drop = "techage:gateblock"..NUM_TEXTURES,
},