namespace HSchool.Server.Game; /// /// Swarm failures raise GenerationFailed on the school's board. Success does not, and a /// missing person id never posts. /// 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(TaskCreationOptions.RunContinuationsAsynchronously))); } }