Files
tbd-station-14/Content.Shared/Blocking/Components/BlockingComponent.cs
Leon Friedrich 3101e5a18d Fix action-granting items not being predicted (#20778)
* Ensure actions are predicted

* Fix test fail
2023-10-07 15:08:13 -04:00

77 lines
2.6 KiB
C#

using Content.Shared.Damage;
using Robust.Shared.Audio;
using Robust.Shared.GameStates;
using Robust.Shared.Physics.Collision.Shapes;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
namespace Content.Shared.Blocking;
/// <summary>
/// This component goes on an item that you want to use to block
/// </summary>
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
public sealed partial class BlockingComponent : Component
{
/// <summary>
/// The entity that's blocking
/// </summary>
[ViewVariables, AutoNetworkedField]
public EntityUid? User;
/// <summary>
/// Is it currently blocking?
/// </summary>
[ViewVariables, AutoNetworkedField]
public bool IsBlocking;
/// <summary>
/// The ID for the fixture that's dynamically created when blocking
/// </summary>
public const string BlockFixtureID = "blocking-active";
/// <summary>
/// The shape of the blocking fixture that will be dynamically spawned
/// </summary>
[DataField("shape"), ViewVariables(VVAccess.ReadWrite)]
public IPhysShape Shape = new PhysShapeCircle(0.5f);
/// <summary>
/// The damage modifer to use while passively blocking
/// </summary>
[DataField("passiveBlockModifier", required: true)]
public DamageModifierSet PassiveBlockDamageModifer = default!;
/// <summary>
/// The damage modifier to use while actively blocking.
/// </summary>
[DataField("activeBlockModifier", required: true)]
public DamageModifierSet ActiveBlockDamageModifier = default!;
[DataField("blockingToggleAction", customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>))]
public string BlockingToggleAction = "ActionToggleBlock";
[DataField, AutoNetworkedField]
public EntityUid? BlockingToggleActionEntity;
/// <summary>
/// The sound to be played when you get hit while actively blocking
/// </summary>
[DataField("blockSound")]
public SoundSpecifier BlockSound = new SoundPathSpecifier("/Audio/Weapons/block_metal1.ogg");
/// <summary>
/// Fraction of original damage shield will take instead of user
/// when not blocking
/// </summary>
[DataField("passiveBlockFraction"), ViewVariables(VVAccess.ReadWrite)]
public float PassiveBlockFraction = 0.5f;
/// <summary>
/// Fraction of original damage shield will take instead of user
/// when blocking
/// </summary>
[DataField("activeBlockFraction"), ViewVariables(VVAccess.ReadWrite)]
public float ActiveBlockFraction = 1.0f;
}