From 8b2f28f155b19dfd19c1a42dee5f2bd24cbb5737 Mon Sep 17 00:00:00 2001 From: Pieter-Jan Briers Date: Sat, 23 Jan 2021 19:36:48 +0100 Subject: [PATCH] ReactionPrototype now uses arrays instead of lists internally. Just a tiny optimization. --- Content.Shared/Chemistry/ReactionPrototype.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Content.Shared/Chemistry/ReactionPrototype.cs b/Content.Shared/Chemistry/ReactionPrototype.cs index 7f2f9eb006..57ae9eaf7a 100644 --- a/Content.Shared/Chemistry/ReactionPrototype.cs +++ b/Content.Shared/Chemistry/ReactionPrototype.cs @@ -1,4 +1,5 @@ #nullable enable +using System; using System.Collections.Generic; using Content.Server.Interfaces.Chemistry; using Content.Shared.Interfaces; @@ -20,7 +21,7 @@ namespace Content.Shared.Chemistry private string _name = default!; private Dictionary _reactants = default!; private Dictionary _products = default!; - private List _effects = default!; + private IReactionEffect[] _effects = default!; public string ID => _id; public string Name => _name; @@ -55,11 +56,11 @@ namespace Content.Shared.Chemistry { //TODO: Don't have a check for if this is the server //Some implementations of IReactionEffect can't currently be moved to shared, so this is here to prevent the client from breaking when reading server-only IReactionEffects. - serializer.DataField(ref _effects, "effects", new List()); + serializer.DataField(ref _effects, "effects", Array.Empty()); } else { - _effects = new(); //To ensure _effects isn't null since it is only serializable on the server right snow + _effects = Array.Empty(); //To ensure _effects isn't null since it is only serializable on the server right snow } } }