allow AnimationNode to not have its own animation

This commit is contained in:
PeaAshMeter 2025-10-23 19:07:16 +03:00
parent 77e723c4bb
commit f790a4dcf8
2 changed files with 4 additions and 5 deletions

View File

@ -30,11 +30,13 @@ function animation:chain(children)
return self
end
--- @param data {[1]: animationRunner, onEnd?: voidCallback, children?: AnimationNode[]}
--- @param data {[1]: animationRunner?, onEnd?: voidCallback, children?: AnimationNode[]}
--- @return AnimationNode
local function new(data)
local t = setmetatable({}, animation)
t.run = data[1]
t.run = data[1] or function(self)
self:finish()
end
t.onEnd = data.onEnd
t.count = 1 -- своя анимация
t.children = {}

View File

@ -115,9 +115,6 @@ function attack:cast(caster, target)
if not sprite or not targetSprite then return true end
AnimationNode {
function(node)
caster:has(Tree.behaviors.residentsleeper):sleep(0, node)
end,
onEnd = function() caster:has(Tree.behaviors.spellcaster):endCast() end,
children = {
AnimationNode {