mirror of
https://github.com/tribufu/rust-gamedig
synced 2026-05-18 09:35:50 +00:00
Sven Co-op support.
This commit is contained in:
parent
8c5ac24468
commit
de3ac9aad5
6 changed files with 21 additions and 2 deletions
|
|
@ -45,3 +45,5 @@ pub mod unturned;
|
|||
pub mod tf;
|
||||
/// Team Fortress Classic
|
||||
pub mod tfc;
|
||||
/// Sven Co-op
|
||||
pub mod sc;
|
||||
|
|
|
|||
12
src/games/sc.rs
Normal file
12
src/games/sc.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::SC.as_app(), None, None)?;
|
||||
|
||||
Ok(game::Response::new_from_valve_response(valve_response))
|
||||
}
|
||||
|
|
@ -175,6 +175,8 @@ pub enum SteamID {
|
|||
INSMIC = 17700,
|
||||
/// Insurgency
|
||||
INS = 222880,
|
||||
/// Sven Co-op
|
||||
SC = 225840,
|
||||
/// The Forrest
|
||||
TF = 556450, //this is the id for the dedicated server, for the game its 242760
|
||||
/// 7 Days To Die
|
||||
|
|
@ -193,7 +195,7 @@ impl SteamID {
|
|||
/// Get ID as App (the engine is specified).
|
||||
pub fn as_app(&self) -> App {
|
||||
match self {
|
||||
SteamID::TFC | SteamID::DOD | SteamID::CSCZ => App::GoldSrc(false),
|
||||
SteamID::TFC | SteamID::DOD | SteamID::CSCZ | SteamID::SC => App::GoldSrc(false),
|
||||
x => App::Source(Some(x.clone() as u32))
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue