Files
Pieter-Jan BriersandGitHub 5168b5f3d4 IoC source gen compatibility (#43863)
* IoC source gen compatibility

Can be merged before or after https://github.com/space-wizards/RobustToolbox/pull/6549 doesn't really matter.

* Missed a spot
2026-05-09 03:29:58 +00:00

29 lines
1.0 KiB
C#

using Content.Shared.Weather;
using Robust.Server.GameStates;
namespace Content.Server.Weather;
public sealed partial 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 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);
}
}