levilamina::client¶
Client-only capabilities.
On a server host this whole family is empty slots
Not a compile error but a runtime Err. Contract Β§2.1: the layout is identical on every
target and an absent capability is a NULL slot, so the same mod source compiles for both
targets and loading onto the wrong one is refused explicitly by the host during the
handshake, from mod_flags.
Decide with is_available and not with a cfg.
A callback runs on the client thread
Not the server thread. A hotkey callback must not touch server state.
Functions¶
client::is_available¶
| Rust | |
|---|---|
Whether this host was built for the client target, meaning whether the client_* slots
are filled.
- Return type:
bool - Slots:
client_is_in_level
client::is_in_level¶
| Rust | |
|---|---|
Whether the client is currently in a world.
- Return type:
Result<bool> - Slots:
client_is_in_level
client::local_player_name¶
| Rust | |
|---|---|
The name of the local player. Not being in a world is an Err.
- Return type:
Result<String> - Slots:
client_get_local_player
client::screen_name¶
| Rust | |
|---|---|
The current screen name, such as "hud_screen" or "pause_screen".
- Return type:
Result<String> - Slots:
client_get_screen_name
client::register_key¶
| Rust | |
|---|---|
Registers a hotkey.
key_codes is the default binding and allow_remap decides whether the player may
change it in the settings.
The callback receives (action, focus impact) and both run on the client thread.
- Parameters:
- name :
&str - key_codes :
&[i32] - allow_remap :
bool - handler :
impl FnMut(KeyAction, i32) + Send + 'static
- name :
- Return type:
Result<KeyBinding> - Slots:
client_register_key
KeyBinding¶
One registered hotkey. Dropping it deregisters.
- Implements:
Drop
KeyBinding::name¶
| Rust | |
|---|---|
- Return type:
&str
KeyBinding::key_codes¶
| Rust | |
|---|---|
The key codes currently bound. They differ from the defaults once the player has rebound them.
- Return type:
Result<Vec<i32>> - Slots:
client_get_key_codes
KeyBinding::forget¶
| Rust | |
|---|---|
Keeps it alive until the mod unloads, when the host clears it.
KeyAction¶
| Rust | |
|---|---|
A key action.
- Implements:
Debug,Clone,Copy,PartialEq,Eq
KeyAction::from_i32¶
| Rust | |
|---|---|
- Parameters:
- v :
i32
- v :
- Return type:
KeyAction
KeyAction::is_down¶
| Rust | |
|---|---|
- Return type:
bool