srdusr
aboutsummaryrefslogtreecommitdiffstats
path: root/crates/steam/src
diff options
context:
space:
mode:
Diffstat (limited to 'crates/steam/src')
-rw-r--r--crates/steam/src/multiplayer_plugin.rs1
-rw-r--r--crates/steam/src/net.rs9
2 files changed, 10 insertions, 0 deletions
diff --git a/crates/steam/src/multiplayer_plugin.rs b/crates/steam/src/multiplayer_plugin.rs
index 05c1760..02bd2e7 100644
--- a/crates/steam/src/multiplayer_plugin.rs
+++ b/crates/steam/src/multiplayer_plugin.rs
@@ -80,6 +80,7 @@ fn poll_events(
) {
while let Some(event) = net.0.try_recv() {
match event {
+ NetEvent::Ignored => {}
NetEvent::RoomCreated { code } => {
info!("multiplayer room created - join it from the web app with code: {code}");
}
diff --git a/crates/steam/src/net.rs b/crates/steam/src/net.rs
index 4d213b4..e08e9fa 100644
--- a/crates/steam/src/net.rs
+++ b/crates/steam/src/net.rs
@@ -19,6 +19,10 @@ use typerpunk_core::multiplayer::{ClientMessage, PlayerInfo, ServerMessage};
#[derive(Debug, Clone)]
pub enum NetEvent {
+ /// A protocol message this client has no use for. Delivered rather than
+ /// dropped so the match on ServerMessage stays exhaustive and adding a
+ /// variant is a compile-time prompt rather than a silent parse failure.
+ Ignored,
RoomCreated { code: String },
Joined { player_id: String },
PlayerList(Vec<PlayerInfo>),
@@ -84,6 +88,11 @@ fn to_event(msg: ServerMessage) -> NetEvent {
match msg {
ServerMessage::Joined { player_id } => NetEvent::Joined { player_id },
ServerMessage::PlayerList { players } => NetEvent::PlayerList(players),
+ // The passage ahead of the countdown, so a client can show it while
+ // players wait. This one does not yet, and Start still carries the
+ // text, so it is accepted and ignored rather than dropped as an
+ // unparseable message.
+ ServerMessage::RaceText { .. } => NetEvent::Ignored,
ServerMessage::Countdown { seconds } => NetEvent::Countdown(seconds),
ServerMessage::Start { text } => NetEvent::Start(text),
ServerMessage::PlayerProgress { player_id, percent, wpm } => NetEvent::PlayerProgress { player_id, percent, wpm },