Launcher: install from Horizon's registry, enable and disable, takedowns
Mods install into horizon-mods/<id>.hmod (turned on) and resource packs into resourcepacks/, each downloaded to mod-browser/downloads/ and checked by horizon_mods::index::check_file (size, SHA-256, signature, manifest) before it is moved into place. Files the index takes down are turned off when the index is read or the game starts, and can't be installed or turned back on. CLI (and so MCP): --source horizon, mods enable|disable, and search shows whether a project is signed and what a mod may do. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -110,6 +110,16 @@ pub fn check_project(
|
||||
Ok((version, check))
|
||||
}
|
||||
|
||||
/// Whether mod `id` is on in `horizon-mods.txt`.
|
||||
pub fn is_enabled(home: &Path, id: &str) -> bool {
|
||||
let key = format!("mod.{id}");
|
||||
fs::read_to_string(home.join(MODS_LIST))
|
||||
.unwrap_or_default()
|
||||
.lines()
|
||||
.filter_map(|l| l.split_once(':'))
|
||||
.any(|(k, v)| k.trim() == key && v.trim() == "true")
|
||||
}
|
||||
|
||||
/// Turns mod `id` on (or off) in `horizon-mods.txt`, keeping the other lines.
|
||||
pub fn set_enabled(home: &Path, id: &str, on: bool) -> Result<(), String> {
|
||||
let path = home.join(MODS_LIST);
|
||||
|
||||
Reference in New Issue
Block a user