This commit is contained in:
root 2021-10-25 14:38:22 +02:00
parent 7e3de5f6fc
commit a9bba98e20
47 changed files with 2041 additions and 1780 deletions

View file

@ -0,0 +1,27 @@
quiet = 1
codes = true
exclude_files = {
".luarocks/*",
"worldeditadditions/utils/bit.lua"
}
ignore = {
"631", "61[124]",
"542",
"412",
"321/bit",
"21[123]"
}
-- Read-write globals (i.e. they can be defined)
globals = {
"flowerpot"
}
-- Read-only globals
read_globals = {
"minetest",
"default"
}
std = "max"

View file

@ -84,7 +84,7 @@ function flowerpot.register_node(nodename)
local desc = nodedef.description
local name = nodedef.name:gsub(":", "_")
local tiles = {}
local tiles
if nodedef.drawtype == "plantlike" then
tiles = {
@ -109,6 +109,7 @@ function flowerpot.register_node(nodename)
tiles = tiles,
paramtype = "light",
sunlight_propagates = true,
use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "clip" or true,
collision_box = {
type = "fixed",
fixed = {-1/4, -1/2, -1/4, 1/4, -1/8, 1/4},
@ -151,6 +152,7 @@ minetest.register_node("flowerpot:empty", {
},
paramtype = "light",
sunlight_propagates = true,
use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "clip" or true,
collision_box = {
type = "fixed",
fixed = {-1/4, -1/2, -1/4, 1/4, -1/8, 1/4},

View file

@ -1,8 +1,9 @@
-- Load support for intllib.
local MP = minetest.get_modpath(minetest.get_current_modname())
local MP = minetest.get_modpath(minetest.get_current_modname()) .. "/"
local S = minetest.get_translator and minetest.get_translator("mob_horse") or
dofile(MP .. "/intllib.lua")
dofile(MP .. "intllib.lua")
-- 0.4.17 or 5.0 check
local y_off = 20
@ -10,6 +11,7 @@ if minetest.features.object_independent_selectionbox then
y_off = 10
end
-- horse shoes (speed, jump, break, overlay texture)
local shoes = {
["mobs:horseshoe_steel"] = {7, 4, 2, "mobs_horseshoe_steelo.png"},
@ -19,6 +21,7 @@ local shoes = {
["mobs:horseshoe_crystal"] = {11, 6, 9, "mobs_horseshoe_crystalo.png"}
}
-- rideable horse
mobs:register_mob("mob_horse:horse", {
type = "animal",
@ -39,7 +42,7 @@ mobs:register_mob("mob_horse:horse", {
walk_start = 75,
walk_end = 100,
run_start = 75,
run_end = 100,
run_end = 100
},
textures = {
{"mobs_horse.png"}, -- textures by Mjollna
@ -227,16 +230,28 @@ mobs:register_mob("mob_horse:horse", {
end
})
mobs:spawn({
name = "mob_horse:horse",
nodes = {"default:dirt_with_grass", "ethereal:dry_dirt"},
min_light = 14,
interval = 60,
chance = 16000,
min_height = 10,
max_height = 31000,
day_toggle = true,
})
-- check for custom spawn.lua
local input = io.open(MP .. "spawn.lua", "r")
if input then
input:close()
input = nil
dofile(MP .. "spawn.lua")
else
mobs:spawn({
name = "mob_horse:horse",
nodes = {"default:dirt_with_grass", "ethereal:dry_dirt"},
min_light = 14,
interval = 60,
chance = 16000,
min_height = 10,
max_height = 31000,
day_toggle = true
})
end
mobs:register_egg("mob_horse:horse", S("Horse"), "wool_brown.png", 1)
@ -252,14 +267,14 @@ minetest.register_craft({
recipe = {
{"", "default:steelblock", ""},
{"default:steel_ingot", "", "default:steel_ingot"},
{"default:steel_ingot", "", "default:steel_ingot"},
{"default:steel_ingot", "", "default:steel_ingot"}
}
})
-- bronze horseshoes
minetest.register_craftitem(":mobs:horseshoe_bronze", {
description = S("Bronze HorseShoes (use on horse to apply)"),
inventory_image = "mobs_horseshoe_bronze.png",
inventory_image = "mobs_horseshoe_bronze.png"
})
minetest.register_craft({
@ -267,14 +282,14 @@ minetest.register_craft({
recipe = {
{"", "default:bronzeblock", ""},
{"default:bronze_ingot", "", "default:bronze_ingot"},
{"default:bronze_ingot", "", "default:bronze_ingot"},
{"default:bronze_ingot", "", "default:bronze_ingot"}
}
})
-- mese horseshoes
minetest.register_craftitem(":mobs:horseshoe_mese", {
description = S("Mese HorseShoes (use on horse to apply)"),
inventory_image = "mobs_horseshoe_mese.png",
inventory_image = "mobs_horseshoe_mese.png"
})
minetest.register_craft({
@ -282,14 +297,14 @@ minetest.register_craft({
recipe = {
{"", "default:mese", ""},
{"default:mese_crystal_fragment", "", "default:mese_crystal_fragment"},
{"default:mese_crystal_fragment", "", "default:mese_crystal_fragment"},
{"default:mese_crystal_fragment", "", "default:mese_crystal_fragment"}
}
})
-- diamond horseshoes
minetest.register_craftitem(":mobs:horseshoe_diamond", {
description = S("Diamond HorseShoes (use on horse to apply)"),
inventory_image = "mobs_horseshoe_diamond.png",
inventory_image = "mobs_horseshoe_diamond.png"
})
minetest.register_craft({
@ -297,7 +312,7 @@ minetest.register_craft({
recipe = {
{"", "default:diamondblock", ""},
{"default:diamond", "", "default:diamond"},
{"default:diamond", "", "default:diamond"},
{"default:diamond", "", "default:diamond"}
}
})
@ -306,7 +321,7 @@ if minetest.get_modpath("ethereal") then
minetest.register_craftitem(":mobs:horseshoe_crystal", {
description = S("Crystal HorseShoes (use on horse to apply)"),
inventory_image = "mobs_horseshoe_crystal.png",
inventory_image = "mobs_horseshoe_crystal.png"
})
minetest.register_craft({
@ -314,12 +329,13 @@ minetest.register_craft({
recipe = {
{"", "ethereal:crystal_block", ""},
{"ethereal:crystal_ingot", "", "ethereal:crystal_ingot"},
{"ethereal:crystal_ingot", "", "ethereal:crystal_ingot"},
{"ethereal:crystal_ingot", "", "ethereal:crystal_ingot"}
}
})
end
-- lucky blocks
if minetest.get_modpath("lucky_block") then

View file

@ -0,0 +1,72 @@
--[[ Spawn Template, defaults to values shown if line not provided
mobs:spawn({
name = "",
- Name of mob, must be provided e.g. "mymod:my_mob"
nodes = {"group:soil, "group:stone"},
- Nodes to spawn on top of.
neighbors = {"air"},
- Nodes to spawn beside.
min_light = 0,
- Minimum light level.
max_light = 15,
- Maximum light level, 15 is sunlight only.
interval = 30,
- Spawn interval in seconds.
chance = 5000,
- Spawn chance, 1 in every 5000 nodes.
active_object_count = 1,
- Active mobs of this type in area.
min_height = -31000,
- Minimum height level.
max_height = 31000,
- Maximum height level.
day_toggle = nil,
- Daytime toggle, true to spawn during day, false for night, nil for both
on_spawn = nil,
- On spawn function to run when mob spawns in world
on_map_load = nil,
- On map load, when true mob only spawns in newly generated map areas
})
]]--
-- Horse
mobs:spawn({
name = "mob_horse:horse",
nodes = {"default:dirt_with_grass", "ethereal:dry_dirt"},
min_light = 14,
interval = 60,
chance = 16000,
min_height = 10,
max_height = 31000,
day_toggle = true
})

View file

@ -77,7 +77,7 @@ minetest.register_node("morelights_vintage:chain_ceiling_b", {
minetest.register_node("morelights_vintage:block", {
description = S("Vintage Light Block"),
tiles = {"morelights_vintage_block.png"},
tiles = {"morelights_vintage_block_glass.png^morelights_vintage_block_frame.png"},
paramtype = "light",
light_source = minetest.LIGHT_MAX,
groups = {cracky = 2, oddly_breakable_by_hand = 3, handy = 1},
@ -93,9 +93,10 @@ minetest.register_node("morelights_vintage:smallblock", {
fixed = {-1/4, -1/2, -1/4, 1/4, 0, 1/4}
},
tiles = {
"morelights_vintage_block.png",
"morelights_vintage_block.png",
"[combine:16x16:0,4=morelights_vintage_block.png"
"morelights_vintage_block_glass.png^morelights_vintage_block_frame.png",
"morelights_vintage_block_glass.png^morelights_vintage_block_frame.png",
"[combine:16x16:0,4=" ..
"(morelights_vintage_block_glass.png^morelights_vintage_block_frame.png)"
},
use_texture_alpha = "opaque",
paramtype = "light",
@ -116,7 +117,7 @@ minetest.register_node("morelights_vintage:lantern_f", {
drawtype = "mesh",
mesh = "morelights_vintage_lantern_f.obj",
tiles = {
"morelights_vintage_lantern.png",
"morelights_vintage_lantern_frame.png^morelights_vintage_lantern_glass.png",
"morelights_metal_dark_32.png"
},
use_texture_alpha = "opaque",
@ -159,7 +160,7 @@ minetest.register_node("morelights_vintage:lantern_c", {
drawtype = "mesh",
mesh = "morelights_vintage_lantern_c.obj",
tiles = {
"morelights_vintage_lantern.png",
"morelights_vintage_lantern_frame.png^morelights_vintage_lantern_glass.png",
"morelights_metal_dark_32.png"
},
use_texture_alpha = "opaque",
@ -185,7 +186,7 @@ minetest.register_node("morelights_vintage:lantern_w", {
drawtype = "mesh",
mesh = "morelights_vintage_lantern_w.obj",
tiles = {
"morelights_vintage_lantern.png",
"morelights_vintage_lantern_frame.png^morelights_vintage_lantern_glass.png",
"morelights_metal_dark_32.png"
},
use_texture_alpha = "clip",

Binary file not shown.

Before

Width:  |  Height:  |  Size: 272 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 220 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 152 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 422 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 368 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 191 B

View file

@ -14,21 +14,21 @@ local cdoor_list = { --Number , Description , Inven Image , Image
-- {"Castle Door 13" , "door13"},
}
for i in ipairs(cdoor_list) do
local desc = cdoor_list[i][1]
local img = cdoor_list[i][2]
doors.register("my_castle_doors:"..img.."_locked", {
description = desc.." Locked",
inventory_image = "mydoors_"..img.."_inv.png",
groups = {choppy=2,cracky=2,door=1},
tiles = {{ name = "mydoors_"..img..".png", backface_culling = true }},
protected = true,
})
local function add_door(desc, img)
doors.register("my_castle_doors:"..img.."_locked", {
description = desc.." Locked",
inventory_image = "mydoors_"..img.."_inv.png",
groups = {choppy=2,cracky=2,door=1},
tiles = {{ name = "mydoors_"..img..".png", backface_culling = true }},
protected = true,
})
end
for _,cdoor in ipairs(cdoor_list) do
add_door(unpack(cdoor))
end
---[[ Crafts
minetest.register_craft({

View file

@ -14,21 +14,21 @@ local cdoor_list = { --Number , Description , Inven Image , Image
{"Castle Door 13" , "door13"},
}
for i in ipairs(cdoor_list) do
local desc = cdoor_list[i][1]
local img = cdoor_list[i][2]
doors.register_door("my_castle_doors:"..img, {
description = desc,
inventory_image = "mydoors_"..img.."_inv.png",
groups = {choppy=2,cracky=2,door=1},
tiles = {{name="mydoors_"..img..".png", backface_culling = true}},
protected = false,
})
local function add_door(desc, img)
doors.register_door("my_castle_doors:"..img, {
description = desc,
inventory_image = "mydoors_"..img.."_inv.png",
groups = {choppy=2,cracky=2,door=1},
tiles = {{name="mydoors_"..img..".png", backface_culling = true}},
protected = false,
})
end
for _,cdoor in ipairs(cdoor_list) do
add_door(unpack(cdoor))
end
-- Crafts
minetest.register_craft({

View file

@ -3,21 +3,21 @@ local cdoor_list = { --Number , Description , Inven Image , Image
-- {"Cottage Door 2" , "door2"},
}
for i in ipairs(cdoor_list) do
local desc = cdoor_list[i][1]
local img = cdoor_list[i][2]
doors.register_door("my_cottage_doors:"..img.."_locked", {
description = desc.." Locked",
inventory_image = "mycdoors_"..img.."_inv.png",
groups = {choppy=2,cracky=2,door=1},
tiles = {{name="mycdoors_"..img..".png", backface_culling = true}},
protected = true,
})
local function add_door(desc, img)
doors.register_door("my_cottage_doors:"..img.."_locked", {
description = desc.." Locked",
inventory_image = "mycdoors_"..img.."_inv.png",
groups = {choppy=2,cracky=2,door=1},
tiles = {{name="mycdoors_"..img..".png", backface_culling = true}},
protected = true,
})
end
for _,cdoor in ipairs(cdoor_list) do
add_door(unpack(cdoor))
end
-- Crafts
minetest.register_craft({

View file

@ -3,21 +3,21 @@ local cdoor_list = { --Number , Description , Inven Image , Image
{"Cottage Door 2" , "door2"},
}
for i in ipairs(cdoor_list) do
local desc = cdoor_list[i][1]
local img = cdoor_list[i][2]
doors.register_door("my_cottage_doors:"..img, {
description = desc,
inventory_image = "mycdoors_"..img.."_inv.png",
groups = {choppy=2,cracky=2,door=1},
tiles = {{name="mycdoors_"..img..".png", backface_culling = true}},
protected = false,
})
local function add_door(desc, img)
doors.register_door("my_cottage_doors:"..img, {
description = desc,
inventory_image = "mycdoors_"..img.."_inv.png",
groups = {choppy=2,cracky=2,door=1},
tiles = {{name="mycdoors_"..img..".png", backface_culling = true}},
protected = false,
})
end
for _,cdoor in ipairs(cdoor_list) do
add_door(unpack(cdoor))
end
-- Crafts
minetest.register_craft({

View file

@ -6,31 +6,26 @@ local cdoor_list = { --Number , Description , Inven Image , Image
{ "5", "Mese Door" , "mese", "mese_crystal"},
}
local function add_door(num, desc, img, itm)
doors.register_door("my_default_doors:door"..num.."_locked", {
description = desc.." Locked",
inventory_image = "mydoors_"..img.."_inv.png",
groups = {choppy=2,cracky=2,door=1},
tiles = {{name="mydoors_"..img..".png", backface_culling = true}},
protected = true,
})
for i in ipairs(cdoor_list) do
local num = cdoor_list[i][1]
local desc = cdoor_list[i][2]
local img = cdoor_list[i][3]
local itm = cdoor_list[i][4]
doors.register_door("my_default_doors:door"..num.."_locked", {
description = desc.." Locked",
inventory_image = "mydoors_"..img.."_inv.png",
groups = {choppy=2,cracky=2,door=1},
tiles = {{name="mydoors_"..img..".png", backface_culling = true}},
protected = true,
})
-- Crafts
minetest.register_craft({
output = "my_default_doors:door"..num.."_locked 1",
recipe = {
{"", "", ""},
{"default:"..itm, "doors:door_steel", "default:"..itm},
{"", "default:steel_ingot", ""}
}
})
-- Crafts
minetest.register_craft({
output = "my_default_doors:door"..num.."_locked 1",
recipe = {
{"", "", ""},
{"default:"..itm, "doors:door_steel", "default:"..itm},
{"", "default:steel_ingot", ""}
}
})
end
for _,cdoor in ipairs(cdoor_list) do
add_door(unpack(cdoor))
end

View file

@ -6,31 +6,26 @@ local cdoor_list = { --Number , Description , Inven Image , Image
{ "5", "Mese Door" , "mese", "mese_crystal"},
}
local function add_door(num, desc, img, itm)
doors.register_door("my_default_doors:door"..num, {
description = desc,
inventory_image = "mydoors_"..img.."_inv.png",
groups = {choppy=2,cracky=2,door=1},
tiles = {{name="mydoors_"..img..".png", backface_culling = true}},
protected = false,
})
for i in ipairs(cdoor_list) do
local num = cdoor_list[i][1]
local desc = cdoor_list[i][2]
local img = cdoor_list[i][3]
local itm = cdoor_list[i][4]
doors.register_door("my_default_doors:door"..num, {
description = desc,
inventory_image = "mydoors_"..img.."_inv.png",
groups = {choppy=2,cracky=2,door=1},
tiles = {{name="mydoors_"..img..".png", backface_culling = true}},
protected = false,
})
-- Crafts
minetest.register_craft({
output = "my_default_doors:door"..num.." 1",
recipe = {
{"", "", ""},
{"default:"..itm, "doors:door_steel", "default:"..itm},
{"", "", ""}
}
})
-- Crafts
minetest.register_craft({
output = "my_default_doors:door"..num.." 1",
recipe = {
{"", "", ""},
{"default:"..itm, "doors:door_steel", "default:"..itm},
{"", "", ""}
}
})
end
for _,cdoor in ipairs(cdoor_list) do
add_door(unpack(cdoor))
end

View file

@ -8,9 +8,9 @@ local door_wood = { -- color, desc, image
{"black", "Black", "black"},
}
local function my_door_wood_block_stairs(nodename, def)
local mod = string.match (nodename,"(.+):")
local name = string.match (nodename,":(.+)")
minetest.register_node(nodename,def)
local mod = string.match(nodename, "(.+):")
local name = string.match(nodename, ":(.+)")
minetest.register_node(nodename, def)
if minetest.get_modpath("moreblocks") then
stairsplus:register_all(
mod,
@ -33,30 +33,29 @@ local function my_door_wood_block_stairs(nodename, def)
)
end
end
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]
my_door_wood_block_stairs("my_door_wood:wood_"..color, {
description = desc.." Wood",
drawtype = "normal",
paramtype = "light",
tiles = {"mydoors_"..img.."_wood.png"},
paramtype = "light",
groups = {cracky = 2, choppy = 2},
sounds = default.node_sound_wood_defaults(),
local function add_door(color, desc, img)
my_door_wood_block_stairs("my_door_wood:wood_"..color, {
description = desc.." Wood",
drawtype = "normal",
paramtype = "light",
tiles = {"mydoors_"..img.."_wood.png"},
paramtype = "light",
groups = {cracky = 2, choppy = 2},
sounds = default.node_sound_wood_defaults(),
})
})
-- Crafts
minetest.register_craft({
output = "my_door_wood:wood_"..color,
recipe = {
{"default:wood", "", ""},
{"dye:"..color, "", ""},
{"", "", ""}
}
})
-- Crafts
minetest.register_craft({
output = "my_door_wood:wood_"..color,
recipe = {
{"default:wood", "", ""},
{"dye:"..color, "", ""},
{"", "", ""}
}
})
end
for _,door in ipairs(door_wood) do
add_door(unpack(door))
end

View file

@ -9,21 +9,21 @@ local fdoor_list = { --Number , Description , Inven Image , Image
{"Fancy Door 8" , "door8"},
}
for i in ipairs(fdoor_list) do
local desc = fdoor_list[i][1]
local img = fdoor_list[i][2]
doors.register_door("my_fancy_doors:"..img.."_locked", {
description = desc.." Locked",
inventory_image = "myfdoors_"..img.."_inv.png",
groups = {choppy=2,cracky=2,door=1},
tiles = {{ name = "myfdoors_"..img..".png", backface_culling = true }},
protected = true,
})
local function add_door(desc, img)
doors.register_door("my_fancy_doors:"..img.."_locked", {
description = desc.." Locked",
inventory_image = "myfdoors_"..img.."_inv.png",
groups = {choppy=2,cracky=2,door=1},
tiles = {{ name = "myfdoors_"..img..".png", backface_culling = true }},
protected = true,
})
end
for _,fdoor in ipairs(fdoor_list) do
add_door(unpack(fdoor))
end
-- Crafts
minetest.register_craft({

View file

@ -9,21 +9,21 @@ local fdoor_list = { --Number , Description , Inven Image , Image
-- {"Fancy Door 8" , "door8"},
}
for i in ipairs(fdoor_list) do
local desc = fdoor_list[i][1]
local img = fdoor_list[i][2]
doors.register_door("my_fancy_doors:"..img, {
description = desc,
inventory_image = "myfdoors_"..img.."_inv.png",
groups = {choppy=2,cracky=2,door=1},
tiles = {{ name = "myfdoors_"..img..".png", backface_culling = true }},
protected = false,
})
local function add_door(desc, img)
doors.register_door("my_fancy_doors:"..img, {
description = desc,
inventory_image = "myfdoors_"..img.."_inv.png",
groups = {choppy=2,cracky=2,door=1},
tiles = {{ name = "myfdoors_"..img..".png", backface_culling = true }},
protected = false,
})
end
for _,fdoor in ipairs(fdoor_list) do
add_door(unpack(fdoor))
end
-- Crafts
minetest.register_craft({

View file

@ -1,190 +1,210 @@
local doorcolors = {"white","red","black"}
for i = 1,#doorcolors do
local col = doorcolors[i]
minetest.register_node("my_future_doors:door1a_"..col, {
description = "Door 1a",
tiles = {
"myndoors_door1_"..col..".png",
"myndoors_door1_"..col..".png",
"myndoors_door1_"..col..".png",
"myndoors_door1_"..col..".png",
"myndoors_door1_"..col.."b.png",
"myndoors_door1_"..col.."b.png"
},
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
groups = {cracky = 3},
node_box = {
type = "fixed",
fixed = {
{-0.4375, -0.5, -0.1875, 0.4375, 0.5, -0.0625},
{-0.5, -0.5, -0.5, -0.4375, 0.5, 0.5},
{0.4375, -0.5, -0.5, 0.5, 0.5, 0.5},
{0.4375, -0.5, 0.5, 0.625, 0.5, 0.5625},
{0.4375, -0.5, -0.5625, 0.625, 0.5, -0.5},
{-0.625, -0.5, -0.5625, -0.4375, 0.5, -0.5},
{-0.625, -0.5, 0.5, -0.4375, 0.5, 0.5625},
}
},
selection_box = {
type = "fixed",
fixed = {
{-0.4375, -0.5, -0.1875, 0.4375, 1.5, -0.0625}, --door
{0.4375, -0.5, -0.5625, 0.625, 1.4375, 0.5625}, --right
{-0.625, -0.5, -0.5625, -0.4375, 1.4375, 0.5625}, --left
{-0.625, 1.4375, -0.5625, 0.625, 1.625, 0.5625}, --top
}
},
local function add_door(col)
minetest.register_node("my_future_doors:door1a_"..col, {
description = "Door 1a",
tiles = {
"myndoors_door1_"..col..".png",
"myndoors_door1_"..col..".png",
"myndoors_door1_"..col..".png",
"myndoors_door1_"..col..".png",
"myndoors_door1_"..col.."b.png",
"myndoors_door1_"..col.."b.png"
},
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
groups = {cracky = 3},
node_box = {
type = "fixed",
fixed = {
{-0.4375, -0.5, -0.1875, 0.4375, 0.5, -0.0625},
{-0.5, -0.5, -0.5, -0.4375, 0.5, 0.5},
{ 0.4375, -0.5, -0.5, 0.5, 0.5, 0.5},
{ 0.4375, -0.5, 0.5, 0.625, 0.5, 0.5625},
{ 0.4375, -0.5, -0.5625, 0.625, 0.5, -0.5},
{-0.625, -0.5, -0.5625,-0.4375, 0.5, -0.5},
{-0.625, -0.5, 0.5, -0.4375, 0.5, 0.5625},
}
},
selection_box = {
type = "fixed",
fixed = {
{-0.4375, -0.5, -0.1875, 0.4375, 1.5, -0.0625}, --door
{ 0.4375, -0.5, -0.5625, 0.625, 1.4375, 0.5625}, --right
{-0.625, -0.5, -0.5625, -0.4375, 1.4375, 0.5625}, --left
{-0.625, 1.4375,-0.5625, 0.625, 1.625, 0.5625}, --top
}
},
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
return minetest.item_place(itemstack, placer, pointed_thing)
end,
after_place_node = function(pos, placer, itemstack, pointed_thing)
local node = minetest.get_node(pos)
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z},{name="my_future_doors:door1b_"..col,param2=node.param2})
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)
if node.name == "my_future_doors:door1a_"..col then
minetest.set_node(pos,{name="my_future_doors:door1c_"..col,param2=node.param2})
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z},{name="my_future_doors:door1d_"..col,param2=node.param2})
timer:start(3)
end
end,
})
minetest.register_node("my_future_doors:door1b_"..col, {
tiles = {
"myndoors_door1_"..col..".png",
"myndoors_door1_"..col..".png",
"myndoors_door1_"..col..".png",
"myndoors_door1_"..col..".png",
"myndoors_door1_"..col.."b.png",
"myndoors_door1_"..col.."b.png"
},
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
groups = {cracky = 1},
node_box = {
type = "fixed",
fixed = {
{-0.4375, -0.5, -0.1875, 0.4375, 0.5, -0.0625},
{-0.5, -0.5, -0.5, -0.4375, 0.5, 0.5},
{0.4375, -0.5, -0.5, 0.5, 0.5, 0.5},
{0.4375, -0.5, 0.5, 0.625, 0.5, 0.5625},
{0.4375, -0.5, -0.5625, 0.625, 0.5, -0.5},
{-0.625, -0.5, -0.5625, -0.4375, 0.5, -0.5},
{-0.625, -0.5, 0.5, -0.4375, 0.5, 0.5625},
{-0.5, 0.4375, -0.5, 0.5, 0.5, 0.5},
{-0.625, 0.4375, -0.5625, 0.625, 0.625, -0.5},
{-0.625, 0.4375, 0.5, 0.625, 0.625, 0.5625},
on_place = function(itemstack, placer, pointed_thing)
local pos1 = pointed_thing.above
local pos2 = vector.add(pos1, {x=0,y=1,z=0})
if not placer or not placer:is_player() then
return
end
if not minetest.registered_nodes[minetest.get_node(pos1).name].buildable_to or
not minetest.registered_nodes[minetest.get_node(pos2).name].buildable_to then
minetest.chat_send_player(placer:get_player_name(), "Not enough room")
return
end
local player_name = placer:get_player_name()
if minetest.is_protected(pos1, player_name) then
minetest.record_protection_violation(pos1, player_name)
return
end
if minetest.is_protected(pos2, player_name) then
minetest.record_protection_violation(pos2, player_name)
return
end
return minetest.item_place(itemstack, placer, pointed_thing)
end,
after_place_node = function(pos, placer, itemstack, pointed_thing)
local node = minetest.get_node(pos)
minetest.set_node(vector.add(pos, {x=0,y=1,z=0}), {name="my_future_doors:door1b_"..col, param2=node.param2})
end,
after_destruct = function(pos, oldnode)
minetest.set_node(vector.add(pos, {x=0,y=1,z=0}), {name="air"})
end,
on_rightclick = function(pos, node, player, itemstack, pointed_thing)
if node.name == "my_future_doors:door1a_"..col then
local timer = minetest.get_node_timer(pos)
minetest.set_node(pos, {name="my_future_doors:door1c_"..col, param2=node.param2})
minetest.set_node(vector.add(pos, {x=0,y=1,z=0}), {name="my_future_doors:door1d_"..col, param2=node.param2})
timer:start(3)
end
end,
})
minetest.register_node("my_future_doors:door1b_"..col, {
tiles = {
"myndoors_door1_"..col..".png",
"myndoors_door1_"..col..".png",
"myndoors_door1_"..col..".png",
"myndoors_door1_"..col..".png",
"myndoors_door1_"..col.."b.png",
"myndoors_door1_"..col.."b.png"
},
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
groups = {cracky = 1},
node_box = {
type = "fixed",
fixed = {
{-0.4375, -0.5, -0.1875, 0.4375, 0.5, -0.0625},
{-0.5, -0.5, -0.5, -0.4375, 0.5, 0.5},
{ 0.4375, -0.5, -0.5, 0.5, 0.5, 0.5},
{ 0.4375, -0.5, 0.5, 0.625, 0.5, 0.5625},
{ 0.4375, -0.5, -0.5625, 0.625, 0.5, -0.5},
{-0.625, -0.5, -0.5625, -0.4375, 0.5, -0.5},
{-0.625, -0.5, 0.5, -0.4375, 0.5, 0.5625},
{-0.5, 0.4375, -0.5, 0.5, 0.5, 0.5},
{-0.625, 0.4375, -0.5625, 0.625, 0.625, -0.5},
{-0.625, 0.4375, 0.5, 0.625, 0.625, 0.5625},
}
},
selection_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, -0.5, -0.5, -0.5},
}
},
})
minetest.register_node("my_future_doors:door1c_"..col, {
tiles = {
"myndoors_door1_"..col..".png",
"myndoors_door1_"..col..".png",
"myndoors_door1_"..col..".png",
"myndoors_door1_"..col..".png",
"myndoors_door1_"..col.."b.png",
"myndoors_door1_"..col.."b.png"
},
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
groups = {cracky = 1},
node_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, -0.4375, 0.5, 0.5},
{ 0.4375, -0.5, -0.5, 0.5, 0.5, 0.5},
{ 0.4375, -0.5, 0.5, 0.625, 0.5, 0.5625},
{ 0.4375, -0.5, -0.5625, 0.625, 0.5, -0.5},
{-0.625, -0.5, -0.5625, -0.4375, 0.5, -0.5},
{-0.625, -0.5, 0.5, -0.4375, 0.5, 0.5625},
}
},
selection_box = {
type = "fixed",
fixed = {
{ 0.4375, -0.5, -0.5625, 0.625, 1.4375, 0.5625}, --right
{-0.625, -0.5, -0.5625, -0.4375, 1.4375, 0.5625}, --left
{-0.625, 1.4375, -0.5625, 0.625, 1.625, 0.5625}, --top
}
},
drop = "my_future_doors:door1a_"..col,
after_place_node = function(pos, placer, itemstack, pointed_thing)
local node = minetest.get_node(pos)
local timer = minetest.get_node_timer(pos)
minetest.set_node(vector.add(pos, {x=0,y=1,z=0}), {name="my_future_doors:door1d_"..col, param2=node.param2})
timer:start(3)
end,
after_destruct = function(pos, oldnode)
minetest.set_node(vector.add(pos, {x=0,y=1,z=0}), {name="air"})
end,
on_timer = function(pos, elapsed)
local node = minetest.get_node(pos)
minetest.set_node(pos, {name="my_future_doors:door1a_"..col, param2=node.param2})
minetest.set_node(vector.add(pos, {x=0,y=1,z=0}), {name="my_future_doors:door1b_"..col, param2=node.param2})
end,
})
minetest.register_node("my_future_doors:door1d_"..col, {
tiles = {
"myndoors_door1_"..col..".png",
"myndoors_door1_"..col..".png",
"myndoors_door1_"..col..".png",
"myndoors_door1_"..col..".png",
"myndoors_door1_"..col.."b.png",
"myndoors_door1_"..col.."b.png"
},
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
groups = {cracky = 1},
node_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, -0.4375, 0.5, 0.5},
{ 0.4375, -0.5, -0.5, 0.5, 0.5, 0.5},
{ 0.4375, -0.5, 0.5, 0.625, 0.5, 0.5625},
{ 0.4375, -0.5, -0.5625, 0.625, 0.5, -0.5},
{-0.625, -0.5, -0.5625, -0.4375, 0.5, -0.5},
{-0.625, -0.5, 0.5, -0.4375, 0.4375, 0.5625},
{-0.5, 0.4375, -0.5, 0.5, 0.5, 0.5},
{-0.625, 0.4375, -0.5625, 0.625, 0.625, -0.5},
{-0.625, 0.4375, 0.5, 0.625, 0.625, 0.5625},
}
},
selection_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, -0.5, -0.5, -0.5},
}
},
})
minetest.register_craft({
output = "my_future_doors:door1a_"..col.." 1",
recipe = {
{"my_door_wood:wood_"..col, "wool:"..col, "my_door_wood:wood_"..col},
{"wool:"..col, "my_door_wood:wood_"..col, "wool:"..col},
{"my_door_wood:wood_"..col, "wool:"..col, "my_door_wood:wood_"..col}
}
},
selection_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, -0.5, -0.5, -0.5},
}
},
})minetest.register_node("my_future_doors:door1c_"..col, {
tiles = {
"myndoors_door1_"..col..".png",
"myndoors_door1_"..col..".png",
"myndoors_door1_"..col..".png",
"myndoors_door1_"..col..".png",
"myndoors_door1_"..col.."b.png",
"myndoors_door1_"..col.."b.png"
},
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
groups = {cracky = 1},
node_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, -0.4375, 0.5, 0.5},
{0.4375, -0.5, -0.5, 0.5, 0.5, 0.5},
{0.4375, -0.5, 0.5, 0.625, 0.5, 0.5625},
{0.4375, -0.5, -0.5625, 0.625, 0.5, -0.5},
{-0.625, -0.5, -0.5625, -0.4375, 0.5, -0.5},
{-0.625, -0.5, 0.5, -0.4375, 0.5, 0.5625},
}
},
selection_box = {
type = "fixed",
fixed = {
{0.4375, -0.5, -0.5625, 0.625, 1.4375, 0.5625}, --right
{-0.625, -0.5, -0.5625, -0.4375, 1.4375, 0.5625}, --left
{-0.625, 1.4375, -0.5625, 0.625, 1.625, 0.5625}, --top
}
},
after_place_node = function(pos, placer, itemstack, pointed_thing)
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z},{name="my_future_doors:door1d_"..col,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)
minetest.set_node(pos,{name="my_future_doors:door1a_"..col,param2=node.param2})
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z},{name="my_future_doors:door1b_"..col,param2=node.param2})
end,
})
minetest.register_node("my_future_doors:door1d_"..col, {
tiles = {
"myndoors_door1_"..col..".png",
"myndoors_door1_"..col..".png",
"myndoors_door1_"..col..".png",
"myndoors_door1_"..col..".png",
"myndoors_door1_"..col.."b.png",
"myndoors_door1_"..col.."b.png"
},
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
groups = {cracky = 1},
node_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, -0.4375, 0.5, 0.5},
{0.4375, -0.5, -0.5, 0.5, 0.5, 0.5},
{0.4375, -0.5, 0.5, 0.625, 0.5, 0.5625},
{0.4375, -0.5, -0.5625, 0.625, 0.5, -0.5},
{-0.625, -0.5, -0.5625, -0.4375, 0.5, -0.5},
{-0.625, -0.5, 0.5, -0.4375, 0.4375, 0.5625},
{-0.5, 0.4375, -0.5, 0.5, 0.5, 0.5},
{-0.625, 0.4375, -0.5625, 0.625, 0.625, -0.5},
{-0.625, 0.4375, 0.5, 0.625, 0.625, 0.5625},
}
},
selection_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, -0.5, -0.5, -0.5},
}
},
})
minetest.register_craft({
output = "my_future_doors:door1a_"..col.." 1",
recipe = {
{"my_door_wood:wood_"..col, "wool:"..col, "my_door_wood:wood_"..col},
{"wool:"..col, "my_door_wood:wood_"..col, "wool:"..col},
{"my_door_wood:wood_"..col, "wool:"..col, "my_door_wood:wood_"..col}
}
})
})
end
for _,col in ipairs(doorcolors) do
add_door(col)
end

View file

@ -1,270 +1,247 @@
local doors = {
{"my_future_doors:door2a","my_future_doors:door2b","my_future_doors:door2c","my_future_doors:door2d","2","Steel"},
{"my_future_doors:door3a","my_future_doors:door3b","my_future_doors:door3c","my_future_doors:door3d","3","Squared"},
{"my_future_doors:door4a","my_future_doors:door4b","my_future_doors:door4c","my_future_doors:door4d","4","Dark"},
{"my_future_doors:door6a","my_future_doors:door6b","my_future_doors:door6c","my_future_doors:door6d","6","Points"},
{"my_future_doors:door7a","my_future_doors:door7b","my_future_doors:door7c","my_future_doors:door7d","7","Snow Flake"},
{"my_future_doors:door8a","my_future_doors:door8b","my_future_doors:door8c","my_future_doors:door8d","8","Blue Steel"},
{"my_future_doors:door9a","my_future_doors:door9b","my_future_doors:door9c","my_future_doors:door9d","9","Tan Steel"},
}
local recipes = {
{{"default:steel_ingot", "default:steelblock", ""},
{"default:steel_ingot", "default:steel_ingot", ""},
{"default:steelblock", "default:steel_ingot", ""}},
{{"default:steel_ingot","default:steel_ingot", ""},
{"default:steel_ingot", "default:steel_ingot", ""},
{"default:steelblock", "default:steelblock", ""}},
{{"default:steel_ingot","default:steel_ingot", ""},
{"default:steel_ingot", "default:steel_ingot", "dye:black"},
{"default:steelblock", "default:steelblock", ""}},
{{"default:steel_ingot","default:steel_ingot", ""},
{"default:steelblock", "default:steelblock", ""},
{"default:steel_ingot", "default:steel_ingot", ""}},
{{"default:steel_ingot", "default:steelblock", ""},
{"default:steel_ingot", "default:steel_ingot", ""},
{ "default:steel_ingot", "default:steelblock",""}},
{{"default:steel_ingot", "default:steelblock", ""},
{"default:steel_ingot", "default:steel_ingot", "dye:blue"},
{ "default:steel_ingot", "default:steelblock",""}},
{{"default:steel_ingot", "default:steelblock", ""},
{"default:steel_ingot", "default:steel_ingot", "dye:brown"},
{ "default:steel_ingot", "default:steelblock",""}},
{"my_future_doors:door2a","my_future_doors:door2b","my_future_doors:door2c","my_future_doors:door2d","2","Steel",
{{"default:steel_ingot", "default:steelblock", ""},
{"default:steel_ingot", "default:steel_ingot", ""},
{"default:steelblock", "default:steel_ingot", ""}}},
{"my_future_doors:door3a","my_future_doors:door3b","my_future_doors:door3c","my_future_doors:door3d","3","Squared",
{{"default:steel_ingot","default:steel_ingot", ""},
{"default:steel_ingot", "default:steel_ingot", ""},
{"default:steelblock", "default:steelblock", ""}}},
{"my_future_doors:door4a","my_future_doors:door4b","my_future_doors:door4c","my_future_doors:door4d","4","Dark",
{{"default:steel_ingot","default:steel_ingot", ""},
{"default:steel_ingot", "default:steel_ingot", "dye:black"},
{"default:steelblock", "default:steelblock", ""}}},
{"my_future_doors:door6a","my_future_doors:door6b","my_future_doors:door6c","my_future_doors:door6d","6","Points",
{{"default:steel_ingot","default:steel_ingot", ""},
{"default:steelblock", "default:steelblock", ""},
{"default:steel_ingot", "default:steel_ingot", ""}}},
{"my_future_doors:door7a","my_future_doors:door7b","my_future_doors:door7c","my_future_doors:door7d","7","Snow Flake",
{{"default:steel_ingot", "default:steelblock", ""},
{"default:steel_ingot", "default:steel_ingot", ""},
{ "default:steel_ingot", "default:steelblock",""}}},
{"my_future_doors:door8a","my_future_doors:door8b","my_future_doors:door8c","my_future_doors:door8d","8","Blue Steel",
{{"default:steel_ingot", "default:steelblock", ""},
{"default:steel_ingot", "default:steel_ingot", "dye:blue"},
{ "default:steel_ingot", "default:steelblock",""}}},
{"my_future_doors:door9a","my_future_doors:door9b","my_future_doors:door9c","my_future_doors:door9d","9","Tan Steel",
{{"default:steel_ingot", "default:steelblock", ""},
{"default:steel_ingot", "default:steel_ingot", "dye:brown"},
{ "default:steel_ingot", "default:steelblock",""}}},
}
for i in ipairs (doors) do
local doora = doors[i][1]
local doorb = doors[i][2]
local doorc = doors[i][3]
local doord = doors[i][4]
local num = doors[i][5]
local des = doors[i][6]
local recipe = recipes[i]
local function onplace(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 == doora then
minetest.set_node(pt, {name=doora, param2=p4})
minetest.set_node(pt2, {name=doorb, param2=p4})
else
minetest.set_node(pt, {name=doora, param2=p2})
minetest.set_node(pt2, {name=doorb, param2=p2})
end
itemstack: take_item()
local function add_door(doora, doorb, doorc, doord, num, des, recipe)
local function onplace(itemstack, placer, pointed_thing)
local pos1 = pointed_thing.above
local pos2 = vector.add(pos1, {x=0,y=1,z=0})
if not placer or not placer:is_player() then
return
end
if not minetest.registered_nodes[minetest.get_node(pos1).name].buildable_to or
not minetest.registered_nodes[minetest.get_node(pos2).name].buildable_to then
minetest.chat_send_player(placer:get_player_name(), "Not enough room")
return
end
local p2 = minetest.dir_to_facedir(placer:get_look_dir())
local p4 = (p2+2)%4
local pos3 = vector.add(pos1, minetest.facedir_to_dir((p2-1)%4))
local player_name = placer:get_player_name()
if minetest.is_protected(pos1, player_name) then
minetest.record_protection_violation(pos1, player_name)
return
end
if minetest.is_protected(pos2, player_name) then
minetest.record_protection_violation(pos2, player_name)
return
end
if minetest.get_node(pos3).name == doora then
minetest.set_node(pos1, {name=doora, param2=p4})
minetest.set_node(pos2, {name=doorb, param2=p4})
else
minetest.set_node(pos1, {name=doora, param2=p2})
minetest.set_node(pos2, {name=doorb, param2=p2})
end
if not (minetest.settings:get_bool("creative_mode") or minetest.check_player_privs(placer:get_player_name(), {creative = true})) then
itemstack:take_item()
end
return itemstack
end
end
local function afterdestruct(pos, oldnode)
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z},{name="air"})
end
local function afterdestruct(pos, oldnode)
minetest.set_node(vector.add(pos, {x=0,y=1,z=0}), {name="air"})
end
local function rightclick(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})
local function rightclick(pos, node, player, itemstack, pointed_thing)
local timer = minetest.get_node_timer(pos)
minetest.set_node(pos, {name=doorc, param2=node.param2})
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z}, {name=doord, param2=node.param2})
minetest.set_node(vector.add(pos, {x=0,y=1,z=0}), {name=doord, param2=node.param2})
if a.name == doora then
minetest.set_node({x=pos.x, y=pos.y, z=pos.z-1}, {name=doorc, param2=a.param2})
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z-1}, {name=doord, param2=a.param2})
end
if b.name == doora then
minetest.set_node({x=pos.x, y=pos.y, z=pos.z+1}, {name=doorc, param2=b.param2})
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z+1}, {name=doord, param2=b.param2})
end
if c.name == doora then
minetest.set_node({x=pos.x+1, y=pos.y, z=pos.z}, {name=doorc, param2=c.param2})
minetest.set_node({x=pos.x+1,y=pos.y+1,z=pos.z}, {name=doord, param2=c.param2})
end
if d.name == doora then
minetest.set_node({x=pos.x-1, y=pos.y, z=pos.z}, {name=doorc, param2=d.param2})
minetest.set_node({x=pos.x-1,y=pos.y+1,z=pos.z}, {name=doord, param2=d.param2})
-- Open neighbouring doors
for i=0,3 do
local dir = minetest.facedir_to_dir(i)
local neighbour_pos = vector.add(pos, dir)
local neighbour = minetest.get_node(neighbour_pos)
if neighbour.name == "my_misc_doors:door2a" then
minetest.set_node(neighbour_pos, {name=doorc, param2=neighbour.param2})
minetest.set_node(vector.add(neighbour_pos, {x=0,y=1,z=0}), {name=doord, param2=neighbour.param2})
end
end
timer:start(3)
timer:start(3)
end
end
local function afterplace(pos, placer, itemstack, pointed_thing)
local node = minetest.get_node(pos)
local timer = minetest.get_node_timer(pos)
minetest.set_node(vector.add(pos, {x=0,y=1,z=0}), {name=doord, param2=node.param2})
timer:start(3)
end
local function afterplace(pos, placer, itemstack, pointed_thing)
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z},{name=doord,param2=nodeu.param2})
end
local function ontimer(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})
local function ontimer(pos, elapsed)
local node = minetest.get_node(pos)
minetest.set_node(pos, {name=doora, param2=node.param2})
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z}, {name=doorb, param2=node.param2})
minetest.set_node(vector.add(pos, {x=0,y=1,z=0}), {name=doorb, param2=node.param2})
if a.name == doorc then
minetest.set_node({x=pos.x, y=pos.y, z=pos.z-1}, {name=doora, param2=a.param2})
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z-1}, {name=doorb, param2=a.param2})
end
if b.name == doorc then
minetest.set_node({x=pos.x, y=pos.y, z=pos.z+1}, {name=doora, param2=b.param2})
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z+1}, {name=doorb, param2=b.param2})
end
if c.name == doorc then
minetest.set_node({x=pos.x+1, y=pos.y, z=pos.z}, {name=doora, param2=c.param2})
minetest.set_node({x=pos.x+1,y=pos.y+1,z=pos.z}, {name=doorb, param2=c.param2})
end
if d.name == doorc then
minetest.set_node({x=pos.x-1, y=pos.y, z=pos.z}, {name=doora, param2=d.param2})
minetest.set_node({x=pos.x-1,y=pos.y+1,z=pos.z}, {name=doorb, param2=d.param2})
-- Close neighbouring doors
for i=0,3 do
local dir = minetest.facedir_to_dir(i)
local neighbour_pos = vector.add(pos, dir)
local neighbour = minetest.get_node(neighbour_pos)
if neighbour.name == "my_misc_doors:door2c" then
minetest.set_node(neighbour_pos, {name=doora, param2=neighbour.param2})
minetest.set_node(vector.add(neighbour_pos, {x=0,y=1,z=0}), {name=doorb, param2=neighbour.param2})
end
end
end
minetest.register_node(doora, {
description = des.." Sliding Door",
inventory_image = "myndoors_door"..num.."a_inv.png",
wield_image = "myndoors_door"..num.."a_inv.png",
tiles = {
"myndoors_door"..num.."a_edge.png",
"myndoors_door"..num.."a_edge.png",
"myndoors_door"..num.."a_edge.png",
"myndoors_door"..num.."a_edge.png",
"myndoors_door"..num.."a_bottom.png",
"myndoors_door"..num.."a_bottom.png^[transformFX"
},
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
groups = {cracky = 3},
node_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.0625, 0.5, 0.5, 0.0625}
}
},
selection_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.0625, 0.5, 1.5, 0.0625}
}
},
on_place = onplace,
after_destruct = afterdestruct,
on_rightclick = rightclick,
})
minetest.register_node(doorb, {
tiles = {
"myndoors_door"..num.."a_edge.png",
"myndoors_door"..num.."a_edge.png",
"myndoors_door"..num.."a_edge.png",
"myndoors_door"..num.."a_edge.png",
"myndoors_door"..num.."a_bottom.png^[transformFY",
"myndoors_door"..num.."a_bottom.png^[transformFX^[transformFY"
},
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
groups = {cracky = 1},
node_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.0625, 0.5, 0.5, 0.0625}
}
},
selection_box = {
type = "fixed",
fixed = {
{0, 0, 0, 0, 0, 0},
}
},
})
minetest.register_node(doorc, {
tiles = {
"myndoors_door"..num.."a_edge.png",
"myndoors_door"..num.."a_edge.png",
"myndoors_door"..num.."a_edge.png",
"myndoors_door"..num.."a_edge.png",
"myndoors_door"..num.."a_bottomo.png",
"myndoors_door"..num.."a_bottomo.png^[transformFX"
},
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
drop = doora,
groups = {cracky = 1},
node_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.0625, -0.25, 0.5, 0.0625},
}
},
selection_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.0625, -0.25, 1.5, 0.0625},
}
},
after_place_node = afterplace,
after_destruct = afterdestruct,
on_timer = ontimer,
})
minetest.register_node(doord, {
tiles = {
"myndoors_door"..num.."a_edge.png",
"myndoors_door"..num.."a_edge.png",
"myndoors_door"..num.."a_edge.png",
"myndoors_door"..num.."a_edge.png",
"myndoors_door"..num.."a_bottomo.png^[transformFY",
"myndoors_door"..num.."a_bottomo.png^[transformFX^[transformFY"
},
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
groups = {cracky = 1},
node_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.0625, -0.25, 0.5, 0.0625},
}
},
selection_box = {
type = "fixed",
fixed = {
{0, 0, 0, 0, 0, 0},
}
},
})
minetest.register_craft({
output = "my_future_doors:door"..num.."a 2",
recipe = recipe
})
end
minetest.register_node(doora, {
description = des.." Sliding Door",
inventory_image = "myndoors_door"..num.."a_inv.png",
wield_image = "myndoors_door"..num.."a_inv.png",
tiles = {
"myndoors_door"..num.."a_edge.png",
"myndoors_door"..num.."a_edge.png",
"myndoors_door"..num.."a_edge.png",
"myndoors_door"..num.."a_edge.png",
"myndoors_door"..num.."a_bottom.png",
"myndoors_door"..num.."a_bottom.png^[transformFX"
},
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
groups = {cracky = 3},
node_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.0625, 0.5, 0.5, 0.0625}
}
},
selection_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.0625, 0.5, 1.5, 0.0625}
}
},
on_place = onplace,
after_destruct = afterdestruct,
on_rightclick = rightclick,
})
minetest.register_node(doorb, {
tiles = {
"myndoors_door"..num.."a_edge.png",
"myndoors_door"..num.."a_edge.png",
"myndoors_door"..num.."a_edge.png",
"myndoors_door"..num.."a_edge.png",
"myndoors_door"..num.."a_bottom.png^[transformFY",
"myndoors_door"..num.."a_bottom.png^[transformFX^[transformFY"
},
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
groups = {cracky = 1},
node_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.0625, 0.5, 0.5, 0.0625}
}
},
selection_box = {
type = "fixed",
fixed = {
{0, 0, 0, 0, 0, 0},
}
},
})minetest.register_node(doorc, {
tiles = {
"myndoors_door"..num.."a_edge.png",
"myndoors_door"..num.."a_edge.png",
"myndoors_door"..num.."a_edge.png",
"myndoors_door"..num.."a_edge.png",
"myndoors_door"..num.."a_bottomo.png",
"myndoors_door"..num.."a_bottomo.png^[transformFX"
},
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
drop = doora,
groups = {cracky = 1},
node_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.0625, -0.25, 0.5, 0.0625},
}
},
selection_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.0625, -0.25, 1.5, 0.0625},
}
},
after_place_node = afterplace,
after_destruct = afterdestruct,
on_timer = ontimer,
})
minetest.register_node(doord, {
tiles = {
"myndoors_door"..num.."a_edge.png",
"myndoors_door"..num.."a_edge.png",
"myndoors_door"..num.."a_edge.png",
"myndoors_door"..num.."a_edge.png",
"myndoors_door"..num.."a_bottomo.png^[transformFY",
"myndoors_door"..num.."a_bottomo.png^[transformFX^[transformFY"
},
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
groups = {cracky = 1},
node_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.0625, -0.25, 0.5, 0.0625},
}
},
selection_box = {
type = "fixed",
fixed = {
{0, 0, 0, 0, 0, 0},
}
},
})
minetest.register_craft({
output = "my_future_doors:door"..num.."a 2",
recipe = recipe
})
for i, door in ipairs(doors) do
add_door(unpack(door))
end

View file

@ -11,11 +11,11 @@ minetest.register_node("my_garage_door:garage_door", {
node_box = {
type = "fixed",
fixed = {
{-1.5, -0.5, -0.125, 1.5, 0.5, -0.0625},
{-1.5, -0.5, -0.1875, 1.5, -0.3125, -0.0625},
{-1.5, -0.5, -0.125, 1.5, 0.5, -0.0625},
{-1.5, -0.5, -0.1875, 1.5, -0.3125, -0.0625},
{-1.5, -0.25, -0.1875, 1.5, -0.0624999, -0.0625},
{-1.5, 0, -0.1875, 1.5, 0.1875, -0.0625},
{-1.5, 0.25, -0.1875, 1.5, 0.4375, -0.0625},
{-1.5, 0, -0.1875, 1.5, 0.1875, -0.0625},
{-1.5, 0.25, -0.1875, 1.5, 0.4375, -0.0625},
}
},
selection_box = {
@ -25,38 +25,74 @@ minetest.register_node("my_garage_door:garage_door", {
}
},
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})
local pos1 = pointed_thing.above
local pos2 = vector.add(pos1, {x=0,y=1,z=0})
if not placer or not placer:is_player() then
return
end
if not minetest.registered_nodes[minetest.get_node(pos1).name].buildable_to or
not minetest.registered_nodes[minetest.get_node(pos2).name].buildable_to then
minetest.chat_send_player(placer:get_player_name(), "Not enough room")
return
end
local player_name = placer:get_player_name()
if minetest.is_protected(pos1, player_name) then
minetest.record_protection_violation(pos1, player_name)
return
end
if minetest.is_protected(pos2, player_name) then
minetest.record_protection_violation(pos2, player_name)
return
end
local p2 = minetest.dir_to_facedir(placer:get_look_dir())
minetest.set_node(pos1, {name = "my_garage_door:garage_door", param2 = p2})
minetest.set_node(pos2, {name = "my_garage_door:garage_door_top", param2 = p2})
if not (minetest.settings:get_bool("creative_mode") or minetest.check_player_privs(placer:get_player_name(), {creative = true})) then
itemstack:take_item()
end
return itemstack
end,
after_destruct = function(pos, oldnode)
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z},{name = "air"})
minetest.set_node(vector.add(pos, {x=0,y=1,z=0}), {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}
local p2 = node.param2
local dir = minetest.facedir_to_dir(p2)
local above = vector.add(pos, {x=0,y=1,z=0})
local t1 = vector.add(above, dir)
local t2 = vector.add(t1, dir)
if not player or not player:is_player() then
return
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
if not minetest.registered_nodes[minetest.get_node(t1).name].buildable_to or
not minetest.registered_nodes[minetest.get_node(t2).name].buildable_to then
minetest.chat_send_player(player:get_player_name(), "Not enough room to open")
return
end
local player_name = player:get_player_name()
if minetest.is_protected(t1, player_name) then
minetest.record_protection_violation(t1, player_name)
return
end
if minetest.is_protected(t2, player_name) then
minetest.record_protection_violation(t2, player_name)
return
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(above, {name="air"})
end,
})
minetest.register_node("my_garage_door:garage_door_top", {
@ -73,11 +109,11 @@ minetest.register_node("my_garage_door:garage_door_top", {
node_box = {
type = "fixed",
fixed = {
{-1.5, -0.5, -0.125, 1.5, 0.5, -0.0625},
{-1.5, -0.5, -0.1875, 1.5, -0.3125, -0.0625},
{-1.5, -0.5, -0.125, 1.5, 0.5, -0.0625},
{-1.5, -0.5, -0.1875, 1.5, -0.3125, -0.0625},
{-1.5, -0.25, -0.1875, 1.5, -0.0624999, -0.0625},
{-1.5, 0, -0.1875, 1.5, 0.1875, -0.0625},
{-1.5, 0.25, -0.1875, 1.5, 0.4375, -0.0625},
{-1.5, 0, -0.1875, 1.5, 0.1875, -0.0625},
{-1.5, 0.25, -0.1875, 1.5, 0.4375, -0.0625},
}
},
selection_box = {type = "fixed",fixed = {{0, 0, 0, 0, 0, 0},}},
@ -95,41 +131,48 @@ minetest.register_node("my_garage_door:garage_door_open", {
node_box = {
type = "fixed",
fixed = {
{-1.5, 0.4375, -0.5, 1.5, 0.375, 0.5},
{-1.5, 0.375, 0.3125, 1.5, 0.5, 0.5},
{-1.5, 0.375, 0.0625, 1.5, 0.5, 0.25},
{-1.5, 0.375, -0.1875, 1.5, 0.5, 0},
{-1.5, 0.375, -0.4375, 1.5, 0.5, -0.25},
{-1.5, 0.4375, -0.5, 1.5, 0.375, 0.5},
{-1.5, 0.375, 0.3125, 1.5, 0.5, 0.5},
{-1.5, 0.375, 0.0625, 1.5, 0.5, 0.25},
{-1.5, 0.375, -0.1875, 1.5, 0.5, 0},
{-1.5, 0.375, -0.4375, 1.5, 0.5, -0.25},
}
},
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}
local t2 = {x=pos.x,y=pos.y+1,z=pos.z}
local t3
if p2 == 0 then
t1 = {x=pos.x,y=pos.y,z=pos.z-1}
t2 = {x=pos.x,y=pos.y-1,z=pos.z-1}
t3 = {x=pos.x,y=pos.y,z=pos.z+1}
elseif p2 == 1 then
t1 = {x=pos.x-1,y=pos.y,z=pos.z}
t2 = {x=pos.x-1,y=pos.y-1,z=pos.z}
t3 = {x=pos.x+1,y=pos.y,z=pos.z}
elseif p2 == 2 then
t1 = {x=pos.x,y=pos.y,z=pos.z+1}
t2 = {x=pos.x,y=pos.y-1,z=pos.z+1}
t3 = {x=pos.x,y=pos.y,z=pos.z-1}
elseif p2 == 3 then
t1 = {x=pos.x+1,y=pos.y,z=pos.z}
t2 = {x=pos.x+1,y=pos.y-1,z=pos.z}
t3 = {x=pos.x-1,y=pos.y,z=pos.z}
local p2 = node.param2
local dir = minetest.facedir_to_dir((p2+2)%4)
local t1 = vector.add(pos, dir)
local t2 = vector.subtract(t1, {x=0,y=1,z=0})
if not player or not player:is_player() then
return
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"})
if not minetest.registered_nodes[minetest.get_node(t1).name].buildable_to or
not minetest.registered_nodes[minetest.get_node(t2).name].buildable_to then
minetest.chat_send_player(player:get_player_name(), "Not enough room to close")
return
end
local player_name = player:get_player_name()
if minetest.is_protected(t1, player_name) then
minetest.record_protection_violation(t1, player_name)
return
end
if minetest.is_protected(t2, player_name) then
minetest.record_protection_violation(t2, player_name)
return
end
local t3 = vector.subtract(pos, dir)
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"})
end,
})
minetest.register_node("my_garage_door:garage_door_open2", {
@ -146,11 +189,11 @@ minetest.register_node("my_garage_door:garage_door_open2", {
node_box = {
type = "fixed",
fixed = {
{-1.5, 0.4375, -0.5, 1.5, 0.375, 0.5},
{-1.5, 0.375, 0.3125, 1.5, 0.5, 0.5},
{-1.5, 0.375, 0.0625, 1.5, 0.5, 0.25},
{-1.5, 0.375, -0.1875, 1.5, 0.5, 0},
{-1.5, 0.375, -0.4375, 1.5, 0.5, -0.25},
{-1.5, 0.4375, -0.5, 1.5, 0.375, 0.5},
{-1.5, 0.375, 0.3125, 1.5, 0.5, 0.5},
{-1.5, 0.375, 0.0625, 1.5, 0.5, 0.25},
{-1.5, 0.375, -0.1875, 1.5, 0.5, 0},
{-1.5, 0.375, -0.4375, 1.5, 0.5, -0.25},
}
},
selection_box = {type = "fixed",fixed = {{0, 0, 0, 0, 0, 0},}},

View file

@ -10,23 +10,22 @@ local hdoor_list = { --Number , Description , default image
{ "bookshelf", "Hidden Bookshelf Door" , "mydoors_bookshelf" , "door9"},
}
for i in ipairs(hdoor_list) do
local img = hdoor_list[i][1]
local desc = hdoor_list[i][2]
--local dimg = hdoor_list[i][3]
doors.register_door("my_hidden_doors:hidden_door"..img, {
description = desc.." Locked",
inventory_image = "mydoors_"..img.."_inv.png",
groups = {choppy=2,cracky=2,door=1},
only_placer_can_open = false,
tiles = {{ name = "mydoors_"..img..".png", backface_culling = true }},
protected = false,
})
local function add_door(img, desc)
doors.register_door("my_hidden_doors:hidden_door"..img, {
description = desc.." Locked",
inventory_image = "mydoors_"..img.."_inv.png",
groups = {choppy=2,cracky=2,door=1},
only_placer_can_open = false,
tiles = {{ name = "mydoors_"..img..".png", backface_culling = true }},
protected = false,
})
end
for _,hdoor in ipairs(hdoor_list) do
add_door(unpack(hdoor))
end
doors.register_door("my_hidden_doors:hidden_door_grey", {
description = "Grey Door Locked",
inventory_image = "mydoors_grey_inv.png",
@ -34,6 +33,8 @@ doors.register_door("my_hidden_doors:hidden_door_grey", {
tiles = {{ name = "mydoors_grey.png", backface_culling = true }},
protected = false,
})
-- Crafts
minetest.register_craft({

View file

@ -17,10 +17,10 @@ minetest.register_node("my_misc_doors:door2a", {
type = "fixed",
fixed = {
{-0.4375, -0.5, -0.0625, -0.3125, 0.5, 0.0625},
{-0.0625, -0.5, -0.0625, 0.0625, 0.5, 0.0625},
{0.3125, -0.5, -0.0625, 0.4375, 0.5, 0.0625},
{0.125, -0.5, -0.0625, 0.25, 0.5, 0.0625},
{-0.25, -0.5, -0.0625, -0.125, 0.5, 0.0625},
{-0.0625, -0.5, -0.0625, 0.0625, 0.5, 0.0625},
{ 0.3125, -0.5, -0.0625, 0.4375, 0.5, 0.0625},
{ 0.125, -0.5, -0.0625, 0.25, 0.5, 0.0625},
{-0.25, -0.5, -0.0625, -0.125, 0.5, 0.0625},
}
},
selection_box = {
@ -30,76 +30,68 @@ 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(itemstack, placer, pointed_thing)
local pos1 = pointed_thing.above
local pos2 = vector.add(pos1, {x=0,y=1,z=0})
if not placer or not placer:is_player() then
return
end
if not minetest.registered_nodes[minetest.get_node(pos1).name].buildable_to or
not minetest.registered_nodes[minetest.get_node(pos2).name].buildable_to then
minetest.chat_send_player(placer:get_player_name(), "Not enough room")
return
end
local p2 = minetest.dir_to_facedir(placer:get_look_dir())
local p4 = (p2+2)%4
local pos3 = vector.add(pos1, minetest.facedir_to_dir((p2-1)%4))
local player_name = placer:get_player_name()
if minetest.is_protected(pos1, player_name) then
minetest.record_protection_violation(pos1, player_name)
return
end
if minetest.is_protected(pos2, player_name) then
minetest.record_protection_violation(pos2, player_name)
return
end
if minetest.get_node(pos3).name == "my_misc_doors:door2a" then
minetest.set_node(pos1, {name="my_misc_doors:door2a", param2=p4})
minetest.set_node(pos2, {name="my_misc_doors:door2b", param2=p4})
else
minetest.set_node(pos1, {name="my_misc_doors:door2a", param2=p2})
minetest.set_node(pos2, {name="my_misc_doors:door2b", param2=p2})
end
if not (minetest.settings:get_bool("creative_mode") or minetest.check_player_privs(placer:get_player_name(), {creative = true})) then
itemstack:take_item()
end
return itemstack
end,
after_destruct = function(pos, oldnode)
minetest.set_node(vector.add(pos, {x=0,y=1,z=0}), {name="air"})
end,
on_rightclick = function(pos, node, player, itemstack, pointed_thing)
local timer = minetest.get_node_timer(pos)
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})
minetest.set_node(vector.add(pos, {x=0,y=1,z=0}), {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})
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})
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})
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})
-- Open neighbouring doors
for i=0,3 do
local dir = minetest.facedir_to_dir(i)
local neighbour_pos = vector.add(pos, dir)
local neighbour = minetest.get_node(neighbour_pos)
if neighbour.name == "my_misc_doors:door2a" then
minetest.set_node(neighbour_pos, {name="my_misc_doors:door2c", param2=neighbour.param2})
minetest.set_node(vector.add(neighbour_pos, {x=0,y=1,z=0}), {name="my_misc_doors:door2d", param2=neighbour.param2})
end
end
timer:start(3)
end,
timer:start(3)
end,
})
minetest.register_node("my_misc_doors:door2b", {
tiles = {
@ -113,10 +105,10 @@ minetest.register_node("my_misc_doors:door2b", {
type = "fixed",
fixed = {
{-0.4375, -0.5, -0.0625, -0.3125, 0.5, 0.0625},
{-0.0625, -0.5, -0.0625, 0.0625, 0.5, 0.0625},
{0.3125, -0.5, -0.0625, 0.4375, 0.5, 0.0625},
{0.125, -0.5, -0.0625, 0.25, 0.5, 0.0625},
{-0.25, -0.5, -0.0625, -0.125, 0.5, 0.0625},
{-0.0625, -0.5, -0.0625, 0.0625, 0.5, 0.0625},
{ 0.3125, -0.5, -0.0625, 0.4375, 0.5, 0.0625},
{ 0.125, -0.5, -0.0625, 0.25, 0.5, 0.0625},
{-0.25, -0.5, -0.0625, -0.125, 0.5, 0.0625},
}
},
selection_box = {
@ -143,10 +135,10 @@ minetest.register_node("my_misc_doors:door2c", {
type = "fixed",
fixed = {
{-0.4375, -0.375, -0.0625, -0.3125, -0.5, 0.0625},
{-0.0625, -0.375, -0.0625, 0.0625, -0.5, 0.0625},
{0.3125, -0.375, -0.0625, 0.4375, -0.5, 0.0625},
{0.125, -0.375, -0.0625, 0.25, -0.5, 0.0625},
{-0.25, -0.375, -0.0625, -0.125, -0.5, 0.0625},
{-0.0625, -0.375, -0.0625, 0.0625, -0.5, 0.0625},
{ 0.3125, -0.375, -0.0625, 0.4375, -0.5, 0.0625},
{ 0.125, -0.375, -0.0625, 0.25, -0.5, 0.0625},
{-0.25, -0.375, -0.0625, -0.125, -0.5, 0.0625},
}
},
selection_box = {
@ -155,39 +147,32 @@ minetest.register_node("my_misc_doors:door2c", {
{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})
drop = "my_misc_doors:door2a",
after_place_node = function(pos, placer, itemstack, pointed_thing)
local node = minetest.get_node(pos)
local timer = minetest.get_node_timer(pos)
minetest.set_node(vector.add(pos, {x=0,y=1,z=0}), {name="my_misc_doors:door2d",param2=node.param2})
timer:start(3)
end,
after_destruct = function(pos, oldnode)
minetest.set_node(vector.add(pos, {x=0,y=1,z=0}), {name="air"})
end,
on_timer = function(pos, elapsed)
local node = minetest.get_node(pos)
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})
minetest.set_node(vector.add(pos, {x=0,y=1,z=0}), {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})
-- Close neighbouring doors
for i=0,3 do
local dir = minetest.facedir_to_dir(i)
local neighbour_pos = vector.add(pos, dir)
local neighbour = minetest.get_node(neighbour_pos)
if neighbour.name == "my_misc_doors:door2c" then
minetest.set_node(neighbour_pos, {name="my_misc_doors:door2a", param2=neighbour.param2})
minetest.set_node(vector.add(neighbour_pos, {x=0,y=1,z=0}), {name="my_misc_doors:door2b", param2=neighbour.param2})
end
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})
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})
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})
end
end,
end,
})
minetest.register_node("my_misc_doors:door2d", {
tiles = {
@ -206,10 +191,10 @@ minetest.register_node("my_misc_doors:door2d", {
type = "fixed",
fixed = {
{-0.4375, 0.375, -0.0625, -0.3125, 0.5, 0.0625},
{-0.0625, 0.375, -0.0625, 0.0625, 0.5, 0.0625},
{0.3125, 0.375, -0.0625, 0.4375, 0.5, 0.0625},
{0.125, 0.375, -0.0625, 0.25, 0.5, 0.0625},
{-0.25, 0.375, -0.0625, -0.125, 0.5, 0.0625},
{-0.0625, 0.375, -0.0625, 0.0625, 0.5, 0.0625},
{ 0.3125, 0.375, -0.0625, 0.4375, 0.5, 0.0625},
{ 0.125, 0.375, -0.0625, 0.25, 0.5, 0.0625},
{-0.25, 0.375, -0.0625, -0.125, 0.5, 0.0625},
}
},
selection_box = {

View file

@ -6,21 +6,21 @@ local mdoor_list = { --Number , Description , Inven Image , Image
-- {"Misc Door 5" , "door5"},
}
for i in ipairs(mdoor_list) do
local desc = mdoor_list[i][1]
local img = mdoor_list[i][2]
doors.register_door("my_misc_doors:"..img.."_locked", {
description = desc.." Locked",
inventory_image = "mymdoors_"..img.."_inv.png",
groups = {choppy=2,cracky=2,door=1},
tiles = {{name="mymdoors_"..img..".png", backface_culling = true }},
protected = true,
})
local function add_door(desc, img)
doors.register_door("my_misc_doors:"..img.."_locked", {
description = desc.." Locked",
inventory_image = "mymdoors_"..img.."_inv.png",
groups = {choppy=2,cracky=2,door=1},
tiles = {{name="mymdoors_"..img..".png", backface_culling = true }},
protected = true,
})
end
for _,mdoor in ipairs(mdoor_list) do
add_door(unpack(mdoor))
end
-- Crafts
minetest.register_craft({

View file

@ -6,21 +6,21 @@ local mdoor_list = { --Number , Description , Inven Image , Image
{"Misc Door 5" , "door5"},
}
for i in ipairs(mdoor_list) do
local desc = mdoor_list[i][1]
local img = mdoor_list[i][2]
doors.register_door("my_misc_doors:"..img, {
description = desc,
inventory_image = "mymdoors_"..img.."_inv.png",
groups = {choppy=2,cracky=2,door=1},
tiles = {{name="mymdoors_"..img..".png", backface_culling = true }},
protected = false,
})
local function add_door(desc, img)
doors.register_door("my_misc_doors:"..img, {
description = desc,
inventory_image = "mymdoors_"..img.."_inv.png",
groups = {choppy=2,cracky=2,door=1},
tiles = {{name="mymdoors_"..img..".png", backface_culling = true }},
protected = false,
})
end
for _,mdoor in ipairs(mdoor_list) do
add_door(unpack(mdoor))
end
-- Crafts
minetest.register_craft({

View file

@ -4,21 +4,22 @@ local cdoor_list = { --Number , Description , Inven Image , Image
{ "3", "Old Door 3" , "old3"},
{ "4", "Old Door 4" , "old4"},
}
for i in ipairs(cdoor_list) do
local num = cdoor_list[i][1]
local desc = cdoor_list[i][2]
local img = cdoor_list[i][3]
doors.register_door("my_old_doors:door"..num.."_locked", {
description = desc.." Locked",
inventory_image = "mydoors_"..img.."_inv.png",
groups = {choppy=2,cracky=2,door=1},
tiles = {{ name = "mydoors_"..img..".png", backface_culling = true }},
protected = true,
})
local function add_door(num, desc, img)
doors.register_door("my_old_doors:door"..num.."_locked", {
description = desc.." Locked",
inventory_image = "mydoors_"..img.."_inv.png",
groups = {choppy=2,cracky=2,door=1},
tiles = {{ name = "mydoors_"..img..".png", backface_culling = true }},
protected = true,
})
end
for _,cdoor in ipairs(cdoor_list) do
add_door(unpack(cdoor))
end
-- Crafts
minetest.register_craft({

View file

@ -4,20 +4,22 @@ local cdoor_list = { --Number , Description , Inven Image , Image
-- { "3", "Old Door 3" , "old3"},
-- { "4", "Old Door 4" , "old4"},
}
for i in ipairs(cdoor_list) do
local num = cdoor_list[i][1]
local desc = cdoor_list[i][2]
local img = cdoor_list[i][3]
doors.register_door("my_old_doors:door"..num, {
description = desc,
inventory_image = "mydoors_"..img.."_inv.png",
groups = {choppy=2,cracky=2,door=1},
tiles = {{ name = "mydoors_"..img..".png", backface_culling = true }},
protected = true,
})
local function add_door(num, desc, img)
doors.register_door("my_old_doors:door"..num, {
description = desc,
inventory_image = "mydoors_"..img.."_inv.png",
groups = {choppy=2,cracky=2,door=1},
tiles = {{ name = "mydoors_"..img..".png", backface_culling = true }},
protected = true,
})
end
for _,cdoor in ipairs(cdoor_list) do
add_door(unpack(cdoor))
end
-- Crafts
minetest.register_craft({

View file

@ -1,4 +1,3 @@
local doorcol = {
{"white", "White", "^[colorize:white:120"},
{"red", "Red", "^[colorize:red:120"},
@ -7,103 +6,114 @@ local doorcol = {
{"grey", "Grey", "^[colorize:white:120^[colorize:black:120"},
{"dark_grey", "Dark grey", "^[colorize:white:120^[colorize:black:200"},
{"yellow", "Yellow", "^[colorize:yellow:100"},
}
for i in ipairs (doorcol) do
local col = doorcol[i][1]
local des = doorcol[i][2]
local tint = doorcol[i][3]
}
minetest.register_node("my_saloon_doors:door1a_"..col, {
description = des.." Saloon Door ",
tiles = {"mydoors_saloon_bottom.png"..tint},
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
groups = {cracky = 3},
node_box = {
type = "fixed",
fixed = {
{-0.5, -0.1875, -0.0625, 0, 0.75, 0.0625},
{-0.5, 0.75, -0.0625, -0.0625, 0.8125, 0.0625},
{-0.5, 0.8125, -0.0625, -0.125, 0.875, 0.0625},
{-0.5, 0.875, -0.0625, -0.1875, 0.9375, 0.0625},
{-0.5, 0.9375, -0.0625, -0.3125, 1, 0.0625},
{-0, -0.1875, -0.0625, 0.5, 0.75, 0.0625},
{0.0625, 0.75, -0.0625, 0.5, 0.8125, 0.0625},
{0.125, 0.8125, -0.0625, 0.5, 0.875, 0.0625},
{0.1875, 0.875, -0.0625, 0.5, 0.9375, 0.0625},
{0.3125, 0.9375, -0.0625, 0.5, 1, 0.0625},
}
},
selection_box = {
type = "fixed",
fixed = {
{-0.5, -0.1875, -0.0625, 0.5, 1, 0.0625},
}
},
local function add_door(col, des, tint)
minetest.register_node("my_saloon_doors:door1a_"..col, {
description = des.." Saloon Door ",
tiles = {"mydoors_saloon_bottom.png"..tint},
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
groups = {cracky = 3},
node_box = {
type = "fixed",
fixed = {
{-0.5, -0.1875, -0.0625, 0, 0.75, 0.0625},
{-0.5, 0.75, -0.0625, -0.0625, 0.8125, 0.0625},
{-0.5, 0.8125, -0.0625, -0.125, 0.875, 0.0625},
{-0.5, 0.875, -0.0625, -0.1875, 0.9375, 0.0625},
{-0.5, 0.9375, -0.0625, -0.3125, 1, 0.0625},
{-0, -0.1875, -0.0625, 0.5, 0.75, 0.0625},
{ 0.0625, 0.75, -0.0625, 0.5, 0.8125, 0.0625},
{ 0.125, 0.8125, -0.0625, 0.5, 0.875, 0.0625},
{ 0.1875, 0.875, -0.0625, 0.5, 0.9375, 0.0625},
{ 0.3125, 0.9375, -0.0625, 0.5, 1, 0.0625},
}
},
selection_box = {
type = "fixed",
fixed = {
{-0.5, -0.1875, -0.0625, 0.5, 1, 0.0625},
}
},
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
return minetest.item_place(itemstack, placer, pointed_thing)
end,
on_rightclick = function(pos, node, player, itemstack, pointed_thing)
on_place = function(itemstack, placer, pointed_thing)
local pos1 = pointed_thing.above
local pos2 = vector.add(pos1, {x=0,y=1,z=0})
if not placer or not placer:is_player() then
return
end
local timer = minetest.get_node_timer(pos)
local par1 = node.param2
local par2 = minetest.dir_to_facedir(player:get_look_dir())
if par1 + par2 == 1 or
par1 + par2 == 3 or
par1 + par2 == 5 then
par2 = par1
end
if node.name == "my_saloon_doors:door1a_"..col then
minetest.set_node(pos,{name="my_saloon_doors:door1b_"..col,param2=par2})
timer:start(3)
end
end,
})
minetest.register_node("my_saloon_doors:door1b_"..col, {
tiles = {"mydoors_saloon_bottom.png^[transformFY"..tint},
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
groups = {cracky = 1},
node_box = {
type = "fixed",
fixed = {
{-0.5, -0.1875, -0.0625, -0.375, 0.75, 0.5},
{-0.5, 0.75, -0.0625, -0.375, 0.8125, 0.4375},
{-0.5, 0.8125, -0.0625, -0.375, 0.875, 0.375},
{-0.5, 0.875, -0.0625, -0.375, 0.9375, 0.3125},
{-0.5, 0.9375, -0.0625, -0.375, 1, 0.1875},
{0.375, -0.1875, -0.0625, 0.5, 0.75, 0.5},
{0.375, 0.75, -0.0625, 0.5, 0.8125, 0.4375},
{0.375, 0.8125, -0.0625, 0.5, 0.875, 0.375},
{0.375, 0.875, -0.0625, 0.5, 0.9375, 0.3125},
{0.375, 0.9375, -0.0625, 0.5, 1, 0.1875},
}
},
selection_box = {
type = "fixed",
fixed = {
{0, 0, 0, 0, 0, 0},
}
},
if not minetest.registered_nodes[minetest.get_node(pos1).name].buildable_to or
not minetest.registered_nodes[minetest.get_node(pos2).name].buildable_to then
minetest.chat_send_player(placer:get_player_name(), "Not enough room")
return
end
on_timer = function(pos, elapsed)
local node = minetest.get_node(pos)
minetest.set_node(pos,{name="my_saloon_doors:door1a_"..col,param2=node.param2})
-- minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z},{name="my_saloon_doors:door1b_"..col,param2=node.param2})
end,
})
local player_name = placer:get_player_name()
if minetest.is_protected(pos1, player_name) then
minetest.record_protection_violation(pos1, player_name)
return
end
if minetest.is_protected(pos2, player_name) then
minetest.record_protection_violation(pos2, player_name)
return
end
return minetest.item_place(itemstack, placer, pointed_thing)
end,
on_rightclick = function(pos, node, player, itemstack, pointed_thing)
local timer = minetest.get_node_timer(pos)
local par1 = node.param2
local par2 = minetest.dir_to_facedir(player:get_look_dir())
if par1 + par2 == 1 or
par1 + par2 == 3 or
par1 + par2 == 5 then
par2 = par1
end
if node.name == "my_saloon_doors:door1a_"..col then
minetest.set_node(pos, {name="my_saloon_doors:door1b_"..col, param2=par2})
timer:start(3)
end
end,
})
minetest.register_node("my_saloon_doors:door1b_"..col, {
tiles = {"mydoors_saloon_bottom.png^[transformFY"..tint},
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
groups = {cracky = 1},
node_box = {
type = "fixed",
fixed = {
{-0.5, -0.1875, -0.0625, -0.375, 0.75, 0.5},
{-0.5, 0.75, -0.0625, -0.375, 0.8125, 0.4375},
{-0.5, 0.8125, -0.0625, -0.375, 0.875, 0.375},
{-0.5, 0.875, -0.0625, -0.375, 0.9375, 0.3125},
{-0.5, 0.9375, -0.0625, -0.375, 1, 0.1875},
{ 0.375, -0.1875, -0.0625, 0.5, 0.75, 0.5},
{ 0.375, 0.75, -0.0625, 0.5, 0.8125, 0.4375},
{ 0.375, 0.8125, -0.0625, 0.5, 0.875, 0.375},
{ 0.375, 0.875, -0.0625, 0.5, 0.9375, 0.3125},
{ 0.375, 0.9375, -0.0625, 0.5, 1, 0.1875},
}
},
selection_box = {
type = "fixed",
fixed = {
{0, 0, 0, 0, 0, 0},
}
},
on_timer = function(pos, elapsed)
local node = minetest.get_node(pos)
minetest.set_node(pos, {name="my_saloon_doors:door1a_"..col, param2=node.param2})
-- minetest.set_node(vector.add(pos, {x=0,y=1,z=0}),{name="my_saloon_doors:door1b_"..col,param2=node.param2})
end,
})
end
for _,door in ipairs(doorcol) do
add_door(unpack(door))
end

View file

@ -1,3 +1,2 @@
dofile(minetest.get_modpath("my_sliding_doors").."/jdoors1.lua")
dofile(minetest.get_modpath("my_sliding_doors").."/jdoors2.lua")

View file

@ -2,437 +2,470 @@ local doors = {
{"my_sliding_doors:door1a","my_sliding_doors:door1b","my_sliding_doors:door1c","my_sliding_doors:door1d","1","White"},
{"my_sliding_doors:door2a","my_sliding_doors:door2b","my_sliding_doors:door2c","my_sliding_doors:door2d","2","Flower"},
{"my_sliding_doors:door3a","my_sliding_doors:door3b","my_sliding_doors:door3c","my_sliding_doors:door3d","3","Framed"},
}
for i in ipairs (doors) do
local doora = doors[i][1]
local doorb = doors[i][2]
local doorc = doors[i][3]
local doord = doors[i][4]
local num = doors[i][5]
local des = doors[i][6]
}
function onplace(itemstack, placer, pointed_thing)
local function add_door(doora, doorb, doorc, doord, num, des)
local function onplace(itemstack, placer, pointed_thing)
local pos1 = pointed_thing.above
local pos = pos1
local pos2 = minetest.find_node_near(pos1, 1, {doora})
local par = minetest.dir_to_facedir(placer:get_look_dir())
local par2 = par + 2
local above = vector.add(pos, {x=0,y=1,z=0})
if not placer or not placer:is_player() then
return
end
local pos1 = pointed_thing.above
local pos = pos1
local pos2 = minetest.find_node_near(pos1, 1, {doora})
local par = minetest.dir_to_facedir(placer:get_look_dir())
local par2 = par + 2
if not minetest.registered_nodes[minetest.get_node(pos).name].buildable_to or
not minetest.registered_nodes[minetest.get_node(above).name].buildable_to then
minetest.chat_send_player(placer:get_player_name(), "Not enough room")
return
end
local player_name = placer:get_player_name()
if minetest.is_protected(pos, player_name) then
minetest.record_protection_violation(pos, player_name)
return
end
if minetest.is_protected(above, player_name) then
minetest.record_protection_violation(above, player_name)
return
end
if par2 == 4 then par2 = 0 end
if par2 == 5 then par2 = 1 end
if pos2 == nil then
minetest.set_node(pos, {name=doora,param2=par})
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z}, {name=doorb,param2=par})
minetest.set_node(above, {name=doorb,param2=par})
else
minetest.set_node(pos, {name=doora.."2",param2=par2})
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z}, {name=doorb.."2",param2=par2})
minetest.set_node(above, {name=doorb.."2",param2=par2})
end
end
if not (minetest.settings:get_bool("creative_mode") or minetest.check_player_privs(placer:get_player_name(), {creative = true})) then
itemstack:take_item()
end
return itemstack
function afterdestruct(pos, oldnode)
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z},{name="air"})
end
end
function rightclick(pos, node, player, itemstack, pointed_thing)
local function afterdestruct(pos, oldnode)
minetest.set_node(vector.add(pos, {x=0,y=1,z=0}), {name="air"})
end
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})
local function rightclick(pos, node, player, itemstack, pointed_thing)
if node.name == doora then
minetest.set_node(pos, {name=doorc, param2=node.param2})
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z}, {name=doord, param2=node.param2})
minetest.set_node(pos, {name=doorc, param2=node.param2})
minetest.set_node(vector.add(pos, {x=0,y=1,z=0}), {name=doord, param2=node.param2})
elseif node.name == doorc then
minetest.set_node(pos, {name=doora, param2=node.param2})
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z}, {name=doorb, param2=node.param2})
minetest.set_node(pos, {name=doora, param2=node.param2})
minetest.set_node(vector.add(pos, {x=0,y=1,z=0}), {name=doorb, param2=node.param2})
end
if a.name == doora then
minetest.set_node({x=pos.x, y=pos.y, z=pos.z-1}, {name=doorc, param2=a.param2})
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z-1}, {name=doord, param2=a.param2})
-- Open neighbouring doors
for i=0,3 do
local dir = minetest.facedir_to_dir(i)
local neighbour_pos = vector.add(pos, dir)
local neighbour_above = vector.add(neighbour_pos, {x=0,y=1,z=0})
local neighbour = minetest.get_node(neighbour_pos)
if neighbour.name == doora then
minetest.set_node(neighbour_pos, {name=doorc, param2=neighbour.param2})
minetest.set_node(neighbour_above, {name=doord, param2=neighbour.param2})
elseif neighbour.name == doora.."2" then
minetest.set_node(neighbour_pos, {name=doorc.."2", param2=neighbour.param2})
minetest.set_node(neighbour_above, {name=doord.."2", param2=neighbour.param2})
elseif neighbour.name == doorc then
minetest.set_node(neighbour_pos, {name=doora, param2=neighbour.param2})
minetest.set_node(neighbour_above, {name=doorb, param2=neighbour.param2})
elseif neighbour.name == doorc.."2" then
minetest.set_node(neighbour_pos, {name=doora.."2", param2=neighbour.param2})
minetest.set_node(neighbour_above, {name=doorb.."2", param2=neighbour.param2})
end
end
if b.name == doora then
minetest.set_node({x=pos.x, y=pos.y, z=pos.z+1}, {name=doorc, param2=b.param2})
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z+1}, {name=doord, param2=b.param2})
end
if c.name == doora then
minetest.set_node({x=pos.x+1, y=pos.y, z=pos.z}, {name=doorc, param2=c.param2})
minetest.set_node({x=pos.x+1,y=pos.y+1,z=pos.z}, {name=doord, param2=c.param2})
end
if d.name == doora then
minetest.set_node({x=pos.x-1, y=pos.y, z=pos.z}, {name=doorc, param2=d.param2})
minetest.set_node({x=pos.x-1,y=pos.y+1,z=pos.z}, {name=doord, param2=d.param2})
end
if a.name == doora.."2" then
minetest.set_node({x=pos.x, y=pos.y, z=pos.z-1}, {name=doorc.."2", param2=a.param2})
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z-1}, {name=doord.."2", param2=a.param2})
end
if b.name == doora.."2" then
minetest.set_node({x=pos.x, y=pos.y, z=pos.z+1}, {name=doorc.."2", param2=b.param2})
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z+1}, {name=doord.."2", param2=b.param2})
end
if c.name == doora.."2" then
minetest.set_node({x=pos.x+1, y=pos.y, z=pos.z}, {name=doorc.."2", param2=c.param2})
minetest.set_node({x=pos.x+1,y=pos.y+1,z=pos.z}, {name=doord.."2", param2=c.param2})
end
if d.name == doora.."2" then
minetest.set_node({x=pos.x-1, y=pos.y, z=pos.z}, {name=doorc.."2", param2=d.param2})
minetest.set_node({x=pos.x-1,y=pos.y+1,z=pos.z}, {name=doord.."2", param2=d.param2})
end
if a.name == doorc then
minetest.set_node({x=pos.x, y=pos.y, z=pos.z-1}, {name=doora, param2=a.param2})
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z-1}, {name=doorb, param2=a.param2})
end
if b.name == doorc then
minetest.set_node({x=pos.x, y=pos.y, z=pos.z+1}, {name=doora, param2=b.param2})
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z+1}, {name=doorb, param2=b.param2})
end
if c.name == doorc then
minetest.set_node({x=pos.x+1, y=pos.y, z=pos.z}, {name=doora, param2=c.param2})
minetest.set_node({x=pos.x+1,y=pos.y+1,z=pos.z}, {name=doorb, param2=c.param2})
end
if d.name == doorc then
minetest.set_node({x=pos.x-1, y=pos.y, z=pos.z}, {name=doora, param2=d.param2})
minetest.set_node({x=pos.x-1,y=pos.y+1,z=pos.z}, {name=doorb, param2=d.param2})
end
if a.name == doorc.."2" then
minetest.set_node({x=pos.x, y=pos.y, z=pos.z-1}, {name=doora.."2", param2=a.param2})
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z-1}, {name=doorb.."2", param2=a.param2})
end
if b.name == doorc.."2" then
minetest.set_node({x=pos.x, y=pos.y, z=pos.z+1}, {name=doora.."2", param2=b.param2})
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z+1}, {name=doorb.."2", param2=b.param2})
end
if c.name == doorc.."2" then
minetest.set_node({x=pos.x+1, y=pos.y, z=pos.z}, {name=doora.."2", param2=c.param2})
minetest.set_node({x=pos.x+1,y=pos.y+1,z=pos.z}, {name=doorb.."2", param2=c.param2})
end
if d.name == doorc.."2" then
minetest.set_node({x=pos.x-1, y=pos.y, z=pos.z}, {name=doora.."2", param2=d.param2})
minetest.set_node({x=pos.x-1,y=pos.y+1,z=pos.z}, {name=doorb.."2", param2=d.param2})
end
end
function afterplace(pos, placer, itemstack, pointed_thing)
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z},{name=doord,param2=nodeu.param2})
end
minetest.register_node(doora, {
description = des.." Sliding Door",
inventory_image = "myjdoors_door"..num.."a_inv.png",
wield_image = "myjdoors_door"..num.."a_inv.png",
tiles = {
"myjdoors_door"..num.."a_edge.png",
"myjdoors_door"..num.."a_edge.png",
"myjdoors_door"..num.."a_edge.png",
"myjdoors_door"..num.."a_edge.png",
"myjdoors_door"..num.."a_bottom.png^[transformFX",
"myjdoors_door"..num.."a_bottom.png"
},
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
sunlight_propagates = true,
groups = {cracky = 3},
node_box = {
type = "fixed",
fixed = {
{0.375, -0.5, 0.1875, 0.5, 0.5, 0.0625},
{-0.5, -0.5, 0.1875, -0.375, 0.5, 0.0625},
{-0.5, -0.5, 0.1875, 0.5, -0.375, 0.0625},
{-0.5, -0.5, 0.125, 0.5, 0.5, 0.145},
{-0.625, -0.5, -0.0625, -0.5, 0.5, 0.0625},
{-1.5, -0.5, -0.0625, -1.375, 0.5, 0.0625},
{-1.5, -0.5, -0.0625, -0.5, -0.375, 0.0625},
{-1.5, -0.5, 0, -0.5, 0.5, 0.02},
}
},
selection_box = {type = "fixed",fixed = {{-1.5, -0.5, -0.0625, -0.5, 1.5, 0.0625},{-0.5, -0.5, 0.0625, 0.5, 1.5, 0.1875}}},
on_place = onplace,
after_destruct = afterdestruct,
on_rightclick = rightclick,
})
minetest.register_node(doorb, {
tiles = {
"myjdoors_door"..num.."a_edge.png",
"myjdoors_door"..num.."a_edge.png",
"myjdoors_door"..num.."a_edge.png",
"myjdoors_door"..num.."a_edge.png",
"myjdoors_door"..num.."a_top.png^[transformFX",
"myjdoors_door"..num.."a_top.png"
},
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
sunlight_propagates = true,
groups = {cracky = 1},
node_box = {
type = "fixed",
fixed = {
{0.375, -0.5, 0.1875, 0.5, 0.5, 0.0625},
{-0.5, -0.5, 0.1875, -0.375, 0.5, 0.0625},
{-0.5, 0.5, 0.1875, 0.5, 0.375, 0.0625},
{-0.5, -0.5, 0.125, 0.5, 0.5, 0.145},
{-0.625, -0.5, -0.0625, -0.5, 0.5, 0.0625},
{-1.5, -0.5, -0.0625, -1.375, 0.5, 0.0625},
{-1.5, 0.5, -0.0625, -0.5, 0.375, 0.0625},
{-1.5, -0.5, 0, -0.5, 0.5, 0.02},
}
},
selection_box = {
type = "fixed",
fixed = {
{0, 0, 0, 0, 0, 0},
}
},
})minetest.register_node(doorc, {
tiles = {
"myjdoors_door"..num.."a_edge.png",
"myjdoors_door"..num.."a_edge.png",
"myjdoors_door"..num.."a_edge.png",
"myjdoors_door"..num.."a_edge.png",
"myjdoors_door"..num.."a_bottom.png^[transformFX",
"myjdoors_door"..num.."a_bottom.png"
},
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
sunlight_propagates = true,
drop = doora,
groups = {cracky = 1},
node_box = {
type = "fixed",
fixed = {
{-0.625, -0.5, 0.1875, -0.5, 0.5, 0.0625},
{-1.5, -0.5, 0.1875, -1.375, 0.5, 0.0625},
{-1.5, -0.5, 0.1875, -0.5, -0.375, 0.0625},
{-1.5, -0.5, 0.125, -0.5, 0.5, 0.145},
{-0.625, -0.5, -0.0625, -0.5, 0.5, 0.0625},
{-1.5, -0.5, -0.0625, -1.375, 0.5, 0.0625},
{-1.5, -0.5, -0.0625, -0.5, -0.375, 0.0625},
{-1.5, -0.5, 0, -0.5, 0.5, 0.02},
}
},
selection_box = {
type = "fixed",
fixed = {
{-1.5, -0.5, -0.0625, -0.5, 1.5, 0.1875}
}
},
after_place_node = afterplace,
after_destruct = afterdestruct,
on_rightclick = rightclick,
})
minetest.register_node(doord, {
tiles = {
"myjdoors_door"..num.."a_edge.png",
"myjdoors_door"..num.."a_edge.png",
"myjdoors_door"..num.."a_edge.png",
"myjdoors_door"..num.."a_edge.png",
"myjdoors_door"..num.."a_top.png^[transformFX",
"myjdoors_door"..num.."a_top.png"
},
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
sunlight_propagates = true,
groups = {cracky = 1},
node_box = {
type = "fixed",
fixed = {
{-0.625, -0.5, 0.1875, -0.5, 0.5, 0.0625},
{-1.5, -0.5, 0.1875, -1.375, 0.5, 0.0625},
{-1.5, 0.5, 0.1875, -0.5, 0.375, 0.0625},
{-1.5, -0.5, 0.125, -0.5, 0.5, 0.145},
{-0.625, -0.5, -0.0625, -0.5, 0.5, 0.0625},
{-1.5, -0.5, -0.0625, -1.375, 0.5, 0.0625},
{-1.5, 0.5, -0.0625, -0.5, 0.375, 0.0625},
{-1.5, -0.5, 0, -0.5, 0.5, 0.02},
}
},
selection_box = {
type = "fixed",
fixed = {
{0, 0, 0, 0, 0, 0},
}
},
})
minetest.register_node("my_sliding_doors:jpanel"..num, {
description = des.." Panel",
inventory_image = "myjdoors_panel"..num.."_inv.png",
wield_image = "myjdoors_panel"..num.."_inv.png",
tiles = {
"myjdoors_door"..num.."a_edge.png",
"myjdoors_door"..num.."a_edge.png",
"myjdoors_door"..num.."a_edge.png",
"myjdoors_door"..num.."a_edge.png",
"myjdoors_door"..num.."a_bottom.png",
"myjdoors_door"..num.."a_bottom.png"
},
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
sunlight_propagates = true,
groups = {cracky = 3},
node_box = {
type = "fixed",
fixed = {
{0.375, -0.5, -0.0625, 0.5, 0.5, 0.0625},
{-0.5, -0.5, -0.0625, -0.375, 0.5, 0.0625},
{-0.5, -0.5, -0.0625, 0.5, -0.375, 0.0625},
{-0.4375, -0.5, 0, 0.4375, 0.5, 0.02},
}
},
selection_box = {type = "fixed",fixed = {{-0.5, -0.5, -0.0625, 0.5, 1.5, 0.0625}}},
collision_box = {type = "fixed",fixed = {{-0.5, -0.5, -0.0625, 0.5, 1.5, 0.0625}}},
on_place = function(itemstack, placer, pointed_thing)
local p2 = minetest.dir_to_facedir(placer:get_look_dir())
local pos = pointed_thing.above
local na = minetest.get_node({x=pos.x,y=pos.y+1,z=pos.z})
if na.name == "air" then
minetest.set_node(pos,{name = "my_sliding_doors:jpanel"..num, param2 = p2})
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z},{name = "my_sliding_doors:jpanel_top"..num, param2 = p2})
else
return
end
end,
on_destruct = function(pos)
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z},{name="air"})
end,
})
minetest.register_node("my_sliding_doors:jpanel_top"..num, {
tiles = {
"myjdoors_door"..num.."a_edge.png",
"myjdoors_door"..num.."a_edge.png",
"myjdoors_door"..num.."a_edge.png",
"myjdoors_door"..num.."a_edge.png",
"myjdoors_door"..num.."a_top.png",
"myjdoors_door"..num.."a_top.png"
},
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
sunlight_propagates = true,
drop = "",
groups = {cracky = 3},
node_box = {
type = "fixed",
fixed = {
{0.375, -0.5, -0.0625, 0.5, 0.5, 0.0625},
{-0.5, -0.5, -0.0625, -0.375, 0.5, 0.0625},
{-0.5, 0.5, -0.0625, 0.5, 0.375, 0.0625},
{-0.4375, -0.5, 0, 0.4375, 0.5, 0.02},
}
},
selection_box = {
type = "fixed",
fixed = {
{0, 0, 0, 0, 0, 0}
}
},
})
minetest.register_node("my_sliding_doors:jpanel_corner_"..num, {
description = des.." Panel Corner",
inventory_image = "myjdoors_panel"..num.."_corner_inv.png",
wield_image = "myjdoors_panel"..num.."_corner_inv.png",
tiles = {
"myjdoors_door"..num.."a_edge.png",
"myjdoors_door"..num.."a_edge.png",
"myjdoors_door"..num.."a_bottom.png",
"myjdoors_door"..num.."a_bottom.png",
"myjdoors_door"..num.."a_bottom.png",
"myjdoors_door"..num.."a_bottom.png"
},
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
sunlight_propagates = true,
groups = {cracky = 3},
node_box = {
type = "fixed",
fixed = {
{-0.0625, -0.5, -0.5, 0.0625001, 0.5, -0.375},
{-0.5, -0.5, -0.0625, -0.375, 0.5, 0.0625},
{-0.5, -0.5, -0.0625, 0.0624999, -0.375, 0.0625},
{-0.5, -0.5, 0, 0, 0.5, 0.02},
{-0.0625, -0.5, -0.5, 0.0625, -0.375, 0.0625},
{0.02, -0.5, -0.5, 0, 0.5, 0},
}
},
selection_box = {
type = "fixed",
fixed = {
{-0.0625, -0.5, -0.5, 0.0625, 1.5, 0},
{-0.5, -0.5, -0.0625, 0, 1.5, 0.0625},
}
},
on_place = function(itemstack, placer, pointed_thing)
local p2 = minetest.dir_to_facedir(placer:get_look_dir())
local pos = pointed_thing.above
local na = minetest.get_node({x=pos.x,y=pos.y+1,z=pos.z})
if na.name == "air" then
minetest.set_node(pos,{name = "my_sliding_doors:jpanel_corner_"..num, param2 = p2})
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z},{name = "my_sliding_doors:jpanel_corner_top"..num, param2 = p2})
else
return
local function afterplace(pos, placer, itemstack, pointed_thing)
local node = minetest.get_node(pos)
minetest.set_node(vector.add(pos, {x=0,y=1,z=0}), {name=doord,param2=node.param2})
end
end,
on_destruct = function(pos)
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z},{name="air"})
end,
})
minetest.register_node("my_sliding_doors:jpanel_corner_top"..num, {
tiles = {
"myjdoors_door"..num.."a_edge.png",
"myjdoors_door"..num.."a_edge.png",
"myjdoors_door"..num.."a_top.png",
"myjdoors_door"..num.."a_top.png",
"myjdoors_door"..num.."a_top.png",
"myjdoors_door"..num.."a_top.png"
},
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
sunlight_propagates = true,
drop = "",
groups = {cracky = 3},
node_box = {
type = "fixed",
fixed = {
{-0.0625, -0.5, -0.5, 0.0625001, 0.5, -0.375},
{-0.5, -0.5, -0.0625, -0.375, 0.5, 0.0625},
{-0.5, 0.375, -0.0625, 0.0625, 0.5, 0.0625},
{-0.5, -0.5, 0, 0, 0.5, 0.02},
{-0.0625, 0.375, -0.5, 0.0625, 0.5, 0.0625},
{0.02, -0.5, -0.5, 0, 0.5, 0},
}
},
selection_box = {
type = "fixed",
fixed = {
{0, 0, 0, 0, 0, 0}
}
},
})
minetest.register_node(doora, {
description = des.." Sliding Door",
inventory_image = "myjdoors_door"..num.."a_inv.png",
wield_image = "myjdoors_door"..num.."a_inv.png",
tiles = {
"myjdoors_door"..num.."a_edge.png",
"myjdoors_door"..num.."a_edge.png",
"myjdoors_door"..num.."a_edge.png",
"myjdoors_door"..num.."a_edge.png",
"myjdoors_door"..num.."a_bottom.png^[transformFX",
"myjdoors_door"..num.."a_bottom.png"
},
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
sunlight_propagates = true,
groups = {cracky = 3},
node_box = {
type = "fixed",
fixed = {
{ 0.375, -0.5, 0.1875, 0.5, 0.5, 0.0625},
{-0.5, -0.5, 0.1875, -0.375, 0.5, 0.0625},
{-0.5, -0.5, 0.1875, 0.5, -0.375, 0.0625},
{-0.5, -0.5, 0.125, 0.5, 0.5, 0.145},
{-0.625, -0.5, -0.0625, -0.5, 0.5, 0.0625},
{-1.5, -0.5, -0.0625, -1.375, 0.5, 0.0625},
{-1.5, -0.5, -0.0625, -0.5, -0.375, 0.0625},
{-1.5, -0.5, 0, -0.5, 0.5, 0.02},
}
},
selection_box = {
type = "fixed",
fixed = {
{-1.5, -0.5, -0.0625, -0.5, 1.5, 0.0625},
{-0.5, -0.5, 0.0625, 0.5, 1.5, 0.1875}
}
},
on_place = onplace,
after_destruct = afterdestruct,
on_rightclick = rightclick,
})
minetest.register_node(doorb, {
tiles = {
"myjdoors_door"..num.."a_edge.png",
"myjdoors_door"..num.."a_edge.png",
"myjdoors_door"..num.."a_edge.png",
"myjdoors_door"..num.."a_edge.png",
"myjdoors_door"..num.."a_top.png^[transformFX",
"myjdoors_door"..num.."a_top.png"
},
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
sunlight_propagates = true,
groups = {cracky = 1},
node_box = {
type = "fixed",
fixed = {
{ 0.375, -0.5, 0.1875, 0.5, 0.5, 0.0625},
{-0.5, -0.5, 0.1875, -0.375, 0.5, 0.0625},
{-0.5, 0.5, 0.1875, 0.5, 0.375, 0.0625},
{-0.5, -0.5, 0.125, 0.5, 0.5, 0.145},
{-0.625, -0.5, -0.0625, -0.5, 0.5, 0.0625},
{-1.5, -0.5, -0.0625, -1.375, 0.5, 0.0625},
{-1.5, 0.5, -0.0625, -0.5, 0.375, 0.0625},
{-1.5, -0.5, 0, -0.5, 0.5, 0.02},
}
},
selection_box = {
type = "fixed",
fixed = {
{0, 0, 0, 0, 0, 0},
}
},
})
minetest.register_node(doorc, {
tiles = {
"myjdoors_door"..num.."a_edge.png",
"myjdoors_door"..num.."a_edge.png",
"myjdoors_door"..num.."a_edge.png",
"myjdoors_door"..num.."a_edge.png",
"myjdoors_door"..num.."a_bottom.png^[transformFX",
"myjdoors_door"..num.."a_bottom.png"
},
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
sunlight_propagates = true,
drop = doora,
groups = {cracky = 1},
node_box = {
type = "fixed",
fixed = {
{-0.625, -0.5, 0.1875, -0.5, 0.5, 0.0625},
{-1.5, -0.5, 0.1875, -1.375, 0.5, 0.0625},
{-1.5, -0.5, 0.1875, -0.5, -0.375, 0.0625},
{-1.5, -0.5, 0.125, -0.5, 0.5, 0.145},
{-0.625, -0.5, -0.0625, -0.5, 0.5, 0.0625},
{-1.5, -0.5, -0.0625, -1.375, 0.5, 0.0625},
{-1.5, -0.5, -0.0625, -0.5, -0.375, 0.0625},
{-1.5, -0.5, 0, -0.5, 0.5, 0.02},
}
},
selection_box = {
type = "fixed",
fixed = {
{-1.5, -0.5, -0.0625, -0.5, 1.5, 0.1875}
}
},
after_place_node = afterplace,
after_destruct = afterdestruct,
on_rightclick = rightclick,
})
minetest.register_node(doord, {
tiles = {
"myjdoors_door"..num.."a_edge.png",
"myjdoors_door"..num.."a_edge.png",
"myjdoors_door"..num.."a_edge.png",
"myjdoors_door"..num.."a_edge.png",
"myjdoors_door"..num.."a_top.png^[transformFX",
"myjdoors_door"..num.."a_top.png"
},
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
sunlight_propagates = true,
groups = {cracky = 1},
node_box = {
type = "fixed",
fixed = {
{-0.625, -0.5, 0.1875, -0.5, 0.5, 0.0625},
{-1.5, -0.5, 0.1875, -1.375, 0.5, 0.0625},
{-1.5, 0.5, 0.1875, -0.5, 0.375, 0.0625},
{-1.5, -0.5, 0.125, -0.5, 0.5, 0.145},
{-0.625, -0.5, -0.0625, -0.5, 0.5, 0.0625},
{-1.5, -0.5, -0.0625, -1.375, 0.5, 0.0625},
{-1.5, 0.5, -0.0625, -0.5, 0.375, 0.0625},
{-1.5, -0.5, 0, -0.5, 0.5, 0.02},
}
},
selection_box = {
type = "fixed",
fixed = {
{0, 0, 0, 0, 0, 0},
}
},
})
minetest.register_node("my_sliding_doors:jpanel"..num, {
description = des.." Panel",
inventory_image = "myjdoors_panel"..num.."_inv.png",
wield_image = "myjdoors_panel"..num.."_inv.png",
tiles = {
"myjdoors_door"..num.."a_edge.png",
"myjdoors_door"..num.."a_edge.png",
"myjdoors_door"..num.."a_edge.png",
"myjdoors_door"..num.."a_edge.png",
"myjdoors_door"..num.."a_bottom.png",
"myjdoors_door"..num.."a_bottom.png"
},
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
sunlight_propagates = true,
groups = {cracky = 3},
node_box = {
type = "fixed",
fixed = {
{ 0.375, -0.5, -0.0625, 0.5, 0.5, 0.0625},
{-0.5, -0.5, -0.0625, -0.375, 0.5, 0.0625},
{-0.5, -0.5, -0.0625, 0.5, -0.375, 0.0625},
{-0.4375, -0.5, 0, 0.4375, 0.5, 0.02},
}
},
selection_box = {type = "fixed", fixed = {{-0.5, -0.5, -0.0625, 0.5, 1.5, 0.0625}}},
collision_box = {type = "fixed", fixed = {{-0.5, -0.5, -0.0625, 0.5, 1.5, 0.0625}}},
on_place = function(itemstack, placer, pointed_thing)
local p2 = minetest.dir_to_facedir(placer:get_look_dir())
local pos = pointed_thing.above
local pos2 = vector.add(pos, {x=0,y=1,z=0})
local na = minetest.get_node(pos2)
if not placer or not placer:is_player() then
return
end
if not minetest.registered_nodes[minetest.get_node(pos).name].buildable_to or
not minetest.registered_nodes[na.name].buildable_to then
minetest.chat_send_player(placer:get_player_name(), "Not enough room")
return
end
local player_name = placer:get_player_name()
if minetest.is_protected(pos, player_name) then
minetest.record_protection_violation(pos, player_name)
return
end
if minetest.is_protected(pos2, player_name) then
minetest.record_protection_violation(pos2, player_name)
return
end
if na.name == "air" then
minetest.set_node(pos, {name = "my_sliding_doors:jpanel"..num, param2 = p2})
minetest.set_node(pos2, {name = "my_sliding_doors:jpanel_top"..num, param2 = p2})
else
return
end
if not (minetest.settings:get_bool("creative_mode") or minetest.check_player_privs(placer:get_player_name(), {creative = true})) then
itemstack:take_item()
end
return itemstack
end,
on_destruct = function(pos)
minetest.set_node(vector.add(pos, {x=0,y=1,z=0}), {name="air"})
end,
})
minetest.register_node("my_sliding_doors:jpanel_top"..num, {
tiles = {
"myjdoors_door"..num.."a_edge.png",
"myjdoors_door"..num.."a_edge.png",
"myjdoors_door"..num.."a_edge.png",
"myjdoors_door"..num.."a_edge.png",
"myjdoors_door"..num.."a_top.png",
"myjdoors_door"..num.."a_top.png"
},
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
sunlight_propagates = true,
drop = "",
groups = {cracky = 3},
node_box = {
type = "fixed",
fixed = {
{ 0.375, -0.5, -0.0625, 0.5, 0.5, 0.0625},
{-0.5, -0.5, -0.0625, -0.375, 0.5, 0.0625},
{-0.5, 0.5, -0.0625, 0.5, 0.375, 0.0625},
{-0.4375, -0.5, 0, 0.4375, 0.5, 0.02},
}
},
selection_box = {
type = "fixed",
fixed = {
{0, 0, 0, 0, 0, 0}
}
},
})
minetest.register_node("my_sliding_doors:jpanel_corner_"..num, {
description = des.." Panel Corner",
inventory_image = "myjdoors_panel"..num.."_corner_inv.png",
wield_image = "myjdoors_panel"..num.."_corner_inv.png",
tiles = {
"myjdoors_door"..num.."a_edge.png",
"myjdoors_door"..num.."a_edge.png",
"myjdoors_door"..num.."a_bottom.png",
"myjdoors_door"..num.."a_bottom.png",
"myjdoors_door"..num.."a_bottom.png",
"myjdoors_door"..num.."a_bottom.png"
},
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
sunlight_propagates = true,
groups = {cracky = 3},
node_box = {
type = "fixed",
fixed = {
{-0.0625, -0.5, -0.5, 0.0625001, 0.5, -0.375},
{-0.5, -0.5, -0.0625, -0.375, 0.5, 0.0625},
{-0.5, -0.5, -0.0625, 0.0624999, -0.375, 0.0625},
{-0.5, -0.5, 0, 0, 0.5, 0.02},
{-0.0625, -0.5, -0.5, 0.0625, -0.375, 0.0625},
{ 0.02, -0.5, -0.5, 0, 0.5, 0},
}
},
selection_box = {
type = "fixed",
fixed = {
{-0.0625, -0.5, -0.5, 0.0625, 1.5, 0},
{-0.5, -0.5, -0.0625, 0, 1.5, 0.0625},
}
},
on_place = function(itemstack, placer, pointed_thing)
local p2 = minetest.dir_to_facedir(placer:get_look_dir())
local pos = pointed_thing.above
local pos2 = vector.add(pos, {x=0,y=1,z=0})
local na = minetest.get_node(pos2)
if not placer or not placer:is_player() then
return
end
if not minetest.registered_nodes[minetest.get_node(pos).name].buildable_to or
not minetest.registered_nodes[na.name].buildable_to then
minetest.chat_send_player(placer:get_player_name(), "Not enough room")
return
end
local player_name = placer:get_player_name()
if minetest.is_protected(pos, player_name) then
minetest.record_protection_violation(pos, player_name)
return
end
if minetest.is_protected(pos2, player_name) then
minetest.record_protection_violation(pos2, player_name)
return
end
if na.name == "air" then
minetest.set_node(pos, {name = "my_sliding_doors:jpanel_corner_"..num, param2 = p2})
minetest.set_node(pos2, {name = "my_sliding_doors:jpanel_corner_top"..num, param2 = p2})
else
return
end
if not (minetest.settings:get_bool("creative_mode") or minetest.check_player_privs(placer:get_player_name(), {creative = true})) then
itemstack:take_item()
end
return itemstack
end,
on_destruct = function(pos)
minetest.set_node(vector.add(pos, {x=0,y=1,z=0}), {name="air"})
end,
})
minetest.register_node("my_sliding_doors:jpanel_corner_top"..num, {
tiles = {
"myjdoors_door"..num.."a_edge.png",
"myjdoors_door"..num.."a_edge.png",
"myjdoors_door"..num.."a_top.png",
"myjdoors_door"..num.."a_top.png",
"myjdoors_door"..num.."a_top.png",
"myjdoors_door"..num.."a_top.png"
},
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
sunlight_propagates = true,
drop = "",
groups = {cracky = 3},
node_box = {
type = "fixed",
fixed = {
{-0.0625, -0.5, -0.5, 0.0625001, 0.5, -0.375},
{-0.5, -0.5, -0.0625, -0.375, 0.5, 0.0625},
{-0.5, 0.375, -0.0625, 0.0625, 0.5, 0.0625},
{-0.5, -0.5, 0, 0, 0.5, 0.02},
{-0.0625, 0.375, -0.5, 0.0625, 0.5, 0.0625},
{ 0.02, -0.5, -0.5, 0, 0.5, 0},
}
},
selection_box = {
type = "fixed",
fixed = {
{0, 0, 0, 0, 0, 0}
}
},
})
end
for _,door in ipairs(doors) do
add_door(unpack(door))
end

View file

@ -2,295 +2,262 @@ local doors = {
{"my_sliding_doors:door1a","my_sliding_doors:door1b","my_sliding_doors:door1c","my_sliding_doors:door1d","1","White Right"},
{"my_sliding_doors:door2a","my_sliding_doors:door2b","my_sliding_doors:door2c","my_sliding_doors:door2d","2","Flower Right"},
{"my_sliding_doors:door3a","my_sliding_doors:door3b","my_sliding_doors:door3c","my_sliding_doors:door3d","3","Framed Right"},
}
for i in ipairs (doors) do
local doora = doors[i][1]
local doorb = doors[i][2]
local doorc = doors[i][3]
local doord = doors[i][4]
local num = doors[i][5]
--local des = doors[i][6]
}
function onplace(itemstack, placer, pointed_thing)
local pos1 = pointed_thing.above
local pos2 = {x=pos1.x, y=pos1.y + 1, z=pos1.z}
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
local function add_door(doora, doorb, doorc, doord, num)
local function onplace(itemstack, placer, pointed_thing)
local pos1 = pointed_thing.above
local pos2 = vector.add(pos, {x=0,y=1,z=0})
if not placer or not placer:is_player() then
return
end
if not minetest.registered_nodes[minetest.get_node(pos1).name].buildable_to or
not minetest.registered_nodes[minetest.get_node(pos2).name].buildable_to then
minetest.chat_send_player(placer:get_player_name(), "Not enough room")
return
end
local p2 = minetest.dir_to_facedir(placer:get_look_dir())
local p4 = (p2+2)%4
local pos3 = vector.add(pos1, minetest.facedir_to_dir((p2-1)%4))
local player_name = placer:get_player_name()
if minetest.is_protected(pos1, player_name) then
minetest.record_protection_violation(pos1, player_name)
return
end
if minetest.is_protected(pos2, player_name) then
minetest.record_protection_violation(pos2, player_name)
return
end
if minetest.is_protected(pos3, player_name) then
minetest.record_protection_violation(pos3, player_name)
return
end
if minetest.get_node(pos3).name ~= "air" then
minetest.chat_send_player(placer:get_player_name(), "Not enough room")
return
end
if minetest.get_node(pos3).name == doora then
minetest.set_node(pos1, {name=doora.."2", param2=p2})
minetest.set_node(pos2, {name=doorb.."2", param2=p2})
else
minetest.set_node(pos1, {name=doora.."2", param2=p2})
minetest.set_node(pos2, {name=doorb.."2", param2=p2})
end
if not (minetest.settings:get_bool("creative_mode") or minetest.check_player_privs(placer:get_player_name(), {creative = true})) then
itemstack:take_item()
end
return itemstack
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}
if p2 == 0 then
pt3.x = pt3.x-1
elseif p2 == 1 then
pt3.z = pt3.z+1
elseif p2 == 2 then
pt3.x = pt3.x+1
elseif p2 == 3 then
pt3.z = pt3.z-1
local function afterdestruct(pos, oldnode)
minetest.set_node(vector.add(pos, {x=0,y=1,z=0}), {name="air"})
end
if minetest.get_node(pt3).name ~= "air" then
minetest.chat_send_player(placer:get_player_name(),"Not enough room")
return
local function rightclick(pos, node, player, itemstack, pointed_thing)
if node.name == doora.."2" then
minetest.set_node(pos, {name=doorc.."2", param2=node.param2})
minetest.set_node(vector.add(pos, {x=0,y=1,z=0}), {name=doord.."2", param2=node.param2})
elseif node.name == doorc.."2" then
minetest.set_node(pos, {name=doora.."2", param2=node.param2})
minetest.set_node(vector.add(pos, {x=0,y=1,z=0}), {name=doorb.."2", param2=node.param2})
end
-- Open neighbouring doors
for i=0,3 do
local dir = minetest.facedir_to_dir(i)
local neighbour_pos = vector.add(pos, dir)
local neighbour_above = vector.add(neighbour_pos, {x=0,y=1,z=0})
local neighbour = minetest.get_node(neighbour_pos)
if neighbour.name == doora then
minetest.set_node(neighbour_pos, {name=doorc, param2=neighbour.param2})
minetest.set_node(neighbour_above, {name=doord, param2=neighbour.param2})
elseif neighbour.name == doora.."2" then
minetest.set_node(neighbour_pos, {name=doorc.."2", param2=neighbour.param2})
minetest.set_node(neighbour_above, {name=doord.."2", param2=neighbour.param2})
elseif neighbour.name == doorc then
minetest.set_node(neighbour_pos, {name=doora, param2=neighbour.param2})
minetest.set_node(neighbour_above, {name=doorb, param2=neighbour.param2})
elseif neighbour.name == doorc.."2" then
minetest.set_node(neighbour_pos, {name=doora.."2", param2=neighbour.param2})
minetest.set_node(neighbour_above, {name=doorb.."2", param2=neighbour.param2})
end
end
end
if minetest.get_node(pt3).name == doora then
minetest.set_node(pt, {name=doora.."2", param2=p2})
minetest.set_node(pt2, {name=doorb.."2", param2=p2})
else
minetest.set_node(pt, {name=doora.."2", param2=p2})
minetest.set_node(pt2, {name=doorb.."2", param2=p2})
local function afterplace(pos, placer, itemstack, pointed_thing)
local node = minetest.get_node(pos)
minetest.set_node(vector.add(pos, {x=0,y=1,z=0}), {name=doord,param2=node.param2})
end
minetest.register_node(doora.."2", {
tiles = {
"myjdoors_door"..num.."a_edge.png",
"myjdoors_door"..num.."a_edge.png",
"myjdoors_door"..num.."a_edge.png",
"myjdoors_door"..num.."a_edge.png",
"myjdoors_door"..num.."a_bottom.png^[transformFX",
"myjdoors_door"..num.."a_bottom.png"
},
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
drop = doora,
sunlight_propagates = true,
groups = {cracky = 3},
node_box = {
type = "fixed",
fixed = {
{ 0.375, -0.5, -0.1875, 0.5, 0.5, -0.0625},
{-0.5, -0.5, -0.1875, -0.375, 0.5, -0.0625},
{-0.5, -0.5, -0.1875, 0.5, -0.375, -0.0625},
{-0.5, -0.5, -0.125, 0.5, 0.5, -0.145},
{-0.625, -0.5, -0.0625, -0.5, 0.5, 0.0625},
{-1.5, -0.5, -0.0625, -1.375, 0.5, 0.0625},
{-1.5, -0.5, -0.0625, -0.5, -0.375, 0.0625},
{-1.5, -0.5, 0, -0.5, 0.5, 0.02},
}
},
selection_box = {
type = "fixed",
fixed = {
{-1.5, -0.5, -0.0625, -0.5, 1.5, 0.0625},
{-0.5, -0.5, -0.0625, 0.5, 1.5, -0.1875}
}
},
on_place = onplace,
after_destruct = afterdestruct,
on_rightclick = rightclick,
})
minetest.register_node(doorb.."2", {
tiles = {
"myjdoors_door"..num.."a_edge.png",
"myjdoors_door"..num.."a_edge.png",
"myjdoors_door"..num.."a_edge.png",
"myjdoors_door"..num.."a_edge.png",
"myjdoors_door"..num.."a_top.png^[transformFX",
"myjdoors_door"..num.."a_top.png"
},
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
sunlight_propagates = true,
groups = {cracky = 1},
node_box = {
type = "fixed",
fixed = {
{ 0.375, -0.5, -0.1875, 0.5, 0.5, -0.0625},
{-0.5, -0.5, -0.1875, -0.375, 0.5, -0.0625},
{-0.5, 0.5, -0.1875, 0.5, 0.375, -0.0625},
{-0.5, -0.5, -0.125, 0.5, 0.5, -0.145},
{-0.625, -0.5, -0.0625, -0.5, 0.5, 0.0625},
{-1.5, -0.5, -0.0625, -1.375, 0.5, 0.0625},
{-1.5, 0.5, -0.0625, -0.5, 0.375, 0.0625},
{-1.5, -0.5, 0, -0.5, 0.5, 0.02},
}
},
selection_box = {
type = "fixed",
fixed = {
{0, 0, 0, 0, 0, 0},
}
},
})
minetest.register_node(doorc.."2", {
tiles = {
"myjdoors_door"..num.."a_edge.png",
"myjdoors_door"..num.."a_edge.png",
"myjdoors_door"..num.."a_edge.png",
"myjdoors_door"..num.."a_edge.png",
"myjdoors_door"..num.."a_bottom.png^[transformFX",
"myjdoors_door"..num.."a_bottom.png"
},
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
sunlight_propagates = true,
drop = doora,
groups = {cracky = 1},
node_box = {
type = "fixed",
fixed = {
{-0.625, -0.5, -0.1875, -0.5, 0.5, -0.0625},
{-1.5, -0.5, -0.1875, -1.375, 0.5, -0.0625},
{-1.5, -0.5, -0.1875, -0.5, -0.375, -0.0625},
{-1.5, -0.5, -0.125, -0.5, 0.5, -0.145},
{-0.625, -0.5, -0.0625, -0.5, 0.5, 0.0625},
{-1.5, -0.5, -0.0625, -1.375, 0.5, 0.0625},
{-1.5, -0.5, -0.0625, -0.5, -0.375, 0.0625},
{-1.5, -0.5, 0, -0.5, 0.5, 0.02},
}
},
selection_box = {
type = "fixed",
fixed = {
{-1.5, -0.5, 0.0625, -0.5, 1.5, -0.1875}
}
},
after_place_node = afterplace,
after_destruct = afterdestruct,
on_rightclick = rightclick,
})
minetest.register_node(doord.."2", {
tiles = {
"myjdoors_door"..num.."a_edge.png",
"myjdoors_door"..num.."a_edge.png",
"myjdoors_door"..num.."a_edge.png",
"myjdoors_door"..num.."a_edge.png",
"myjdoors_door"..num.."a_top.png^[transformFX",
"myjdoors_door"..num.."a_top.png"
},
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
sunlight_propagates = true,
groups = {cracky = 1},
node_box = {
type = "fixed",
fixed = {
{-0.625, -0.5, -0.1875, -0.5, 0.5, -0.0625},
{-1.5, -0.5, -0.1875, -1.375, 0.5, -0.0625},
{-1.5, 0.5, -0.1875, -0.5, 0.375, -0.0625},
{-1.5, -0.5, -0.125, -0.5, 0.5, -0.145},
{-0.625, -0.5, -0.0625, -0.5, 0.5, 0.0625},
{-1.5, -0.5, -0.0625, -1.375, 0.5, 0.0625},
{-1.5, 0.5, -0.0625, -0.5, 0.375, 0.0625},
{-1.5, -0.5, 0, -0.5, 0.5, 0.02},
}
},
selection_box = {
type = "fixed",
fixed = {
{0, 0, 0, 0, 0, 0},
}
},
})
end
function afterdestruct(pos, oldnode)
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z},{name="air"})
end
function rightclick(pos, node, player, itemstack, pointed_thing)
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})
if node.name == doora.."2" then
minetest.set_node(pos, {name=doorc.."2", param2=node.param2})
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z}, {name=doord.."2", param2=node.param2})
elseif node.name == doorc.."2" then
minetest.set_node(pos, {name=doora.."2", param2=node.param2})
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z}, {name=doorb.."2", param2=node.param2})
end
if a.name == doora then
minetest.set_node({x=pos.x, y=pos.y, z=pos.z-1}, {name=doorc, param2=a.param2})
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z-1}, {name=doord, param2=a.param2})
end
if b.name == doora then
minetest.set_node({x=pos.x, y=pos.y, z=pos.z+1}, {name=doorc, param2=b.param2})
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z+1}, {name=doord, param2=b.param2})
end
if c.name == doora then
minetest.set_node({x=pos.x+1, y=pos.y, z=pos.z}, {name=doorc, param2=c.param2})
minetest.set_node({x=pos.x+1,y=pos.y+1,z=pos.z}, {name=doord, param2=c.param2})
end
if d.name == doora then
minetest.set_node({x=pos.x-1, y=pos.y, z=pos.z}, {name=doorc, param2=d.param2})
minetest.set_node({x=pos.x-1,y=pos.y+1,z=pos.z}, {name=doord, param2=d.param2})
end
if a.name == doora.."2" then
minetest.set_node({x=pos.x, y=pos.y, z=pos.z-1}, {name=doorc.."2", param2=a.param2})
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z-1}, {name=doord.."2", param2=a.param2})
end
if b.name == doora.."2" then
minetest.set_node({x=pos.x, y=pos.y, z=pos.z+1}, {name=doorc.."2", param2=b.param2})
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z+1}, {name=doord.."2", param2=b.param2})
end
if c.name == doora.."2" then
minetest.set_node({x=pos.x+1, y=pos.y, z=pos.z}, {name=doorc.."2", param2=c.param2})
minetest.set_node({x=pos.x+1,y=pos.y+1,z=pos.z}, {name=doord.."2", param2=c.param2})
end
if d.name == doora.."2" then
minetest.set_node({x=pos.x-1, y=pos.y, z=pos.z}, {name=doorc.."2", param2=d.param2})
minetest.set_node({x=pos.x-1,y=pos.y+1,z=pos.z}, {name=doord.."2", param2=d.param2})
end
if a.name == doorc then
minetest.set_node({x=pos.x, y=pos.y, z=pos.z-1}, {name=doora, param2=a.param2})
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z-1}, {name=doorb, param2=a.param2})
end
if b.name == doorc then
minetest.set_node({x=pos.x, y=pos.y, z=pos.z+1}, {name=doora, param2=b.param2})
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z+1}, {name=doorb, param2=b.param2})
end
if c.name == doorc then
minetest.set_node({x=pos.x+1, y=pos.y, z=pos.z}, {name=doora, param2=c.param2})
minetest.set_node({x=pos.x+1,y=pos.y+1,z=pos.z}, {name=doorb, param2=c.param2})
end
if d.name == doorc then
minetest.set_node({x=pos.x-1, y=pos.y, z=pos.z}, {name=doora, param2=d.param2})
minetest.set_node({x=pos.x-1,y=pos.y+1,z=pos.z}, {name=doorb, param2=d.param2})
end
if a.name == doorc.."2" then
minetest.set_node({x=pos.x, y=pos.y, z=pos.z-1}, {name=doora.."2", param2=a.param2})
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z-1}, {name=doorb.."2", param2=a.param2})
end
if b.name == doorc.."2" then
minetest.set_node({x=pos.x, y=pos.y, z=pos.z+1}, {name=doora.."2", param2=b.param2})
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z+1}, {name=doorb.."2", param2=b.param2})
end
if c.name == doorc.."2" then
minetest.set_node({x=pos.x+1, y=pos.y, z=pos.z}, {name=doora.."2", param2=c.param2})
minetest.set_node({x=pos.x+1,y=pos.y+1,z=pos.z}, {name=doorb.."2", param2=c.param2})
end
if d.name == doorc.."2" then
minetest.set_node({x=pos.x-1, y=pos.y, z=pos.z}, {name=doora.."2", param2=d.param2})
minetest.set_node({x=pos.x-1,y=pos.y+1,z=pos.z}, {name=doorb.."2", param2=d.param2})
end
end
function afterplace(pos, placer, itemstack, pointed_thing)
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z},{name=doord,param2=nodeu.param2})
end
minetest.register_node(doora.."2", {
tiles = {
"myjdoors_door"..num.."a_edge.png",
"myjdoors_door"..num.."a_edge.png",
"myjdoors_door"..num.."a_edge.png",
"myjdoors_door"..num.."a_edge.png",
"myjdoors_door"..num.."a_bottom.png^[transformFX",
"myjdoors_door"..num.."a_bottom.png"
},
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
drop = doora,
sunlight_propagates = true,
groups = {cracky = 3},
node_box = {
type = "fixed",
fixed = {
{0.375, -0.5, -0.1875, 0.5, 0.5, -0.0625},
{-0.5, -0.5, -0.1875, -0.375, 0.5, -0.0625},
{-0.5, -0.5, -0.1875, 0.5, -0.375, -0.0625},
{-0.5, -0.5, -0.125, 0.5, 0.5, -0.145},
{-0.625, -0.5, -0.0625, -0.5, 0.5, 0.0625},
{-1.5, -0.5, -0.0625, -1.375, 0.5, 0.0625},
{-1.5, -0.5, -0.0625, -0.5, -0.375, 0.0625},
{-1.5, -0.5, 0, -0.5, 0.5, 0.02},
}
},
selection_box = {type = "fixed",fixed = {{-1.5, -0.5, -0.0625, -0.5, 1.5, 0.0625},{-0.5, -0.5, -0.0625, 0.5, 1.5, -0.1875}}},
on_place = onplace,
after_destruct = afterdestruct,
on_rightclick = rightclick,
})
minetest.register_node(doorb.."2", {
tiles = {
"myjdoors_door"..num.."a_edge.png",
"myjdoors_door"..num.."a_edge.png",
"myjdoors_door"..num.."a_edge.png",
"myjdoors_door"..num.."a_edge.png",
"myjdoors_door"..num.."a_top.png^[transformFX",
"myjdoors_door"..num.."a_top.png"
},
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
sunlight_propagates = true,
groups = {cracky = 1},
node_box = {
type = "fixed",
fixed = {
{0.375, -0.5, -0.1875, 0.5, 0.5, -0.0625},
{-0.5, -0.5, -0.1875, -0.375, 0.5, -0.0625},
{-0.5, 0.5, -0.1875, 0.5, 0.375, -0.0625},
{-0.5, -0.5, -0.125, 0.5, 0.5, -0.145},
{-0.625, -0.5, -0.0625, -0.5, 0.5, 0.0625},
{-1.5, -0.5, -0.0625, -1.375, 0.5, 0.0625},
{-1.5, 0.5, -0.0625, -0.5, 0.375, 0.0625},
{-1.5, -0.5, 0, -0.5, 0.5, 0.02},
}
},
selection_box = {
type = "fixed",
fixed = {
{0, 0, 0, 0, 0, 0},
}
},
})minetest.register_node(doorc.."2", {
tiles = {
"myjdoors_door"..num.."a_edge.png",
"myjdoors_door"..num.."a_edge.png",
"myjdoors_door"..num.."a_edge.png",
"myjdoors_door"..num.."a_edge.png",
"myjdoors_door"..num.."a_bottom.png^[transformFX",
"myjdoors_door"..num.."a_bottom.png"
},
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
sunlight_propagates = true,
drop = doora,
groups = {cracky = 1},
node_box = {
type = "fixed",
fixed = {
{-0.625, -0.5, -0.1875, -0.5, 0.5, -0.0625},
{-1.5, -0.5, -0.1875, -1.375, 0.5, -0.0625},
{-1.5, -0.5, -0.1875, -0.5, -0.375, -0.0625},
{-1.5, -0.5, -0.125, -0.5, 0.5, -0.145},
{-0.625, -0.5, -0.0625, -0.5, 0.5, 0.0625},
{-1.5, -0.5, -0.0625, -1.375, 0.5, 0.0625},
{-1.5, -0.5, -0.0625, -0.5, -0.375, 0.0625},
{-1.5, -0.5, 0, -0.5, 0.5, 0.02},
}
},
selection_box = {
type = "fixed",
fixed = {
{-1.5, -0.5, 0.0625, -0.5, 1.5, -0.1875}
}
},
after_place_node = afterplace,
after_destruct = afterdestruct,
on_rightclick = rightclick,
})
minetest.register_node(doord.."2", {
tiles = {
"myjdoors_door"..num.."a_edge.png",
"myjdoors_door"..num.."a_edge.png",
"myjdoors_door"..num.."a_edge.png",
"myjdoors_door"..num.."a_edge.png",
"myjdoors_door"..num.."a_top.png^[transformFX",
"myjdoors_door"..num.."a_top.png"
},
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
sunlight_propagates = true,
groups = {cracky = 1},
node_box = {
type = "fixed",
fixed = {
{-0.625, -0.5, -0.1875, -0.5, 0.5, -0.0625},
{-1.5, -0.5, -0.1875, -1.375, 0.5, -0.0625},
{-1.5, 0.5, -0.1875, -0.5, 0.375, -0.0625},
{-1.5, -0.5, -0.125, -0.5, 0.5, -0.145},
{-0.625, -0.5, -0.0625, -0.5, 0.5, 0.0625},
{-1.5, -0.5, -0.0625, -1.375, 0.5, 0.0625},
{-1.5, 0.5, -0.0625, -0.5, 0.375, 0.0625},
{-1.5, -0.5, 0, -0.5, 0.5, 0.02},
}
},
selection_box = {
type = "fixed",
fixed = {
{0, 0, 0, 0, 0, 0},
}
},
})
for _,door in ipairs(doors) do
add_door(unpack(door))
end

View file

@ -61,7 +61,7 @@ Change log:
- 3.1 - Ability to hide protection blocks using /protector_hide and /protector_show , italian local added (thanks Hamlet)
- 3.2 - Defaults to Minetest translation if found, otherwise intllib fallback if loaded, locale files updated for both. Added 'protector_msg' setting for player text.
- 3.3 - Added support for playerfactions new api (thanks louisroyer), added limiter to protection radius of 22.
- 3.4 - Player flip and hurt functions moved to minetest.register_protection_violation function (thanks hlqkj)
- 3.4 - Player flip and hurt functions moved to minetest.register_protection_violation function (thanks hlqkj), added 'protector_crafts' setting, changed wood doors n chests to immediate_dig for mineclone2 fix.
Lucky Blocks: 10

View file

@ -9,6 +9,9 @@ local F = minetest.formspec_escape
-- MineClone2 support
local mcl = not minetest.registered_items["default:steel_ingot"]
-- Are crafts enabled?
local protector_crafts = minetest.settings:get_bool("protector_crafts") ~= false
-- Registers a door
function register_door(name, def)
def.groups.not_in_creative_inventory = 1
@ -308,7 +311,7 @@ register_door(name, {
description = S("Protected Wooden Door"),
inventory_image = "doors_wood.png^protector_logo.png",
groups = {
snappy = 1, choppy = 2, oddly_breakable_by_hand = 2,
snappy = 1, choppy = 2, dig_immediate = 2,
unbreakable = 1, --door = 1
},
tiles_bottom = {"doors_wood_b.png^protector_logo.png", "doors_brown.png"},
@ -317,29 +320,31 @@ register_door(name, {
sunlight = false,
})
if mcl then
minetest.register_craft({
output = name,
recipe = {
{"mcl_doors:wooden_door", "mcl_core:gold_ingot"}
}
})
else
minetest.register_craft({
output = name,
recipe = {
{"group:wood", "group:wood"},
{"group:wood", "default:copper_ingot"},
{"group:wood", "group:wood"}
}
})
if protector_crafts then
if mcl then
minetest.register_craft({
output = name,
recipe = {
{"mcl_doors:wooden_door", "mcl_core:gold_ingot"}
}
})
else
minetest.register_craft({
output = name,
recipe = {
{"group:wood", "group:wood"},
{"group:wood", "default:copper_ingot"},
{"group:wood", "group:wood"}
}
})
minetest.register_craft({
output = name,
recipe = {
{"doors:door_wood", "default:copper_ingot"}
}
})
minetest.register_craft({
output = name,
recipe = {
{"doors:door_wood", "default:copper_ingot"}
}
})
end
end
-- Protected Steel Door
@ -359,29 +364,31 @@ register_door(name, {
sunlight = false,
})
if mcl then
minetest.register_craft({
output = name,
recipe = {
{"mcl_doors:iron_door", "mcl_core:gold_ingot"}
}
})
else
minetest.register_craft({
output = name,
recipe = {
{"default:steel_ingot", "default:steel_ingot"},
{"default:steel_ingot", "default:copper_ingot"},
{"default:steel_ingot", "default:steel_ingot"}
}
})
if protector_crafts then
if mcl then
minetest.register_craft({
output = name,
recipe = {
{"mcl_doors:iron_door", "mcl_core:gold_ingot"}
}
})
else
minetest.register_craft({
output = name,
recipe = {
{"default:steel_ingot", "default:steel_ingot"},
{"default:steel_ingot", "default:copper_ingot"},
{"default:steel_ingot", "default:steel_ingot"}
}
})
minetest.register_craft({
output = name,
recipe = {
{"doors:door_steel", "default:copper_ingot"}
}
})
minetest.register_craft({
output = name,
recipe = {
{"doors:door_steel", "default:copper_ingot"}
}
})
end
end
----trapdoor----
@ -454,34 +461,36 @@ register_trapdoor("protector:trapdoor", {
tile_front = "doors_trapdoor.png^protector_logo.png",
tile_side = "doors_trapdoor_side.png",
groups = {
snappy = 1, choppy = 2, oddly_breakable_by_hand = 2,
snappy = 1, choppy = 2, dig_immediate = 2,
unbreakable = 1, --door = 1
},
sounds = default.node_sound_wood_defaults(),
})
if mcl then
minetest.register_craft({
output = "protector:trapdoor",
recipe = {
{"mcl_doors:trapdoor", "mcl_core:gold_ingot"}
}
})
else
minetest.register_craft({
output = "protector:trapdoor 2",
recipe = {
{"group:wood", "default:copper_ingot", "group:wood"},
{"group:wood", "group:wood", "group:wood"},
}
})
if protector_crafts then
if mcl then
minetest.register_craft({
output = "protector:trapdoor",
recipe = {
{"mcl_doors:trapdoor", "mcl_core:gold_ingot"}
}
})
else
minetest.register_craft({
output = "protector:trapdoor 2",
recipe = {
{"group:wood", "default:copper_ingot", "group:wood"},
{"group:wood", "group:wood", "group:wood"},
}
})
minetest.register_craft({
output = "protector:trapdoor",
recipe = {
{"doors:trapdoor", "default:copper_ingot"}
}
})
minetest.register_craft({
output = "protector:trapdoor",
recipe = {
{"doors:trapdoor", "default:copper_ingot"}
}
})
end
end
-- Protected Steel Trapdoor
@ -499,28 +508,30 @@ register_trapdoor("protector:trapdoor_steel", {
sounds = default.node_sound_wood_defaults(),
})
if mcl then
minetest.register_craft({
output = "protector:trapdoor_steel",
recipe = {
{"mcl_doors:iron_trapdoor", "mcl_core:gold_ingot"}
}
})
else
minetest.register_craft({
output = "protector:trapdoor_steel",
recipe = {
{"default:copper_ingot", "default:steel_ingot"},
{"default:steel_ingot", "default:steel_ingot"},
}
})
if protector_crafts then
if mcl then
minetest.register_craft({
output = "protector:trapdoor_steel",
recipe = {
{"mcl_doors:iron_trapdoor", "mcl_core:gold_ingot"}
}
})
else
minetest.register_craft({
output = "protector:trapdoor_steel",
recipe = {
{"default:copper_ingot", "default:steel_ingot"},
{"default:steel_ingot", "default:steel_ingot"},
}
})
minetest.register_craft({
output = "protector:trapdoor_steel",
recipe = {
{"doors:trapdoor_steel", "default:copper_ingot"}
}
})
minetest.register_craft({
output = "protector:trapdoor_steel",
recipe = {
{"doors:trapdoor_steel", "default:copper_ingot"}
}
})
end
end
-- Protected Chest
@ -533,7 +544,7 @@ minetest.register_node("protector:chest", {
"default_chest_side.png", "default_chest_front.png^protector_logo.png"
},
paramtype2 = "facedir",
groups = {choppy = 2, oddly_breakable_by_hand = 2, unbreakable = 1},
groups = {dig_immediate = 2, unbreakable = 1},
legacy_facedir_simple = true,
is_ground_content = false,
sounds = default.node_sound_wood_defaults(),
@ -720,27 +731,29 @@ end)
-- Protected Chest recipes
if mcl then
minetest.register_craft({
output = "protector:chest",
recipe = {
{"mcl_chests:chest", "mcl_core:gold_ingot"},
}
})
else
minetest.register_craft({
output = "protector:chest",
recipe = {
{"group:wood", "group:wood", "group:wood"},
{"group:wood", "default:copper_ingot", "group:wood"},
{"group:wood", "group:wood", "group:wood"},
}
})
if protector_crafts then
if mcl then
minetest.register_craft({
output = "protector:chest",
recipe = {
{"mcl_chests:chest", "mcl_core:gold_ingot"},
}
})
else
minetest.register_craft({
output = "protector:chest",
recipe = {
{"group:wood", "group:wood", "group:wood"},
{"group:wood", "default:copper_ingot", "group:wood"},
{"group:wood", "group:wood", "group:wood"},
}
})
minetest.register_craft({
output = "protector:chest",
recipe = {
{"default:chest", "default:copper_ingot"},
}
})
minetest.register_craft({
output = "protector:chest",
recipe = {
{"default:chest", "default:copper_ingot"},
}
})
end
end

View file

@ -28,5 +28,8 @@ protector_hud_interval (Protector HUD Interval) int 5
# Enables craft recipe for protection block
protector_recipe (Enable Protector recipe) bool true
# Enables craft recipes for protected doors and chest
protector_crafts (Enable Protector door/chest recipes) bool true
# Enables protection messages in player chat
protector_msg (Enable Protector Messages) bool true

View file

@ -0,0 +1,3 @@
SPECOPSOUTFIT3
SPECOPSOUTFIT3
CC BY-NC-SA 4.0

View file

@ -0,0 +1,3 @@
THE TRUE AESTHER
THE TRUE AESTHER gaming
CC 0 (1.0)

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 465 B

View file

@ -152,6 +152,10 @@ minetest.after(0.01, function()
end
end
end
for _, callback in ipairs(ui.initialized_callbacks) do
callback()
end
end)
@ -212,10 +216,15 @@ function ui.register_craft(options)
if options.type == "normal" and options.width == 0 then
options = { type = "shapeless", items = options.items, output = options.output, width = 0 }
end
if not ui.crafts_for.recipe[itemstack:get_name()] then
ui.crafts_for.recipe[itemstack:get_name()] = {}
local item_name = itemstack:get_name()
if not ui.crafts_for.recipe[item_name] then
ui.crafts_for.recipe[item_name] = {}
end
table.insert(ui.crafts_for.recipe[item_name],options)
for _, callback in ipairs(ui.craft_registered_callbacks) do
callback(item_name, options)
end
table.insert(ui.crafts_for.recipe[itemstack:get_name()],options)
end
@ -309,6 +318,32 @@ function ui.register_button(name, def)
table.insert(ui.buttons, def)
end
function ui.register_on_initialized(callback)
if type(callback) ~= "function" then
error(("Initialized callback must be a function, %s given."):format(type(callback)))
end
table.insert(ui.initialized_callbacks, callback)
end
function ui.register_on_craft_registered(callback)
if type(callback) ~= "function" then
error(("Craft registered callback must be a function, %s given."):format(type(callback)))
end
table.insert(ui.craft_registered_callbacks, callback)
end
function ui.get_recipe_list(output)
return ui.crafts_for.recipe[output]
end
function ui.get_registered_outputs()
local outputs = {}
for item_name, _ in pairs(ui.crafts_for.recipe) do
table.insert(outputs, item_name)
end
return outputs
end
function ui.is_creative(playername)
return minetest.check_player_privs(playername, {creative=true})
or minetest.settings:get_bool("creative_mode")

View file

@ -24,8 +24,7 @@ minetest.register_on_joinplayer(function(player)
unified_inventory.alternate[player_name] = 1
unified_inventory.current_item[player_name] = nil
unified_inventory.current_craft_direction[player_name] = "recipe"
unified_inventory.set_inventory_formspec(player,
unified_inventory.default)
unified_inventory.set_inventory_formspec(player, unified_inventory.default)
-- Refill slot
local refill = minetest.create_detached_inventory(player_name.."refill", {

View file

@ -20,6 +20,64 @@ Grouped by use-case, afterwards sorted alphabetically.
* Checks whether creative is enabled or the player has `creative`
Callbacks
---------
Register a callback that will be run whenever a craft is registered via unified_inventory.register_craft:
unified_inventory.register_on_craft_registered(
function (item_name, options)
-- item_name (string): name of the output item, equivalent to `ItemStack:get_name()`
-- options (table): definition table of crafts registered by `unified_inventory.register_craft`
end
)
Register a callback that will be run after all mods have loaded and after the unified_inventory mod has initialised all its internal structures:
unified_inventory.register_on_initialized(callback)
-- The callback is passed no arguments
Accessing Data
--------------
These methods should be used instead of accessing the unified_inventory data structures directly - this will ensure your code survives any potential restructuring of the mod.
Get a list of recipes for a particular output item:
unified_inventory.get_recipe_list(output_item)
Returns a list of tables, each holding a recipe definition, like:
{
{
type = "normal",
items = { "default:stick", "default:stick", "default:stick", "default:stick" },
output = "default:wood",
width = 2
},
{
type = "shapeless",
items = { "default:tree" },
output = "default:wood 4",
width = 0
},
...
}
Get a list of all the output items crafts have been registered for:
unified_inventory.get_registered_outputs()
Returns a list of item names, like:
{
"default:stone",
"default:chest",
"default:brick",
"doors:door_wood",
...
}
Pages
-----

View file

@ -24,6 +24,8 @@ unified_inventory = {
filtered_items_list = {},
pages = {},
buttons = {},
initialized_callbacks = {},
craft_registered_callbacks = {},
-- Homepos stuff
home_pos = {},

View file

@ -375,6 +375,5 @@ function ui.apply_filter(player, filter, search_dir)
ui.current_index[player_name] = 1
ui.activefilter[player_name] = filter
ui.active_search_direction[player_name] = search_dir
ui.set_inventory_formspec(player,
ui.current_page[player_name])
ui.set_inventory_formspec(player, ui.current_page[player_name])
end

View file

@ -330,8 +330,9 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
end
end)
minetest.register_on_joinplayer(function(player)
-- waypoints_temp must be initialized before the general unified_inventory
-- joinplayer callback is run for updating the inventory
table.insert(minetest.registered_on_joinplayers, 1, function(player)
local player_name = player:get_player_name()
local waypoints = get_waypoint_data(player)