mirror of
https://github.com/IntQuant/noita_entangled_worlds.git
synced 2025-10-19 07:03:16 +00:00
Basic inventory sync
This commit is contained in:
parent
6fccc6bfd6
commit
c1d8472b01
10 changed files with 346 additions and 1411 deletions
1489
noita-proxy/Cargo.lock
generated
1489
noita-proxy/Cargo.lock
generated
File diff suppressed because it is too large
Load diff
|
@ -10,10 +10,15 @@ edition = "2021"
|
|||
|
||||
[dependencies]
|
||||
tungstenite = "0.21.0"
|
||||
eframe = "0.27.2"
|
||||
eframe = { version="0.27.2", features = ["persistence", "glow", "default_fonts"], default_features = false }
|
||||
tracing-subscriber = "0.3.18"
|
||||
tracing = "0.1.40"
|
||||
tangled = { path = "tangled" }
|
||||
serde = { version = "1.0.199", features = ["serde_derive"] }
|
||||
bitcode = "0.6.0"
|
||||
|
||||
[profile.dev]
|
||||
opt-level = 1
|
||||
|
||||
[profile.release]
|
||||
lto = "thin"
|
||||
|
|
|
@ -10,7 +10,7 @@ use std::{
|
|||
use bitcode::{Decode, Encode};
|
||||
use eframe::egui::{self, Color32};
|
||||
use tangled::{Peer, PeerId, Reliability};
|
||||
use tracing::{error, info};
|
||||
use tracing::{error, info, warn};
|
||||
use tungstenite::accept;
|
||||
|
||||
use crate::messages::NetMsg;
|
||||
|
@ -19,7 +19,7 @@ pub mod messages;
|
|||
|
||||
static HOST: PeerId = PeerId(0);
|
||||
|
||||
#[derive(Decode, Encode, Clone)]
|
||||
#[derive(Debug, Decode, Encode, Clone)]
|
||||
pub struct GameSettings {
|
||||
seed: u64,
|
||||
}
|
||||
|
@ -66,7 +66,9 @@ impl NetManager {
|
|||
|
||||
fn broadcast(&self, msg: &NetMsg, reliability: Reliability) {
|
||||
let encoded = bitcode::encode(msg);
|
||||
self.peer.broadcast(encoded, reliability).ok(); // TODO log
|
||||
if let Err(err) = self.peer.broadcast(encoded, reliability) {
|
||||
warn!("Error while broadcasting message: {}", err)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn start(self: Arc<NetManager>) {
|
||||
|
|
|
@ -2,7 +2,7 @@ use bitcode::{Decode, Encode};
|
|||
|
||||
use crate::GameSettings;
|
||||
|
||||
#[derive(Decode, Encode)]
|
||||
#[derive(Debug, Decode, Encode)]
|
||||
pub enum NetMsg {
|
||||
StartGame { settings: GameSettings },
|
||||
ModRaw { data: Vec<u8> },
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue