Skip to content

Commit

Permalink
fix: Don't spawn rogue fleets right next to home systems
Browse files Browse the repository at this point in the history
  • Loading branch information
Clashsoft committed Aug 13, 2024
1 parent bf06598 commit 7dd3ba7
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/game-logic/game-logic.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,11 @@ export class GameLogicService {

// Create fleets (ships are spawned automatically due to the fleet created handler
await this.fleetService.generateFleets(empires);
await this.fleetService.generateRogueFleets(game, systems.filter(s => !homeSystems.has(s._id.toString())));
await this.fleetService.generateRogueFleets(game, systems.filter(s =>
// Exclude systems that are home systems or have a link to a home system
!homeSystems.has(s._id.toString())
&& !Object.keys(s.links).some(neighbor => homeSystems.has(neighbor)),
));

await this.empireService.saveAll(empires);
await this.systemService.saveAll(systems);
Expand Down

0 comments on commit 7dd3ba7

Please sign in to comment.