* basic implementation

* minor fixes

* objectives temp commit

* proper onstart bind

* changes all conditions to be bound to a mind-instance

* oops

* oops v2

* adds possiblity to enable duplicate assignment of objective
equal objectives are unable to be added

* minor fixes, adds greentext

* refactors incompatability to be defined by requirements

* fixes a wrong whitespace

* minor fix

* addressed reviews v1

* address reviews v2

Co-authored-by: Exp <theexp111@gmail.com>

* final sweep

* adds/refactors traitor&sss cvars

* Update Content.Server/Mobs/Mind.cs

* never trust github web

* adds datasets & makes codewords use them

* addresses exp's reviews

* addressed zumos reviews

Co-authored-by: Paul <ritter.paul1+git@googlemail.com>
Co-authored-by: Exp <theexp111@gmail.com>
This commit is contained in:
Paul Ritter
2020-12-01 17:05:19 +01:00
committed by GitHub
parent 602f37e70c
commit f7c09fbd7e
28 changed files with 1875 additions and 107 deletions

View File

@@ -115,6 +115,15 @@ namespace Content.Server.GameTicking
}
}
[ViewVariables]
public GamePreset Preset
{
get => _preset == null ? MakeGamePreset(null) : _preset;
set => _preset = value;
}
private GamePreset _preset;
public event Action<GameRunLevelChangedEventArgs> OnRunLevelChanged;
public event Action<GameRuleAddedEventArgs> OnRuleAdded;
@@ -278,18 +287,18 @@ namespace Content.Server.GameTicking
}
// Time to start the preset.
var preset = MakeGamePreset(profiles);
Preset = MakeGamePreset(profiles);
DisallowLateJoin |= preset.DisallowLateJoin;
DisallowLateJoin |= Preset.DisallowLateJoin;
if (!preset.Start(assignedJobs.Keys.ToList(), force))
if (!Preset.Start(assignedJobs.Keys.ToList(), force))
{
if (_configurationManager.GetCVar(CCVars.GameLobbyFallbackEnabled))
{
SetStartPreset(_configurationManager.GetCVar(CCVars.GameLobbyFallbackPreset));
var newPreset = MakeGamePreset(profiles);
_chatManager.DispatchServerAnnouncement(
$"Failed to start {preset.ModeTitle} mode! Defaulting to {newPreset.ModeTitle}...");
$"Failed to start {Preset.ModeTitle} mode! Defaulting to {newPreset.ModeTitle}...");
if (!newPreset.Start(readyPlayers, force))
{
throw new ApplicationException("Fallback preset failed to start!");
@@ -297,15 +306,17 @@ namespace Content.Server.GameTicking
DisallowLateJoin = false;
DisallowLateJoin |= newPreset.DisallowLateJoin;
Preset = newPreset;
}
else
{
SendServerMessage($"Failed to start {preset.ModeTitle} mode! Restarting round...");
SendServerMessage($"Failed to start {Preset.ModeTitle} mode! Restarting round...");
RestartRound();
DelayStart(TimeSpan.FromSeconds(PresetFailedCooldownIncrease));
return;
}
}
Preset.OnGameStarted();
_roundStartTimeSpan = IoCManager.Resolve<IGameTiming>().RealTime;
_sendStatusToAll();
@@ -342,8 +353,8 @@ namespace Content.Server.GameTicking
//Tell every client the round has ended.
var roundEndMessage = _netManager.CreateNetMessage<MsgRoundEndMessage>();
roundEndMessage.GamemodeTitle = MakeGamePreset(null).ModeTitle;
roundEndMessage.RoundEndText = roundEndText;
roundEndMessage.GamemodeTitle = Preset.ModeTitle;
roundEndMessage.RoundEndText = roundEndText + $"\n{Preset.GetRoundEndDescription()}";
//Get the timespan of the round.
roundEndMessage.RoundDuration = IoCManager.Resolve<IGameTiming>().RealTime.Subtract(_roundStartTimeSpan);
@@ -472,6 +483,7 @@ namespace Content.Server.GameTicking
"sandbox" => typeof(PresetSandbox),
"deathmatch" => typeof(PresetDeathMatch),
"suspicion" => typeof(PresetSuspicion),
"traitor" => typeof(PresetTraitor),
_ => default
};
@@ -1003,8 +1015,8 @@ namespace Content.Server.GameTicking
private string GetInfoText()
{
var gmTitle = MakeGamePreset(null).ModeTitle;
var desc = MakeGamePreset(null).Description;
var gmTitle = Preset.ModeTitle;
var desc = Preset.Description;
return Loc.GetString(@"Hi and welcome to [color=white]Space Station 14![/color]
The current game mode is: [color=white]{0}[/color].