Use 'new' expression in places where the type is evident for content (#2590)
* Content.Client * Content.Benchmarks * Content.IntegrationTests * Content.Server * Content.Server.Database * Content.Shared * Content.Tests * Merge fixes Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
This commit is contained in:
@@ -13,7 +13,7 @@ namespace Content.Shared.Administration
|
||||
// As you can tell from the boatload of bitwise ops,
|
||||
// writing this class was genuinely fun.
|
||||
|
||||
private static readonly Dictionary<string, AdminFlags> NameFlagsMap = new Dictionary<string, AdminFlags>();
|
||||
private static readonly Dictionary<string, AdminFlags> NameFlagsMap = new();
|
||||
private static readonly string[] FlagsNameMap = new string[32];
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -12,8 +12,8 @@ namespace Content.Shared.Alert
|
||||
[Prototype("alertOrder")]
|
||||
public class AlertOrderPrototype : IPrototype, IComparer<AlertPrototype>
|
||||
{
|
||||
private readonly Dictionary<AlertType, int> _typeToIdx = new Dictionary<AlertType, int>();
|
||||
private readonly Dictionary<AlertCategory, int> _categoryToIdx = new Dictionary<AlertCategory, int>();
|
||||
private readonly Dictionary<AlertType, int> _typeToIdx = new();
|
||||
private readonly Dictionary<AlertCategory, int> _categoryToIdx = new();
|
||||
|
||||
public void LoadFrom(YamlMappingNode mapping)
|
||||
{
|
||||
|
||||
@@ -183,7 +183,7 @@ namespace Content.Shared.Alert
|
||||
/// <returns>An alert key for the provided alert category</returns>
|
||||
public static AlertKey ForCategory(AlertCategory category)
|
||||
{
|
||||
return new AlertKey(null, category);
|
||||
return new(null, category);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,21 +32,21 @@ namespace Content.Shared.Arcade
|
||||
public static class BlockGameVector2Extensions{
|
||||
public static BlockGameBlock ToBlockGameBlock(this Vector2i vector2, BlockGameBlock.BlockGameBlockColor gameBlockColor)
|
||||
{
|
||||
return new BlockGameBlock(vector2, gameBlockColor);
|
||||
return new(vector2, gameBlockColor);
|
||||
}
|
||||
|
||||
public static Vector2i AddToX(this Vector2i vector2, int amount)
|
||||
{
|
||||
return new Vector2i(vector2.X + amount, vector2.Y);
|
||||
return new(vector2.X + amount, vector2.Y);
|
||||
}
|
||||
public static Vector2i AddToY(this Vector2i vector2, int amount)
|
||||
{
|
||||
return new Vector2i(vector2.X, vector2.Y + amount);
|
||||
return new(vector2.X, vector2.Y + amount);
|
||||
}
|
||||
|
||||
public static Vector2i Rotate90DegreesAsOffset(this Vector2i vector)
|
||||
{
|
||||
return new Vector2i(-vector.Y, vector.X);
|
||||
return new(-vector.Y, vector.X);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -11,9 +11,9 @@ namespace Content.Shared.Chemistry
|
||||
private int _value;
|
||||
private static readonly int Shift = 2;
|
||||
|
||||
public static ReagentUnit MaxValue { get; } = new ReagentUnit(int.MaxValue);
|
||||
public static ReagentUnit Epsilon { get; } = new ReagentUnit(1);
|
||||
public static ReagentUnit Zero { get; } = new ReagentUnit(0);
|
||||
public static ReagentUnit MaxValue { get; } = new(int.MaxValue);
|
||||
public static ReagentUnit Epsilon { get; } = new(1);
|
||||
public static ReagentUnit Zero { get; } = new(0);
|
||||
|
||||
private double ShiftDown()
|
||||
{
|
||||
@@ -27,12 +27,12 @@ namespace Content.Shared.Chemistry
|
||||
|
||||
public static ReagentUnit New(int value)
|
||||
{
|
||||
return new ReagentUnit(value * (int) Math.Pow(10, Shift));
|
||||
return new(value * (int) Math.Pow(10, Shift));
|
||||
}
|
||||
|
||||
public static ReagentUnit New(float value)
|
||||
{
|
||||
return new ReagentUnit(FromFloat(value));
|
||||
return new(FromFloat(value));
|
||||
}
|
||||
|
||||
private static int FromFloat(float value)
|
||||
@@ -42,7 +42,7 @@ namespace Content.Shared.Chemistry
|
||||
|
||||
public static ReagentUnit New(double value)
|
||||
{
|
||||
return new ReagentUnit((int) Math.Round(value * Math.Pow(10, Shift), MidpointRounding.AwayFromZero));
|
||||
return new((int) Math.Round(value * Math.Pow(10, Shift), MidpointRounding.AwayFromZero));
|
||||
}
|
||||
|
||||
public static ReagentUnit New(string value)
|
||||
@@ -57,10 +57,10 @@ namespace Content.Shared.Chemistry
|
||||
|
||||
public static ReagentUnit operator +(ReagentUnit a) => a;
|
||||
|
||||
public static ReagentUnit operator -(ReagentUnit a) => new ReagentUnit(-a._value);
|
||||
public static ReagentUnit operator -(ReagentUnit a) => new(-a._value);
|
||||
|
||||
public static ReagentUnit operator +(ReagentUnit a, ReagentUnit b)
|
||||
=> new ReagentUnit(a._value + b._value);
|
||||
=> new(a._value + b._value);
|
||||
|
||||
public static ReagentUnit operator -(ReagentUnit a, ReagentUnit b)
|
||||
=> a + -b;
|
||||
@@ -86,7 +86,7 @@ namespace Content.Shared.Chemistry
|
||||
|
||||
public static ReagentUnit operator *(ReagentUnit a, int b)
|
||||
{
|
||||
return new ReagentUnit(a._value * b);
|
||||
return new(a._value * b);
|
||||
}
|
||||
|
||||
public static ReagentUnit operator /(ReagentUnit a, ReagentUnit b)
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace Content.Shared.Chemistry
|
||||
{
|
||||
// Most objects on the station hold only 1 or 2 reagents
|
||||
[ViewVariables]
|
||||
private List<ReagentQuantity> _contents = new List<ReagentQuantity>(2);
|
||||
private List<ReagentQuantity> _contents = new(2);
|
||||
|
||||
public IReadOnlyList<ReagentQuantity> Contents => _contents;
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace Content.Shared.Construction
|
||||
[Serializable]
|
||||
public class ConstructionGraphEdge : IExposeData
|
||||
{
|
||||
private List<ConstructionGraphStep> _steps = new List<ConstructionGraphStep>();
|
||||
private List<ConstructionGraphStep> _steps = new();
|
||||
private List<IEdgeCondition> _conditions;
|
||||
private List<IGraphAction> _completed;
|
||||
|
||||
|
||||
@@ -13,8 +13,8 @@ namespace Content.Shared.Construction
|
||||
[Serializable]
|
||||
public class ConstructionGraphNode
|
||||
{
|
||||
private List<IGraphAction> _actions = new List<IGraphAction>();
|
||||
private List<ConstructionGraphEdge> _edges = new List<ConstructionGraphEdge>();
|
||||
private List<IGraphAction> _actions = new();
|
||||
private List<ConstructionGraphEdge> _edges = new();
|
||||
|
||||
[ViewVariables]
|
||||
public string Name { get; private set; }
|
||||
|
||||
@@ -12,9 +12,9 @@ namespace Content.Shared.Construction
|
||||
[Prototype("constructionGraph")]
|
||||
public class ConstructionGraphPrototype : IPrototype, IIndexedPrototype
|
||||
{
|
||||
private readonly Dictionary<string, ConstructionGraphNode> _nodes = new Dictionary<string, ConstructionGraphNode>();
|
||||
private readonly Dictionary<ValueTuple<string, string>, ConstructionGraphNode[]> _paths = new Dictionary<ValueTuple<string, string>, ConstructionGraphNode[]>();
|
||||
private Dictionary<ConstructionGraphNode, ConstructionGraphNode> _pathfinding = new Dictionary<ConstructionGraphNode, ConstructionGraphNode>();
|
||||
private readonly Dictionary<string, ConstructionGraphNode> _nodes = new();
|
||||
private readonly Dictionary<ValueTuple<string, string>, ConstructionGraphNode[]> _paths = new();
|
||||
private Dictionary<ConstructionGraphNode, ConstructionGraphNode> _pathfinding = new();
|
||||
|
||||
[ViewVariables]
|
||||
public string ID { get; private set; }
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace Content.Shared.Construction
|
||||
{
|
||||
public class NestedConstructionGraphStep : ConstructionGraphStep
|
||||
{
|
||||
public List<List<ConstructionGraphStep>> Steps { get; private set; } = new List<List<ConstructionGraphStep>>();
|
||||
public List<List<ConstructionGraphStep>> Steps { get; private set; } = new();
|
||||
|
||||
public void LoadFrom(YamlMappingNode mapping)
|
||||
{
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace Content.Shared.Damage.ResistanceSet
|
||||
{
|
||||
[ViewVariables]
|
||||
private Dictionary<DamageType, ResistanceSetSettings> _resistances =
|
||||
new Dictionary<DamageType, ResistanceSetSettings>();
|
||||
new();
|
||||
|
||||
public ResistanceSet()
|
||||
{
|
||||
|
||||
@@ -18,12 +18,12 @@ namespace Content.Shared.GameObjects.Components.Body.Mechanism
|
||||
{
|
||||
public override string Name => "Mechanism";
|
||||
|
||||
protected readonly Dictionary<int, object> OptionsCache = new Dictionary<int, object>();
|
||||
protected readonly Dictionary<int, object> OptionsCache = new();
|
||||
protected IBody? BodyCache;
|
||||
protected int IdHash;
|
||||
protected IEntity? PerformerCache;
|
||||
private IBodyPart? _part;
|
||||
private readonly Dictionary<Type, IMechanismBehavior> _behaviors = new Dictionary<Type, IMechanismBehavior>();
|
||||
private readonly Dictionary<Type, IMechanismBehavior> _behaviors = new();
|
||||
|
||||
public IBody? Body => Part?.Body;
|
||||
|
||||
|
||||
@@ -23,11 +23,11 @@ namespace Content.Shared.GameObjects.Components.Body.Part
|
||||
private IBody? _body;
|
||||
|
||||
// TODO BODY Remove
|
||||
private List<string> _mechanismIds = new List<string>();
|
||||
private List<string> _mechanismIds = new();
|
||||
public IReadOnlyList<string> MechanismIds => _mechanismIds;
|
||||
|
||||
[ViewVariables]
|
||||
private readonly HashSet<IMechanism> _mechanisms = new HashSet<IMechanism>();
|
||||
private readonly HashSet<IMechanism> _mechanisms = new();
|
||||
|
||||
[ViewVariables]
|
||||
public IBody? Body
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace Content.Shared.GameObjects.Components.Body.Preset
|
||||
|
||||
[ViewVariables] public string Name => _name;
|
||||
|
||||
[ViewVariables] public Dictionary<string, string> PartIDs => new Dictionary<string, string>(_partIDs);
|
||||
[ViewVariables] public Dictionary<string, string> PartIDs => new(_partIDs);
|
||||
|
||||
public virtual void LoadFrom(YamlMappingNode mapping)
|
||||
{
|
||||
|
||||
@@ -32,19 +32,19 @@ namespace Content.Shared.GameObjects.Components.Body
|
||||
|
||||
private string? _centerSlot;
|
||||
|
||||
private Dictionary<string, string> _partIds = new Dictionary<string, string>();
|
||||
private Dictionary<string, string> _partIds = new();
|
||||
|
||||
private readonly Dictionary<string, IBodyPart> _parts = new Dictionary<string, IBodyPart>();
|
||||
private readonly Dictionary<string, IBodyPart> _parts = new();
|
||||
|
||||
[ViewVariables] public string? TemplateName { get; private set; }
|
||||
|
||||
[ViewVariables] public string? PresetName { get; private set; }
|
||||
|
||||
[ViewVariables]
|
||||
public Dictionary<string, BodyPartType> Slots { get; private set; } = new Dictionary<string, BodyPartType>();
|
||||
public Dictionary<string, BodyPartType> Slots { get; private set; } = new();
|
||||
|
||||
[ViewVariables]
|
||||
public Dictionary<string, List<string>> Connections { get; private set; } = new Dictionary<string, List<string>>();
|
||||
public Dictionary<string, List<string>> Connections { get; private set; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// Maps slots to the part filling each one.
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace Content.Shared.GameObjects.Components.Body.Surgery
|
||||
{
|
||||
public override string Name => "BiologicalSurgeryData";
|
||||
|
||||
private readonly List<IMechanism> _disconnectedOrgans = new List<IMechanism>();
|
||||
private readonly List<IMechanism> _disconnectedOrgans = new();
|
||||
|
||||
private bool _skinOpened;
|
||||
private bool _skinRetracted;
|
||||
|
||||
@@ -30,15 +30,15 @@ namespace Content.Shared.GameObjects.Components.Body.Template
|
||||
|
||||
[ViewVariables] public string CenterSlot => _centerSlot;
|
||||
|
||||
[ViewVariables] public Dictionary<string, BodyPartType> Slots => new Dictionary<string, BodyPartType>(_slots);
|
||||
[ViewVariables] public Dictionary<string, BodyPartType> Slots => new(_slots);
|
||||
|
||||
[ViewVariables]
|
||||
public Dictionary<string, List<string>> Connections =>
|
||||
_connections.ToDictionary(x => x.Key, x => x.Value.ToList());
|
||||
|
||||
[ViewVariables] public Dictionary<string, string> Layers => new Dictionary<string, string>(_layers);
|
||||
[ViewVariables] public Dictionary<string, string> Layers => new(_layers);
|
||||
|
||||
[ViewVariables] public Dictionary<string, string> MechanismLayers => new Dictionary<string, string>(_mechanismLayers);
|
||||
[ViewVariables] public Dictionary<string, string> MechanismLayers => new(_mechanismLayers);
|
||||
|
||||
public virtual void LoadFrom(YamlMappingNode mapping)
|
||||
{
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace Content.Shared.GameObjects.Components.Cargo
|
||||
public sealed override string Name => "GalacticMarket";
|
||||
public sealed override uint? NetID => ContentNetIDs.GALACTIC_MARKET;
|
||||
|
||||
protected List<CargoProductPrototype> _products = new List<CargoProductPrototype>();
|
||||
protected List<CargoProductPrototype> _products = new();
|
||||
|
||||
/// <summary>
|
||||
/// A read-only list of products.
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace Content.Shared.GameObjects.Components.Chemistry.ReagentDispenser
|
||||
/// <summary>
|
||||
/// A list of reagents which this may dispense. Defined in yaml prototype, see <see cref="ReagentDispenserInventoryPrototype"/>.
|
||||
/// </summary>
|
||||
protected readonly List<ReagentDispenserInventoryEntry> Inventory = new List<ReagentDispenserInventoryEntry>();
|
||||
protected readonly List<ReagentDispenserInventoryEntry> Inventory = new();
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
public class ReagentDispenserBoundUserInterfaceState : BoundUserInterfaceState
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace Content.Shared.GameObjects.Components.Chemistry
|
||||
/// <inheritdoc />
|
||||
public sealed override uint? NetID => ContentNetIDs.SOLUTION;
|
||||
|
||||
private Solution _solution = new Solution();
|
||||
private Solution _solution = new();
|
||||
private ReagentUnit _maxVolume;
|
||||
private Color _substanceColor;
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace Content.Shared.GameObjects.Components.Damage
|
||||
|
||||
[ViewVariables] private DamageContainer Damage { get; set; } = default!;
|
||||
|
||||
public Dictionary<DamageState, int> Thresholds { get; set; } = new Dictionary<DamageState, int>();
|
||||
public Dictionary<DamageState, int> Thresholds { get; set; } = new();
|
||||
|
||||
public virtual List<DamageState> SupportedDamageStates
|
||||
{
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace Content.Shared.GameObjects.Components.Disposal
|
||||
{
|
||||
public override string Name => "DisposalRouter";
|
||||
|
||||
public static readonly Regex TagRegex = new Regex("^[a-zA-Z0-9, ]*$", RegexOptions.Compiled);
|
||||
public static readonly Regex TagRegex = new("^[a-zA-Z0-9, ]*$", RegexOptions.Compiled);
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
public class DisposalRouterUserInterfaceState : BoundUserInterfaceState
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace Content.Shared.GameObjects.Components.Disposal
|
||||
{
|
||||
public override string Name => "DisposalTagger";
|
||||
|
||||
public static readonly Regex TagRegex = new Regex("^[a-zA-Z0-9 ]*$", RegexOptions.Compiled);
|
||||
public static readonly Regex TagRegex = new("^[a-zA-Z0-9 ]*$", RegexOptions.Compiled);
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
public class DisposalTaggerUserInterfaceState : BoundUserInterfaceState
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace Content.Shared.GameObjects.Components.Disposal
|
||||
{
|
||||
public override string Name => "DisposalUnit";
|
||||
|
||||
private readonly List<IEntity> _intersecting = new List<IEntity>();
|
||||
private readonly List<IEntity> _intersecting = new();
|
||||
|
||||
[ViewVariables]
|
||||
public bool Anchored =>
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace Content.Shared.GameObjects.Components.Inventory
|
||||
{
|
||||
public override string InterfaceControllerTypeName => "HumanInventoryInterfaceController";
|
||||
|
||||
private static readonly Dictionary<Slots, int> _slotDrawingOrder = new Dictionary<Slots, int>
|
||||
private static readonly Dictionary<Slots, int> _slotDrawingOrder = new()
|
||||
{
|
||||
{Slots.POCKET1, 13},
|
||||
{Slots.POCKET2, 12},
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace Content.Shared.GameObjects.Components.Mobs
|
||||
public override uint? NetID => ContentNetIDs.ALERTS;
|
||||
|
||||
[ViewVariables]
|
||||
private Dictionary<AlertKey, ClickableAlertState> _alerts = new Dictionary<AlertKey, ClickableAlertState>();
|
||||
private Dictionary<AlertKey, ClickableAlertState> _alerts = new();
|
||||
|
||||
/// <returns>true iff an alert of the indicated alert category is currently showing</returns>
|
||||
public bool IsShowingAlertCategory(AlertCategory alertCategory)
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace Content.Shared.GameObjects.Components.Mobs
|
||||
public string ID { get; }
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public List<OverlayParameter> Parameters { get; } = new List<OverlayParameter>();
|
||||
public List<OverlayParameter> Parameters { get; } = new();
|
||||
|
||||
public OverlayContainer([NotNull] string id)
|
||||
{
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace Content.Shared.GameObjects.Components.Mobs
|
||||
|
||||
private string _stunAlertId;
|
||||
|
||||
protected CancellationTokenSource StatusRemoveCancellation = new CancellationTokenSource();
|
||||
protected CancellationTokenSource StatusRemoveCancellation = new();
|
||||
|
||||
[ViewVariables] protected float WalkModifierOverride = 0f;
|
||||
[ViewVariables] protected float RunModifierOverride = 0f;
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace Content.Shared.GameObjects.Components.Movement
|
||||
/// The list of entities that have been slipped by this component,
|
||||
/// and which have not stopped colliding with its owner yet.
|
||||
/// </summary>
|
||||
protected readonly List<EntityUid> _slipped = new List<EntityUid>();
|
||||
protected readonly List<EntityUid> _slipped = new();
|
||||
|
||||
/// <summary>
|
||||
/// How many seconds the mob will be paralyzed for.
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace Content.Shared.GameObjects.Components.Research
|
||||
public override string Name => "LatheDatabase";
|
||||
public override uint? NetID => ContentNetIDs.LATHE_DATABASE;
|
||||
|
||||
private readonly List<LatheRecipePrototype> _recipes = new List<LatheRecipePrototype>();
|
||||
private readonly List<LatheRecipePrototype> _recipes = new();
|
||||
|
||||
/// <summary>
|
||||
/// Removes all recipes from the database if it's not static.
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace Content.Shared.GameObjects.Components.Research
|
||||
public override string Name => "ProtolatheDatabase";
|
||||
public sealed override uint? NetID => ContentNetIDs.PROTOLATHE_DATABASE;
|
||||
|
||||
private readonly List<LatheRecipePrototype> _protolatheRecipes = new List<LatheRecipePrototype>();
|
||||
private readonly List<LatheRecipePrototype> _protolatheRecipes = new();
|
||||
|
||||
/// <summary>
|
||||
/// A full list of recipes this protolathe can print.
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace Content.Shared.GameObjects.Components.Research
|
||||
public override string Name => "TechnologyDatabase";
|
||||
public override uint? NetID => ContentNetIDs.TECHNOLOGY_DATABASE;
|
||||
|
||||
protected List<TechnologyPrototype> _technologies = new List<TechnologyPrototype>();
|
||||
protected List<TechnologyPrototype> _technologies = new();
|
||||
|
||||
/// <summary>
|
||||
/// A read-only list of unlocked technologies.
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace Content.Shared.GameObjects.Components.VendingMachines
|
||||
public override uint? NetID => ContentNetIDs.VENDING_MACHINE;
|
||||
|
||||
[ViewVariables]
|
||||
public List<VendingMachineInventoryEntry> Inventory = new List<VendingMachineInventoryEntry>();
|
||||
public List<VendingMachineInventoryEntry> Inventory = new();
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
public enum VendingMachineVisuals
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace Content.Shared.GameObjects.EntitySystems.Atmos
|
||||
|
||||
public static Vector2i GetGasChunkIndices(Vector2i indices)
|
||||
{
|
||||
return new Vector2i((int) Math.Floor((float) indices.X / ChunkSize) * ChunkSize, (int) MathF.Floor((float) indices.Y / ChunkSize) * ChunkSize);
|
||||
return new((int) Math.Floor((float) indices.X / ChunkSize) * ChunkSize, (int) MathF.Floor((float) indices.Y / ChunkSize) * ChunkSize);
|
||||
}
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace Content.Shared.GameObjects.EntitySystems
|
||||
/// A mapping of pullers to the entity that they are pulling.
|
||||
/// </summary>
|
||||
private readonly Dictionary<IEntity, IEntity> _pullers =
|
||||
new Dictionary<IEntity, IEntity>();
|
||||
new();
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace Content.Shared.GameObjects.Verbs
|
||||
|
||||
public static implicit operator VerbCategoryData((string name, string icon) tuple)
|
||||
{
|
||||
return new VerbCategoryData(tuple.name, tuple.icon == null ? null : new SpriteSpecifier.Texture(new ResourcePath(tuple.icon)));
|
||||
return new(tuple.name, tuple.icon == null ? null : new SpriteSpecifier.Texture(new ResourcePath(tuple.icon)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace Content.Shared.Preferences.Appearance
|
||||
public const string DefaultHairStyle = "Bald";
|
||||
public const string DefaultFacialHairStyle = "Shaved";
|
||||
|
||||
public static readonly Dictionary<string, string> HairStylesMap = new Dictionary<string, string>
|
||||
public static readonly Dictionary<string, string> HairStylesMap = new()
|
||||
{
|
||||
{"Afro", "afro"},
|
||||
{"Afro 2", "afro2"},
|
||||
@@ -190,7 +190,7 @@ namespace Content.Shared.Preferences.Appearance
|
||||
{"Wisp", "wisp"},
|
||||
};
|
||||
|
||||
public static readonly Dictionary<string, string> FacialHairStylesMap = new Dictionary<string, string>()
|
||||
public static readonly Dictionary<string, string> FacialHairStylesMap = new()
|
||||
{
|
||||
{"Beard (Abraham Lincoln)", "abe"},
|
||||
{"Beard (Broken Man)", "brokenman"},
|
||||
|
||||
@@ -36,38 +36,37 @@ namespace Content.Shared.Preferences
|
||||
|
||||
public HumanoidCharacterAppearance WithHairStyleName(string newName)
|
||||
{
|
||||
return new HumanoidCharacterAppearance(newName, HairColor, FacialHairStyleName, FacialHairColor, EyeColor, SkinColor);
|
||||
return new(newName, HairColor, FacialHairStyleName, FacialHairColor, EyeColor, SkinColor);
|
||||
}
|
||||
|
||||
public HumanoidCharacterAppearance WithHairColor(Color newColor)
|
||||
{
|
||||
return new HumanoidCharacterAppearance(HairStyleName, newColor, FacialHairStyleName, FacialHairColor, EyeColor, SkinColor);
|
||||
return new(HairStyleName, newColor, FacialHairStyleName, FacialHairColor, EyeColor, SkinColor);
|
||||
}
|
||||
|
||||
public HumanoidCharacterAppearance WithFacialHairStyleName(string newName)
|
||||
{
|
||||
return new HumanoidCharacterAppearance(HairStyleName, HairColor, newName, FacialHairColor, EyeColor, SkinColor);
|
||||
return new(HairStyleName, HairColor, newName, FacialHairColor, EyeColor, SkinColor);
|
||||
}
|
||||
|
||||
public HumanoidCharacterAppearance WithFacialHairColor(Color newColor)
|
||||
{
|
||||
return new HumanoidCharacterAppearance(HairStyleName, HairColor, FacialHairStyleName, newColor, EyeColor, SkinColor);
|
||||
return new(HairStyleName, HairColor, FacialHairStyleName, newColor, EyeColor, SkinColor);
|
||||
}
|
||||
|
||||
public HumanoidCharacterAppearance WithEyeColor(Color newColor)
|
||||
{
|
||||
return new HumanoidCharacterAppearance(HairStyleName, HairColor, FacialHairStyleName, FacialHairColor, newColor, SkinColor);
|
||||
return new(HairStyleName, HairColor, FacialHairStyleName, FacialHairColor, newColor, SkinColor);
|
||||
}
|
||||
|
||||
public HumanoidCharacterAppearance WithSkinColor(Color newColor)
|
||||
{
|
||||
return new HumanoidCharacterAppearance(HairStyleName, HairColor, FacialHairStyleName, FacialHairColor, EyeColor, newColor);
|
||||
return new(HairStyleName, HairColor, FacialHairStyleName, FacialHairColor, EyeColor, newColor);
|
||||
}
|
||||
|
||||
public static HumanoidCharacterAppearance Default()
|
||||
{
|
||||
return new HumanoidCharacterAppearance
|
||||
(
|
||||
return new(
|
||||
"Bald",
|
||||
Color.Black,
|
||||
"Shaved",
|
||||
@@ -104,7 +103,7 @@ namespace Content.Shared.Preferences
|
||||
|
||||
public static Color ClampColor(Color color)
|
||||
{
|
||||
return new Color(color.RByte, color.GByte, color.BByte);
|
||||
return new(color.RByte, color.GByte, color.BByte);
|
||||
}
|
||||
|
||||
public static HumanoidCharacterAppearance EnsureValid(HumanoidCharacterAppearance appearance)
|
||||
|
||||
@@ -88,27 +88,27 @@ namespace Content.Shared.Preferences
|
||||
|
||||
public HumanoidCharacterProfile WithName(string name)
|
||||
{
|
||||
return new HumanoidCharacterProfile(name, Age, Sex, Appearance, _jobPriorities, PreferenceUnavailable, _antagPreferences);
|
||||
return new(name, Age, Sex, Appearance, _jobPriorities, PreferenceUnavailable, _antagPreferences);
|
||||
}
|
||||
|
||||
public HumanoidCharacterProfile WithAge(int age)
|
||||
{
|
||||
return new HumanoidCharacterProfile(Name, Math.Clamp(age, MinimumAge, MaximumAge), Sex, Appearance, _jobPriorities, PreferenceUnavailable, _antagPreferences);
|
||||
return new(Name, Math.Clamp(age, MinimumAge, MaximumAge), Sex, Appearance, _jobPriorities, PreferenceUnavailable, _antagPreferences);
|
||||
}
|
||||
|
||||
public HumanoidCharacterProfile WithSex(Sex sex)
|
||||
{
|
||||
return new HumanoidCharacterProfile(Name, Age, sex, Appearance, _jobPriorities, PreferenceUnavailable, _antagPreferences);
|
||||
return new(Name, Age, sex, Appearance, _jobPriorities, PreferenceUnavailable, _antagPreferences);
|
||||
}
|
||||
|
||||
public HumanoidCharacterProfile WithCharacterAppearance(HumanoidCharacterAppearance appearance)
|
||||
{
|
||||
return new HumanoidCharacterProfile(Name, Age, Sex, appearance, _jobPriorities, PreferenceUnavailable, _antagPreferences);
|
||||
return new(Name, Age, Sex, appearance, _jobPriorities, PreferenceUnavailable, _antagPreferences);
|
||||
}
|
||||
|
||||
public HumanoidCharacterProfile WithJobPriorities(IReadOnlyDictionary<string, JobPriority> jobPriorities)
|
||||
{
|
||||
return new HumanoidCharacterProfile(
|
||||
return new(
|
||||
Name,
|
||||
Age,
|
||||
Sex,
|
||||
@@ -135,12 +135,12 @@ namespace Content.Shared.Preferences
|
||||
|
||||
public HumanoidCharacterProfile WithPreferenceUnavailable(PreferenceUnavailableMode mode)
|
||||
{
|
||||
return new HumanoidCharacterProfile(Name, Age, Sex, Appearance, _jobPriorities, mode, _antagPreferences);
|
||||
return new(Name, Age, Sex, Appearance, _jobPriorities, mode, _antagPreferences);
|
||||
}
|
||||
|
||||
public HumanoidCharacterProfile WithAntagPreferences(IReadOnlyList<string> antagPreferences)
|
||||
{
|
||||
return new HumanoidCharacterProfile(
|
||||
return new(
|
||||
Name,
|
||||
Age,
|
||||
Sex,
|
||||
|
||||
@@ -10,12 +10,12 @@ namespace Content.Shared.Utility
|
||||
{
|
||||
public static EntityCoordinates ToCoordinates(this EntityUid id, Vector2 offset)
|
||||
{
|
||||
return new EntityCoordinates(id, offset);
|
||||
return new(id, offset);
|
||||
}
|
||||
|
||||
public static EntityCoordinates ToCoordinates(this EntityUid id, float x, float y)
|
||||
{
|
||||
return new EntityCoordinates(id, x, y);
|
||||
return new(id, x, y);
|
||||
}
|
||||
|
||||
public static EntityCoordinates ToCoordinates(this EntityUid id)
|
||||
@@ -30,7 +30,7 @@ namespace Content.Shared.Utility
|
||||
|
||||
public static EntityCoordinates ToCoordinates(this IEntity entity, float x, float y)
|
||||
{
|
||||
return new EntityCoordinates(entity.Uid, x, y);
|
||||
return new(entity.Uid, x, y);
|
||||
}
|
||||
|
||||
public static EntityCoordinates ToCoordinates(this IEntity entity)
|
||||
|
||||
Reference in New Issue
Block a user