* WIP changes * Fix tests, merge conflict and trigger once behavior * Update yml * Change test strings to be consts * Fix total damage types and classes triggers * Simplify damage trigger logic, move state to Threshold * Update outdated code and docs * Change the name of IBehavior back to IThresholdBehavior * Change human gibbing to trigger at 400 brute damage * Change gibbing from brute to blunt damage * Fix one (1) typo * Add damage class trigger test * Add missing nullable enable to thresholds
40 lines
974 B
C#
40 lines
974 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Collections.Immutable;
|
|
using System.Linq;
|
|
using Content.Shared.GameObjects.EntitySystems;
|
|
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>();
|
|
}
|
|
}
|
|
}
|