1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
//! Steam achievements and stats for game code.
//!
//! Every call compiles in every build and does nothing yet: Steamworks needs
//! the `steamworks` crate, which waits on the owner's approval. The optional
//! `steam` feature is reserved for that backend, so game code written against
//! these calls today keeps working when it lands. Until then a game runs the
//! same with or without Steam installed, and these calls never fail.
//!
//! Never let these calls change simulation state: achievements are
//! presentation, like audio, and must not affect replay hashes.
/// Whether a Steam client is connected. Always `false` until the
/// Steamworks backend lands.
#[must_use]
pub fn is_running() -> bool {
false
}
/// Unlocks the achievement with this API name. Returns whether Steam took
/// the call; always `false` until the backend lands.
pub fn unlock_achievement(name: &str) -> bool {
let _ = name;
false
}
/// Sets an integer stat, such as nights survived. Returns whether Steam
/// took the call; always `false` until the backend lands.
pub fn set_stat(name: &str, value: i32) -> bool {
let _ = (name, value);
false
}
#[cfg(test)]
mod tests {
#[test]
fn calls_do_nothing_without_steam() {
assert!(!super::is_running());
assert!(!super::unlock_achievement("night_5"));
assert!(!super::set_stat("nights_survived", 5));
}
}