Fix nullability for ReadyProfiles in GamePreset

This commit is contained in:
DrSmugleaf
2020-12-16 10:00:10 +01:00
parent c770c6b37e
commit 49e6db2b87
4 changed files with 6 additions and 6 deletions

View File

@@ -28,7 +28,7 @@ namespace Content.Server.GameTicking
public virtual string ModeTitle => "Sandbox"; public virtual string ModeTitle => "Sandbox";
public virtual string Description => "Secret!"; public virtual string Description => "Secret!";
public virtual bool DisallowLateJoin => false; public virtual bool DisallowLateJoin => false;
public Dictionary<NetUserId, HumanoidCharacterProfile> readyProfiles; public Dictionary<NetUserId, HumanoidCharacterProfile> ReadyProfiles = new();
public virtual void OnGameStarted() { } public virtual void OnGameStarted() { }

View File

@@ -69,11 +69,11 @@ namespace Content.Server.GameTicking.GamePresets
foreach (var player in list) foreach (var player in list)
{ {
if (!readyProfiles.ContainsKey(player.UserId)) if (!ReadyProfiles.ContainsKey(player.UserId))
{ {
continue; continue;
} }
var profile = readyProfiles[player.UserId]; var profile = ReadyProfiles[player.UserId];
if (profile.AntagPreferences.Contains(_prototypeManager.Index<AntagPrototype>(TraitorID).Name)) if (profile.AntagPreferences.Contains(_prototypeManager.Index<AntagPrototype>(TraitorID).Name))
{ {
prefList.Add(player); prefList.Add(player);

View File

@@ -73,11 +73,11 @@ namespace Content.Server.GameTicking.GamePresets
foreach (var player in list) foreach (var player in list)
{ {
if (!readyProfiles.ContainsKey(player.UserId)) if (!ReadyProfiles.ContainsKey(player.UserId))
{ {
continue; continue;
} }
var profile = readyProfiles[player.UserId]; var profile = ReadyProfiles[player.UserId];
if (profile.AntagPreferences.Contains("Traitor")) if (profile.AntagPreferences.Contains("Traitor"))
{ {
prefList.Add(player); prefList.Add(player);

View File

@@ -1049,7 +1049,7 @@ The current game mode is: [color=white]{0}[/color].
private GamePreset MakeGamePreset(Dictionary<NetUserId, HumanoidCharacterProfile> readyProfiles) private GamePreset MakeGamePreset(Dictionary<NetUserId, HumanoidCharacterProfile> readyProfiles)
{ {
var preset = _dynamicTypeFactory.CreateInstance<GamePreset>(_presetType ?? typeof(PresetSandbox)); var preset = _dynamicTypeFactory.CreateInstance<GamePreset>(_presetType ?? typeof(PresetSandbox));
preset.readyProfiles = readyProfiles; preset.ReadyProfiles = readyProfiles;
return preset; return preset;
} }