summaryrefslogtreecommitdiff
path: root/src/content_sao.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/content_sao.cpp')
-rw-r--r--src/content_sao.cpp26
1 files changed, 18 insertions, 8 deletions
diff --git a/src/content_sao.cpp b/src/content_sao.cpp
index 984d2ffa3..386b7e070 100644
--- a/src/content_sao.cpp
+++ b/src/content_sao.cpp
@@ -136,6 +136,7 @@ LuaEntitySAO::LuaEntitySAO(ServerEnvironment *env, v3f pos,
m_armor_groups_sent(false),
m_animation_speed(0),
m_animation_blend(0),
+ m_animation_loop(true),
m_animation_sent(false),
m_bone_position_sent(false),
m_attachment_parent_id(0),
@@ -324,7 +325,8 @@ void LuaEntitySAO::step(float dtime, bool send_recommended)
if(m_animation_sent == false){
m_animation_sent = true;
- std::string str = gob_cmd_update_animation(m_animation_range, m_animation_speed, m_animation_blend);
+ std::string str = gob_cmd_update_animation(
+ m_animation_range, m_animation_speed, m_animation_blend, m_animation_loop);
// create message and add to list
ActiveObjectMessage aom(getId(), true, str);
m_messages_out.push(aom);
@@ -366,7 +368,8 @@ std::string LuaEntitySAO::getClientInitializationData(u16 protocol_version)
writeU8(os, 4 + m_bone_position.size()); // number of messages stuffed in here
os<<serializeLongString(getPropertyPacket()); // message 1
os<<serializeLongString(gob_cmd_update_armor_groups(m_armor_groups)); // 2
- os<<serializeLongString(gob_cmd_update_animation(m_animation_range, m_animation_speed, m_animation_blend)); // 3
+ os<<serializeLongString(gob_cmd_update_animation(
+ m_animation_range, m_animation_speed, m_animation_blend, m_animation_loop)); // 3
for(std::map<std::string, core::vector2d<v3f> >::const_iterator ii = m_bone_position.begin(); ii != m_bone_position.end(); ++ii){
os<<serializeLongString(gob_cmd_update_bone_position((*ii).first, (*ii).second.X, (*ii).second.Y)); // m_bone_position.size
}
@@ -533,19 +536,21 @@ ItemGroupList LuaEntitySAO::getArmorGroups()
return m_armor_groups;
}
-void LuaEntitySAO::setAnimation(v2f frame_range, float frame_speed, float frame_blend)
+void LuaEntitySAO::setAnimation(v2f frame_range, float frame_speed, float frame_blend, bool frame_loop)
{
m_animation_range = frame_range;
m_animation_speed = frame_speed;
m_animation_blend = frame_blend;
+ m_animation_loop = frame_loop;
m_animation_sent = false;
}
-void LuaEntitySAO::getAnimation(v2f *frame_range, float *frame_speed, float *frame_blend)
+void LuaEntitySAO::getAnimation(v2f *frame_range, float *frame_speed, float *frame_blend, bool *frame_loop)
{
*frame_range = m_animation_range;
*frame_speed = m_animation_speed;
*frame_blend = m_animation_blend;
+ *frame_loop = m_animation_loop;
}
void LuaEntitySAO::setBonePosition(const std::string &bone, v3f position, v3f rotation)
@@ -733,6 +738,7 @@ PlayerSAO::PlayerSAO(ServerEnvironment *env_, Player *player_, u16 peer_id_,
m_is_singleplayer(is_singleplayer),
m_animation_speed(0),
m_animation_blend(0),
+ m_animation_loop(true),
m_animation_sent(false),
m_bone_position_sent(false),
m_attachment_parent_id(0),
@@ -828,7 +834,8 @@ std::string PlayerSAO::getClientInitializationData(u16 protocol_version)
writeU8(os, 6 + m_bone_position.size()); // number of messages stuffed in here
os<<serializeLongString(getPropertyPacket()); // message 1
os<<serializeLongString(gob_cmd_update_armor_groups(m_armor_groups)); // 2
- os<<serializeLongString(gob_cmd_update_animation(m_animation_range, m_animation_speed, m_animation_blend)); // 3
+ os<<serializeLongString(gob_cmd_update_animation(
+ m_animation_range, m_animation_speed, m_animation_blend, m_animation_loop)); // 3
for(std::map<std::string, core::vector2d<v3f> >::const_iterator ii = m_bone_position.begin(); ii != m_bone_position.end(); ++ii){
os<<serializeLongString(gob_cmd_update_bone_position((*ii).first, (*ii).second.X, (*ii).second.Y)); // m_bone_position.size
}
@@ -967,7 +974,8 @@ void PlayerSAO::step(float dtime, bool send_recommended)
if(m_animation_sent == false){
m_animation_sent = true;
- std::string str = gob_cmd_update_animation(m_animation_range, m_animation_speed, m_animation_blend);
+ std::string str = gob_cmd_update_animation(
+ m_animation_range, m_animation_speed, m_animation_blend, m_animation_loop);
// create message and add to list
ActiveObjectMessage aom(getId(), true, str);
m_messages_out.push(aom);
@@ -1166,20 +1174,22 @@ ItemGroupList PlayerSAO::getArmorGroups()
return m_armor_groups;
}
-void PlayerSAO::setAnimation(v2f frame_range, float frame_speed, float frame_blend)
+void PlayerSAO::setAnimation(v2f frame_range, float frame_speed, float frame_blend, bool frame_loop)
{
// store these so they can be updated to clients
m_animation_range = frame_range;
m_animation_speed = frame_speed;
m_animation_blend = frame_blend;
+ m_animation_loop = frame_loop;
m_animation_sent = false;
}
-void PlayerSAO::getAnimation(v2f *frame_range, float *frame_speed, float *frame_blend)
+void PlayerSAO::getAnimation(v2f *frame_range, float *frame_speed, float *frame_blend, bool *frame_loop)
{
*frame_range = m_animation_range;
*frame_speed = m_animation_speed;
*frame_blend = m_animation_blend;
+ *frame_loop = m_animation_loop;
}
void PlayerSAO::setBonePosition(const std::string &bone, v3f position, v3f rotation)