aboutsummaryrefslogtreecommitdiff
path: root/games/rstnode/rst-core/src/wire/req.rs
diff options
context:
space:
mode:
authorKatharina Fey <kookie@spacekookie.de>2021-02-06 19:40:53 +0100
committerKatharina Fey <kookie@spacekookie.de>2021-02-06 19:42:04 +0100
commitcf9392a33bb99ae581f818d3ddb8be1231521a02 (patch)
tree8295d8a4ed199c3263eadd8f1a508b98567a44f7 /games/rstnode/rst-core/src/wire/req.rs
parent56d96b2f22bf6a61ff992b000215dc3a2c2448ad (diff)
rstnode: restructure project into workspace and sub-crates
Diffstat (limited to 'games/rstnode/rst-core/src/wire/req.rs')
-rw-r--r--games/rstnode/rst-core/src/wire/req.rs38
1 files changed, 38 insertions, 0 deletions
diff --git a/games/rstnode/rst-core/src/wire/req.rs b/games/rstnode/rst-core/src/wire/req.rs
new file mode 100644
index 000000000000..ffefcbdb6ac7
--- /dev/null
+++ b/games/rstnode/rst-core/src/wire/req.rs
@@ -0,0 +1,38 @@
+use super::{action::Action, LobbyId, MatchId, User};
+use serde::{Deserialize, Serialize};
+
+/// A message sent from the game client to the server
+#[derive(Serialize, Deserialize)]
+pub enum Request {
+ /// Register yourself with the game server
+ Register(String, String),
+
+ /// Login to your user session
+ ///
+ /// This user can't log into the system from another computer
+ Login(String, String),
+
+ /// Close your user session
+ Logout(User),
+
+ /// Start an anonymous session
+ Anonymous(String),
+
+ /// A user joins a game lobby
+ Join(User, LobbyId),
+
+ /// A user leaves a game lobby
+ Leave(User, LobbyId),
+
+ /// Mark a user as ready
+ Ready(User, LobbyId, bool),
+
+ /// Try to start the match
+ StartReq(User, LobbyId),
+
+ /// Send a move in the game
+ GameAction(User, MatchId, Action),
+
+ /// Leave the match (forfeit)
+ LeaveGame(User, MatchId),
+}