Refactor serialization copying to use source generators (#19412)

This commit is contained in:
DrSmugleaf
2023-08-22 18:14:33 -07:00
committed by GitHub
parent 08b43990ab
commit a88e747a0b
1737 changed files with 2532 additions and 2521 deletions

View File

@@ -15,19 +15,19 @@ namespace Content.Shared.Roles
{
[ViewVariables]
[IdDataField]
public string ID { get; } = default!;
public string ID { get; private set; } = default!;
[DataField("playTimeTracker", required: true, customTypeSerializer: typeof(PrototypeIdSerializer<PlayTimeTrackerPrototype>))]
public string PlayTimeTracker { get; } = string.Empty;
public string PlayTimeTracker { get; private set; } = string.Empty;
[DataField("supervisors")]
public string Supervisors { get; } = "nobody";
public string Supervisors { get; private set; } = "nobody";
/// <summary>
/// The name of this job as displayed to players.
/// </summary>
[DataField("name")]
public string Name { get; } = string.Empty;
public string Name { get; private set; } = string.Empty;
[ViewVariables(VVAccess.ReadOnly)]
public string LocalizedName => Loc.GetString(Name);
@@ -36,7 +36,7 @@ namespace Content.Shared.Roles
/// The name of this job as displayed to players.
/// </summary>
[DataField("description")]
public string? Description { get; }
public string? Description { get; private set; }
[ViewVariables(VVAccess.ReadOnly)]
public string? LocalizedDescription => Description is null ? null : Loc.GetString(Description);
@@ -45,16 +45,16 @@ namespace Content.Shared.Roles
public HashSet<JobRequirement>? Requirements;
[DataField("joinNotifyCrew")]
public bool JoinNotifyCrew { get; } = false;
public bool JoinNotifyCrew { get; private set; } = false;
[DataField("requireAdminNotify")]
public bool RequireAdminNotify { get; } = false;
public bool RequireAdminNotify { get; private set; } = false;
[DataField("setPreference")]
public bool SetPreference { get; } = true;
public bool SetPreference { get; private set; } = true;
[DataField("canBeAntag")]
public bool CanBeAntag { get; } = true;
public bool CanBeAntag { get; private set; } = true;
/// <summary>
/// Whether this job is a head.
@@ -82,21 +82,21 @@ namespace Content.Shared.Roles
public string? JobEntity = null;
[DataField("icon", customTypeSerializer: typeof(PrototypeIdSerializer<StatusIconPrototype>))]
public string Icon { get; } = "JobIconUnknown";
public string Icon { get; private set; } = "JobIconUnknown";
[DataField("special", serverOnly: true)]
public JobSpecial[] Special { get; private set; } = Array.Empty<JobSpecial>();
[DataField("access", customTypeSerializer: typeof(PrototypeIdListSerializer<AccessLevelPrototype>))]
public IReadOnlyCollection<string> Access { get; } = Array.Empty<string>();
public IReadOnlyCollection<string> Access { get; private set; } = Array.Empty<string>();
[DataField("accessGroups", customTypeSerializer: typeof(PrototypeIdListSerializer<AccessGroupPrototype>))]
public IReadOnlyCollection<string> AccessGroups { get; } = Array.Empty<string>();
public IReadOnlyCollection<string> AccessGroups { get; private set; } = Array.Empty<string>();
[DataField("extendedAccess", customTypeSerializer: typeof(PrototypeIdListSerializer<AccessLevelPrototype>))]
public IReadOnlyCollection<string> ExtendedAccess { get; } = Array.Empty<string>();
public IReadOnlyCollection<string> ExtendedAccess { get; private set; } = Array.Empty<string>();
[DataField("extendedAccessGroups", customTypeSerializer: typeof(PrototypeIdListSerializer<AccessGroupPrototype>))]
public IReadOnlyCollection<string> ExtendedAccessGroups { get; } = Array.Empty<string>();
public IReadOnlyCollection<string> ExtendedAccessGroups { get; private set; } = Array.Empty<string>();
}
}