Games: Onset support.

This commit is contained in:
CosminPerRam 2023-01-18 18:13:50 +02:00
parent 2312ba9114
commit 649dfd81ed
6 changed files with 20 additions and 1 deletions

View file

@ -6,6 +6,7 @@ Who knows what the future holds...
Games:
- [Don't Starve Together](https://store.steampowered.com/app/322330/Dont_Starve_Together/) support.
- [Colony Survival](https://store.steampowered.com/app/366090/Colony_Survival/) support.
- [Onset](https://store.steampowered.com/app/1105810/Onset/) support.
### Breaking:
Nothing.

View file

@ -38,6 +38,7 @@ Beware of the `Notes` column, as it contains information about query port offset
| Age of Chivalry | AOC | Valve Protocol | |
| Don't Starve Together | DST | Valve Protocol | Query port is 27016. |
| Colony Survival | COLU | Valve Protocol | |
| Onset | ONSET | Valve Protocol | Query port is 7776. |
## Planned to add support:
_

View file

@ -1,6 +1,6 @@
use std::env;
use gamedig::{aliens, aoc, arma2oa, ase, asrd, bat1944, bm, cosu, cs, cscz, csgo, css, dod, dods, doi, dst, GDResult, gm, hl2dm, hldms, ins, insmic, inss, l4d, l4d2, mc, pz, ror2, rust, sc, sdtd, tf, tf2, tfc, ts, unturned};
use gamedig::{aliens, aoc, arma2oa, ase, asrd, bat1944, bm, cosu, cs, cscz, csgo, css, dod, dods, doi, dst, GDResult, gm, hl2dm, hldms, ins, insmic, inss, l4d, l4d2, mc, onset, pz, ror2, rust, sc, sdtd, tf, tf2, tfc, ts, unturned};
use gamedig::protocols::minecraft::LegacyGroup;
use gamedig::protocols::valve;
use gamedig::protocols::valve::App;
@ -76,6 +76,7 @@ fn main() -> GDResult<()> {
"aoc" => println!("{:#?}", aoc::query(ip, port)?),
"dst" => println!("{:#?}", dst::query(ip, port)?),
"cosu" => println!("{:#?}", cosu::query(ip, port)?),
"onset" => println!("{:#?}", onset::query(ip, port)?),
_ => panic!("Undefined game: {}", args[1])
};

View file

@ -71,3 +71,5 @@ pub mod aoc;
pub mod dst;
/// Colony Survival
pub mod cosu;
/// Onset
pub mod onset;

12
src/games/onset.rs Normal file
View 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 => 7776,
Some(port) => port
}, SteamID::ONSET.as_app(), None, None)?;
Ok(game::Response::new_from_valve_response(valve_response))
}

View file

@ -207,6 +207,8 @@ pub enum SteamID {
ASRD = 563560,
/// Risk of Rain 2
ROR2 = 632360,
/// Onset
ONSET = 1105810,
}
impl SteamID {