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

@@ -356,16 +356,7 @@ namespace Content.Server.Buckle.Components
public override ComponentState GetComponentState()
{
int? drawDepth = null;
if (BuckledTo != null &&
EntMan.GetComponent<TransformComponent>(BuckledTo.Owner).LocalRotation.GetCardinalDir() == Direction.North &&
EntMan.TryGetComponent<SpriteComponent>(BuckledTo.Owner, out var spriteComponent))
{
drawDepth = spriteComponent.DrawDepth - 1;
}
return new BuckleComponentState(Buckled, drawDepth, LastEntityBuckledTo, DontCollide);
return new BuckleComponentState(Buckled, LastEntityBuckledTo, DontCollide);
}
}
}

View File

@@ -112,9 +112,6 @@ namespace Content.Server.Hands.Systems
// update gui of anyone stripping this entity.
_strippableSystem.SendUpdate(uid);
if (TryComp(hand.HeldEntity, out SpriteComponent? sprite))
sprite.RenderOrder = EntityManager.CurrentTick.Value;
}
public override void DoPickup(EntityUid uid, Hand hand, EntityUid entity, SharedHandsComponent? hands = null)

View File

@@ -2,7 +2,6 @@ using Content.Server.Projectiles;
using Content.Server.Projectiles.Components;
using Content.Server.Singularity.Components;
using Content.Shared.Singularity.Components;
using Robust.Server.GameObjects;
using Robust.Shared.Timing;
namespace Content.Server.ParticleAccelerator.Components
@@ -49,24 +48,12 @@ namespace Content.Server.ParticleAccelerator.Components
};
singuloFoodComponent.Energy = 10 * multiplier;
var suffix = state switch
if (_entMan.TryGetComponent(Owner, out AppearanceComponent? appearance))
{
ParticleAcceleratorPowerState.Level0 => "0",
ParticleAcceleratorPowerState.Level1 => "1",
ParticleAcceleratorPowerState.Level2 => "2",
ParticleAcceleratorPowerState.Level3 => "3",
_ => "0"
};
if (!_entMan.TryGetComponent<SpriteComponent?>(Owner, out var spriteComponent))
{
Logger.Error("ParticleProjectile tried firing, but it was spawned without a SpriteComponent");
return;
appearance.SetData(ParticleAcceleratorVisuals.VisualState, state);
}
spriteComponent.LayerSetState(0, $"particle{suffix}");
physicsComponent
.LinearVelocity = angle.ToWorldVec() * 20f;
physicsComponent.LinearVelocity = angle.ToWorldVec() * 20f;
_entMan.GetComponent<TransformComponent>(Owner).LocalRotation = angle;
Timer.Spawn(3000, () => _entMan.DeleteEntity(Owner));

View File

@@ -53,16 +53,6 @@ namespace Content.Server.Pointing.Components
[DataField("rogue")]
public bool Rogue = false;
protected override void Startup()
{
base.Startup();
if (_entMan.TryGetComponent(Owner, out SpriteComponent? sprite))
{
sprite.DrawDepth = (int) DrawDepth.Overlays;
}
}
public void Update(float frameTime)
{
var movement = _speed * frameTime * (_up ? 1 : -1);

View File

@@ -17,21 +17,6 @@ namespace Content.Server.Pointing.EntitySystems
[Dependency] private readonly IRobustRandom _random = default!;
[Dependency] private readonly ExplosionSystem _explosion = default!;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<RoguePointingArrowComponent, ComponentStartup>(OnStartup);
}
private void OnStartup(EntityUid uid, RoguePointingArrowComponent component, ComponentStartup args)
{
if (EntityManager.TryGetComponent(uid, out SpriteComponent? sprite))
{
sprite.DrawDepth = (int) DrawDepth.Overlays;
}
}
private EntityUid? RandomNearbyPlayer(EntityUid uid, RoguePointingArrowComponent? component = null, TransformComponent? transform = null)
{
if (!Resolve(uid, ref component, ref transform))

View File

@@ -157,11 +157,6 @@ namespace Content.Server.Sandbox
void UpgradeId(EntityUid id)
{
_access.TrySetTags(id, allAccess);
if (TryComp<SpriteComponent>(id, out var sprite))
{
sprite.LayerSetState(0, "gold");
}
}
EntityUid CreateFreshId()