Retry a failed portrait from the notice with the same scene builder.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -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)));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user