2024-08-25 23:54:21 +03:00
|
|
|
|
using Content.Server.GameTicking;
|
|
|
|
|
|
using Content.Server.RoundEnd;
|
|
|
|
|
|
using Content.Server.Voting.Managers;
|
|
|
|
|
|
using Content.Shared.Voting;
|
2024-10-01 21:02:34 +03:00
|
|
|
|
using Robust.Server.Player;
|
2024-08-25 23:54:21 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
namespace Content.Server._Honk.RoundEndVote;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public sealed class RoundEndVoteSystem : EntitySystem
|
|
|
|
|
|
{
|
|
|
|
|
|
[Dependency] private readonly IVoteManager _voteManager = default!;
|
|
|
|
|
|
[Dependency] private readonly GameTicker _gameTicker = default!;
|
2024-10-01 23:37:57 +03:00
|
|
|
|
[Dependency] private readonly IPlayerManager _playerManager = default!;
|
2024-08-25 23:54:21 +03:00
|
|
|
|
|
|
|
|
|
|
public override void Initialize()
|
|
|
|
|
|
{
|
|
|
|
|
|
SubscribeLocalEvent<RoundEndSystemChangedEvent>(OnRoundEndSystemChange);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void OnRoundEndSystemChange(RoundEndSystemChangedEvent ev)
|
|
|
|
|
|
{
|
2024-10-01 23:37:57 +03:00
|
|
|
|
if (_gameTicker.RunLevel != GameRunLevel.PreRoundLobby)
|
2024-08-25 23:54:21 +03:00
|
|
|
|
return;
|
|
|
|
|
|
|
2024-10-01 23:37:57 +03:00
|
|
|
|
var player = _playerManager.PlayerCount >= 20;
|
|
|
|
|
|
|
|
|
|
|
|
if (player)
|
|
|
|
|
|
{
|
|
|
|
|
|
_voteManager.CreateStandardVote(null, StandardVoteType.Preset);
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
_gameTicker.SetGamePreset("Secret");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-08-26 16:47:47 +03:00
|
|
|
|
_voteManager.CreateStandardVote(null, StandardVoteType.Map);
|
2024-08-25 23:54:21 +03:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|