2022-04-01 15:39:26 +13:00
|
|
|
using Content.Server.Explosion.EntitySystems;
|
|
|
|
|
using Content.Shared.Explosion;
|
|
|
|
|
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.Dictionary;
|
|
|
|
|
|
|
|
|
|
namespace Content.Server.Explosion.Components;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
2023-12-11 09:43:00 +00:00
|
|
|
/// 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>.
|
2022-04-01 15:39:26 +13:00
|
|
|
/// </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>
|
|
|
|
|
[RegisterComponent]
|
2022-06-07 15:26:28 +02:00
|
|
|
[Access(typeof(ExplosionSystem))]
|
2023-08-22 18:14:33 -07:00
|
|
|
public sealed partial class ExplosionResistanceComponent : Component
|
2022-04-01 15:39:26 +13:00
|
|
|
{
|
|
|
|
|
/// <summary>
|
2022-07-06 23:15:20 -04:00
|
|
|
/// The explosive resistance coefficient, This fraction is multiplied into the total resistance.
|
2022-04-01 15:39:26 +13:00
|
|
|
/// </summary>
|
2022-07-06 23:15:20 -04:00
|
|
|
[DataField("damageCoefficient")]
|
|
|
|
|
public float DamageCoefficient = 1;
|
2022-04-01 15:39:26 +13:00
|
|
|
|
2023-12-11 09:43:00 +00:00
|
|
|
/// <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";
|
|
|
|
|
|
2022-04-01 15:39:26 +13:00
|
|
|
/// <summary>
|
2023-05-03 08:23:07 +03:00
|
|
|
/// Modifiers specific to each explosion type for more customizability.
|
2022-04-01 15:39:26 +13:00
|
|
|
/// </summary>
|
|
|
|
|
[ViewVariables(VVAccess.ReadWrite)]
|
2023-05-03 08:23:07 +03:00
|
|
|
[DataField("modifiers", customTypeSerializer: typeof(PrototypeIdDictionarySerializer<float, ExplosionPrototype>))]
|
|
|
|
|
public Dictionary<string, float> Modifiers = new();
|
2022-04-01 15:39:26 +13:00
|
|
|
}
|