@divinevoxel/vlox 0.0.80 → 0.0.81
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Builder/Tools/Brush/BrushTool.d.ts +12 -2
- package/Builder/Tools/Brush/BrushTool.js +53 -28
- package/Builder/Tools/Debug/DebugTool.d.ts +18 -0
- package/Builder/Tools/Debug/DebugTool.js +36 -0
- package/Builder/Tools/Path/PahtTool.d.ts +1 -1
- package/Builder/Tools/Path/PahtTool.js +1 -1
- package/Builder/Tools/Sculpt/SculptTool.js +8 -0
- package/Builder/Tools/Wrench/WrenchTool.js +10 -23
- package/Builder/Util/SurfaceBoxSelection.js +2 -0
- package/Builder/VoxelBuildSpace.js +3 -3
- package/Contexts/Base/Remote/InitDataSync.js +1 -1
- package/Math/UtilFunctions.js +7 -8
- package/Math/VoxelFaces.d.ts +2 -2
- package/Math/VoxelFaces.js +46 -55
- package/Math/WorldIndexing.d.ts +11 -0
- package/Math/WorldIndexing.js +34 -0
- package/Mesher/Geometry/Geometry.types.d.ts +2 -2
- package/Mesher/Geometry/Geometry.types.js +7 -20
- package/Mesher/Geometry/Primitives/QuadVertexData.js +118 -119
- package/Mesher/Geometry/Primitives/TriangleVertexData.js +89 -90
- package/Mesher/Geometry/Proto/ProtoMesh.d.ts +1 -1
- package/Mesher/Geometry/Proto/ProtoMesh.js +22 -29
- package/Mesher/Geometry/Proto/ProtoMeshBuffer.d.ts +4 -2
- package/Mesher/Geometry/Proto/ProtoMeshBuffer.js +14 -6
- package/Mesher/Geometry/Shapes/Box.js +6 -7
- package/Mesher/Geometry/Transform/TransformBox.js +8 -9
- package/Mesher/Geometry/Transform/TransformQuad.js +4 -5
- package/Mesher/Geometry/Transform/TransformTriangle.js +3 -4
- package/Mesher/InitMesher.js +4 -9
- package/Mesher/Items/Geometry/ItemGeometryBuilder.js +7 -8
- package/Mesher/Items/MeshTexture.js +125 -57
- package/Mesher/Voxels/Base/BuildVoxel.d.ts +6 -0
- package/Mesher/Voxels/Base/BuildVoxel.js +101 -0
- package/Mesher/Voxels/Base/CompactVoxelSectionMesh.js +1 -21
- package/Mesher/Voxels/Base/MeshSectionBase.js +3 -26
- package/Mesher/Voxels/Geometry/VoxelGeometryBuilder.js +33 -31
- package/Mesher/Voxels/Geometry/VoxelShaderData.js +3 -7
- package/Mesher/Voxels/MeshTemplate.js +6 -26
- package/Mesher/Voxels/MeshVoxel.js +5 -10
- package/Mesher/Voxels/Models/Common/Calc/CalcConstants.js +41 -42
- package/Mesher/Voxels/Models/Common/Calc/FaceDataCalc.js +6 -9
- package/Mesher/Voxels/Models/Common/Faces/CullRulledFace.js +64 -47
- package/Mesher/Voxels/Models/Common/Faces/ShadeRulledFace.js +57 -43
- package/Mesher/Voxels/Models/Nodes/Custom/Liquid/FlowGradient.js +4 -5
- package/Mesher/Voxels/Models/Nodes/Custom/Liquid/LiquidGeometryNode.d.ts +1 -1
- package/Mesher/Voxels/Models/Nodes/Custom/Liquid/LiquidGeometryNode.js +116 -118
- package/Mesher/Voxels/Models/Nodes/Default/QuadVoxelGeometryNode.js +4 -4
- package/Mesher/Voxels/Models/Nodes/VoxelGeometryConstructor.js +2 -2
- package/Mesher/Voxels/Models/Procedures/Default/OutlinedTextureProcedure.js +19 -21
- package/Mesher/Voxels/Models/Procedures/Default/PillarTextureProcedure.js +45 -38
- package/Mesher/Voxels/Models/RenderedMaterials.d.ts +1 -1
- package/Mesher/Voxels/Models/RenderedMaterials.js +8 -5
- package/Mesher/Voxels/Models/VoxelGeometryBuilderCacheSpace.d.ts +18 -4
- package/Mesher/Voxels/Models/VoxelGeometryBuilderCacheSpace.js +135 -22
- package/Mesher/Voxels/Models/VoxelGeometryBuilderCacheSpaceN.d.ts +33 -0
- package/Mesher/Voxels/Models/VoxelGeometryBuilderCacheSpaceN.js +204 -0
- package/Mesher/Voxels/Models/{VoxelModelConstructorRegister.d.ts → VoxelGeometryConstructorRegister.d.ts} +1 -6
- package/Mesher/Voxels/Models/VoxelGeometryConstructorRegister.js +20 -0
- package/Mesher/Voxels/Models/VoxelModelBuilder.js +15 -16
- package/Mesher/Voxels/Models/VoxelModelEffect.d.ts +1 -3
- package/Mesher/Voxels/Models/VoxelModelEffect.js +1 -3
- package/Renderer/DVERenderNode.types.d.ts +1 -0
- package/Renderer/InitTasks.js +2 -0
- package/Tasks/Paint/Erase/EraseVoxel.js +1 -1
- package/Tasks/Propagation/Illumanation/RGBUpdate.js +191 -48
- package/Tasks/Propagation/Illumanation/SunUpdate.d.ts +1 -1
- package/Tasks/Propagation/Illumanation/SunUpdate.js +167 -63
- package/Tasks/Propagation/Illumanation/WorldSun.js +96 -60
- package/Tasks/WorldGeneration/WorldGenBrush.d.ts +2 -0
- package/Tasks/WorldGeneration/WorldGenBrush.js +31 -0
- package/Templates/Archive/ArchivedVoxelTemplate.js +1 -1
- package/Templates/Archive/Functions/CreateArchivedTemplate.js +1 -1
- package/Templates/Archive/Functions/CreateArchivedTemplateFromFull.d.ts +6 -0
- package/Templates/Archive/Functions/CreateArchivedTemplateFromFull.js +174 -0
- package/Textures/Classes/CompactedTextureReader.d.ts +22 -0
- package/Textures/Classes/CompactedTextureReader.js +90 -0
- package/Textures/Classes/CompiledTexture.d.ts +4 -1
- package/Textures/Classes/CompiledTexture.js +36 -8
- package/Textures/Classes/TextureAtlasIndex.d.ts +7 -0
- package/Textures/Classes/TextureAtlasIndex.js +14 -0
- package/Textures/Classes/TextureLoader.d.ts +20 -0
- package/Textures/Classes/TextureLoader.js +95 -0
- package/Textures/Functions/BuildTextureData.d.ts +1 -1
- package/Textures/Functions/BuildTextureData.js +19 -122
- package/Textures/Functions/CreateCompactedTexture.d.ts +6 -0
- package/Textures/Functions/CreateCompactedTexture.js +105 -0
- package/Textures/Functions/ReadCompactedTexture.d.ts +2 -0
- package/Textures/Functions/ReadCompactedTexture.js +42 -0
- package/Textures/Texture.types.d.ts +14 -0
- package/Textures/TextureManager.d.ts +7 -1
- package/Textures/TextureManager.js +13 -0
- package/Tools/Brush/Brush.d.ts +4 -2
- package/Tools/Brush/Brush.js +28 -6
- package/Util/BinaryBuffer/Functions/BinaryBufferConvert.d.ts +1 -1
- package/Util/TickInterval.d.ts +3 -0
- package/Util/TickInterval.js +31 -3
- package/Voxels/Archive/VoxelPaletteArchiveReader.d.ts +1 -0
- package/Voxels/Archive/VoxelPaletteArchiveReader.js +9 -10
- package/Voxels/Archive/VoxelPaletteArechive.js +5 -4
- package/Voxels/Cursor/VoxelCursor.interface.d.ts +1 -1
- package/Voxels/Cursor/VoxelCursor.interface.js +22 -16
- package/Voxels/Data/VoxelLUT.d.ts +69 -42
- package/Voxels/Data/VoxelLUT.js +110 -53
- package/Voxels/Functions/BuildLUTs.js +100 -45
- package/Voxels/Functions/Geometry/CalcFunctions.js +6 -7
- package/Voxels/Functions/Geometry/Inputs/BuildTriangleInputs.js +3 -0
- package/Voxels/Indexes/VoxelIndex.js +3 -1
- package/Voxels/InitVoxelData.js +3 -1
- package/Voxels/Interaction/Functions/PickVoxel.js +3 -5
- package/Voxels/Interaction/Functions/PickVoxelWorld.js +4 -6
- package/Voxels/Models/Defaults/Examples.d.ts +2 -0
- package/Voxels/Models/Defaults/Examples.js +151 -2
- package/Voxels/State/Reltional/ReltionalStateBuilder.js +2 -0
- package/Voxels/State/Schema/BinarySchema.d.ts +1 -0
- package/Voxels/State/Schema/BinarySchema.js +14 -0
- package/Voxels/State/VoxelSchemas.d.ts +11 -4
- package/Voxels/State/VoxelSchemas.js +42 -9
- package/Voxels/Types/PaintVoxelData.js +6 -2
- package/World/Archive/Classes/ImportedSection.js +1 -1
- package/World/Archive/Classes/ImportedSector.js +0 -1
- package/World/Archive/Functions/Sector/ArchiveSector.js +2 -2
- package/World/Archive/Functions/Sector/ImportSector.d.ts +1 -0
- package/World/Archive/Functions/Sector/ImportSector.js +183 -7
- package/World/Cursor/SectorCursor.js +1 -4
- package/World/Cursor/WorldCursor.d.ts +12 -3
- package/World/Cursor/WorldCursor.js +60 -30
- package/World/InitTasks.js +1 -1
- package/World/Lock/Function/LockSectors.js +5 -1
- package/World/Lock/Function/UnLockSectors.js +5 -1
- package/World/SnapShot/SectionSnapShot.d.ts +7 -3
- package/World/SnapShot/SectionSnapShot.js +47 -21
- package/World/SnapShot/SectionSnapShotCursor.d.ts +4 -2
- package/World/SnapShot/SectionSnapShotCursor.js +23 -11
- package/World/SnapShot/SnapShots.d.ts +1 -2
- package/World/SnapShot/SnapShots.js +3 -3
- package/World/WorldSpaces.d.ts +7 -0
- package/World/WorldSpaces.js +35 -13
- package/WorldSimulation/Dimensions/DimensionSegment.d.ts +2 -0
- package/WorldSimulation/Dimensions/DimensionSegment.js +9 -1
- package/WorldSimulation/Dimensions/DimensionSimulation.js +6 -7
- package/WorldSimulation/Dimensions/Generator.d.ts +4 -0
- package/WorldSimulation/Dimensions/Generator.js +15 -1
- package/WorldSimulation/Dimensions/SimulationSector.d.ts +1 -0
- package/WorldSimulation/Dimensions/SimulationSector.js +18 -0
- package/WorldSimulation/Internal/WorldSimulationTasks.js +11 -7
- package/WorldSimulation/Procedures/InitalLoad.d.ts +1 -0
- package/WorldSimulation/Procedures/InitalLoad.js +18 -8
- package/WorldSimulation/Tasks/SimulationTaskBase.d.ts +4 -1
- package/WorldSimulation/Tasks/SimulationTaskBase.js +13 -2
- package/WorldSimulation/Tasks/TaskSegment.d.ts +4 -2
- package/WorldSimulation/Tasks/TaskSegment.js +36 -22
- package/WorldSimulation/Voxels/Ticks/Types/LiquidVoxelUpdate.js +1 -2
- package/WorldSimulation/WorldSimulation.d.ts +6 -3
- package/WorldSimulation/WorldSimulation.js +44 -20
- package/package.json +1 -1
- package/Mesher/Items/MeshTextureO.d.ts +0 -1
- package/Mesher/Items/MeshTextureO.js +0 -277
- package/Mesher/Voxels/Models/VoxelConstructor.d.ts +0 -8
- package/Mesher/Voxels/Models/VoxelConstructor.js +0 -78
- package/Mesher/Voxels/Models/VoxelModelConstructorRegister.js +0 -37
- package/WorldSimulation/Procedures/BuildOnly.d.ts +0 -10
- package/WorldSimulation/Procedures/BuildOnly.js +0 -55
|
@@ -1,46 +1,71 @@
|
|
|
1
|
-
import { Flat3DIndex } from "@amodx/math";
|
|
2
1
|
import { WorldSpaces } from "../WorldSpaces";
|
|
3
2
|
import { Section } from "../Section/Section";
|
|
4
3
|
import { WorldRegister } from "../WorldRegister";
|
|
5
4
|
export class SectionSnapShot {
|
|
6
5
|
sections = [];
|
|
7
6
|
location = [0, 0, 0, 0];
|
|
8
|
-
index = Flat3DIndex.GetXYZOrder();
|
|
9
7
|
_buffers = [];
|
|
8
|
+
_used = [];
|
|
9
|
+
_sectionSizeX = 0;
|
|
10
|
+
_sectionSizeY = 0;
|
|
11
|
+
_sectionSizeZ = 0;
|
|
10
12
|
constructor() {
|
|
11
|
-
|
|
12
|
-
let
|
|
13
|
-
while (totalSections--) {
|
|
13
|
+
const totalSections = 27;
|
|
14
|
+
for (let i = 0; i < totalSections; i++) {
|
|
14
15
|
const buffer = new ArrayBuffer(Section.GetBufferSize());
|
|
15
16
|
this.sections.push(new Uint8Array(buffer));
|
|
16
17
|
this._buffers.push(buffer);
|
|
18
|
+
this._used[i] = false;
|
|
17
19
|
}
|
|
20
|
+
this._updateSizes();
|
|
18
21
|
}
|
|
19
|
-
|
|
22
|
+
_updateSizes() {
|
|
23
|
+
this._sectionSizeX = WorldSpaces.section.bounds.x;
|
|
24
|
+
this._sectionSizeY = WorldSpaces.section.bounds.y;
|
|
25
|
+
this._sectionSizeZ = WorldSpaces.section.bounds.z;
|
|
26
|
+
}
|
|
27
|
+
setLocation(dimension, x, y, z) {
|
|
20
28
|
this.location[0] = dimension;
|
|
21
29
|
this.location[1] = x;
|
|
22
30
|
this.location[2] = y;
|
|
23
31
|
this.location[3] = z;
|
|
24
32
|
}
|
|
25
33
|
storeSnapShot() {
|
|
26
|
-
const
|
|
27
|
-
const
|
|
28
|
-
|
|
34
|
+
const sizeX = this._sectionSizeX;
|
|
35
|
+
const sizeY = this._sectionSizeY;
|
|
36
|
+
const sizeZ = this._sectionSizeZ;
|
|
37
|
+
const dim = this.location[0];
|
|
38
|
+
const ox = this.location[1];
|
|
39
|
+
const oy = this.location[2];
|
|
40
|
+
const oz = this.location[3];
|
|
41
|
+
const sections = this.sections;
|
|
42
|
+
const used = this._used;
|
|
43
|
+
const world = WorldSpaces.world;
|
|
44
|
+
const sectorReg = WorldRegister.sectors;
|
|
45
|
+
let index = 0;
|
|
46
|
+
for (let z = 0; z < 3; z++) {
|
|
47
|
+
const wz = oz + (z - 1) * sizeZ;
|
|
29
48
|
for (let y = 0; y < 3; y++) {
|
|
30
|
-
|
|
49
|
+
const wy = oy + (y - 1) * sizeY;
|
|
50
|
+
for (let x = 0; x < 3; x++) {
|
|
31
51
|
const wx = ox + (x - 1) * sizeX;
|
|
32
|
-
const
|
|
33
|
-
const
|
|
34
|
-
const
|
|
35
|
-
if (!
|
|
36
|
-
|
|
52
|
+
const i = index++;
|
|
53
|
+
const snapShotSection = sections[i];
|
|
54
|
+
const beenUsed = used[i];
|
|
55
|
+
if (!world.inBounds(wx, wy, wz)) {
|
|
56
|
+
if (beenUsed)
|
|
57
|
+
snapShotSection.fill(0);
|
|
58
|
+
used[i] = false;
|
|
37
59
|
continue;
|
|
38
60
|
}
|
|
39
|
-
const sector =
|
|
61
|
+
const sector = sectorReg.get(dim, wx, wy, wz);
|
|
40
62
|
if (!sector) {
|
|
41
|
-
|
|
63
|
+
if (beenUsed)
|
|
64
|
+
snapShotSection.fill(0);
|
|
65
|
+
used[i] = false;
|
|
42
66
|
continue;
|
|
43
67
|
}
|
|
68
|
+
used[i] = true;
|
|
44
69
|
snapShotSection.set(sector.getSection(wx, wy, wz).view);
|
|
45
70
|
}
|
|
46
71
|
}
|
|
@@ -54,8 +79,9 @@ export class SectionSnapShot {
|
|
|
54
79
|
this._isTransfered = true;
|
|
55
80
|
return [
|
|
56
81
|
{
|
|
57
|
-
location:
|
|
58
|
-
sections:
|
|
82
|
+
location: this.location,
|
|
83
|
+
sections: this.sections,
|
|
84
|
+
used: this._used,
|
|
59
85
|
},
|
|
60
86
|
this._buffers,
|
|
61
87
|
];
|
|
@@ -63,10 +89,10 @@ export class SectionSnapShot {
|
|
|
63
89
|
restore(data) {
|
|
64
90
|
this.sections = data.sections;
|
|
65
91
|
this.location = data.location;
|
|
66
|
-
this.
|
|
92
|
+
this._used = data.used;
|
|
67
93
|
this._isTransfered = false;
|
|
68
94
|
for (let i = 0; i < this.sections.length; i++) {
|
|
69
|
-
this._buffers
|
|
95
|
+
this._buffers[i] = this.sections[i].buffer;
|
|
70
96
|
}
|
|
71
97
|
}
|
|
72
98
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Vector3Like } from "@amodx/math";
|
|
2
2
|
import { DataCursorInterface } from "../../Voxels/Cursor/DataCursor.interface";
|
|
3
3
|
import { SectionSnapShot } from "./SectionSnapShot";
|
|
4
4
|
import { Sector } from "../Sector";
|
|
@@ -12,7 +12,9 @@ export declare class SectionSnapshotCursor implements DataCursorInterface {
|
|
|
12
12
|
volumeBounds: BoundingBox;
|
|
13
13
|
sectors: Sector[];
|
|
14
14
|
cursors: SectorCursor[];
|
|
15
|
-
|
|
15
|
+
private invSectorSizeX;
|
|
16
|
+
private invSectorSizeY;
|
|
17
|
+
private invSectorSizeZ;
|
|
16
18
|
constructor();
|
|
17
19
|
private updateBounds;
|
|
18
20
|
private _snapShot;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Vector3Like } from "@amodx/math";
|
|
2
2
|
import { WorldSpaces } from "../WorldSpaces";
|
|
3
3
|
import { Sector } from "../Sector";
|
|
4
4
|
import { SectorCursor } from "../Cursor/SectorCursor";
|
|
@@ -12,16 +12,22 @@ export class SectionSnapshotCursor {
|
|
|
12
12
|
volumeBounds = new BoundingBox();
|
|
13
13
|
sectors = [];
|
|
14
14
|
cursors = [];
|
|
15
|
-
|
|
15
|
+
invSectorSizeX = 0;
|
|
16
|
+
invSectorSizeY = 0;
|
|
17
|
+
invSectorSizeZ = 0;
|
|
16
18
|
constructor() {
|
|
17
|
-
|
|
19
|
+
// Initialize inverse sizes FIRST
|
|
20
|
+
this.invSectorSizeX = 1 / WorldSpaces.sector.bounds.x;
|
|
21
|
+
this.invSectorSizeY = 1 / WorldSpaces.sector.bounds.y;
|
|
22
|
+
this.invSectorSizeZ = 1 / WorldSpaces.sector.bounds.z;
|
|
18
23
|
const { x: sizeX, y: sizeY, z: sizeZ } = WorldSpaces.sector.bounds;
|
|
19
24
|
for (let x = 0; x < 3; x++) {
|
|
20
25
|
for (let y = 0; y < 3; y++) {
|
|
21
26
|
for (let z = 0; z < 3; z++) {
|
|
22
27
|
if (!WorldSpaces.world.inBounds((x - 1) * sizeX, (y - 1) * sizeY, (z - 1) * sizeZ))
|
|
23
28
|
continue;
|
|
24
|
-
|
|
29
|
+
// Use direct index calculation here — we're iterating grid positions, not world coords
|
|
30
|
+
const sectorIndex = x + y * 3 + z * 9;
|
|
25
31
|
const sector = new Sector();
|
|
26
32
|
sector.setBuffer(Sector.CreateNewBuffer());
|
|
27
33
|
const cursor = new SectorCursor();
|
|
@@ -35,6 +41,9 @@ export class SectionSnapshotCursor {
|
|
|
35
41
|
}
|
|
36
42
|
updateBounds() {
|
|
37
43
|
this.volumeBounds.setMinMax(Vector3Like.Create(WorldSpaces.world.bounds.MinX, WorldSpaces.world.bounds.MinY, WorldSpaces.world.bounds.MinZ), Vector3Like.Create(WorldSpaces.world.bounds.MaxX, WorldSpaces.world.bounds.MaxY, WorldSpaces.world.bounds.MaxZ));
|
|
44
|
+
this.invSectorSizeX = 1 / WorldSpaces.sector.bounds.x;
|
|
45
|
+
this.invSectorSizeY = 1 / WorldSpaces.sector.bounds.y;
|
|
46
|
+
this.invSectorSizeZ = 1 / WorldSpaces.sector.bounds.z;
|
|
38
47
|
}
|
|
39
48
|
_snapShot;
|
|
40
49
|
_centeralCursor = new SectionCursor();
|
|
@@ -62,7 +71,8 @@ export class SectionSnapshotCursor {
|
|
|
62
71
|
for (let x = 0; x < 3; x++) {
|
|
63
72
|
for (let y = 0; y < 3; y++) {
|
|
64
73
|
for (let z = 0; z < 3; z++) {
|
|
65
|
-
|
|
74
|
+
// Direct index — these are grid positions, not world coords
|
|
75
|
+
const sectorIndex = x + y * 3 + z * 9;
|
|
66
76
|
const sector = this.sectors[sectorIndex];
|
|
67
77
|
if (!sector)
|
|
68
78
|
continue;
|
|
@@ -89,23 +99,25 @@ export class SectionSnapshotCursor {
|
|
|
89
99
|
continue;
|
|
90
100
|
const section = sector.getSection(sectionX, sectionY, sectionZ);
|
|
91
101
|
section.updatePosition();
|
|
92
|
-
section.view.set(snapShot.sections[
|
|
102
|
+
section.view.set(snapShot.sections[x + y * 3 + z * 9]);
|
|
93
103
|
}
|
|
94
104
|
}
|
|
95
105
|
}
|
|
96
106
|
}
|
|
97
107
|
getSectorIndex(x, y, z) {
|
|
98
|
-
const
|
|
99
|
-
|
|
108
|
+
const ix = ((x - this.sectorOrigin.x) * this.invSectorSizeX + 1) | 0;
|
|
109
|
+
const iy = ((y - this.sectorOrigin.y) * this.invSectorSizeY + 1) | 0;
|
|
110
|
+
const iz = ((z - this.sectorOrigin.z) * this.invSectorSizeZ + 1) | 0;
|
|
111
|
+
return ix + iy * 3 + iz * 9;
|
|
100
112
|
}
|
|
101
113
|
inBounds(x, y, z) {
|
|
102
114
|
return WorldSpaces.world.inBounds(x, y, z);
|
|
103
115
|
}
|
|
104
116
|
getVoxel(x, y, z) {
|
|
105
|
-
const
|
|
106
|
-
if (!
|
|
117
|
+
const cursor = this.cursors[this.getSectorIndex(x, y, z)];
|
|
118
|
+
if (!cursor)
|
|
107
119
|
return null;
|
|
108
|
-
return
|
|
120
|
+
return cursor.getVoxel(x, y, z);
|
|
109
121
|
}
|
|
110
122
|
clone() {
|
|
111
123
|
return new SectionSnapshotCursor();
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { LocationData } from "../../Math";
|
|
2
1
|
import { SectionSnapShot } from "./SectionSnapShot";
|
|
3
2
|
import { BoundingBox } from "@amodx/math/Geometry/Bounds/BoundingBox";
|
|
4
3
|
export declare class SnapShots {
|
|
@@ -6,6 +5,6 @@ export declare class SnapShots {
|
|
|
6
5
|
static _pendingCache: SectionSnapShot[];
|
|
7
6
|
private static bounds;
|
|
8
7
|
static getSnapShotBounds(x: number, y: number, z: number): Readonly<BoundingBox>;
|
|
9
|
-
static createSnapShot(
|
|
8
|
+
static createSnapShot(dimension: number, x: number, y: number, z: number): SectionSnapShot;
|
|
10
9
|
static transferSnapShot(snapShot: SectionSnapShot): void;
|
|
11
10
|
}
|
|
@@ -10,11 +10,11 @@ export class SnapShots {
|
|
|
10
10
|
this.bounds.setMinMax(WorldSpaces.section.transformPosition(Vector3Like.Subtract({ x, y, z }, WorldSpaces.section.bounds)), WorldSpaces.section.transformPosition(Vector3Like.Add({ x, y, z }, WorldSpaces.section.bounds)));
|
|
11
11
|
return this.bounds;
|
|
12
12
|
}
|
|
13
|
-
static createSnapShot(
|
|
13
|
+
static createSnapShot(dimension, x, y, z) {
|
|
14
14
|
let snapShot = this._readyCache.length
|
|
15
|
-
? this._readyCache.
|
|
15
|
+
? this._readyCache.pop()
|
|
16
16
|
: new SectionSnapShot();
|
|
17
|
-
snapShot.setLocation(
|
|
17
|
+
snapShot.setLocation(dimension, x, y, z);
|
|
18
18
|
snapShot.storeSnapShot();
|
|
19
19
|
return snapShot;
|
|
20
20
|
}
|
package/World/WorldSpaces.d.ts
CHANGED
|
@@ -40,6 +40,10 @@ declare class SectorSpace {
|
|
|
40
40
|
static bounds: Vector3Like;
|
|
41
41
|
static volumne: number;
|
|
42
42
|
static sectionBounds: Vector3Like;
|
|
43
|
+
static sectionPower2Axes: Vector3Like;
|
|
44
|
+
static sectionXZPower: number;
|
|
45
|
+
static sectionZMask: number;
|
|
46
|
+
static sectionXMask: number;
|
|
43
47
|
static sectionVolumne: number;
|
|
44
48
|
static getPosition(x: number, y: number, z: number, refPosition?: Vector3Like): Vector3Like;
|
|
45
49
|
static transformPosition(position: Vector3Like): Vector3Like;
|
|
@@ -49,6 +53,9 @@ declare class SectionSpace {
|
|
|
49
53
|
static power2Axes: Vector3Like;
|
|
50
54
|
static bounds: Vector3Like;
|
|
51
55
|
static volumne: number;
|
|
56
|
+
static xzPower: number;
|
|
57
|
+
static zMask: number;
|
|
58
|
+
static xMask: number;
|
|
52
59
|
static getPosition(x: number, y: number, z: number, refPosition?: Vector3Like): Vector3Like;
|
|
53
60
|
static transformPosition(position: Vector3Like): Vector3Like;
|
|
54
61
|
static getPositionVec3Array(x: number, y: number, z: number, refPosition?: Vec3Array): Vec3Array;
|
package/World/WorldSpaces.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
//types
|
|
2
1
|
import { EngineSettings } from "../Settings/EngineSettings.js";
|
|
3
2
|
import { Vector3Like } from "@amodx/math";
|
|
4
|
-
import { CubeHashVec3, CubeHashVec3Array, GetYXZOrderArrayIndex, GetYXZOrderArrayPositionVec3, GetYXZOrderArrayPositionVec3Array, } from "../Math/
|
|
3
|
+
import { CubeHashVec3, CubeHashVec3Array, GetYXZOrderArrayIndex, GetYXZOrderArrayPositionVec3, GetYXZOrderArrayPositionVec3Array, } from "../Math/WorldIndexing.js";
|
|
5
4
|
const tempPosition = Vector3Like.Create();
|
|
6
5
|
const tempPosition2 = Vector3Like.Create();
|
|
7
6
|
class WorldBounds {
|
|
@@ -16,7 +15,7 @@ class WorldBounds {
|
|
|
16
15
|
static setWorldBounds(minX, minY, minZ, maxX, maxY, maxZ) {
|
|
17
16
|
this.bounds.MinX = minX;
|
|
18
17
|
this.bounds.MaxX = maxX;
|
|
19
|
-
this.bounds.
|
|
18
|
+
this.bounds.MinZ = minZ;
|
|
20
19
|
this.bounds.MaxZ = maxZ;
|
|
21
20
|
this.bounds.MinY = minY;
|
|
22
21
|
this.bounds.MaxY = maxY;
|
|
@@ -58,6 +57,10 @@ class SectorSpace {
|
|
|
58
57
|
static bounds = Vector3Like.Create();
|
|
59
58
|
static volumne = 0;
|
|
60
59
|
static sectionBounds = Vector3Like.Create();
|
|
60
|
+
static sectionPower2Axes = Vector3Like.Create();
|
|
61
|
+
static sectionXZPower = 0;
|
|
62
|
+
static sectionZMask = 0;
|
|
63
|
+
static sectionXMask = 0;
|
|
61
64
|
static sectionVolumne = 0;
|
|
62
65
|
static getPosition(x, y, z, refPosition = Vector3Like.Create()) {
|
|
63
66
|
CubeHashVec3(x, y, z, SectorSpace.power2Axes.x, SectorSpace.power2Axes.y, SectorSpace.power2Axes.z, refPosition);
|
|
@@ -76,6 +79,9 @@ class SectionSpace {
|
|
|
76
79
|
static power2Axes = Vector3Like.Create();
|
|
77
80
|
static bounds = Vector3Like.Create();
|
|
78
81
|
static volumne = 0;
|
|
82
|
+
static xzPower = 0;
|
|
83
|
+
static zMask = 0;
|
|
84
|
+
static xMask = 0;
|
|
79
85
|
static getPosition(x, y, z, refPosition = Vector3Like.Create()) {
|
|
80
86
|
CubeHashVec3(x, y, z, SectionSpace.power2Axes.x, SectionSpace.power2Axes.y, SectionSpace.power2Axes.z, refPosition);
|
|
81
87
|
return refPosition;
|
|
@@ -85,19 +91,19 @@ class SectionSpace {
|
|
|
85
91
|
return position;
|
|
86
92
|
}
|
|
87
93
|
static getPositionVec3Array(x, y, z, refPosition = [0, 0, 0]) {
|
|
88
|
-
CubeHashVec3Array(x, y, z, SectionSpace.
|
|
94
|
+
CubeHashVec3Array(x, y, z, SectionSpace.power2Axes.x, SectionSpace.power2Axes.y, SectionSpace.power2Axes.z, refPosition);
|
|
89
95
|
return refPosition;
|
|
90
96
|
}
|
|
91
97
|
static getIndex(x, y, z) {
|
|
92
98
|
SectionSpace.getPosition(x, y, z, tempPosition);
|
|
93
99
|
SectorSpace.getPosition(x, y, z, tempPosition2);
|
|
94
|
-
return GetYXZOrderArrayIndex((tempPosition.x - tempPosition2.x)
|
|
100
|
+
return GetYXZOrderArrayIndex((tempPosition.x - tempPosition2.x) >> SectionSpace.power2Axes.x, (tempPosition.y - tempPosition2.y) >> SectionSpace.power2Axes.y, (tempPosition.z - tempPosition2.z) >> SectionSpace.power2Axes.z, SectorSpace.sectionPower2Axes.z, SectorSpace.sectionXZPower);
|
|
95
101
|
}
|
|
96
102
|
static getPositionFromIndex(index, refPosition = Vector3Like.Create()) {
|
|
97
|
-
return GetYXZOrderArrayPositionVec3(index, SectorSpace.
|
|
103
|
+
return GetYXZOrderArrayPositionVec3(index, SectorSpace.sectionPower2Axes.z, SectorSpace.sectionXZPower, SectorSpace.sectionZMask, SectorSpace.sectionXMask, refPosition);
|
|
98
104
|
}
|
|
99
105
|
static getPositionFromIndexVec3Array(index, refPosition = [0, 0, 0]) {
|
|
100
|
-
return GetYXZOrderArrayPositionVec3Array(index, SectorSpace.
|
|
106
|
+
return GetYXZOrderArrayPositionVec3Array(index, SectorSpace.sectionPower2Axes.z, SectorSpace.sectionXZPower, SectorSpace.sectionZMask, SectorSpace.sectionXMask, refPosition);
|
|
101
107
|
}
|
|
102
108
|
}
|
|
103
109
|
class VoxelSpace {
|
|
@@ -125,14 +131,14 @@ class VoxelSpace {
|
|
|
125
131
|
return position;
|
|
126
132
|
}
|
|
127
133
|
static getPositionFromIndex(index, refPosition = Vector3Like.Create()) {
|
|
128
|
-
return GetYXZOrderArrayPositionVec3(index, SectionSpace.
|
|
134
|
+
return GetYXZOrderArrayPositionVec3(index, SectionSpace.power2Axes.z, SectionSpace.xzPower, SectionSpace.zMask, SectionSpace.xMask, refPosition);
|
|
129
135
|
}
|
|
130
136
|
static getIndex(x, y, z) {
|
|
131
137
|
const position = this.getPosition(x, y, z, tempPosition);
|
|
132
|
-
return GetYXZOrderArrayIndex(position.x, position.y, position.z, SectionSpace.
|
|
138
|
+
return GetYXZOrderArrayIndex(position.x, position.y, position.z, SectionSpace.power2Axes.z, SectionSpace.xzPower);
|
|
133
139
|
}
|
|
134
140
|
static getIndexFromPosition(x, y, z) {
|
|
135
|
-
return GetYXZOrderArrayIndex(x, y, z, SectionSpace.
|
|
141
|
+
return GetYXZOrderArrayIndex(x, y, z, SectionSpace.power2Axes.z, SectionSpace.xzPower);
|
|
136
142
|
}
|
|
137
143
|
}
|
|
138
144
|
class Hash {
|
|
@@ -189,11 +195,27 @@ EngineSettings.addEventListener("synced", (event) => {
|
|
|
189
195
|
SectionSpace.bounds.z = 1 << SectionSpace.power2Axes.z;
|
|
190
196
|
SectionSpace.volumne =
|
|
191
197
|
SectionSpace.bounds.x * SectionSpace.bounds.y * SectionSpace.bounds.z;
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
198
|
+
SectionSpace.xzPower = SectionSpace.power2Axes.x + SectionSpace.power2Axes.z;
|
|
199
|
+
SectionSpace.zMask = SectionSpace.bounds.z - 1;
|
|
200
|
+
SectionSpace.xMask = SectionSpace.bounds.x - 1;
|
|
201
|
+
SectorSpace.sectionBounds.x =
|
|
202
|
+
SectorSpace.bounds.x >> SectionSpace.power2Axes.x;
|
|
203
|
+
SectorSpace.sectionBounds.y =
|
|
204
|
+
SectorSpace.bounds.y >> SectionSpace.power2Axes.y;
|
|
205
|
+
SectorSpace.sectionBounds.z =
|
|
206
|
+
SectorSpace.bounds.z >> SectionSpace.power2Axes.z;
|
|
195
207
|
SectorSpace.sectionVolumne =
|
|
196
208
|
SectorSpace.sectionBounds.x *
|
|
197
209
|
SectorSpace.sectionBounds.y *
|
|
198
210
|
SectorSpace.sectionBounds.z;
|
|
211
|
+
SectorSpace.sectionPower2Axes.x =
|
|
212
|
+
SectorSpace.power2Axes.x - SectionSpace.power2Axes.x;
|
|
213
|
+
SectorSpace.sectionPower2Axes.y =
|
|
214
|
+
SectorSpace.power2Axes.y - SectionSpace.power2Axes.y;
|
|
215
|
+
SectorSpace.sectionPower2Axes.z =
|
|
216
|
+
SectorSpace.power2Axes.z - SectionSpace.power2Axes.z;
|
|
217
|
+
SectorSpace.sectionXZPower =
|
|
218
|
+
SectorSpace.sectionPower2Axes.x + SectorSpace.sectionPower2Axes.z;
|
|
219
|
+
SectorSpace.sectionZMask = SectorSpace.sectionBounds.z - 1;
|
|
220
|
+
SectorSpace.sectionXMask = SectorSpace.sectionBounds.x - 1;
|
|
199
221
|
});
|
|
@@ -11,6 +11,7 @@ declare class ActiveSectors {
|
|
|
11
11
|
_map: Map<string, SimulationSector>;
|
|
12
12
|
constructor(dimension: DimensionSegment);
|
|
13
13
|
add(x: number, y: number, z: number): false | undefined;
|
|
14
|
+
clearAll(): void;
|
|
14
15
|
get(x: number, y: number, z: number): SimulationSector | null | undefined;
|
|
15
16
|
remove(x: number, y: number, z: number): false | undefined;
|
|
16
17
|
}
|
|
@@ -33,6 +34,7 @@ export declare class DimensionSegment {
|
|
|
33
34
|
addTask(id: string, generationTask: boolean): void;
|
|
34
35
|
getTask(id: string): TaskSegment;
|
|
35
36
|
clearAllTasks(): void;
|
|
37
|
+
clearAll(): void;
|
|
36
38
|
logTasks(): string;
|
|
37
39
|
}
|
|
38
40
|
export {};
|
|
@@ -24,6 +24,10 @@ class ActiveSectors {
|
|
|
24
24
|
this._sectors.push(newSector);
|
|
25
25
|
this._map.set(key, newSector);
|
|
26
26
|
}
|
|
27
|
+
clearAll() {
|
|
28
|
+
this._sectors = [];
|
|
29
|
+
this._map.clear();
|
|
30
|
+
}
|
|
27
31
|
get(x, y, z) {
|
|
28
32
|
const key = WorldSpaces.hash.hashVec3(WorldSpaces.sector.getPosition(x, y, z, tempPosition));
|
|
29
33
|
if (!this._map.has(key))
|
|
@@ -107,9 +111,13 @@ export class DimensionSegment {
|
|
|
107
111
|
}
|
|
108
112
|
clearAllTasks() {
|
|
109
113
|
for (const [key, task] of this.tasks) {
|
|
110
|
-
task.
|
|
114
|
+
task.clearAll();
|
|
111
115
|
}
|
|
112
116
|
}
|
|
117
|
+
clearAll() {
|
|
118
|
+
this.activeSectors.clearAll();
|
|
119
|
+
this.clearAllTasks();
|
|
120
|
+
}
|
|
113
121
|
logTasks() {
|
|
114
122
|
const tasks = [];
|
|
115
123
|
for (const [key, task] of this.tasks) {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { WorldSpaces } from "../../World/WorldSpaces";
|
|
2
|
-
import { VoxelFaces } from "../../Math";
|
|
3
2
|
import { WorldCursor } from "../../World/Cursor/WorldCursor";
|
|
4
3
|
import { WorldRegister } from "../../World/WorldRegister";
|
|
5
4
|
import { Vector3Like } from "@amodx/math";
|
|
@@ -72,12 +71,12 @@ export class DimensionSimulation {
|
|
|
72
71
|
nDataCursor = new WorldCursor();
|
|
73
72
|
sDataCursor = new WorldCursor();
|
|
74
73
|
tickCursor = {
|
|
75
|
-
[VoxelFaces.Up]: new WorldCursor(),
|
|
76
|
-
[VoxelFaces.Down]: new WorldCursor(),
|
|
77
|
-
[VoxelFaces.North]: new WorldCursor(),
|
|
78
|
-
[VoxelFaces.South]: new WorldCursor(),
|
|
79
|
-
[VoxelFaces.East]: new WorldCursor(),
|
|
80
|
-
[VoxelFaces.West]: new WorldCursor(),
|
|
74
|
+
[0 /* VoxelFaces.Up */]: new WorldCursor(),
|
|
75
|
+
[1 /* VoxelFaces.Down */]: new WorldCursor(),
|
|
76
|
+
[2 /* VoxelFaces.North */]: new WorldCursor(),
|
|
77
|
+
[3 /* VoxelFaces.South */]: new WorldCursor(),
|
|
78
|
+
[4 /* VoxelFaces.East */]: new WorldCursor(),
|
|
79
|
+
[5 /* VoxelFaces.West */]: new WorldCursor(),
|
|
81
80
|
};
|
|
82
81
|
bounds = new UpdatedBounds();
|
|
83
82
|
brush;
|
|
@@ -17,6 +17,7 @@ export declare class Generator {
|
|
|
17
17
|
_generating: boolean;
|
|
18
18
|
_isNew: boolean;
|
|
19
19
|
_dirty: boolean;
|
|
20
|
+
_valuesUpdated: boolean;
|
|
20
21
|
_waitingForCull: boolean;
|
|
21
22
|
_cullTime: number;
|
|
22
23
|
_culling: boolean;
|
|
@@ -27,5 +28,8 @@ export declare class Generator {
|
|
|
27
28
|
_renderCircle: Circle;
|
|
28
29
|
_maxCircle: Circle;
|
|
29
30
|
constructor(data: GeneratorData);
|
|
31
|
+
setRenderRadius(value: number): void;
|
|
32
|
+
setGenRadius(value: number): void;
|
|
33
|
+
setMaxRadius(value: number): void;
|
|
30
34
|
update(): void;
|
|
31
35
|
}
|
|
@@ -8,6 +8,7 @@ export class Generator {
|
|
|
8
8
|
_generating = true;
|
|
9
9
|
_isNew = true;
|
|
10
10
|
_dirty = true;
|
|
11
|
+
_valuesUpdated = false;
|
|
11
12
|
_waitingForCull = false;
|
|
12
13
|
_cullTime = 0;
|
|
13
14
|
_culling = true;
|
|
@@ -28,8 +29,21 @@ export class Generator {
|
|
|
28
29
|
this._tickCircle.radius = data.generationRadius;
|
|
29
30
|
this._maxCircle.radius = data.maxRadius;
|
|
30
31
|
}
|
|
32
|
+
setRenderRadius(value) {
|
|
33
|
+
this._renderCircle.radius = value;
|
|
34
|
+
this._valuesUpdated = true;
|
|
35
|
+
}
|
|
36
|
+
setGenRadius(value) {
|
|
37
|
+
this._genCircle.radius = value;
|
|
38
|
+
this._valuesUpdated = true;
|
|
39
|
+
}
|
|
40
|
+
setMaxRadius(value) {
|
|
41
|
+
this._maxCircle.radius = value;
|
|
42
|
+
this._valuesUpdated = true;
|
|
43
|
+
}
|
|
31
44
|
update() {
|
|
32
|
-
this._dirty =
|
|
45
|
+
this._dirty = this._valuesUpdated;
|
|
46
|
+
this._valuesUpdated = false;
|
|
33
47
|
WorldSpaces.section.getPosition(this.position.x, 0, this.position.z, this._sectorPosition);
|
|
34
48
|
if (!Vector3Like.Equals(this._sectorPosition, this._cachedPosition)) {
|
|
35
49
|
this._dirty = true;
|
|
@@ -188,6 +188,24 @@ export class SimulationSector {
|
|
|
188
188
|
}
|
|
189
189
|
return true;
|
|
190
190
|
}
|
|
191
|
+
updateGenAllDone() {
|
|
192
|
+
if (this._genAllDone)
|
|
193
|
+
return 0;
|
|
194
|
+
if (!this.sector) {
|
|
195
|
+
const sector = WorldRegister.sectors.get(this.dimension.id, ...this.position);
|
|
196
|
+
if (!sector) {
|
|
197
|
+
return 1;
|
|
198
|
+
}
|
|
199
|
+
this.sector = sector;
|
|
200
|
+
}
|
|
201
|
+
const state = this.state.update();
|
|
202
|
+
if (state.nSunAllDone &&
|
|
203
|
+
this.sector.getBitFlag(Sector.FlagIds.isWorldSunDone)) {
|
|
204
|
+
this._genAllDone = true;
|
|
205
|
+
return 2;
|
|
206
|
+
}
|
|
207
|
+
return 3;
|
|
208
|
+
}
|
|
191
209
|
generateUpdate() {
|
|
192
210
|
if (!this.fullNeighbors)
|
|
193
211
|
return false;
|
|
@@ -8,6 +8,13 @@ import { EngineSettings } from "../../Settings/EngineSettings";
|
|
|
8
8
|
import { SnapShots } from "../../World/SnapShot/SnapShots";
|
|
9
9
|
import LockSectors from "../../World/Lock/Function/LockSectors";
|
|
10
10
|
import UnLockSectors from "../../World/Lock/Function/UnLockSectors";
|
|
11
|
+
function createAndTransferSnapShot(task, taskId, dim, x, y, z) {
|
|
12
|
+
task.completeTask(taskId);
|
|
13
|
+
const snapShot = SnapShots.createSnapShot(dim, x, y, z);
|
|
14
|
+
WorldSimulationTools.taskTool.build.sectionSnapShot.run(...snapShot.transfer());
|
|
15
|
+
SnapShots.transferSnapShot(snapShot);
|
|
16
|
+
UnLockSectors(dim, SnapShots.getSnapShotBounds(x, y, z));
|
|
17
|
+
}
|
|
11
18
|
export class WorldSimulationTasks {
|
|
12
19
|
/**# Load Sectors
|
|
13
20
|
* ---
|
|
@@ -45,6 +52,7 @@ export class WorldSimulationTasks {
|
|
|
45
52
|
generationTask: true,
|
|
46
53
|
checkInRequired: true,
|
|
47
54
|
log: true,
|
|
55
|
+
sort: true,
|
|
48
56
|
checkDone(location) {
|
|
49
57
|
const sector = WorldRegister.sectors.get(...location);
|
|
50
58
|
if (!sector || sector.isCheckedOut())
|
|
@@ -163,7 +171,7 @@ export class WorldSimulationTasks {
|
|
|
163
171
|
* ---
|
|
164
172
|
*/
|
|
165
173
|
static buildTasks = TaskRegister.addTasks({
|
|
166
|
-
id: "
|
|
174
|
+
id: "build",
|
|
167
175
|
sort: true,
|
|
168
176
|
checkInRequired: false,
|
|
169
177
|
run(dimension, location, taskId, task, simSector) {
|
|
@@ -180,16 +188,12 @@ export class WorldSimulationTasks {
|
|
|
180
188
|
}
|
|
181
189
|
const [dim, x, y, z] = location;
|
|
182
190
|
LockSectors(dim, SnapShots.getSnapShotBounds(x, y, z)).then(() => {
|
|
183
|
-
task
|
|
184
|
-
const snapShot = SnapShots.createSnapShot(location);
|
|
185
|
-
WorldSimulationTools.taskTool.build.sectionSnapShot.run(...snapShot.transfer());
|
|
186
|
-
SnapShots.transferSnapShot(snapShot);
|
|
187
|
-
UnLockSectors(dim, SnapShots.getSnapShotBounds(x, y, z));
|
|
191
|
+
createAndTransferSnapShot(task, taskId, dim, x, y, z);
|
|
188
192
|
});
|
|
189
193
|
},
|
|
190
194
|
});
|
|
191
195
|
static unbuildTasks = TaskRegister.addTasks({
|
|
192
|
-
id: "
|
|
196
|
+
id: "unbuild",
|
|
193
197
|
sort: true,
|
|
194
198
|
checkInRequired: false,
|
|
195
199
|
run(dimension, location, taskId, task) {
|
|
@@ -18,13 +18,13 @@ export async function InitalLoad(props) {
|
|
|
18
18
|
}
|
|
19
19
|
const dimension = WorldSimulationDimensions.getDimension(props.dimension || 0);
|
|
20
20
|
let done = false;
|
|
21
|
-
generator._building = false;
|
|
21
|
+
generator._building = props.buildOnly || false;
|
|
22
22
|
WorldSimulation.addGenerator(generator);
|
|
23
23
|
let timeOut = null;
|
|
24
24
|
const update = () => {
|
|
25
25
|
if (done)
|
|
26
26
|
return;
|
|
27
|
-
WorldSimulation.tick(true);
|
|
27
|
+
WorldSimulation.tick(props.buildOnly ? false : true, props.buildOnly || false);
|
|
28
28
|
timeOut = setTimeout(update, 0);
|
|
29
29
|
};
|
|
30
30
|
update();
|
|
@@ -33,12 +33,20 @@ export async function InitalLoad(props) {
|
|
|
33
33
|
console.log(WorldSimulation.logTasks());
|
|
34
34
|
}
|
|
35
35
|
let allDone = true;
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
continue;
|
|
36
|
+
if (props.buildOnly) {
|
|
37
|
+
const task = dimension.tasks.get("build");
|
|
39
38
|
if (task.waitingFor > 0 || task._task.size > 0) {
|
|
40
39
|
allDone = false;
|
|
41
|
-
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
for (const [key, task] of dimension.tasks) {
|
|
44
|
+
if (!task.generationTask)
|
|
45
|
+
continue;
|
|
46
|
+
if (task.waitingFor > 0 || task._task.size > 0) {
|
|
47
|
+
allDone = false;
|
|
48
|
+
break;
|
|
49
|
+
}
|
|
42
50
|
}
|
|
43
51
|
}
|
|
44
52
|
if (!allDone)
|
|
@@ -48,8 +56,10 @@ export async function InitalLoad(props) {
|
|
|
48
56
|
clearTimeout(timeOut);
|
|
49
57
|
WorldSimulation.removeGenerator(generator);
|
|
50
58
|
(async () => {
|
|
51
|
-
if (
|
|
52
|
-
|
|
59
|
+
if (!props.buildOnly) {
|
|
60
|
+
if (WorldSimulationTools.worldStorage) {
|
|
61
|
+
await SaveAllSectors();
|
|
62
|
+
}
|
|
53
63
|
}
|
|
54
64
|
resolve(true);
|
|
55
65
|
})();
|
|
@@ -13,9 +13,12 @@ export type SimulationTaskBaseData = {
|
|
|
13
13
|
};
|
|
14
14
|
export declare class SimulationTaskBase {
|
|
15
15
|
data: SimulationTaskBaseData;
|
|
16
|
-
|
|
16
|
+
parent?: SimulationTaskBase | undefined;
|
|
17
|
+
_subTask: Map<string, SimulationTaskBase>;
|
|
18
|
+
constructor(data: SimulationTaskBaseData, parent?: SimulationTaskBase | undefined);
|
|
17
19
|
getTotal(dimensionId: number): number;
|
|
18
20
|
getTotalWaitingFor(dimensionId: number): number;
|
|
19
21
|
add(dimensionId: number, x: number, y: number, z: number): void;
|
|
22
|
+
addSubTask(data: SimulationTaskBaseData): void;
|
|
20
23
|
runTask(max?: number): void;
|
|
21
24
|
}
|