Reduce knocked down players tile friction (#11035)

This commit is contained in:
metalgearsloth
2022-09-11 16:49:10 +10:00
committed by GitHub
parent 47dd0ff2e8
commit 12e1a961d6
12 changed files with 80 additions and 124 deletions

View File

@@ -15,75 +15,29 @@ namespace Content.Shared.Slippery
[NetworkedComponent]
public sealed class SlipperyComponent : Component
{
private float _paralyzeTime = 3f;
private float _launchForwardsMultiplier = 1f;
private SoundSpecifier _slipSound = new SoundPathSpecifier("/Audio/Effects/slip.ogg");
/// <summary>
/// Path to the sound to be played when a mob slips.
/// Path to the sound to be played when a mob slips.
/// </summary>
[ViewVariables]
[DataField("slipSound")]
public SoundSpecifier SlipSound
{
get => _slipSound;
set
{
if (value == _slipSound)
return;
_slipSound = value;
Dirty();
}
}
[Access(Other = AccessPermissions.ReadWriteExecute)]
public SoundSpecifier SlipSound = new SoundPathSpecifier("/Audio/Effects/slip.ogg");
/// <summary>
/// How many seconds the mob will be paralyzed for.
/// How many seconds the mob will be paralyzed for.
/// </summary>
[ViewVariables(VVAccess.ReadWrite)]
[DataField("paralyzeTime")]
public float ParalyzeTime
{
get => _paralyzeTime;
set
{
if (MathHelper.CloseToPercent(_paralyzeTime, value)) return;
_paralyzeTime = value;
Dirty();
}
}
[Access(Other = AccessPermissions.ReadWrite)]
public float ParalyzeTime = 3f;
/// <summary>
/// The entity's speed will be multiplied by this to slip it forwards.
/// The entity's speed will be multiplied by this to slip it forwards.
/// </summary>
[ViewVariables(VVAccess.ReadWrite)]
[DataField("launchForwardsMultiplier")]
public float LaunchForwardsMultiplier
{
get => _launchForwardsMultiplier;
set
{
if (MathHelper.CloseToPercent(_launchForwardsMultiplier, value)) return;
_launchForwardsMultiplier = value;
Dirty();
}
}
public override ComponentState GetComponentState()
{
return new SlipperyComponentState(ParalyzeTime, LaunchForwardsMultiplier, SlipSound.GetSound());
}
public override void HandleComponentState(ComponentState? curState, ComponentState? nextState)
{
if (curState is not SlipperyComponentState state) return;
_paralyzeTime = state.ParalyzeTime;
_launchForwardsMultiplier = state.LaunchForwardsMultiplier;
_slipSound = new SoundPathSpecifier(state.SlipSound);
}
[Access(Other = AccessPermissions.ReadWrite)]
public float LaunchForwardsMultiplier = 1f;
}
[Serializable, NetSerializable]