aboutsummaryrefslogtreecommitdiff
path: root/src/server/unit_sao.cpp
diff options
context:
space:
mode:
authorSmallJoker <SmallJoker@users.noreply.github.com>2020-06-04 19:31:46 +0200
committerGitHub <noreply@github.com>2020-06-04 19:31:46 +0200
commitc1e01bc638637efa788b5698238a465406bc3f5e (patch)
treeb4e3abad6b2a51f41e28bc76cacc75002b37c324 /src/server/unit_sao.cpp
parent0e698e63b3bc27551fda9bd4e66f72501413b4e6 (diff)
downloadhax-minetest-server-c1e01bc638637efa788b5698238a465406bc3f5e.tar.gz
hax-minetest-server-c1e01bc638637efa788b5698238a465406bc3f5e.zip
Move shared parameters sending to UnitSAO (#9968)
Better header sorting by topic Make UnitSAO-specific parameters private Skip redundant recursive entity sending code (since ~5.2.0)
Diffstat (limited to 'src/server/unit_sao.cpp')
-rw-r--r--src/server/unit_sao.cpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/server/unit_sao.cpp b/src/server/unit_sao.cpp
index 74b0508b8..ef0e87f2c 100644
--- a/src/server/unit_sao.cpp
+++ b/src/server/unit_sao.cpp
@@ -88,6 +88,39 @@ void UnitSAO::getBonePosition(const std::string &bone, v3f *position, v3f *rotat
*rotation = m_bone_position[bone].Y;
}
+// clang-format off
+void UnitSAO::sendOutdatedData()
+{
+ if (!m_armor_groups_sent) {
+ m_armor_groups_sent = true;
+ m_messages_out.emplace(getId(), true, generateUpdateArmorGroupsCommand());
+ }
+
+ if (!m_animation_sent) {
+ m_animation_sent = true;
+ m_animation_speed_sent = true;
+ m_messages_out.emplace(getId(), true, generateUpdateAnimationCommand());
+ } else if (!m_animation_speed_sent) {
+ // Animation speed is also sent when 'm_animation_sent == false'
+ m_animation_speed_sent = true;
+ m_messages_out.emplace(getId(), true, generateUpdateAnimationSpeedCommand());
+ }
+
+ if (!m_bone_position_sent) {
+ m_bone_position_sent = true;
+ for (const auto &bone_pos : m_bone_position) {
+ m_messages_out.emplace(getId(), true, generateUpdateBonePositionCommand(
+ bone_pos.first, bone_pos.second.X, bone_pos.second.Y));
+ }
+ }
+
+ if (!m_attachment_sent) {
+ m_attachment_sent = true;
+ m_messages_out.emplace(getId(), true, generateUpdateAttachmentCommand());
+ }
+}
+// clang-format on
+
void UnitSAO::setAttachment(
int parent_id, const std::string &bone, v3f position, v3f rotation)
{