clean up weather systems (#28792)
* clean up weather systems * Update WeatherComponent.cs * Update SharedWeatherSystem.cs * some fix * Update SharedWeatherSystem.cs * Update WeatherComponent.cs * Update WeatherComponent.cs * revert autoPause * Update SharedWeatherSystem.cs
This commit is contained in:
@@ -1,17 +1,16 @@
|
||||
using System.Linq;
|
||||
using Content.Server.Administration;
|
||||
using Content.Shared.Administration;
|
||||
using Content.Shared.Weather;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.GameStates;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Map.Components;
|
||||
|
||||
namespace Content.Server.Weather;
|
||||
|
||||
public sealed class WeatherSystem : SharedWeatherSystem
|
||||
{
|
||||
[Dependency] private readonly IConsoleHost _console = default!;
|
||||
[Dependency] private readonly SharedMapSystem _mapSystem = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -30,7 +29,7 @@ public sealed class WeatherSystem : SharedWeatherSystem
|
||||
}
|
||||
|
||||
[AdminCommand(AdminFlags.Fun)]
|
||||
private void WeatherTwo(IConsoleShell shell, string argstr, string[] args)
|
||||
private void WeatherTwo(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
if (args.Length < 2)
|
||||
{
|
||||
@@ -60,7 +59,8 @@ public sealed class WeatherSystem : SharedWeatherSystem
|
||||
var maxTime = TimeSpan.MaxValue;
|
||||
|
||||
// If it's already running then just fade out with how much time we're into the weather.
|
||||
if (TryComp<WeatherComponent>(MapManager.GetMapEntityId(mapId), out var weatherComp) &&
|
||||
if (_mapSystem.TryGetMap(mapId, out var mapUid) &&
|
||||
TryComp<WeatherComponent>(mapUid, out var weatherComp) &&
|
||||
weatherComp.Weather.TryGetValue(args[1], out var existing))
|
||||
{
|
||||
maxTime = curTime - existing.StartTime;
|
||||
|
||||
Reference in New Issue
Block a user