@divinevoxel/vlox 0.0.73 → 0.0.74
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/Contexts/Base/Remote/InitDataSync.js +4 -0
- package/Contexts/Base/Remote/InitWorldDataSync.js +1 -1
- package/Contexts/Render/DivineVoxelEngineRender.d.ts +1 -0
- package/Contexts/World/DivineVoxelEngineWorld.d.ts +1 -0
- package/Init/StartConstructor.js +2 -0
- package/Math/index.d.ts +5 -1
- package/Mesher/Functions/CompactVoxelSectionMesh.d.ts +4 -0
- package/Mesher/Functions/CompactVoxelSectionMesh.js +112 -0
- package/Mesher/Functions/MeshSection.d.ts +1 -1
- package/Mesher/Functions/MeshSection.js +15 -22
- package/Mesher/Geomtry/CompactedSectionVoxelMesh.d.ts +23 -0
- package/Mesher/Geomtry/CompactedSectionVoxelMesh.js +144 -0
- package/Mesher/Geomtry/VoxelGeometryBuilder.d.ts +1 -1
- package/Mesher/Geomtry/VoxelGeometryBuilder.js +118 -197
- package/Mesher/Geomtry/VoxelMesh.js +2 -2
- package/Mesher/Geomtry/VoxelMeshBVHBuilder.d.ts +8 -70
- package/Mesher/Geomtry/VoxelMeshBVHBuilder.js +18 -183
- package/Mesher/Geomtry/VoxelMeshBVHStructCursor.d.ts +22 -0
- package/Mesher/Geomtry/VoxelMeshBVHStructCursor.js +78 -0
- package/Mesher/Geomtry/VoxelMeshBuffers.js +2 -2
- package/Mesher/InitTask.js +5 -1
- package/Mesher/Models/Common/BoxGeometryNode.js +7 -7
- package/Mesher/Models/Common/Calc/CalcConstants.d.ts +1 -1
- package/Mesher/Models/Common/Calc/CalcConstants.js +1 -1
- package/Mesher/Models/Common/QuadGeometryNode.js +2 -2
- package/Mesher/Models/Nodes/Custom/Liquid/LiquidGeomtryNode.js +7 -7
- package/Mesher/Models/Nodes/Ruled/BoxVoxelGeometryNode.js +22 -25
- package/Mesher/Models/Nodes/Ruled/QuadVoxelGeometryNode.js +2 -2
- package/Mesher/Models/Nodes/Ruleless/RulelessBoxVoxelGeometryNode.js +2 -2
- package/Mesher/Models/Nodes/Ruleless/RulelessQuadVoxelGeometryNode.js +2 -2
- package/Mesher/Models/VoxelConstructor.d.ts +3 -3
- package/Mesher/Models/VoxelConstructor.js +8 -8
- package/Mesher/Models/VoxelGeometryBuilderCacheSpace.d.ts +2 -2
- package/Mesher/Models/VoxelGeometryBuilderCacheSpace.js +8 -9
- package/Mesher/Models/VoxelModelBuilder.js +1 -8
- package/Mesher/Types/Mesher.types.d.ts +1 -0
- package/Models/Defaults/CubeVoxelModels.js +16 -39
- package/Models/Defaults/LiquidVoxelModel.js +3 -3
- package/Models/Defaults/PanelVoxelModels.js +10 -36
- package/Models/Defaults/StairVoxelModel.js +6 -21
- package/Models/Examples.js +23 -44
- package/Models/Rules/Classes/VoxelRulesModel.d.ts +1 -1
- package/Models/Rules/Classes/VoxelRulesModel.js +3 -3
- package/Models/Rules/Functions/BuildFinalInputs.d.ts +1 -1
- package/Models/Rules/Functions/BuildFinalInputs.js +13 -13
- package/Models/Rules/VoxelModelRuleBuilderRegister.js +8 -8
- package/Models/VoxelModel.types.d.ts +3 -3
- package/Renderer/Classes/DVESectionMeshes.d.ts +2 -3
- package/Renderer/InitTasks.js +1 -9
- package/Renderer/MeshManager.d.ts +1 -1
- package/Renderer/MeshManager.js +24 -23
- package/Renderer/MeshRegister.d.ts +5 -5
- package/Renderer/MeshRegister.js +2 -2
- package/Settings/EngineSettings.d.ts +1 -0
- package/Settings/EngineSettings.js +6 -3
- package/Settings/EngineSettings.types.d.ts +7 -21
- package/Settings/EngineSettings.types.js +6 -14
- package/Tasks/Logic/InitTasks.d.ts +1 -0
- package/Tasks/Logic/InitTasks.js +10 -0
- package/Tasks/Logic/VoxelLogicUpdate.d.ts +3 -0
- package/Tasks/Logic/VoxelLogicUpdate.js +71 -0
- package/Tasks/Propagation/Explosion/ExplosionManager.d.ts +2 -2
- package/Tasks/Propagation/Explosion/ExplosionManager.js +1 -2
- package/Tasks/Propagation/Flow/FlowManager.d.ts +4 -4
- package/Tasks/Propagation/Flow/FlowRemove.d.ts +2 -2
- package/Tasks/Propagation/Flow/FlowUpdate.d.ts +2 -2
- package/Tasks/Propagation/Flow/WorldFlow.d.ts +2 -2
- package/Tasks/Propagation/Illumanation/RGBUpdate.d.ts +3 -3
- package/Tasks/Propagation/Illumanation/SunUpdate.d.ts +3 -3
- package/Tasks/Propagation/Illumanation/WorldRGB.d.ts +2 -2
- package/Tasks/Propagation/Illumanation/WorldSun.d.ts +2 -2
- package/Tasks/Propagation/Illumanation/WorldSun.js +8 -15
- package/Tasks/Propagation/InitTasks.js +4 -4
- package/Tasks/Propagation/Power/PowerUpdate.d.ts +3 -0
- package/Tasks/Propagation/Power/PowerUpdate.js +80 -0
- package/Tasks/Tasks.types.d.ts +2 -2
- package/Tasks/TasksIds.d.ts +2 -1
- package/Tasks/TasksIds.js +1 -0
- package/Tasks/Update/Common.d.ts +3 -0
- package/Tasks/Update/Common.js +41 -0
- package/Tasks/Update/EreaseUpdate.d.ts +3 -0
- package/Tasks/Update/EreaseUpdate.js +66 -0
- package/Tasks/Update/InitTasks.d.ts +2 -2
- package/Tasks/Update/InitTasks.js +3 -1
- package/Tasks/Update/PaintUpdate.d.ts +3 -0
- package/Tasks/Update/PaintUpdate.js +89 -0
- package/Tasks/Update/VoxelUpdate.d.ts +2 -5
- package/Tasks/Update/VoxelUpdate.js +5 -147
- package/Tasks/{Update/UpdateTask.d.ts → VoxelUpdateTask.d.ts} +15 -7
- package/Tasks/{Update/UpdateTask.js → VoxelUpdateTask.js} +20 -7
- package/Tasks/WorldGeneration/WorldGenBrush.d.ts +3 -3
- package/Tasks/WorldGeneration/WorldGenBrush.js +2 -2
- package/Tasks/WorldGeneration/WorldGenRegister.d.ts +1 -1
- package/Templates/Functions/CreateTemplate.d.ts +1 -1
- package/Tools/Brush/AdvancedBrushTool.js +1 -1
- package/Tools/Brush/Brush.d.ts +2 -2
- package/Tools/Brush/Brush.js +1 -1
- package/Tools/Tasks/TasksTool.d.ts +1 -0
- package/Tools/Tasks/TasksTool.js +2 -0
- package/Util/Binary/BinaryBuffer.d.ts +17 -11
- package/Util/Binary/BinaryBuffer.js +65 -59
- package/Util/Binary/BinaryTree.d.ts +46 -0
- package/Util/Binary/BinaryTree.js +104 -0
- package/Voxels/Cursor/VoxelCursor.interface.d.ts +7 -2
- package/Voxels/Cursor/VoxelCursor.interface.js +46 -2
- package/Voxels/Cursor/VoxelLightData.js +1 -1
- package/Voxels/Data/VoxelTag.types.d.ts +17 -2
- package/Voxels/Data/VoxelTag.types.js +6 -1
- package/Voxels/Data/VoxelTagsRegister.js +5 -0
- package/Voxels/Functions/BuildStateData.d.ts +6 -6
- package/Voxels/Functions/BuildStateData.js +31 -31
- package/Voxels/Functions/BuildTagAndPaletteData.js +5 -0
- package/Voxels/Indexes/VoxelIndex.d.ts +2 -2
- package/Voxels/Indexes/VoxelIndex.js +16 -18
- package/Voxels/InitVoxelData.js +12 -8
- package/Voxels/Logic/Classes/Default/Types/VoxelPoweredLogicType.d.ts +5 -0
- package/Voxels/Logic/Classes/Default/Types/VoxelPoweredLogicType.js +6 -0
- package/Voxels/Logic/Classes/VoxelLogic.d.ts +11 -0
- package/Voxels/Logic/Classes/VoxelLogic.js +49 -0
- package/Voxels/Logic/Classes/VoxelLogicType.d.ts +4 -0
- package/Voxels/Logic/Classes/VoxelLogicType.js +2 -0
- package/Voxels/Logic/VoxelLogic.types.d.ts +23 -0
- package/Voxels/Logic/VoxelLogic.types.js +1 -0
- package/Voxels/Logic/VoxelLogicRegister.d.ts +9 -0
- package/Voxels/Logic/VoxelLogicRegister.js +15 -0
- package/Voxels/State/SchemaRegister.js +10 -5
- package/Voxels/State/State.types.d.ts +1 -1
- package/Voxels/State/StateTreeReader.d.ts +1 -1
- package/Voxels/State/StateTreeReader.js +2 -3
- package/Voxels/Types/Voxel.types.d.ts +3 -0
- package/Voxels/Types/VoxelModelCompiledData.types.d.ts +6 -4
- package/World/Archive/Archive.types.d.ts +31 -12
- package/World/Archive/Classes/ArchiveClasses.d.ts +66 -0
- package/World/Archive/Classes/ArchiveClasses.js +78 -0
- package/World/Archive/Classes/ImportedSection.d.ts +40 -0
- package/World/Archive/Classes/ImportedSection.js +307 -0
- package/World/Archive/Classes/ImportedSector.d.ts +23 -0
- package/World/Archive/Classes/ImportedSector.js +97 -0
- package/World/Archive/Functions/ArchiveArea.d.ts +1 -1
- package/World/Archive/Functions/ArchiveArea.js +39 -36
- package/World/Archive/Functions/ArchiveSector.js +210 -404
- package/World/Archive/Functions/CreateArchivedSection.d.ts +3 -0
- package/World/Archive/Functions/CreateArchivedSection.js +207 -0
- package/World/Archive/Functions/ImportSector.d.ts +1 -3
- package/World/Archive/Functions/ImportSector.js +13 -244
- package/World/Archive/Functions/RemoveDuplicates.d.ts +3 -0
- package/World/Archive/Functions/RemoveDuplicates.js +92 -0
- package/World/Archive/Functions/Shared.d.ts +2 -2
- package/World/Archive/Functions/Shared.js +15 -40
- package/World/Archive/InitTasks.js +7 -10
- package/World/Cursor/SectionCursor.d.ts +1 -1
- package/World/Cursor/SectorCursor.d.ts +1 -1
- package/World/Cursor/WorldCursor.d.ts +4 -3
- package/World/Cursor/WorldCursor.js +16 -13
- package/World/Cursor/WorldVoxelCursor.d.ts +0 -4
- package/World/Cursor/WorldVoxelCursor.js +23 -14
- package/World/Dimension/Dimension.d.ts +4 -1
- package/World/Dimension/Dimension.js +8 -1
- package/World/Section/Section.d.ts +17 -4
- package/World/Section/Section.js +68 -6
- package/World/Section/SectionState.d.ts +4 -2
- package/World/Section/SectionState.js +4 -2
- package/World/Sector/Sector.d.ts +7 -1
- package/World/Sector/Sector.js +37 -4
- package/World/Sector/SectorState.d.ts +3 -2
- package/World/Sector/SectorState.js +3 -2
- package/World/Types/WorldData.types.d.ts +2 -7
- package/World/WorldRegister.d.ts +9 -9
- package/World/WorldRegister.js +9 -6
- package/World/WorldSpaces.js +6 -6
- package/{Tasks/IWG → WorldSimulation}/Internal/Classes/DimensionSegment.d.ts +2 -2
- package/{Tasks/IWG → WorldSimulation}/Internal/Classes/Generator.d.ts +6 -4
- package/{Tasks/IWG → WorldSimulation}/Internal/Classes/Generator.js +9 -5
- package/WorldSimulation/Internal/Classes/Queues/BuildQueue.d.ts +5 -0
- package/WorldSimulation/Internal/Classes/Queues/BuildQueue.js +6 -0
- package/WorldSimulation/Internal/Classes/Queues/LogiccQueue.d.ts +5 -0
- package/WorldSimulation/Internal/Classes/Queues/LogiccQueue.js +6 -0
- package/{Tasks/IWG → WorldSimulation}/Internal/Classes/SectorVisistedMap.js +1 -1
- package/WorldSimulation/Internal/Classes/TickQueue.d.ts +12 -0
- package/{Tasks/IWG/Internal/Classes/BuildQueue.js → WorldSimulation/Internal/Classes/TickQueue.js} +16 -7
- package/WorldSimulation/Internal/Classes/WorldSimulationTaskBase.d.ts +15 -0
- package/{Tasks/IWG/Internal/Classes/IWGTaskBase.js → WorldSimulation/Internal/Classes/WorldSimulationTaskBase.js} +6 -6
- package/{Tasks/IWG → WorldSimulation}/Internal/Functions/cullSectors.js +9 -9
- package/{Tasks/IWG → WorldSimulation}/Internal/Functions/getSectorState.d.ts +1 -1
- package/{Tasks/IWG → WorldSimulation}/Internal/Functions/getSectorState.js +4 -4
- package/WorldSimulation/Internal/Functions/runTickUpdate.d.ts +2 -0
- package/{Tasks/IWG/Internal/Functions/runBuildUpdate.js → WorldSimulation/Internal/Functions/runTickUpdate.js} +29 -19
- package/{Tasks/IWG → WorldSimulation}/Internal/Functions/runWorldUpdate.js +13 -13
- package/{Tasks/IWG → WorldSimulation}/Internal/TaskRegister.d.ts +2 -2
- package/{Tasks/IWG → WorldSimulation}/Internal/TaskRegister.js +1 -1
- package/WorldSimulation/Internal/WorldSimulationDimensions.d.ts +6 -0
- package/{Tasks/IWG/Internal/IWGDimensions.js → WorldSimulation/Internal/WorldSimulationDimensions.js} +1 -1
- package/WorldSimulation/Internal/WorldSimulationTasks.d.ts +30 -0
- package/{Tasks/IWG/Internal/IWGTasks.js → WorldSimulation/Internal/WorldSimulationTasks.js} +14 -14
- package/WorldSimulation/Internal/WorldSimulationTools.d.ts +8 -0
- package/{Tasks/IWG/Internal/IWGTools.js → WorldSimulation/Internal/WorldSimulationTools.js} +1 -1
- package/{Tasks/IWG → WorldSimulation}/Procedures/InitalLoad.d.ts +1 -1
- package/{Tasks/IWG → WorldSimulation}/Procedures/InitalLoad.js +11 -11
- package/{Tasks/IWG → WorldSimulation}/Procedures/SaveAllSectors.js +5 -5
- package/{Tasks/IWG/IWG.d.ts → WorldSimulation/WorldSimulation.d.ts} +5 -5
- package/{Tasks/IWG/IWG.js → WorldSimulation/WorldSimulation.js} +21 -21
- package/{Tasks/IWG → WorldSimulation}/index.d.ts +1 -1
- package/{Tasks/IWG → WorldSimulation}/index.js +1 -1
- package/package.json +1 -1
- package/Tasks/IWG/Internal/Classes/BuildQueue.d.ts +0 -11
- package/Tasks/IWG/Internal/Classes/IWGTaskBase.d.ts +0 -15
- package/Tasks/IWG/Internal/Functions/runBuildUpdate.d.ts +0 -2
- package/Tasks/IWG/Internal/IWGDimensions.d.ts +0 -6
- package/Tasks/IWG/Internal/IWGTasks.d.ts +0 -30
- package/Tasks/IWG/Internal/IWGTools.d.ts +0 -8
- /package/{Tasks/IWG → WorldSimulation}/Internal/Classes/DimensionSegment.js +0 -0
- /package/{Tasks/IWG → WorldSimulation}/Internal/Classes/SectorState.d.ts +0 -0
- /package/{Tasks/IWG → WorldSimulation}/Internal/Classes/SectorState.js +0 -0
- /package/{Tasks/IWG → WorldSimulation}/Internal/Classes/SectorVisistedMap.d.ts +0 -0
- /package/{Tasks/IWG → WorldSimulation}/Internal/Functions/cullSectors.d.ts +0 -0
- /package/{Tasks/IWG → WorldSimulation}/Internal/Functions/runWorldUpdate.d.ts +0 -0
- /package/{Tasks/IWG → WorldSimulation}/Procedures/SaveAllSectors.d.ts +0 -0
package/World/WorldSpaces.js
CHANGED
|
@@ -140,17 +140,17 @@ export class WorldSpaces {
|
|
|
140
140
|
EngineSettings.addEventListener("synced", (event) => {
|
|
141
141
|
const { settings } = event.detail.settings;
|
|
142
142
|
WorldBounds.setWorldBounds(settings.world.min.x, settings.world.min.y, settings.world.min.z, settings.world.max.x, settings.world.max.y, settings.world.max.z);
|
|
143
|
-
SectorSpace.power2Axes.x = settings.
|
|
144
|
-
SectorSpace.power2Axes.y = settings.
|
|
145
|
-
SectorSpace.power2Axes.z = settings.
|
|
143
|
+
SectorSpace.power2Axes.x = settings.world.sectorPower2Size.x;
|
|
144
|
+
SectorSpace.power2Axes.y = settings.world.sectorPower2Size.y;
|
|
145
|
+
SectorSpace.power2Axes.z = settings.world.sectorPower2Size.z;
|
|
146
146
|
SectorSpace.bounds.x = 1 << SectorSpace.power2Axes.x;
|
|
147
147
|
SectorSpace.bounds.y = 1 << SectorSpace.power2Axes.y;
|
|
148
148
|
SectorSpace.bounds.z = 1 << SectorSpace.power2Axes.z;
|
|
149
149
|
SectorSpace.volumne =
|
|
150
150
|
SectorSpace.bounds.x * SectorSpace.bounds.y * SectorSpace.bounds.z;
|
|
151
|
-
SectionSpace.power2Axes.x = settings.
|
|
152
|
-
SectionSpace.power2Axes.y = settings.
|
|
153
|
-
SectionSpace.power2Axes.z = settings.
|
|
151
|
+
SectionSpace.power2Axes.x = settings.world.sectionPower2Size.x;
|
|
152
|
+
SectionSpace.power2Axes.y = settings.world.sectionPower2Size.y;
|
|
153
|
+
SectionSpace.power2Axes.z = settings.world.sectionPower2Size.z;
|
|
154
154
|
SectionSpace.bounds.x = 1 << SectionSpace.power2Axes.x;
|
|
155
155
|
SectionSpace.bounds.y = 1 << SectionSpace.power2Axes.y;
|
|
156
156
|
SectionSpace.bounds.z = 1 << SectionSpace.power2Axes.z;
|
|
@@ -20,7 +20,7 @@ declare class SectorQueue {
|
|
|
20
20
|
addSector(sector: Sector): void;
|
|
21
21
|
}
|
|
22
22
|
export declare class DimensionSegment {
|
|
23
|
-
id:
|
|
23
|
+
id: number;
|
|
24
24
|
tasks: Map<string, TaskSegment>;
|
|
25
25
|
queue: number[];
|
|
26
26
|
vistedMap: SectorVisistedMap;
|
|
@@ -28,7 +28,7 @@ export declare class DimensionSegment {
|
|
|
28
28
|
inProgress: SectorVisistedMap;
|
|
29
29
|
unRenderQueue: SectorQueue;
|
|
30
30
|
unLoadQueue: SectorQueue;
|
|
31
|
-
constructor(id:
|
|
31
|
+
constructor(id: number);
|
|
32
32
|
addTask(id: string): void;
|
|
33
33
|
getTask(id: string): TaskSegment;
|
|
34
34
|
clearAllTasks(): void;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { Vector3Like } from "@amodx/math";
|
|
2
2
|
import { Circle } from "@amodx/math/Shapes";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { TaskTool } from "../../../Tools/Tasks/TasksTool";
|
|
4
|
+
import { BuildQueue } from "./Queues/BuildQueue";
|
|
5
|
+
import { LogicQueue } from "./Queues/LogiccQueue";
|
|
5
6
|
export interface GeneratorData {
|
|
6
|
-
dimension:
|
|
7
|
+
dimension: number;
|
|
7
8
|
building?: boolean;
|
|
8
9
|
culling?: boolean;
|
|
9
10
|
position: Vector3Like;
|
|
@@ -14,7 +15,7 @@ export interface GeneratorData {
|
|
|
14
15
|
export declare class Generator {
|
|
15
16
|
taskTool: TaskTool;
|
|
16
17
|
position: Vector3Like;
|
|
17
|
-
_dimension:
|
|
18
|
+
_dimension: number;
|
|
18
19
|
_building: boolean;
|
|
19
20
|
_positonChanged: boolean;
|
|
20
21
|
_waitingForCull: boolean;
|
|
@@ -26,6 +27,7 @@ export declare class Generator {
|
|
|
26
27
|
_renderCircle: Circle;
|
|
27
28
|
_maxCircle: Circle;
|
|
28
29
|
buildQueue: BuildQueue;
|
|
30
|
+
logicQueue: LogicQueue;
|
|
29
31
|
constructor(taskTool: TaskTool, data: GeneratorData);
|
|
30
32
|
update(): void;
|
|
31
33
|
tick(): void;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { Vector3Like } from "@amodx/math";
|
|
2
2
|
import { Circle } from "@amodx/math/Shapes";
|
|
3
|
-
import { WorldSpaces } from "
|
|
4
|
-
import { BuildQueue } from "./BuildQueue";
|
|
3
|
+
import { WorldSpaces } from "../../../World/WorldSpaces";
|
|
4
|
+
import { BuildQueue } from "./Queues/BuildQueue";
|
|
5
|
+
import { LogicQueue } from "./Queues/LogiccQueue";
|
|
5
6
|
export class Generator {
|
|
6
7
|
taskTool;
|
|
7
8
|
position;
|
|
8
|
-
_dimension =
|
|
9
|
+
_dimension = 0;
|
|
9
10
|
_building = true;
|
|
10
11
|
_positonChanged = false;
|
|
11
12
|
_waitingForCull = false;
|
|
@@ -17,9 +18,9 @@ export class Generator {
|
|
|
17
18
|
_renderCircle = new Circle({ x: 0, y: 0 }, 0);
|
|
18
19
|
_maxCircle = new Circle({ x: 0, y: 0 }, 10);
|
|
19
20
|
buildQueue;
|
|
21
|
+
logicQueue;
|
|
20
22
|
constructor(taskTool, data) {
|
|
21
23
|
this.taskTool = taskTool;
|
|
22
|
-
console.warn("make generator", taskTool);
|
|
23
24
|
this._dimension = data.dimension;
|
|
24
25
|
this.position = data.position;
|
|
25
26
|
this._building =
|
|
@@ -29,6 +30,7 @@ export class Generator {
|
|
|
29
30
|
this._genCircle.radius = data.generationRadius;
|
|
30
31
|
this._maxCircle.radius = data.maxRadius;
|
|
31
32
|
this.buildQueue = new BuildQueue(taskTool);
|
|
33
|
+
this.logicQueue = new LogicQueue(taskTool);
|
|
32
34
|
}
|
|
33
35
|
update() {
|
|
34
36
|
this._positonChanged = false;
|
|
@@ -47,7 +49,9 @@ export class Generator {
|
|
|
47
49
|
tick() {
|
|
48
50
|
if (this._building) {
|
|
49
51
|
this.buildQueue.sort(this.position.x, this.position.y, this.position.z);
|
|
50
|
-
this.buildQueue.run(
|
|
52
|
+
this.buildQueue.run(125);
|
|
51
53
|
}
|
|
54
|
+
this.logicQueue.sort(this.position.x, this.position.y, this.position.z);
|
|
55
|
+
this.logicQueue.run();
|
|
52
56
|
}
|
|
53
57
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { LocationData } from "../../../Math";
|
|
2
|
+
import { TaskTool } from "../../../Tools/Tasks/TasksTool";
|
|
3
|
+
export declare abstract class TickQueue {
|
|
4
|
+
tasks: TaskTool;
|
|
5
|
+
hash: Set<unknown>;
|
|
6
|
+
sections: LocationData[];
|
|
7
|
+
constructor(tasks: TaskTool);
|
|
8
|
+
add(dimension: number, x: number, y: number, z: number): false | undefined;
|
|
9
|
+
sort(x: number, y: number, z: number): LocationData[];
|
|
10
|
+
abstract runTask(section: LocationData): void;
|
|
11
|
+
run(limit?: number): void;
|
|
12
|
+
}
|
package/{Tasks/IWG/Internal/Classes/BuildQueue.js → WorldSimulation/Internal/Classes/TickQueue.js}
RENAMED
|
@@ -1,17 +1,23 @@
|
|
|
1
|
-
import { WorldSpaces } from "
|
|
2
|
-
|
|
1
|
+
import { WorldSpaces } from "../../../World/WorldSpaces";
|
|
2
|
+
const pool = [];
|
|
3
|
+
export class TickQueue {
|
|
3
4
|
tasks;
|
|
4
5
|
hash = new Set();
|
|
5
6
|
sections = [];
|
|
6
7
|
constructor(tasks) {
|
|
7
8
|
this.tasks = tasks;
|
|
8
9
|
}
|
|
9
|
-
add(
|
|
10
|
-
const key = WorldSpaces.hash.hashXYZ(
|
|
10
|
+
add(dimension, x, y, z) {
|
|
11
|
+
const key = WorldSpaces.hash.hashXYZ(x, y, z);
|
|
11
12
|
if (this.hash.has(key))
|
|
12
13
|
return false;
|
|
13
14
|
this.hash.add(key);
|
|
14
|
-
|
|
15
|
+
const location = pool.length ? pool.shift() : [0, 0, 0, 0];
|
|
16
|
+
location[0] = dimension;
|
|
17
|
+
location[1] = x;
|
|
18
|
+
location[2] = y;
|
|
19
|
+
location[3] = z;
|
|
20
|
+
this.sections.push(location);
|
|
15
21
|
}
|
|
16
22
|
sort(x, y, z) {
|
|
17
23
|
const sections = this.sections;
|
|
@@ -33,15 +39,18 @@ export class BuildQueue {
|
|
|
33
39
|
}
|
|
34
40
|
i--;
|
|
35
41
|
}
|
|
42
|
+
return sections;
|
|
36
43
|
}
|
|
37
44
|
run(limit = 25) {
|
|
38
45
|
let count = 0;
|
|
39
46
|
while (this.sections.length) {
|
|
40
47
|
const vec = this.sections.shift();
|
|
41
|
-
const [
|
|
42
|
-
this.
|
|
48
|
+
const [, x, y, z] = vec;
|
|
49
|
+
this.runTask(vec);
|
|
50
|
+
this.tasks.build.section.run(vec);
|
|
43
51
|
this.hash.delete(WorldSpaces.hash.hashXYZ(x, y, z));
|
|
44
52
|
count++;
|
|
53
|
+
pool.push(vec);
|
|
45
54
|
if (count > limit)
|
|
46
55
|
break;
|
|
47
56
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { LocationData } from "../../../Math/index.js";
|
|
2
|
+
import { DimensionSegment } from "./DimensionSegment.js";
|
|
3
|
+
export type WorldSimulationTaskBase = {
|
|
4
|
+
id: string;
|
|
5
|
+
propagationBlocking?: boolean;
|
|
6
|
+
run(location: LocationData, onDone: () => void, dimension: DimensionSegment): void;
|
|
7
|
+
};
|
|
8
|
+
export declare class IWGTaskBase {
|
|
9
|
+
data: WorldSimulationTaskBase;
|
|
10
|
+
constructor(data: WorldSimulationTaskBase);
|
|
11
|
+
add(dimensionId: number, x: number, y: number, z: number): void;
|
|
12
|
+
remove(dimensionId: number, x: number, y: number, z: number): void;
|
|
13
|
+
cancelAll(dimensionId?: number | null): void;
|
|
14
|
+
runTask(max?: number): void;
|
|
15
|
+
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { WorldSimulationDimensions } from "../WorldSimulationDimensions.js";
|
|
2
2
|
export class IWGTaskBase {
|
|
3
3
|
data;
|
|
4
4
|
constructor(data) {
|
|
5
5
|
this.data = data;
|
|
6
6
|
}
|
|
7
7
|
add(dimensionId, x, y, z) {
|
|
8
|
-
const dimension =
|
|
8
|
+
const dimension = WorldSimulationDimensions.getDimension(dimensionId);
|
|
9
9
|
const task = dimension.getTask(this.data.id);
|
|
10
10
|
if (task.vistedMap.has(x, y, z))
|
|
11
11
|
return;
|
|
@@ -15,7 +15,7 @@ export class IWGTaskBase {
|
|
|
15
15
|
task.vistedMap.add(x, y, z);
|
|
16
16
|
}
|
|
17
17
|
remove(dimensionId, x, y, z) {
|
|
18
|
-
const dimension =
|
|
18
|
+
const dimension = WorldSimulationDimensions.getDimension(dimensionId);
|
|
19
19
|
const task = dimension.getTask(this.data.id);
|
|
20
20
|
task.vistedMap.remove(x, y, z);
|
|
21
21
|
if (this.data.propagationBlocking) {
|
|
@@ -24,18 +24,18 @@ export class IWGTaskBase {
|
|
|
24
24
|
}
|
|
25
25
|
cancelAll(dimensionId = null) {
|
|
26
26
|
if (dimensionId) {
|
|
27
|
-
const dimension =
|
|
27
|
+
const dimension = WorldSimulationDimensions.getDimension(dimensionId);
|
|
28
28
|
const task = dimension.getTask(this.data.id);
|
|
29
29
|
task.clear();
|
|
30
30
|
}
|
|
31
31
|
else {
|
|
32
|
-
for (const [key, dimension] of
|
|
32
|
+
for (const [key, dimension] of WorldSimulationDimensions._dimensions) {
|
|
33
33
|
dimension.clearAllTasks();
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
runTask(max = 1000) {
|
|
38
|
-
for (const [key, dimension] of
|
|
38
|
+
for (const [key, dimension] of WorldSimulationDimensions._dimensions) {
|
|
39
39
|
const task = dimension.getTask(this.data.id);
|
|
40
40
|
if (task.waitingFor < 0)
|
|
41
41
|
task.waitingFor = 0;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { Circle, Square } from "@amodx/math";
|
|
2
|
-
import {
|
|
3
|
-
import { WorldRegister } from "
|
|
4
|
-
import { WorldSpaces } from "
|
|
5
|
-
import {
|
|
6
|
-
import { WorldLock } from "
|
|
2
|
+
import { WorldSimulationDimensions } from "../WorldSimulationDimensions";
|
|
3
|
+
import { WorldRegister } from "../../../World/WorldRegister";
|
|
4
|
+
import { WorldSpaces } from "../../../World/WorldSpaces";
|
|
5
|
+
import { WorldSimulationTools } from "../WorldSimulationTools";
|
|
6
|
+
import { WorldLock } from "../../../World/Lock/WorldLock";
|
|
7
7
|
const sectorSquare = new Square();
|
|
8
8
|
export function cullSectors(generatos, cullGenerators) {
|
|
9
9
|
const time = performance.now();
|
|
10
|
-
for (const [, dimension] of
|
|
10
|
+
for (const [, dimension] of WorldSimulationDimensions._dimensions) {
|
|
11
11
|
for (let i = dimension.unRenderQueue.nodes.length - 1; i > -1; i--) {
|
|
12
12
|
const node = dimension.unRenderQueue.nodes[i];
|
|
13
13
|
const [cx, cy, cz] = node.position;
|
|
@@ -31,7 +31,7 @@ export function cullSectors(generatos, cullGenerators) {
|
|
|
31
31
|
if (delta > 5_000) {
|
|
32
32
|
dimension.rendered.remove(cx, cy, cz);
|
|
33
33
|
dimension.inProgress.add(cx, cy, cz);
|
|
34
|
-
|
|
34
|
+
WorldSimulationTools.parent
|
|
35
35
|
.runTaskAsync("remove-sector", [dimension.id, cx, cy, cz])
|
|
36
36
|
.then(() => {
|
|
37
37
|
dimension.inProgress.remove(cx, cy, cz);
|
|
@@ -61,9 +61,9 @@ export function cullSectors(generatos, cullGenerators) {
|
|
|
61
61
|
const delta = time - node.time;
|
|
62
62
|
if (delta > 5_000) {
|
|
63
63
|
dimension.unLoadQueue.removeIndex(i);
|
|
64
|
-
if (
|
|
64
|
+
if (WorldSimulationTools.worldStorage) {
|
|
65
65
|
dimension.inProgress.add(cx, cy, cz);
|
|
66
|
-
|
|
66
|
+
WorldSimulationTools.worldStorage
|
|
67
67
|
.unloadSector([dimension.id, cx, cy, cz])
|
|
68
68
|
.finally(() => {
|
|
69
69
|
dimension.inProgress.remove(cx, cy, cz);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { SectorState } from "../Classes/SectorState";
|
|
2
|
-
import { Sector } from "
|
|
2
|
+
import { Sector } from "../../../World/index";
|
|
3
3
|
import { DimensionSegment } from "../Classes/DimensionSegment";
|
|
4
4
|
export declare function getSectorState(sector: Sector, state: SectorState, segment: DimensionSegment): SectorState;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { WorldRegister } from "
|
|
2
|
-
import { $2dMooreNeighborhood } from "
|
|
3
|
-
import { WorldSpaces } from "
|
|
4
|
-
import { Sector } from "
|
|
1
|
+
import { WorldRegister } from "../../../World/WorldRegister";
|
|
2
|
+
import { $2dMooreNeighborhood } from "../../../Math/CardinalNeighbors";
|
|
3
|
+
import { WorldSpaces } from "../../../World/WorldSpaces";
|
|
4
|
+
import { Sector } from "../../../World/index";
|
|
5
5
|
import { Vector3Like } from "@amodx/math";
|
|
6
6
|
const tempPosition = Vector3Like.Create();
|
|
7
7
|
export function getSectorState(sector, state, segment) {
|
|
@@ -1,32 +1,39 @@
|
|
|
1
1
|
import { Circle, Square } from "@amodx/math";
|
|
2
|
-
import { WorldSpaces } from "
|
|
2
|
+
import { WorldSpaces } from "../../../World/WorldSpaces";
|
|
3
3
|
import { SectorState } from "../Classes/SectorState";
|
|
4
|
-
import { WorldRegister } from "
|
|
4
|
+
import { WorldRegister } from "../../../World/WorldRegister";
|
|
5
5
|
import { getSectorState } from "./getSectorState";
|
|
6
|
-
import {
|
|
6
|
+
import { WorldSimulationDimensions } from "../WorldSimulationDimensions";
|
|
7
7
|
const stateCursor = new SectorState();
|
|
8
8
|
const sectorSquare = new Square();
|
|
9
|
-
function
|
|
9
|
+
function buildCheck(dimenion, sector, generator, x, y, z) {
|
|
10
10
|
let rendered = true;
|
|
11
|
-
if (!dimenion.rendered.has(
|
|
11
|
+
if (!dimenion.rendered.has(x, y, z)) {
|
|
12
12
|
rendered = false;
|
|
13
|
-
dimenion.rendered.add(
|
|
13
|
+
dimenion.rendered.add(x, y, z);
|
|
14
14
|
}
|
|
15
15
|
for (const section of sector.getRenerableSections()) {
|
|
16
|
-
if (rendered && (section.isInProgress() || !section.
|
|
16
|
+
if (rendered && (section.isInProgress() || !section.isDisplayDirty()))
|
|
17
17
|
continue;
|
|
18
18
|
section.setInProgress(true);
|
|
19
|
-
generator.buildQueue.add(
|
|
20
|
-
location[0],
|
|
21
|
-
...section.getPosition(),
|
|
22
|
-
]);
|
|
19
|
+
generator.buildQueue.add(dimenion.id, ...section.position);
|
|
23
20
|
}
|
|
24
21
|
}
|
|
25
|
-
|
|
22
|
+
function logicCheck(dimenion, sector, generator, x, y, z) {
|
|
23
|
+
if (!sector.isLogicDirty())
|
|
24
|
+
return false;
|
|
25
|
+
for (const section of sector.getLogicDirtySections()) {
|
|
26
|
+
if (section.isLogicUpdateInProgress() || !section.isLogicDirty())
|
|
27
|
+
continue;
|
|
28
|
+
section.setLogicUpdateInProgress(true);
|
|
29
|
+
generator.logicQueue.add(dimenion.id, ...section.position);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
export function runTickUpdate(generators) {
|
|
26
33
|
for (const generator of generators) {
|
|
27
34
|
if (!generator._building)
|
|
28
35
|
continue;
|
|
29
|
-
const segment =
|
|
36
|
+
const segment = WorldSimulationDimensions._dimensions.get(generator._dimension);
|
|
30
37
|
if (!segment)
|
|
31
38
|
throw new Error(`No segment for dimensions ${generator._dimension} found.`);
|
|
32
39
|
const queue = segment.queue;
|
|
@@ -54,17 +61,20 @@ export function runBuildUpdate(generators) {
|
|
|
54
61
|
if (state.nWorldGenAllDone &&
|
|
55
62
|
state.nSunAllDone &&
|
|
56
63
|
state.nPropagtionAllDone) {
|
|
57
|
-
if (
|
|
58
|
-
|
|
64
|
+
if (!segment.rendered.has(cx, cy, cz)) {
|
|
65
|
+
buildCheck(segment, sector, generator, cx, cy, cz);
|
|
59
66
|
continue;
|
|
60
67
|
}
|
|
61
|
-
if (
|
|
62
|
-
|
|
63
|
-
|
|
68
|
+
if (sector.anySectionLogicDirty()) {
|
|
69
|
+
logicCheck(segment, sector, generator, cx, cy, cz);
|
|
70
|
+
}
|
|
71
|
+
if (sector.anySectionDisplayDirty()) {
|
|
72
|
+
buildCheck(segment, sector, generator, cx, cy, cz);
|
|
73
|
+
}
|
|
64
74
|
}
|
|
65
75
|
}
|
|
66
76
|
}
|
|
67
|
-
for (const [, dimension] of
|
|
77
|
+
for (const [, dimension] of WorldSimulationDimensions._dimensions) {
|
|
68
78
|
dimension.vistedMap.clear();
|
|
69
79
|
}
|
|
70
80
|
}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { Circle, Square } from "@amodx/math";
|
|
2
2
|
import { getSectorState } from "./getSectorState";
|
|
3
3
|
import { SectorState } from "../Classes/SectorState";
|
|
4
|
-
import { WorldRegister } from "
|
|
5
|
-
import { Sector } from "
|
|
6
|
-
import { WorldLock } from "
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { WorldSpaces } from "
|
|
4
|
+
import { WorldRegister } from "../../../World/WorldRegister";
|
|
5
|
+
import { Sector } from "../../../World";
|
|
6
|
+
import { WorldLock } from "../../../World/Lock/WorldLock";
|
|
7
|
+
import { WorldSimulationTasks } from "../WorldSimulationTasks";
|
|
8
|
+
import { WorldSimulationDimensions } from "../WorldSimulationDimensions";
|
|
9
|
+
import { WorldSpaces } from "../../../World/WorldSpaces";
|
|
10
10
|
const stateCursor = new SectorState();
|
|
11
11
|
const sectorSquare = new Square();
|
|
12
12
|
export function runWorldUpdate(generators) {
|
|
13
13
|
for (const generator of generators) {
|
|
14
|
-
const segment =
|
|
14
|
+
const segment = WorldSimulationDimensions._dimensions.get(generator._dimension);
|
|
15
15
|
if (!segment)
|
|
16
16
|
throw new Error(`No segment for dimensions ${generator._dimension} found.`);
|
|
17
17
|
const queue = segment.queue;
|
|
@@ -36,34 +36,34 @@ export function runWorldUpdate(generators) {
|
|
|
36
36
|
continue;
|
|
37
37
|
const sector = WorldRegister.sectors.get(generator._dimension, cx, cy, cz);
|
|
38
38
|
if (!sector) {
|
|
39
|
-
|
|
39
|
+
WorldSimulationTasks.worldLoadTasks.add(generator._dimension, cx, cy, cz);
|
|
40
40
|
continue;
|
|
41
41
|
}
|
|
42
42
|
const state = getSectorState(sector, stateCursor, segment);
|
|
43
43
|
sector.getBitFlag(Sector.FlagIds.isWorldGenDone);
|
|
44
44
|
if (state.allLoaded &&
|
|
45
45
|
!sector.getBitFlag(Sector.FlagIds.isWorldGenDone)) {
|
|
46
|
-
|
|
46
|
+
WorldSimulationTasks.worldGenTasks.add(generator._dimension, cx, cy, cz);
|
|
47
47
|
continue;
|
|
48
48
|
}
|
|
49
49
|
if (state.nWorldGenAllDone &&
|
|
50
50
|
!sector.getBitFlag(Sector.FlagIds.isWorldDecorDone)) {
|
|
51
|
-
|
|
51
|
+
WorldSimulationTasks.worldDecorateTasks.add(generator._dimension, cx, cy, cz);
|
|
52
52
|
continue;
|
|
53
53
|
}
|
|
54
54
|
if (state.nDecorAllDone &&
|
|
55
55
|
!sector.getBitFlag(Sector.FlagIds.isWorldPropagationDone)) {
|
|
56
|
-
|
|
56
|
+
WorldSimulationTasks.worldPropagationTasks.add(generator._dimension, cx, cy, cz);
|
|
57
57
|
continue;
|
|
58
58
|
}
|
|
59
59
|
if (state.nPropagtionAllDone &&
|
|
60
60
|
!sector.getBitFlag(Sector.FlagIds.isWorldSunDone)) {
|
|
61
|
-
|
|
61
|
+
WorldSimulationTasks.worldSunTasks.add(generator._dimension, cx, cy, cz);
|
|
62
62
|
continue;
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
|
-
for (const [key, dimension] of
|
|
66
|
+
for (const [key, dimension] of WorldSimulationDimensions._dimensions) {
|
|
67
67
|
dimension.vistedMap.clear();
|
|
68
68
|
}
|
|
69
69
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { DimensionSegment } from "./Classes/DimensionSegment";
|
|
2
|
-
import { IWGTaskBase,
|
|
2
|
+
import { IWGTaskBase, WorldSimulationTaskBase } from "./Classes/WorldSimulationTaskBase";
|
|
3
3
|
export declare class TaskRegister {
|
|
4
4
|
static readonly tasks: IWGTaskBase[];
|
|
5
|
-
static addTasks(data:
|
|
5
|
+
static addTasks(data: WorldSimulationTaskBase): IWGTaskBase;
|
|
6
6
|
static addToDimension(dimension: DimensionSegment): void;
|
|
7
7
|
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { DimensionSegment } from "./Classes/DimensionSegment";
|
|
2
|
+
export declare class WorldSimulationDimensions {
|
|
3
|
+
static readonly _dimensions: Map<number, DimensionSegment>;
|
|
4
|
+
static addDimension(dimensionId: number): void;
|
|
5
|
+
static getDimension(dimensionId: number): DimensionSegment;
|
|
6
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DimensionSegment } from "./Classes/DimensionSegment";
|
|
2
2
|
import { TaskRegister } from "./TaskRegister";
|
|
3
|
-
export class
|
|
3
|
+
export class WorldSimulationDimensions {
|
|
4
4
|
static _dimensions = new Map();
|
|
5
5
|
static addDimension(dimensionId) {
|
|
6
6
|
const segment = new DimensionSegment(dimensionId);
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export declare class WorldSimulationTasks {
|
|
2
|
+
/**# Load Sectors
|
|
3
|
+
* ---
|
|
4
|
+
*/
|
|
5
|
+
static readonly worldLoadTasks: import("./Classes/WorldSimulationTaskBase").IWGTaskBase;
|
|
6
|
+
/**# Generate Sectors
|
|
7
|
+
* ---
|
|
8
|
+
*/
|
|
9
|
+
static readonly worldGenTasks: import("./Classes/WorldSimulationTaskBase").IWGTaskBase;
|
|
10
|
+
/**# Decorate Sectors
|
|
11
|
+
* ---
|
|
12
|
+
*/
|
|
13
|
+
static readonly worldDecorateTasks: import("./Classes/WorldSimulationTaskBase").IWGTaskBase;
|
|
14
|
+
/**# World Sun
|
|
15
|
+
* ---
|
|
16
|
+
*/
|
|
17
|
+
static readonly worldSunTasks: import("./Classes/WorldSimulationTaskBase").IWGTaskBase;
|
|
18
|
+
/**# World Propagation
|
|
19
|
+
* ---
|
|
20
|
+
*/
|
|
21
|
+
static readonly worldPropagationTasks: import("./Classes/WorldSimulationTaskBase").IWGTaskBase;
|
|
22
|
+
/**# Save Sector
|
|
23
|
+
* ---
|
|
24
|
+
*/
|
|
25
|
+
static readonly saveTasks: import("./Classes/WorldSimulationTaskBase").IWGTaskBase;
|
|
26
|
+
/**# Save & Unload Sector
|
|
27
|
+
* ---
|
|
28
|
+
*/
|
|
29
|
+
static readonly saveAndUnloadTasks: import("./Classes/WorldSimulationTaskBase").IWGTaskBase;
|
|
30
|
+
}
|