Add prediction for standing states and mob states (#1937)

This commit is contained in:
DrSmugleaf
2020-08-29 13:20:37 +02:00
committed by GitHub
parent 4d23bbf4df
commit 1ecf8aad1a
38 changed files with 1001 additions and 626 deletions

View File

@@ -20,6 +20,7 @@ using Content.Shared.GameObjects.Components.Damage;
using Content.Shared.GameObjects.Components.Movement;
using Robust.Server.Interfaces.Player;
using Robust.Shared.GameObjects;
using Robust.Shared.GameObjects.Systems;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Interfaces.Reflection;
using Robust.Shared.IoC;
@@ -38,7 +39,7 @@ namespace Content.Server.GameObjects.Components.Body
/// </summary>
[RegisterComponent]
[ComponentReference(typeof(IDamageableComponent))]
[ComponentReference(typeof(IBodyManagerComponent))]
[ComponentReference(typeof(ISharedBodyManagerComponent))]
public class BodyManagerComponent : SharedBodyManagerComponent, IBodyPartContainer, IRelayMoveInput
{
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
@@ -289,14 +290,14 @@ namespace Content.Server.GameObjects.Components.Body
if (speedSum <= 0.001f || _activeLegs.Count <= 0)
{
// Case: no way of moving. Fall down.
StandingStateHelper.Down(Owner);
EntitySystem.Get<StandingStateSystem>().Down(Owner);
playerMover.BaseWalkSpeed = 0.8f;
playerMover.BaseSprintSpeed = 2.0f;
}
else
{
// Case: have at least one leg. Set move speed.
StandingStateHelper.Standing(Owner);
EntitySystem.Get<StandingStateSystem>().Standing(Owner);
// Extra legs stack diminishingly.
// Final speed = speed sum/(leg count-log4(leg count))