feat(voice): limit voice message range to 48 units

This commit is contained in:
2026-07-20 19:58:50 +08:00
parent 527178e067
commit 6a328f75c1

View File

@@ -4,6 +4,7 @@
#include "Cubed/gameplay/session.hpp"
#include "Cubed/tools/cubed_assert.hpp"
#include "Cubed/tools/log.hpp"
#include "Cubed/tools/math_tools.hpp"
#include "Cubed/tools/uuid.hpp"
#include <ranges>
@@ -787,6 +788,9 @@ void ServerWorld::handle_voice_message(VoiceMsg& msg) {
if (key == uuid) {
continue;
}
if (Math::distance2(p, player.get_pos()) > 48.0f * 48.0f) {
continue;
}
session.emplace_back(player.get_session());
}
}