forked from VoxeLibre/VoxeLibre
Improve the code
This commit is contained in:
parent
70eb019a58
commit
9c208fb6b0
|
@ -54,19 +54,11 @@ function mcl_doors:register_door(name, def)
|
||||||
def.sound_close = "doors_door_close"
|
def.sound_close = "doors_door_close"
|
||||||
end
|
end
|
||||||
|
|
||||||
local box = {{-8/16, -8/16, -8/16, 8/16, 8/16, -5/16}}
|
if not def.node_box then
|
||||||
|
def.node_box = {{-8/16, -8/16, -8/16, 8/16, 8/16, -5/16}}
|
||||||
if not def.node_box_bottom then
|
|
||||||
def.node_box_bottom = box
|
|
||||||
end
|
end
|
||||||
if not def.node_box_top then
|
if not def.selection_box then
|
||||||
def.node_box_top = box
|
def.selection_box = {{-8/16, -8/16, -8/16, 8/16, 8/16, -5/16}}
|
||||||
end
|
|
||||||
if not def.selection_box_bottom then
|
|
||||||
def.selection_box_bottom= box
|
|
||||||
end
|
|
||||||
if not def.selection_box_top then
|
|
||||||
def.selection_box_top = box
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local longdesc, usagehelp, tt_help
|
local longdesc, usagehelp, tt_help
|
||||||
|
@ -202,22 +194,22 @@ function mcl_doors:register_door(name, def)
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
local doortextop = def.tiles_top:match("(.+)%..+$")
|
local top_door_texture = def.tiles_top:match("(.+)%..+$") -- This removes the filename extension from the images.
|
||||||
local doortexbottom = def.tiles_bottom:match("(.+)%..+$")
|
local bottom_door_texture = def.tiles_bottom:match("(.+)%..+$") -- This removes the filename extension from the images.
|
||||||
|
|
||||||
local tt = doortextop .. ".png"
|
local texture_top = top_door_texture .. ".png"
|
||||||
local tb = doortexbottom .. ".png"
|
local texture_bottom = bottom_door_texture .. ".png"
|
||||||
local ttt = doortextop .. "_toppart.png" -- Special texture to make the top of opened doors not look weird.
|
local texture_top_toppart = top_door_texture .. "_toppart.png" -- Special texture to make the top of opened doors not look weird.
|
||||||
local tbb = doortexbottom .. "_bottompart.png" -- Special texture to make the bottom of opened doors not look weird.
|
local texture_bottom_bottompart = bottom_door_texture .. "_bottompart.png" -- Special texture to make the bottom of opened doors not look weird.
|
||||||
local tts = doortextop .. "_side.png" -- Special texture to make the side of opened doors not look weird.
|
local texture_top_side = top_door_texture .. "_side.png" -- Special texture to make the side of opened doors not look weird.
|
||||||
local tbs = doortexbottom .. "_side.png" -- Special texture to make the side of opened doors not look weird.
|
local texture_bottom_side = bottom_door_texture .. "_side.png" -- Special texture to make the side of opened doors not look weird.
|
||||||
|
|
||||||
local ttm = tt .. "^[transformFX"
|
local texture_top_mirrored = texture_top .. "^[transformFX"
|
||||||
local tbm = tb .. "^[transformFX"
|
local texture_bottom_mirrored = texture_bottom .. "^[transformFX"
|
||||||
local tttm = ttt .. "^[transformFX"
|
local texture_top_toppart_mirrored = texture_top_toppart .. "^[transformFX"
|
||||||
local tbbm = tbb .. "^[transformFX"
|
local texture_bottom_bottompart_mirrored = texture_bottom_bottompart .. "^[transformFX"
|
||||||
local ttsm = tts .. "^[transformFX"
|
local texture_top_side_mirrored = texture_top_side .. "^[transformFX"
|
||||||
local tbsm = tbs .. "^[transformFX"
|
local texture_bottom_side_mirrored = texture_bottom_side .. "^[transformFX"
|
||||||
|
|
||||||
local function on_open_close(pos, dir, check_name, replace, replace_dir)
|
local function on_open_close(pos, dir, check_name, replace, replace_dir)
|
||||||
local meta1 = minetest_get_meta(pos)
|
local meta1 = minetest_get_meta(pos)
|
||||||
|
@ -304,8 +296,8 @@ function mcl_doors:register_door(name, def)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_node(name.."_b_1", {
|
local template_def = {
|
||||||
tiles = {"blank.png", tbb .. "^[transformFY", tbs, tbsm, tbm, tb},
|
tiles = nil,
|
||||||
use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "clip" or true,
|
use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "clip" or true,
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
|
@ -315,18 +307,31 @@ function mcl_doors:register_door(name, def)
|
||||||
drawtype = "nodebox",
|
drawtype = "nodebox",
|
||||||
node_box = {
|
node_box = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
fixed = def.node_box_bottom
|
fixed = def.node_box
|
||||||
},
|
},
|
||||||
selection_box = {
|
selection_box = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
fixed = def.selection_box_bottom
|
fixed = def.selection_box
|
||||||
},
|
},
|
||||||
groups = def.groups,
|
groups = def.groups,
|
||||||
_mcl_hardness = def._mcl_hardness,
|
_mcl_hardness = def._mcl_hardness,
|
||||||
_mcl_blast_resistance = def._mcl_blast_resistance,
|
_mcl_blast_resistance = def._mcl_blast_resistance,
|
||||||
sounds = def.sounds,
|
sounds = def.sounds,
|
||||||
|
|
||||||
after_destruct = function(bottom, oldnode)
|
after_destruct = nil,
|
||||||
|
|
||||||
|
on_rightclick = nil,
|
||||||
|
|
||||||
|
mesecons = nil,
|
||||||
|
|
||||||
|
on_rotate = nil,
|
||||||
|
|
||||||
|
can_dig = check_player_priv,
|
||||||
|
}
|
||||||
|
|
||||||
|
local _b_1_def = table.copy(template_def)
|
||||||
|
_b_1_def.tiles = {"blank.png", texture_bottom_bottompart .. "^[transformFY", texture_bottom_side, texture_bottom_side_mirrored, texture_bottom_mirrored, texture_bottom}
|
||||||
|
_b_1_def.after_destruct = function(bottom, oldnode)
|
||||||
local meta_bottom = minetest_get_meta(bottom)
|
local meta_bottom = minetest_get_meta(bottom)
|
||||||
if meta_bottom:get_int("rotation") == 1 then
|
if meta_bottom:get_int("rotation") == 1 then
|
||||||
meta_bottom:set_int("rotation", 0)
|
meta_bottom:set_int("rotation", 0)
|
||||||
|
@ -337,15 +342,12 @@ function mcl_doors:register_door(name, def)
|
||||||
minetest.remove_node(top)
|
minetest.remove_node(top)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end,
|
end
|
||||||
|
_b_1_def.on_rightclick = on_rightclick
|
||||||
on_rightclick = on_rightclick,
|
_b_1_def.mesecons = { effector = {
|
||||||
|
|
||||||
mesecons = { effector = {
|
|
||||||
action_on = on_mesecons_signal_open,
|
action_on = on_mesecons_signal_open,
|
||||||
}},
|
}}
|
||||||
|
_b_1_def.on_rotate = function(bottom, node, user, mode, param2)
|
||||||
on_rotate = function(bottom, node, user, mode, param2)
|
|
||||||
if mode == screwdriver.ROTATE_FACE then
|
if mode == screwdriver.ROTATE_FACE then
|
||||||
local meta_bottom = minetest_get_meta(bottom)
|
local meta_bottom = minetest_get_meta(bottom)
|
||||||
meta_bottom:set_int("rotation", 1)
|
meta_bottom:set_int("rotation", 1)
|
||||||
|
@ -361,10 +363,9 @@ function mcl_doors:register_door(name, def)
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
return false
|
return false
|
||||||
end,
|
end
|
||||||
|
|
||||||
can_dig = check_player_priv,
|
minetest.register_node(name.."_b_1", _b_1_def)
|
||||||
})
|
|
||||||
|
|
||||||
if def.only_redstone_can_open then
|
if def.only_redstone_can_open then
|
||||||
on_rightclick = nil
|
on_rightclick = nil
|
||||||
|
@ -376,29 +377,9 @@ function mcl_doors:register_door(name, def)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_node(name.."_t_1", {
|
local _t_1_def = table.copy(template_def)
|
||||||
tiles = {ttt .. "^[transformFY", "blank.png", tts, ttsm, ttm, tt},
|
_t_1_def.tiles = {texture_top_toppart .. "^[transformFY", "blank.png", texture_top_side, texture_top_side_mirrored, texture_top_mirrored, texture_top}
|
||||||
use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "clip" or true,
|
_t_1_def.after_destruct = function(top, oldnode)
|
||||||
paramtype = "light",
|
|
||||||
paramtype2 = "facedir",
|
|
||||||
sunlight_propagates = true,
|
|
||||||
is_ground_content = false,
|
|
||||||
drop = "",
|
|
||||||
drawtype = "nodebox",
|
|
||||||
node_box = {
|
|
||||||
type = "fixed",
|
|
||||||
fixed = def.node_box_top
|
|
||||||
},
|
|
||||||
selection_box = {
|
|
||||||
type = "fixed",
|
|
||||||
fixed = def.selection_box_top
|
|
||||||
},
|
|
||||||
groups = def.groups,
|
|
||||||
_mcl_hardness = def._mcl_hardness,
|
|
||||||
_mcl_blast_resistance = def._mcl_blast_resistance,
|
|
||||||
sounds = def.sounds,
|
|
||||||
|
|
||||||
after_destruct = function(top, oldnode)
|
|
||||||
local meta_top = minetest_get_meta(top)
|
local meta_top = minetest_get_meta(top)
|
||||||
if meta_top:get_int("rotation") == 1 then
|
if meta_top:get_int("rotation") == 1 then
|
||||||
meta_top:set_int("rotation", 0)
|
meta_top:set_int("rotation", 0)
|
||||||
|
@ -408,16 +389,13 @@ function mcl_doors:register_door(name, def)
|
||||||
minetest.dig_node(bottom)
|
minetest.dig_node(bottom)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end,
|
end
|
||||||
|
_t_1_def.on_rightclick = on_rightclick
|
||||||
on_rightclick = on_rightclick,
|
_t_1_def.mesecons = { effector = {
|
||||||
|
|
||||||
mesecons = { effector = {
|
|
||||||
action_on = on_mesecons_signal_open_top,
|
action_on = on_mesecons_signal_open_top,
|
||||||
rules = mesecon.rules.flat,
|
rules = mesecon.rules.flat,
|
||||||
}},
|
}}
|
||||||
|
_t_1_def.on_rotate = function(top, node, user, mode, param2)
|
||||||
on_rotate = function(top, node, user, mode, param2)
|
|
||||||
if mode == screwdriver.ROTATE_FACE then
|
if mode == screwdriver.ROTATE_FACE then
|
||||||
local meta_top = minetest_get_meta(top)
|
local meta_top = minetest_get_meta(top)
|
||||||
meta_top:set_int("rotation", 1)
|
meta_top:set_int("rotation", 1)
|
||||||
|
@ -433,10 +411,9 @@ function mcl_doors:register_door(name, def)
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
return false
|
return false
|
||||||
end,
|
end
|
||||||
|
|
||||||
can_dig = check_player_priv,
|
minetest.register_node(name.."_t_1", _t_1_def)
|
||||||
})
|
|
||||||
|
|
||||||
if def.only_redstone_can_open then
|
if def.only_redstone_can_open then
|
||||||
on_rightclick = nil
|
on_rightclick = nil
|
||||||
|
@ -448,28 +425,9 @@ function mcl_doors:register_door(name, def)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_node(name.."_b_2", {
|
local _b_2_def = table.copy(template_def)
|
||||||
tiles = {"blank.png", tbbm, tbs, tbs, tb, tbm},
|
_b_2_def.tiles = {"blank.png", texture_bottom_bottompart_mirrored, texture_bottom_side, texture_bottom_side, texture_bottom, texture_bottom_mirrored}
|
||||||
use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "clip" or true,
|
_b_2_def.after_destruct = function(bottom, oldnode)
|
||||||
paramtype = "light",
|
|
||||||
paramtype2 = "facedir",
|
|
||||||
sunlight_propagates = true,
|
|
||||||
is_ground_content = false,
|
|
||||||
drop = "",
|
|
||||||
drawtype = "nodebox",
|
|
||||||
groups = def.groups,
|
|
||||||
_mcl_hardness = def._mcl_hardness,
|
|
||||||
_mcl_blast_resistance = def._mcl_blast_resistance,
|
|
||||||
sounds = def.sounds,
|
|
||||||
node_box = {
|
|
||||||
type = "fixed",
|
|
||||||
fixed = def.node_box_bottom
|
|
||||||
},
|
|
||||||
selection_box = {
|
|
||||||
type = "fixed",
|
|
||||||
fixed = def.selection_box_bottom
|
|
||||||
},
|
|
||||||
after_destruct = function(bottom, oldnode)
|
|
||||||
local meta_bottom = minetest_get_meta(bottom)
|
local meta_bottom = minetest_get_meta(bottom)
|
||||||
if meta_bottom:get_int("rotation") == 1 then
|
if meta_bottom:get_int("rotation") == 1 then
|
||||||
meta_bottom:set_int("rotation", 0)
|
meta_bottom:set_int("rotation", 0)
|
||||||
|
@ -480,15 +438,12 @@ function mcl_doors:register_door(name, def)
|
||||||
minetest.remove_node(top)
|
minetest.remove_node(top)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end,
|
end
|
||||||
|
_b_2_def.on_rightclick = on_rightclick
|
||||||
on_rightclick = on_rightclick,
|
_b_2_def.mesecons = { effector = {
|
||||||
|
|
||||||
mesecons = { effector = {
|
|
||||||
action_off = on_mesecons_signal_close,
|
action_off = on_mesecons_signal_close,
|
||||||
}},
|
}}
|
||||||
|
_b_2_def.on_rotate = function(bottom, node, user, mode, param2)
|
||||||
on_rotate = function(bottom, node, user, mode, param2)
|
|
||||||
if mode == screwdriver.ROTATE_FACE then
|
if mode == screwdriver.ROTATE_FACE then
|
||||||
local meta_bottom = minetest_get_meta(bottom)
|
local meta_bottom = minetest_get_meta(bottom)
|
||||||
meta_bottom:set_int("rotation", 1)
|
meta_bottom:set_int("rotation", 1)
|
||||||
|
@ -504,10 +459,9 @@ function mcl_doors:register_door(name, def)
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
return false
|
return false
|
||||||
end,
|
end
|
||||||
|
|
||||||
can_dig = check_player_priv,
|
minetest.register_node(name.."_b_2", _b_2_def)
|
||||||
})
|
|
||||||
|
|
||||||
if def.only_redstone_can_open then
|
if def.only_redstone_can_open then
|
||||||
on_rightclick = nil
|
on_rightclick = nil
|
||||||
|
@ -519,28 +473,9 @@ function mcl_doors:register_door(name, def)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_node(name.."_t_2", {
|
local _t_2_def = table.copy(template_def)
|
||||||
tiles = {tttm, "blank.png", tts, tts, tt, ttm},
|
_t_2_def.tiles = {texture_top_toppart_mirrored, "blank.png", texture_top_side, texture_top_side, texture_top, texture_top_mirrored}
|
||||||
use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "clip" or true,
|
_t_2_def.after_destruct = function(top, oldnode)
|
||||||
paramtype = "light",
|
|
||||||
paramtype2 = "facedir",
|
|
||||||
sunlight_propagates = true,
|
|
||||||
is_ground_content = false,
|
|
||||||
drop = "",
|
|
||||||
drawtype = "nodebox",
|
|
||||||
groups = def.groups,
|
|
||||||
_mcl_hardness = def._mcl_hardness,
|
|
||||||
_mcl_blast_resistance = def._mcl_blast_resistance,
|
|
||||||
sounds = def.sounds,
|
|
||||||
node_box = {
|
|
||||||
type = "fixed",
|
|
||||||
fixed = def.node_box_top
|
|
||||||
},
|
|
||||||
selection_box = {
|
|
||||||
type = "fixed",
|
|
||||||
fixed = def.selection_box_top
|
|
||||||
},
|
|
||||||
after_destruct = function(top, oldnode)
|
|
||||||
local meta_top = minetest_get_meta(top)
|
local meta_top = minetest_get_meta(top)
|
||||||
if meta_top:get_int("rotation") == 1 then
|
if meta_top:get_int("rotation") == 1 then
|
||||||
meta_top:set_int("rotation", 0)
|
meta_top:set_int("rotation", 0)
|
||||||
|
@ -550,16 +485,13 @@ function mcl_doors:register_door(name, def)
|
||||||
minetest.dig_node(bottom)
|
minetest.dig_node(bottom)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end,
|
end
|
||||||
|
_t_2_def.on_rightclick = on_rightclick
|
||||||
on_rightclick = on_rightclick,
|
_t_2_def.mesecons = { effector = {
|
||||||
|
|
||||||
mesecons = { effector = {
|
|
||||||
action_off = on_mesecons_signal_close_top,
|
action_off = on_mesecons_signal_close_top,
|
||||||
rules = mesecon.rules.flat,
|
rules = mesecon.rules.flat,
|
||||||
}},
|
}}
|
||||||
|
_t_2_def.on_rotate = function(top, node, user, mode, param2)
|
||||||
on_rotate = function(top, node, user, mode, param2)
|
|
||||||
if mode == screwdriver.ROTATE_FACE then
|
if mode == screwdriver.ROTATE_FACE then
|
||||||
local meta_top = minetest_get_meta(top)
|
local meta_top = minetest_get_meta(top)
|
||||||
meta_top:set_int("rotation", 1)
|
meta_top:set_int("rotation", 1)
|
||||||
|
@ -575,10 +507,9 @@ function mcl_doors:register_door(name, def)
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
return false
|
return false
|
||||||
end,
|
end
|
||||||
|
|
||||||
can_dig = check_player_priv,
|
minetest.register_node(name.."_t_2", _t_2_def)
|
||||||
})
|
|
||||||
|
|
||||||
if not def.only_redstone_can_open then
|
if not def.only_redstone_can_open then
|
||||||
on_rightclick = function(pos, node, clicker)
|
on_rightclick = function(pos, node, clicker)
|
||||||
|
@ -588,29 +519,9 @@ function mcl_doors:register_door(name, def)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_node(name.."_b_3", {
|
local _b_3_def = table.copy(template_def)
|
||||||
tiles = {"blank.png", tbm .. "^[transformFY", tbs, tbsm, tb, tbm},
|
_b_3_def.tiles = {"blank.png", texture_bottom_mirrored .. "^[transformFY", texture_bottom_side, texture_bottom_side_mirrored, texture_bottom, texture_bottom_mirrored}
|
||||||
use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "clip" or true,
|
_b_3_def.after_destruct = function(bottom, oldnode)
|
||||||
paramtype = "light",
|
|
||||||
paramtype2 = "facedir",
|
|
||||||
sunlight_propagates = true,
|
|
||||||
is_ground_content = false,
|
|
||||||
drop = "",
|
|
||||||
drawtype = "nodebox",
|
|
||||||
node_box = {
|
|
||||||
type = "fixed",
|
|
||||||
fixed = def.node_box_bottom
|
|
||||||
},
|
|
||||||
selection_box = {
|
|
||||||
type = "fixed",
|
|
||||||
fixed = def.selection_box_bottom
|
|
||||||
},
|
|
||||||
groups = def.groups,
|
|
||||||
_mcl_hardness = def._mcl_hardness,
|
|
||||||
_mcl_blast_resistance = def._mcl_blast_resistance,
|
|
||||||
sounds = def.sounds,
|
|
||||||
|
|
||||||
after_destruct = function(bottom, oldnode)
|
|
||||||
local meta_bottom = minetest_get_meta(bottom)
|
local meta_bottom = minetest_get_meta(bottom)
|
||||||
if meta_bottom:get_int("rotation") == 1 then
|
if meta_bottom:get_int("rotation") == 1 then
|
||||||
meta_bottom:set_int("rotation", 0)
|
meta_bottom:set_int("rotation", 0)
|
||||||
|
@ -621,15 +532,12 @@ function mcl_doors:register_door(name, def)
|
||||||
minetest.remove_node(top)
|
minetest.remove_node(top)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end,
|
end
|
||||||
|
_b_3_def.on_rightclick = on_rightclick
|
||||||
on_rightclick = on_rightclick,
|
_b_3_def.mesecons = { effector = {
|
||||||
|
|
||||||
mesecons = { effector = {
|
|
||||||
action_on = on_mesecons_signal_open,
|
action_on = on_mesecons_signal_open,
|
||||||
}},
|
}}
|
||||||
|
_b_3_def.on_rotate = function(bottom, node, user, mode, param2)
|
||||||
on_rotate = function(bottom, node, user, mode, param2)
|
|
||||||
if mode == screwdriver.ROTATE_FACE then
|
if mode == screwdriver.ROTATE_FACE then
|
||||||
local meta_bottom = minetest_get_meta(bottom)
|
local meta_bottom = minetest_get_meta(bottom)
|
||||||
meta_bottom:set_int("rotation", 1)
|
meta_bottom:set_int("rotation", 1)
|
||||||
|
@ -645,10 +553,9 @@ function mcl_doors:register_door(name, def)
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
return false
|
return false
|
||||||
end,
|
end
|
||||||
|
|
||||||
can_dig = check_player_priv,
|
minetest.register_node(name.."_b_3", _b_3_def)
|
||||||
})
|
|
||||||
|
|
||||||
if def.only_redstone_can_open then
|
if def.only_redstone_can_open then
|
||||||
on_rightclick = nil
|
on_rightclick = nil
|
||||||
|
@ -660,29 +567,9 @@ function mcl_doors:register_door(name, def)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_node(name.."_t_3", {
|
local _t_3_def = table.copy(template_def)
|
||||||
tiles = {ttm .. "^[transformFY", "blank.png", tts, ttsm, tt, ttm},
|
_t_3_def.tiles = {texture_top_mirrored .. "^[transformFY", "blank.png", texture_top_side, texture_top_side_mirrored, texture_top, texture_top_mirrored}
|
||||||
use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "clip" or true,
|
_t_3_def.after_destruct = function(top, oldnode)
|
||||||
paramtype = "light",
|
|
||||||
paramtype2 = "facedir",
|
|
||||||
sunlight_propagates = true,
|
|
||||||
is_ground_content = false,
|
|
||||||
drop = "",
|
|
||||||
drawtype = "nodebox",
|
|
||||||
node_box = {
|
|
||||||
type = "fixed",
|
|
||||||
fixed = def.node_box_top
|
|
||||||
},
|
|
||||||
selection_box = {
|
|
||||||
type = "fixed",
|
|
||||||
fixed = def.selection_box_top
|
|
||||||
},
|
|
||||||
groups = def.groups,
|
|
||||||
_mcl_hardness = def._mcl_hardness,
|
|
||||||
_mcl_blast_resistance = def._mcl_blast_resistance,
|
|
||||||
sounds = def.sounds,
|
|
||||||
|
|
||||||
after_destruct = function(top, oldnode)
|
|
||||||
local meta_top = minetest_get_meta(top)
|
local meta_top = minetest_get_meta(top)
|
||||||
if meta_top:get_int("rotation") == 1 then
|
if meta_top:get_int("rotation") == 1 then
|
||||||
meta_top:set_int("rotation", 0)
|
meta_top:set_int("rotation", 0)
|
||||||
|
@ -692,16 +579,13 @@ function mcl_doors:register_door(name, def)
|
||||||
minetest.dig_node(bottom)
|
minetest.dig_node(bottom)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end,
|
end
|
||||||
|
_t_3_def.on_rightclick = on_rightclick
|
||||||
on_rightclick = on_rightclick,
|
_t_3_def.mesecons = { effector = {
|
||||||
|
|
||||||
mesecons = { effector = {
|
|
||||||
action_on = on_mesecons_signal_open_top,
|
action_on = on_mesecons_signal_open_top,
|
||||||
rules = mesecon.rules.flat,
|
rules = mesecon.rules.flat,
|
||||||
}},
|
}}
|
||||||
|
_t_3_def.on_rotate = function(top, node, user, mode, param2)
|
||||||
on_rotate = function(top, node, user, mode, param2)
|
|
||||||
if mode == screwdriver.ROTATE_FACE then
|
if mode == screwdriver.ROTATE_FACE then
|
||||||
local meta_top = minetest_get_meta(top)
|
local meta_top = minetest_get_meta(top)
|
||||||
meta_top:set_int("rotation", 1)
|
meta_top:set_int("rotation", 1)
|
||||||
|
@ -717,10 +601,9 @@ function mcl_doors:register_door(name, def)
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
return false
|
return false
|
||||||
end,
|
end
|
||||||
|
|
||||||
can_dig = check_player_priv,
|
minetest.register_node(name.."_t_3", _t_3_def)
|
||||||
})
|
|
||||||
|
|
||||||
if def.only_redstone_can_open then
|
if def.only_redstone_can_open then
|
||||||
on_rightclick = nil
|
on_rightclick = nil
|
||||||
|
@ -732,28 +615,9 @@ function mcl_doors:register_door(name, def)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_node(name.."_b_4", {
|
local _b_4_def = table.copy(template_def)
|
||||||
tiles = {"blank.png", tbb, tbsm, tbsm, tbm, tb},
|
_b_4_def.tiles = {"blank.png", texture_bottom_bottompart, texture_bottom_side_mirrored, texture_bottom_side_mirrored, texture_bottom_mirrored, texture_bottom}
|
||||||
use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "clip" or true,
|
_b_4_def.after_destruct = function(bottom, oldnode)
|
||||||
paramtype = "light",
|
|
||||||
paramtype2 = "facedir",
|
|
||||||
sunlight_propagates = true,
|
|
||||||
is_ground_content = false,
|
|
||||||
drop = "",
|
|
||||||
drawtype = "nodebox",
|
|
||||||
groups = def.groups,
|
|
||||||
_mcl_hardness = def._mcl_hardness,
|
|
||||||
_mcl_blast_resistance = def._mcl_blast_resistance,
|
|
||||||
sounds = def.sounds,
|
|
||||||
node_box = {
|
|
||||||
type = "fixed",
|
|
||||||
fixed = def.node_box_bottom
|
|
||||||
},
|
|
||||||
selection_box = {
|
|
||||||
type = "fixed",
|
|
||||||
fixed = def.selection_box_bottom
|
|
||||||
},
|
|
||||||
after_destruct = function(bottom, oldnode)
|
|
||||||
local meta_bottom = minetest_get_meta(bottom)
|
local meta_bottom = minetest_get_meta(bottom)
|
||||||
if meta_bottom:get_int("rotation") == 1 then
|
if meta_bottom:get_int("rotation") == 1 then
|
||||||
meta_bottom:set_int("rotation", 0)
|
meta_bottom:set_int("rotation", 0)
|
||||||
|
@ -764,15 +628,12 @@ function mcl_doors:register_door(name, def)
|
||||||
minetest.remove_node(top)
|
minetest.remove_node(top)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end,
|
end
|
||||||
|
_b_4_def.on_rightclick = on_rightclick
|
||||||
on_rightclick = on_rightclick,
|
_b_4_def.mesecons = { effector = {
|
||||||
|
|
||||||
mesecons = { effector = {
|
|
||||||
action_off = on_mesecons_signal_close,
|
action_off = on_mesecons_signal_close,
|
||||||
}},
|
}}
|
||||||
|
_b_4_def.on_rotate = function(bottom, node, user, mode, param2)
|
||||||
on_rotate = function(bottom, node, user, mode, param2)
|
|
||||||
if mode == screwdriver.ROTATE_FACE then
|
if mode == screwdriver.ROTATE_FACE then
|
||||||
local meta_bottom = minetest_get_meta(bottom)
|
local meta_bottom = minetest_get_meta(bottom)
|
||||||
meta_bottom:set_int("rotation", 1)
|
meta_bottom:set_int("rotation", 1)
|
||||||
|
@ -788,10 +649,9 @@ function mcl_doors:register_door(name, def)
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
return false
|
return false
|
||||||
end,
|
end
|
||||||
|
|
||||||
can_dig = check_player_priv,
|
minetest.register_node(name.."_b_4", _b_4_def)
|
||||||
})
|
|
||||||
|
|
||||||
if def.only_redstone_can_open then
|
if def.only_redstone_can_open then
|
||||||
on_rightclick = nil
|
on_rightclick = nil
|
||||||
|
@ -803,28 +663,9 @@ function mcl_doors:register_door(name, def)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_node(name.."_t_4", {
|
local _t_4_def = table.copy(template_def)
|
||||||
tiles = {ttt, "blank.png", ttsm, ttsm, ttm, tt},
|
_t_4_def.tiles = {texture_top_toppart, "blank.png", texture_top_side_mirrored, texture_top_side_mirrored, texture_top_mirrored, texture_top}
|
||||||
use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "clip" or true,
|
_t_4_def.after_destruct = function(top, oldnode)
|
||||||
paramtype = "light",
|
|
||||||
paramtype2 = "facedir",
|
|
||||||
sunlight_propagates = true,
|
|
||||||
is_ground_content = false,
|
|
||||||
drop = "",
|
|
||||||
drawtype = "nodebox",
|
|
||||||
groups = def.groups,
|
|
||||||
_mcl_hardness = def._mcl_hardness,
|
|
||||||
_mcl_blast_resistance = def._mcl_blast_resistance,
|
|
||||||
sounds = def.sounds,
|
|
||||||
node_box = {
|
|
||||||
type = "fixed",
|
|
||||||
fixed = def.node_box_top
|
|
||||||
},
|
|
||||||
selection_box = {
|
|
||||||
type = "fixed",
|
|
||||||
fixed = def.selection_box_top
|
|
||||||
},
|
|
||||||
after_destruct = function(top, oldnode)
|
|
||||||
local meta_top = minetest_get_meta(top)
|
local meta_top = minetest_get_meta(top)
|
||||||
if meta_top:get_int("rotation") == 1 then
|
if meta_top:get_int("rotation") == 1 then
|
||||||
meta_top:set_int("rotation", 0)
|
meta_top:set_int("rotation", 0)
|
||||||
|
@ -834,16 +675,13 @@ function mcl_doors:register_door(name, def)
|
||||||
minetest.dig_node(bottom)
|
minetest.dig_node(bottom)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end,
|
end
|
||||||
|
_t_4_def.on_rightclick = on_rightclick
|
||||||
on_rightclick = on_rightclick,
|
_t_4_def.mesecons = { effector = {
|
||||||
|
|
||||||
mesecons = { effector = {
|
|
||||||
action_off = on_mesecons_signal_close_top,
|
action_off = on_mesecons_signal_close_top,
|
||||||
rules = mesecon.rules.flat,
|
rules = mesecon.rules.flat,
|
||||||
}},
|
}}
|
||||||
|
_t_4_def.on_rotate = function(top, node, user, mode, param2)
|
||||||
on_rotate = function(top, node, user, mode, param2)
|
|
||||||
if mode == screwdriver.ROTATE_FACE then
|
if mode == screwdriver.ROTATE_FACE then
|
||||||
local meta_top = minetest_get_meta(top)
|
local meta_top = minetest_get_meta(top)
|
||||||
meta_top:set_int("rotation", 1)
|
meta_top:set_int("rotation", 1)
|
||||||
|
@ -859,10 +697,9 @@ function mcl_doors:register_door(name, def)
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
return false
|
return false
|
||||||
end,
|
end
|
||||||
|
|
||||||
can_dig = check_player_priv,
|
minetest.register_node(name.."_t_4", _t_4_def)
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
-- Add entry aliases for the Help
|
-- Add entry aliases for the Help
|
||||||
|
|
Loading…
Reference in New Issue