mirror of
https://github.com/DeltaV-Station/Delta-v.git
synced 2026-09-29 23:57:29 +00:00
* weather status effect entities * proto port + fixes * Update weather.yml * fix visuals * Update SharedWeatherSystem.cs * Update SharedWeatherSystem.cs * Update WeatherSystem.cs * Thanks Slarti, thats a much better * Update WeatherSystem.cs * Update StencilOverlay.Weather.cs * Update Content.Client/Overlays/StencilOverlay.Weather.cs Co-authored-by: Pok <113675512+Pok27@users.noreply.github.com> * Update Content.Shared/StatusEffectNew/Components/StatusEffectComponent.cs Co-authored-by: Pok <113675512+Pok27@users.noreply.github.com> * Update Content.Client/Overlays/StencilOverlay.Weather.cs Co-authored-by: Pok <113675512+Pok27@users.noreply.github.com> * Revise weather command help descriptions Updated weather command help texts for clarity. * Merge branch 'master' into ed-14-11-2025-weather-entities * Tayrtahn review apply * fixes and cleanup --------- Co-authored-by: Pok <113675512+Pok27@users.noreply.github.com> Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>
30 lines
1.1 KiB
C#
30 lines
1.1 KiB
C#
using Content.Shared.Trigger.Components.Effects;
|
|
using Content.Shared.Weather;
|
|
using Robust.Shared.Prototypes;
|
|
using Robust.Shared.Timing;
|
|
|
|
namespace Content.Shared.Trigger.Systems;
|
|
|
|
public sealed class WeatherTriggerSystem : XOnTriggerSystem<WeatherOnTriggerComponent>
|
|
{
|
|
[Dependency] private readonly IGameTiming _timing = default!;
|
|
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
|
[Dependency] private readonly SharedWeatherSystem _weather = default!;
|
|
|
|
protected override void OnTrigger(Entity<WeatherOnTriggerComponent> ent, EntityUid target, ref TriggerEvent args)
|
|
{
|
|
var xform = Transform(target);
|
|
|
|
if (ent.Comp.Weather == null) //Clear weather if nothing is set
|
|
{
|
|
_weather.TrySetWeather(xform.MapID, null, out _);
|
|
return;
|
|
}
|
|
|
|
var endTime = ent.Comp.Duration == null ? null : ent.Comp.Duration + _timing.CurTime;
|
|
|
|
if (_prototypeManager.Resolve(ent.Comp.Weather, out var weatherPrototype))
|
|
_weather.TrySetWeather(xform.MapID, weatherPrototype, out _, endTime);
|
|
}
|
|
}
|