CatStation/Content.Server/Weather/WeatherSystem.cs
ArtisticRoomba 376f16504c
Content.Shared EntityQuery<T> dependency injection refactor (#43498)
* part 1

* second pass

* final fix

* last fix i swear

* an even bigger genius

* regex missed this

* should be all of em?

* oops

* yeah

* Revert "should be all of em?"

This reverts commit 4dd54d1b9a76977b4cf8d6008358e4dacdee6eb1.

---------

Co-authored-by: Princess Cheeseballs <66055347+Pronana@users.noreply.github.com>
2026-04-11 21:30:36 +00:00

28 lines
1 KiB
C#

using Content.Shared.Weather;
using Robust.Server.GameStates;
namespace Content.Server.Weather;
public sealed class WeatherSystem : SharedWeatherSystem
{
//I dont really like to PVS override weather entities, but map status effect containers dont PVS-ing out of the box
[Dependency] private readonly PvsOverrideSystem _pvs = default!;
public override void Initialize()
{
SubscribeLocalEvent<WeatherStatusEffectComponent, ComponentInit>(OnCompInit);
SubscribeLocalEvent<WeatherStatusEffectComponent, ComponentShutdown>(OnCompShutdown);
}
private void OnCompInit(Entity<WeatherStatusEffectComponent> ent, ref ComponentInit args)
{
// The map entitiy itself is networked by PVS if the player is on that map but not anything inside a container,
// So we need to add an overridce to make sure the client sees it.
_pvs.AddGlobalOverride(ent);
}
private void OnCompShutdown(Entity<WeatherStatusEffectComponent> ent, ref ComponentShutdown args)
{
_pvs.RemoveGlobalOverride(ent);
}
}