commit
d554a9d2fe
@ -1,4 +1,2 @@
|
||||
dofile(minetest.get_modpath("my_castle_doors").."/locked.lua")
|
||||
dofile(minetest.get_modpath("my_castle_doors").."/unlocked.lua")
|
||||
|
||||
|
||||
|
@ -14,29 +14,26 @@ local cdoor_list = { --Number , Description , Inven Image , Image
|
||||
-- { "13", "Castle Door 13" , "door13" , "door13"},
|
||||
}
|
||||
|
||||
|
||||
for i in ipairs(cdoor_list) do
|
||||
local num = cdoor_list[i][1]
|
||||
local desc = cdoor_list[i][2]
|
||||
local inv = cdoor_list[i][3]
|
||||
local img = cdoor_list[i][4]
|
||||
local lock = cdoor_list[i][5]
|
||||
local cdoor_groups = {choppy=2,cracky=2,door=1}
|
||||
|
||||
|
||||
doors.register_door("my_castle_doors:door"..num.."_locked", {
|
||||
description = desc.." Locked",
|
||||
inventory_image = "mydoors_"..inv.."_inv.png",
|
||||
groups = {choppy=2,cracky=2,door=1},
|
||||
tiles_bottom = {"mydoors_"..img.."_bottom.png", "mydoors_"..img.."_edge.png"},
|
||||
tiles_top = {"mydoors_"..img.."_top.png", "mydoors_"..img.."_edge.png"},
|
||||
only_placer_can_open = true,
|
||||
})
|
||||
for i = 1,#cdoor_list do
|
||||
local num,desc,inv,img = unpack(cdoor_list[i])
|
||||
|
||||
doors.register_door("my_castle_doors:door"..num.."_locked", {
|
||||
description = desc.." Locked",
|
||||
inventory_image = "mydoors_"..inv.."_inv.png",
|
||||
groups = cdoor_groups,
|
||||
tiles_bottom = {"mydoors_"..img.."_bottom.png", "mydoors_"..img.."_edge.png"},
|
||||
tiles_top = {"mydoors_"..img.."_top.png", "mydoors_"..img.."_edge.png"},
|
||||
only_placer_can_open = true,
|
||||
})
|
||||
end
|
||||
|
||||
-- Crafts
|
||||
|
||||
minetest.register_craft({
|
||||
output = "my_castle_doors:door1_locked 1",
|
||||
output = "my_castle_doors:door1_locked",
|
||||
recipe = {
|
||||
{"default:steel_ingot", "default:glass", ""},
|
||||
{"my_door_wood:wood_dark_grey", "my_door_wood:wood_dark_grey", "default:steel_ingot"},
|
||||
@ -45,7 +42,7 @@ minetest.register_craft({
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "my_castle_doors:door2_locked 1",
|
||||
output = "my_castle_doors:door2_locked",
|
||||
recipe = {
|
||||
{"default:steel_ingot", "default:glass", ""},
|
||||
{"my_door_wood:wood_red", "my_door_wood:wood_red", "default:steel_ingot"},
|
||||
@ -53,7 +50,7 @@ minetest.register_craft({
|
||||
}
|
||||
})
|
||||
minetest.register_craft({
|
||||
output = "my_castle_doors:door3_locked 1",
|
||||
output = "my_castle_doors:door3_locked",
|
||||
recipe = {
|
||||
{"my_door_wood:wood_yellow", "default:steel_ingot", ""},
|
||||
{"my_door_wood:wood_yellow", "my_door_wood:wood_yellow", "default:steel_ingot"},
|
||||
@ -61,7 +58,7 @@ minetest.register_craft({
|
||||
}
|
||||
})
|
||||
minetest.register_craft({
|
||||
output = "my_castle_doors:door4_locked 1",
|
||||
output = "my_castle_doors:door4_locked",
|
||||
recipe = {
|
||||
{"my_door_wood:wood_brown", "default:steel_ingot", ""},
|
||||
{"my_door_wood:wood_brown", "my_door_wood:wood_brown", "default:steel_ingot"},
|
||||
@ -69,7 +66,7 @@ minetest.register_craft({
|
||||
}
|
||||
})
|
||||
minetest.register_craft({
|
||||
output = "my_castle_doors:door5_locked 1",
|
||||
output = "my_castle_doors:door5_locked",
|
||||
recipe = {
|
||||
{"my_door_wood:wood_yellow", "default:steel_ingot", ""},
|
||||
{"my_door_wood:wood_white", "my_door_wood:wood_yellow", "default:steel_ingot"},
|
||||
@ -77,7 +74,7 @@ minetest.register_craft({
|
||||
}
|
||||
})
|
||||
minetest.register_craft({
|
||||
output = "my_castle_doors:door6_locked 1",
|
||||
output = "my_castle_doors:door6_locked",
|
||||
recipe = {
|
||||
{"my_door_wood:wood_grey", "my_door_wood:wood_grey", ""},
|
||||
{"my_door_wood:wood_grey", "default:steel_ingot", "default:steel_ingot"},
|
||||
@ -85,7 +82,7 @@ minetest.register_craft({
|
||||
}
|
||||
})
|
||||
minetest.register_craft({
|
||||
output = "my_castle_doors:door7_locked 1",
|
||||
output = "my_castle_doors:door7_locked",
|
||||
recipe = {
|
||||
{"my_door_wood:wood_red", "my_door_wood:wood_red", ""},
|
||||
{"my_door_wood:wood_red", "default:steel_ingot", "default:steel_ingot"},
|
||||
@ -93,7 +90,7 @@ minetest.register_craft({
|
||||
}
|
||||
})
|
||||
minetest.register_craft({
|
||||
output = "my_castle_doors:door8_locked 1",
|
||||
output = "my_castle_doors:door8_locked",
|
||||
recipe = {
|
||||
{"default:steel_ingot", "default:steel_ingot", ""},
|
||||
{"my_door_wood:wood_dark_grey", "my_door_wood:wood_dark_grey", "default:steel_ingot"},
|
||||
@ -101,7 +98,7 @@ minetest.register_craft({
|
||||
}
|
||||
})
|
||||
minetest.register_craft({
|
||||
output = "my_castle_doors:door9_locked 1",
|
||||
output = "my_castle_doors:door9_locked",
|
||||
recipe = {
|
||||
{"default:steel_ingot", "my_door_wood:wood_yellow", ""},
|
||||
{"my_door_wood:wood_yellow", "my_door_wood:wood_yellow", "default:steel_ingot"},
|
||||
@ -109,7 +106,7 @@ minetest.register_craft({
|
||||
}
|
||||
})
|
||||
minetest.register_craft({
|
||||
output = "my_castle_doors:door10_locked 1",
|
||||
output = "my_castle_doors:door10_locked",
|
||||
recipe = {
|
||||
{"my_door_wood:wood_red", "default:steel_ingot", ""},
|
||||
{"my_door_wood:wood_red", "my_door_wood:wood_red", "default:steel_ingot"},
|
||||
@ -117,7 +114,7 @@ minetest.register_craft({
|
||||
}
|
||||
})
|
||||
minetest.register_craft({
|
||||
output = "my_castle_doors:door11_locked 1",
|
||||
output = "my_castle_doors:door11_locked",
|
||||
recipe = {
|
||||
{"my_door_wood:wood_brown", "default:steel_ingot", ""},
|
||||
{"my_door_wood:wood_brown", "my_door_wood:wood_brown", "default:steel_ingot"},
|
||||
@ -125,7 +122,7 @@ minetest.register_craft({
|
||||
}
|
||||
})
|
||||
minetest.register_craft({
|
||||
output = "my_castle_doors:door12_locked 1",
|
||||
output = "my_castle_doors:door12_locked",
|
||||
recipe = {
|
||||
{"my_door_wood:wood_brown", "default:steel_ingot", ""},
|
||||
{"my_door_wood:wood_grey", "my_door_wood:wood_brown", "default:steel_ingot"},
|
||||
@ -133,13 +130,10 @@ minetest.register_craft({
|
||||
}
|
||||
})
|
||||
minetest.register_craft({
|
||||
output = "my_castle_doors:door13_locked 1",
|
||||
output = "my_castle_doors:door13_locked",
|
||||
recipe = {
|
||||
{"my_door_wood:wood_brown", "my_door_wood:wood_brown", "default:steel_ingot"},
|
||||
{"my_door_wood:wood_brown", "my_door_wood:wood_brown", "default:steel_ingot"},
|
||||
{"my_door_wood:wood_brown", "my_door_wood:wood_brown", "default:steel_ingot"}
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
@ -14,29 +14,26 @@ local cdoor_list = { --Number , Description , Inven Image , Image
|
||||
{ "13", "Castle Door 13" , "door13" , "door13"},
|
||||
}
|
||||
|
||||
|
||||
for i in ipairs(cdoor_list) do
|
||||
local num = cdoor_list[i][1]
|
||||
local desc = cdoor_list[i][2]
|
||||
local inv = cdoor_list[i][3]
|
||||
local img = cdoor_list[i][4]
|
||||
local lock = cdoor_list[i][5]
|
||||
local cdoor_groups = {choppy=2,cracky=2,door=1}
|
||||
|
||||
|
||||
doors.register_door("my_castle_doors:door"..num, {
|
||||
description = desc,
|
||||
inventory_image = "mydoors_"..inv.."_inv.png",
|
||||
groups = {choppy=2,cracky=2,door=1},
|
||||
tiles_bottom = {"mydoors_"..img.."_bottom.png", "mydoors_"..img.."_edge.png"},
|
||||
tiles_top = {"mydoors_"..img.."_top.png", "mydoors_"..img.."_edge.png"},
|
||||
only_placer_can_open = false,
|
||||
})
|
||||
for i = 1,#cdoor_list do
|
||||
local num,desc,inv,img = unpack(cdoor_list[i])
|
||||
|
||||
doors.register_door("my_castle_doors:door"..num, {
|
||||
description = desc,
|
||||
inventory_image = "mydoors_"..inv.."_inv.png",
|
||||
groups = cdoor_groups,
|
||||
tiles_bottom = {"mydoors_"..img.."_bottom.png", "mydoors_"..img.."_edge.png"},
|
||||
tiles_top = {"mydoors_"..img.."_top.png", "mydoors_"..img.."_edge.png"},
|
||||
only_placer_can_open = false,
|
||||
})
|
||||
end
|
||||
|
||||
-- Crafts
|
||||
|
||||
minetest.register_craft({
|
||||
output = "my_castle_doors:door1 1",
|
||||
output = "my_castle_doors:door1",
|
||||
recipe = {
|
||||
{"default:steel_ingot", "default:glass", ""},
|
||||
{"my_door_wood:wood_dark_grey", "my_door_wood:wood_dark_grey", ""},
|
||||
@ -45,7 +42,7 @@ minetest.register_craft({
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "my_castle_doors:door2 1",
|
||||
output = "my_castle_doors:door2",
|
||||
recipe = {
|
||||
{"default:steel_ingot", "default:glass", ""},
|
||||
{"my_door_wood:wood_red", "my_door_wood:wood_red", ""},
|
||||
@ -53,7 +50,7 @@ minetest.register_craft({
|
||||
}
|
||||
})
|
||||
minetest.register_craft({
|
||||
output = "my_castle_doors:door3 1",
|
||||
output = "my_castle_doors:door3",
|
||||
recipe = {
|
||||
{"my_door_wood:wood_yellow", "default:steel_ingot", ""},
|
||||
{"my_door_wood:wood_yellow", "my_door_wood:wood_yellow", ""},
|
||||
@ -61,7 +58,7 @@ minetest.register_craft({
|
||||
}
|
||||
})
|
||||
minetest.register_craft({
|
||||
output = "my_castle_doors:door4 1",
|
||||
output = "my_castle_doors:door4",
|
||||
recipe = {
|
||||
{"my_door_wood:wood_brown", "default:steel_ingot", ""},
|
||||
{"my_door_wood:wood_brown", "my_door_wood:wood_brown", ""},
|
||||
@ -69,7 +66,7 @@ minetest.register_craft({
|
||||
}
|
||||
})
|
||||
minetest.register_craft({
|
||||
output = "my_castle_doors:door5 1",
|
||||
output = "my_castle_doors:door5",
|
||||
recipe = {
|
||||
{"my_door_wood:wood_yellow", "default:steel_ingot", ""},
|
||||
{"my_door_wood:wood_white", "my_door_wood:wood_yellow", ""},
|
||||
@ -77,7 +74,7 @@ minetest.register_craft({
|
||||
}
|
||||
})
|
||||
minetest.register_craft({
|
||||
output = "my_castle_doors:door6 1",
|
||||
output = "my_castle_doors:door6",
|
||||
recipe = {
|
||||
{"my_door_wood:wood_grey", "my_door_wood:wood_grey", ""},
|
||||
{"my_door_wood:wood_grey", "default:steel_ingot", ""},
|
||||
@ -85,7 +82,7 @@ minetest.register_craft({
|
||||
}
|
||||
})
|
||||
minetest.register_craft({
|
||||
output = "my_castle_doors:door7 1",
|
||||
output = "my_castle_doors:door7",
|
||||
recipe = {
|
||||
{"my_door_wood:wood_red", "my_door_wood:wood_red", ""},
|
||||
{"my_door_wood:wood_red", "default:steel_ingot", ""},
|
||||
@ -93,7 +90,7 @@ minetest.register_craft({
|
||||
}
|
||||
})
|
||||
minetest.register_craft({
|
||||
output = "my_castle_doors:door8 1",
|
||||
output = "my_castle_doors:door8",
|
||||
recipe = {
|
||||
{"default:steel_ingot", "default:steel_ingot", ""},
|
||||
{"my_door_wood:wood_dark_grey", "my_door_wood:wood_dark_grey", ""},
|
||||
@ -101,7 +98,7 @@ minetest.register_craft({
|
||||
}
|
||||
})
|
||||
minetest.register_craft({
|
||||
output = "my_castle_doors:door9 1",
|
||||
output = "my_castle_doors:door9",
|
||||
recipe = {
|
||||
{"default:steel_ingot", "my_door_wood:wood_yellow", ""},
|
||||
{"my_door_wood:wood_yellow", "my_door_wood:wood_yellow", ""},
|
||||
@ -109,7 +106,7 @@ minetest.register_craft({
|
||||
}
|
||||
})
|
||||
minetest.register_craft({
|
||||
output = "my_castle_doors:door10 1",
|
||||
output = "my_castle_doors:door10",
|
||||
recipe = {
|
||||
{"my_door_wood:wood_red", "default:steel_ingot", ""},
|
||||
{"my_door_wood:wood_red", "my_door_wood:wood_red", ""},
|
||||
@ -117,7 +114,7 @@ minetest.register_craft({
|
||||
}
|
||||
})
|
||||
minetest.register_craft({
|
||||
output = "my_castle_doors:door11 1",
|
||||
output = "my_castle_doors:door11",
|
||||
recipe = {
|
||||
{"my_door_wood:wood_brown", "default:steel_ingot", ""},
|
||||
{"my_door_wood:wood_brown", "my_door_wood:wood_brown", ""},
|
||||
@ -125,7 +122,7 @@ minetest.register_craft({
|
||||
}
|
||||
})
|
||||
minetest.register_craft({
|
||||
output = "my_castle_doors:door12 1",
|
||||
output = "my_castle_doors:door12",
|
||||
recipe = {
|
||||
{"my_door_wood:wood_brown", "default:steel_ingot", ""},
|
||||
{"my_door_wood:wood_grey", "my_door_wood:wood_brown", ""},
|
||||
@ -133,12 +130,10 @@ minetest.register_craft({
|
||||
}
|
||||
})
|
||||
minetest.register_craft({
|
||||
output = "my_castle_doors:door13 1",
|
||||
output = "my_castle_doors:door13",
|
||||
recipe = {
|
||||
{"my_door_wood:wood_brown", "my_door_wood:wood_brown", "default:steel_ingot"},
|
||||
{"my_door_wood:wood_brown", "my_door_wood:wood_brown", ""},
|
||||
{"my_door_wood:wood_brown", "my_door_wood:wood_brown", "default:steel_ingot"}
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
|
@ -7,32 +7,26 @@ local door_wood = { -- color, desc, image
|
||||
{"yellow", "Clear Stained", "yellow"},
|
||||
{"black", "Black", "black"},
|
||||
}
|
||||
for i in ipairs(door_wood) do
|
||||
local color = door_wood[i][1]
|
||||
local desc = door_wood[i][2]
|
||||
local img = door_wood[i][3]
|
||||
|
||||
minetest.register_node("my_door_wood:wood_"..color, {
|
||||
description = desc.." Wood",
|
||||
drawtype = "normal",
|
||||
paramtype = "light",
|
||||
tiles = {"mydoors_"..img.."_wood.png"},
|
||||
paramtype = "light",
|
||||
groups = {cracky = 2, choppy = 2},
|
||||
for i = 1,#door_wood do
|
||||
local color,desc,img = unpack(door_wood[i])
|
||||
|
||||
})
|
||||
minetest.register_node("my_door_wood:wood_"..color, {
|
||||
description = desc.." Wood",
|
||||
drawtype = "normal",
|
||||
paramtype = "light",
|
||||
tiles = {"mydoors_"..img.."_wood.png"},
|
||||
groups = {cracky = 2, choppy = 2},
|
||||
})
|
||||
|
||||
-- Crafts
|
||||
-- Crafts
|
||||
|
||||
minetest.register_craft({
|
||||
output = "my_door_wood:wood_"..color,
|
||||
recipe = {
|
||||
{"default:wood", "", ""},
|
||||
{"dye:"..color, "", ""},
|
||||
{"", "", ""}
|
||||
}
|
||||
})
|
||||
minetest.register_craft({
|
||||
output = "my_door_wood:wood_"..color,
|
||||
recipe = {
|
||||
{"default:wood", "", ""},
|
||||
{"dye:"..color, "", ""},
|
||||
{"", "", ""}
|
||||
}
|
||||
})
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
@ -1,9 +1,7 @@
|
||||
|
||||
minetest.register_node("my_garage_door:garage_door", {
|
||||
description = "Garage Door",
|
||||
tiles = {
|
||||
"default_snow.png"
|
||||
},
|
||||
tiles = {"default_snow.png"},
|
||||
drawtype = "nodebox",
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
@ -24,45 +22,54 @@ minetest.register_node("my_garage_door:garage_door", {
|
||||
{-1.5, -0.5, -0.1875, 1.5, 1.5, -0.0625},
|
||||
}
|
||||
},
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
local p = pointed_thing.above
|
||||
local p2 = minetest.dir_to_facedir(placer:get_look_dir())
|
||||
print(p2)
|
||||
minetest.set_node(p, {name = "my_garage_door:garage_door",param2 = p2})
|
||||
minetest.set_node({x=p.x,y=p.y+1,z=p.z}, {name = "my_garage_door:garage_door_top",param2 = p2})
|
||||
on_place = function(_, placer, pt)
|
||||
if not placer
|
||||
or not pt then
|
||||
return
|
||||
end
|
||||
local p = pt.above
|
||||
local node = {
|
||||
name = "my_garage_door:garage_door",
|
||||
param2 = minetest.dir_to_facedir(placer:get_look_dir())
|
||||
}
|
||||
minetest.set_node(p, node)
|
||||
p.y = p.y+1
|
||||
node.name = node.name.."_top"
|
||||
minetest.set_node(p, node)
|
||||
end,
|
||||
after_destruct = function(pos, oldnode)
|
||||
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z},{name = "air"})
|
||||
end,
|
||||
|
||||
on_rightclick = function(pos, node, player, itemstack, pointed_thing)
|
||||
local p2 = node.param2 --minetest.dir_to_facedir(player:get_look_dir())
|
||||
local t1 = {x=pos.x,y=pos.y+1,z=pos.z}
|
||||
local t2 = {x=pos.x,y=pos.y+1,z=pos.z}
|
||||
if p2 == 0 then
|
||||
t1 = {x=pos.x,y=pos.y+1,z=pos.z+1}
|
||||
t2 = {x=pos.x,y=pos.y+1,z=pos.z+2}
|
||||
elseif p2 == 1 then
|
||||
t1 = {x=pos.x+1,y=pos.y+1,z=pos.z}
|
||||
t2 = {x=pos.x+2,y=pos.y+1,z=pos.z}
|
||||
elseif p2 == 2 then
|
||||
t1 = {x=pos.x,y=pos.y+1,z=pos.z-1}
|
||||
t2 = {x=pos.x,y=pos.y+1,z=pos.z-2}
|
||||
elseif p2 == 3 then
|
||||
t1 = {x=pos.x-1,y=pos.y+1,z=pos.z}
|
||||
t2 = {x=pos.x-2,y=pos.y+1,z=pos.z}
|
||||
pos.y = pos.y+1
|
||||
if minetest.get_node(pos).name == "my_garage_door:garage_door_top" then
|
||||
minetest.remove_node(pos)
|
||||
end
|
||||
minetest.set_node(t1,{name="my_garage_door:garage_door_open",param2=p2})
|
||||
minetest.set_node(t2,{name="my_garage_door:garage_door_open2",param2=p2})
|
||||
minetest.set_node(pos,{name="air"})
|
||||
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z},{name="air"})
|
||||
end,
|
||||
|
||||
on_rightclick = function(pos, node, player, itemstack, pointed_thing)
|
||||
local p2 = node.param2 --minetest.dir_to_facedir(player:get_look_dir())
|
||||
local t1 = {x=pos.x,y=pos.y+1,z=pos.z}
|
||||
local t2 = {x=pos.x,y=pos.y+1,z=pos.z}
|
||||
if p2 == 0 then
|
||||
t1 = {x=pos.x,y=pos.y+1,z=pos.z+1}
|
||||
t2 = {x=pos.x,y=pos.y+1,z=pos.z+2}
|
||||
elseif p2 == 1 then
|
||||
t1 = {x=pos.x+1,y=pos.y+1,z=pos.z}
|
||||
t2 = {x=pos.x+2,y=pos.y+1,z=pos.z}
|
||||
elseif p2 == 2 then
|
||||
t1 = {x=pos.x,y=pos.y+1,z=pos.z-1}
|
||||
t2 = {x=pos.x,y=pos.y+1,z=pos.z-2}
|
||||
elseif p2 == 3 then
|
||||
t1 = {x=pos.x-1,y=pos.y+1,z=pos.z}
|
||||
t2 = {x=pos.x-2,y=pos.y+1,z=pos.z}
|
||||
end
|
||||
minetest.set_node(t1,{name="my_garage_door:garage_door_open",param2=p2})
|
||||
minetest.set_node(t2,{name="my_garage_door:garage_door_open2",param2=p2})
|
||||
minetest.remove_node(pos)
|
||||
minetest.remove_node({x=pos.x,y=pos.y+1,z=pos.z})
|
||||
--end
|
||||
end,
|
||||
})
|
||||
minetest.register_node("my_garage_door:garage_door_top", {
|
||||
tiles = {
|
||||
"default_snow.png"
|
||||
},
|
||||
tiles = {"default_snow.png"},
|
||||
drawtype = "nodebox",
|
||||
paramtype = "light",
|
||||
paramtype2= "facedir",
|
||||
@ -80,12 +87,9 @@ minetest.register_node("my_garage_door:garage_door_top", {
|
||||
{-1.5, 0.25, -0.1875, 1.5, 0.4375, -0.0625},
|
||||
}
|
||||
},
|
||||
selection_box = {type = "fixed",fixed = {{0, 0, 0, 0, 0, 0},}},
|
||||
})
|
||||
minetest.register_node("my_garage_door:garage_door_open", {
|
||||
tiles = {
|
||||
"default_snow.png"
|
||||
},
|
||||
tiles = {"default_snow.png"},
|
||||
drawtype = "nodebox",
|
||||
paramtype = "light",
|
||||
paramtype2= "facedir",
|
||||
@ -103,7 +107,7 @@ minetest.register_node("my_garage_door:garage_door_open", {
|
||||
}
|
||||
},
|
||||
selection_box = {type = "fixed",fixed = {{-1.5, 0.375, -0.5, 1.5, 0.5, 1.5},}},
|
||||
|
||||
|
||||
on_rightclick = function(pos, node, player, itemstack, pointed_thing)
|
||||
local p2 = node.param2 --minetest.dir_to_facedir(player:get_look_dir())
|
||||
local t1 = {x=pos.x,y=pos.y+1,z=pos.z}
|
||||
@ -127,8 +131,8 @@ minetest.register_node("my_garage_door:garage_door_open", {
|
||||
end
|
||||
minetest.set_node(t1,{name="my_garage_door:garage_door_top",param2=p2})
|
||||
minetest.set_node(t2,{name="my_garage_door:garage_door",param2=p2})
|
||||
minetest.set_node(pos,{name="air"})
|
||||
minetest.set_node(t3,{name="air"})
|
||||
minetest.remove_node(pos)
|
||||
minetest.remove_node(t3)
|
||||
end,
|
||||
})
|
||||
minetest.register_node("my_garage_door:garage_door_open2", {
|
||||
@ -152,6 +156,4 @@ minetest.register_node("my_garage_door:garage_door_open2", {
|
||||
{-1.5, 0.375, -0.4375, 1.5, 0.5, -0.25},
|
||||
}
|
||||
},
|
||||
selection_box = {type = "fixed",fixed = {{0, 0, 0, 0, 0, 0},}},
|
||||
|
||||
})
|
||||
|
@ -1,14 +1,7 @@
|
||||
minetest.register_node("my_misc_doors:door2a", {
|
||||
description = "Sliding Door",
|
||||
inventory_image = "mydoors_bars.png",
|
||||
tiles = {
|
||||
"mydoors_bars.png",
|
||||
"mydoors_bars.png",
|
||||
"mydoors_bars.png",
|
||||
"mydoors_bars.png",
|
||||
"mydoors_bars.png",
|
||||
"mydoors_bars.png",
|
||||
},
|
||||
tiles = {"mydoors_bars.png"},
|
||||
drawtype = "nodebox",
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
@ -30,84 +23,89 @@ minetest.register_node("my_misc_doors:door2a", {
|
||||
}
|
||||
},
|
||||
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
local pos1 = pointed_thing.above
|
||||
local pos2 = {x=pos1.x, y=pos1.y, z=pos1.z}
|
||||
pos2.y = pos2.y+1
|
||||
if
|
||||
not minetest.registered_nodes[minetest.get_node(pos1).name].buildable_to or
|
||||
not minetest.registered_nodes[minetest.get_node(pos2).name].buildable_to or
|
||||
not placer or
|
||||
not placer:is_player() then
|
||||
return
|
||||
end
|
||||
local pt = pointed_thing.above
|
||||
local pt2 = {x=pt.x, y=pt.y, z=pt.z}
|
||||
pt2.y = pt2.y+1
|
||||
local p2 = minetest.dir_to_facedir(placer:get_look_dir())
|
||||
local pt3 = {x=pt.x, y=pt.y, z=pt.z}
|
||||
local p4 = 0
|
||||
if p2 == 0 then
|
||||
pt3.x = pt3.x-1
|
||||
p4 = 2
|
||||
elseif p2 == 1 then
|
||||
pt3.z = pt3.z+1
|
||||
p4 = 3
|
||||
elseif p2 == 2 then
|
||||
pt3.x = pt3.x+1
|
||||
p4 = 0
|
||||
elseif p2 == 3 then
|
||||
pt3.z = pt3.z-1
|
||||
p4 = 1
|
||||
end
|
||||
if minetest.get_node(pt3).name == "my_misc_doors:door2a" then
|
||||
minetest.set_node(pt, {name="my_misc_doors:door2a", param2=p4})
|
||||
minetest.set_node(pt2, {name="my_misc_doors:door2b", param2=p4})
|
||||
else
|
||||
minetest.set_node(pt, {name="my_misc_doors:door2a", param2=p2})
|
||||
minetest.set_node(pt2, {name="my_misc_doors:door2b", param2=p2})
|
||||
end
|
||||
end,
|
||||
after_destruct = function(pos, oldnode)
|
||||
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z},{name="air"})
|
||||
end,
|
||||
on_rightclick = function(pos, node, player, itemstack, pointed_thing)
|
||||
local timer = minetest.get_node_timer(pos)
|
||||
local a = minetest.get_node({x=pos.x, y=pos.y, z=pos.z-1})
|
||||
local b = minetest.get_node({x=pos.x, y=pos.y, z=pos.z+1})
|
||||
local c = minetest.get_node({x=pos.x+1, y=pos.y, z=pos.z})
|
||||
local d = minetest.get_node({x=pos.x-1, y=pos.y, z=pos.z})
|
||||
on_place = function(_, placer, pt)
|
||||
if not placer
|
||||
or not pt
|
||||
or not placer:is_player() then
|
||||
return
|
||||
end
|
||||
|
||||
pt = pt.above
|
||||
local pt2 = {x=pt.x, y=pt.y+1, z=pt.z}
|
||||
|
||||
if not minetest.registered_nodes[minetest.get_node(pt).name].buildable_to
|
||||
or not minetest.registered_nodes[minetest.get_node(pt2).name].buildable_to then
|
||||
return
|
||||
end
|
||||
|
||||
local pt3 = vector.new(pt)
|
||||
local p2 = minetest.dir_to_facedir(placer:get_look_dir())
|
||||
local p4
|
||||
if p2 == 0 then
|
||||
pt3.x = pt3.x-1
|
||||
p4 = 2
|
||||
elseif p2 == 1 then
|
||||
pt3.z = pt3.z+1
|
||||
p4 = 3
|
||||
elseif p2 == 2 then
|
||||
pt3.x = pt3.x+1
|
||||
p4 = 0
|
||||
elseif p2 == 3 then
|
||||
pt3.z = pt3.z-1
|
||||
p4 = 1
|
||||
end
|
||||
if minetest.get_node(pt3).name == "my_misc_doors:door2a" then
|
||||
minetest.set_node(pt, {name="my_misc_doors:door2a", param2=p4})
|
||||
minetest.set_node(pt2, {name="my_misc_doors:door2b", param2=p4})
|
||||
else
|
||||
minetest.set_node(pt, {name="my_misc_doors:door2a", param2=p2})
|
||||
minetest.set_node(pt2, {name="my_misc_doors:door2b", param2=p2})
|
||||
end
|
||||
end,
|
||||
after_destruct = function(pos)
|
||||
pos.y = pos.y+1
|
||||
if minetest.get_node(pos).name == "my_misc_doors:door2b" then
|
||||
minetest.remove_node(pos)
|
||||
end
|
||||
end,
|
||||
on_rightclick = function(pos, node, player, itemstack, pointed_thing)
|
||||
local timer = minetest.get_node_timer(pos)
|
||||
local a = minetest.get_node({x=pos.x, y=pos.y, z=pos.z-1})
|
||||
local b = minetest.get_node({x=pos.x, y=pos.y, z=pos.z+1})
|
||||
local c = minetest.get_node({x=pos.x+1, y=pos.y, z=pos.z})
|
||||
local d = minetest.get_node({x=pos.x-1, y=pos.y, z=pos.z})
|
||||
minetest.set_node(pos, {name="my_misc_doors:door2c", param2=node.param2})
|
||||
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z}, {name="my_misc_doors:door2d", param2=node.param2})
|
||||
|
||||
if a.name == "my_misc_doors:door2a" then
|
||||
minetest.set_node({x=pos.x, y=pos.y, z=pos.z-1}, {name="my_misc_doors:door2c", param2=a.param2})
|
||||
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z-1}, {name="my_misc_doors:door2d", param2=a.param2})
|
||||
if a.name == "my_misc_doors:door2a" then
|
||||
minetest.set_node({x=pos.x, y=pos.y, z=pos.z-1}, {name="my_misc_doors:door2c", param2=a.param2})
|
||||
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z-1}, {name="my_misc_doors:door2d", param2=a.param2})
|
||||
end
|
||||
if b.name == "my_misc_doors:door2a" then
|
||||
minetest.set_node({x=pos.x, y=pos.y, z=pos.z+1}, {name="my_misc_doors:door2c", param2=b.param2})
|
||||
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z+1}, {name="my_misc_doors:door2d", param2=b.param2})
|
||||
if b.name == "my_misc_doors:door2a" then
|
||||
minetest.set_node({x=pos.x, y=pos.y, z=pos.z+1}, {name="my_misc_doors:door2c", param2=b.param2})
|
||||
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z+1}, {name="my_misc_doors:door2d", param2=b.param2})
|
||||
end
|
||||
if c.name == "my_misc_doors:door2a" then
|
||||
minetest.set_node({x=pos.x+1, y=pos.y, z=pos.z}, {name="my_misc_doors:door2c", param2=c.param2})
|
||||
minetest.set_node({x=pos.x+1,y=pos.y+1,z=pos.z}, {name="my_misc_doors:door2d", param2=c.param2})
|
||||
if c.name == "my_misc_doors:door2a" then
|
||||
minetest.set_node({x=pos.x+1, y=pos.y, z=pos.z}, {name="my_misc_doors:door2c", param2=c.param2})
|
||||
minetest.set_node({x=pos.x+1,y=pos.y+1,z=pos.z}, {name="my_misc_doors:door2d", param2=c.param2})
|
||||
end
|
||||
if d.name == "my_misc_doors:door2a" then
|
||||
minetest.set_node({x=pos.x-1, y=pos.y, z=pos.z}, {name="my_misc_doors:door2c", param2=d.param2})
|
||||
minetest.set_node({x=pos.x-1,y=pos.y+1,z=pos.z}, {name="my_misc_doors:door2d", param2=d.param2})
|
||||
if d.name == "my_misc_doors:door2a" then
|
||||
minetest.set_node({x=pos.x-1, y=pos.y, z=pos.z}, {name="my_misc_doors:door2c", param2=d.param2})
|
||||
minetest.set_node({x=pos.x-1,y=pos.y+1,z=pos.z}, {name="my_misc_doors:door2d", param2=d.param2})
|
||||
end
|
||||
|
||||
timer:start(3)
|
||||
timer:start(3)
|
||||
|
||||
end,
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_node("my_misc_doors:door2b", {
|
||||
tiles = {
|
||||
"mydoors_bars.png",
|
||||
},
|
||||
tiles = {"mydoors_bars.png"},
|
||||
drawtype = "nodebox",
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
diggable = false,
|
||||
pointable = false,
|
||||
groups = {cracky = 1},
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
@ -119,12 +117,6 @@ minetest.register_node("my_misc_doors:door2b", {
|
||||
{-0.25, -0.5, -0.0625, -0.125, 0.5, 0.0625},
|
||||
}
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{0, 0, 0, 0, 0, 0},
|
||||
}
|
||||
},
|
||||
})
|
||||
minetest.register_node("my_misc_doors:door2c", {
|
||||
tiles = {
|
||||
@ -138,6 +130,8 @@ minetest.register_node("my_misc_doors:door2c", {
|
||||
drawtype = "nodebox",
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
diggable = false,
|
||||
pointable = false,
|
||||
groups = {cracky = 1},
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
@ -149,45 +143,42 @@ minetest.register_node("my_misc_doors:door2c", {
|
||||
{-0.25, -0.375, -0.0625, -0.125, -0.5, 0.0625},
|
||||
}
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{0, 0, 0, 0, 0, 0},
|
||||
}
|
||||
},
|
||||
after_place_node = function(pos, placer, itemstack, pointed_thing)
|
||||
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z},{name="my_misc_doors:door2d",param2=nodeu.param2})
|
||||
end,
|
||||
after_destruct = function(pos, oldnode)
|
||||
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z},{name="air"})
|
||||
end,
|
||||
on_timer = function(pos, elapsed)
|
||||
local node = minetest.get_node(pos)
|
||||
local a = minetest.get_node({x=pos.x, y=pos.y, z=pos.z-1})
|
||||
local b = minetest.get_node({x=pos.x, y=pos.y, z=pos.z+1})
|
||||
local c = minetest.get_node({x=pos.x+1, y=pos.y, z=pos.z})
|
||||
local d = minetest.get_node({x=pos.x-1, y=pos.y, z=pos.z})
|
||||
--[[after_place_node = function(pos)
|
||||
pos.y = pos.y+1
|
||||
minetest.set_node(pos, {name="my_misc_doors:door2d"}) -- param2=nodeu.param2 ?
|
||||
end,--]]
|
||||
after_destruct = function(pos)
|
||||
pos.y = pos.y+1
|
||||
if minetest.get_node(pos).name == "my_misc_doors:door2d" then
|
||||
minetest.remove_node(pos)
|
||||
end
|
||||
end,
|
||||
on_timer = function(pos)
|
||||
local node = minetest.get_node(pos)
|
||||
local a = minetest.get_node({x=pos.x, y=pos.y, z=pos.z-1})
|
||||
local b = minetest.get_node({x=pos.x, y=pos.y, z=pos.z+1})
|
||||
local c = minetest.get_node({x=pos.x+1, y=pos.y, z=pos.z})
|
||||
local d = minetest.get_node({x=pos.x-1, y=pos.y, z=pos.z})
|
||||
minetest.set_node(pos, {name="my_misc_doors:door2a", param2=node.param2})
|
||||
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z}, {name="my_misc_doors:door2b", param2=node.param2})
|
||||
|
||||
if a.name == "my_misc_doors:door2c" then
|
||||
minetest.set_node({x=pos.x, y=pos.y, z=pos.z-1}, {name="my_misc_doors:door2a", param2=a.param2})
|
||||
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z-1}, {name="my_misc_doors:door2b", param2=a.param2})
|
||||
if a.name == "my_misc_doors:door2c" then
|
||||
minetest.set_node({x=pos.x, y=pos.y, z=pos.z-1}, {name="my_misc_doors:door2a", param2=a.param2})
|
||||
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z-1}, {name="my_misc_doors:door2b", param2=a.param2})
|
||||
end
|
||||
if b.name == "my_misc_doors:door2c" then
|
||||
minetest.set_node({x=pos.x, y=pos.y, z=pos.z+1}, {name="my_misc_doors:door2a", param2=b.param2})
|
||||
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z+1}, {name="my_misc_doors:door2b", param2=b.param2})
|
||||
if b.name == "my_misc_doors:door2c" then
|
||||
minetest.set_node({x=pos.x, y=pos.y, z=pos.z+1}, {name="my_misc_doors:door2a", param2=b.param2})
|
||||
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z+1}, {name="my_misc_doors:door2b", param2=b.param2})
|
||||
end
|
||||
if c.name == "my_misc_doors:door2c" then
|
||||
minetest.set_node({x=pos.x+1, y=pos.y, z=pos.z}, {name="my_misc_doors:door2a", param2=c.param2})
|
||||
minetest.set_node({x=pos.x+1,y=pos.y+1,z=pos.z}, {name="my_misc_doors:door2b", param2=c.param2})
|
||||
if c.name == "my_misc_doors:door2c" then
|
||||
minetest.set_node({x=pos.x+1, y=pos.y, z=pos.z}, {name="my_misc_doors:door2a", param2=c.param2})
|
||||
minetest.set_node({x=pos.x+1,y=pos.y+1,z=pos.z}, {name="my_misc_doors:door2b", param2=c.param2})
|
||||
end
|
||||
if d.name == "my_misc_doors:door2c" then
|
||||
minetest.set_node({x=pos.x-1, y=pos.y, z=pos.z}, {name="my_misc_doors:door2a", param2=d.param2})
|
||||
minetest.set_node({x=pos.x-1,y=pos.y+1,z=pos.z}, {name="my_misc_doors:door2b", param2=d.param2})
|
||||
if d.name == "my_misc_doors:door2c" then
|
||||
minetest.set_node({x=pos.x-1, y=pos.y, z=pos.z}, {name="my_misc_doors:door2a", param2=d.param2})
|
||||
minetest.set_node({x=pos.x-1,y=pos.y+1,z=pos.z}, {name="my_misc_doors:door2b", param2=d.param2})
|
||||
end
|
||||
|
||||
end,
|
||||
end,
|
||||
})
|
||||
minetest.register_node("my_misc_doors:door2d", {
|
||||
tiles = {
|
||||
@ -201,6 +192,8 @@ minetest.register_node("my_misc_doors:door2d", {
|
||||
drawtype = "nodebox",
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
diggable = false,
|
||||
pointable = false,
|
||||
groups = {cracky = 1},
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
@ -212,18 +205,12 @@ minetest.register_node("my_misc_doors:door2d", {
|
||||
{-0.25, 0.375, -0.0625, -0.125, 0.5, 0.0625},
|
||||
}
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{0, 0, 0, 0, 0, 0},
|
||||
}
|
||||
},
|
||||
})
|
||||
minetest.register_craft({
|
||||
output = "my_misc_doors:door2a 1",
|
||||
output = "my_misc_doors:door2a",
|
||||
recipe = {
|
||||
{"default:steel_ingot", "default:steelblock", ""},
|
||||
{"default:steel_ingot", "default:steel_ingot", ""},
|
||||
{"default:steelblock", "default:steel_ingot", ""}
|
||||
{"default:steel_ingot", "default:steelblock"},
|
||||
{"default:steel_ingot", "default:steel_ingot"},
|
||||
{"default:steelblock", "default:steel_ingot"}
|
||||
}
|
||||
})
|
||||
|
@ -1,5 +1,3 @@
|
||||
dofile(minetest.get_modpath("my_misc_doors").."/locked.lua")
|
||||
dofile(minetest.get_modpath("my_misc_doors").."/unlocked.lua")
|
||||
dofile(minetest.get_modpath("my_misc_doors").."/bars.lua")
|
||||
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
local mdoor_list = { --Number , Description , Inven Image , Image
|
||||
-- { "1" , "Misc Door 1" , "door1" , "door1"},
|
||||
-- { "2" , "Misc Door 2" , "door2" , "door2"},
|
||||
-- { "2" , "Misc Door 2" , "door2" , "door2"},
|
||||
{ "3" , "Misc Door 3" , "door3" , "door3"},
|
||||
{ "4" , "Misc Door 4" , "door4" , "door4"},
|
||||
-- { "5" , "Misc Door 5" , "door5" , "door5"},
|
||||
@ -8,21 +8,17 @@ local mdoor_list = { --Number , Description , Inven Image , Image
|
||||
}
|
||||
|
||||
|
||||
for i in ipairs(mdoor_list) do
|
||||
local num = mdoor_list[i][1]
|
||||
local desc = mdoor_list[i][2]
|
||||
local inv = mdoor_list[i][3]
|
||||
local img = mdoor_list[i][4]
|
||||
for i = 1,#mdoor_list do
|
||||
local num,desc,inv,img = unpack(mdoor_list[i])
|
||||
|
||||
|
||||
doors.register_door("my_misc_doors:door"..num.."_locked", {
|
||||
description = desc.." Locked",
|
||||
inventory_image = "mymdoors_"..inv.."_inv.png",
|
||||
groups = {choppy=2,cracky=2,door=1},
|
||||
tiles_bottom = {"mymdoors_"..img.."_bottom.png", "mymdoors_"..img.."_edge.png"},
|
||||
tiles_top = {"mymdoors_"..img.."_top.png", "mymdoors_"..img.."_edge.png"},
|
||||
only_placer_can_open = true,
|
||||
})
|
||||
doors.register_door("my_misc_doors:door"..num.."_locked", {
|
||||
description = desc.." Locked",
|
||||
inventory_image = "mymdoors_"..inv.."_inv.png",
|
||||
groups = {choppy=2,cracky=2,door=1},
|
||||
tiles_bottom = {"mymdoors_"..img.."_bottom.png", "mymdoors_"..img.."_edge.png"},
|
||||
tiles_top = {"mymdoors_"..img.."_top.png", "mymdoors_"..img.."_edge.png"},
|
||||
only_placer_can_open = true,
|
||||
})
|
||||
end
|
||||
|
||||
-- Crafts
|
||||
@ -53,7 +49,7 @@ minetest.register_craft({
|
||||
}
|
||||
})
|
||||
minetest.register_craft({
|
||||
output = "my_misc_doors:door4_locked 1",
|
||||
output = "my_misc_doors:door4_locked",
|
||||
recipe = {
|
||||
{"default:cobble", "default:cobble", ""},
|
||||
{"default:cobble", "default:cobble", "default:steel_ingot"},
|
||||
@ -69,7 +65,7 @@ minetest.register_craft({
|
||||
}
|
||||
})
|
||||
minetest.register_craft({
|
||||
output = "my_misc_doors:door6_locked 1",
|
||||
output = "my_misc_doors:door6_locked",
|
||||
recipe = {
|
||||
{"default:steel_ingot", "default:iron_lump", ""},
|
||||
{"default:steel_ingot", "default:iron_lump", "default:steel_ingot"},
|
||||
|
Loading…
x
Reference in New Issue
Block a user