1
0
Fork 0
mirror of https://github.com/AquariaOSE/Aquaria.git synced 2024-11-29 03:33:48 +00:00

new Lua func to get elapsed time of anim currently playing

+ entity_getAnimationTime(e, layer)
This commit is contained in:
fgenesis 2022-11-13 12:54:00 +01:00
parent 37cf5134ba
commit da8faf2bd9

View file

@ -4681,6 +4681,21 @@ luaFunc(entity_getAnimationLoop)
luaReturnInt(loop); 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 // entity, x, y, time, ease, relative
luaFunc(entity_move) luaFunc(entity_move)
{ {
@ -10288,6 +10303,7 @@ static const struct {
luaRegister(entity_getAnimLayerTimeMult), luaRegister(entity_getAnimLayerTimeMult),
luaRegister(entity_stopAnimation), luaRegister(entity_stopAnimation),
luaRegister(entity_getAnimationLoop), luaRegister(entity_getAnimationLoop),
luaRegister(entity_getAnimationTime),
luaRegister(entity_setCurrentTarget), luaRegister(entity_setCurrentTarget),
luaRegister(entity_stopInterpolating), luaRegister(entity_stopInterpolating),