forked from VoxeLibre/VoxeLibre
Fix `mcl_enchanting` formating
This commit is contained in:
parent
2cb9eca8e1
commit
06e2022c6d
|
@ -82,7 +82,8 @@ function mcl_enchanting.not_enchantable_on_enchanting_table(itemname)
|
||||||
end
|
end
|
||||||
|
|
||||||
function mcl_enchanting.is_enchantable(itemname)
|
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
|
end
|
||||||
|
|
||||||
function mcl_enchanting.can_enchant_freshly(itemname)
|
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
|
for incompatible in pairs(enchantment_def.incompatible) do
|
||||||
local incompatible_level = item_enchantments[incompatible]
|
local incompatible_level = item_enchantments[incompatible]
|
||||||
if incompatible_level then
|
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
|
end
|
||||||
end
|
end
|
||||||
|
@ -396,7 +398,6 @@ function mcl_enchanting.generate_random_enchantments(itemstack, enchantment_leve
|
||||||
enchantments[selected_enchantment] = enchantment_power
|
enchantments[selected_enchantment] = enchantment_power
|
||||||
mcl_enchanting.enchant(itemstack, selected_enchantment, enchantment_power)
|
mcl_enchanting.enchant(itemstack, selected_enchantment, enchantment_power)
|
||||||
end
|
end
|
||||||
|
|
||||||
until not no_reduced_bonus_chance and mcl_enchanting.random(pr) >= (enchantment_level + 1) / 50
|
until not no_reduced_bonus_chance and mcl_enchanting.random(pr) >= (enchantment_level + 1) / 50
|
||||||
|
|
||||||
return enchantments, description
|
return enchantments, description
|
||||||
|
@ -512,17 +513,13 @@ function mcl_enchanting.show_enchanting_formspec(player)
|
||||||
"size[11.75,10.425]",
|
"size[11.75,10.425]",
|
||||||
|
|
||||||
"label[0.375,0.375;" .. F(C(mcl_formspec.label_color) .. table_name) .. "]",
|
"label[0.375,0.375;" .. F(C(mcl_formspec.label_color) .. table_name) .. "]",
|
||||||
|
|
||||||
mcl_formspec.get_itemslot_bg_v4(1, 3.25, 1, 1),
|
mcl_formspec.get_itemslot_bg_v4(1, 3.25, 1, 1),
|
||||||
"list[current_player;enchanting_item;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),
|
mcl_formspec.get_itemslot_bg_v4(2.25, 3.25, 1, 1),
|
||||||
"image[2.25,3.25;1,1;mcl_enchanting_lapis_background.png]",
|
"image[2.25,3.25;1,1;mcl_enchanting_lapis_background.png]",
|
||||||
"list[current_player;enchanting_lapis;2.25,3.25;1,1]",
|
"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]",
|
"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")) .. "]",
|
"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),
|
mcl_formspec.get_itemslot_bg_v4(0.375, 5.1, 9, 3),
|
||||||
"list[current_player;main;0.375,5.1;9,3;9]",
|
"list[current_player;main;0.375,5.1;9,3;9]",
|
||||||
|
|
||||||
|
@ -544,7 +541,7 @@ function mcl_enchanting.show_enchanting_formspec(player)
|
||||||
local table_slots = mcl_enchanting.get_table_slots(player, itemstack, num_bookshelves)
|
local table_slots = mcl_enchanting.get_table_slots(player, itemstack, num_bookshelves)
|
||||||
for i, slot in ipairs(table_slots) do
|
for i, slot in ipairs(table_slots) do
|
||||||
any_enchantment = any_enchantment or slot
|
any_enchantment = any_enchantment or slot
|
||||||
local enough_lapis = inv:contains_item("enchanting_lapis", ItemStack({name = "mcl_core:lapis", count = i}))
|
local enough_lapis = inv:contains_item("enchanting_lapis", ItemStack({ name = "mcl_core:lapis", count = i }))
|
||||||
local enough_levels = slot and slot.level_requirement <= player_levels
|
local enough_levels = slot and slot.level_requirement <= player_levels
|
||||||
local can_enchant = (slot and enough_lapis and enough_levels)
|
local can_enchant = (slot and enough_lapis and enough_levels)
|
||||||
local ending = (can_enchant and "" or "_off")
|
local ending = (can_enchant and "" or "_off")
|
||||||
|
@ -586,7 +583,8 @@ function mcl_enchanting.show_enchanting_formspec(player)
|
||||||
"image[" ..
|
"image[" ..
|
||||||
(any_enchantment and 1.1 or 1.67) ..
|
(any_enchantment and 1.1 or 1.67) ..
|
||||||
",1.2;" ..
|
",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)
|
minetest.show_formspec(name, "mcl_enchanting:table", formspec)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -604,7 +602,7 @@ function mcl_enchanting.handle_formspec_fields(player, formname, fields)
|
||||||
local meta = player:get_meta()
|
local meta = player:get_meta()
|
||||||
local num_bookshelfes = meta:get_int("mcl_enchanting:num_bookshelves")
|
local num_bookshelfes = meta:get_int("mcl_enchanting:num_bookshelves")
|
||||||
local itemstack = inv:get_stack("enchanting_item", 1)
|
local itemstack = inv:get_stack("enchanting_item", 1)
|
||||||
local cost = ItemStack({name = "mcl_core:lapis", count = button_pressed})
|
local cost = ItemStack({ name = "mcl_core:lapis", count = button_pressed })
|
||||||
if not inv:contains_item("enchanting_lapis", cost) then
|
if not inv:contains_item("enchanting_lapis", cost) then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
@ -652,7 +650,8 @@ function mcl_enchanting.is_enchanting_inventory_action(action, inventory, invent
|
||||||
end
|
end
|
||||||
|
|
||||||
function mcl_enchanting.allow_inventory_action(player, action, inventory, inventory_info)
|
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 is_enchanting_action and do_limit then
|
||||||
if action == "move" then
|
if action == "move" then
|
||||||
local listname = inventory_info.to_list
|
local listname = inventory_info.to_list
|
||||||
|
@ -700,8 +699,7 @@ end
|
||||||
function mcl_enchanting.set_book_animation(self, anim)
|
function mcl_enchanting.set_book_animation(self, anim)
|
||||||
local anim_index = mcl_enchanting.book_animations[anim]
|
local anim_index = mcl_enchanting.book_animations[anim]
|
||||||
local start, stop = mcl_enchanting.book_animation_steps[anim_index],
|
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,
|
self.object:set_animation({ x = start, y = stop }, mcl_enchanting.book_animation_speed, 0,
|
||||||
mcl_enchanting.book_animation_loop[anim] or false)
|
mcl_enchanting.book_animation_loop[anim] or false)
|
||||||
self.scheduled_anim = nil
|
self.scheduled_anim = nil
|
||||||
|
|
Loading…
Reference in New Issue