Archive incari-client (client, 26.3, clean)
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
// Each frame: the chat box cleared while on, and the game's own back once off.
|
||||
fn incari_clearchat_frame(game: &mut crate::game::Game<'_>) {
|
||||
use crate::game::{incari_clearchat as m, incari_client as c};
|
||||
game.native_set_chat_background(m::opacity(c::on(m::ID)));
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
# Incari's Clear Chat (features/clearchat) 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_clearchat"
|
||||
version = "0.1.0"
|
||||
priority = 100
|
||||
|
||||
[[module]]
|
||||
id = "runtime"
|
||||
file = "crates/horizon-client/src/game.rs"
|
||||
name = "incari_clearchat"
|
||||
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 Clear Chat for the Rust build (ADR 0068, 0069), as features/clearchat does it: no dark
|
||||
// box behind chat. The Java module holds the game's Text Background Opacity at 0%; here the box is
|
||||
// cleared each frame and options.txt is untouched, so the player's own value is back once it's
|
||||
// off. Its toggle is 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 = "clearchat";
|
||||
|
||||
/// The chat box's opacity while on; off gives it back to the game's option.
|
||||
pub fn opacity(on: bool) -> Option<f64> {
|
||||
on.then_some(0.0)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn clears_only_while_on() {
|
||||
assert_eq!(opacity(true), Some(0.0));
|
||||
assert_eq!(opacity(false), None);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user