Fix warnings and code cleanup/fixes (#13570)

This commit is contained in:
Visne
2023-01-19 03:56:45 +01:00
committed by GitHub
parent 3ca5a0224b
commit c6d3e4f3bd
265 changed files with 499 additions and 666 deletions

View File

@@ -20,7 +20,7 @@ namespace Content.Shared.Chemistry.Components
public FixedPoint2 TotalVolume { get; }
public InjectorToggleMode CurrentMode { get; }
public InjectorComponentState(FixedPoint2 currentVolume, FixedPoint2 totalVolume, SharedInjectorComponent.InjectorToggleMode currentMode)
public InjectorComponentState(FixedPoint2 currentVolume, FixedPoint2 totalVolume, InjectorToggleMode currentMode)
{
CurrentVolume = currentVolume;
TotalVolume = totalVolume;

View File

@@ -19,7 +19,7 @@ namespace Content.Shared.Chemistry.Components
public sealed partial class Solution : IEnumerable<Solution.ReagentQuantity>, ISerializationHooks
{
// This is a list because it is actually faster to add and remove reagents from
// a list than a dictionary, though contains-reagent checks are slightly slower,
// a list than a dictionary, though contains-reagent checks are slightly slower,
[DataField("reagents")]
public List<ReagentQuantity> Contents = new(2);
@@ -322,7 +322,7 @@ namespace Content.Shared.Chemistry.Components
RemoveAllSolution();
return;
}
_heatCapacity *= scale;
Volume *= scale;
@@ -498,7 +498,7 @@ namespace Content.Shared.Chemistry.Components
/// <summary>
/// Variant of <see cref="SplitSolution(FixedPoint2)"/> that doesn't return a new solution containing the removed reagents.
/// </summary>
/// <param name="quantity">The quantity of this solution to remove</param>
/// <param name="toTake">The quantity of this solution to remove</param>
public void RemoveSolution(FixedPoint2 toTake)
{
if (toTake <= FixedPoint2.Zero)

View File

@@ -18,7 +18,7 @@ namespace Content.Shared.Chemistry.Dispenser
private List<string> _inventory = new();
[ViewVariables]
[IdDataFieldAttribute]
[IdDataField]
public string ID { get; } = default!;
public List<string> Inventory => _inventory;

View File

@@ -14,7 +14,7 @@ namespace Content.Shared.Chemistry.Reaction
public sealed class ReactionPrototype : IPrototype, IComparable<ReactionPrototype>
{
[ViewVariables]
[IdDataFieldAttribute]
[IdDataField]
public string ID { get; } = default!;
[DataField("name")]
@@ -94,7 +94,7 @@ namespace Content.Shared.Chemistry.Reaction
if (Products.Count != other.Products.Count)
return Products.Count - other.Products.Count;
return ID.CompareTo(other.ID);
return string.Compare(ID, other.ID, StringComparison.Ordinal);
}
}

View File

@@ -5,6 +5,6 @@ namespace Content.Shared.Chemistry.Reaction;
[Prototype("reactiveGroup")]
public sealed class ReactiveGroupPrototype : IPrototype
{
[IdDataFieldAttribute]
[IdDataField]
public string ID { get; } = default!;
}

View File

@@ -247,7 +247,7 @@ namespace Content.Shared.Chemistry.Reaction
// did any reaction occur?
if (products == null)
return false; ;
return false;
// Remove any reactions that were not applicable. Avoids re-iterating over them in future.
reactions.Except(toRemove);

View File

@@ -19,7 +19,7 @@ namespace Content.Shared.Chemistry.Reagent
public sealed class ReagentPrototype : IPrototype, IInheritingPrototype
{
[ViewVariables]
[IdDataFieldAttribute]
[IdDataField]
public string ID { get; } = default!;
[DataField("name", required: true)]