Add slipping prediction (#1440)
This commit is contained in:
@@ -1,29 +1,26 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Content.Client.UserInterface;
|
||||
using Content.Client.Utility;
|
||||
using Content.Shared.GameObjects.Components.Mobs;
|
||||
using Content.Shared.Input;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Client.Interfaces.ResourceManagement;
|
||||
using Robust.Client.Interfaces.UserInterface;
|
||||
using Robust.Client.Player;
|
||||
using Robust.Client.UserInterface;
|
||||
using Robust.Client.UserInterface.Controls;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Input;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.Interfaces.Network;
|
||||
using Robust.Shared.Interfaces.Timing;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Log;
|
||||
using Robust.Shared.Maths;
|
||||
using Robust.Shared.Players;
|
||||
|
||||
namespace Content.Client.GameObjects.Components.Mobs
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
[RegisterComponent]
|
||||
[ComponentReference(typeof(SharedStatusEffectsComponent))]
|
||||
public sealed class ClientStatusEffectsComponent : SharedStatusEffectsComponent
|
||||
{
|
||||
#pragma warning disable 649
|
||||
@@ -65,7 +62,12 @@ namespace Content.Client.GameObjects.Components.Mobs
|
||||
public override void HandleComponentState(ComponentState curState, ComponentState nextState)
|
||||
{
|
||||
base.HandleComponentState(curState, nextState);
|
||||
if (!(curState is StatusEffectComponentState state) || _status == state.StatusEffects) return;
|
||||
|
||||
if (!(curState is StatusEffectComponentState state) || _status == state.StatusEffects)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_status = state.StatusEffects;
|
||||
UpdateStatusEffects();
|
||||
}
|
||||
@@ -154,5 +156,16 @@ namespace Content.Client.GameObjects.Components.Mobs
|
||||
cooldownGraphic.Visible = ratio > -1f;
|
||||
}
|
||||
}
|
||||
|
||||
public override void ChangeStatusEffect(StatusEffect effect, string icon, (TimeSpan, TimeSpan)? cooldown)
|
||||
{
|
||||
_status[effect] = new StatusEffectStatus()
|
||||
{
|
||||
Icon = icon,
|
||||
Cooldown = cooldown
|
||||
};
|
||||
|
||||
Dirty();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
#nullable enable
|
||||
using Content.Shared.Audio;
|
||||
using Content.Shared.GameObjects.Components.Mobs;
|
||||
using Content.Shared.GameObjects.Components.Movement;
|
||||
using Robust.Client.GameObjects.EntitySystems;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.GameObjects.Systems;
|
||||
|
||||
namespace Content.Client.GameObjects.Components.Mobs
|
||||
{
|
||||
@@ -9,13 +12,11 @@ namespace Content.Client.GameObjects.Components.Mobs
|
||||
[ComponentReference(typeof(SharedStunnableComponent))]
|
||||
public class StunnableComponent : SharedStunnableComponent
|
||||
{
|
||||
private bool _stunned;
|
||||
private bool _knockedDown;
|
||||
private bool _slowedDown;
|
||||
|
||||
public override bool Stunned => _stunned;
|
||||
public override bool KnockedDown => _knockedDown;
|
||||
public override bool SlowedDown => _slowedDown;
|
||||
protected override void OnInteractHand()
|
||||
{
|
||||
EntitySystem.Get<AudioSystem>()
|
||||
.Play("/Audio/Effects/thudswoosh.ogg", Owner, AudioHelpers.WithVariation(0.25f));
|
||||
}
|
||||
|
||||
public override void HandleComponentState(ComponentState? curState, ComponentState? nextState)
|
||||
{
|
||||
@@ -26,9 +27,9 @@ namespace Content.Client.GameObjects.Components.Mobs
|
||||
return;
|
||||
}
|
||||
|
||||
_stunned = state.Stunned;
|
||||
_knockedDown = state.KnockedDown;
|
||||
_slowedDown = state.SlowedDown;
|
||||
StunnedTimer = state.StunnedTimer;
|
||||
KnockdownTimer = state.KnockdownTimer;
|
||||
SlowdownTimer = state.SlowdownTimer;
|
||||
|
||||
WalkModifierOverride = state.WalkModifierOverride;
|
||||
RunModifierOverride = state.RunModifierOverride;
|
||||
|
||||
Reference in New Issue
Block a user