* Add nullable to some Content.Shared files. * Use [NotNullWhen(true)] * Undo adding now redundant !'s * Forgot one * Add a ton more nullable * You can guess * Fix some issues * It actually compiles now * Auto stash before merge of "null2" and "origin/master" * I lied * enable annotations -> enable * Revert ActionBlockerSystem.cs to original * Fix ActionBlockerSystem.cs * More nullable * Undo some added exclamation marks * Fix issues * Update Content.Shared/Maps/ContentTileDefinition.cs Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> * Resolve some issues * Remove unused method * Fix more issues * Fix more issues * Fix more issues * Fix more issues * Fix issue, rollback SharedGhostComponent.cs * Update submodule * Fix issue, invert some if-statements to reduce nesting * Revert RobustToolbox * FIx things broken by merge * Some fixes - Replaced with string.Empty - Remove some exclamation marks - Revert file * Some fixes * Trivial #nullable enable * Fix null ables Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> Co-authored-by: Metal Gear Sloth <metalgearsloth@gmail.com>
69 lines
2.6 KiB
C#
69 lines
2.6 KiB
C#
#nullable enable
|
|
using System.Collections.Generic;
|
|
using System.Collections.Immutable;
|
|
using Content.Shared.Damage;
|
|
using JetBrains.Annotations;
|
|
using Robust.Shared.GameObjects;
|
|
|
|
namespace Content.Shared.GameObjects.EntitySystems
|
|
{
|
|
[UsedImplicitly]
|
|
public class DamageSystem : EntitySystem
|
|
{
|
|
public static ImmutableDictionary<DamageClass, ImmutableList<DamageType>> ClassToType { get; } = DefaultClassToType();
|
|
|
|
public static ImmutableDictionary<DamageType, DamageClass> TypeToClass { get; } = DefaultTypeToClass();
|
|
|
|
private static ImmutableDictionary<DamageClass, ImmutableList<DamageType>> DefaultClassToType()
|
|
{
|
|
return new Dictionary<DamageClass, ImmutableList<DamageType>>
|
|
{
|
|
[DamageClass.Brute] = new List<DamageType>
|
|
{
|
|
DamageType.Blunt,
|
|
DamageType.Slash,
|
|
DamageType.Piercing
|
|
}.ToImmutableList(),
|
|
[DamageClass.Burn] = new List<DamageType>
|
|
{
|
|
DamageType.Heat,
|
|
DamageType.Shock,
|
|
DamageType.Cold
|
|
}.ToImmutableList(),
|
|
[DamageClass.Toxin] = new List<DamageType>
|
|
{
|
|
DamageType.Poison,
|
|
DamageType.Radiation
|
|
}.ToImmutableList(),
|
|
[DamageClass.Airloss] = new List<DamageType>
|
|
{
|
|
DamageType.Asphyxiation,
|
|
DamageType.Bloodloss
|
|
}.ToImmutableList(),
|
|
[DamageClass.Genetic] = new List<DamageType>
|
|
{
|
|
DamageType.Cellular
|
|
}.ToImmutableList()
|
|
}.ToImmutableDictionary();
|
|
}
|
|
|
|
private static ImmutableDictionary<DamageType, DamageClass> DefaultTypeToClass()
|
|
{
|
|
return new Dictionary<DamageType, DamageClass>
|
|
{
|
|
{DamageType.Blunt, DamageClass.Brute},
|
|
{DamageType.Slash, DamageClass.Brute},
|
|
{DamageType.Piercing, DamageClass.Brute},
|
|
{DamageType.Heat, DamageClass.Burn},
|
|
{DamageType.Shock, DamageClass.Burn},
|
|
{DamageType.Cold, DamageClass.Burn},
|
|
{DamageType.Poison, DamageClass.Toxin},
|
|
{DamageType.Radiation, DamageClass.Toxin},
|
|
{DamageType.Asphyxiation, DamageClass.Airloss},
|
|
{DamageType.Bloodloss, DamageClass.Airloss},
|
|
{DamageType.Cellular, DamageClass.Genetic}
|
|
}.ToImmutableDictionary();
|
|
}
|
|
}
|
|
}
|