@divinevoxel/vlox 0.0.72 → 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 +2 -1
- package/Contexts/World/DivineVoxelEngineWorld.d.ts +2 -1
- package/Init/StartConstructor.js +8 -4
- package/Init/StartWorld.d.ts +1 -1
- package/Math/index.d.ts +5 -1
- package/Mesher/Functions/CompactVoxelMesh.d.ts +2 -2
- package/Mesher/Functions/CompactVoxelMesh.js +1 -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 +27 -22
- package/Mesher/Functions/MeshTexture.d.ts +1 -1
- package/Mesher/Functions/MeshTexture.js +3 -4
- package/Mesher/Geomtry/CompactedSectionVoxelMesh.d.ts +23 -0
- package/Mesher/Geomtry/CompactedSectionVoxelMesh.js +144 -0
- package/Mesher/Geomtry/Primitives/QuadVertexData.d.ts +12 -10
- package/Mesher/Geomtry/Primitives/QuadVertexData.js +49 -56
- package/Mesher/Geomtry/VoxelGeometryBuilder.d.ts +2 -2
- package/Mesher/Geomtry/VoxelGeometryBuilder.js +120 -199
- package/Mesher/Geomtry/VoxelMesh.d.ts +1 -1
- package/Mesher/Geomtry/VoxelMesh.js +4 -4
- package/Mesher/Geomtry/VoxelMeshBVHBuilder.d.ts +16 -0
- package/Mesher/Geomtry/VoxelMeshBVHBuilder.js +51 -0
- package/Mesher/Geomtry/VoxelMeshBVHStructCursor.d.ts +22 -0
- package/Mesher/Geomtry/VoxelMeshBVHStructCursor.js +78 -0
- package/Mesher/Geomtry/{Buffers.js → VoxelMeshBuffers.js} +2 -2
- package/Mesher/Geomtry/index.d.ts +0 -1
- package/Mesher/Geomtry/index.js +0 -1
- package/Mesher/InitMesher.js +1 -1
- package/Mesher/InitTask.js +9 -23
- 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/Calc/FaceDataCalc.d.ts +2 -2
- package/Mesher/Models/Common/Calc/FaceDataCalc.js +37 -30
- package/Mesher/Models/Common/QuadGeometryNode.js +2 -2
- package/Mesher/Models/Nodes/Custom/Liquid/FlowGradient.d.ts +2 -2
- package/Mesher/Models/Nodes/Custom/Liquid/FlowGradient.js +1 -1
- package/Mesher/Models/Nodes/Custom/Liquid/LiquidGeomtryNode.js +18 -24
- package/Mesher/Models/Nodes/GeometryNode.d.ts +2 -2
- package/Mesher/Models/Nodes/Ruled/BoxVoxelGeometryNode.d.ts +1 -0
- package/Mesher/Models/Nodes/Ruled/BoxVoxelGeometryNode.js +40 -31
- 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/{Tools → Models/Protocols}/OutlinedVoxelTool.d.ts +1 -1
- package/Mesher/{Tools → Models/Protocols}/OutlinedVoxelTool.js +1 -1
- package/Mesher/Models/RenderedMaterials.d.ts +6 -0
- package/Mesher/{RenderedMaterials.js → Models/RenderedMaterials.js} +2 -2
- package/Mesher/Models/VoxelConstructor.d.ts +6 -6
- package/Mesher/Models/VoxelConstructor.js +8 -8
- package/Mesher/Models/VoxelGeometryBuilderCacheSpace.d.ts +3 -5
- package/Mesher/Models/VoxelGeometryBuilderCacheSpace.js +8 -32
- package/Mesher/{Tools/VoxelMesherDataTool.d.ts → Models/VoxelModelBuilder.d.ts} +4 -5
- package/Mesher/{Tools/VoxelMesherDataTool.js → Models/VoxelModelBuilder.js} +5 -8
- package/Mesher/Types/Mesher.types.d.ts +1 -0
- package/Models/Defaults/CubeVoxelGeometry.js +4 -0
- package/Models/Defaults/CubeVoxelModels.js +360 -383
- package/Models/Defaults/LiquidVoxelModel.js +5 -5
- package/Models/Defaults/PanelVoxelModels.js +442 -468
- package/Models/Defaults/StairVoxelModel.js +582 -597
- package/Models/Examples.js +490 -498
- 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 +21 -19
- package/Models/Rules/Functions/BuildGeomtryInputs.js +8 -5
- package/Models/Rules/Functions/BuildRules.js +2 -2
- package/Models/Rules/{VoxelModelManager.d.ts → VoxelModelRuleBuilderRegister.d.ts} +1 -1
- package/Models/Rules/VoxelModelRuleBuilderRegister.js +178 -0
- package/Models/VoxelModel.types.d.ts +17 -8
- package/Renderer/Classes/DVESectionMeshes.d.ts +2 -3
- package/Renderer/Classes/SectorMesh.d.ts +3 -4
- package/Renderer/Classes/SectorMesh.js +6 -11
- package/Renderer/InitTasks.js +1 -10
- package/Renderer/MeshManager.d.ts +1 -1
- package/Renderer/MeshManager.js +26 -25
- package/Renderer/MeshRegister.d.ts +5 -5
- package/Renderer/MeshRegister.js +4 -3
- package/Settings/EngineSettings.d.ts +2 -1
- package/Settings/EngineSettings.js +6 -5
- package/Settings/EngineSettings.types.d.ts +24 -39
- package/Settings/EngineSettings.types.js +22 -29
- 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 +7 -143
- package/Tasks/{Update/UpdateTask.d.ts → VoxelUpdateTask.d.ts} +16 -6
- package/Tasks/{Update/UpdateTask.js → VoxelUpdateTask.js} +44 -5
- package/Tasks/WorldGeneration/WorldGenBrush.d.ts +3 -3
- package/Tasks/WorldGeneration/WorldGenBrush.js +3 -3
- package/Tasks/WorldGeneration/WorldGenRegister.d.ts +1 -1
- package/Templates/Cursor/TemplateCursor.d.ts +2 -2
- package/Templates/Cursor/TemplateCursor.js +1 -2
- package/Templates/Functions/CreateTemplate.d.ts +1 -1
- package/Templates/VoxelTemplates.types.d.ts +1 -1
- package/Textures/Classes/CompiledTexture.d.ts +18 -0
- package/Textures/Classes/CompiledTexture.js +50 -0
- package/Textures/Classes/CompiledTextureAnimation.d.ts +12 -0
- package/Textures/Classes/CompiledTextureAnimation.js +27 -0
- package/Textures/Classes/TextureAnimationTexture.d.ts +10 -0
- package/Textures/Classes/TextureAnimationTexture.js +32 -0
- package/Textures/Functions/BuildTextureData.d.ts +10 -0
- package/Textures/Functions/BuildTextureData.js +205 -0
- package/Textures/Texture.types.d.ts +50 -64
- package/Textures/TextureManager.d.ts +8 -19
- package/Textures/TextureManager.js +28 -166
- package/Tools/Brush/AdvancedBrushTool.js +1 -1
- package/Tools/Brush/Brush.d.ts +3 -3
- package/Tools/Brush/Brush.js +40 -8
- package/Tools/Tasks/TasksTool.d.ts +1 -0
- package/Tools/Tasks/TasksTool.js +2 -0
- package/Util/Binary/BinaryArrays.d.ts +6 -0
- package/Util/Binary/BinaryArrays.js +25 -0
- package/Util/Binary/BinaryBuffer.d.ts +35 -0
- package/Util/Binary/BinaryBuffer.js +136 -0
- package/Util/Binary/{BitArray.d.ts → BinaryFunctions.d.ts} +1 -2
- package/Util/Binary/BinaryFunctions.js +11 -0
- package/{Mesher/Tools/VoxelMeshBVHBuilder.d.ts → Util/Binary/BinaryTree.d.ts} +1 -33
- package/Util/Binary/BinaryTree.js +104 -0
- package/Voxels/Cursor/DataCursor.interface.d.ts +5 -0
- package/Voxels/Cursor/VoxelCursor.interface.d.ts +8 -3
- package/Voxels/Cursor/VoxelCursor.interface.js +54 -13
- package/Voxels/Cursor/VoxelLightData.js +1 -1
- package/Voxels/Data/VoxelPalettesRegister.d.ts +0 -5
- package/Voxels/Data/VoxelPalettesRegister.js +0 -9
- package/Voxels/Data/VoxelTag.types.d.ts +17 -2
- package/Voxels/Data/VoxelTag.types.js +6 -1
- package/Voxels/Data/VoxelTagsRegister.js +12 -7
- package/Voxels/Functions/BuildStateData.d.ts +6 -6
- package/Voxels/Functions/BuildStateData.js +37 -37
- package/Voxels/Functions/BuildTagAndPaletteData.js +6 -3
- package/Voxels/Indexes/VoxelIndex.d.ts +2 -2
- package/Voxels/Indexes/VoxelIndex.js +16 -18
- package/Voxels/InitVoxelData.js +24 -21
- 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/Schema/StateSchema.d.ts +1 -1
- 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 +21 -0
- package/Voxels/Types/Voxel.types.js +6 -2
- package/Voxels/Types/VoxelModelCompiledData.types.d.ts +6 -4
- package/World/Archive/Archive.types.d.ts +65 -42
- 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 +49 -54
- package/World/Archive/Functions/ArchiveSector.js +373 -282
- package/World/Archive/Functions/CreateArchivedSection.d.ts +3 -0
- package/World/Archive/Functions/CreateArchivedSection.js +207 -0
- package/World/Archive/Functions/ImportSector.d.ts +2 -4
- package/World/Archive/Functions/ImportSector.js +50 -220
- package/World/Archive/Functions/RemoveDuplicates.d.ts +3 -0
- package/World/Archive/Functions/RemoveDuplicates.js +92 -0
- package/World/Archive/Functions/Shared.d.ts +6 -0
- package/World/Archive/Functions/Shared.js +50 -0
- package/World/Archive/InitTasks.js +37 -23
- package/World/Cursor/SectionCursor.d.ts +3 -3
- package/World/Cursor/SectionCursor.js +2 -3
- package/World/Cursor/SectorCursor.d.ts +3 -3
- package/World/Cursor/SectorCursor.js +1 -2
- package/World/Cursor/WorldCursor.d.ts +6 -5
- package/World/Cursor/WorldCursor.js +17 -15
- package/World/Cursor/WorldVoxelCursor.d.ts +0 -4
- package/World/Cursor/WorldVoxelCursor.js +24 -14
- package/World/Dimension/Dimension.d.ts +4 -1
- package/World/Dimension/Dimension.js +8 -1
- package/World/InitTasks.d.ts +1 -1
- package/World/Lock/WorldLock.d.ts +1 -1
- package/World/Section/Section.d.ts +27 -18
- package/World/Section/Section.js +125 -21
- package/World/Section/SectionState.d.ts +12 -0
- package/World/Section/SectionState.js +13 -0
- package/World/Sector/Sector.d.ts +20 -6
- package/World/Sector/Sector.js +100 -17
- package/World/Sector/SectorHeightMap.js +2 -2
- package/World/Sector/SectorState.d.ts +16 -7
- package/World/Sector/SectorState.js +29 -15
- package/World/Types/WorldData.types.d.ts +2 -7
- package/World/Types/WorldStorage.interface.js +1 -0
- package/World/WorldRegister.d.ts +13 -9
- package/World/WorldRegister.js +24 -9
- package/World/WorldSpaces.d.ts +4 -0
- package/World/WorldSpaces.js +25 -12
- package/{Tasks/IWG → WorldSimulation}/Internal/Classes/DimensionSegment.d.ts +2 -2
- package/{Tasks/IWG → WorldSimulation}/Internal/Classes/Generator.d.ts +10 -3
- package/{Tasks/IWG → WorldSimulation}/Internal/Classes/Generator.js +19 -3
- 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/WorldSimulation/Internal/Classes/TickQueue.js +58 -0
- package/WorldSimulation/Internal/Classes/WorldSimulationTaskBase.d.ts +15 -0
- package/{Tasks/IWG/Internal/Classes/IWGTaskBase.js → WorldSimulation/Internal/Classes/WorldSimulationTaskBase.js} +8 -8
- 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} +38 -9
- 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 -24
- 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 +7 -5
- package/{Tasks/IWG/IWG.d.ts → WorldSimulation/WorldSimulation.d.ts} +6 -5
- package/{Tasks/IWG/IWG.js → WorldSimulation/WorldSimulation.js} +29 -23
- package/{Tasks/IWG → WorldSimulation}/index.d.ts +1 -1
- package/{Tasks/IWG → WorldSimulation}/index.js +1 -1
- package/package.json +1 -1
- package/Mesher/Functions/CompactMesh.d.ts +0 -2
- package/Mesher/Functions/CompactMesh.js +0 -42
- package/Mesher/Geomtry/GeometryNormals.d.ts +0 -10
- package/Mesher/Geomtry/GeometryNormals.js +0 -52
- package/Mesher/Geomtry/MeshData.types.d.ts +0 -13
- package/Mesher/Geomtry/MeshData.types.js +0 -6
- package/Mesher/Geomtry/Tools/MesherDataTools.d.ts +0 -7
- package/Mesher/Geomtry/Tools/MesherDataTools.js +0 -12
- package/Mesher/Geomtry/Tools/index.d.ts +0 -1
- package/Mesher/Geomtry/Tools/index.js +0 -1
- package/Mesher/RenderedMaterials.d.ts +0 -6
- package/Mesher/Tools/VoxelMeshBVHBuilder.js +0 -216
- package/Models/Rules/VoxelModelManager.js +0 -82
- 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 -34
- package/Tasks/IWG/Internal/IWGTools.d.ts +0 -8
- package/Textures/TextureAnimations.d.ts +0 -4
- package/Textures/TextureAnimations.js +0 -35
- package/Textures/TextureArray.d.ts +0 -47
- package/Textures/TextureArray.js +0 -202
- package/Textures/TextureBuilder.d.ts +0 -13
- package/Textures/TextureBuilder.js +0 -120
- package/Textures/TextureRegister.d.ts +0 -9
- package/Textures/TextureRegister.js +0 -28
- package/Tools/DataCursor.interface.d.ts +0 -5
- package/Tools/DataCursor.interface.js +0 -2
- package/Util/Binary/BitArray.js +0 -16
- package/World/Structs/WorldDataStructProperties.d.ts +0 -8
- package/World/Structs/WorldDataStructProperties.js +0 -9
- /package/Mesher/Geomtry/{Buffers.d.ts → VoxelMeshBuffers.d.ts} +0 -0
- /package/Mesher/{Tools → Geomtry}/VoxelMeshVertexStructCursor.d.ts +0 -0
- /package/Mesher/{Tools → Geomtry}/VoxelMeshVertexStructCursor.js +0 -0
- /package/Mesher/{VoxelShaderData.d.ts → Geomtry/VoxelShaderData.d.ts} +0 -0
- /package/Mesher/{VoxelShaderData.js → Geomtry/VoxelShaderData.js} +0 -0
- /package/{World/Storage/WorldStorage.interface.js → Voxels/Cursor/DataCursor.interface.js} +0 -0
- /package/World/{Storage → Types}/WorldStorage.interface.d.ts +0 -0
- /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,9 +1,12 @@
|
|
|
1
1
|
import { Vector3Like } from "@amodx/math";
|
|
2
2
|
import { Circle } from "@amodx/math/Shapes";
|
|
3
|
-
import { WorldSpaces } from "
|
|
3
|
+
import { WorldSpaces } from "../../../World/WorldSpaces";
|
|
4
|
+
import { BuildQueue } from "./Queues/BuildQueue";
|
|
5
|
+
import { LogicQueue } from "./Queues/LogiccQueue";
|
|
4
6
|
export class Generator {
|
|
7
|
+
taskTool;
|
|
5
8
|
position;
|
|
6
|
-
_dimension =
|
|
9
|
+
_dimension = 0;
|
|
7
10
|
_building = true;
|
|
8
11
|
_positonChanged = false;
|
|
9
12
|
_waitingForCull = false;
|
|
@@ -14,7 +17,10 @@ export class Generator {
|
|
|
14
17
|
_genCircle = new Circle({ x: 0, y: 0 }, 0);
|
|
15
18
|
_renderCircle = new Circle({ x: 0, y: 0 }, 0);
|
|
16
19
|
_maxCircle = new Circle({ x: 0, y: 0 }, 10);
|
|
17
|
-
|
|
20
|
+
buildQueue;
|
|
21
|
+
logicQueue;
|
|
22
|
+
constructor(taskTool, data) {
|
|
23
|
+
this.taskTool = taskTool;
|
|
18
24
|
this._dimension = data.dimension;
|
|
19
25
|
this.position = data.position;
|
|
20
26
|
this._building =
|
|
@@ -23,6 +29,8 @@ export class Generator {
|
|
|
23
29
|
this._renderCircle.radius = data.renderRadius;
|
|
24
30
|
this._genCircle.radius = data.generationRadius;
|
|
25
31
|
this._maxCircle.radius = data.maxRadius;
|
|
32
|
+
this.buildQueue = new BuildQueue(taskTool);
|
|
33
|
+
this.logicQueue = new LogicQueue(taskTool);
|
|
26
34
|
}
|
|
27
35
|
update() {
|
|
28
36
|
this._positonChanged = false;
|
|
@@ -38,4 +46,12 @@ export class Generator {
|
|
|
38
46
|
this._maxCircle.center.x = this._sectorPosition.x;
|
|
39
47
|
this._maxCircle.center.y = this._sectorPosition.z;
|
|
40
48
|
}
|
|
49
|
+
tick() {
|
|
50
|
+
if (this._building) {
|
|
51
|
+
this.buildQueue.sort(this.position.x, this.position.y, this.position.z);
|
|
52
|
+
this.buildQueue.run(125);
|
|
53
|
+
}
|
|
54
|
+
this.logicQueue.sort(this.position.x, this.position.y, this.position.z);
|
|
55
|
+
this.logicQueue.run();
|
|
56
|
+
}
|
|
41
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
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { WorldSpaces } from "../../../World/WorldSpaces";
|
|
2
|
+
const pool = [];
|
|
3
|
+
export class TickQueue {
|
|
4
|
+
tasks;
|
|
5
|
+
hash = new Set();
|
|
6
|
+
sections = [];
|
|
7
|
+
constructor(tasks) {
|
|
8
|
+
this.tasks = tasks;
|
|
9
|
+
}
|
|
10
|
+
add(dimension, x, y, z) {
|
|
11
|
+
const key = WorldSpaces.hash.hashXYZ(x, y, z);
|
|
12
|
+
if (this.hash.has(key))
|
|
13
|
+
return false;
|
|
14
|
+
this.hash.add(key);
|
|
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);
|
|
21
|
+
}
|
|
22
|
+
sort(x, y, z) {
|
|
23
|
+
const sections = this.sections;
|
|
24
|
+
const sx = x, sy = y, sz = z;
|
|
25
|
+
let i = sections.length, j, temp, ax, ay, az, bx, by, bz, distA, distB;
|
|
26
|
+
while (i > 1) {
|
|
27
|
+
for (j = 1; j < i; j++) {
|
|
28
|
+
(ax = sections[j - 1][1]),
|
|
29
|
+
(ay = sections[j - 1][2]),
|
|
30
|
+
(az = sections[j - 1][3]);
|
|
31
|
+
(bx = sections[j][1]), (by = sections[j][2]), (bz = sections[j][3]);
|
|
32
|
+
distA = (ax - sx) ** 2 + (ay - sy) ** 2 + (az - sz) ** 2;
|
|
33
|
+
distB = (bx - sx) ** 2 + (by - sy) ** 2 + (bz - sz) ** 2;
|
|
34
|
+
if (distA > distB) {
|
|
35
|
+
temp = sections[j - 1];
|
|
36
|
+
sections[j - 1] = sections[j];
|
|
37
|
+
sections[j] = temp;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
i--;
|
|
41
|
+
}
|
|
42
|
+
return sections;
|
|
43
|
+
}
|
|
44
|
+
run(limit = 25) {
|
|
45
|
+
let count = 0;
|
|
46
|
+
while (this.sections.length) {
|
|
47
|
+
const vec = this.sections.shift();
|
|
48
|
+
const [, x, y, z] = vec;
|
|
49
|
+
this.runTask(vec);
|
|
50
|
+
this.tasks.build.section.run(vec);
|
|
51
|
+
this.hash.delete(WorldSpaces.hash.hashXYZ(x, y, z));
|
|
52
|
+
count++;
|
|
53
|
+
pool.push(vec);
|
|
54
|
+
if (count > limit)
|
|
55
|
+
break;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
@@ -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;
|
|
@@ -47,12 +47,12 @@ export class IWGTaskBase {
|
|
|
47
47
|
const z = task.queue.shift();
|
|
48
48
|
task.waitingFor++;
|
|
49
49
|
if (this.data.propagationBlocking) {
|
|
50
|
-
dimension.inProgress.add(x,
|
|
50
|
+
dimension.inProgress.add(x, y, z);
|
|
51
51
|
}
|
|
52
52
|
this.data.run([dimension.id, x, y, z], () => {
|
|
53
53
|
task.vistedMap.remove(x, y, z);
|
|
54
54
|
if (this.data.propagationBlocking) {
|
|
55
|
-
dimension.inProgress.remove(x,
|
|
55
|
+
dimension.inProgress.remove(x, y, z);
|
|
56
56
|
}
|
|
57
57
|
task.waitingFor--;
|
|
58
58
|
}, dimension);
|
|
@@ -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,17 +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 {
|
|
7
|
-
import { IWGDimensions } from "../IWGDimensions";
|
|
6
|
+
import { WorldSimulationDimensions } from "../WorldSimulationDimensions";
|
|
8
7
|
const stateCursor = new SectorState();
|
|
9
8
|
const sectorSquare = new Square();
|
|
10
|
-
|
|
9
|
+
function buildCheck(dimenion, sector, generator, x, y, z) {
|
|
10
|
+
let rendered = true;
|
|
11
|
+
if (!dimenion.rendered.has(x, y, z)) {
|
|
12
|
+
rendered = false;
|
|
13
|
+
dimenion.rendered.add(x, y, z);
|
|
14
|
+
}
|
|
15
|
+
for (const section of sector.getRenerableSections()) {
|
|
16
|
+
if (rendered && (section.isInProgress() || !section.isDisplayDirty()))
|
|
17
|
+
continue;
|
|
18
|
+
section.setInProgress(true);
|
|
19
|
+
generator.buildQueue.add(dimenion.id, ...section.position);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
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) {
|
|
11
33
|
for (const generator of generators) {
|
|
12
34
|
if (!generator._building)
|
|
13
35
|
continue;
|
|
14
|
-
const segment =
|
|
36
|
+
const segment = WorldSimulationDimensions._dimensions.get(generator._dimension);
|
|
15
37
|
if (!segment)
|
|
16
38
|
throw new Error(`No segment for dimensions ${generator._dimension} found.`);
|
|
17
39
|
const queue = segment.queue;
|
|
@@ -39,13 +61,20 @@ export function runBuildUpdate(generators) {
|
|
|
39
61
|
if (state.nWorldGenAllDone &&
|
|
40
62
|
state.nSunAllDone &&
|
|
41
63
|
state.nPropagtionAllDone) {
|
|
42
|
-
if (segment.rendered.has(cx, cy, cz))
|
|
64
|
+
if (!segment.rendered.has(cx, cy, cz)) {
|
|
65
|
+
buildCheck(segment, sector, generator, cx, cy, cz);
|
|
43
66
|
continue;
|
|
44
|
-
|
|
67
|
+
}
|
|
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
|
+
}
|
|
45
74
|
}
|
|
46
75
|
}
|
|
47
76
|
}
|
|
48
|
-
for (const [, dimension] of
|
|
77
|
+
for (const [, dimension] of WorldSimulationDimensions._dimensions) {
|
|
49
78
|
dimension.vistedMap.clear();
|
|
50
79
|
}
|
|
51
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
|
+
}
|
|
@@ -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,20 +120,10 @@ 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
|
});
|
|
129
|
-
/**# Build Task
|
|
130
|
-
* ---
|
|
131
|
-
*/
|
|
132
|
-
static buildTasks = TaskRegister.addTasks({
|
|
133
|
-
id: "build_tasks",
|
|
134
|
-
async run(location, onDone, dimenion) {
|
|
135
|
-
dimenion.rendered.add(location[1], location[2], location[3]);
|
|
136
|
-
IWGTools.taskTool.build.sector.run(location, null, onDone);
|
|
137
|
-
},
|
|
138
|
-
});
|
|
139
129
|
}
|
|
@@ -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>;
|