Send game options to player at connection
This commit is contained in:
parent
ad574ec381
commit
6ba4e37bab
@ -2,7 +2,7 @@ use std::collections::HashMap;
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug)]
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct GameOptions {
|
||||
pub values: HashMap<GameOption, GameOptionValue>,
|
||||
}
|
||||
|
||||
@ -12,7 +12,7 @@ use crate::{
|
||||
announcer::Announcement,
|
||||
game::{
|
||||
Game, GameManager, NetPlayer,
|
||||
opts::{GameOption, GameOptionValue},
|
||||
opts::{GameOption, GameOptionValue, GameOptions},
|
||||
},
|
||||
game_settings::GameSettingsManager,
|
||||
net::{net_stats::Stats, util::NetVector3},
|
||||
@ -321,6 +321,7 @@ pub enum Package {
|
||||
NewPlayer(NetPlayer),
|
||||
PlayerLeft(NetPlayer),
|
||||
SetTeam(u16, u8),
|
||||
GameOptions(GameOptions),
|
||||
GameOptionChanged(GameOption, GameOptionValue),
|
||||
ChatMessage(u16, String),
|
||||
|
||||
|
||||
@ -264,6 +264,10 @@ impl NetworkManager {
|
||||
self_id,
|
||||
),
|
||||
);
|
||||
peer.send_reliable(
|
||||
&connection.address,
|
||||
Package::GameOptions(game.bind().opts.clone()),
|
||||
);
|
||||
peer.broadcast_reliable(Package::NewPlayer(
|
||||
game.bind().find_player(self_id).unwrap().clone().into(),
|
||||
));
|
||||
|
||||
Loading…
Reference in New Issue
Block a user