mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-12-23 16:39:33 +01:00
Fix enchanting book animation being weird sometimes
This commit is contained in:
parent
ebc2ec9f72
commit
37f256648b
2 changed files with 7 additions and 6 deletions
|
@ -279,7 +279,7 @@ function mcl_enchanting.generate_random_enchantments(itemstack, enchantment_leve
|
|||
if weights[enchantment] >= r then
|
||||
selected_enchantment = enchantment
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
local enchantment_def = mcl_enchanting.enchantments[selected_enchantment]
|
||||
local power_range_table = enchantment_def.power_range_table
|
||||
|
@ -340,7 +340,7 @@ end
|
|||
function mcl_enchanting.get_random_glyph_row()
|
||||
local glyphs = ""
|
||||
local x = 1.3
|
||||
for i = 1, 9 do
|
||||
for i = 1, 9 do
|
||||
glyphs = glyphs .. "image[".. x .. ",0.1;0.5,0.5;mcl_enchanting_glyph_" .. math.random(18) .. ".png^[colorize:#675D49:255]"
|
||||
x = x + 0.6
|
||||
end
|
||||
|
@ -560,7 +560,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]
|
||||
self.object:set_animation({x = start, y = stop}, mcl_enchanting.book_animation_speed)
|
||||
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
|
||||
self.anim_length = (stop - start) / 40
|
||||
end
|
||||
|
|
|
@ -5,6 +5,7 @@ mcl_enchanting = {
|
|||
book_offset = vector.new(0, 0.75, 0),
|
||||
book_animations = {["close"] = 1, ["opening"] = 2, ["open"] = 3, ["closing"] = 4},
|
||||
book_animation_steps = {0, 640, 680, 700, 740},
|
||||
book_animation_loop = {["open"] = true, ["close"] = true},
|
||||
book_animation_speed = 40,
|
||||
roman_numerals = dofile(modpath .. "/roman_numerals.lua"), -- https://exercism.io/tracks/lua/exercises/roman-numerals/solutions/73c2fb7521e347209312d115f872fa49
|
||||
enchantments = {},
|
||||
|
@ -278,7 +279,7 @@ minetest.register_node("mcl_enchanting:table", {
|
|||
drop = "",
|
||||
_mcl_blast_resistance = 1200,
|
||||
_mcl_hardness = 5,
|
||||
})
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "mcl_enchanting:table",
|
||||
|
@ -330,7 +331,7 @@ minetest.register_abm({
|
|||
end
|
||||
end
|
||||
end
|
||||
})
|
||||
})
|
||||
|
||||
minetest.register_lbm({
|
||||
label = "(Re-)spawn book entity above enchanting table",
|
||||
|
@ -348,4 +349,4 @@ minetest.register_on_joinplayer(mcl_enchanting.initialize_player)
|
|||
minetest.register_on_player_receive_fields(mcl_enchanting.handle_formspec_fields)
|
||||
minetest.register_allow_player_inventory_action(mcl_enchanting.allow_inventory_action)
|
||||
minetest.register_on_player_inventory_action(mcl_enchanting.on_inventory_action)
|
||||
table.insert(tt.registered_snippets, 1, mcl_enchanting.enchantments_snippet)
|
||||
table.insert(tt.registered_snippets, 1, mcl_enchanting.enchantments_snippet)
|
||||
|
|
Loading…
Reference in a new issue