M server/src/main.rs => server/src/main.rs +5 -1
@@ 14,6 14,8 @@ use naia_bevy_server::{Plugin as ServerPlugin, ServerConfig, Stage};
use laurelin_shared::server::protocol::protocol;
+mod systems;
+
fn main() {
let mut server = App::new();
@@ 26,7 28,9 @@ fn main() {
level: bevy_log::Level::INFO,
..Default::default()
})
- .add_plugin(ServerPlugin::new(ServerConfig::default(), protocol()));
+ .add_plugin(ServerPlugin::new(ServerConfig::default(), protocol()))
+ // init system
+ .add_startup_system(systems::init::init);
info!("Laurelin server starting");
server.run();
A server/src/systems/init.rs => server/src/systems/init.rs +28 -0
@@ 0,0 1,28 @@
+/*
+ * This file is part of laurelin/server
+ * Copyright (C) 2023 Jonni Liljamo <jonni@liljamo.com>
+ *
+ * Licensed under GPL-3.0-only.
+ * See LICENSE for licensing information.
+ */
+
+use bevy_ecs::system::Commands;
+use bevy_log::info;
+
+use naia_bevy_server::{Server, ServerAddrs};
+
+pub(crate) fn init(mut commands: Commands, mut server: Server) {
+ info!("Laurelin server listening");
+
+ let server_addrs = ServerAddrs::new(
+ "0.0.0.0:14191"
+ .parse()
+ .expect("could not parse Signaling address/port"),
+ "0.0.0.0:14192"
+ .parse()
+ .expect("could not parse WebRTC data address/port"),
+ "http://127.0.0.1:14192",
+ );
+
+ server.listen(&server_addrs);
+}
A server/src/systems/mod.rs => server/src/systems/mod.rs +9 -0
@@ 0,0 1,9 @@
+/*
+ * This file is part of laurelin/server
+ * Copyright (C) 2023 Jonni Liljamo <jonni@liljamo.com>
+ *
+ * Licensed under GPL-3.0-only.
+ * See LICENSE for licensing information.
+ */
+
+pub(crate) mod init;