mirror of
https://github.com/tribufu/rust-gamedig
synced 2026-05-06 15:27:28 +00:00
Team Fortress Classic support.
This commit is contained in:
parent
21b7d91ee6
commit
d086d49cdc
6 changed files with 21 additions and 2 deletions
|
|
@ -7,6 +7,7 @@ Who knows what the future holds...
|
|||
[ARK: Survival Evolved](https://store.steampowered.com/app/346110/ARK_Survival_Evolved/) support.
|
||||
[Unturned](https://store.steampowered.com/app/304930/Unturned/) support.
|
||||
[The Forest](https://store.steampowered.com/app/242760/The_Forest/) support.
|
||||
[Team Fortress Classic](https://store.steampowered.com/app/20/Team_Fortress_Classic/) support.
|
||||
|
||||
# 0.0.5 - 15/11/2022
|
||||
Added `SocketBind` error, regarding failing to bind a socket.
|
||||
|
|
|
|||
1
GAMES.md
1
GAMES.md
|
|
@ -22,6 +22,7 @@
|
|||
| ASE | ARK: Survival Evolved | Valve Protocol | |
|
||||
| UNTURNED | Unturned | Valve Protocol | |
|
||||
| TF | The Forest | Valve Protocol | Use the query port. |
|
||||
| TFC | Team Fortress Classic | Valve Protocol | |
|
||||
|
||||
## Planned to add support:
|
||||
_
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
use std::env;
|
||||
use gamedig::{aliens, ase, asrd, cscz, csgo, css, dod, dods, GDResult, gm, hl2dm, ins, insmic, inss, l4d, l4d2, mc, sdtd, tf, tf2, ts, unturned};
|
||||
use gamedig::{aliens, ase, asrd, cscz, csgo, css, dod, dods, GDResult, gm, hl2dm, ins, insmic, inss, l4d, l4d2, mc, sdtd, tf, tf2, tfc, ts, unturned};
|
||||
use gamedig::protocols::minecraft::{LegacyGroup, Server};
|
||||
use gamedig::protocols::valve;
|
||||
use gamedig::protocols::valve::App;
|
||||
|
|
@ -51,6 +51,7 @@ fn main() -> GDResult<()> {
|
|||
"ase" => println!("{:#?}", ase::query(ip, port)?),
|
||||
"unturned" => println!("{:#?}", unturned::query(ip, port)?),
|
||||
"tf" => println!("{:#?}", tf::query(ip, port)?),
|
||||
"tfc" => println!("{:#?}", tfc::query(ip, port)?),
|
||||
"_src" => println!("{:#?}", valve::query(ip, 27015, App::Source(None), None, None)?),
|
||||
"_gld" => println!("{:#?}", valve::query(ip, 27015, App::GoldSrc(false), None, None)?),
|
||||
"_gld_f" => println!("{:#?}", valve::query(ip, 27015, App::GoldSrc(true), None, None)?),
|
||||
|
|
|
|||
|
|
@ -43,3 +43,5 @@ pub mod ase;
|
|||
pub mod unturned;
|
||||
/// The Forest
|
||||
pub mod tf;
|
||||
/// Team Fortress Classic
|
||||
pub mod tfc;
|
||||
|
|
|
|||
12
src/games/tfc.rs
Normal file
12
src/games/tfc.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::TFC.as_app(), None, None)?;
|
||||
|
||||
Ok(game::Response::new_from_valve_response(valve_response))
|
||||
}
|
||||
|
|
@ -145,6 +145,8 @@ pub enum Request {
|
|||
#[repr(u32)]
|
||||
#[derive(PartialEq, Clone)]
|
||||
pub enum SteamID {
|
||||
/// Team Fortress Classic
|
||||
TFC = 20,
|
||||
/// Day of Defeat
|
||||
DOD = 30,
|
||||
/// Counter-Strike: Condition Zero
|
||||
|
|
@ -191,7 +193,7 @@ impl SteamID {
|
|||
/// Get ID as App (the engine is specified).
|
||||
pub fn as_app(&self) -> App {
|
||||
match self {
|
||||
SteamID::CSCZ | SteamID::DOD => App::GoldSrc(false),
|
||||
SteamID::TFC | SteamID::DOD | SteamID::CSCZ => App::GoldSrc(false),
|
||||
x => App::Source(Some(x.clone() as u32))
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue