The Forest support.

This commit is contained in:
CosminPerRam 2022-11-26 16:08:47 +02:00
parent ed2161a6da
commit 21b7d91ee6
6 changed files with 22 additions and 3 deletions

View file

@ -5,7 +5,8 @@ Who knows what the future holds...
[Minecraft](https://www.minecraft.com) implementation (bedrock not supported yet).
[7 Days To Die](https://store.steampowered.com/app/251570/7_Days_to_Die/) support.
[ARK: Survival Evolved](https://store.steampowered.com/app/346110/ARK_Survival_Evolved/) support.
[Unturned](https://store.steampowered.com/app/304930/Unturned/) support.
[Unturned](https://store.steampowered.com/app/304930/Unturned/) support.
[The Forest](https://store.steampowered.com/app/242760/The_Forest/) support.
# 0.0.5 - 15/11/2022
Added `SocketBind` error, regarding failing to bind a socket.

View file

@ -13,7 +13,7 @@
| ALIENS | Alien Swarm | Valve Protocol | Not tested. |
| ASRD | Alien Swarm: Reactive Drop | Valve Protocol | |
| INS | Insurgency | Valve Protocol | |
| INSS | Insurgency: Sandstorm | Valve Protocol | Use the query port, not the server port. |
| INSS | Insurgency: Sandstorm | Valve Protocol | Use the query port. |
| INSMIC | Insurgency: Modern Infantry Combat | Valve Protocol | Not tested. |
| CSCZ | Counter-Strike: Condition Zero | Valve Protocol | |
| DOD | Day of Defeat | Valve Protocol | |
@ -21,6 +21,7 @@
| SDTD | 7 Days To Die | Valve Protocol | |
| ASE | ARK: Survival Evolved | Valve Protocol | |
| UNTURNED | Unturned | Valve Protocol | |
| TF | The Forest | Valve Protocol | Use the query port. |
## Planned to add support:
_

View file

@ -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, 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, ts, unturned};
use gamedig::protocols::minecraft::{LegacyGroup, Server};
use gamedig::protocols::valve;
use gamedig::protocols::valve::App;
@ -50,6 +50,7 @@ fn main() -> GDResult<()> {
"7dtd" => println!("{:#?}", sdtd::query(ip, port)?),
"ase" => println!("{:#?}", ase::query(ip, port)?),
"unturned" => println!("{:#?}", unturned::query(ip, port)?),
"tf" => println!("{:#?}", tf::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)?),

View file

@ -41,3 +41,5 @@ pub mod sdtd;
pub mod ase;
/// Unturned
pub mod unturned;
/// The Forest
pub mod tf;

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

View file

@ -173,6 +173,8 @@ pub enum SteamID {
INSMIC = 17700,
/// Insurgency
INS = 222880,
/// The Forrest
TF = 556450, //this is the id for the dedicated server, for the game its 242760
/// 7 Days To Die
SDTD = 251570,
/// Unturned