Custom races off: count the characters kept out, delete their companion bots

A client without the races patch crashes on a unit of race 12+, so the server now keeps
those characters out while custom races are off. The Custom Races card shows how many
player characters and bots that are (active realm, read only while the database runs) and
offers botcmd purgecustomraces for the companion bots.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
ДмитрийandClaude Opus 5.5 committed 2026-11-16 00:36:18 +05:00
1 parent 2fd42f2acd
commit f9839ba369
13 files changed
+121 -1

No files matched your search

+29
View File
@@ -1479,6 +1479,33 @@ async fn custom_races_install(
result
}
#[tauri::command]
async fn custom_race_characters(
state: State<'_, AppState>,
id: String,
) -> std::result::Result<Option<coa_core::custom_races::CustomRaceCharacters>, UiError> {
let root = path_of(&state, &id)?;
blocking(move || coa_core::custom_races::custom_race_characters(&root)).await
}
/// Delete the companion bots of custom races through the running world's console. Returns how many.
#[tauri::command]
async fn purge_custom_race_bots(
state: State<'_, AppState>,
id: String,
) -> std::result::Result<u32, UiError> {
let root = path_of(&state, &id)?;
let _guard = BusyGuard::acquire(&state, &id)?;
blocking(move || {
let o = coa_core::process::observe(&root, &layout::read_ports(&root));
if o.world.state != coa_core::process::ServiceState::Running {
return Err(Error::Invalid("Start the server to delete bots.".into()));
}
Ra::connect(&root)?.purge_custom_race_bots()
})
.await
}
#[tauri::command]
async fn addons_list(
state: State<'_, AppState>,
@@ -3152,6 +3179,8 @@ pub fn run() {
restart_schedule_save,
clear_game_cache_on_play,
set_clear_game_cache_on_play,
custom_race_characters,
purge_custom_race_bots,
addons_list,
addons_install,
addons_remove,