* Server EntitySystem cleanup I went after low-hanging fruit systems. * Add / change to internal access modifiers to systems * Use EntityQuery to get components instead * Add sealed modifier to systems * Remove unused imports * Add jetbrains annotation for unused classes * Removed some pragmas for dependencies This should also fix a decent chunk of the server build warnings, at least the ones that matter. * Also disposals * Update Content.Server/GameObjects/EntitySystems/GravitySystem.cs * Fix build Co-authored-by: Metal Gear Sloth <metalgearsloth@gmail.com> Co-authored-by: Víctor Aguilera Puerto <6766154+Zumorica@users.noreply.github.com>
35 lines
1.0 KiB
C#
35 lines
1.0 KiB
C#
using System;
|
|
using Content.Server.GameObjects.Components;
|
|
using JetBrains.Annotations;
|
|
using Robust.Shared.GameObjects.Systems;
|
|
using Robust.Shared.Maths;
|
|
|
|
namespace Content.Server.GameObjects.EntitySystems
|
|
{
|
|
[UsedImplicitly]
|
|
internal sealed class StressTestMovementSystem : EntitySystem
|
|
{
|
|
public override void Update(float frameTime)
|
|
{
|
|
base.Update(frameTime);
|
|
|
|
foreach (var stressTest in ComponentManager.EntityQuery<StressTestMovementComponent>())
|
|
{
|
|
var transform = stressTest.Owner.Transform;
|
|
|
|
stressTest.Progress += frameTime;
|
|
|
|
if (stressTest.Progress > 1)
|
|
{
|
|
stressTest.Progress -= 1;
|
|
}
|
|
|
|
var x = MathF.Sin(stressTest.Progress * MathHelper.TwoPi);
|
|
var y = MathF.Cos(stressTest.Progress * MathHelper.TwoPi);
|
|
|
|
transform.WorldPosition = stressTest.Origin + (new Vector2(x, y) * 5);
|
|
}
|
|
}
|
|
}
|
|
}
|