Cloud shadows (#298)
* not worked * fix * Update CP14CloudShadowsComponent.cs * more params in component
This commit is contained in:
24
Content.Server/_CP14/DayCycle/CP14CloudShadowsSystem.cs
Normal file
24
Content.Server/_CP14/DayCycle/CP14CloudShadowsSystem.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using System.Numerics;
|
||||
using Content.Shared._CP14.DayCycle;
|
||||
using Robust.Shared.Random;
|
||||
|
||||
namespace Content.Server._CP14.DayCycle;
|
||||
|
||||
public sealed partial class CP14CloudShadowsSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly IRobustRandom _random = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<CP14CloudShadowsComponent, MapInitEvent>(OnMapInit);
|
||||
}
|
||||
|
||||
private void OnMapInit(Entity<CP14CloudShadowsComponent> ent, ref MapInitEvent args)
|
||||
{
|
||||
ent.Comp.CloudSpeed = new Vector2(
|
||||
_random.NextFloat(-ent.Comp.MaxSpeed, ent.Comp.MaxSpeed),
|
||||
_random.NextFloat(-ent.Comp.MaxSpeed, ent.Comp.MaxSpeed));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user