CatStation/Content.Server/FeedbackSystem/FeedbackSystem.cs
Whatstone f42f8df6d1
Cleanup: ProtoMan Part 2 - remove Client and Server EntitySystem IPrototypeManager instances (#44416)
* Remove all IPrototypeManager instances

* Remove redundant IComponentFactory instances too

* Found some stragglers

* DestructibleSystem.PrototypeManager: no dependency

* not based
2026-06-29 21:33:56 +00:00

38 lines
1.2 KiB
C#

using Content.Server.GameTicking;
using Content.Shared.FeedbackSystem;
using Content.Shared.GameTicking;
using Robust.Shared.Prototypes;
namespace Content.Server.FeedbackSystem;
public sealed partial class FeedbackSystem : EntitySystem
{
[Dependency] private ServerFeedbackManager _feedbackManager = null!;
[Dependency] private GameTicker _gameTicker = null!;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<RoundEndMessageEvent>(OnRoundEnd);
}
private void OnRoundEnd(RoundEndMessageEvent args)
{
var validPopups = new List<ProtoId<FeedbackPopupPrototype>>();
var notValidPopups = new List<ProtoId<FeedbackPopupPrototype>>();
foreach (var feedback in _feedbackManager.GetOriginFeedbackPrototypes(true, true))
{
if (_gameTicker.IsGameRuleAdded(ProtoMan.Index(feedback).RuleWhitelist))
validPopups.Add(feedback);
else
notValidPopups.Add(feedback);
}
if (validPopups.Count > 0)
_feedbackManager.SendToAllSessions(validPopups);
if (notValidPopups.Count > 0)
_feedbackManager.SendToAllSessions(notValidPopups, true);
}
}