Games: Colony Survival support.

This commit is contained in:
CosminPerRam 2023-01-18 18:06:08 +02:00
parent bbd2dd7d97
commit 2312ba9114
6 changed files with 20 additions and 1 deletions

View file

@ -5,6 +5,7 @@ Who knows what the future holds...
### Changes:
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.
### Breaking:
Nothing.

View file

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

View file

@ -1,6 +1,6 @@
use std::env;
use gamedig::{aliens, aoc, arma2oa, ase, asrd, bat1944, bm, 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, pz, ror2, rust, sc, sdtd, tf, tf2, tfc, ts, unturned};
use gamedig::protocols::minecraft::LegacyGroup;
use gamedig::protocols::valve;
use gamedig::protocols::valve::App;
@ -75,6 +75,7 @@ fn main() -> GDResult<()> {
"pz" => println!("{:#?}", pz::query(ip, port)?),
"aoc" => println!("{:#?}", aoc::query(ip, port)?),
"dst" => println!("{:#?}", dst::query(ip, port)?),
"cosu" => println!("{:#?}", cosu::query(ip, port)?),
_ => panic!("Undefined game: {}", args[1])
};

12
src/games/cosu.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 => 27004,
Some(port) => port
}, SteamID::COSU.as_app(), None, None)?;
Ok(game::Response::new_from_valve_response(valve_response))
}

View file

@ -69,3 +69,5 @@ pub mod pz;
pub mod aoc;
/// Don't Starve Together
pub mod dst;
/// Colony Survival
pub mod cosu;

View file

@ -187,6 +187,8 @@ pub enum SteamID {
DST = 322320,
/// Black Mesa
BM = 362890,
/// Colony Survival
COSU = 366090,
/// Day of Infamy
DOI = 447820,
/// The Forrest