diff options
author | metamuffin <metamuffin@disroot.org> | 2024-09-02 01:41:33 +0200 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2024-09-02 01:41:37 +0200 |
commit | 6c4fb2a9d5bf0fde77a6633cb244828852559b04 (patch) | |
tree | e39555afb74c2fdc561679cac9567ef0a4519b03 /server/src/server.rs | |
parent | 52e7384c955d6fcfe5d522c3c4d5258de38f3507 (diff) | |
download | hurrycurry-6c4fb2a9d5bf0fde77a6633cb244828852559b04.tar hurrycurry-6c4fb2a9d5bf0fde77a6633cb244828852559b04.tar.bz2 hurrycurry-6c4fb2a9d5bf0fde77a6633cb244828852559b04.tar.zst |
move things around, add scoreboards load/save module
Diffstat (limited to 'server/src/server.rs')
-rw-r--r-- | server/src/server.rs | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/server/src/server.rs b/server/src/server.rs index 12eca299..6693d0fb 100644 --- a/server/src/server.rs +++ b/server/src/server.rs @@ -19,9 +19,10 @@ use crate::{ data::{DataIndex, Serverdata}, entity::{Entities, EntityContext}, interaction::{interact, tick_slot, InteractEffect, TickEffect}, + scoreboard::ScoreboardStore, ConnectionID, }; -use anyhow::{anyhow, bail, Result}; +use anyhow::{anyhow, bail, Context, Result}; use hurrycurry_client_lib::{Game, Item, Player, Tile}; use hurrycurry_protocol::{ glam::{IVec2, Vec2}, @@ -50,6 +51,7 @@ pub struct Server { pub packet_out: VecDeque<PacketC>, pub tx: Sender<PacketC>, pub connections: HashMap<ConnectionID, HashSet<PlayerID>>, + pub scoreboard: ScoreboardStore, } pub trait GameServerExt { @@ -231,11 +233,9 @@ impl GameServerExt for Game { impl Server { pub async fn new(tx: Sender<PacketC>) -> Result<Self> { - let mut index = DataIndex::default(); - index.reload()?; Ok(Self { game: Game::default(), - index, + index: DataIndex::load().await.context("loading data index")?, tx, packet_out: VecDeque::new(), connections: HashMap::new(), @@ -245,6 +245,9 @@ impl Server { score_changed: false, packet_loopback: VecDeque::new(), last_movement_update: HashMap::default(), + scoreboard: ScoreboardStore::load() + .await + .context("loading scoreboards")?, }) } } |