mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Fix animation frame_speed and blend loosing precision due to incorrec… (#6357)
* Fix animation frame_speed and blend loosing precision due to incorrect data type Add lua function set_animation_frame_speed to update the frame speed without resetting the animation to start
This commit is contained in:
parent
b8f06ad37e
commit
bf403b923a
10 changed files with 74 additions and 5 deletions
|
@ -604,6 +604,26 @@ int ObjectRef::l_get_eye_offset(lua_State *L)
|
|||
return 2;
|
||||
}
|
||||
|
||||
// set_animation_frame_speed(self, frame_speed)
|
||||
int ObjectRef::l_set_animation_frame_speed(lua_State *L)
|
||||
{
|
||||
NO_MAP_LOCK_REQUIRED;
|
||||
ObjectRef *ref = checkobject(L, 1);
|
||||
ServerActiveObject *co = getobject(ref);
|
||||
if (co == NULL)
|
||||
return 0;
|
||||
|
||||
// Do it
|
||||
if (!lua_isnil(L, 2)) {
|
||||
float frame_speed = lua_tonumber(L, 2);
|
||||
co->setAnimationSpeed(frame_speed);
|
||||
lua_pushboolean(L, true);
|
||||
} else {
|
||||
lua_pushboolean(L, false);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
// set_bone_position(self, std::string bone, v3f position, v3f rotation)
|
||||
int ObjectRef::l_set_bone_position(lua_State *L)
|
||||
{
|
||||
|
@ -1937,6 +1957,7 @@ const luaL_Reg ObjectRef::methods[] = {
|
|||
luamethod(ObjectRef, get_armor_groups),
|
||||
luamethod(ObjectRef, set_animation),
|
||||
luamethod(ObjectRef, get_animation),
|
||||
luamethod(ObjectRef, set_animation_frame_speed),
|
||||
luamethod(ObjectRef, set_bone_position),
|
||||
luamethod(ObjectRef, get_bone_position),
|
||||
luamethod(ObjectRef, set_attach),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue