Fix dynamic loot generation not respecting spawn point's IsAlwaysSpawn
field (!226)
A similar field can also be seen in static container generation which the value is respected Also Limited the amount of random draws to avoid going over the `desiredSpawnpointCount` - Consider a potential mod that changes every spawn point's `IsAlwaysSpawn` to true, then there is absolute no point for the generator to draw them again and only to have them removed during dedupe Co-authored-by: qe201020335 <qe201020335@sina.com> Reviewed-on: https://dev.sp-tarkov.com/SPT-AKI/Server/pulls/226 Co-authored-by: qe201020335 <qe201020335@noreply.dev.sp-tarkov.com> Co-committed-by: qe201020335 <qe201020335@noreply.dev.sp-tarkov.com>
This commit is contained in:
parent
d77c930396
commit
a1d82af41f
@ -623,7 +623,7 @@ export class LocationGenerator
|
||||
continue;
|
||||
}
|
||||
|
||||
if (spawnpoint.probability === 1)
|
||||
if (spawnpoint.probability === 1 || spawnpoint.template.IsAlwaysSpawn)
|
||||
{
|
||||
guaranteedLoosePoints.push(spawnpoint);
|
||||
continue;
|
||||
@ -636,10 +636,15 @@ export class LocationGenerator
|
||||
// Add ALL loose loot with 100% chance to pool
|
||||
let chosenSpawnpoints: Spawnpoint[] = [...guaranteedLoosePoints];
|
||||
|
||||
// Add randomly chosen spawn points
|
||||
for (const si of spawnpointArray.draw(desiredSpawnpointCount, false))
|
||||
const randomSpawnpointCount = desiredSpawnpointCount - chosenSpawnpoints.length
|
||||
// only draw random spawn points if needed
|
||||
if (randomSpawnpointCount > 0)
|
||||
{
|
||||
chosenSpawnpoints.push(spawnpointArray.data(si));
|
||||
// Add randomly chosen spawn points
|
||||
for (const si of spawnpointArray.draw(randomSpawnpointCount, false))
|
||||
{
|
||||
chosenSpawnpoints.push(spawnpointArray.data(si));
|
||||
}
|
||||
}
|
||||
|
||||
// Filter out duplicate locationIds
|
||||
|
Loading…
Reference in New Issue
Block a user