Release Healer Man 0.1.29
This commit is contained in:
1 parent
8c9809d3e0
commit
544c1bee91
120 files changed
+4363
-1036
No files matched your search
@@ -20,12 +20,13 @@ export interface CombatMediaDownloadResult {
|
||||
}
|
||||
|
||||
type ProgressListener = (progress: CombatMediaDownloadProgress) => void;
|
||||
let installRequest: Promise<void> | null = null;
|
||||
|
||||
function isCombatMediaUrl(value: unknown): value is string {
|
||||
return typeof value === "string" && value.startsWith("/assets/game/combat-effects/");
|
||||
}
|
||||
|
||||
/** Callers must enforce the player's original-media opt-in before fetching. */
|
||||
/** Fetch original media after the enabled pack is ready. */
|
||||
export async function fetchCombatMediaAsset(url: string): Promise<Response> {
|
||||
if (!isCombatMediaUrl(url)) throw new Error(`Unsupported combat media URL: ${url}`);
|
||||
return fetchOptionalMediaAsset(url);
|
||||
@@ -50,7 +51,9 @@ export async function downloadCombatMediaPack(
|
||||
};
|
||||
const unsubscribe = subscribeContentManager(publishProgress);
|
||||
try {
|
||||
await installContentPack(COMBAT_MEDIA_CONTENT_PACK_ID);
|
||||
installRequest ??= installContentPack(COMBAT_MEDIA_CONTENT_PACK_ID)
|
||||
.finally(() => { installRequest = null; });
|
||||
await installRequest;
|
||||
publishProgress();
|
||||
const pack = getContentManagerSnapshot().manifest?.packs.find((candidate) => (
|
||||
candidate.id === COMBAT_MEDIA_CONTENT_PACK_ID
|
||||
@@ -61,6 +64,17 @@ export async function downloadCombatMediaPack(
|
||||
}
|
||||
}
|
||||
|
||||
/** Prepare the default media without blocking gameplay when it is unavailable. */
|
||||
export async function ensureCombatMediaPack(): Promise<boolean> {
|
||||
if (combatMediaPackReady()) return true;
|
||||
try {
|
||||
await downloadCombatMediaPack();
|
||||
return combatMediaPackReady();
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
export async function removeCombatMediaPack(): Promise<void> {
|
||||
await removeContentPack(COMBAT_MEDIA_CONTENT_PACK_ID);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user