Files
tbd-station-14/Content.Shared/Damage/DamageClass.cs
DrSmugleaf 5909a41028 Move damage class and type mappings to DamageSystem (#2784)
* Move damage class and type mappings to DamageSystem

* Make the properties static again
2020-12-20 04:31:56 +01:00

41 lines
1015 B
C#

using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Linq;
using Content.Shared.GameObjects.EntitySystems;
using Robust.Shared.GameObjects.Systems;
using Robust.Shared.Serialization;
namespace Content.Shared.Damage
{
[Serializable, NetSerializable]
public enum DamageClass
{
Brute,
Burn,
Toxin,
Airloss,
Genetic
}
public static class DamageClassExtensions
{
public static ImmutableList<DamageType> ToTypes(this DamageClass @class)
{
return DamageSystem.ClassToType[@class];
}
public static Dictionary<DamageClass, T> ToNewDictionary<T>()
{
return Enum.GetValues(typeof(DamageClass))
.Cast<DamageClass>()
.ToDictionary(@class => @class, _ => default(T));
}
public static Dictionary<DamageClass, int> ToNewDictionary()
{
return ToNewDictionary<int>();
}
}
}