Add new nodes and tweaks
52
crafts.lua
@ -1,3 +1,12 @@
|
||||
minetest.register_craft({
|
||||
output = "xdecor:baricade",
|
||||
recipe = {
|
||||
{"group:stick", "default:steel_ingot", "group:stick"},
|
||||
{"", "group:stick", ""},
|
||||
{"group:stick", "", "group:stick"}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "xdecor:candle",
|
||||
recipe = {
|
||||
@ -138,6 +147,15 @@ minetest.register_craftitem("xdecor:hammer", {
|
||||
description = "Hammer",
|
||||
inventory_image = "xdecor_hammer.png"
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "xdecor:japanese_door",
|
||||
recipe = {
|
||||
{"group:wood", "group:wood"},
|
||||
{"default:paper", "default:paper"},
|
||||
{"group:wood", "group:wood"}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "xdecor:lantern",
|
||||
@ -147,6 +165,15 @@ minetest.register_craft({
|
||||
{"default:iron_lump"}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "xdecor:mailbox",
|
||||
recipe = {
|
||||
{"default:steel_ingot", "default:steel_ingot", "default:steel_ingot"},
|
||||
{"dye:red", "default:paper", "dye:red"},
|
||||
{"default:steel_ingot", "default:steel_ingot", "default:steel_ingot"}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "xdecor:metal_cabinet",
|
||||
@ -210,6 +237,15 @@ minetest.register_craft({
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "xdecor:stonepath 16",
|
||||
recipe = {
|
||||
{"stairs:slab_stone", "", "stairs:slab_stone"},
|
||||
{"", "stairs:slab_stone", ""},
|
||||
{"stairs:slab_stone", "", "stairs:slab_stone"}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "xdecor:table",
|
||||
recipe = {
|
||||
@ -219,6 +255,13 @@ minetest.register_craft({
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "xdecor:tatami",
|
||||
recipe = {
|
||||
{"farming:wheat", "farming:wheat", "farming:wheat"}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "xdecor:tv",
|
||||
recipe = {
|
||||
@ -253,3 +296,12 @@ minetest.register_craft({
|
||||
{"group:wood", "group:wood"}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "xdecor:woodglass_door",
|
||||
recipe = {
|
||||
{"default:glass", "default:glass"},
|
||||
{"group:wood", "group:wood"},
|
||||
{"group:wood", "group:wood"}
|
||||
}
|
||||
})
|
||||
|
@ -1,2 +1,3 @@
|
||||
default
|
||||
moreblocks?
|
||||
doors
|
||||
xpanes
|
||||
|
1
init.lua
@ -5,5 +5,6 @@ dofile(modpath.."/handlers/nodeboxes.lua")
|
||||
dofile(modpath.."/handlers/registration.lua")
|
||||
dofile(modpath.."/crafts.lua")
|
||||
dofile(modpath.."/itemframes.lua")
|
||||
dofile(modpath.."/mailbox.lua")
|
||||
dofile(modpath.."/nodes.lua")
|
||||
dofile(modpath.."/worktable.lua")
|
||||
|
89
mailbox.lua
Normal file
@ -0,0 +1,89 @@
|
||||
xdecor.register("mailbox", {
|
||||
description = "Mailbox",
|
||||
tiles = {
|
||||
"xdecor_mailbox_top.png", "xdecor_mailbox_bottom.png",
|
||||
"xdecor_mailbox_side.png", "xdecor_mailbox_side.png",
|
||||
"xdecor_mailbox.png", "xdecor_mailbox.png",
|
||||
},
|
||||
groups = {snappy=3},
|
||||
after_place_node = function(pos, placer, itemstack)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local owner = placer:get_player_name()
|
||||
|
||||
meta:set_string("owner", owner)
|
||||
meta:set_string("infotext", owner.."'s Mailbox")
|
||||
|
||||
local inv = meta:get_inventory()
|
||||
inv:set_size("main", 8*4)
|
||||
inv:set_size("drop", 1)
|
||||
end,
|
||||
on_rightclick = function(pos, node, clicker, itemstack)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local player = clicker:get_player_name()
|
||||
local owner = meta:get_string("owner")
|
||||
local meta = minetest.get_meta(pos)
|
||||
|
||||
if owner == player then
|
||||
minetest.show_formspec(
|
||||
clicker:get_player_name(),
|
||||
"default:chest_locked",
|
||||
xdecor.get_mailbox_formspec(pos))
|
||||
else
|
||||
minetest.show_formspec(
|
||||
clicker:get_player_name(),
|
||||
"default:chest_locked",
|
||||
xdecor.get_mailbox_insert_formspec(pos))
|
||||
end
|
||||
end,
|
||||
can_dig = function(pos,player)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local owner = meta:get_string("owner")
|
||||
local inv = meta:get_inventory()
|
||||
|
||||
return player:get_player_name() == owner and inv:is_empty("main")
|
||||
end,
|
||||
on_metadata_inventory_put = function(pos, listname, index, stack, player)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
|
||||
if listname == "drop" and inv:room_for_item("main", stack) then
|
||||
inv:remove_item("drop", stack)
|
||||
inv:add_item("main", stack)
|
||||
end
|
||||
end,
|
||||
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
|
||||
if listname == "main" then
|
||||
return 0
|
||||
end
|
||||
if listname == "drop" then
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
|
||||
if inv:room_for_item("main", stack) then
|
||||
return -1
|
||||
else
|
||||
return 0
|
||||
end
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
function xdecor.get_mailbox_formspec(pos)
|
||||
local spos = pos.x..","..pos.y..","..pos.z
|
||||
local formspec =
|
||||
"size[8,9]"..xdecor.fancy_gui..
|
||||
"label[0,0;You received...]"..
|
||||
"list[nodemeta:"..spos..";main;0,0.75;8,4;]"..
|
||||
"list[current_player;main;0,5.25;8,4;]"
|
||||
return formspec
|
||||
end
|
||||
|
||||
function xdecor.get_mailbox_insert_formspec(pos)
|
||||
local spos = pos.x..","..pos.y..","..pos.z
|
||||
local formspec =
|
||||
"size[8,5]"..xdecor.fancy_gui..
|
||||
"label[0,0;Send your goods...]"..
|
||||
"list[nodemeta:"..spos..";drop;3.5,0;1,1;]"..
|
||||
"list[current_player;main;0,1.25;8,4;]"
|
||||
return formspec
|
||||
end
|
78
nodes.lua
@ -1,3 +1,31 @@
|
||||
xpanes.register_pane("bamboo_frame", {
|
||||
description = "Bamboo Frame",
|
||||
tiles = {"xdecor_bamboo_frame.png"},
|
||||
drawtype = "airlike",
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
textures = { "xdecor_bamboo_frame.png", "xdecor_bamboo_frame.png",
|
||||
"xpanes_space.png" },
|
||||
inventory_image = "xdecor_bamboo_frame.png",
|
||||
wield_image = "xdecor_bamboo_frame.png",
|
||||
groups = {snappy=3, pane=1},
|
||||
recipe = {
|
||||
{"default:papyrus", "default:papyrus", "default:papyrus"},
|
||||
{"default:papyrus", "farming:cotton", "default:papyrus"},
|
||||
{"default:papyrus", "default:papyrus", "default:papyrus"}
|
||||
}
|
||||
})
|
||||
|
||||
xdecor.register("baricade", {
|
||||
description = "Baricade",
|
||||
drawtype = "plantlike",
|
||||
walkable = false,
|
||||
inventory_image = "xdecor_baricade.png",
|
||||
tiles = {"xdecor_baricade.png"},
|
||||
groups = {snappy=3},
|
||||
damage_per_second = 4
|
||||
})
|
||||
|
||||
xdecor.register("barrel", {
|
||||
description = "Barrel",
|
||||
inventory = {size=24},
|
||||
@ -171,6 +199,20 @@ xdecor.register("cushion", {
|
||||
node_box = xdecor.nodebox.slab_y(-0.5, 0.5)
|
||||
})
|
||||
|
||||
local door_types = {"woodglass", "japanese"}
|
||||
|
||||
for _, d in pairs(door_types) do
|
||||
doors.register_door("xdecor:"..d.."_door", {
|
||||
description = string.sub(string.upper(d), 0, 1)..
|
||||
string.sub(d, 2).." Door",
|
||||
inventory_image = "xdecor_"..d.."_door_inv.png",
|
||||
groups = {snappy=3, door=1},
|
||||
tiles_bottom = {"xdecor_"..d.."_door_b.png", "xdecor_brown.png"},
|
||||
tiles_top = {"xdecor_"..d.."_door_a.png", "xdecor_brown.png"},
|
||||
sounds = xdecor.wood,
|
||||
})
|
||||
end
|
||||
|
||||
xdecor.register("empty_shelf", {
|
||||
description = "Empty Shelf",
|
||||
inventory = {size=24},
|
||||
@ -358,6 +400,30 @@ xdecor.register("stone_rune", {
|
||||
sounds = xdecor.stone
|
||||
})
|
||||
|
||||
xdecor.register("stonepath", {
|
||||
description = "Garden Stone Path",
|
||||
tiles = { "default_stone.png" },
|
||||
groups = { snappy=3 },
|
||||
sounds = xdecor.stone,
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.4375, -0.5, 0.3125, -0.3125, -0.48, 0.4375},
|
||||
{-0.25, -0.5, 0.125, 0, -0.48, 0.375},
|
||||
{0.125, -0.5, 0.125, 0.4375, -0.48, 0.4375},
|
||||
{-0.4375, -0.5, -0.125, -0.25, -0.48, 0.0625},
|
||||
{-0.0625, -0.5, -0.25, 0.25, -0.48, 0.0625},
|
||||
{0.3125, -0.5, -0.25, 0.4375, -0.48, -0.125},
|
||||
{-0.3125, -0.5, -0.375, -0.125, -0.48, -0.1875},
|
||||
{0.125, -0.5, -0.4375, 0.25, -0.48, -0.3125}
|
||||
}
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = { -0.4375, -0.5, -0.4375, 0.4375, -0.4, 0.4375 }
|
||||
}
|
||||
})
|
||||
|
||||
xdecor.register("stone_tile", {
|
||||
description = "Stone Tile",
|
||||
tiles = {"xdecor_stone_tile.png"},
|
||||
@ -380,6 +446,18 @@ xdecor.register("table", {
|
||||
}
|
||||
})
|
||||
|
||||
xdecor.register("tatami", {
|
||||
description = "Tatami",
|
||||
tiles = {"xdecor_tatami.png"},
|
||||
groups = {snappy=3},
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.5, -0.5, -0.5, 0.5, -0.4375, 0.5},
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
xdecor.register("tv", {
|
||||
description = "Television",
|
||||
light_source = 11,
|
||||
|
BIN
textures/xdecor_bamboo_frame.png
Normal file
After Width: | Height: | Size: 243 B |
BIN
textures/xdecor_baricade.png
Normal file
After Width: | Height: | Size: 231 B |
BIN
textures/xdecor_brown.png
Normal file
After Width: | Height: | Size: 82 B |
BIN
textures/xdecor_japanese_door_a.png
Normal file
After Width: | Height: | Size: 291 B |
BIN
textures/xdecor_japanese_door_b.png
Normal file
After Width: | Height: | Size: 299 B |
BIN
textures/xdecor_japanese_door_inv.png
Normal file
After Width: | Height: | Size: 198 B |
BIN
textures/xdecor_mailbox.png
Normal file
After Width: | Height: | Size: 193 B |
BIN
textures/xdecor_mailbox_bottom.png
Normal file
After Width: | Height: | Size: 115 B |
BIN
textures/xdecor_mailbox_side.png
Normal file
After Width: | Height: | Size: 166 B |
BIN
textures/xdecor_mailbox_top.png
Normal file
After Width: | Height: | Size: 115 B |
BIN
textures/xdecor_tatami.png
Normal file
After Width: | Height: | Size: 155 B |
BIN
textures/xdecor_woodglass_door_a.png
Normal file
After Width: | Height: | Size: 265 B |
BIN
textures/xdecor_woodglass_door_b.png
Normal file
After Width: | Height: | Size: 271 B |
BIN
textures/xdecor_woodglass_door_inv.png
Normal file
After Width: | Height: | Size: 231 B |
@ -146,6 +146,9 @@ local function name(mat)
|
||||
elseif string.find(mat, "brick") then
|
||||
local newname = string.gsub(mat, "(brick)", "_%1")
|
||||
return "default_"..newname..".png"
|
||||
elseif string.find(mat, "tree") then
|
||||
local newname = string.gsub(mat, "(tree)", "%1_top")
|
||||
return "default_"..newname..".png"
|
||||
else
|
||||
return "default_"..mat..".png"
|
||||
end
|
||||
|