Skip to content

Add spawn immunity check to canBuild for structure spawning #3287

@coderabbitai

Description

@coderabbitai

Context

During spawn phase, nukes are blocked via isSpawnImmunityActive() checks in nukeSpawn(), but structure spawning methods (landBasedStructureSpawn, portSpawn) lack equivalent guards.

NationExecution (which is active during spawn phase via activeDuringSpawnPhase() => true) calls structureBehavior.handleStructures(), which then calls player.canBuild() for structures. This allows structures to be queued for construction during spawn phase via the nation AI path.

Proposed Solution

Add isSpawnImmunityActive() checks to structure spawn methods to match nuke behavior:

  • Either check inside canBuild() before calling canSpawnUnitType() for structure types
  • Or add early-return checks to landBasedStructureSpawn() and portSpawn() (mirroring nukeSpawn())

References

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Status

Complete

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions