Explosion resistance is now predicted! (#30654)

* First commit

* Added Network and access
This commit is contained in:
beck-thompson
2024-08-04 20:15:07 -07:00
committed by GitHub
parent 84a9253b10
commit 490de1de4e
10 changed files with 53 additions and 30 deletions

View File

@@ -0,0 +1,46 @@
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();
}