Archive incari-client (client, 26.3, clean)
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
// The fire overlay, lower.
|
||||
fn incari_lowfire_fire(game: &crate::game::Game<'_>, lower: &mut f32) {
|
||||
use crate::game::{incari_client as c, incari_lowfire as m};
|
||||
let _ = game;
|
||||
if let Some(percent) = c::settings(m::ID, |s| s.int("lower")) {
|
||||
*lower = m::lower(percent);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
# Incari's Low Fire (features/lowfire) for the Rust build (ADR 0068, 0069).
|
||||
# Hooks by name where Horizon has stamped the hook point (native-hooks.json), by function where
|
||||
# it's still pending. Its settings are the client's (rust/mods/incari): the module menu shows them.
|
||||
[mod]
|
||||
id = "incari_lowfire"
|
||||
version = "0.1.0"
|
||||
priority = 100
|
||||
|
||||
[[module]]
|
||||
id = "runtime"
|
||||
file = "crates/horizon-client/src/game.rs"
|
||||
name = "incari_lowfire"
|
||||
source = "runtime.rs"
|
||||
|
||||
[[injection]]
|
||||
id = "fire"
|
||||
# Horizon's fire_overlay hook point is still a pending fragment
|
||||
# (tools/native-hook-fragments/incari_client_hooks.json), so this targets its function. Make it
|
||||
# `hook = "fire_overlay"` and `hook_version = 1` once Horizon stamps it.
|
||||
target = "horizon_client::game::native_hooks::Game<'_>::native_fire_overlay"
|
||||
kind = "HEAD"
|
||||
helper = "fire.rs"
|
||||
bindings = [
|
||||
{ name = "game", ty = "&crate::game::Game<'_>", value = "self" },
|
||||
{ name = "lower", ty = "&mut f32", value = "&mut *lower" },
|
||||
]
|
||||
@@ -0,0 +1,22 @@
|
||||
// Incari's Low Fire for the Rust build (ADR 0068, 0069), as features/lowfire does it: the
|
||||
// first-person fire overlay drawn lower while you burn, so it hides less. Its settings are the
|
||||
// module's in `incari_core::modules`. No game types: rust/lib.rs tests it.
|
||||
|
||||
/// The module's id, as the Java client's profiles name it.
|
||||
pub const ID: &str = "lowfire";
|
||||
|
||||
/// How far down, in flame heights, for the `lower` setting (a percent).
|
||||
pub fn lower(percent: i32) -> f32 {
|
||||
percent.clamp(0, 25) as f32 / 100.0
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn lowers_by_the_percent() {
|
||||
assert_eq!(lower(10), 0.1);
|
||||
assert_eq!(lower(25), 0.25);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user