mirror of
https://github.com/wega-team/ss14-wega.git
synced 2026-06-09 10:06:49 +02:00
42 lines
1.3 KiB
C#
42 lines
1.3 KiB
C#
using Content.Server.GameTicking;
|
|
using Content.Shared.CombatMode.Pacification;
|
|
using Content.Shared.Corvax.CCCVars;
|
|
using Content.Shared.Mindshield.Components;
|
|
using Content.Shared.Silicons.Laws.Components;
|
|
using Robust.Server.Player;
|
|
using Robust.Shared.Configuration;
|
|
|
|
namespace Content.Server.Corvax.PeacefulRoundEnd;
|
|
|
|
public sealed partial class PeacefulRoundEndSystem : EntitySystem
|
|
{
|
|
[Dependency] private IConfigurationManager _cfg = default!;
|
|
[Dependency] private IPlayerManager _playerManager = default!;
|
|
|
|
private bool _isEnabled = false;
|
|
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
_cfg.OnValueChanged(CCCVars.PeacefulRoundEnd, v => _isEnabled = v, true);
|
|
SubscribeLocalEvent<RoundEndTextAppendEvent>(OnRoundEnded);
|
|
}
|
|
|
|
private void OnRoundEnded(RoundEndTextAppendEvent ev)
|
|
{
|
|
if (!_isEnabled) return;
|
|
foreach (var session in _playerManager.Sessions)
|
|
{
|
|
if (!session.AttachedEntity.HasValue) continue;
|
|
|
|
var entityId = session.AttachedEntity.Value;
|
|
if (HasComp<MindShieldComponent>(entityId)
|
|
|| HasComp<SiliconLawBoundComponent>(entityId))
|
|
{
|
|
continue;
|
|
}
|
|
EnsureComp<PacifiedComponent>(entityId);
|
|
}
|
|
}
|
|
}
|