Revert "Refactor Damage to use Protoypes (#4262)"
This reverts commit 20bf5739a9.
This commit is contained in:
38
Content.Shared/Damage/DamageClass.cs
Normal file
38
Content.Shared/Damage/DamageClass.cs
Normal file
@@ -0,0 +1,38 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Immutable;
|
||||
using System.Linq;
|
||||
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>() where T : struct
|
||||
{
|
||||
return Enum.GetValues(typeof(DamageClass))
|
||||
.Cast<DamageClass>()
|
||||
.ToDictionary(@class => @class, _ => default(T));
|
||||
}
|
||||
|
||||
public static Dictionary<DamageClass, int> ToNewDictionary()
|
||||
{
|
||||
return ToNewDictionary<int>();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user