2023-02-13 21:27:27 -06:00
|
|
|
|
2023-02-11 17:37:24 -06:00
|
|
|
use shipyard::{World, Workload, IntoWorkload};
|
|
|
|
use std::{thread, time::Duration};
|
2023-02-10 15:11:18 -06:00
|
|
|
|
2023-02-13 21:27:27 -06:00
|
|
|
pub(crate) mod util;
|
2023-02-11 17:37:24 -06:00
|
|
|
pub(crate) mod config;
|
|
|
|
pub(crate) mod server;
|
|
|
|
pub(crate) mod client;
|
2023-02-13 21:27:27 -06:00
|
|
|
pub(crate) mod chunk;
|
|
|
|
pub(crate) mod auth;
|
2023-02-10 13:26:03 -06:00
|
|
|
|
2023-02-11 17:37:24 -06:00
|
|
|
use config::read_config;
|
2023-02-13 21:27:27 -06:00
|
|
|
use server::{bind_server, update_server, update_server_events};
|
|
|
|
use auth::authenticate_players;
|
2023-02-10 13:36:58 -06:00
|
|
|
|
|
|
|
fn initialize() -> Workload {
|
|
|
|
(
|
2023-02-11 17:37:24 -06:00
|
|
|
read_config,
|
2023-02-10 13:36:58 -06:00
|
|
|
bind_server,
|
|
|
|
).into_workload()
|
|
|
|
}
|
|
|
|
|
|
|
|
fn update() -> Workload {
|
|
|
|
(
|
|
|
|
update_server,
|
2023-02-13 21:27:27 -06:00
|
|
|
update_server_events,
|
|
|
|
authenticate_players,
|
2023-02-10 13:36:58 -06:00
|
|
|
).into_workload()
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
2023-02-10 13:44:34 -06:00
|
|
|
kubi_logging::init();
|
2023-02-10 13:36:58 -06:00
|
|
|
let world = World::new();
|
|
|
|
world.add_workload(initialize);
|
|
|
|
world.add_workload(update);
|
|
|
|
world.run_workload(initialize).unwrap();
|
2023-02-10 15:11:18 -06:00
|
|
|
log::info!("The server is now running");
|
2023-02-10 13:26:03 -06:00
|
|
|
loop {
|
2023-02-10 13:36:58 -06:00
|
|
|
world.run_workload(update).unwrap();
|
2023-02-10 15:05:10 -06:00
|
|
|
thread::sleep(Duration::from_millis(16));
|
2023-02-10 13:26:03 -06:00
|
|
|
}
|
2023-01-29 18:46:22 -06:00
|
|
|
}
|