screeps/game/
gcl.rs

1//! Global Control Level information.
2//!
3//! [Screeps documentation](https://docs.screeps.com/api/#Game.gcl)
4use wasm_bindgen::prelude::*;
5
6#[wasm_bindgen]
7extern "C" {
8    #[wasm_bindgen(js_name = "gcl")]
9    type Gcl;
10
11    #[wasm_bindgen(js_namespace = ["Game"], js_class = "gcl", static_method_of = Gcl, getter, js_name = level)]
12    fn level() -> u32;
13
14    #[wasm_bindgen(js_namespace = ["Game"], js_class = "gcl", static_method_of = Gcl, getter, js_name = progress)]
15    fn progress() -> f64;
16
17    #[wasm_bindgen(js_namespace = ["Game"], js_class = "gcl", static_method_of = Gcl, getter, js_name = progressTotal)]
18    fn progress_total() -> f64;
19}
20
21/// Your current Global Control Level, which determines the number of rooms
22/// you are allowed to claim.
23pub fn level() -> u32 {
24    Gcl::level()
25}
26
27/// Your progress toward the next Global Control Level.
28pub fn progress() -> f64 {
29    Gcl::progress()
30}
31
32/// Total progress needed to reach the next Global Control Level.
33pub fn progress_total() -> f64 {
34    Gcl::progress_total()
35}