mirror of
https://github.com/space-syndicate/space-station-14.git
synced 2026-10-09 18:31:17 +03:00
* Remove Shared System IPrototypeManager instances * Remove RecipeManager IPrototypeManager instance * Fix ItemSystem IPrototypeManager refs, use TryComp * SharedItemSystem changes, EntWhitelist CompName * HasComponent->HasComp
27 lines
971 B
C#
27 lines
971 B
C#
using Content.Shared.Trigger.Components.Effects;
|
|
using Content.Shared.Weather;
|
|
using Robust.Shared.Timing;
|
|
|
|
namespace Content.Shared.Trigger.Systems;
|
|
|
|
public sealed partial class WeatherTriggerSystem : XOnTriggerSystem<WeatherOnTriggerComponent>
|
|
{
|
|
[Dependency] private IGameTiming _timing = default!;
|
|
[Dependency] private 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 (ProtoMan.Resolve(ent.Comp.Weather, out var weatherPrototype))
|
|
_weather.TrySetWeather(xform.MapID, weatherPrototype, out _, endTime);
|
|
}
|
|
}
|