mirror of
https://github.com/tribufu/rust-gamedig
synced 2026-06-01 09:42:41 +00:00
Games: Add Black Mesa support.
This commit is contained in:
parent
4a7eb400db
commit
328de37b2d
6 changed files with 22 additions and 3 deletions
|
|
@ -6,12 +6,13 @@ Who knows what the future holds...
|
||||||
Games:
|
Games:
|
||||||
- [Risk of Rain 2](https://store.steampowered.com/app/632360/Risk_of_Rain_2/) support.
|
- [Risk of Rain 2](https://store.steampowered.com/app/632360/Risk_of_Rain_2/) support.
|
||||||
- [Battalion 1944](https://store.steampowered.com/app/489940/BATTALION_Legacy/) support.
|
- [Battalion 1944](https://store.steampowered.com/app/489940/BATTALION_Legacy/) support.
|
||||||
|
- [Black Mesa](https://store.steampowered.com/app/362890/Black_Mesa/) support.
|
||||||
|
|
||||||
Protocols:
|
Protocols:
|
||||||
- Valve: Players with no name are no more added to the `players_details` field.
|
- Valve: Players with no name are no more added to the `players_details` field.
|
||||||
|
|
||||||
Crate:
|
Crate:
|
||||||
- `MSRV` is now `1.56.1` (from `1.58.1`)
|
- `MSRV` is now `1.56.1` (was `1.58.1`)
|
||||||
|
|
||||||
### Breaking:
|
### Breaking:
|
||||||
Protocols:
|
Protocols:
|
||||||
|
|
|
||||||
1
GAMES.md
1
GAMES.md
|
|
@ -32,6 +32,7 @@ A supported game is defined as a game that has been successfully tested, other g
|
||||||
| Half-Life Deathmatch: Source | HLDMS | Valve Protocol | |
|
| Half-Life Deathmatch: Source | HLDMS | Valve Protocol | |
|
||||||
| Risk of Rain 2 | ROR2 | Valve Protocol | Query port offset: 1. |
|
| Risk of Rain 2 | ROR2 | Valve Protocol | Query port offset: 1. |
|
||||||
| Battalion 1944 | BAT1944 | Valve Protocol | Query port offset: 3. It is strongly recommended to also query the rules, as the game sends server information's in them. |
|
| Battalion 1944 | BAT1944 | Valve Protocol | Query port offset: 3. It is strongly recommended to also query the rules, as the game sends server information's in them. |
|
||||||
|
| Black Mesa | BM | Valve Protocol | |
|
||||||
|
|
||||||
## Planned to add support:
|
## Planned to add support:
|
||||||
_
|
_
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
|
|
||||||
use std::env;
|
use std::env;
|
||||||
use gamedig::{aliens, arma2oa, ase, asrd, bat1944, cs, cscz, csgo, css, dod, dods, doi, GDResult, gm, hl2dm, hldms, ins, insmic, inss, l4d, l4d2, mc, ror2, rust, sc, sdtd, tf, tf2, tfc, ts, unturned};
|
use gamedig::{aliens, arma2oa, ase, asrd, bat1944, bm, cs, cscz, csgo, css, dod, dods, doi, GDResult, gm, hl2dm, hldms, ins, insmic, inss, l4d, l4d2, mc, ror2, rust, sc, sdtd, tf, tf2, tfc, ts, unturned};
|
||||||
use gamedig::protocols::minecraft::LegacyGroup;
|
use gamedig::protocols::minecraft::LegacyGroup;
|
||||||
use gamedig::protocols::valve;
|
use gamedig::protocols::valve;
|
||||||
use gamedig::protocols::valve::App;
|
use gamedig::protocols::valve::App;
|
||||||
|
|
@ -71,6 +71,7 @@ fn main() -> GDResult<()> {
|
||||||
"hldms" => println!("{:#?}", hldms::query(ip, port)?),
|
"hldms" => println!("{:#?}", hldms::query(ip, port)?),
|
||||||
"ror2" => println!("{:#?}", ror2::query(ip, port)?),
|
"ror2" => println!("{:#?}", ror2::query(ip, port)?),
|
||||||
"bat1944" => println!("{:#?}", bat1944::query(ip, port)?),
|
"bat1944" => println!("{:#?}", bat1944::query(ip, port)?),
|
||||||
|
"bm" => println!("{:#?}", bm::query(ip, port)?),
|
||||||
_ => panic!("Undefined game: {}", args[1])
|
_ => panic!("Undefined game: {}", args[1])
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
12
src/games/bm.rs
Normal file
12
src/games/bm.rs
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
use crate::GDResult;
|
||||||
|
use crate::protocols::valve;
|
||||||
|
use crate::protocols::valve::{game, SteamID};
|
||||||
|
|
||||||
|
pub fn query(address: &str, port: Option<u16>) -> GDResult<game::Response> {
|
||||||
|
let valve_response = valve::query(address, match port {
|
||||||
|
None => 27015,
|
||||||
|
Some(port) => port
|
||||||
|
}, SteamID::BM.as_app(), None, None)?;
|
||||||
|
|
||||||
|
Ok(game::Response::new_from_valve_response(valve_response))
|
||||||
|
}
|
||||||
|
|
@ -61,3 +61,5 @@ pub mod hldms;
|
||||||
pub mod ror2;
|
pub mod ror2;
|
||||||
/// Battalion 1944
|
/// Battalion 1944
|
||||||
pub mod bat1944;
|
pub mod bat1944;
|
||||||
|
/// Black Mesa
|
||||||
|
pub mod bm;
|
||||||
|
|
|
||||||
|
|
@ -179,6 +179,8 @@ pub enum SteamID {
|
||||||
SC = 225840,
|
SC = 225840,
|
||||||
/// Rust
|
/// Rust
|
||||||
RUST = 252490,
|
RUST = 252490,
|
||||||
|
/// Black Mesa
|
||||||
|
BM = 362890,
|
||||||
/// Day of Infamy
|
/// Day of Infamy
|
||||||
DOI = 447820,
|
DOI = 447820,
|
||||||
/// The Forrest
|
/// The Forrest
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue