Demiplane exploration map (#1251)
* dehardcode nodeTreeControl part 1 * finish * demiplane map system setup * link map entity with station data! * random demiplane map generation * redesign demiplane map node tree * center * map generate v2 * location generation * modifier generation * missing location icons * ui polish * data refactor * fix line color * ejectabling * split demiplane component into two * blocker attempt * revoking * fix frontier calculation * dimensit * demiplane core room spawning * demiplane cool destruction * Update round_end.yml * progression works now! * Update CP14NodeTree.cs * Update CP14NodeTree.cs * documentation pass * fix abusing, some balance pass * demiplane naming fix * см * location names * delete old keys * Update buy.yml * Update migration.yml * fix guidebook * Update misc.yml * Update misc.yml
This commit is contained in:
@@ -30,6 +30,9 @@ public sealed class CP14WeatherControllerSystem : EntitySystem
|
||||
|
||||
var weatherData = PickWeatherDataByWeight(uid, weather.Entries);
|
||||
|
||||
if (weatherData is null)
|
||||
continue;
|
||||
|
||||
if (!_proto.TryIndex(weatherData.Visuals, out var weatherVisualsIndexed))
|
||||
{
|
||||
var weatherDuration = TimeSpan.FromSeconds(weatherData.Duration.Next(_random));
|
||||
@@ -45,7 +48,7 @@ public sealed class CP14WeatherControllerSystem : EntitySystem
|
||||
}
|
||||
}
|
||||
|
||||
private CP14WeatherData PickWeatherDataByWeight(EntityUid map, HashSet<CP14WeatherData> entries)
|
||||
private CP14WeatherData? PickWeatherDataByWeight(EntityUid map, HashSet<CP14WeatherData> entries)
|
||||
{
|
||||
var filteredEntries = new HashSet<CP14WeatherData>(entries);
|
||||
|
||||
@@ -60,6 +63,9 @@ public sealed class CP14WeatherControllerSystem : EntitySystem
|
||||
}
|
||||
}
|
||||
|
||||
if (filteredEntries.Count == 0)
|
||||
return null;
|
||||
|
||||
var totalWeight = filteredEntries.Sum(entry => entry.Weight);
|
||||
var randomWeight = _random.NextFloat() * totalWeight;
|
||||
var currentWeight = 0f;
|
||||
|
||||
Reference in New Issue
Block a user