Cache CanMove (#7480)

This commit is contained in:
Leon Friedrich
2022-04-10 16:48:11 +12:00
committed by GitHub
parent 4135d9813b
commit 87eede8785
26 changed files with 218 additions and 109 deletions

View File

@@ -1,3 +1,4 @@
using Content.Shared.ActionBlocker;
using Content.Shared.Buckle.Components;
using Robust.Client.GameObjects;
using Robust.Shared.GameObjects;
@@ -9,6 +10,9 @@ namespace Content.Client.Buckle
[ComponentReference(typeof(SharedBuckleComponent))]
public sealed class BuckleComponent : SharedBuckleComponent
{
[Dependency] private readonly IEntityManager _entMan = default!;
[Dependency] private readonly IEntitySystemManager _sysMan = default!;
private bool _buckled;
private int? _originalDrawDepth;
@@ -30,7 +34,10 @@ namespace Content.Client.Buckle
_buckled = buckle.Buckled;
LastEntityBuckledTo = buckle.LastEntityBuckledTo;
DontCollide = buckle.DontCollide;
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out SpriteComponent? ownerSprite))
_sysMan.GetEntitySystem<ActionBlockerSystem>().UpdateCanMove(Owner);
if (!_entMan.TryGetComponent(Owner, out SpriteComponent? ownerSprite))
{
return;
}