summaryrefslogtreecommitdiff
path: root/src/serverobject.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/serverobject.cpp')
-rw-r--r--src/serverobject.cpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/serverobject.cpp b/src/serverobject.cpp
index 1ed33f66b..119a41b7b 100644
--- a/src/serverobject.cpp
+++ b/src/serverobject.cpp
@@ -81,3 +81,34 @@ bool ServerActiveObject::setWieldedItem(const ItemStack &item)
{
return false;
}
+
+std::string ServerActiveObject::generateUpdateInfantCommand(u16 infant_id, u16 protocol_version)
+{
+ std::ostringstream os(std::ios::binary);
+ // command
+ writeU8(os, AO_CMD_SPAWN_INFANT);
+ // parameters
+ writeU16(os, infant_id);
+ writeU8(os, getSendType());
+ os << serializeLongString(getClientInitializationData(protocol_version));
+ return os.str();
+}
+
+std::string ServerActiveObject::generateUpdateNametagAttributesCommand(const video::SColor &color) const
+{
+ std::ostringstream os(std::ios::binary);
+ // command
+ writeU8(os, AO_CMD_UPDATE_NAMETAG_ATTRIBUTES);
+ // parameters
+ writeU8(os, 1); // version for forward compatibility
+ writeARGB8(os, color);
+ return os.str();
+}
+
+void ServerActiveObject::dumpAOMessagesToQueue(std::queue<ActiveObjectMessage> &queue)
+{
+ while (!m_messages_out.empty()) {
+ queue.push(m_messages_out.front());
+ m_messages_out.pop();
+ }
+} \ No newline at end of file