-
Notifications
You must be signed in to change notification settings - Fork 147
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/Simple-Station/Einstein-E…
…ngines into v229.1.4
- Loading branch information
Showing
14 changed files
with
163 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
using Robust.Shared.Configuration; | ||
using Content.Server.Voting.Managers; | ||
using Content.Shared.GameTicking; | ||
using Content.Shared.Voting; | ||
using Content.Shared.CCVar; | ||
using Robust.Server.Player; | ||
using Content.Server.GameTicking; | ||
|
||
namespace Content.Server.AutoVote; | ||
|
||
public sealed class AutoVoteSystem : EntitySystem | ||
{ | ||
[Dependency] private readonly IConfigurationManager _cfg = default!; | ||
[Dependency] public readonly IVoteManager _voteManager = default!; | ||
[Dependency] public readonly IPlayerManager _playerManager = default!; | ||
|
||
public bool _shouldVoteNextJoin = false; | ||
|
||
public override void Initialize() | ||
{ | ||
base.Initialize(); | ||
|
||
SubscribeLocalEvent<RoundRestartCleanupEvent>(OnReturnedToLobby); | ||
SubscribeLocalEvent<PlayerJoinedLobbyEvent>(OnPlayerJoinedLobby); | ||
} | ||
|
||
public void OnReturnedToLobby(RoundRestartCleanupEvent ev) => CallAutovote(); | ||
|
||
public void OnPlayerJoinedLobby(PlayerJoinedLobbyEvent ev) | ||
{ | ||
if (!_shouldVoteNextJoin) | ||
return; | ||
|
||
CallAutovote(); | ||
_shouldVoteNextJoin = false; | ||
} | ||
|
||
private void CallAutovote() | ||
{ | ||
if (!_cfg.GetCVar(CCVars.AutoVoteEnabled)) | ||
return; | ||
|
||
if (_playerManager.PlayerCount == 0) | ||
{ | ||
_shouldVoteNextJoin = true; | ||
return; | ||
} | ||
|
||
if (_cfg.GetCVar(CCVars.MapAutoVoteEnabled)) | ||
_voteManager.CreateStandardVote(null, StandardVoteType.Map); | ||
if (_cfg.GetCVar(CCVars.PresetAutoVoteEnabled)) | ||
_voteManager.CreateStandardVote(null, StandardVoteType.Preset); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -107,3 +107,5 @@ | |
powersToAdd: | ||
- XenoglossyPower | ||
- TelepathyPower | ||
- type: LanguageSpeaker | ||
- type: UniversalLanguageSpeaker |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters