mirror of
https://github.com/Tribufu/rust-gamedig
synced 2026-08-09 07:01:06 +00:00
[Protocol] Standardize fields (#84)
* [Protocol] Standardize The Ship fields * [Protocol] Standardize FFOW fields * [Protocol] Rename Valve's protocol field to protocol_version * [Protocol] Rename Minecraft's version_protocol field to protocol_version * [Protocol] Rename Valve's version field to game_version * [Protocol] Rename Minecraft java version_name to game_version * [Crate] Reformat RESPONSES.md * [Protocol] Renamed Minecraft Java players_sample to players * [Protocol] Rename Quake (1,2,3) version field to game_version * [Protocol] Rename quake (1 and 2) game_type field to game_mode * [Protocol] Rename Valve, FFOW, TS game field to game_mode * [Generics] Rename game field/function to game_mode * [Protocol] Change players_minimum, _maximum and _bots from those who werent u8 or u32 to u32 * [Protocol] Change instances of player score field type from u32 to i32 * [Crate] Nicer gramar in CHANGELOG * [Protocol] Apply clippy fixes
This commit is contained in:
parent
65c56dc196
commit
9d8fb1ba94
25 changed files with 249 additions and 200 deletions
|
|
@ -66,7 +66,7 @@ pub trait CommonResponse {
|
|||
CommonResponseJson {
|
||||
name: self.name(),
|
||||
description: self.description(),
|
||||
game: self.game(),
|
||||
game_mode: self.game_mode(),
|
||||
game_version: self.game_version(),
|
||||
has_password: self.has_password(),
|
||||
map: self.map(),
|
||||
|
|
@ -84,17 +84,17 @@ pub trait CommonResponse {
|
|||
/// Description of the server
|
||||
fn description(&self) -> Option<&str> { None }
|
||||
/// Name of the current game or game mode
|
||||
fn game(&self) -> Option<&str> { None }
|
||||
fn game_mode(&self) -> Option<&str> { None }
|
||||
/// Version of the game being run on the server
|
||||
fn game_version(&self) -> Option<&str> { None }
|
||||
/// The current map name
|
||||
fn map(&self) -> Option<&str> { None }
|
||||
/// Maximum number of players allowed to connect
|
||||
fn players_maximum(&self) -> u64;
|
||||
fn players_maximum(&self) -> u32;
|
||||
/// Number of players currently connected
|
||||
fn players_online(&self) -> u64;
|
||||
fn players_online(&self) -> u32;
|
||||
/// Number of bots currently connected
|
||||
fn players_bots(&self) -> Option<u64> { None }
|
||||
fn players_bots(&self) -> Option<u32> { None }
|
||||
/// Whether the server requires a password to join
|
||||
fn has_password(&self) -> Option<bool> { None }
|
||||
/// Currently connected players
|
||||
|
|
@ -106,12 +106,12 @@ pub trait CommonResponse {
|
|||
pub struct CommonResponseJson<'a> {
|
||||
pub name: Option<&'a str>,
|
||||
pub description: Option<&'a str>,
|
||||
pub game: Option<&'a str>,
|
||||
pub game_mode: Option<&'a str>,
|
||||
pub game_version: Option<&'a str>,
|
||||
pub map: Option<&'a str>,
|
||||
pub players_maximum: u64,
|
||||
pub players_online: u64,
|
||||
pub players_bots: Option<u64>,
|
||||
pub players_maximum: u32,
|
||||
pub players_online: u32,
|
||||
pub players_bots: Option<u32>,
|
||||
pub has_password: Option<bool>,
|
||||
pub players: Option<Vec<CommonPlayerJson<'a>>>,
|
||||
}
|
||||
|
|
@ -131,14 +131,14 @@ pub trait CommonPlayer {
|
|||
/// Player name
|
||||
fn name(&self) -> &str;
|
||||
/// Player score
|
||||
fn score(&self) -> Option<u32> { None }
|
||||
fn score(&self) -> Option<i32> { None }
|
||||
}
|
||||
|
||||
#[cfg_attr(feature = "serde", derive(Deserialize, Serialize))]
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub struct CommonPlayerJson<'a> {
|
||||
pub name: &'a str,
|
||||
pub score: Option<u32>,
|
||||
pub score: Option<i32>,
|
||||
}
|
||||
|
||||
/// Timeout settings for socket operations
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue