6
2025-11-07 12:32:48 +03:00

69 lines
2.3 KiB
C#

using Content.Shared.StepTrigger.Components;
using Robust.Shared.Audio;
using Robust.Shared.GameStates;
using Robust.Shared.Serialization;
namespace Content.Shared.Slippery
{
/// <summary>
/// Causes somebody to slip when they walk over this entity.
/// </summary>
/// <remarks>
/// Requires <see cref="StepTriggerComponent"/>, see that component for some additional properties.
/// </remarks>
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
public sealed partial class SlipperyComponent : Component
{
/// <summary>
/// Path to the sound to be played when a mob slips.
/// </summary>
[DataField, AutoNetworkedField]
[Access(Other = AccessPermissions.ReadWriteExecute)]
public SoundSpecifier SlipSound = new SoundPathSpecifier("/Audio/Effects/slip.ogg");
/// <summary>
/// Loads the data needed to determine how slippery something is.
/// </summary>
[DataField, AutoNetworkedField]
public SlipperyEffectEntry SlipData = new();
}
/// <summary>
/// Stores the data for slipperiness that way reagents and this component can use it.
/// </summary>
[DataDefinition, Serializable, NetSerializable]
public sealed partial class SlipperyEffectEntry
{
/// <summary>
/// How many seconds the mob will be paralyzed for.
/// </summary>
[DataField]
public TimeSpan ParalyzeTime = TimeSpan.FromSeconds(1.5);
/// <summary>
/// The entity's speed will be multiplied by this to slip it forwards.
/// </summary>
[DataField]
public float LaunchForwardsMultiplier = 1.5f;
/// <summary>
/// Minimum speed entity must be moving to slip.
/// </summary>
[DataField]
public float RequiredSlipSpeed = 3.5f;
/// <summary>
/// If this is true, any slipping entity loses its friction until
/// it's not colliding with any SuperSlippery entities anymore.
/// They also will fail any attempts to stand up unless they have no-slips.
/// </summary>
[DataField]
public bool SuperSlippery;
/// <summary>
/// This is used to store the friction modifier that is used on a sliding entity.
/// </summary>
[DataField]
public float SlipFriction;
}
}