Fix ndef error and prepare enchanting table
This commit is contained in:
parent
5d8db6a8ef
commit
c497b36e60
@ -131,6 +131,15 @@ minetest.register_craft({
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
output = "xdecor:enchantment_table",
|
||||||
|
recipe = {
|
||||||
|
{"", "default:book", ""},
|
||||||
|
{"default:diamond", "default:obsidian", "default:diamond"},
|
||||||
|
{"default:obsidian", "default:obsidian", "default:obsidian"}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = "xdecor:fence_wrought_iron 2",
|
output = "xdecor:fence_wrought_iron 2",
|
||||||
recipe = {
|
recipe = {
|
||||||
|
65
enchanting.lua
Normal file
65
enchanting.lua
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
local function enchconstruct(pos)
|
||||||
|
local meta = minetest.get_meta(pos)
|
||||||
|
meta:set_string("formspec", "size[8,7;]"..xdecor.fancy_gui..
|
||||||
|
"label[0.65,-0.15;Enchant]"..
|
||||||
|
"image[0.4,0.2;2,2;default_book.png]"..
|
||||||
|
"list[current_name;tool;0.3,2;1,1;]"..
|
||||||
|
"list[current_name;mese;1.3,2;1,1;]"..
|
||||||
|
"image_button[2.5,0;5.3,1.1;bg.png;durable;Durable]"..
|
||||||
|
"image_button[2.5,1;5.3,1.1;bg.png;fast;Fast]"..
|
||||||
|
"image_button[2.5,2;5.3,1.1;bg.png;luck;Luck]"..
|
||||||
|
"list[current_player;main;0,3.3;8,4;]")
|
||||||
|
meta:set_string("infotext", "Enchantment Table")
|
||||||
|
|
||||||
|
local inv = meta:get_inventory()
|
||||||
|
inv:set_size("tool", 1)
|
||||||
|
inv:set_size("mese", 1)
|
||||||
|
end
|
||||||
|
|
||||||
|
local function enchdig(pos, player)
|
||||||
|
local meta = minetest.get_meta(pos)
|
||||||
|
local inv = meta:get_inventory()
|
||||||
|
|
||||||
|
if not inv:is_empty("tool") or not inv:is_empty("mese") then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
|
local function enchput(pos, listname, index, stack, player)
|
||||||
|
local meta = minetest.get_meta(pos)
|
||||||
|
local inv = meta:get_inventory()
|
||||||
|
|
||||||
|
if listname == "mese" then
|
||||||
|
if stack:get_name() == "default:mese_crystal" then
|
||||||
|
return stack:get_count()
|
||||||
|
else
|
||||||
|
return 0
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if listname == "tool" then
|
||||||
|
local tname = stack:get_name()
|
||||||
|
local tdef = minetest.registered_tools[tname]
|
||||||
|
|
||||||
|
if tdef then return 1 else return 0 end
|
||||||
|
end
|
||||||
|
|
||||||
|
return stack:get_count()
|
||||||
|
end
|
||||||
|
|
||||||
|
xdecor.register("enchantment_table", {
|
||||||
|
description = "Enchantment Table",
|
||||||
|
tiles = {
|
||||||
|
"xdecor_enchantment_top.png",
|
||||||
|
"xdecor_enchantment_bottom.png",
|
||||||
|
"xdecor_enchantment_side.png",
|
||||||
|
"xdecor_enchantment_side.png",
|
||||||
|
"xdecor_enchantment_side.png",
|
||||||
|
"xdecor_enchantment_side.png",
|
||||||
|
},
|
||||||
|
groups = {cracky=1},
|
||||||
|
sounds = xdecor.stone,
|
||||||
|
on_construct = enchconstruct,
|
||||||
|
can_dig = enchdig,
|
||||||
|
allow_metadata_inventory_put = enchput
|
||||||
|
})
|
1
init.lua
1
init.lua
@ -4,6 +4,7 @@ modpath = minetest.get_modpath("xdecor")
|
|||||||
dofile(modpath.."/handlers/nodeboxes.lua")
|
dofile(modpath.."/handlers/nodeboxes.lua")
|
||||||
dofile(modpath.."/handlers/registration.lua")
|
dofile(modpath.."/handlers/registration.lua")
|
||||||
dofile(modpath.."/crafts.lua")
|
dofile(modpath.."/crafts.lua")
|
||||||
|
--dofile(modpath.."/enchanting.lua") -- In development.
|
||||||
dofile(modpath.."/hive.lua")
|
dofile(modpath.."/hive.lua")
|
||||||
dofile(modpath.."/itemframe.lua")
|
dofile(modpath.."/itemframe.lua")
|
||||||
dofile(modpath.."/mailbox.lua")
|
dofile(modpath.."/mailbox.lua")
|
||||||
|
BIN
textures/bg.png
Normal file
BIN
textures/bg.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 231 B |
@ -1,7 +1,7 @@
|
|||||||
local material = {
|
local material = {
|
||||||
"cloud", -- Only used for the formspec display.
|
"cloud", -- Only used for the formspec display.
|
||||||
"wood", "junglewood", "pinewood",
|
"wood", "junglewood", "pinewood", "acacia_wood",
|
||||||
"tree", "jungletree", "pinetree",
|
"tree", "jungletree", "pinetree", "acacia_tree",
|
||||||
"cobble", "mossycobble", "desert_cobble",
|
"cobble", "mossycobble", "desert_cobble",
|
||||||
"stone", "sandstone", "desert_stone", "obsidian",
|
"stone", "sandstone", "desert_stone", "obsidian",
|
||||||
"stonebrick", "sandstonebrick", "desert_stonebrick", "obsidianbrick",
|
"stonebrick", "sandstonebrick", "desert_stonebrick", "obsidianbrick",
|
||||||
@ -136,6 +136,7 @@ for m=1, #material do
|
|||||||
local nodename = "default:"..v
|
local nodename = "default:"..v
|
||||||
local ndef = minetest.registered_nodes[nodename]
|
local ndef = minetest.registered_nodes[nodename]
|
||||||
|
|
||||||
|
if ndef then
|
||||||
xdecor.register(w[1].."_"..v, {
|
xdecor.register(w[1].."_"..v, {
|
||||||
description = string.sub(string.upper(w[1]), 0, 1)..
|
description = string.sub(string.upper(w[1]), 0, 1)..
|
||||||
string.sub(w[1], 2),
|
string.sub(w[1], 2),
|
||||||
@ -151,6 +152,7 @@ for m=1, #material do
|
|||||||
})
|
})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
minetest.register_abm({
|
minetest.register_abm({
|
||||||
nodenames = {"xdecor:worktable"},
|
nodenames = {"xdecor:worktable"},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user