mirror of
https://github.com/corvax-team/ss14-wl.git
synced 2026-09-15 14:52:26 +02:00
* 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
40 lines
1.3 KiB
C#
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);
|
|
}
|
|
}
|