From 6faf7f1c1d2420d8068043475820904d2cfa8cd9 Mon Sep 17 00:00:00 2001 From: PeaAshMeter Date: Thu, 23 Oct 2025 02:41:30 +0300 Subject: [PATCH] refactor MapBehavior:update --- lib/character/behaviors/map.lua | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/lib/character/behaviors/map.lua b/lib/character/behaviors/map.lua index 07e8708..b5c8174 100644 --- a/lib/character/behaviors/map.lua +++ b/lib/character/behaviors/map.lua @@ -63,17 +63,13 @@ function mapBehavior:update(dt) if fraction >= 1 then -- анимация перемещена завершена self.position = self.runTarget if not self.path:is_empty() then -- еще есть, куда бежать - self:runTo(self.path:peek_front()) - self.path:pop_front() - else -- мы добежали до финальной цели + self:runTo(self.path:pop_front()) + else -- мы добежали до финальной цели self.owner:try(Tree.behaviors.sprite, function(sprite) sprite:loop("idle") end) self.runTarget = nil - if self.animationNode then - self.animationNode:finish() - self.onWalkEnd = nil - end + if self.animationNode then self.animationNode:finish() end end else -- анимация перемещения не завершена self.displayedPosition = utils.lerp(self.position, self.runTarget, fraction) -- линейный интерполятор