MapChunk
Direct Subclass:
Constructor Summary
| Public Constructor | ||
| public |
constructor(root: GameRoot, x: number, y: number) |
|
Member Summary
| Public Members | ||
| public |
|
|
| public |
containedEntitiesByLayer: Record<Layer, Array<Entity>> Which entities this chunk contains, sorted by layer |
|
| public |
Stores the contents of the regular layer |
|
| public |
Stores the contents of the layers |
|
| public |
Stores the contents of the lower (= map resources) layer |
|
| public |
Store which patches we have so we can render them in the overview |
|
| public |
root: * |
|
| public |
Tile space rectangle, can be used for culling |
|
| public |
tileX: * |
|
| public |
tileY: * |
|
| public |
Stores the contents of the wires layer |
|
| public |
World space rectangle, can be used for culling |
|
| public |
x: * |
|
| public |
y: * |
|
Method Summary
| Public Methods | ||
| public |
Generates the lower layer "terrain" |
|
| public |
Checks if this chunk has predefined contents, and if so returns true and generates the predefined contents |
|
| public |
getLayerContentFromWorldCoords(worldX: number, worldY: number, layer: Layer): Entity= Returns the contents of this chunk from the given world space coordinates |
|
| public |
getLayersContentsMultipleFromWorldCoords(worldX: number, worldY: number): Array<Entity> Returns the contents of this chunk from the given world space coordinates |
|
| public |
getLowerLayerFromWorldCoords(worldX: number, worldY: number): BaseItem= |
|
| public |
getTileContentFromLocalCoords(localX: number, localY: number): Entity= Returns the chunks contents from the given local coordinates |
|
| public |
getTileContentFromWorldCoords(worldX: number, worldY: number): Entity= Returns the contents of this chunk from the given world space coordinates |
|
| public |
internalGeneratePatch(rng: RandomNumberGenerator, patchSize: number, item: any, overrideX: number=, overrideY: number=) Generates a patch filled with the given item |
|
| public |
setLayerContentFromWorldCords(tileX: number, tileY: number, contents: Entity, layer: Layer) Sets the chunks contents |
|
Public Constructors
Public Members
public containedEntitiesByLayer: Record<Layer, Array<Entity>> source
Which entities this chunk contains, sorted by layer
public lowerLayer: Array<ArrayBaseItem>> source
Stores the contents of the lower (= map resources) layer
public patches: Array<{pos: Vector, item: BaseItem, size: number}>{pos:> source
Store which patches we have so we can render them in the overview
public root: * source
public tileX: * source
public tileY: * source
public x: * source
public y: * source
Public Methods
public generatePredefined(rng: RandomNumberGenerator): boolean source
Checks if this chunk has predefined contents, and if so returns true and generates the predefined contents
Params:
| Name | Type | Attribute | Description |
| rng | RandomNumberGenerator |
public getLayerContentFromWorldCoords(worldX: number, worldY: number, layer: Layer): Entity= source
Returns the contents of this chunk from the given world space coordinates
Return:
| Entity= |
public getLayersContentsMultipleFromWorldCoords(worldX: number, worldY: number): Array<Entity> source
Returns the contents of this chunk from the given world space coordinates
public getLowerLayerFromWorldCoords(worldX: number, worldY: number): BaseItem= source
Return:
| BaseItem= |
public getTileContentFromLocalCoords(localX: number, localY: number): Entity= source
Returns the chunks contents from the given local coordinates
Return:
| Entity= |
public getTileContentFromWorldCoords(worldX: number, worldY: number): Entity= source
Returns the contents of this chunk from the given world space coordinates
Return:
| Entity= |
public internalGeneratePatch(rng: RandomNumberGenerator, patchSize: number, item: any, overrideX: number=, overrideY: number=) source
Generates a patch filled with the given item
Params:
| Name | Type | Attribute | Description |
| rng | RandomNumberGenerator | ||
| patchSize | number | ||
| item | any | ||
| overrideX | number= | Override the X position of the patch |
|
| overrideY | number= | Override the Y position of the patch |
