Remove more server sprite component uses (#9963)

This commit is contained in:
Leon Friedrich
2022-07-27 04:22:49 +12:00
committed by GitHub
parent 43ec284318
commit ce24d16593
13 changed files with 38 additions and 82 deletions

View File

@@ -46,14 +46,18 @@ namespace Content.Client.Buckle
return;
}
if (_buckled && buckle.DrawDepth.HasValue)
// TODO when ECSing, make this a visualizer
if (_buckled &&
LastEntityBuckledTo != null &&
EntMan.GetComponent<TransformComponent>(LastEntityBuckledTo.Value).LocalRotation.GetCardinalDir() == Direction.North &&
EntMan.TryGetComponent<SpriteComponent>(LastEntityBuckledTo, out var buckledSprite))
{
_originalDrawDepth ??= ownerSprite.DrawDepth;
ownerSprite.DrawDepth = buckle.DrawDepth.Value;
ownerSprite.DrawDepth = buckledSprite.DrawDepth - 1;
return;
}
if (_originalDrawDepth.HasValue && !buckle.DrawDepth.HasValue)
if (_originalDrawDepth.HasValue && !_buckled)
{
ownerSprite.DrawDepth = _originalDrawDepth.Value;
_originalDrawDepth = null;

View File

@@ -99,6 +99,14 @@ namespace Content.Client.Hands
}
#endregion
public override void DoDrop(EntityUid uid, Hand hand, bool doDropInteraction = true, SharedHandsComponent? hands = null)
{
base.DoDrop(uid, hand, doDropInteraction, hands);
if (TryComp(hand.HeldEntity, out SpriteComponent? sprite))
sprite.RenderOrder = EntityManager.CurrentTick.Value;
}
public EntityUid? GetActiveHandEntity()
{
return TryGetPlayerHands(out var hands) ? hands.ActiveHandEntity : null;