Improved Slippery prediction, moves Slippery entirely to Shared (#3677)

* Fixes SlipperyComponent mispredict

* a

* Holy shit
This commit is contained in:
Vera Aguilera Puerto
2021-03-15 19:01:15 +01:00
committed by GitHub
parent 666fb9e2af
commit 0c35b78401
6 changed files with 89 additions and 77 deletions

View File

@@ -5,6 +5,7 @@ using System.Threading;
using Content.Server.GameObjects.Components.Chemistry;
using Content.Server.GameObjects.Components.Movement;
using Content.Shared.Chemistry;
using Content.Shared.GameObjects.Components.Movement;
using Content.Shared.GameObjects.EntitySystems;
using Content.Shared.Maps;
using Content.Shared.Physics;

View File

@@ -1,36 +0,0 @@
using Content.Shared.Audio;
using Content.Shared.GameObjects.Components.Movement;
using Robust.Server.GameObjects;
using Robust.Shared.GameObjects;
using Robust.Shared.Players;
using Robust.Shared.Serialization.Manager.Attributes;
using Robust.Shared.ViewVariables;
namespace Content.Server.GameObjects.Components.Movement
{
[RegisterComponent]
[ComponentReference(typeof(SharedSlipperyComponent))]
public class SlipperyComponent : SharedSlipperyComponent
{
/// <summary>
/// Path to the sound to be played when a mob slips.
/// </summary>
[ViewVariables]
[DataField("slipSound")]
public string SlipSound { get; set; } = "/Audio/Effects/slip.ogg";
protected override void OnSlip()
{
if (!string.IsNullOrEmpty(SlipSound))
{
EntitySystem.Get<AudioSystem>()
.PlayFromEntity(SlipSound, Owner, AudioHelpers.WithVariation(0.2f));
}
}
public override ComponentState GetComponentState(ICommonSession player)
{
return new SlipperyComponentState(ParalyzeTime, IntersectPercentage, RequiredSlipSpeed, LaunchForwardsMultiplier, Slippery);
}
}
}