1
0
mirror of https://git.ngram.ca/OpenJam/rc-servers synced 2026-08-23 23:08:52 +00:00

Mitigate #59 with validation warning and reduce motion packets

This commit is contained in:
NG (Graham)
2025-12-16 20:22:46 -05:00
parent 08bce9155b
commit 274f68f223
2 changed files with 11 additions and 6 deletions

View File

@@ -1068,8 +1068,9 @@ impl <L: super::CustomGameLogic> GenericGamemodeEngine<L> {
log::error!("Failed to serialize motion data from user {}: {}", user_id, e);
} else {
let data = bytes::Bytes::copy_from_slice(ser.as_slice());
for conn in self.users.read().await.values() {
if conn.user.user_id() == user_id { continue; } // fun fact: the game hard crashes if you omit this
for (player_id, conn) in self.users.read().await.iter() {
if *player_id == motion.player_id || conn.aliases.contains(player_id) || conn.aliases.contains(&motion.player_id) { continue; } // don't re-send to client AIs
// fun fact: the game sometimes hard crashes if you send its own motion data back to it
crate::events::log_lnl_send_failure(conn.connection.sender.send_data(crate::handler::EventData {
message_ty: crate::data::MessageType::RobotMotion,
variant: 0,