Trying to fix check fails (#1036)

* Update unique_loot.yml

* test

* slarti help

* test omega
This commit is contained in:
Ed
2025-03-18 00:41:43 +03:00
committed by GitHub
parent a6250d7491
commit 8e1f531767
4 changed files with 209 additions and 31 deletions

View File

@@ -204,45 +204,52 @@ public sealed partial class CP14DemiplaneSystem
private void GeneratorMapInit(Entity<CP14DemiplaneGeneratorDataComponent> generator, ref MapInitEvent args)
{
//Location generation
HashSet<CP14DemiplaneLocationPrototype> suitableConfigs = new();
foreach (var locationConfig in _proto.EnumeratePrototypes<CP14DemiplaneLocationPrototype>())
{
suitableConfigs.Add(locationConfig);
}
CP14DemiplaneLocationPrototype? selectedConfig = null;
while (suitableConfigs.Count > 0)
//Location generation
if (generator.Comp.Location is null)
{
var randomConfig = _random.Pick(suitableConfigs);
if (!generator.Comp.TiersContent.ContainsKey(randomConfig.Tier))
HashSet<CP14DemiplaneLocationPrototype> suitableConfigs = new();
foreach (var locationConfig in _proto.EnumeratePrototypes<CP14DemiplaneLocationPrototype>())
{
suitableConfigs.Remove(randomConfig);
continue;
suitableConfigs.Add(locationConfig);
}
if (!_random.Prob(generator.Comp.TiersContent[randomConfig.Tier]))
while (suitableConfigs.Count > 0)
{
suitableConfigs.Remove(randomConfig);
continue;
var randomConfig = _random.Pick(suitableConfigs);
if (!generator.Comp.TiersContent.ContainsKey(randomConfig.Tier))
{
suitableConfigs.Remove(randomConfig);
continue;
}
if (!_random.Prob(generator.Comp.TiersContent[randomConfig.Tier]))
{
suitableConfigs.Remove(randomConfig);
continue;
}
selectedConfig = randomConfig;
break;
}
selectedConfig = randomConfig;
break;
}
if (selectedConfig is null)
{
// We dont should be here
if (selectedConfig is null)
Log.Warning("Expedition mission generation failed: No suitable location configs.");
QueueDel(generator);
return;
}
generator.Comp.Location = selectedConfig;
}
else
{
// We dont should be here
Log.Warning("Expedition mission generation failed: No suitable location configs.");
QueueDel(generator);
return;
if (!_proto.TryIndex(generator.Comp.Location, out selectedConfig))
return;
}
generator.Comp.Location = selectedConfig;
//Modifier generation
Dictionary<CP14DemiplaneModifierPrototype, float> suitableModifiersWeights = new();
foreach (var modifier in _proto.EnumeratePrototypes<CP14DemiplaneModifierPrototype>())