Refactor serialization copying to use source generators (#19412)
This commit is contained in:
@@ -8,11 +8,11 @@ namespace Content.Shared.Humanoid.Prototypes;
|
||||
public sealed class HumanoidProfilePrototype : IPrototype
|
||||
{
|
||||
[IdDataField]
|
||||
public string ID { get; } = default!;
|
||||
public string ID { get; private set; } = default!;
|
||||
|
||||
[DataField("customBaseLayers")]
|
||||
public Dictionary<HumanoidVisualLayers, CustomBaseLayerInfo> CustomBaseLayers = new();
|
||||
|
||||
[DataField("profile")]
|
||||
public HumanoidCharacterProfile Profile { get; } = new();
|
||||
public HumanoidCharacterProfile Profile { get; private set; } = new();
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace Content.Shared.Humanoid.Prototypes;
|
||||
public sealed class HumanoidSpeciesBaseSpritesPrototype : IPrototype
|
||||
{
|
||||
[IdDataField]
|
||||
public string ID { get; } = default!;
|
||||
public string ID { get; private set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// Sprites that this species will use on the given humanoid
|
||||
@@ -33,7 +33,7 @@ public sealed class HumanoidSpeciesBaseSpritesPrototype : IPrototype
|
||||
public sealed class HumanoidSpeciesSpriteLayer : IPrototype
|
||||
{
|
||||
[IdDataField]
|
||||
public string ID { get; } = default!;
|
||||
public string ID { get; private set; } = default!;
|
||||
/// <summary>
|
||||
/// The base sprite for this sprite layer. This is what
|
||||
/// will replace the empty layer tagged by the enum
|
||||
@@ -43,7 +43,7 @@ public sealed class HumanoidSpeciesSpriteLayer : IPrototype
|
||||
/// layer will be invisible until otherwise set.
|
||||
/// </summary>
|
||||
[DataField("baseSprite")]
|
||||
public SpriteSpecifier? BaseSprite { get; }
|
||||
public SpriteSpecifier? BaseSprite { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// The alpha of this layer. Ensures that
|
||||
@@ -51,20 +51,20 @@ public sealed class HumanoidSpeciesSpriteLayer : IPrototype
|
||||
/// of alpha.
|
||||
/// </summary>
|
||||
[DataField("layerAlpha")]
|
||||
public float LayerAlpha { get; } = 1.0f;
|
||||
public float LayerAlpha { get; private set; } = 1.0f;
|
||||
|
||||
/// <summary>
|
||||
/// If this sprite layer should allow markings or not.
|
||||
/// </summary>
|
||||
[DataField("allowsMarkings")]
|
||||
public bool AllowsMarkings { get; } = true;
|
||||
public bool AllowsMarkings { get; private set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// If this layer should always match the
|
||||
/// skin tone in a character profile.
|
||||
/// </summary>
|
||||
[DataField("matchSkin")]
|
||||
public bool MatchSkin { get; } = true;
|
||||
public bool MatchSkin { get; private set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// If any markings that go on this layer should
|
||||
@@ -72,5 +72,5 @@ public sealed class HumanoidSpeciesSpriteLayer : IPrototype
|
||||
/// alpha.
|
||||
/// </summary>
|
||||
[DataField("markingsMatchSkin")]
|
||||
public bool MarkingsMatchSkin { get; }
|
||||
public bool MarkingsMatchSkin { get; private set; }
|
||||
}
|
||||
|
||||
@@ -21,17 +21,17 @@ public sealed class RandomHumanoidSettingsPrototype : IPrototype, IInheritingPro
|
||||
/// Whether the humanoid's name should take from the randomized profile or not.
|
||||
/// </summary>
|
||||
[DataField("randomizeName")]
|
||||
public bool RandomizeName { get; } = true;
|
||||
public bool RandomizeName { get; private set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// Species that will be ignored by the randomizer.
|
||||
/// </summary>
|
||||
[DataField("speciesBlacklist")]
|
||||
public HashSet<string> SpeciesBlacklist { get; } = new();
|
||||
public HashSet<string> SpeciesBlacklist { get; private set; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// Extra components to add to this entity.
|
||||
/// </summary>
|
||||
[DataField("components")]
|
||||
public ComponentRegistry? Components { get; }
|
||||
public ComponentRegistry? Components { get; private set; }
|
||||
}
|
||||
|
||||
@@ -10,13 +10,13 @@ public sealed class SpeciesPrototype : IPrototype
|
||||
/// Prototype ID of the species.
|
||||
/// </summary>
|
||||
[IdDataField]
|
||||
public string ID { get; } = default!;
|
||||
public string ID { get; private set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// User visible name of the species.
|
||||
/// </summary>
|
||||
[DataField("name", required: true)]
|
||||
public string Name { get; } = default!;
|
||||
public string Name { get; private set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// Descriptor. Unused...? This is intended
|
||||
@@ -24,13 +24,13 @@ public sealed class SpeciesPrototype : IPrototype
|
||||
/// (i.e., young human person, young lizard person, etc.)
|
||||
/// </summary>
|
||||
[DataField("descriptor")]
|
||||
public string Descriptor { get; } = "humanoid";
|
||||
public string Descriptor { get; private set; } = "humanoid";
|
||||
|
||||
/// <summary>
|
||||
/// Whether the species is available "at round start" (In the character editor)
|
||||
/// </summary>
|
||||
[DataField("roundStart", required: true)]
|
||||
public bool RoundStart { get; } = false;
|
||||
public bool RoundStart { get; private set; } = false;
|
||||
|
||||
// The below two are to avoid fetching information about the species from the entity
|
||||
// prototype.
|
||||
@@ -42,59 +42,59 @@ public sealed class SpeciesPrototype : IPrototype
|
||||
// sprite accessories.
|
||||
|
||||
[DataField("sprites")]
|
||||
public string SpriteSet { get; } = default!;
|
||||
public string SpriteSet { get; private set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// Default skin tone for this species. This applies for non-human skin tones.
|
||||
/// </summary>
|
||||
[DataField("defaultSkinTone")]
|
||||
public Color DefaultSkinTone { get; } = Color.White;
|
||||
public Color DefaultSkinTone { get; private set; } = Color.White;
|
||||
|
||||
/// <summary>
|
||||
/// Default human skin tone for this species. This applies for human skin tones.
|
||||
/// See <see cref="SkinColor.HumanSkinTone"/> for the valid range of skin tones.
|
||||
/// </summary>
|
||||
[DataField("defaultHumanSkinTone")]
|
||||
public int DefaultHumanSkinTone { get; } = 20;
|
||||
public int DefaultHumanSkinTone { get; private set; } = 20;
|
||||
|
||||
/// <summary>
|
||||
/// The limit of body markings that you can place on this species.
|
||||
/// </summary>
|
||||
[DataField("markingLimits")]
|
||||
public string MarkingPoints { get; } = default!;
|
||||
public string MarkingPoints { get; private set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// Humanoid species variant used by this entity.
|
||||
/// </summary>
|
||||
[DataField("prototype", required: true, customTypeSerializer:typeof(PrototypeIdSerializer<EntityPrototype>))]
|
||||
public string Prototype { get; } = default!;
|
||||
public string Prototype { get; private set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// Prototype used by the species for the dress-up doll in various menus.
|
||||
/// </summary>
|
||||
[DataField("dollPrototype", required: true, customTypeSerializer:typeof(PrototypeIdSerializer<EntityPrototype>))]
|
||||
public string DollPrototype { get; } = default!;
|
||||
public string DollPrototype { get; private set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// Method of skin coloration used by the species.
|
||||
/// </summary>
|
||||
[DataField("skinColoration", required: true)]
|
||||
public HumanoidSkinColor SkinColoration { get; }
|
||||
public HumanoidSkinColor SkinColoration { get; private set; }
|
||||
|
||||
[DataField("maleFirstNames")]
|
||||
public string MaleFirstNames { get; } = "names_first_male";
|
||||
public string MaleFirstNames { get; private set; } = "names_first_male";
|
||||
|
||||
[DataField("femaleFirstNames")]
|
||||
public string FemaleFirstNames { get; } = "names_first_female";
|
||||
public string FemaleFirstNames { get; private set; } = "names_first_female";
|
||||
|
||||
[DataField("lastNames")]
|
||||
public string LastNames { get; } = "names_last";
|
||||
public string LastNames { get; private set; } = "names_last";
|
||||
|
||||
[DataField("naming")]
|
||||
public SpeciesNaming Naming { get; } = SpeciesNaming.FirstLast;
|
||||
public SpeciesNaming Naming { get; private set; } = SpeciesNaming.FirstLast;
|
||||
|
||||
[DataField("sexes")]
|
||||
public List<Sex> Sexes { get; } = new() { Sex.Male, Sex.Female };
|
||||
public List<Sex> Sexes { get; private set; } = new() { Sex.Male, Sex.Female };
|
||||
|
||||
/// <summary>
|
||||
/// Characters younger than this are too young to be hired by Nanotrasen.
|
||||
|
||||
Reference in New Issue
Block a user