0
0
Fork 0

Fix `mcl_enchanting` formating

This commit is contained in:
AFCMS 2023-06-29 21:11:58 +02:00
parent 2cb9eca8e1
commit 06e2022c6d
Signed by untrusted user: AFCMS
GPG Key ID: 8720389A25B652E3
1 changed files with 16 additions and 18 deletions

View File

@ -82,7 +82,8 @@ function mcl_enchanting.not_enchantable_on_enchanting_table(itemname)
end
function mcl_enchanting.is_enchantable(itemname)
return mcl_enchanting.get_enchantability(itemname) > 0 or mcl_enchanting.not_enchantable_on_enchanting_table(itemname)
return mcl_enchanting.get_enchantability(itemname) > 0 or
mcl_enchanting.not_enchantable_on_enchanting_table(itemname)
end
function mcl_enchanting.can_enchant_freshly(itemname)
@ -153,7 +154,8 @@ function mcl_enchanting.can_enchant(itemstack, enchantment, level)
for incompatible in pairs(enchantment_def.incompatible) do
local incompatible_level = item_enchantments[incompatible]
if incompatible_level then
return false, "incompatible", mcl_enchanting.get_enchantment_description(incompatible, incompatible_level)
return false, "incompatible",
mcl_enchanting.get_enchantment_description(incompatible, incompatible_level)
end
end
end
@ -396,7 +398,6 @@ function mcl_enchanting.generate_random_enchantments(itemstack, enchantment_leve
enchantments[selected_enchantment] = enchantment_power
mcl_enchanting.enchant(itemstack, selected_enchantment, enchantment_power)
end
until not no_reduced_bonus_chance and mcl_enchanting.random(pr) >= (enchantment_level + 1) / 50
return enchantments, description
@ -512,17 +513,13 @@ function mcl_enchanting.show_enchanting_formspec(player)
"size[11.75,10.425]",
"label[0.375,0.375;" .. F(C(mcl_formspec.label_color) .. table_name) .. "]",
mcl_formspec.get_itemslot_bg_v4(1, 3.25, 1, 1),
"list[current_player;enchanting_item;1,3.25;1,1]",
mcl_formspec.get_itemslot_bg_v4(2.25, 3.25, 1, 1),
"image[2.25,3.25;1,1;mcl_enchanting_lapis_background.png]",
"list[current_player;enchanting_lapis;2.25,3.25;1,1]",
"image[4.125,0.56;7.25,4.1;mcl_enchanting_button_background.png]",
"label[0.375,4.7;" .. F(C(mcl_formspec.label_color) .. S("Inventory")) .. "]",
mcl_formspec.get_itemslot_bg_v4(0.375, 5.1, 9, 3),
"list[current_player;main;0.375,5.1;9,3;9]",
@ -586,7 +583,8 @@ function mcl_enchanting.show_enchanting_formspec(player)
"image[" ..
(any_enchantment and 1.1 or 1.67) ..
",1.2;" ..
(any_enchantment and 2 or 0.87) .. ",1.43;mcl_enchanting_book_" .. (any_enchantment and "open" or "closed") .. ".png]"
(any_enchantment and 2 or 0.87) ..
",1.43;mcl_enchanting_book_" .. (any_enchantment and "open" or "closed") .. ".png]"
minetest.show_formspec(name, "mcl_enchanting:table", formspec)
end
@ -652,7 +650,8 @@ function mcl_enchanting.is_enchanting_inventory_action(action, inventory, invent
end
function mcl_enchanting.allow_inventory_action(player, action, inventory, inventory_info)
local is_enchanting_action, do_limit = mcl_enchanting.is_enchanting_inventory_action(action, inventory, inventory_info)
local is_enchanting_action, do_limit = mcl_enchanting.is_enchanting_inventory_action(action, inventory,
inventory_info)
if is_enchanting_action and do_limit then
if action == "move" then
local listname = inventory_info.to_list
@ -700,8 +699,7 @@ end
function mcl_enchanting.set_book_animation(self, anim)
local anim_index = mcl_enchanting.book_animations[anim]
local start, stop = mcl_enchanting.book_animation_steps[anim_index],
mcl_enchanting.book_animation_steps[anim_index + 1
]
mcl_enchanting.book_animation_steps[anim_index + 1]
self.object:set_animation({ x = start, y = stop }, mcl_enchanting.book_animation_speed, 0,
mcl_enchanting.book_animation_loop[anim] or false)
self.scheduled_anim = nil