mirror of
https://github.com/wega-team/ss14-wega.git
synced 2026-06-09 10:06:49 +02:00
32 lines
957 B
C#
32 lines
957 B
C#
using System.Linq;
|
|
using Content.Server.Voting.Managers;
|
|
using Content.Shared.GameTicking;
|
|
using Content.Shared.Voting;
|
|
using Robust.Server.Player;
|
|
using Robust.Shared.Enums;
|
|
using Robust.Shared.Player;
|
|
|
|
namespace Content.Server.GameTicking
|
|
{
|
|
public sealed class AutoVoteSystem : EntitySystem
|
|
{
|
|
[Dependency] private IVoteManager _voteManager = default!;
|
|
[Dependency] private IPlayerManager _playerManager = default!;
|
|
|
|
public override void Initialize()
|
|
{
|
|
SubscribeLocalEvent<VoteRoundEndEvent>(OnRoundEnd);
|
|
}
|
|
|
|
private void OnRoundEnd(VoteRoundEndEvent ev)
|
|
{
|
|
ICommonSession? initiator = null;
|
|
var sessions = _playerManager.Sessions.Where(s => s.Status == SessionStatus.InGame).ToList();
|
|
if (sessions.Count > 0)
|
|
initiator = sessions[0];
|
|
|
|
_voteManager.CreateStandardVote(null, StandardVoteType.Preset);
|
|
}
|
|
}
|
|
}
|