forked from VoxeLibre/VoxeLibre
Fix enchanting book animation being weird sometimes
This commit is contained in:
parent
ebc2ec9f72
commit
37f256648b
|
@ -560,7 +560,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], mcl_enchanting.book_animation_steps[anim_index + 1]
|
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.scheduled_anim = nil
|
||||||
self.anim_length = (stop - start) / 40
|
self.anim_length = (stop - start) / 40
|
||||||
end
|
end
|
||||||
|
|
|
@ -5,6 +5,7 @@ mcl_enchanting = {
|
||||||
book_offset = vector.new(0, 0.75, 0),
|
book_offset = vector.new(0, 0.75, 0),
|
||||||
book_animations = {["close"] = 1, ["opening"] = 2, ["open"] = 3, ["closing"] = 4},
|
book_animations = {["close"] = 1, ["opening"] = 2, ["open"] = 3, ["closing"] = 4},
|
||||||
book_animation_steps = {0, 640, 680, 700, 740},
|
book_animation_steps = {0, 640, 680, 700, 740},
|
||||||
|
book_animation_loop = {["open"] = true, ["close"] = true},
|
||||||
book_animation_speed = 40,
|
book_animation_speed = 40,
|
||||||
roman_numerals = dofile(modpath .. "/roman_numerals.lua"), -- https://exercism.io/tracks/lua/exercises/roman-numerals/solutions/73c2fb7521e347209312d115f872fa49
|
roman_numerals = dofile(modpath .. "/roman_numerals.lua"), -- https://exercism.io/tracks/lua/exercises/roman-numerals/solutions/73c2fb7521e347209312d115f872fa49
|
||||||
enchantments = {},
|
enchantments = {},
|
||||||
|
|
Loading…
Reference in New Issue