Retry a failed portrait from the notice with the same scene builder.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Leonid Pershin
2026-08-21 01:48:30 +03:00
co-authored by Cursor
parent 3c70227229
commit 3061e09d3e
32 changed files with 712 additions and 105 deletions
@@ -0,0 +1,32 @@
namespace HSchool.Server.Game;
/// <summary>
/// Swarm failures raise <c>GenerationFailed</c> on the school's board. Success does not, and a
/// missing person id never posts.
/// </summary>
internal static class GenerationFailedPoster
{
public const string DefName = "GenerationFailed";
public static bool ShouldPost(PortraitGenerationOutcome outcome) =>
outcome is PortraitGenerationOutcome.Unavailable or PortraitGenerationOutcome.TimedOut;
public static void TryEnqueue(
GameCommandQueue commands,
int schoolId,
string personId,
PortraitKind kind)
{
if (string.IsNullOrWhiteSpace(personId))
{
return;
}
commands.Enqueue(new GameCommand.PostSchoolNotice(
schoolId,
DefName,
personId,
PortraitKindParser.ToApiValue(kind),
new TaskCompletionSource<PostedNotice?>(TaskCreationOptions.RunContinuationsAsynchronously)));
}
}