mist weather

This commit is contained in:
Ed
2024-09-29 12:27:51 +03:00
parent 752d9b8ff4
commit beb681ce7b
7 changed files with 47 additions and 13 deletions

View File

@@ -60,7 +60,7 @@ public sealed partial class StencilOverlay
// Draw the rain
worldHandle.UseShader(_protoManager.Index<ShaderPrototype>("StencilDraw").Instance());
_parallax.DrawParallax(worldHandle, worldAABB, sprite, curTime, position, Vector2.Zero, modulate: (weatherProto.Color ?? Color.White).WithAlpha(alpha));
_parallax.DrawParallax(worldHandle, worldAABB, sprite, curTime, position, weatherProto.OffsetSpeed, modulate: (weatherProto.Color ?? Color.White).WithAlpha(alpha*weatherProto.Alpha)); //CP14 alpha and offset scrolling
worldHandle.SetTransform(Matrix3x2.Identity);
worldHandle.UseShader(null);

View File

@@ -57,13 +57,6 @@ public sealed partial class StencilOverlay : Overlay
_blep = _clyde.CreateRenderTarget(args.Viewport.Size, new RenderTargetFormatParameters(RenderTargetColorFormat.Rgba8Srgb), name: "weather-stencil");
}
//CP14 Overlays
if (_entManager.TryGetComponent<CP14WorldEdgeComponent>(mapUid, out var worldEdge))
{
DrawWorldEdge(args, worldEdge, invMatrix);
}
//CP14 Overlays end
if (_entManager.TryGetComponent<WeatherComponent>(mapUid, out var comp))
{
foreach (var (proto, weather) in comp.Weather)
@@ -81,6 +74,14 @@ public sealed partial class StencilOverlay : Overlay
DrawRestrictedRange(args, restrictedRangeComponent, invMatrix);
}
//CP14 Overlays
if (_entManager.TryGetComponent<CP14WorldEdgeComponent>(mapUid, out var worldEdge))
{
DrawWorldEdge(args, worldEdge, invMatrix);
}
//CP14 Overlays end
//CP14 Overlays
if (_entManager.TryGetComponent<CP14CloudShadowsComponent>(mapUid, out var shadows))
{

View File

@@ -1,5 +1,3 @@
using Content.Server.GameTicking;
using Content.Server.GameTicking.Events;
using Content.Server.Weather;
using Robust.Shared.Prototypes;
using Robust.Shared.Random;
@@ -11,7 +9,6 @@ public sealed class CP14WeatherControllerSystem : EntitySystem
{
[Dependency] private readonly IRobustRandom _random = default!;
[Dependency] private readonly IGameTiming _timing = default!;
[Dependency] private readonly GameTicker _gameTicker = default!;
[Dependency] private readonly WeatherSystem _weather = default!;
[Dependency] private readonly IPrototypeManager _proto = default!;
@@ -19,7 +16,7 @@ public sealed class CP14WeatherControllerSystem : EntitySystem
{
base.Initialize();
SubscribeLocalEvent<CP14WeatherControllerComponent, RoundStartingEvent>(OnRoundStart);
SubscribeLocalEvent<CP14WeatherControllerComponent, MapInitEvent>(OnMapInit);
}
public override void Update(float frameTime)
@@ -45,7 +42,7 @@ public sealed class CP14WeatherControllerSystem : EntitySystem
}
}
private void OnRoundStart(Entity<CP14WeatherControllerComponent> ent, ref RoundStartingEvent args)
private void OnMapInit(Entity<CP14WeatherControllerComponent> ent, ref MapInitEvent args)
{
ent.Comp.NextWeatherTime = _timing.CurTime + TimeSpan.FromSeconds(ent.Comp.ClearDuration.Next(_random));
}

View File

@@ -1,3 +1,4 @@
using System.Numerics;
using Robust.Shared.Audio;
using Robust.Shared.Prototypes;
using Robust.Shared.Utility;
@@ -20,4 +21,16 @@ public sealed partial class WeatherPrototype : IPrototype
/// </summary>
[ViewVariables(VVAccess.ReadWrite), DataField("sound")]
public SoundSpecifier? Sound;
/// <summary>
/// CP14 offset speed
/// </summary>
[DataField]
public Vector2 OffsetSpeed = Vector2.Zero;
/// <summary>
/// CP14 alpha
/// </summary>
[DataField]
public float Alpha = 1f;
}

View File

@@ -19,3 +19,12 @@
params:
loop: true
volume: -6
- type: weather
id: CP14Mist
offsetSpeed: 0.04, 0.06
color: "#a9c4bf"
alpha: 0.5
sprite:
sprite: /Textures/_CP14/Effects/parallax.rsi
state: noise

View File

@@ -0,0 +1,14 @@
{
"version": 1,
"copyright": "Generated",
"license": "CC-BY-SA-3.0",
"size": {
"x": 1000,
"y": 1000
},
"states": [
{
"name": "noise"
}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 643 KiB