Weather fix (#30857)

* weather fix

* localize errors
This commit is contained in:
Ed
2024-08-25 20:20:47 +05:00
committed by GitHub
parent ae310878a6
commit ff412a65ba
3 changed files with 34 additions and 35 deletions

View File

@@ -156,11 +156,14 @@ public abstract class SharedWeatherSystem : EntitySystem
foreach (var (eProto, weather) in weatherComp.Weather)
{
// if we turn off the weather, we don't want endTime = null
if (proto == null)
endTime ??= Timing.CurTime + WeatherComponent.ShutdownTime;
// Reset cooldown if it's an existing one.
if (proto == null || eProto == proto.ID)
if (proto is not null && eProto == proto.ID)
{
weather.EndTime = endTime;
if (weather.State == WeatherState.Ending)
weather.State = WeatherState.Running;