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