mirror of
https://github.com/space-wizards/space-station-14.git
synced 2026-09-15 14:53:16 +02:00
* add rule filter to feedback popup * fix the dependency * simplify * remove this * deny popups with rules * missed here * new parameter * the server handles the specific feedback prototypes * fix logic * active > added * minor fixes * not needed anymore * now it should be back * not needed * cleaning * create system * forgot to remove this * also remove this * add a I * remove old feedback popups * doesn't actually fix it * maybe this time? * oh well * use whitelists * use gamerule added * update fix comment * simplify * old commentary * default false * add blacklist option * fix helper functions * remove commentary * who needs those * orks hates linq * not needed * Change linq into foreach * remove unwanted popups for next rounds --------- Co-authored-by: beck-thompson <beck314159@hotmail.com>
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 readonly ServerFeedbackManager _feedbackManager = null!;
|
|
[Dependency] private readonly GameTicker _gameTicker = null!;
|
|
[Dependency] private readonly 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);
|
|
}
|
|
}
|