Исправление и доработка голосований (#555)
* init * откат генокрадов * from Delay to Update
This commit is contained in:
parent
1738ea88dd
commit
8f7137e2cd
3 changed files with 41 additions and 5 deletions
|
|
@ -272,8 +272,9 @@ namespace Content.Server.Voting.Managers
|
|||
{
|
||||
var maps = new Dictionary<string, GameMapPrototype>();
|
||||
var eligibleMaps = _gameMapManager.CurrentlyEligibleMaps().ToList();
|
||||
maps.Add(Loc.GetString("ui-vote-secret-map"), _random.Pick(eligibleMaps));
|
||||
foreach (var map in eligibleMaps)
|
||||
var selectedMaps = eligibleMaps.OrderBy(_ => _random.Next()).Take(3).ToList();
|
||||
maps.Add(Loc.GetString("ui-vote-secret-map"), _random.Pick(selectedMaps));
|
||||
foreach (var map in selectedMaps)
|
||||
{
|
||||
maps.Add(map.MapName, map);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,11 @@
|
|||
using System.Threading.Tasks;
|
||||
using Content.Server.GameTicking;
|
||||
using Content.Server.RoundEnd;
|
||||
using Content.Server.Voting.Managers;
|
||||
using Content.Shared._Sunrise.SunriseCCVars;
|
||||
using Content.Shared.Voting;
|
||||
using Content.Shared.GameTicking;
|
||||
using Robust.Shared.Timing;
|
||||
using Robust.Shared.Configuration;
|
||||
|
||||
namespace Content.Server._Sunrise.RoundEndVote;
|
||||
|
|
@ -10,8 +13,12 @@ namespace Content.Server._Sunrise.RoundEndVote;
|
|||
public sealed class RoundEndVoteSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly GameTicker _gameTicker = default!;
|
||||
[Dependency] private readonly IGameTiming _gameTiming = default!;
|
||||
[Dependency] private readonly SharedGameTicker _sharedgameTicker = default!;
|
||||
[Dependency] private readonly IVoteManager _voteManager = default!;
|
||||
[Dependency] private readonly IConfigurationManager _cfg = default!;
|
||||
|
||||
private TimeSpan? _voteStartTime = null;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
|
|
@ -19,8 +26,28 @@ public sealed class RoundEndVoteSystem : EntitySystem
|
|||
|
||||
SubscribeLocalEvent<RoundEndSystemChangedEvent>(OnRoundEndSystemChange);
|
||||
}
|
||||
|
||||
private void OnRoundEndSystemChange(RoundEndSystemChangedEvent args)
|
||||
|
||||
public void OnRoundEndSystemChange(RoundEndSystemChangedEvent args)
|
||||
{
|
||||
_voteStartTime = _gameTiming.CurTime + _gameTicker.LobbyDuration - TimeSpan.FromSeconds(75);
|
||||
Log.Warning($"Vote will start at {_voteStartTime}");
|
||||
}
|
||||
|
||||
public override void Update(float frameTime)
|
||||
{
|
||||
base.Update(frameTime);
|
||||
|
||||
if (_gameTicker.RunLevel != GameRunLevel.PreRoundLobby || _voteStartTime == null)
|
||||
return;
|
||||
|
||||
if (_gameTiming.CurTime >= _voteStartTime)
|
||||
{
|
||||
StartRoundEndVotes();
|
||||
_voteStartTime = null;
|
||||
}
|
||||
}
|
||||
|
||||
public void StartRoundEndVotes()
|
||||
{
|
||||
if (_gameTicker.RunLevel != GameRunLevel.PreRoundLobby)
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@
|
|||
description: all-at-once-description
|
||||
showInVote: false
|
||||
hide: false # Sunrise-Edit
|
||||
minPlayers: 50 # Sunrise-Edit: 50 players for NUKEOPS
|
||||
rules:
|
||||
- Nukeops
|
||||
- Traitor
|
||||
|
|
@ -58,6 +59,7 @@
|
|||
description: aller-at-once-description
|
||||
showInVote: false #Please god dont do this
|
||||
hide: false # Sunrise-Edit
|
||||
minPlayers: 50 # Sunrise-Edit: 50 players for NUKEOPS
|
||||
rules:
|
||||
- Nukeops
|
||||
- Traitor
|
||||
|
|
@ -157,6 +159,7 @@
|
|||
description: traitor-description
|
||||
showInVote: true # Sunrise-Edit
|
||||
hide: true # Sunrise-Edit
|
||||
minPlayers: 5 # Sunrise-Edit: 50 players for TRAITORS
|
||||
rules:
|
||||
- Traitor
|
||||
- SubGamemodesRule
|
||||
|
|
@ -186,6 +189,7 @@
|
|||
description: nukeops-description
|
||||
showInVote: true # Sunrise-Edit
|
||||
hide: true # Sunrise-Edit
|
||||
minPlayers: 50 # Sunrise-Edit: 50 players for NUKEOPS
|
||||
rules:
|
||||
- Nukeops
|
||||
- SubGamemodesRule
|
||||
|
|
@ -204,6 +208,7 @@
|
|||
description: rev-description
|
||||
showInVote: true # Sunrise-Edit
|
||||
hide: true # Sunrise-Edit
|
||||
minPlayers: 15 # Sunrise-Edit: 50 players for REVOLUTIONARY
|
||||
rules:
|
||||
- Revolutionary
|
||||
- SubGamemodesRule
|
||||
|
|
@ -224,6 +229,7 @@
|
|||
description: zombie-description
|
||||
showInVote: true # Sunrise-Edit
|
||||
hide: true # Sunrise-Edit
|
||||
minPlayers: 20 # Sunrise-Edit: 50 players for ZOMBIES
|
||||
rules:
|
||||
- Zombie
|
||||
- BasicStationEventScheduler
|
||||
|
|
@ -241,6 +247,7 @@
|
|||
description: zombieteors-description
|
||||
showInVote: true # Sunrise-Edit
|
||||
hide: true # Sunrise-Edit
|
||||
minPlayers: 20 # Sunrise-Edit: 50 players for ZOMBIES
|
||||
rules:
|
||||
- Zombie
|
||||
- BasicStationEventScheduler
|
||||
|
|
@ -256,7 +263,8 @@
|
|||
- changeling
|
||||
name: changeling-gamemode-title
|
||||
description: changeling-gamemode-description
|
||||
showInVote: false
|
||||
showInVote: true
|
||||
minPlayers: 50 # Sunrise-Edit: 50 players for CHANGELINGS
|
||||
rules:
|
||||
- Changeling
|
||||
- SubGamemodesRule
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue