1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-07-12 16:58:39 +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:
sapier 2017-09-01 11:15:12 +02:00 committed by Loïc Blot
parent b8f06ad37e
commit bf403b923a
10 changed files with 74 additions and 5 deletions

View file

@ -155,6 +155,12 @@ void UnitSAO::getAnimation(v2f *frame_range, float *frame_speed, float *frame_bl
*frame_loop = m_animation_loop;
}
void UnitSAO::setAnimationSpeed(float frame_speed)
{
m_animation_speed = frame_speed;
m_animation_speed_sent = false;
}
void UnitSAO::setBonePosition(const std::string &bone, v3f position, v3f rotation)
{
// store these so they can be updated to clients
@ -440,6 +446,14 @@ void LuaEntitySAO::step(float dtime, bool send_recommended)
m_messages_out.push(aom);
}
if (!m_animation_speed_sent) {
m_animation_speed_sent = true;
std::string str = gob_cmd_update_animation_speed(m_animation_speed);
// create message and add to list
ActiveObjectMessage aom(getId(), true, str);
m_messages_out.push(aom);
}
if (!m_bone_position_sent) {
m_bone_position_sent = true;
for (std::unordered_map<std::string, core::vector2d<v3f>>::const_iterator