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

40 lines
1.3 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!;
[Dependency] private IPrototypeManager _prototypeManager = 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(_prototypeManager.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);
}
}