Backend/GameLogic/CaptureZoneGenerator.CaptureZoneGenerator
Given a game start block and a zone change block interval, decide when to generate new Capture Zones.
- _generate
- generate
- getNextChangeBlock
- getZones
- isInZone
- onNewChunk
- setNextGenerationBlock
- updateCapturablePlanets
• new CaptureZoneGenerator(gameManager
, gameStartBlock
, changeInterval
)
Name | Type |
---|---|
gameManager |
default |
gameStartBlock |
number |
changeInterval |
number |
• Private
capturablePlanets: Set
<LocationId
>
• Private
changeInterval: number
• Private
gameManager: default
• Readonly
generated$: Monomitter
<CaptureZonesGeneratedEvent
>
• Private
lastChangeBlock: number
• Private
nextChangeBlock: number
• Private
zones: Set
<CaptureZone
>
• Private
get
gameObjects(): GameObjects
▸ Private
_generate(blockNumber
): Promise
<Set
<CaptureZone
>>
Name | Type |
---|---|
blockNumber |
number |
Promise
<Set
<CaptureZone
>>
▸ generate(blockNumber
): Promise
<void
>
Call when a new block is received to check if generation is needed.
Name | Type | Description |
---|---|---|
blockNumber |
number |
Current block number. |
Promise
<void
>
▸ getNextChangeBlock(): number
The next block that will trigger a Capture Zone generation.
number
▸ getZones(): Set
<CaptureZone
>
Set
<CaptureZone
>
▸ isInZone(locationId
): boolean
Is the given planet inside of a Capture Zone.
Name | Type |
---|---|
locationId |
LocationId |
boolean
▸ Private
onNewChunk(chunk
): void
Name | Type |
---|---|
chunk |
Chunk |
void
▸ Private
setNextGenerationBlock(blockNumber
): void
Name | Type |
---|---|
blockNumber |
number |
void
▸ Private
updateCapturablePlanets(): void
void