Create picks a country; climate is rolled from the school seed and stored. Old Slavic saves lift as Russia. Co-authored-by: Cursor <cursoragent@cursor.com>
97 lines
3.6 KiB
C#
97 lines
3.6 KiB
C#
using HSchool.Content;
|
|
using HSchool.People;
|
|
using HSchool.Server.Api;
|
|
using HSchool.Simulation;
|
|
|
|
namespace HSchool.Server.Game;
|
|
|
|
/// <summary>
|
|
/// Work item handed from a request or connection thread to the supervisor. Create, delete and
|
|
/// name suggestions stay here; open/close/running/speed/skip are forwarded to the school's worker.
|
|
/// </summary>
|
|
internal abstract record GameCommand
|
|
{
|
|
internal sealed record CreateSchool(
|
|
string Name,
|
|
DateTime StartDate,
|
|
IReadOnlyList<string>? ExtraModIds,
|
|
MapLayout? Map,
|
|
string? CountryId,
|
|
string? NativeLanguage,
|
|
int? Seed,
|
|
TaskCompletionSource<SchoolCreationOutcome> Result) : GameCommand;
|
|
|
|
internal sealed record DeleteSchool(int SchoolId, TaskCompletionSource<bool> Result) : GameCommand;
|
|
|
|
internal sealed record SuggestName(SchoolNameLanguage Language, TaskCompletionSource<string> Result) : GameCommand;
|
|
|
|
/// <summary>A connection starts watching a school; clock frames follow from that worker.</summary>
|
|
internal sealed record OpenSchool(uint PlayerId, int SchoolId) : GameCommand;
|
|
|
|
/// <summary>
|
|
/// Stops watching. The school id travels with the command because the connection may already
|
|
/// be gone from the registry by the time the supervisor gets here.
|
|
/// </summary>
|
|
internal sealed record CloseSchool(uint PlayerId, int SchoolId) : GameCommand;
|
|
|
|
internal sealed record SetRunning(uint PlayerId, bool Running) : GameCommand;
|
|
|
|
internal sealed record SetSpeed(uint PlayerId, byte SpeedIndex) : GameCommand;
|
|
|
|
internal sealed record SkipEmpty(uint PlayerId) : GameCommand;
|
|
|
|
/// <summary>Stops every worker, re-reads the save directory, starts workers from those files.</summary>
|
|
internal sealed record ReloadSaves(TaskCompletionSource Result) : GameCommand;
|
|
|
|
/// <summary>
|
|
/// A worker thread ended on an exception. The supervisor owns the table, so the worker asks
|
|
/// it to drop the school instead of removing itself.
|
|
/// </summary>
|
|
internal sealed record WorkerFailed(int SchoolId) : GameCommand;
|
|
|
|
/// <summary>Live presence and needs for a diagnostic dump. Completes on that school's worker.</summary>
|
|
internal sealed record DumpSchool(int SchoolId, TaskCompletionSource<SchoolLiveDump?> Result) : GameCommand;
|
|
|
|
/// <summary>One person's card, including live needs. Completes on that school's worker thread.</summary>
|
|
internal sealed record GetPerson(
|
|
int SchoolId,
|
|
string PersonId,
|
|
string Locale,
|
|
TaskCompletionSource<PersonCardResult> Result) : GameCommand;
|
|
|
|
internal sealed record HireStaff(
|
|
int SchoolId,
|
|
string PersonId,
|
|
string Position,
|
|
TaskCompletionSource<StaffingOutcome> Result) : GameCommand;
|
|
|
|
internal sealed record AssignSubject(
|
|
int SchoolId,
|
|
string PersonId,
|
|
string Subject,
|
|
TaskCompletionSource<StaffingOutcome> Result) : GameCommand;
|
|
|
|
internal sealed record UnassignSubject(
|
|
int SchoolId,
|
|
string PersonId,
|
|
string Subject,
|
|
TaskCompletionSource<StaffingOutcome> Result) : GameCommand;
|
|
|
|
internal sealed record PinLesson(
|
|
int SchoolId,
|
|
string ClassId,
|
|
string Subject,
|
|
string RoomId,
|
|
int Day,
|
|
int Period,
|
|
TaskCompletionSource<TimetableOutcome> Result) : GameCommand;
|
|
|
|
internal sealed record UnpinLesson(
|
|
int SchoolId,
|
|
string ClassId,
|
|
string Subject,
|
|
int Day,
|
|
int Period,
|
|
TaskCompletionSource<TimetableOutcome> Result) : GameCommand;
|
|
}
|