/// <summary> /// Checks if the antag preferences have at least one of the possible antags enabled. /// </summary> /// <param name="antagPrefs"></param> /// <returns></returns> protected bool HasPossibleAntagEnabled(ref AntagPrefsDict antagPrefs) { foreach (var antag in PossibleAntags) { if (HasAntagEnabled(ref antagPrefs, antag)) { return(true); } } return(false); }
/// <summary> /// Checks if the antag preferences have at least one of the possible antags enabled. /// Assume the antag is enabled by default if it doesn't appear in the preferences or was never set up. /// </summary> /// <param name="antagPrefs"></param> /// <param name="antag"></param> /// <returns></returns> protected bool HasAntagEnabled(ref AntagPrefsDict antagPrefs, Antagonist antag) { if (antag.ShowInPreferences == false) { return(true); } if (antagPrefs.ContainsKey(antag.AntagName) && antagPrefs[antag.AntagName] == false) { //manually set to false by the player return(false); } return(true); }
/// <summary> /// Loads all antag prefs from the player manager /// </summary> private void LoadAntagPreferences() { antagPrefs = PlayerManager.CurrentCharacterSettings.AntagPreferences; foreach (string antagName in antagPrefs.Keys.ToList()) { if (antagEntries.ContainsKey(antagName)) { antagEntries[antagName].SetToggle(antagPrefs[antagName]); } else { // Remove all antag prefs which aren't valid anymore. antagPrefs.Remove(antagName); } } }
public static bool HasAntagEnabled(AntagPrefsDict antagPrefs, Antagonist antag) { return(!antag.ShowInPreferences || (antagPrefs.ContainsKey(antag.AntagName) && antagPrefs[antag.AntagName])); }