mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2024-11-25 09:44:02 +00:00
new Lua func to get elapsed time of anim currently playing
+ entity_getAnimationTime(e, layer)
This commit is contained in:
parent
37cf5134ba
commit
da8faf2bd9
1 changed files with 16 additions and 0 deletions
|
@ -4681,6 +4681,21 @@ luaFunc(entity_getAnimationLoop)
|
|||
luaReturnInt(loop);
|
||||
}
|
||||
|
||||
luaFunc(entity_getAnimationTime)
|
||||
{
|
||||
SkeletalSprite *skel = getSkeletalSprite(entity(L));
|
||||
int layer = lua_tointeger(L, 2);
|
||||
if (skel)
|
||||
{
|
||||
const AnimationLayer *a = skel->getAnimationLayer(layer);
|
||||
if(a)
|
||||
{
|
||||
luaReturnVec2(a->timer, a->animationLength);
|
||||
}
|
||||
}
|
||||
luaReturnNil();
|
||||
}
|
||||
|
||||
// entity, x, y, time, ease, relative
|
||||
luaFunc(entity_move)
|
||||
{
|
||||
|
@ -10288,6 +10303,7 @@ static const struct {
|
|||
luaRegister(entity_getAnimLayerTimeMult),
|
||||
luaRegister(entity_stopAnimation),
|
||||
luaRegister(entity_getAnimationLoop),
|
||||
luaRegister(entity_getAnimationTime),
|
||||
|
||||
luaRegister(entity_setCurrentTarget),
|
||||
luaRegister(entity_stopInterpolating),
|
||||
|
|
Loading…
Reference in a new issue