mirror of
https://git.ngram.ca/OpenJam/rc-servers
synced 2026-08-23 23:08:52 +00:00
Get part way through loading (to sync) #30
This commit is contained in:
@@ -1,16 +1,19 @@
|
||||
mod cli;
|
||||
mod handler;
|
||||
mod traits;
|
||||
pub use traits::{EventCodeHandler, UserData, PacketData, EventCode};
|
||||
pub use traits::{EventCodeHandler, UserData, PacketData, EventCode, RobotMotionHandler};
|
||||
mod data;
|
||||
mod events;
|
||||
mod handlers;
|
||||
mod user;
|
||||
mod matches;
|
||||
mod vehicle_motion;
|
||||
|
||||
pub struct InitConfig {
|
||||
pub config: oj_rc_core::persist::config::ConfigImpl,
|
||||
pub users: std::sync::Arc<oj_rc_core::persist::user::UserImpl>,
|
||||
pub parsers: oj_rc_core::cubes::CubeParsers,
|
||||
pub matches_chann: tokio::sync::mpsc::Sender<matches::GameMessage>,
|
||||
}
|
||||
|
||||
#[tokio::main]
|
||||
@@ -22,15 +25,19 @@ async fn main() -> std::io::Result<()> {
|
||||
let config = oj_rc_core::persist::config::ConfigImpl::load(&args.assets).expect("Bad config data");
|
||||
let users = std::sync::Arc::new(oj_rc_core::persist::user::UserImpl::load(&args.data, &config).await.expect("Bad user data"));
|
||||
let parsers = oj_rc_core::cubes::CubeParsers::new(&config);
|
||||
let matches = matches::GameMatches::new();
|
||||
let matches_chann = matches.spawn();
|
||||
|
||||
let init_ctx = InitConfig {
|
||||
config,
|
||||
users,
|
||||
parsers,
|
||||
matches_chann,
|
||||
};
|
||||
|
||||
let mtu = oj_rc_core::ConfigProvider::<()>::network_config(&init_ctx.config).max_packet_size;
|
||||
let event_handler = events::handler(&init_ctx).await;
|
||||
let server = literustlib_server::Server::new(event_handler, (args.ip, args.port), mtu).await.expect("Bad server");
|
||||
|
||||
server.listen().await
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user