Skip to content

Commit

Permalink
move player to master, remove comments
Browse files Browse the repository at this point in the history
  • Loading branch information
CosminPerRam committed Oct 29, 2024
1 parent 1f383ff commit d2a5970
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 18 deletions.
1 change: 0 additions & 1 deletion crates/lib/src/games/definitions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,6 @@ pub static GAMES: Map<&'static str, Game> = phf_map! {
"zps" => game!("Zombie Panic: Source", 27015, Protocol::Valve(Engine::new(17_500))),
"moe" => game!("Myth Of Empires", 12888, Protocol::Valve(Engine::new(1_371_580))),
"mordhau" => game!("Mordhau", 27015, Protocol::Valve(Engine::new(629_760))),
// "minetest" => game!("Minetest", 30000, Protocol::PROPRIETARY(ProprietaryProtocol::Minetest)),
"mindustry" => game!("Mindustry", crate::games::mindustry::DEFAULT_PORT, Protocol::PROPRIETARY(ProprietaryProtocol::Mindustry)),
"nla" => game!("Nova-Life: Amboise", 27015, Protocol::Valve(Engine::new(885_570))),
};
23 changes: 7 additions & 16 deletions crates/lib/src/games/minetest/types.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
use crate::minetest_master_server::Server;
use crate::minetest_master_server::{Player, Server};
use crate::protocols::types::{CommonPlayer, CommonResponse, GenericPlayer};
use crate::protocols::GenericResponse;
use serde::{Deserialize, Serialize};

#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[derive(Debug, Clone, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct Player {
pub name: String,
}

impl CommonPlayer for Player {
fn as_original(&self) -> GenericPlayer { GenericPlayer::Minetest(self) }
Expand All @@ -31,13 +24,11 @@ impl CommonResponse for Server {
fn has_password(&self) -> Option<bool> { Some(self.password) }

fn players(&self) -> Option<Vec<&dyn CommonPlayer>> {
None
// Some(
// self.clients_list
// .iter()
// .map(|p| Player { name: p.clone() })
// .map(|p| p as &dyn CommonPlayer)
// .collect(),
// )
Some(
self.clients_list
.iter()
.map(|p| p as &dyn CommonPlayer)
.collect(),
)
}
}
8 changes: 7 additions & 1 deletion crates/lib/src/services/minetest_master_server/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use serde::{Deserialize, Serialize};
pub struct Server {
pub address: String,
pub clients: u32,
pub clients_list: Vec<String>,
pub clients_list: Vec<Player>,
pub clients_max: u32,
pub creative: bool,
pub damage: bool,
Expand Down Expand Up @@ -44,3 +44,9 @@ pub struct Response {
pub total_max: ServersClients,
pub list: Vec<Server>,
}

#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[derive(Debug, Clone, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct Player {
pub name: String,
}

0 comments on commit d2a5970

Please sign in to comment.