Fix doors texture names

This commit is contained in:
MT-Modder 2015-01-20 16:13:50 -05:00
parent aed4d3997b
commit cb598cbe18

View File

@ -29,9 +29,9 @@ end
function doors:register_door(name, def) function doors:register_door(name, def)
def.groups.not_in_creative_inventory = 1 def.groups.not_in_creative_inventory = 1
local box = {{-0.5, -0.5, -0.5, 0.5, 0.5, -0.5+1.5/16}} local box = {{-0.5, -0.5, -0.5, 0.5, 0.5, -0.5+1.5/16}}
if not def.node_box_bottom then if not def.node_box_bottom then
def.node_box_bottom = box def.node_box_bottom = box
end end
@ -44,10 +44,10 @@ function doors:register_door(name, def)
if not def.selection_box_top then if not def.selection_box_top then
def.selection_box_top = box def.selection_box_top = box
end end
local tt = def.tiles_top local tt = def.tiles_top
local tb = def.tiles_bottom local tb = def.tiles_bottom
local function after_dig_node(pos, name) local function after_dig_node(pos, name)
if minetest.get_node(pos).name == name then if minetest.get_node(pos).name == name then
minetest.remove_node(pos) minetest.remove_node(pos)
@ -61,11 +61,11 @@ function doors:register_door(name, def)
end end
local p2 = minetest.get_node(pos).param2 local p2 = minetest.get_node(pos).param2
p2 = params[p2+1] p2 = params[p2+1]
local meta = minetest.get_meta(pos):to_table() local meta = minetest.get_meta(pos):to_table()
minetest.set_node(pos, {name=replace_dir, param2=p2}) minetest.set_node(pos, {name=replace_dir, param2=p2})
minetest.get_meta(pos):from_table(meta) minetest.get_meta(pos):from_table(meta)
pos.y = pos.y-dir pos.y = pos.y-dir
meta = minetest.get_meta(pos):to_table() meta = minetest.get_meta(pos):to_table()
minetest.set_node(pos, {name=replace, param2=p2}) minetest.set_node(pos, {name=replace, param2=p2})
@ -92,7 +92,7 @@ function doors:register_door(name, def)
local function on_mesecons_signal_close (pos, node) local function on_mesecons_signal_close (pos, node)
on_rightclick(pos, 1, name.."_t_2", name.."_b_1", name.."_t_1", {3,0,1,2}) on_rightclick(pos, 1, name.."_t_2", name.."_b_1", name.."_t_1", {3,0,1,2})
end end
local function check_player_priv(pos, player) local function check_player_priv(pos, player)
if not def.only_placer_can_open then if not def.only_placer_can_open then
return true return true
@ -101,7 +101,7 @@ function doors:register_door(name, def)
local pn = player:get_player_name() local pn = player:get_player_name()
return meta:get_string("doors_owner") == pn return meta:get_string("doors_owner") == pn
end end
minetest.register_node(":"..name.."_b_1", { minetest.register_node(":"..name.."_b_1", {
tiles = {tb[2], tb[2], tb[2], tb[2], tb[1], tb[1].."^[transformfx"}, tiles = {tb[2], tb[2], tb[2], tb[2], tb[1], tb[1].."^[transformfx"},
paramtype = "light", paramtype = "light",
@ -117,12 +117,12 @@ function doors:register_door(name, def)
fixed = def.selection_box_bottom fixed = def.selection_box_bottom
}, },
groups = def.groups, groups = def.groups,
after_dig_node = function(pos, oldnode, oldmetadata, digger) after_dig_node = function(pos, oldnode, oldmetadata, digger)
pos.y = pos.y+1 pos.y = pos.y+1
after_dig_node(pos, name.."_t_1") after_dig_node(pos, name.."_t_1")
end, end,
on_rightclick = function(pos, node, puncher) on_rightclick = function(pos, node, puncher)
if check_player_priv(pos, puncher) then if check_player_priv(pos, puncher) then
on_rightclick(pos, 1, name.."_t_1", name.."_b_2", name.."_t_2", {1,2,3,0}) on_rightclick(pos, 1, name.."_t_1", name.."_b_2", name.."_t_2", {1,2,3,0})
@ -132,10 +132,10 @@ function doors:register_door(name, def)
mesecons = {effector = { mesecons = {effector = {
action_on = on_mesecons_signal_open action_on = on_mesecons_signal_open
}}, }},
can_dig = check_player_priv, can_dig = check_player_priv,
}) })
minetest.register_node(":"..name.."_b_2", { minetest.register_node(":"..name.."_b_2", {
tiles = {tb[2], tb[2], tb[2], tb[2], tb[1].."^[transformfx", tb[1]}, tiles = {tb[2], tb[2], tb[2], tb[2], tb[1].."^[transformfx", tb[1]},
paramtype = "light", paramtype = "light",
@ -151,12 +151,12 @@ function doors:register_door(name, def)
fixed = def.selection_box_bottom fixed = def.selection_box_bottom
}, },
groups = def.groups, groups = def.groups,
after_dig_node = function(pos, oldnode, oldmetadata, digger) after_dig_node = function(pos, oldnode, oldmetadata, digger)
pos.y = pos.y+1 pos.y = pos.y+1
after_dig_node(pos, name.."_t_2") after_dig_node(pos, name.."_t_2")
end, end,
on_rightclick = function(pos, node, puncher) on_rightclick = function(pos, node, puncher)
if check_player_priv(pos, puncher) then if check_player_priv(pos, puncher) then
on_rightclick(pos, 1, name.."_t_2", name.."_b_1", name.."_t_1", {3,0,1,2}) on_rightclick(pos, 1, name.."_t_2", name.."_b_1", name.."_t_1", {3,0,1,2})
@ -166,26 +166,26 @@ function doors:register_door(name, def)
mesecons = {effector = { mesecons = {effector = {
action_off = on_mesecons_signal_close action_off = on_mesecons_signal_close
}}, }},
can_dig = check_player_priv, can_dig = check_player_priv,
}) })
end end
doors:register_door("doors:door_wood", { doors:register_door("doors:door_wood", {
description = "Wooden Door", description = "Wooden Door",
inventory_image = "door_wood.png", inventory_image = "doors_wood.png",
groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=2,door=1}, groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=2,door=1},
tiles_bottom = {"door_wood_b.png", "door_brown.png"}, tiles_bottom = {"doors_wood_b.png", "doors_brown.png"},
tiles_top = {"door_wood_a.png", "door_brown.png"}, tiles_top = {"doors_wood_a.png", "doors_brown.png"},
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
}) })
doors:register_door("doors:door_steel", { doors:register_door("doors:door_steel", {
description = "Steel Door", description = "Steel Door",
inventory_image = "door_steel.png", inventory_image = "doors_steel.png",
groups = {snappy=1,bendy=2,cracky=1,melty=2,level=2,door=1}, groups = {snappy=1,bendy=2,cracky=1,melty=2,level=2,door=1},
tiles_bottom = {"door_steel_b.png", "door_grey.png"}, tiles_bottom = {"doors_steel_b.png", "doors_grey.png"},
tiles_top = {"door_steel_a.png", "door_grey.png"}, tiles_top = {"doors_steel_a.png", "doors_grey.png"},
only_placer_can_open = true, only_placer_can_open = true,
sounds = default.node_sound_stone_defaults(), sounds = default.node_sound_stone_defaults(),
}) })