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,6 +230,16 @@ mobs:register_mob("mob_horse:horse", {
end
})
-- 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"},
@ -235,8 +248,10 @@ mobs:spawn({
chance = 16000,
min_height = 10,
max_height = 31000,
day_toggle = true,
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,12 +14,7 @@ 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]
local function add_door(desc, img)
doors.register("my_castle_doors:"..img.."_locked", {
description = desc.." Locked",
inventory_image = "mydoors_"..img.."_inv.png",
@ -29,6 +24,11 @@ doors.register("my_castle_doors:"..img.."_locked", {
})
end
for _,cdoor in ipairs(cdoor_list) do
add_door(unpack(cdoor))
end
---[[ Crafts
minetest.register_craft({

View file

@ -14,12 +14,7 @@ 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]
local function add_door(desc, img)
doors.register_door("my_castle_doors:"..img, {
description = desc,
inventory_image = "mydoors_"..img.."_inv.png",
@ -29,6 +24,11 @@ doors.register_door("my_castle_doors:"..img, {
})
end
for _,cdoor in ipairs(cdoor_list) do
add_door(unpack(cdoor))
end
-- Crafts
minetest.register_craft({

View file

@ -3,12 +3,7 @@ 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]
local function add_door(desc, img)
doors.register_door("my_cottage_doors:"..img.."_locked", {
description = desc.." Locked",
inventory_image = "mycdoors_"..img.."_inv.png",
@ -18,6 +13,11 @@ doors.register_door("my_cottage_doors:"..img.."_locked", {
})
end
for _,cdoor in ipairs(cdoor_list) do
add_door(unpack(cdoor))
end
-- Crafts
minetest.register_craft({

View file

@ -3,12 +3,7 @@ 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]
local function add_door(desc, img)
doors.register_door("my_cottage_doors:"..img, {
description = desc,
inventory_image = "mycdoors_"..img.."_inv.png",
@ -18,6 +13,11 @@ doors.register_door("my_cottage_doors:"..img, {
})
end
for _,cdoor in ipairs(cdoor_list) do
add_door(unpack(cdoor))
end
-- Crafts
minetest.register_craft({

View file

@ -6,14 +6,7 @@ local cdoor_list = { --Number , Description , Inven Image , Image
{ "5", "Mese Door" , "mese", "mese_crystal"},
}
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]
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",
@ -22,9 +15,7 @@ doors.register_door("my_default_doors:door"..num.."_locked", {
protected = true,
})
-- Crafts
minetest.register_craft({
output = "my_default_doors:door"..num.."_locked 1",
recipe = {
@ -34,3 +25,7 @@ minetest.register_craft({
}
})
end
for _,cdoor in ipairs(cdoor_list) do
add_door(unpack(cdoor))
end

View file

@ -6,14 +6,7 @@ local cdoor_list = { --Number , Description , Inven Image , Image
{ "5", "Mese Door" , "mese", "mese_crystal"},
}
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]
local function add_door(num, desc, img, itm)
doors.register_door("my_default_doors:door"..num, {
description = desc,
inventory_image = "mydoors_"..img.."_inv.png",
@ -22,9 +15,7 @@ doors.register_door("my_default_doors:door"..num, {
protected = false,
})
-- Crafts
minetest.register_craft({
output = "my_default_doors:door"..num.." 1",
recipe = {
@ -34,3 +25,7 @@ minetest.register_craft({
}
})
end
for _,cdoor in ipairs(cdoor_list) do
add_door(unpack(cdoor))
end

View file

@ -33,11 +33,8 @@ 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]
local function add_door(color, desc, img)
my_door_wood_block_stairs("my_door_wood:wood_"..color, {
description = desc.." Wood",
drawtype = "normal",
@ -46,11 +43,9 @@ my_door_wood_block_stairs("my_door_wood:wood_"..color, {
paramtype = "light",
groups = {cracky = 2, choppy = 2},
sounds = default.node_sound_wood_defaults(),
})
-- Crafts
minetest.register_craft({
output = "my_door_wood:wood_"..color,
recipe = {
@ -60,3 +55,7 @@ minetest.register_craft({
}
})
end
for _,door in ipairs(door_wood) do
add_door(unpack(door))
end

View file

@ -9,12 +9,7 @@ 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]
local function add_door(desc, img)
doors.register_door("my_fancy_doors:"..img.."_locked", {
description = desc.." Locked",
inventory_image = "myfdoors_"..img.."_inv.png",
@ -24,6 +19,11 @@ doors.register_door("my_fancy_doors:"..img.."_locked", {
})
end
for _,fdoor in ipairs(fdoor_list) do
add_door(unpack(fdoor))
end
-- Crafts
minetest.register_craft({

View file

@ -9,12 +9,7 @@ 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]
local function add_door(desc, img)
doors.register_door("my_fancy_doors:"..img, {
description = desc,
inventory_image = "myfdoors_"..img.."_inv.png",
@ -24,6 +19,11 @@ doors.register_door("my_fancy_doors:"..img, {
})
end
for _,fdoor in ipairs(fdoor_list) do
add_door(unpack(fdoor))
end
-- Crafts
minetest.register_craft({

View file

@ -1,7 +1,6 @@
local doorcolors = {"white","red","black"}
for i = 1,#doorcolors do
local col = doorcolors[i]
local function add_door(col)
minetest.register_node("my_future_doors:door1a_"..col, {
description = "Door 1a",
tiles = {
@ -40,29 +39,41 @@ minetest.register_node("my_future_doors:door1a_"..col, {
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
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({x=pos.x,y=pos.y+1,z=pos.z},{name="my_future_doors:door1b_"..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,
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 timer = minetest.get_node_timer(pos)
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({x=pos.x,y=pos.y+1,z=pos.z},{name="my_future_doors:door1d_"..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,
@ -101,7 +112,8 @@ minetest.register_node("my_future_doors:door1b_"..col, {
{-0.5, -0.5, -0.5, -0.5, -0.5, -0.5},
}
},
})minetest.register_node("my_future_doors:door1c_"..col, {
})
minetest.register_node("my_future_doors:door1c_"..col, {
tiles = {
"myndoors_door1_"..col..".png",
"myndoors_door1_"..col..".png",
@ -133,16 +145,20 @@ minetest.register_node("my_future_doors:door1b_"..col, {
{-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)
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z},{name="my_future_doors:door1d_"..col,param2=nodeu.param2})
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({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_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})
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, {
@ -188,3 +204,7 @@ minetest.register_craft({
}
})
end
for _,col in ipairs(doorcolors) do
add_door(col)
end

View file

@ -1,150 +1,122 @@
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 = {
{"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", ""}},
{"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", ""}},
{"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", ""}},
{"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", ""}},
{"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",""}},
{ "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",""}},
{ "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",""}},
{ "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 add_door(doora, doorb, doorc, doord, num, des, recipe)
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
local pos2 = vector.add(pos1, {x=0,y=1,z=0})
if 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
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 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
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.get_node(pt3).name == doora then
minetest.set_node(pt, {name=doora, param2=p4})
minetest.set_node(pt2, {name=doorb, param2=p4})
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(pt, {name=doora, param2=p2})
minetest.set_node(pt2, {name=doorb, param2=p2})
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
local function afterdestruct(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
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})
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})
-- 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
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
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})
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 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})
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})
-- 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
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
end
minetest.register_node(doora, {
@ -207,7 +179,8 @@ minetest.register_node(doorb, {
{0, 0, 0, 0, 0, 0},
}
},
})minetest.register_node(doorc, {
})
minetest.register_node(doorc, {
tiles = {
"myndoors_door"..num.."a_edge.png",
"myndoors_door"..num.."a_edge.png",
@ -268,3 +241,7 @@ minetest.register_craft({
recipe = recipe
})
end
for i, door in ipairs(doors) do
add_door(unpack(door))
end

View file

@ -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 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())
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})
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
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({x=pos.x,y=pos.y+1,z=pos.z},{name="air"})
--end
minetest.set_node(above, {name="air"})
end,
})
minetest.register_node("my_garage_door:garage_door_top", {
@ -105,27 +141,34 @@ minetest.register_node("my_garage_door:garage_door_open", {
selection_box = {type = "fixed",fixed = {{-1.5, 0.375, -0.5, 1.5, 0.5, 1.5},}},
on_rightclick = function(pos, node, player, itemstack, pointed_thing)
local p2 = node.param2 --minetest.dir_to_facedir(player:get_look_dir())
local t1 = {x=pos.x,y=pos.y+1,z=pos.z}
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
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"})

View file

@ -10,13 +10,7 @@ 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]
local function add_door(img, desc)
doors.register_door("my_hidden_doors:hidden_door"..img, {
description = desc.." Locked",
inventory_image = "mydoors_"..img.."_inv.png",
@ -25,8 +19,13 @@ doors.register_door("my_hidden_doors:hidden_door"..img, {
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

@ -32,73 +32,65 @@ 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
local pos2 = vector.add(pos1, {x=0,y=1,z=0})
if 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
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 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
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.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})
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(pt, {name="my_misc_doors:door2a", param2=p2})
minetest.set_node(pt2, {name="my_misc_doors:door2b", param2=p2})
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({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 timer = minetest.get_node_timer(pos)
local a = minetest.get_node({x=pos.x, y=pos.y, z=pos.z-1})
local b = minetest.get_node({x=pos.x, y=pos.y, z=pos.z+1})
local c = minetest.get_node({x=pos.x+1, y=pos.y, z=pos.z})
local d = minetest.get_node({x=pos.x-1, y=pos.y, z=pos.z})
minetest.set_node(pos, {name="my_misc_doors:door2c", param2=node.param2})
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z}, {name="my_misc_doors:door2d", param2=node.param2})
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})
-- 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
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})
end
timer:start(3)
end,
})
minetest.register_node("my_misc_doors:door2b", {
@ -155,38 +147,31 @@ minetest.register_node("my_misc_doors:door2c", {
{0, 0, 0, 0, 0, 0},
}
},
drop = "my_misc_doors:door2a",
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})
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({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_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})
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
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,
})
minetest.register_node("my_misc_doors:door2d", {

View file

@ -6,12 +6,7 @@ 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]
local function add_door(desc, img)
doors.register_door("my_misc_doors:"..img.."_locked", {
description = desc.." Locked",
inventory_image = "mymdoors_"..img.."_inv.png",
@ -21,6 +16,11 @@ doors.register_door("my_misc_doors:"..img.."_locked", {
})
end
for _,mdoor in ipairs(mdoor_list) do
add_door(unpack(mdoor))
end
-- Crafts
minetest.register_craft({

View file

@ -6,12 +6,7 @@ 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]
local function add_door(desc, img)
doors.register_door("my_misc_doors:"..img, {
description = desc,
inventory_image = "mymdoors_"..img.."_inv.png",
@ -21,6 +16,11 @@ doors.register_door("my_misc_doors:"..img, {
})
end
for _,mdoor in ipairs(mdoor_list) do
add_door(unpack(mdoor))
end
-- Crafts
minetest.register_craft({

View file

@ -4,12 +4,8 @@ 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]
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",
@ -19,6 +15,11 @@ doors.register_door("my_old_doors:door"..num.."_locked", {
})
end
for _,cdoor in ipairs(cdoor_list) do
add_door(unpack(cdoor))
end
-- Crafts
minetest.register_craft({

View file

@ -4,11 +4,8 @@ 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]
local function add_door(num, desc, img)
doors.register_door("my_old_doors:door"..num, {
description = desc,
inventory_image = "mydoors_"..img.."_inv.png",
@ -18,6 +15,11 @@ doors.register_door("my_old_doors:door"..num, {
})
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"},
@ -8,11 +7,8 @@ local doorcol = {
{"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]
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},
@ -44,19 +40,31 @@ minetest.register_node("my_saloon_doors:door1a_"..col, {
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
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,
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())
@ -98,12 +106,14 @@ minetest.register_node("my_saloon_doors:door1b_"..col, {
{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({x=pos.x,y=pos.y+1,z=pos.z},{name="my_saloon_doors:door1b_"..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

@ -3,123 +3,91 @@ local doors = {
{"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
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
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
function afterdestruct(pos, oldnode)
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z},{name="air"})
local function afterdestruct(pos, oldnode)
minetest.set_node(vector.add(pos, {x=0,y=1,z=0}), {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})
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(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(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
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})
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, {
@ -155,7 +123,13 @@ minetest.register_node(doora, {
{-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}}},
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,
@ -199,7 +173,8 @@ minetest.register_node(doorb, {
{0, 0, 0, 0, 0, 0},
}
},
})minetest.register_node(doorc, {
})
minetest.register_node(doorc, {
tiles = {
"myjdoors_door"..num.."a_edge.png",
"myjdoors_door"..num.."a_edge.png",
@ -309,16 +284,43 @@ minetest.register_node("my_sliding_doors:jpanel"..num, {
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})
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({x=pos.x,y=pos.y+1,z=pos.z},{name = "my_sliding_doors:jpanel_top"..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({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,
})
minetest.register_node("my_sliding_doors:jpanel_top"..num, {
@ -390,16 +392,43 @@ minetest.register_node("my_sliding_doors:jpanel_corner_"..num, {
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})
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({x=pos.x,y=pos.y+1,z=pos.z},{name = "my_sliding_doors:jpanel_corner_top"..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({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,
})
minetest.register_node("my_sliding_doors:jpanel_corner_top"..num, {
@ -436,3 +465,7 @@ minetest.register_node("my_sliding_doors:jpanel_corner_top"..num, {
},
})
end
for _,door in ipairs(doors) do
add_door(unpack(door))
end

View file

@ -3,140 +3,96 @@ local doors = {
{"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 function add_door(doora, doorb, doorc, doord, num)
local 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
local pos2 = vector.add(pos, {x=0,y=1,z=0})
if 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}
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
end
if minetest.get_node(pt3).name ~= "air" then
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
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})
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(pt, {name=doora.."2", param2=p2})
minetest.set_node(pt2, {name=doorb.."2", param2=p2})
end
minetest.set_node(pos1, {name=doora.."2", param2=p2})
minetest.set_node(pos2, {name=doorb.."2", param2=p2})
end
function afterdestruct(pos, oldnode)
minetest.set_node({x=pos.x,y=pos.y+1,z=pos.z},{name="air"})
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
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})
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)
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})
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({x=pos.x,y=pos.y+1,z=pos.z}, {name=doorb.."2", param2=node.param2})
minetest.set_node(vector.add(pos, {x=0,y=1,z=0}), {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})
-- 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
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})
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
@ -171,7 +127,13 @@ minetest.register_node(doora.."2", {
{-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}}},
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,
@ -215,7 +177,8 @@ minetest.register_node(doorb.."2", {
{0, 0, 0, 0, 0, 0},
}
},
})minetest.register_node(doorc.."2", {
})
minetest.register_node(doorc.."2", {
tiles = {
"myjdoors_door"..num.."a_edge.png",
"myjdoors_door"..num.."a_edge.png",
@ -294,3 +257,7 @@ minetest.register_node(doord.."2", {
},
})
end
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,6 +320,7 @@ register_door(name, {
sunlight = false,
})
if protector_crafts then
if mcl then
minetest.register_craft({
output = name,
@ -341,6 +345,7 @@ minetest.register_craft({
}
})
end
end
-- Protected Steel Door
@ -359,6 +364,7 @@ register_door(name, {
sunlight = false,
})
if protector_crafts then
if mcl then
minetest.register_craft({
output = name,
@ -383,6 +389,7 @@ minetest.register_craft({
}
})
end
end
----trapdoor----
@ -454,12 +461,13 @@ 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 protector_crafts then
if mcl then
minetest.register_craft({
output = "protector:trapdoor",
@ -483,6 +491,7 @@ minetest.register_craft({
}
})
end
end
-- Protected Steel Trapdoor
@ -499,6 +508,7 @@ register_trapdoor("protector:trapdoor_steel", {
sounds = default.node_sound_wood_defaults(),
})
if protector_crafts then
if mcl then
minetest.register_craft({
output = "protector:trapdoor_steel",
@ -522,6 +532,7 @@ minetest.register_craft({
}
})
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,6 +731,7 @@ end)
-- Protected Chest recipes
if protector_crafts then
if mcl then
minetest.register_craft({
output = "protector:chest",
@ -744,3 +756,4 @@ minetest.register_craft({
}
})
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)