Archive incari-client (client, 26.3, clean)
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
// Each frame: the world lit fully while on, and Horizon's own Fullbright extra's choice once off.
|
||||
fn incari_fullbright_frame(game: &mut crate::game::Game<'_>) {
|
||||
use crate::game::{incari_client as c, incari_fullbright as m};
|
||||
let on = c::settings(m::ID, |s| m::lit(s.int("level"))).unwrap_or(false);
|
||||
game.native_set_fullbright(on);
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
# Incari's Fullbright (features/fullbright) for the Rust build (ADR 0068, 0069). Hooks by name only
|
||||
# (native-hooks.json). Its settings are the client's (rust/mods/incari), shown in the module menu.
|
||||
[mod]
|
||||
id = "incari_fullbright"
|
||||
version = "0.1.0"
|
||||
priority = 100
|
||||
|
||||
[[module]]
|
||||
id = "runtime"
|
||||
file = "crates/horizon-client/src/game.rs"
|
||||
name = "incari_fullbright"
|
||||
source = "runtime.rs"
|
||||
|
||||
[[injection]]
|
||||
id = "frame"
|
||||
hook = "frame"
|
||||
hook_version = 1
|
||||
kind = "HEAD"
|
||||
helper = "frame.rs"
|
||||
bindings = [
|
||||
{ name = "game", ty = "&mut crate::game::Game<'_>", value = "&mut *self" },
|
||||
]
|
||||
@@ -0,0 +1,23 @@
|
||||
// Incari's Fullbright for the Rust build (ADR 0068, 0069), as features/fullbright does it: caves
|
||||
// and nights as light as day, for you only, with the Brightness option untouched. Its settings are
|
||||
// the module's in `incari_core::modules`. Horizon lights the world fully or not at all (its own
|
||||
// Fullbright extra), so any Brightness lights it fully. No game types: rust/lib.rs tests it.
|
||||
|
||||
/// The module's id, as the Java client's profiles name it.
|
||||
pub const ID: &str = "fullbright";
|
||||
|
||||
/// Whether to light the world fully at Brightness `level` (percent): Horizon has no half way.
|
||||
pub fn lit(level: i32) -> bool {
|
||||
level > 0
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn lights_at_every_brightness_the_menu_offers() {
|
||||
assert!(lit(100) && lit(10));
|
||||
assert!(!lit(0));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user