2022-07-10 02:28:37 -07:00
|
|
|
using Content.Shared.StepTrigger.Components;
|
2022-07-29 14:13:12 +12:00
|
|
|
using Robust.Shared.Audio;
|
2021-07-12 01:32:10 -07:00
|
|
|
using Robust.Shared.GameStates;
|
2020-07-23 01:40:31 +02:00
|
|
|
using Robust.Shared.Serialization;
|
|
|
|
|
|
2021-06-09 22:19:39 +02:00
|
|
|
namespace Content.Shared.Slippery
|
2020-07-23 01:40:31 +02:00
|
|
|
{
|
2022-05-18 06:07:35 +02:00
|
|
|
/// <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>
|
2021-03-15 19:01:15 +01:00
|
|
|
[RegisterComponent]
|
2022-05-18 06:07:35 +02:00
|
|
|
[NetworkedComponent]
|
2021-07-21 22:13:58 +10:00
|
|
|
public sealed class SlipperyComponent : Component
|
2020-07-23 01:40:31 +02:00
|
|
|
{
|
2021-03-15 19:01:15 +01:00
|
|
|
/// <summary>
|
2022-09-11 16:49:10 +10:00
|
|
|
/// Path to the sound to be played when a mob slips.
|
2021-03-15 19:01:15 +01:00
|
|
|
/// </summary>
|
|
|
|
|
[DataField("slipSound")]
|
2022-09-11 16:49:10 +10:00
|
|
|
[Access(Other = AccessPermissions.ReadWriteExecute)]
|
|
|
|
|
public SoundSpecifier SlipSound = new SoundPathSpecifier("/Audio/Effects/slip.ogg");
|
2020-07-23 01:40:31 +02:00
|
|
|
|
|
|
|
|
/// <summary>
|
2022-09-11 16:49:10 +10:00
|
|
|
/// How many seconds the mob will be paralyzed for.
|
2020-07-23 01:40:31 +02:00
|
|
|
/// </summary>
|
|
|
|
|
[ViewVariables(VVAccess.ReadWrite)]
|
2021-03-05 01:08:38 +01:00
|
|
|
[DataField("paralyzeTime")]
|
2022-09-11 16:49:10 +10:00
|
|
|
[Access(Other = AccessPermissions.ReadWrite)]
|
|
|
|
|
public float ParalyzeTime = 3f;
|
2020-07-23 01:40:31 +02:00
|
|
|
|
2020-09-21 17:51:07 +02:00
|
|
|
/// <summary>
|
2022-09-11 16:49:10 +10:00
|
|
|
/// The entity's speed will be multiplied by this to slip it forwards.
|
2020-09-21 17:51:07 +02:00
|
|
|
/// </summary>
|
|
|
|
|
[ViewVariables(VVAccess.ReadWrite)]
|
2021-03-05 01:08:38 +01:00
|
|
|
[DataField("launchForwardsMultiplier")]
|
2022-09-11 16:49:10 +10:00
|
|
|
[Access(Other = AccessPermissions.ReadWrite)]
|
|
|
|
|
public float LaunchForwardsMultiplier = 1f;
|
2020-07-23 01:40:31 +02:00
|
|
|
}
|
2020-09-21 17:51:07 +02:00
|
|
|
|
|
|
|
|
[Serializable, NetSerializable]
|
2022-02-16 00:23:23 -07:00
|
|
|
public sealed class SlipperyComponentState : ComponentState
|
2020-09-21 17:51:07 +02:00
|
|
|
{
|
|
|
|
|
public float ParalyzeTime { get; }
|
|
|
|
|
public float LaunchForwardsMultiplier { get; }
|
2021-03-15 19:01:15 +01:00
|
|
|
public string SlipSound { get; }
|
2020-09-21 17:51:07 +02:00
|
|
|
|
2022-05-18 06:07:35 +02:00
|
|
|
public SlipperyComponentState(float paralyzeTime, float launchForwardsMultiplier, string slipSound)
|
2020-09-21 17:51:07 +02:00
|
|
|
{
|
|
|
|
|
ParalyzeTime = paralyzeTime;
|
|
|
|
|
LaunchForwardsMultiplier = launchForwardsMultiplier;
|
2021-03-15 19:01:15 +01:00
|
|
|
SlipSound = slipSound;
|
2020-09-21 17:51:07 +02:00
|
|
|
}
|
|
|
|
|
}
|
2020-07-23 01:40:31 +02:00
|
|
|
}
|