Files
tbd-station-14/Content.Shared/Explosion/Components/ExplosionResistanceComponent.cs
beck-thompson 490de1de4e Explosion resistance is now predicted! (#30654)
* First commit

* Added Network and access
2024-08-05 13:15:07 +10:00

47 lines
1.8 KiB
C#

using Content.Shared.Explosion.EntitySystems;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.Dictionary;
using Robust.Shared.GameStates;
namespace Content.Shared.Explosion.Components;
/// <summary>
/// Component that provides entities with explosion resistance.
/// By default this is applied when worn, but to solely protect the entity itself and
/// not the wearer use <c>worn: false</c>.
/// </summary>
/// <remarks>
/// This is desirable over just using damage modifier sets, given that equipment like bomb-suits need to
/// significantly reduce the damage, but shouldn't be silly overpowered in regular combat.
/// </remarks>
[NetworkedComponent, RegisterComponent]
[Access(typeof(SharedExplosionSystem))]
public sealed partial class ExplosionResistanceComponent : Component
{
/// <summary>
/// The explosive resistance coefficient, This fraction is multiplied into the total resistance.
/// </summary>
[DataField("damageCoefficient")]
public float DamageCoefficient = 1;
/// <summary>
/// When true, resistances will be applied to the entity wearing this item.
/// When false, only this entity will get th resistance.
/// </summary>
[DataField, ViewVariables(VVAccess.ReadWrite)]
public bool Worn = true;
/// <summary>
/// Examine string for explosion resistance.
/// Passed <c>value</c> from 0 to 100.
/// </summary>
[DataField, ViewVariables(VVAccess.ReadWrite)]
public LocId Examine = "explosion-resistance-coefficient-value";
/// <summary>
/// Modifiers specific to each explosion type for more customizability.
/// </summary>
[ViewVariables(VVAccess.ReadWrite)]
[DataField("modifiers", customTypeSerializer: typeof(PrototypeIdDictionarySerializer<float, ExplosionPrototype>))]
public Dictionary<string, float> Modifiers = new();
}