public void SelectRandomMap() { var maps = CurrentlyEligibleMaps().ToList(); _currentMap = _random.Pick(maps); _currentMapForced = false; }
public void SelectRandomMap() { var maps = CurrentlyEligibleMaps().ToList(); _random.Shuffle(maps); _currentMap = maps[0]; _currentMapForced = false; }
public void ForceSelectMap(string gameMap) { if (!TryLookupMap(gameMap, out var map)) { throw new ArgumentException($"The map \"{gameMap}\" is invalid!"); } _currentMap = map; _currentMapForced = true; }
public bool TrySelectMap(string gameMap) { if (!TryLookupMap(gameMap, out var map) || !IsMapEligible(map)) { return(false); } _currentMap = map; _currentMapForced = false; return(true); }
public void Initialize() { _configurationManager.OnValueChanged(CCVars.GameMap, value => { if (TryLookupMap(value, out var map)) { _currentMap = map; } else { throw new ArgumentException($"Unknown map prototype {value} was selected!"); } }, true); _configurationManager.OnValueChanged(CCVars.GameMapForced, value => _currentMapForced = value, true); }
public void Initialize() { _configurationManager.OnValueChanged(CCVars.GameMap, value => { if (TryLookupMap(value, out var map)) { _currentMap = map; } else { throw new ArgumentException($"Unknown map prototype {value} was selected!"); } }, true); _configurationManager.OnValueChanged(CCVars.GameMapForced, value => _currentMapForced = value, true); _configurationManager.OnValueChanged(CCVars.GameMapRotation, value => _mapRotationEnabled = value, true); _configurationManager.OnValueChanged(CCVars.GameMapMemoryDepth, value => { _mapQueueDepth = value; // Drain excess. while (_previousMaps.Count > _mapQueueDepth) { _previousMaps.Dequeue(); } }, true); var maps = AllVotableMaps().ToArray(); _random.Shuffle(maps); foreach (var map in maps) { if (_previousMaps.Count >= _mapQueueDepth) { break; } _previousMaps.Enqueue(map.ID); } }
public string GenerateMapName(GameMapPrototype gameMap) { if (gameMap.NameGenerator is not null && gameMap.MapNameTemplate is not null) { return(gameMap.NameGenerator.FormatName(gameMap.MapNameTemplate)); }
private bool IsMapEligible(GameMapPrototype map) { return(map.MaxPlayers >= _playerManager.PlayerCount && map.MinPlayers <= _playerManager.PlayerCount && map.Conditions.All(x => x.Check(map))); }
public override bool Check(GameMapPrototype map) { var holidaySystem = EntitySystem.Get <HolidaySystem>(); return(Holidays.Any(holiday => holidaySystem.IsCurrentlyHoliday(holiday)) ^ Inverted); }
private bool IsMapEligible(GameMapPrototype map) { return(map.MaxPlayers >= _playerManager.PlayerCount && map.MinPlayers <= _playerManager.PlayerCount); }
public abstract bool Check(GameMapPrototype map);
public StationInfoData(string name, GameMapPrototype mapPrototype, Dictionary <string, int> jobList) { Name = name; MapPrototype = mapPrototype; _jobList = jobList; }