Re-organize all projects (#4166)
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
using Content.Shared.Audio;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Player;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Random;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
|
||||
namespace Content.Server.Movement.Components
|
||||
{
|
||||
/// <summary>
|
||||
/// Changes footstep sound
|
||||
/// </summary>
|
||||
[RegisterComponent]
|
||||
public class FootstepModifierComponent : Component
|
||||
{
|
||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||
[Dependency] private readonly IRobustRandom _footstepRandom = default!;
|
||||
|
||||
/// <inheritdoc />
|
||||
public override string Name => "FootstepModifier";
|
||||
|
||||
[DataField("footstepSoundCollection")]
|
||||
public string? _soundCollectionName;
|
||||
|
||||
public void PlayFootstep()
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(_soundCollectionName))
|
||||
{
|
||||
var soundCollection = _prototypeManager.Index<SoundCollectionPrototype>(_soundCollectionName);
|
||||
var file = _footstepRandom.Pick(soundCollection.PickFiles);
|
||||
SoundSystem.Play(Filter.Pvs(Owner), file, Owner.Transform.Coordinates, AudioParams.Default.WithVolume(-2f));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Maths;
|
||||
|
||||
namespace Content.Server.Movement.Components
|
||||
{
|
||||
[RegisterComponent]
|
||||
public class StressTestMovementComponent : Component
|
||||
{
|
||||
public override string Name => "StressTestMovement";
|
||||
|
||||
public float Progress { get; set; }
|
||||
public Vector2 Origin { get; set; }
|
||||
|
||||
protected override void Startup()
|
||||
{
|
||||
base.Startup();
|
||||
|
||||
Origin = Owner.Transform.WorldPosition;
|
||||
}
|
||||
}
|
||||
}
|
||||
34
Content.Server/Movement/StressTestMovementSystem.cs
Normal file
34
Content.Server/Movement/StressTestMovementSystem.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using System;
|
||||
using Content.Server.Movement.Components;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Maths;
|
||||
|
||||
namespace Content.Server.Movement
|
||||
{
|
||||
[UsedImplicitly]
|
||||
internal sealed class StressTestMovementSystem : EntitySystem
|
||||
{
|
||||
public override void Update(float frameTime)
|
||||
{
|
||||
base.Update(frameTime);
|
||||
|
||||
foreach (var stressTest in ComponentManager.EntityQuery<StressTestMovementComponent>(true))
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user