Веб-сайт самохостера Lotigara

summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source/client/StarClientApplication.cpp2
-rw-r--r--source/game/StarWorldClient.cpp5
-rw-r--r--source/game/StarWorldClient.hpp2
3 files changed, 6 insertions, 3 deletions
diff --git a/source/client/StarClientApplication.cpp b/source/client/StarClientApplication.cpp
index efbdcad..9213d0e 100644
--- a/source/client/StarClientApplication.cpp
+++ b/source/client/StarClientApplication.cpp
@@ -921,7 +921,7 @@ void ClientApplication::updateRunning(float dt) {
std::string_view signatureView((char*)signature.data(), signature.size());
std::string_view audioDataView(voiceData.ptr(), voiceData.size());
auto broadcast = strf("data\0voice\0{}{}"s, signatureView, audioDataView);
- worldClient->sendSecretBroadcast(broadcast, true);
+ worldClient->sendSecretBroadcast(broadcast, true, false); // Already compressed by Opus.
}
if (auto mainPlayer = m_universeClient->mainPlayer()) {
auto localSpeaker = m_voice->localSpeaker();
diff --git a/source/game/StarWorldClient.cpp b/source/game/StarWorldClient.cpp
index f9ad833..24199c3 100644
--- a/source/game/StarWorldClient.cpp
+++ b/source/game/StarWorldClient.cpp
@@ -2013,7 +2013,7 @@ void WorldClient::connectWire(WireConnection const& output, WireConnection const
m_outgoingPackets.append(make_shared<ConnectWirePacket>(output, input));
}
-bool WorldClient::sendSecretBroadcast(StringView broadcast, bool raw) {
+bool WorldClient::sendSecretBroadcast(StringView broadcast, bool raw, bool compress) {
if (!inWorld() || !m_mainPlayer || !m_mainPlayer->getSecretPropertyView(SECRET_BROADCAST_PUBLIC_KEY))
return false;
@@ -2030,6 +2030,9 @@ bool WorldClient::sendSecretBroadcast(StringView broadcast, bool raw) {
dmg.targetMaterialKind = raw ? broadcast : strf("{}{}{}", SECRET_BROADCAST_PREFIX, StringView((char*)&signature, sizeof(signature)), broadcast);
dmg.position = m_mainPlayer->position();
+ if (!compress)
+ damageNotification->setCompressionMode(PacketCompressionMode::Disabled);
+
m_outgoingPackets.emplace_back(move(damageNotification));
return true;
}
diff --git a/source/game/StarWorldClient.hpp b/source/game/StarWorldClient.hpp
index 0adbef6..d816117 100644
--- a/source/game/StarWorldClient.hpp
+++ b/source/game/StarWorldClient.hpp
@@ -155,7 +155,7 @@ public:
// Functions for sending broadcast messages to other players that can receive them,
// on completely vanilla servers by smuggling it through a DamageNotification.
// It's cursed as fuck, but it works.
- bool sendSecretBroadcast(StringView broadcast, bool raw = false);
+ bool sendSecretBroadcast(StringView broadcast, bool raw = false, bool compress = true);
bool handleSecretBroadcast(PlayerPtr player, StringView broadcast);
List<ChatAction> pullPendingChatActions();