mirror of
https://github.com/minetest-mods/enchanting.git
synced 2024-11-29 18:23:45 +01:00
Import changes from xdecor
This commit is contained in:
parent
0b38158302
commit
d5a69a1907
33
init.lua
33
init.lua
@ -110,6 +110,29 @@ function enchanting.construct(pos)
|
|||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
inv:set_size("tool", 1)
|
inv:set_size("tool", 1)
|
||||||
inv:set_size("mese", 1)
|
inv:set_size("mese", 1)
|
||||||
|
|
||||||
|
minetest.add_entity({x=pos.x, y=pos.y+0.85, z=pos.z}, "xdecor:book_open")
|
||||||
|
local timer = minetest.get_node_timer(pos)
|
||||||
|
timer:start(15.0)
|
||||||
|
end
|
||||||
|
|
||||||
|
function enchanting.destruct(pos)
|
||||||
|
for _, obj in pairs(minetest.get_objects_inside_radius(pos, 0.9)) do
|
||||||
|
if obj and obj:get_luaentity() and
|
||||||
|
obj:get_luaentity().name == "xdecor:book_open" then
|
||||||
|
obj:remove() break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function enchanting.timer(pos)
|
||||||
|
local node = minetest.get_node(pos)
|
||||||
|
local num = #minetest.get_objects_inside_radius(pos, 0.9)
|
||||||
|
|
||||||
|
if num == 0 then
|
||||||
|
minetest.add_entity({x=pos.x, y=pos.y+0.85, z=pos.z}, "xdecor:book_open")
|
||||||
|
end
|
||||||
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_node(":xdecor:enchantment_table", {
|
minetest.register_node(":xdecor:enchantment_table", {
|
||||||
@ -123,7 +146,9 @@ minetest.register_node(":xdecor:enchantment_table", {
|
|||||||
sounds = default.node_sound_stone_defaults(),
|
sounds = default.node_sound_stone_defaults(),
|
||||||
on_rotate = screwdriver.rotate_simple,
|
on_rotate = screwdriver.rotate_simple,
|
||||||
can_dig = enchanting.dig,
|
can_dig = enchanting.dig,
|
||||||
|
on_timer = enchanting.timer,
|
||||||
on_construct = enchanting.construct,
|
on_construct = enchanting.construct,
|
||||||
|
on_destruct = enchanting.destruct,
|
||||||
on_receive_fields = enchanting.fields,
|
on_receive_fields = enchanting.fields,
|
||||||
on_metadata_inventory_put = enchanting.on_put,
|
on_metadata_inventory_put = enchanting.on_put,
|
||||||
on_metadata_inventory_take = enchanting.on_take,
|
on_metadata_inventory_take = enchanting.on_take,
|
||||||
@ -131,6 +156,14 @@ minetest.register_node(":xdecor:enchantment_table", {
|
|||||||
allow_metadata_inventory_move = function() return 0 end
|
allow_metadata_inventory_move = function() return 0 end
|
||||||
})
|
})
|
||||||
|
|
||||||
|
minetest.register_entity(":xdecor:book_open", {
|
||||||
|
visual = "sprite",
|
||||||
|
visual_size = {x=0.75, y=0.75},
|
||||||
|
collisionbox = {0},
|
||||||
|
physical = false,
|
||||||
|
textures = {"book_open.png"}
|
||||||
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = "xdecor:enchantment_table",
|
output = "xdecor:enchantment_table",
|
||||||
recipe = {
|
recipe = {
|
||||||
|
BIN
textures/book_open.png
Normal file
BIN
textures/book_open.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 242 B |
Loading…
Reference in New Issue
Block a user