@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
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { WorldRegister } from "
|
|
2
|
-
import { Sector } from "
|
|
3
|
-
import {
|
|
1
|
+
import { WorldRegister } from "../../World/WorldRegister";
|
|
2
|
+
import { Sector } from "../../World/index";
|
|
3
|
+
import { WorldSimulationTools } from "./WorldSimulationTools";
|
|
4
4
|
import { TaskRegister } from "./TaskRegister";
|
|
5
|
-
export class
|
|
5
|
+
export class WorldSimulationTasks {
|
|
6
6
|
/**# Load Sectors
|
|
7
7
|
* ---
|
|
8
8
|
*/
|
|
@@ -14,11 +14,11 @@ export class IWGTasks {
|
|
|
14
14
|
const sector = WorldRegister.sectors.get(location[0], x, y, z);
|
|
15
15
|
if (sector)
|
|
16
16
|
return onDone();
|
|
17
|
-
if (!
|
|
17
|
+
if (!WorldSimulationTools.worldStorage) {
|
|
18
18
|
WorldRegister.sectors.new(location[0], x, y, z);
|
|
19
19
|
return onDone();
|
|
20
20
|
}
|
|
21
|
-
const loaded = await
|
|
21
|
+
const loaded = await WorldSimulationTools.worldStorage.loadSector([
|
|
22
22
|
dimension,
|
|
23
23
|
x,
|
|
24
24
|
y,
|
|
@@ -42,7 +42,7 @@ export class IWGTasks {
|
|
|
42
42
|
throw new Error(`Sector at ${location.toString()} does not exist when attempting generation.`);
|
|
43
43
|
if (sector.getBitFlag(Sector.FlagIds.isWorldGenDone))
|
|
44
44
|
return onDone();
|
|
45
|
-
|
|
45
|
+
WorldSimulationTools.taskTool.generate.run([location, []], null, () => {
|
|
46
46
|
sector.setBitFlag(Sector.FlagIds.isWorldGenDone, true);
|
|
47
47
|
onDone();
|
|
48
48
|
});
|
|
@@ -60,7 +60,7 @@ export class IWGTasks {
|
|
|
60
60
|
throw new Error(`Sector at ${location.toString()} does not exist when attempting decoration.`);
|
|
61
61
|
if (sector.getBitFlag(Sector.FlagIds.isWorldDecorDone))
|
|
62
62
|
return onDone();
|
|
63
|
-
|
|
63
|
+
WorldSimulationTools.taskTool.decorate.run([location, []], null, () => {
|
|
64
64
|
sector.setBitFlag(Sector.FlagIds.isWorldDecorDone, true);
|
|
65
65
|
onDone();
|
|
66
66
|
});
|
|
@@ -78,7 +78,7 @@ export class IWGTasks {
|
|
|
78
78
|
throw new Error(`Sector at ${location.toString()} does not exist when attempting world sun.`);
|
|
79
79
|
if (sector.getBitFlag(Sector.FlagIds.isWorldSunDone))
|
|
80
80
|
return onDone();
|
|
81
|
-
|
|
81
|
+
WorldSimulationTools.taskTool.worldSun.run(location, null, () => {
|
|
82
82
|
sector.setBitFlag(Sector.FlagIds.isWorldSunDone, true);
|
|
83
83
|
onDone();
|
|
84
84
|
});
|
|
@@ -96,7 +96,7 @@ export class IWGTasks {
|
|
|
96
96
|
throw new Error(`Sector at ${location.toString()} does not exist when attempting propagation.`);
|
|
97
97
|
if (sector.getBitFlag(Sector.FlagIds.isWorldPropagationDone))
|
|
98
98
|
return onDone();
|
|
99
|
-
|
|
99
|
+
WorldSimulationTools.taskTool.propagation.run(location, null, () => {
|
|
100
100
|
sector.setBitFlag(Sector.FlagIds.isWorldPropagationDone, true);
|
|
101
101
|
onDone();
|
|
102
102
|
});
|
|
@@ -108,9 +108,9 @@ export class IWGTasks {
|
|
|
108
108
|
static saveTasks = TaskRegister.addTasks({
|
|
109
109
|
id: "save",
|
|
110
110
|
async run(location, onDone) {
|
|
111
|
-
if (!
|
|
111
|
+
if (!WorldSimulationTools.worldStorage)
|
|
112
112
|
return onDone();
|
|
113
|
-
await
|
|
113
|
+
await WorldSimulationTools.worldStorage.saveSector(location);
|
|
114
114
|
onDone();
|
|
115
115
|
},
|
|
116
116
|
});
|
|
@@ -120,9 +120,9 @@ export class IWGTasks {
|
|
|
120
120
|
static saveAndUnloadTasks = TaskRegister.addTasks({
|
|
121
121
|
id: "save_and_unload",
|
|
122
122
|
async run(location, onDone) {
|
|
123
|
-
if (!
|
|
123
|
+
if (!WorldSimulationTools.worldStorage)
|
|
124
124
|
return onDone();
|
|
125
|
-
await
|
|
125
|
+
await WorldSimulationTools.worldStorage.unloadSector(location);
|
|
126
126
|
onDone();
|
|
127
127
|
},
|
|
128
128
|
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Thread } from "@amodx/threads";
|
|
2
|
+
import { TaskTool } from "../../Tools/Tasks/TasksTool";
|
|
3
|
+
import { WorldStorageInterface } from "../../World/Types/WorldStorage.interface";
|
|
4
|
+
export declare class WorldSimulationTools {
|
|
5
|
+
static taskTool: TaskTool;
|
|
6
|
+
static worldStorage: WorldStorageInterface | null;
|
|
7
|
+
static parent: Thread;
|
|
8
|
+
}
|
|
@@ -4,7 +4,7 @@ import { GeneratorData } from "../Internal/Classes/Generator";
|
|
|
4
4
|
* Load the world without building.
|
|
5
5
|
*/
|
|
6
6
|
export declare function InitalLoad(props: {
|
|
7
|
-
dimension?:
|
|
7
|
+
dimension?: number;
|
|
8
8
|
logTasks?: true;
|
|
9
9
|
genData: Partial<GeneratorData>;
|
|
10
10
|
}): Promise<unknown>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { WorldSimulation } from "../WorldSimulation";
|
|
2
|
+
import { WorldSimulationDimensions } from "../Internal/WorldSimulationDimensions";
|
|
3
|
+
import { WorldSimulationTools } from "../Internal/WorldSimulationTools";
|
|
4
4
|
import SaveAllSectors from "./SaveAllSectors";
|
|
5
5
|
/**# InitalLoad
|
|
6
6
|
* ---
|
|
@@ -8,23 +8,23 @@ import SaveAllSectors from "./SaveAllSectors";
|
|
|
8
8
|
*/
|
|
9
9
|
export async function InitalLoad(props) {
|
|
10
10
|
return new Promise((resolve) => {
|
|
11
|
-
const generator =
|
|
11
|
+
const generator = WorldSimulation.createGenerator({
|
|
12
12
|
...props.genData,
|
|
13
13
|
building: false,
|
|
14
14
|
culling: false
|
|
15
15
|
});
|
|
16
|
-
if (!
|
|
17
|
-
|
|
16
|
+
if (!WorldSimulationDimensions._dimensions.has(generator._dimension)) {
|
|
17
|
+
WorldSimulationDimensions.addDimension(generator._dimension);
|
|
18
18
|
}
|
|
19
|
-
const dimension =
|
|
19
|
+
const dimension = WorldSimulationDimensions.getDimension(props.dimension || 0);
|
|
20
20
|
let done = false;
|
|
21
21
|
generator._building = false;
|
|
22
|
-
|
|
22
|
+
WorldSimulation.addGenerator(generator);
|
|
23
23
|
let timeOut = null;
|
|
24
24
|
const update = () => {
|
|
25
25
|
if (done)
|
|
26
26
|
return;
|
|
27
|
-
|
|
27
|
+
WorldSimulation.update();
|
|
28
28
|
timeOut = setTimeout(update, 0);
|
|
29
29
|
};
|
|
30
30
|
update();
|
|
@@ -41,9 +41,9 @@ export async function InitalLoad(props) {
|
|
|
41
41
|
done = true;
|
|
42
42
|
clearInterval(inte);
|
|
43
43
|
clearTimeout(timeOut);
|
|
44
|
-
|
|
44
|
+
WorldSimulation.removeGenerator(generator);
|
|
45
45
|
(async () => {
|
|
46
|
-
if (
|
|
46
|
+
if (WorldSimulationTools.worldStorage) {
|
|
47
47
|
await SaveAllSectors();
|
|
48
48
|
}
|
|
49
49
|
resolve(true);
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { WorldRegister } from "
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { WorldRegister } from "../../World/WorldRegister";
|
|
2
|
+
import { WorldSimulationDimensions } from "../Internal/WorldSimulationDimensions";
|
|
3
|
+
import { WorldSimulationTools } from "../Internal/WorldSimulationTools";
|
|
4
4
|
/**# Save All Sectors
|
|
5
5
|
* ---
|
|
6
6
|
* Save all sectors that are loaded.
|
|
7
7
|
*/
|
|
8
8
|
export default async function SaveAllSectors() {
|
|
9
|
-
const worldStorage =
|
|
9
|
+
const worldStorage = WorldSimulationTools.worldStorage;
|
|
10
10
|
if (!worldStorage)
|
|
11
11
|
return;
|
|
12
12
|
const proms = [];
|
|
13
|
-
for (const [dimensionId] of
|
|
13
|
+
for (const [dimensionId] of WorldSimulationDimensions._dimensions) {
|
|
14
14
|
const dimension = WorldRegister.dimensions.get(dimensionId);
|
|
15
15
|
for (const [key, sector] of dimension.sectors) {
|
|
16
16
|
if (sector.isStored())
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Thread, ThreadPool } from "@amodx/threads";
|
|
2
|
-
import { WorldStorageInterface } from "
|
|
2
|
+
import { WorldStorageInterface } from "../World/Types/WorldStorage.interface";
|
|
3
3
|
import { Generator, GeneratorData } from "./Internal/Classes/Generator";
|
|
4
4
|
import { InitalLoad } from "./Procedures/InitalLoad";
|
|
5
5
|
import SaveAllSectors from "./Procedures/SaveAllSectors";
|
|
6
|
-
interface
|
|
6
|
+
interface WorldSimulationInitData {
|
|
7
7
|
parent: Thread;
|
|
8
8
|
threads: Thread | ThreadPool;
|
|
9
9
|
worldStorage?: WorldStorageInterface;
|
|
@@ -11,15 +11,15 @@ interface IWGInitData {
|
|
|
11
11
|
/**# Infinite World Generation IWG
|
|
12
12
|
* Object to handle the loading and generating the world around a created generator.
|
|
13
13
|
*/
|
|
14
|
-
export declare class
|
|
14
|
+
export declare class WorldSimulation {
|
|
15
15
|
private static _cullGenerators;
|
|
16
16
|
static readonly _generators: Generator[];
|
|
17
|
-
static addDimension(id:
|
|
17
|
+
static addDimension(id: number): void;
|
|
18
18
|
static Procedures: {
|
|
19
19
|
InitalLoad: typeof InitalLoad;
|
|
20
20
|
SaveAllSectors: typeof SaveAllSectors;
|
|
21
21
|
};
|
|
22
|
-
static init(data:
|
|
22
|
+
static init(data: WorldSimulationInitData): void;
|
|
23
23
|
static createGenerator(data: Partial<GeneratorData>): Generator;
|
|
24
24
|
static addGenerator(generator: Generator): void;
|
|
25
25
|
static removeGenerator(generator: Generator): boolean;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { TaskTool } from "
|
|
1
|
+
import { TaskTool } from "../Tools/Tasks/TasksTool";
|
|
2
2
|
import { Generator } from "./Internal/Classes/Generator";
|
|
3
3
|
import { runWorldUpdate } from "./Internal/Functions/runWorldUpdate";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
4
|
+
import { WorldSimulationTasks } from "./Internal/WorldSimulationTasks";
|
|
5
|
+
import { runTickUpdate } from "./Internal/Functions/runTickUpdate";
|
|
6
|
+
import { WorldSimulationTools } from "./Internal/WorldSimulationTools";
|
|
7
|
+
import { WorldSimulationDimensions } from "./Internal/WorldSimulationDimensions";
|
|
8
8
|
import { cullSectors } from "./Internal/Functions/cullSectors";
|
|
9
9
|
import { Vector3Like } from "@amodx/math";
|
|
10
10
|
import { InitalLoad } from "./Procedures/InitalLoad";
|
|
@@ -13,11 +13,11 @@ let initalized = false;
|
|
|
13
13
|
/**# Infinite World Generation IWG
|
|
14
14
|
* Object to handle the loading and generating the world around a created generator.
|
|
15
15
|
*/
|
|
16
|
-
export class
|
|
16
|
+
export class WorldSimulation {
|
|
17
17
|
static _cullGenerators = [];
|
|
18
18
|
static _generators = [];
|
|
19
19
|
static addDimension(id) {
|
|
20
|
-
|
|
20
|
+
WorldSimulationDimensions.addDimension(id);
|
|
21
21
|
}
|
|
22
22
|
static Procedures = {
|
|
23
23
|
InitalLoad,
|
|
@@ -25,16 +25,16 @@ export class IWG {
|
|
|
25
25
|
};
|
|
26
26
|
static init(data) {
|
|
27
27
|
initalized = true;
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
WorldSimulationTools.parent = data.parent;
|
|
29
|
+
WorldSimulationTools.taskTool = new TaskTool(data.threads);
|
|
30
30
|
if (data.worldStorage)
|
|
31
|
-
|
|
31
|
+
WorldSimulationTools.worldStorage = data.worldStorage;
|
|
32
32
|
}
|
|
33
33
|
static createGenerator(data) {
|
|
34
34
|
if (!initalized)
|
|
35
35
|
throw new Error(`IWG must be initalized first before creating generator`);
|
|
36
|
-
return new Generator(
|
|
37
|
-
dimension: data.dimension ? data.dimension :
|
|
36
|
+
return new Generator(WorldSimulationTools.taskTool, {
|
|
37
|
+
dimension: data.dimension ? data.dimension : 0,
|
|
38
38
|
position: data.position ? data.position : Vector3Like.Create(),
|
|
39
39
|
renderRadius: data.renderRadius ? data.renderRadius : 150,
|
|
40
40
|
generationRadius: data.generationRadius ? data.generationRadius : 250,
|
|
@@ -82,17 +82,17 @@ export class IWG {
|
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
|
-
|
|
85
|
+
runTickUpdate(this._generators);
|
|
86
86
|
// IWGTasks.buildTasks.runTask();
|
|
87
87
|
runWorldUpdate(this._generators);
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
88
|
+
WorldSimulationTasks.worldLoadTasks.runTask();
|
|
89
|
+
WorldSimulationTasks.worldGenTasks.runTask();
|
|
90
|
+
WorldSimulationTasks.worldDecorateTasks.runTask();
|
|
91
|
+
WorldSimulationTasks.worldSunTasks.runTask();
|
|
92
|
+
WorldSimulationTasks.worldPropagationTasks.runTask();
|
|
93
|
+
WorldSimulationTasks.saveTasks.runTask();
|
|
94
|
+
WorldSimulationTasks.saveAndUnloadTasks.runTask();
|
|
95
95
|
cullSectors(this._generators, this._cullGenerators);
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
|
-
|
|
98
|
+
WorldSimulation.addDimension(0);
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from "./
|
|
1
|
+
export * from "./WorldSimulation";
|
|
2
2
|
export * from "./Procedures/InitalLoad";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from "./
|
|
1
|
+
export * from "./WorldSimulation";
|
|
2
2
|
export * from "./Procedures/InitalLoad";
|
package/package.json
CHANGED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { LocationData } from "../../../../Math";
|
|
2
|
-
import { TaskTool } from "../../../../Tools/Tasks/TasksTool";
|
|
3
|
-
export declare class BuildQueue {
|
|
4
|
-
tasks: TaskTool;
|
|
5
|
-
hash: Set<unknown>;
|
|
6
|
-
sections: LocationData[];
|
|
7
|
-
constructor(tasks: TaskTool);
|
|
8
|
-
add(data: LocationData): false | undefined;
|
|
9
|
-
sort(x: number, y: number, z: number): void;
|
|
10
|
-
run(limit?: number): void;
|
|
11
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { LocationData } from "../../../../Math/index.js";
|
|
2
|
-
import { DimensionSegment } from "./DimensionSegment.js";
|
|
3
|
-
export type IWGTasksData = {
|
|
4
|
-
id: string;
|
|
5
|
-
propagationBlocking?: boolean;
|
|
6
|
-
run(location: LocationData, onDone: () => void, dimension: DimensionSegment): void;
|
|
7
|
-
};
|
|
8
|
-
export declare class IWGTaskBase {
|
|
9
|
-
data: IWGTasksData;
|
|
10
|
-
constructor(data: IWGTasksData);
|
|
11
|
-
add(dimensionId: string, x: number, y: number, z: number): void;
|
|
12
|
-
remove(dimensionId: string, x: number, y: number, z: number): void;
|
|
13
|
-
cancelAll(dimensionId?: string | null): void;
|
|
14
|
-
runTask(max?: number): void;
|
|
15
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { DimensionSegment } from "./Classes/DimensionSegment";
|
|
2
|
-
export declare class IWGDimensions {
|
|
3
|
-
static readonly _dimensions: Map<string, DimensionSegment>;
|
|
4
|
-
static addDimension(dimensionId: string): void;
|
|
5
|
-
static getDimension(dimensionId: string): DimensionSegment;
|
|
6
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
export declare class IWGTasks {
|
|
2
|
-
/**# Load Sectors
|
|
3
|
-
* ---
|
|
4
|
-
*/
|
|
5
|
-
static readonly worldLoadTasks: import("./Classes/IWGTaskBase").IWGTaskBase;
|
|
6
|
-
/**# Generate Sectors
|
|
7
|
-
* ---
|
|
8
|
-
*/
|
|
9
|
-
static readonly worldGenTasks: import("./Classes/IWGTaskBase").IWGTaskBase;
|
|
10
|
-
/**# Decorate Sectors
|
|
11
|
-
* ---
|
|
12
|
-
*/
|
|
13
|
-
static readonly worldDecorateTasks: import("./Classes/IWGTaskBase").IWGTaskBase;
|
|
14
|
-
/**# World Sun
|
|
15
|
-
* ---
|
|
16
|
-
*/
|
|
17
|
-
static readonly worldSunTasks: import("./Classes/IWGTaskBase").IWGTaskBase;
|
|
18
|
-
/**# World Propagation
|
|
19
|
-
* ---
|
|
20
|
-
*/
|
|
21
|
-
static readonly worldPropagationTasks: import("./Classes/IWGTaskBase").IWGTaskBase;
|
|
22
|
-
/**# Save Sector
|
|
23
|
-
* ---
|
|
24
|
-
*/
|
|
25
|
-
static readonly saveTasks: import("./Classes/IWGTaskBase").IWGTaskBase;
|
|
26
|
-
/**# Save & Unload Sector
|
|
27
|
-
* ---
|
|
28
|
-
*/
|
|
29
|
-
static readonly saveAndUnloadTasks: import("./Classes/IWGTaskBase").IWGTaskBase;
|
|
30
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { Thread } from "@amodx/threads";
|
|
2
|
-
import { TaskTool } from "../../../Tools/Tasks/TasksTool";
|
|
3
|
-
import { WorldStorageInterface } from "../../../World/Types/WorldStorage.interface";
|
|
4
|
-
export declare class IWGTools {
|
|
5
|
-
static taskTool: TaskTool;
|
|
6
|
-
static worldStorage: WorldStorageInterface | null;
|
|
7
|
-
static parent: Thread;
|
|
8
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|