Archive incari-client (client, 26.3, clean)

This commit is contained in:
2026-11-28 00:54:38 -06:00
parent 7a6174687f
commit 12838e838c
2383 changed files with 280266 additions and 0 deletions
@@ -0,0 +1,9 @@
# clearchat: Clear Chat
Removes the dark box behind chat by holding the game's Text Background Opacity at 0%. Moving that slider yourself turns the module off. ([ADR 0050](../../docs/adr/0050-first-modules-game-view.md))
No settings besides the toggle key.
```sh
./gradlew :features:clearchat:check
```
@@ -0,0 +1,16 @@
plugins {
`java-library`
}
// Clear Chat (ADR 0050): chat without the dark box behind its lines.
// A feature module: it sees the module framework and nothing else.
dependencies {
api(project(":framework"))
testImplementation(testFixtures(project(":framework")))
testImplementation(platform(libs.junit.bom))
testImplementation(libs.junit.jupiter)
testImplementation(libs.assertj)
testImplementation(libs.archunit)
testRuntimeOnly(libs.junit.launcher)
}
@@ -0,0 +1,24 @@
package incari.features.clearchat;
import incari.framework.Category;
import incari.framework.Module;
import incari.framework.game.GameOption;
/**
* Clear Chat: no dark box behind the chat's lines. It holds the game's own Text Background Opacity
* (Chat Settings) at 0 while on, so the game's slider shows it; moving that slider hands control
* back to the player and turns the module off. Turning the module off puts the player's opacity
* back.
*/
public final class ClearChat extends Module {
/** Clear Chat, off until the player turns it on. */
public ClearChat() {
super(
"clearchat",
"Clear Chat",
"Removes the dark box behind chat (the game's Text Background Opacity, set to 0%).",
Category.HUD);
holdOption(GameOption.TEXT_BACKGROUND_OPACITY, () -> 0);
}
}
@@ -0,0 +1,5 @@
/** Clear Chat (ADR 0050): chat without the dark box behind its lines. */
@NullMarked
package incari.features.clearchat;
import org.jspecify.annotations.NullMarked;
@@ -0,0 +1,24 @@
package incari.features.clearchat;
import static com.tngtech.archunit.lang.syntax.ArchRuleDefinition.classes;
import com.tngtech.archunit.core.importer.ImportOption;
import com.tngtech.archunit.junit.AnalyzeClasses;
import com.tngtech.archunit.junit.ArchTest;
import com.tngtech.archunit.lang.ArchRule;
/** A feature sees the module framework and the JDK's basics: no game, platform or other feature. */
@AnalyzeClasses(packages = "incari.features.clearchat", importOptions = ImportOption.DoNotIncludeTests.class)
class BoundaryTest {
@ArchTest
static final ArchRule onlyTheFramework = classes()
.should()
.onlyDependOnClassesThat()
.resideInAnyPackage(
"java.lang..",
"java.util..",
"org.jspecify..",
"incari.framework..",
"incari.features.clearchat..");
}
@@ -0,0 +1,60 @@
package incari.features.clearchat;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.data.Offset.offset;
import incari.framework.game.GameOption;
import incari.framework.testing.TestGame;
import org.junit.jupiter.api.Test;
class ClearChatTest {
private final ClearChat module = new ClearChat();
private final TestGame game = new TestGame(module);
@Test
void setsTheChatsBackgroundOpacityToZeroWhileOn() {
game.setOption(GameOption.TEXT_BACKGROUND_OPACITY, 0.7);
module.setEnabled(true);
assertThat(game.option(GameOption.TEXT_BACKGROUND_OPACITY)).isZero();
game.ticks(5);
assertThat(module.isEnabled()).isTrue();
module.setEnabled(false);
assertThat(game.option(GameOption.TEXT_BACKGROUND_OPACITY)).isEqualTo(0.7, offset(1e-4));
}
@Test
void raisingTheSliderInChatSettingsTurnsItOffAndKeepsTheNewValue() {
module.setEnabled(true);
game.setOption(GameOption.TEXT_BACKGROUND_OPACITY, 0.3);
game.tick();
assertThat(module.isEnabled()).isFalse();
assertThat(game.option(GameOption.TEXT_BACKGROUND_OPACITY)).isEqualTo(0.3);
}
@Test
void givesThePlayersOpacityBackAfterARestartWithItOn() {
game.setOption(GameOption.TEXT_BACKGROUND_OPACITY, 0.6);
module.setEnabled(true);
game.system().flush();
// A new start: the game's options kept the 0, the profile has the module on.
ClearChat again = new ClearChat();
TestGame restarted = new TestGame(again);
restarted.files.putAll(game.files);
restarted.setOption(GameOption.TEXT_BACKGROUND_OPACITY, 0);
restarted.system().load();
assertThat(again.isEnabled()).isTrue();
again.setEnabled(false);
assertThat(restarted.option(GameOption.TEXT_BACKGROUND_OPACITY)).isEqualTo(0.6, offset(1e-4));
}
@Test
void theHeldValueIsntInTheSettingsScreen() {
assertThat(module.settings().anyShown()).isTrue(); // the toggle key
assertThat(module.settings().get("before-text-background-opacity").isVisible())
.isFalse();
}
}