Some minor cleanup in mcl_enchanting

This commit is contained in:
Wuzzy 2020-12-14 14:27:20 +01:00
parent 9028902a87
commit 7d8c33c647

View file

@ -103,6 +103,7 @@ minetest.register_chatcommand("enchant", {
minetest.register_chatcommand("forceenchant", { minetest.register_chatcommand("forceenchant", {
description = S("Forcefully enchant an item"), description = S("Forcefully enchant an item"),
params = S("<player> <enchantment> [<level>]"), params = S("<player> <enchantment> [<level>]"),
privs = {give = true},
func = function(_, param) func = function(_, param)
local sparam = param:split(" ") local sparam = param:split(" ")
local target_name = sparam[1] local target_name = sparam[1]
@ -181,6 +182,11 @@ minetest.register_entity("mcl_enchanting:book", {
end, end,
}) })
local rotate
if minetest.get_modpath("screwdriver") then
rotate = screwdriver.rotate_simple
end
minetest.register_node("mcl_enchanting:table", { minetest.register_node("mcl_enchanting:table", {
description = S("Enchanting Table"), description = S("Enchanting Table"),
drawtype = "nodebox", drawtype = "nodebox",
@ -190,8 +196,8 @@ minetest.register_node("mcl_enchanting:table", {
fixed = {-0.5, -0.5, -0.5, 0.5, 0.25, 0.5}, fixed = {-0.5, -0.5, -0.5, 0.5, 0.25, 0.5},
}, },
sounds = mcl_sounds.node_sound_stone_defaults(), sounds = mcl_sounds.node_sound_stone_defaults(),
groups = {pickaxey = 2}, groups = {pickaxey = 2, deco_block = 1},
on_rotate = (rawget(_G, "screwdriver") or {}).rotate_simple, on_rotate = rotate,
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
local player_meta = clicker:get_meta() local player_meta = clicker:get_meta()
local table_meta = minetest.get_meta(pos) local table_meta = minetest.get_meta(pos)
@ -237,7 +243,7 @@ minetest.register_craft({
}) })
minetest.register_abm({ minetest.register_abm({
name = "Enchanting table bookshelf particles", label = "Enchanting table bookshelf particles",
interval = 1, interval = 1,
chance = 1, chance = 1,
nodenames = "mcl_enchanting:table", nodenames = "mcl_enchanting:table",