aboutsummaryrefslogtreecommitdiff
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
parent56d96b2f22bf6a61ff992b000215dc3a2c2448ad (diff)
rstnode: restructure project into workspace and sub-crates
-rw-r--r--games/rstnode/Cargo.lock115
-rw-r--r--games/rstnode/Cargo.toml34
-rw-r--r--games/rstnode/assets/logo.svg5
-rw-r--r--games/rstnode/rst-client/Cargo.toml11
-rw-r--r--games/rstnode/rst-client/src/main.rs3
-rw-r--r--games/rstnode/rst-core/Cargo.toml29
-rw-r--r--games/rstnode/rst-core/src/_if.rs (renamed from games/rstnode/src/_if.rs)0
-rw-r--r--games/rstnode/rst-core/src/_loop.rs (renamed from games/rstnode/src/_loop.rs)7
-rw-r--r--games/rstnode/rst-core/src/_match.rs (renamed from games/rstnode/src/_match.rs)5
-rw-r--r--games/rstnode/rst-core/src/bin/game.rs (renamed from games/rstnode/src/bin/game.rs)4
-rw-r--r--games/rstnode/rst-core/src/bin/server.rs (renamed from games/rstnode/src/bin/server.rs)5
-rw-r--r--games/rstnode/rst-core/src/config/io.rs45
-rw-r--r--games/rstnode/rst-core/src/config/mod.rs (renamed from games/rstnode/src/config.rs)17
-rw-r--r--games/rstnode/rst-core/src/data.rs (renamed from games/rstnode/src/data.rs)0
-rw-r--r--games/rstnode/rst-core/src/gens.rs (renamed from games/rstnode/src/gens.rs)2
-rw-r--r--games/rstnode/rst-core/src/io.rs (renamed from games/rstnode/src/io.rs)0
-rw-r--r--games/rstnode/rst-core/src/lib.rs39
-rw-r--r--games/rstnode/rst-core/src/lobby.rs (renamed from games/rstnode/src/lobby.rs)0
-rw-r--r--games/rstnode/rst-core/src/map.rs (renamed from games/rstnode/src/map.rs)0
-rw-r--r--games/rstnode/rst-core/src/mapstore.rs (renamed from games/rstnode/src/mapstore.rs)0
-rw-r--r--games/rstnode/rst-core/src/runner.rs (renamed from games/rstnode/src/runner.rs)0
-rw-r--r--games/rstnode/rst-core/src/server.rs (renamed from games/rstnode/src/server.rs)0
-rw-r--r--games/rstnode/rst-core/src/stats.rs (renamed from games/rstnode/src/stats.rs)0
-rw-r--r--games/rstnode/rst-core/src/users.rs (renamed from games/rstnode/src/users.rs)0
-rw-r--r--games/rstnode/rst-core/src/wire/action.rs (renamed from games/rstnode/src/wire/action.rs)2
-rw-r--r--games/rstnode/rst-core/src/wire/mod.rs (renamed from games/rstnode/src/wire/mod.rs)2
-rw-r--r--games/rstnode/rst-core/src/wire/req.rs (renamed from games/rstnode/src/wire/req.rs)5
-rw-r--r--games/rstnode/rst-core/src/wire/resp.rs (renamed from games/rstnode/src/wire/resp.rs)2
-rw-r--r--games/rstnode/rst-core/src/wire/update.rs (renamed from games/rstnode/src/wire/update.rs)0
-rw-r--r--games/rstnode/rst-launcher/Cargo.toml9
-rw-r--r--games/rstnode/rst-launcher/src/main.rs3
-rw-r--r--games/rstnode/rst-server/Cargo.toml10
-rw-r--r--games/rstnode/rst-server/src/main.rs3
-rw-r--r--games/rstnode/shell.nix4
-rw-r--r--games/rstnode/src/lib.rs24
35 files changed, 267 insertions, 118 deletions
diff --git a/games/rstnode/Cargo.lock b/games/rstnode/Cargo.lock
index d6074e27d20a..d41147a5e623 100644
--- a/games/rstnode/Cargo.lock
+++ b/games/rstnode/Cargo.lock
@@ -27,7 +27,7 @@ version = "0.9.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4f823d037a7ec6ea2197046bafd4ae150e6bc36f9ca347404f46a46823fa84f2"
dependencies = [
- "approx 0.3.2",
+ "approx",
"num-complex",
"num-traits 0.2.14",
]
@@ -72,15 +72,6 @@ dependencies = [
]
[[package]]
-name = "approx"
-version = "0.4.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3f2a05fd1bd10b2527e20a2cd32d8873d115b8b39fe219ee25f42a8aca6ba278"
-dependencies = [
- "num-traits 0.2.14",
-]
-
-[[package]]
name = "arrayref"
version = "0.3.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -289,9 +280,9 @@ dependencies = [
[[package]]
name = "bumpalo"
-version = "3.5.0"
+version = "3.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f07aa6688c702439a1be0307b6a94dffe1168569e45b9500c1372bc580740d59"
+checksum = "099e596ef14349721d9016f6b80dd3419ea1bf289ab9b44df8e4dfd3a005d5d9"
[[package]]
name = "byte-tools"
@@ -323,9 +314,9 @@ dependencies = [
[[package]]
name = "bzip2-sys"
-version = "0.1.9+1.0.8"
+version = "0.1.10+1.0.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ad3b39a260062fca31f7b0b12f207e8f2590a67d32ec7d59c20484b07ea7285e"
+checksum = "17fa3d1ac1ca21c5c4e36a97f3c3eb25084576f6fc47bf0139c1123434216c6c"
dependencies = [
"cc",
"libc",
@@ -382,17 +373,6 @@ dependencies = [
]
[[package]]
-name = "cgmath"
-version = "0.18.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1a98d30140e3296250832bbaaff83b27dcd6fa3cc70fb6f1f3e5c9c0023b5317"
-dependencies = [
- "approx 0.4.0",
- "mint",
- "num-traits 0.2.14",
-]
-
-[[package]]
name = "chrono"
version = "0.4.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -648,9 +628,9 @@ dependencies = [
[[package]]
name = "ctor"
-version = "0.1.18"
+version = "0.1.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "10bcb9d7dcbf7002aaffbb53eac22906b64cdcc127971dcc387d8eb7c95d5560"
+checksum = "e8f45d9ad417bcef4817d614a501ab55cdd96a6fdb24f49aab89a54acfd66b19"
dependencies = [
"quote 1.0.8",
"syn 1.0.60",
@@ -787,6 +767,12 @@ dependencies = [
]
[[package]]
+name = "dtoa"
+version = "0.4.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "88d7ed2934d741c6b37e33e3832298e8850b53fd2d2bea03873375596c7cea4e"
+
+[[package]]
name = "error-chain"
version = "0.12.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1069,7 +1055,7 @@ version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2a76347431050a0b4e1a925124cdcde614b628260093bb52560d9c6b48435336"
dependencies = [
- "approx 0.3.2",
+ "approx",
"bitflags",
"directories",
"gfx",
@@ -1274,7 +1260,7 @@ version = "0.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8b70adc570f1dc71b6b32e241cbcc2b42175f5aea71951fbf41e68b04aec24c7"
dependencies = [
- "approx 0.3.2",
+ "approx",
"rusttype 0.8.3",
"xi-unicode",
]
@@ -1380,9 +1366,9 @@ checksum = "dd25036021b0de88a0aff6b850051563c6516d0bf53f8638938edbb9de732736"
[[package]]
name = "jpeg-decoder"
-version = "0.1.21"
+version = "0.1.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d6187dc218616c3a222bae7b78938f5af5e7c27d9cbef4c30ebca709cd680bf8"
+checksum = "229d53d58899083193af11e15917b5640cd40b29ff475a1fe4ef725deb02d0f2"
[[package]]
name = "kernel32-sys"
@@ -1434,9 +1420,9 @@ dependencies = [
[[package]]
name = "libc"
-version = "0.2.84"
+version = "0.2.85"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1cca32fa0182e8c0989459524dc356b8f2b5c10f1b9eb521b7d182c03cf8c5ff"
+checksum = "7ccac4b00700875e6a07c6cde370d44d32fa01c5a65cdd2fca6858c479d28bb3"
[[package]]
name = "libloading"
@@ -1715,7 +1701,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aaa9fddbc34c8c35dd2108515587b8ce0cab396f17977b8c738568e4edb521a2"
dependencies = [
"alga",
- "approx 0.3.2",
+ "approx",
"generic-array 0.12.3",
"matrixmultiply",
"mint",
@@ -2511,22 +2497,40 @@ dependencies = [
]
[[package]]
-name = "rstnode"
+name = "rst-core"
version = "0.0.0"
dependencies = [
"async-std",
"async-trait",
- "cgmath",
+ "bincode",
"chrono",
"const_env",
- "ggez",
"netmod-mem",
"quadtree_rs",
"rand 0.7.3",
"ratman",
"ratman-identity 0.4.0",
"serde",
- "serde_json",
+ "serde_yaml",
+]
+
+[[package]]
+name = "rst-launcher"
+version = "0.1.0"
+
+[[package]]
+name = "rst-node-client"
+version = "0.0.0"
+dependencies = [
+ "ggez",
+ "rst-core",
+]
+
+[[package]]
+name = "rst-node-server"
+version = "0.0.0"
+dependencies = [
+ "rst-core",
]
[[package]]
@@ -2577,7 +2581,7 @@ version = "0.8.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9f61411055101f7b60ecf1041d87fb74205fb20b0c7a723f07ef39174cf6b4c0"
dependencies = [
- "approx 0.3.2",
+ "approx",
"crossbeam-deque",
"crossbeam-utils 0.7.2",
"linked-hash-map",
@@ -2657,9 +2661,9 @@ dependencies = [
[[package]]
name = "serde_json"
-version = "1.0.61"
+version = "1.0.62"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4fceb2595057b6891a4ee808f70054bd2d12f0e97f1cbb78689b59f676df325a"
+checksum = "ea1c6153794552ea7cf7cf63b1231a25de00ec90db326ba6264440fa08e31486"
dependencies = [
"itoa",
"ryu",
@@ -2667,6 +2671,18 @@ dependencies = [
]
[[package]]
+name = "serde_yaml"
+version = "0.8.16"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bdd2af560da3c1fdc02cb80965289254fc35dff869810061e2d8290ee48848ae"
+dependencies = [
+ "dtoa",
+ "linked-hash-map",
+ "serde",
+ "yaml-rust",
+]
+
+[[package]]
name = "sha1"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -2957,9 +2973,9 @@ dependencies = [
[[package]]
name = "tracing"
-version = "0.1.22"
+version = "0.1.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9f47026cdc4080c07e49b37087de021820269d996f581aac150ef9e5583eefe3"
+checksum = "f7d40a22fd029e33300d8d89a5cc8ffce18bb7c587662f54629e94c9de5487f3"
dependencies = [
"cfg-if 1.0.0",
"pin-project-lite 0.2.4",
@@ -2969,9 +2985,9 @@ dependencies = [
[[package]]
name = "tracing-attributes"
-version = "0.1.11"
+version = "0.1.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "80e0ccfc3378da0cce270c946b676a376943f5cd16aeba64568e7939806f4ada"
+checksum = "43f080ea7e4107844ef4766459426fa2d5c1ada2e47edba05dc7fa99d9629f47"
dependencies = [
"proc-macro2 1.0.24",
"quote 1.0.8",
@@ -3304,6 +3320,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b07db065a5cf61a7e4ba64f29e67db906fb1787316516c4e6e5ff0fea1efcd8a"
[[package]]
+name = "yaml-rust"
+version = "0.4.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "56c1936c4cc7a1c9ab21a1ebb602eb942ba868cbd44a99cb7cdc5892335e1c85"
+dependencies = [
+ "linked-hash-map",
+]
+
+[[package]]
name = "zip"
version = "0.5.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
diff --git a/games/rstnode/Cargo.toml b/games/rstnode/Cargo.toml
index a8bfe703e236..4aa2532acf2d 100644
--- a/games/rstnode/Cargo.toml
+++ b/games/rstnode/Cargo.toml
@@ -1,27 +1,11 @@
-[package]
-name = "rstnode"
-description = "A game about capturing computers on a network"
-version = "0.0.0"
-edition = "2018"
-license = "AGPL-3.0-or-later"
-authors = ["Bread Machine", "Katharina Fey <kookie@spacekookie.de>"]
+[workspace]
+members = [
+ "rst-core",
-[dependencies]
-serde = { version = "1.0", features = ["derive", "rc"] }
-serde_json = "1.0"
-async-std = { version = "1.0", features = ["unstable"] }
-async-trait = "0.1"
+ "rst-launcher",
+ "rst-client",
+ "rst-server",
+]
-ratman = "0.1"
-netmod-mem = "0.1.0"
-identity = { version = "0.4", features = ["random"], package = "ratman-identity"}
-
-ggez = "0.5"
-cgmath = { version = "*", features = ["mint"] }
-chrono = { version = "0.4", features = ["serde"] }
-rand = "0.7"
-quadtree_rs = "0.1"
-const_env = "0.1"
-
-[profile.release.overrides."*"]
-opt-level = 3 \ No newline at end of file
+# [profile.release.overrides."*"]
+# opt-level = 3 \ No newline at end of file
diff --git a/games/rstnode/assets/logo.svg b/games/rstnode/assets/logo.svg
index 2bb655b75b63..0049d99c53fa 100644
--- a/games/rstnode/assets/logo.svg
+++ b/games/rstnode/assets/logo.svg
@@ -13,7 +13,10 @@
version="1.1"
id="svg8"
inkscape:version="1.0.1 (3bc2e813f5, 2020-09-07)"
- sodipodi:docname="logo.svg">
+ sodipodi:docname="logo.svg"
+ inkscape:export-filename="/home/Projects/kookienomicon/games/rstnode/assets/logo.png"
+ inkscape:export-xdpi="200.07384"
+ inkscape:export-ydpi="200.07384">
<defs
id="defs2" />
<sodipodi:namedview
diff --git a/games/rstnode/rst-client/Cargo.toml b/games/rstnode/rst-client/Cargo.toml
new file mode 100644
index 000000000000..7ebf7092d0a0
--- /dev/null
+++ b/games/rstnode/rst-client/Cargo.toml
@@ -0,0 +1,11 @@
+[package]
+name = "rst-node-client"
+description = "RST Node game client"
+version = "0.0.0"
+edition = "2018"
+license = "AGPL-3.0-or-later"
+authors = ["Bread Machine", "Katharina Fey <kookie@spacekookie.de>"]
+
+[dependencies]
+rst-core = { path = "../rst-core" }
+ggez = "0.5" \ No newline at end of file
diff --git a/games/rstnode/rst-client/src/main.rs b/games/rstnode/rst-client/src/main.rs
new file mode 100644
index 000000000000..e7a11a969c03
--- /dev/null
+++ b/games/rstnode/rst-client/src/main.rs
@@ -0,0 +1,3 @@
+fn main() {
+ println!("Hello, world!");
+}
diff --git a/games/rstnode/rst-core/Cargo.toml b/games/rstnode/rst-core/Cargo.toml
new file mode 100644
index 000000000000..da0d3fa0ad55
--- /dev/null
+++ b/games/rstnode/rst-core/Cargo.toml
@@ -0,0 +1,29 @@
+[package]
+name = "rst-core"
+description = "Shared logic and type state library for rstnode"
+version = "0.0.0"
+edition = "2018"
+license = "AGPL-3.0-or-later"
+authors = ["Bread Machine", "Katharina Fey <kookie@spacekookie.de>"]
+
+[dependencies]
+
+# Serialisation
+bincode = "1.0"
+serde = { version = "1.0", features = ["derive", "rc"] }
+serde_yaml = "0.8.15"
+
+# Async utils
+async-std = { version = "1.0", features = ["unstable"] }
+async-trait = "0.1"
+
+# Ratman networking utils
+identity = { version = "0.4", features = ["random"], package = "ratman-identity"}
+netmod-mem = "0.1.0"
+ratman = "0.1"
+
+# Other dependencies
+chrono = { version = "0.4", features = ["serde"] }
+const_env = "0.1"
+quadtree_rs = "0.1"
+rand = "0.7"
diff --git a/games/rstnode/src/_if.rs b/games/rstnode/rst-core/src/_if.rs
index 1a842840708c..1a842840708c 100644
--- a/games/rstnode/src/_if.rs
+++ b/games/rstnode/rst-core/src/_if.rs
diff --git a/games/rstnode/src/_loop.rs b/games/rstnode/rst-core/src/_loop.rs
index 862325490322..ac4619622ed3 100644
--- a/games/rstnode/src/_loop.rs
+++ b/games/rstnode/rst-core/src/_loop.rs
@@ -1,4 +1,7 @@
//! A timed loop implementation
+//!
+//! This is a utility to be used in the server simulation to make sure
+//! that a simulation step takes a certain amount of time to execute.
use async_std::{future::Future, task};
use chrono::{DateTime, Utc};
@@ -16,7 +19,7 @@ const TICKS: u64 = 100;
const TICK_TIME: Duration = Duration::from_millis(1000 / TICKS);
/// Run a timed loop until you no longer want to
-pub fn block_loop<F>(run: Arc<AtomicBool>, f: F)
+pub(crate) fn block_loop<F>(run: Arc<AtomicBool>, f: F)
where
F: Future<Output = ()> + Send + Copy + 'static,
{
@@ -30,7 +33,7 @@ where
}
/// Run a detached timed loop until you no longer want to
-pub fn spawn_loop<F>(run: Arc<AtomicBool>, f: F)
+pub(crate) fn spawn_loop<F>(run: Arc<AtomicBool>, f: F)
where
F: Future<Output = ()> + Send + Copy + 'static,
{
diff --git a/games/rstnode/src/_match.rs b/games/rstnode/rst-core/src/_match.rs
index 6ae69c54e935..ce75af5af393 100644
--- a/games/rstnode/src/_match.rs
+++ b/games/rstnode/rst-core/src/_match.rs
@@ -10,6 +10,11 @@ use serde::{Deserialize, Serialize};
use std::collections::VecDeque;
/// Describes a match for the server
+///
+/// This type implements the partial [GameIf](crate::GameIf) API to
+/// allow client to queue commands from players. The server
+/// implementation runs a simulation for each match that is running on
+/// it.
pub struct Match {
/// The match id
pub id: MatchId,
diff --git a/games/rstnode/src/bin/game.rs b/games/rstnode/rst-core/src/bin/game.rs
index 9bf9fc9f9631..f826c64689db 100644
--- a/games/rstnode/src/bin/game.rs
+++ b/games/rstnode/rst-core/src/bin/game.rs
@@ -1,5 +1,3 @@
//! The main game UI client
-fn main() {
-
-}
+fn main() {}
diff --git a/games/rstnode/src/bin/server.rs b/games/rstnode/rst-core/src/bin/server.rs
index 47db85926ac1..357ddf944dc4 100644
--- a/games/rstnode/src/bin/server.rs
+++ b/games/rstnode/rst-core/src/bin/server.rs
@@ -1,6 +1,3 @@
//! The dedicated server binary
-
-fn main() {
-
-}
+fn main() {}
diff --git a/games/rstnode/rst-core/src/config/io.rs b/games/rstnode/rst-core/src/config/io.rs
new file mode 100644
index 000000000000..07aa7e7b3d3f
--- /dev/null
+++ b/games/rstnode/rst-core/src/config/io.rs
@@ -0,0 +1,45 @@
+//! I/O utilities to load configurations from disk
+
+use super::MapCfg;
+use serde_yaml::from_str;
+use std::{
+ fs::File,
+ io::{self, Read},
+ path::Path,
+};
+
+/// Encode error state while loading a map configuration
+pub enum Error {
+ Io(String),
+ Parsing(String),
+}
+
+impl From<io::Error> for Error {
+ fn from(e: io::Error) -> Self {
+ Self::Io(e.to_string())
+ }
+}
+
+impl From<serde_yaml::Error> for Error {
+ fn from(e: serde_yaml::Error) -> Self {
+ Self::Parsing(e.to_string())
+ }
+}
+
+/// Load a map YAML configuration from disk
+///
+/// This file format is structured according to the configuration
+/// types in [config](crate::config). An example configuration is
+/// provided below.
+///
+/// ```yaml
+/// nodes:
+/// -
+/// ```
+pub fn load_map<'p>(p: impl Into<&'p Path>) -> Result<MapCfg, Error> {
+ let mut f = File::open(p.into())?;
+ let mut s = String::new();
+ f.read_to_string(&mut s)?;
+
+ Ok(from_str(s.as_str())?)
+}
diff --git a/games/rstnode/src/config.rs b/games/rstnode/rst-core/src/config/mod.rs
index 8a1b0b4deb0a..447c0fcbcc35 100644
--- a/games/rstnode/src/config.rs
+++ b/games/rstnode/rst-core/src/config/mod.rs
@@ -1,8 +1,14 @@
//! The file formats backing maps and other configs
+//!
+//! When creating maps to share with other clients, or to load into a
+//! server, these types can be constructed with the YML description
+//! format, outlined in [load_map](config::io::load_map)
-use crate::data::{NodeId, LinkId};
-use serde::{Serialize, Deserialize};
-use std::path::Path;
+mod io;
+pub use io::*;
+
+use crate::data::{LinkId, NodeId};
+use serde::{Deserialize, Serialize};
/// A config tree that describes a map
#[derive(Serialize, Deserialize)]
@@ -15,6 +21,7 @@ pub struct MapCfg {
pub spawns: Vec<SpawnCfg>,
}
+/// A single node on a map, with an x and y coordinate
#[derive(Serialize, Deserialize)]
pub struct NodeCfg {
/// Node ID
@@ -24,14 +31,16 @@ pub struct NodeCfg {
pub y: f64,
}
+/// A link between two nodes
#[derive(Serialize, Deserialize)]
pub struct LinkCfg {
/// The link ID
id: LinkId,
/// List of connectioned nodes
- con: Vec<NodeId>,
+ con: (NodeId, NodeId),
}
+/// Special configuration for a node to act as a player spawn point
#[derive(Serialize, Deserialize)]
pub struct SpawnCfg {
/// The node of the spawn point
diff --git a/games/rstnode/src/data.rs b/games/rstnode/rst-core/src/data.rs
index 5ce5517c2b07..5ce5517c2b07 100644
--- a/games/rstnode/src/data.rs
+++ b/games/rstnode/rst-core/src/data.rs
diff --git a/games/rstnode/src/gens.rs b/games/rstnode/rst-core/src/gens.rs
index 7374731c826d..e6859f04ec66 100644
--- a/games/rstnode/src/gens.rs
+++ b/games/rstnode/rst-core/src/gens.rs
@@ -84,7 +84,7 @@ pub mod send {
// Only level 3 guards can send takeovers
(None, Guard(Three), "takeover") => Pkt::TakeOver,
-
+
// Can't touch this
(_, _, _) => unreachable!(),
}
diff --git a/games/rstnode/src/io.rs b/games/rstnode/rst-core/src/io.rs
index 3032c2698190..3032c2698190 100644
--- a/games/rstnode/src/io.rs
+++ b/games/rstnode/rst-core/src/io.rs
diff --git a/games/rstnode/rst-core/src/lib.rs b/games/rstnode/rst-core/src/lib.rs
new file mode 100644
index 000000000000..36e232f4639c
--- /dev/null
+++ b/games/rstnode/rst-core/src/lib.rs
@@ -0,0 +1,39 @@
+//! # RST Node
+//!
+//! RST Node is a real-time strategy game about computers on a
+//! network, fighting for dominance against a set of other network
+//! operators. To operate a successful network you need to build
+//! infrastructure, compute clusters, and defences on edge nodes.
+//!
+//! The game architecture is split between the game client and game
+//! server. This library implements all required types and functions
+//! to manage this state over a network connection.
+//!
+//! The main game interface is provided by [GameIf](crate::GameIf),
+//! which is them implemented by [Server](crate::server::Server), and
+//! [MatchClient](crate::client::MatchClient).
+
+#[macro_use]
+extern crate const_env;
+
+pub(crate) mod _loop;
+
+mod _if;
+pub use _if::GameIf;
+
+mod _match;
+pub use _match::Match;
+
+pub mod config;
+pub mod data;
+pub mod gens;
+pub mod io;
+pub mod lobby;
+pub mod map;
+pub mod mapstore;
+pub mod server;
+pub mod stats;
+pub mod users;
+pub mod wire;
+
+pub use identity::Identity as Id;
diff --git a/games/rstnode/src/lobby.rs b/games/rstnode/rst-core/src/lobby.rs
index 496f98bd7b6f..496f98bd7b6f 100644
--- a/games/rstnode/src/lobby.rs
+++ b/games/rstnode/rst-core/src/lobby.rs
diff --git a/games/rstnode/src/map.rs b/games/rstnode/rst-core/src/map.rs
index 37f758b4a433..37f758b4a433 100644
--- a/games/rstnode/src/map.rs
+++ b/games/rstnode/rst-core/src/map.rs
diff --git a/games/rstnode/src/mapstore.rs b/games/rstnode/rst-core/src/mapstore.rs
index 85c5e36ef93b..85c5e36ef93b 100644
--- a/games/rstnode/src/mapstore.rs
+++ b/games/rstnode/rst-core/src/mapstore.rs
diff --git a/games/rstnode/src/runner.rs b/games/rstnode/rst-core/src/runner.rs
index 8b137891791f..8b137891791f 100644
--- a/games/rstnode/src/runner.rs
+++ b/games/rstnode/rst-core/src/runner.rs
diff --git a/games/rstnode/src/server.rs b/games/rstnode/rst-core/src/server.rs
index 3d95c3638c98..3d95c3638c98 100644
--- a/games/rstnode/src/server.rs
+++ b/games/rstnode/rst-core/src/server.rs
diff --git a/games/rstnode/src/stats.rs b/games/rstnode/rst-core/src/stats.rs
index 1c651a98a0a8..1c651a98a0a8 100644
--- a/games/rstnode/src/stats.rs
+++ b/games/rstnode/rst-core/src/stats.rs
diff --git a/games/rstnode/src/users.rs b/games/rstnode/rst-core/src/users.rs
index 0c93b83ec1da..0c93b83ec1da 100644
--- a/games/rstnode/src/users.rs
+++ b/games/rstnode/rst-core/src/users.rs
diff --git a/games/rstnode/src/wire/action.rs b/games/rstnode/rst-core/src/wire/action.rs
index 8b25e58649ba..22ab7ce6868e 100644
--- a/games/rstnode/src/wire/action.rs
+++ b/games/rstnode/rst-core/src/wire/action.rs
@@ -1,5 +1,5 @@
use crate::data::{NodeId, Upgrade};
-use serde::{Serialize, Deserialize};
+use serde::{Deserialize, Serialize};
/// All actions that a user can trigger via the UI
#[derive(Serialize, Deserialize)]
diff --git a/games/rstnode/src/wire/mod.rs b/games/rstnode/rst-core/src/wire/mod.rs
index b1c231b44580..cd311383a83a 100644
--- a/games/rstnode/src/wire/mod.rs
+++ b/games/rstnode/rst-core/src/wire/mod.rs
@@ -66,5 +66,3 @@ pub struct Lobby {
/// An alias for a match ID
pub type MatchId = usize;
-
-
diff --git a/games/rstnode/src/wire/req.rs b/games/rstnode/rst-core/src/wire/req.rs
index fba64287006b..ffefcbdb6ac7 100644
--- a/games/rstnode/src/wire/req.rs
+++ b/games/rstnode/rst-core/src/wire/req.rs
@@ -1,5 +1,4 @@
-
-use super::{action::Action, User, LobbyId, MatchId};
+use super::{action::Action, LobbyId, MatchId, User};
use serde::{Deserialize, Serialize};
/// A message sent from the game client to the server
@@ -18,7 +17,7 @@ pub enum Request {
/// Start an anonymous session
Anonymous(String),
-
+
/// A user joins a game lobby
Join(User, LobbyId),
diff --git a/games/rstnode/src/wire/resp.rs b/games/rstnode/rst-core/src/wire/resp.rs
index 4812baf13e39..ef2e192a6044 100644
--- a/games/rstnode/src/wire/resp.rs
+++ b/games/rstnode/rst-core/src/wire/resp.rs
@@ -90,5 +90,5 @@ pub enum MatchErr {
/// The provided player wasn't in the match (anymore?)
NotInMatch,
/// The requested match had already ended
- MatchAlreadyEnded
+ MatchAlreadyEnded,
}
diff --git a/games/rstnode/src/wire/update.rs b/games/rstnode/rst-core/src/wire/update.rs
index a1b47ff07e50..a1b47ff07e50 100644
--- a/games/rstnode/src/wire/update.rs
+++ b/games/rstnode/rst-core/src/wire/update.rs
diff --git a/games/rstnode/rst-launcher/Cargo.toml b/games/rstnode/rst-launcher/Cargo.toml
new file mode 100644
index 000000000000..3df25c561eb1
--- /dev/null
+++ b/games/rstnode/rst-launcher/Cargo.toml
@@ -0,0 +1,9 @@
+[package]
+name = "rst-launcher"
+version = "0.1.0"
+authors = ["Katharina Fey <kookie@spacekookie.de>"]
+edition = "2018"
+
+# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
+
+[dependencies]
diff --git a/games/rstnode/rst-launcher/src/main.rs b/games/rstnode/rst-launcher/src/main.rs
new file mode 100644
index 000000000000..e7a11a969c03
--- /dev/null
+++ b/games/rstnode/rst-launcher/src/main.rs
@@ -0,0 +1,3 @@
+fn main() {
+ println!("Hello, world!");
+}
diff --git a/games/rstnode/rst-server/Cargo.toml b/games/rstnode/rst-server/Cargo.toml
new file mode 100644
index 000000000000..865caf9fab15
--- /dev/null
+++ b/games/rstnode/rst-server/Cargo.toml
@@ -0,0 +1,10 @@
+[package]
+name = "rst-node-server"
+description = "Backend game server"
+version = "0.0.0"
+edition = "2018"
+license = "AGPL-3.0-or-later"
+authors = ["Bread Machine", "Katharina Fey <kookie@spacekookie.de>"]
+
+[dependencies]
+rst-core = { path = "../rst-core" } \ No newline at end of file
diff --git a/games/rstnode/rst-server/src/main.rs b/games/rstnode/rst-server/src/main.rs
new file mode 100644
index 000000000000..e7a11a969c03
--- /dev/null
+++ b/games/rstnode/rst-server/src/main.rs
@@ -0,0 +1,3 @@
+fn main() {
+ println!("Hello, world!");
+}
diff --git a/games/rstnode/shell.nix b/games/rstnode/shell.nix
index 0cf2e03db1ec..98465394e67e 100644
--- a/games/rstnode/shell.nix
+++ b/games/rstnode/shell.nix
@@ -3,8 +3,8 @@ with import <nixpkgs> {};
stdenv.mkDerivation {
name = "rstnode";
buildInputs = with pkgs; [
- rustc cargo clangStdenv stdenv rust-analyzer
- alsaLib pkg-config libudev steam-run
+ rustc cargo clangStdenv rust-analyzer rustfmt
+ alsaLib pkg-config libudev
] ++ (with pkgs.xlibs; [
libGL
libGLU
diff --git a/games/rstnode/src/lib.rs b/games/rstnode/src/lib.rs
deleted file mode 100644
index e063da34d8bf..000000000000
--- a/games/rstnode/src/lib.rs
+++ /dev/null
@@ -1,24 +0,0 @@
-#![allow(warnings)]
-
-#[macro_use]
-extern crate const_env;
-
-mod _if;
-pub use _if::GameIf;
-
-pub mod data;
-pub mod gens;
-
-pub mod _loop;
-pub mod _match;
-pub mod config;
-pub mod io;
-pub mod lobby;
-pub mod map;
-pub mod mapstore;
-pub mod server;
-pub mod stats;
-pub mod users;
-pub mod wire;
-
-pub use identity::Identity as Id;