@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
|
@@ -12,10 +12,9 @@ function runArchiveSector(location) {
|
|
|
12
12
|
});
|
|
13
13
|
const transfers = [];
|
|
14
14
|
// if (archived.palettes.light) transfers.push(archived.palettes.light.buffer);
|
|
15
|
-
if (archived.palettes.state)
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
transfers.push(archived.palettes.secondaryState.buffer);
|
|
15
|
+
// if (archived.palettes.state) transfers.push(archived.palettes.state.buffer);
|
|
16
|
+
if (archived.palettes.secondaryValue)
|
|
17
|
+
transfers.push(archived.palettes.secondaryValue.buffer);
|
|
19
18
|
for (const section of archived.sections) {
|
|
20
19
|
if (typeof section == "string")
|
|
21
20
|
continue;
|
|
@@ -42,12 +41,10 @@ function runArchiveSector(location) {
|
|
|
42
41
|
if (section.palettes.id)
|
|
43
42
|
transfers.push(section.palettes.id.buffer);
|
|
44
43
|
// if (section.palettes.light) transfers.push(section.palettes.light.buffer);
|
|
45
|
-
if (section.palettes.state)
|
|
46
|
-
|
|
47
|
-
if (section.palettes.
|
|
48
|
-
transfers.push(section.palettes.
|
|
49
|
-
if (section.palettes.secondaryState)
|
|
50
|
-
transfers.push(section.palettes.secondaryState.buffer);
|
|
44
|
+
// if (section.palettes.state) transfers.push(section.palettes.state.buffer);
|
|
45
|
+
// if (section.palettes.mod) transfers.push(section.palettes.mod.buffer);
|
|
46
|
+
if (section.palettes.secondaryValue)
|
|
47
|
+
transfers.push(section.palettes.secondaryValue.buffer);
|
|
51
48
|
if (section.palettes.secondaryId)
|
|
52
49
|
transfers.push(section.palettes.secondaryId.buffer);
|
|
53
50
|
}
|
|
@@ -11,7 +11,7 @@ export declare class SectionCursor implements DataCursorInterface, WorldSectionC
|
|
|
11
11
|
_sectionPosition: Vector3Like;
|
|
12
12
|
inBounds(x: number, y: number, z: number): boolean;
|
|
13
13
|
setSection(section: Section): boolean;
|
|
14
|
-
setSection(dimension:
|
|
14
|
+
setSection(dimension: number, x: number, y: number, z: number): boolean;
|
|
15
15
|
getVoxelAtIndex(index: number): WorldVoxelCursor;
|
|
16
16
|
getVoxel(x: number, y: number, z: number): WorldVoxelCursor | null;
|
|
17
17
|
}
|
|
@@ -12,7 +12,7 @@ export declare class SectorCursor implements DataCursorInterface, WorldSectionCu
|
|
|
12
12
|
_voxelPosition: Vector3Like;
|
|
13
13
|
_sectorPosition: Vector3Like;
|
|
14
14
|
inBounds(x: number, y: number, z: number): boolean;
|
|
15
|
-
setSector(dimension:
|
|
15
|
+
setSector(dimension: number, x: number, y: number, z: number): boolean;
|
|
16
16
|
getSection(x: number, y: number, z: number): Section | null;
|
|
17
17
|
getVoxel(x: number, y: number, z: number): WorldVoxelCursor | null;
|
|
18
18
|
getVoxelAtIndex(index: number): void;
|
|
@@ -2,10 +2,11 @@ import { Vector3Like } from "@amodx/math";
|
|
|
2
2
|
import { SectorCursor } from "./SectorCursor";
|
|
3
3
|
import { DataCursorInterface } from "../../Voxels/Cursor/DataCursor.interface";
|
|
4
4
|
export declare class WorldCursor implements DataCursorInterface {
|
|
5
|
-
sectorCursors:
|
|
5
|
+
sectorCursors: Record<number, Record<number, SectorCursor | null>>;
|
|
6
6
|
origin: Vector3Like;
|
|
7
|
-
dimension:
|
|
8
|
-
|
|
7
|
+
dimension: number;
|
|
8
|
+
_lastPosition: Vector3Like;
|
|
9
|
+
setFocalPoint(dimension: number, x: number, y: number, z: number): void;
|
|
9
10
|
inBounds(x: number, y: number, z: number): boolean;
|
|
10
11
|
getSector(x: number, y: number, z: number): SectorCursor | null;
|
|
11
12
|
getVoxel(x: number, y: number, z: number): import("./WorldVoxelCursor").WorldVoxelCursor | null;
|
|
@@ -4,21 +4,26 @@ import { WorldSpaces } from "../WorldSpaces";
|
|
|
4
4
|
let cursorCache = [];
|
|
5
5
|
const tempPosition = Vector3Like.Create();
|
|
6
6
|
export class WorldCursor {
|
|
7
|
-
sectorCursors =
|
|
8
|
-
origin =
|
|
9
|
-
dimension =
|
|
7
|
+
sectorCursors = {};
|
|
8
|
+
origin = Vector3Like.Create();
|
|
9
|
+
dimension = 0;
|
|
10
|
+
_lastPosition = Vector3Like.Create();
|
|
10
11
|
setFocalPoint(dimension, x, y, z) {
|
|
11
12
|
const sectorPos = WorldSpaces.sector.getPosition(x, y, z, tempPosition);
|
|
12
|
-
for (const
|
|
13
|
-
for (const
|
|
14
|
-
|
|
13
|
+
for (const row in this.sectorCursors) {
|
|
14
|
+
for (const col in this.sectorCursors[row]) {
|
|
15
|
+
const cursor = this.sectorCursors[row][col];
|
|
16
|
+
if (!cursor)
|
|
17
|
+
continue;
|
|
18
|
+
cursorCache.push(cursor);
|
|
19
|
+
this.sectorCursors[row][col] = null;
|
|
15
20
|
}
|
|
16
21
|
}
|
|
17
|
-
this.sectorCursors.clear();
|
|
18
22
|
this.dimension = dimension;
|
|
19
23
|
this.origin.x = sectorPos.x / WorldSpaces.sector.bounds.x;
|
|
20
24
|
this.origin.y = sectorPos.y / WorldSpaces.sector.bounds.y;
|
|
21
25
|
this.origin.z = sectorPos.z / WorldSpaces.sector.bounds.z;
|
|
26
|
+
this.getSector(x, y, z);
|
|
22
27
|
}
|
|
23
28
|
inBounds(x, y, z) {
|
|
24
29
|
return WorldSpaces.world.inBounds(x, y, z);
|
|
@@ -29,19 +34,17 @@ export class WorldCursor {
|
|
|
29
34
|
const sectorPos = WorldSpaces.sector.getPosition(x, y, z, tempPosition);
|
|
30
35
|
const cx = sectorPos.x / WorldSpaces.sector.bounds.x - this.origin.x;
|
|
31
36
|
const cz = sectorPos.z / WorldSpaces.sector.bounds.z - this.origin.z;
|
|
32
|
-
let
|
|
33
|
-
let cursor = row?.get(cz);
|
|
37
|
+
let cursor = this.sectorCursors[cx]?.[cz];
|
|
34
38
|
if (!cursor) {
|
|
35
39
|
cursor = cursorCache.length ? cursorCache.shift() : new SectorCursor();
|
|
36
40
|
if (!cursor.setSector(this.dimension, sectorPos.x, sectorPos.y, sectorPos.z)) {
|
|
37
41
|
cursorCache.push(cursor);
|
|
38
42
|
return null;
|
|
39
43
|
}
|
|
40
|
-
if (!
|
|
41
|
-
|
|
42
|
-
this.sectorCursors.set(cx, row);
|
|
44
|
+
if (!this.sectorCursors[cx]) {
|
|
45
|
+
this.sectorCursors[cx] ??= {};
|
|
43
46
|
}
|
|
44
|
-
|
|
47
|
+
this.sectorCursors[cx][cz] = cursor;
|
|
45
48
|
}
|
|
46
49
|
return cursor;
|
|
47
50
|
}
|
|
@@ -11,9 +11,5 @@ export declare class WorldVoxelCursor extends VoxelCursorInterface {
|
|
|
11
11
|
secondary: Uint16Array;
|
|
12
12
|
constructor(dataCursor: WorldSectionCursorInterface);
|
|
13
13
|
loadIn(): void;
|
|
14
|
-
/**
|
|
15
|
-
*
|
|
16
|
-
* @param mode 0 for add 1 for remove
|
|
17
|
-
*/
|
|
18
14
|
updateVoxel(mode: 0 | 1 | 2): boolean;
|
|
19
15
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { VoxelCursorInterface } from "../../Voxels/Cursor/VoxelCursor.interface";
|
|
2
2
|
export class WorldVoxelCursor extends VoxelCursorInterface {
|
|
3
3
|
dataCursor;
|
|
4
|
-
_section;
|
|
5
|
-
ids;
|
|
6
|
-
light;
|
|
7
|
-
level;
|
|
8
|
-
state;
|
|
9
|
-
mod;
|
|
10
|
-
secondary;
|
|
4
|
+
_section = null;
|
|
5
|
+
ids = new Uint16Array(1);
|
|
6
|
+
light = new Uint16Array(1);
|
|
7
|
+
level = new Uint8Array(1);
|
|
8
|
+
state = new Uint16Array(1);
|
|
9
|
+
mod = new Uint16Array(1);
|
|
10
|
+
secondary = new Uint16Array(1);
|
|
11
11
|
constructor(dataCursor) {
|
|
12
12
|
super();
|
|
13
13
|
this.dataCursor = dataCursor;
|
|
@@ -25,26 +25,35 @@ export class WorldVoxelCursor extends VoxelCursorInterface {
|
|
|
25
25
|
this._index = this.dataCursor._voxelIndex;
|
|
26
26
|
this.process();
|
|
27
27
|
}
|
|
28
|
-
/**
|
|
29
|
-
*
|
|
30
|
-
* @param mode 0 for add 1 for remove
|
|
31
|
-
*/
|
|
32
28
|
updateVoxel(mode) {
|
|
33
29
|
const voxelPos = this.dataCursor._voxelPosition;
|
|
34
30
|
this.dataCursor._section?.sector.setStored(false);
|
|
31
|
+
this.dataCursor._section?.setBuried(this.dataCursor._voxelIndex, false);
|
|
35
32
|
if (mode == 0) {
|
|
36
|
-
this.
|
|
33
|
+
if (this.doesVoxelAffectLogic()) {
|
|
34
|
+
this.dataCursor._section?.setLogicDirty(true);
|
|
35
|
+
this.dataCursor._section?.setLogicSliceDirty(voxelPos.y, true);
|
|
36
|
+
this.dataCursor._section?.setVoxelLogicDirty(this.dataCursor._voxelIndex, true);
|
|
37
|
+
}
|
|
37
38
|
this.dataCursor._section?.setHasVoxel(voxelPos.y, true);
|
|
38
39
|
return true;
|
|
39
40
|
}
|
|
40
41
|
if (mode == 1) {
|
|
41
|
-
this.
|
|
42
|
+
if (this.doesVoxelAffectLogic()) {
|
|
43
|
+
this.dataCursor._section?.setLogicDirty(true);
|
|
44
|
+
this.dataCursor._section?.setLogicSliceDirty(voxelPos.y, true);
|
|
45
|
+
this.dataCursor._section?.setVoxelLogicDirty(this.dataCursor._voxelIndex, true);
|
|
46
|
+
}
|
|
42
47
|
this.dataCursor._section?.setHasVoxelDirty(voxelPos.y, true);
|
|
43
48
|
this.dataCursor._section?.setHasVoxel(voxelPos.y, false);
|
|
44
49
|
return true;
|
|
45
50
|
}
|
|
46
51
|
if (mode == 2) {
|
|
47
|
-
this.
|
|
52
|
+
if (this.doesVoxelAffectLogic()) {
|
|
53
|
+
this.dataCursor._section?.setLogicDirty(true);
|
|
54
|
+
this.dataCursor._section?.setLogicSliceDirty(voxelPos.y, true);
|
|
55
|
+
this.dataCursor._section?.setVoxelLogicDirty(this.dataCursor._voxelIndex, true);
|
|
56
|
+
}
|
|
48
57
|
}
|
|
49
58
|
return false;
|
|
50
59
|
}
|
|
@@ -1,14 +1,17 @@
|
|
|
1
|
+
import { DimensionSyncData } from "../Types/WorldData.types";
|
|
1
2
|
import { Sector } from "../Sector";
|
|
2
3
|
export interface DimensionData {
|
|
3
4
|
id: string;
|
|
5
|
+
index: number;
|
|
4
6
|
sectors: Map<string, Sector>;
|
|
5
7
|
}
|
|
6
8
|
export interface Dimension extends DimensionData {
|
|
7
9
|
}
|
|
8
10
|
export declare class Dimension {
|
|
9
|
-
static CreateNew(
|
|
11
|
+
static CreateNew(index: number, id?: string): Dimension;
|
|
10
12
|
constructor(data: DimensionData);
|
|
11
13
|
set(sectorId: string, region: Sector): void;
|
|
12
14
|
delete(sectorId: string): void;
|
|
13
15
|
get(sectorId: string): Sector | undefined;
|
|
16
|
+
getData(): DimensionSyncData;
|
|
14
17
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
export class Dimension {
|
|
2
|
-
static CreateNew(id) {
|
|
2
|
+
static CreateNew(index, id = "") {
|
|
3
3
|
return new Dimension({
|
|
4
4
|
id,
|
|
5
|
+
index,
|
|
5
6
|
sectors: new Map(),
|
|
6
7
|
});
|
|
7
8
|
}
|
|
@@ -17,4 +18,10 @@ export class Dimension {
|
|
|
17
18
|
get(sectorId) {
|
|
18
19
|
return this.sectors.get(sectorId);
|
|
19
20
|
}
|
|
21
|
+
getData() {
|
|
22
|
+
return {
|
|
23
|
+
id: this.id,
|
|
24
|
+
index: this.index,
|
|
25
|
+
};
|
|
26
|
+
}
|
|
20
27
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Sector } from "../Sector/Sector.js";
|
|
2
|
-
import { Vec3Array } from "@amodx/math";
|
|
2
|
+
import { Vec2Array, Vec3Array } from "@amodx/math";
|
|
3
3
|
import { VoxelDataArrays } from "Voxels/index.js";
|
|
4
4
|
export interface SectionData extends VoxelDataArrays {
|
|
5
5
|
/**Array of bit flags for the sector*/
|
|
@@ -8,8 +8,12 @@ export interface SectionData extends VoxelDataArrays {
|
|
|
8
8
|
voxelMap: Uint8Array;
|
|
9
9
|
/**Y slice of the section to tell if the slice is dirty and voxelMap needs to be re-checked. */
|
|
10
10
|
dirtyMap: Uint8Array;
|
|
11
|
+
/**Y slice of the section to tell if the slice is needs it voxel logic checked.*/
|
|
12
|
+
logicDirtyMap: Uint8Array;
|
|
11
13
|
/**A bit array used to cache if a voxel is exposed or not. */
|
|
12
14
|
buried: Uint8Array;
|
|
15
|
+
/**A bit array used to cache if a voxel needs its logic evaled or not*/
|
|
16
|
+
logicDirty: Uint8Array;
|
|
13
17
|
}
|
|
14
18
|
export interface Section extends SectionData {
|
|
15
19
|
}
|
|
@@ -25,17 +29,26 @@ export declare class Section {
|
|
|
25
29
|
getPosition(): Readonly<Vec3Array>;
|
|
26
30
|
setBitFlag(index: number, value: boolean): void;
|
|
27
31
|
getBitFlag(index: number): boolean;
|
|
28
|
-
|
|
29
|
-
|
|
32
|
+
isDisplayDirty(): boolean;
|
|
33
|
+
setDisplayDirty(dirty: boolean): void;
|
|
34
|
+
isLogicDirty(): boolean;
|
|
35
|
+
setLogicDirty(dirty: boolean): void;
|
|
36
|
+
isLogicSliceDirty(y: number): boolean;
|
|
37
|
+
setLogicSliceDirty(y: number, dirty: boolean): void;
|
|
38
|
+
getVoxelLogicDirty(index: number): boolean;
|
|
39
|
+
setVoxelLogicDirty(index: number, value: boolean): void;
|
|
30
40
|
isInProgress(): boolean;
|
|
31
41
|
setInProgress(inProgress: boolean): void;
|
|
42
|
+
isLogicUpdateInProgress(): boolean;
|
|
43
|
+
setLogicUpdateInProgress(inProgress: boolean): void;
|
|
32
44
|
getBuried(index: number): boolean;
|
|
33
45
|
setBuried(index: number, value: boolean): void;
|
|
34
46
|
setHasVoxel(y: number, hasVoxel: boolean): void;
|
|
35
47
|
getHasVoxel(y: number): boolean;
|
|
36
48
|
setHasVoxelDirty(y: number, dirty: boolean): void;
|
|
37
49
|
getHasVoxelDirty(y: number): boolean;
|
|
38
|
-
getMinMax():
|
|
50
|
+
getMinMax(): Vec2Array;
|
|
51
|
+
getLogicMinMax(): Vec2Array;
|
|
39
52
|
storeFlags(): Record<string, boolean>;
|
|
40
53
|
loadFlags(flags: Record<string, boolean>): void;
|
|
41
54
|
toJSON(): SectionData;
|
package/World/Section/Section.js
CHANGED
|
@@ -3,6 +3,7 @@ import { Sector } from "../Sector/Sector.js";
|
|
|
3
3
|
import { getBitArrayIndex, setBitArrayIndex, } from "../../Util/Binary/BinaryArrays.js";
|
|
4
4
|
import { SectionState, SectionStateDefaultFlags } from "./SectionState.js";
|
|
5
5
|
import { forceMultipleOf2 } from "../../Util/Binary/BinaryFunctions.js";
|
|
6
|
+
const temp = [0, 0];
|
|
6
7
|
export class Section {
|
|
7
8
|
sector;
|
|
8
9
|
index;
|
|
@@ -17,8 +18,12 @@ export class Section {
|
|
|
17
18
|
height / 8 +
|
|
18
19
|
//dirtyMap
|
|
19
20
|
height / 8 +
|
|
21
|
+
//logicDirtyMap
|
|
22
|
+
height / 8 +
|
|
20
23
|
//bureid
|
|
21
24
|
voxelSize / 8 +
|
|
25
|
+
//logic dirty
|
|
26
|
+
voxelSize / 8 +
|
|
22
27
|
//---- voxel data arrays
|
|
23
28
|
//ids
|
|
24
29
|
voxelSize * 2 +
|
|
@@ -46,8 +51,12 @@ export class Section {
|
|
|
46
51
|
bufferStart += height / 8;
|
|
47
52
|
const dirtyMap = new Uint8Array(sectorBuffer, bufferStart, height / 8);
|
|
48
53
|
bufferStart += height / 8;
|
|
54
|
+
const logicDirtyMap = new Uint8Array(sectorBuffer, bufferStart, height / 8);
|
|
55
|
+
bufferStart += height / 8;
|
|
49
56
|
const buried = new Uint8Array(sectorBuffer, bufferStart, voxelSize / 8);
|
|
50
57
|
bufferStart += voxelSize / 8;
|
|
58
|
+
const logicDirty = new Uint8Array(sectorBuffer, bufferStart, voxelSize / 8);
|
|
59
|
+
bufferStart += voxelSize / 8;
|
|
51
60
|
const ids = new Uint16Array(sectorBuffer, bufferStart, voxelSize);
|
|
52
61
|
bufferStart += voxelSize * 2;
|
|
53
62
|
const light = new Uint16Array(sectorBuffer, bufferStart, voxelSize);
|
|
@@ -64,6 +73,8 @@ export class Section {
|
|
|
64
73
|
flagArray,
|
|
65
74
|
voxelMap,
|
|
66
75
|
dirtyMap,
|
|
76
|
+
logicDirtyMap,
|
|
77
|
+
logicDirty,
|
|
67
78
|
buried,
|
|
68
79
|
ids,
|
|
69
80
|
light,
|
|
@@ -90,6 +101,8 @@ export class Section {
|
|
|
90
101
|
this.flagArray = data.flagArray;
|
|
91
102
|
this.voxelMap = data.voxelMap;
|
|
92
103
|
this.dirtyMap = data.dirtyMap;
|
|
104
|
+
this.logicDirty = data.logicDirty;
|
|
105
|
+
this.logicDirtyMap = data.logicDirtyMap;
|
|
93
106
|
this.buried = data.buried;
|
|
94
107
|
this.ids = data.ids;
|
|
95
108
|
this.level = data.level;
|
|
@@ -107,13 +120,36 @@ export class Section {
|
|
|
107
120
|
getBitFlag(index) {
|
|
108
121
|
return getBitArrayIndex(this.flagArray, index) == 1;
|
|
109
122
|
}
|
|
110
|
-
|
|
111
|
-
return this.getBitFlag(SectionStateDefaultFlags.
|
|
123
|
+
isDisplayDirty() {
|
|
124
|
+
return this.getBitFlag(SectionStateDefaultFlags.displayDirty);
|
|
112
125
|
}
|
|
113
|
-
|
|
114
|
-
this.setBitFlag(SectionStateDefaultFlags.
|
|
115
|
-
if (dirty)
|
|
126
|
+
setDisplayDirty(dirty) {
|
|
127
|
+
this.setBitFlag(SectionStateDefaultFlags.displayDirty, dirty);
|
|
128
|
+
if (dirty) {
|
|
116
129
|
this.sector.setStored(false);
|
|
130
|
+
this.sector.setDisplayDirty(true);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
isLogicDirty() {
|
|
134
|
+
return this.getBitFlag(SectionStateDefaultFlags.logicDirty);
|
|
135
|
+
}
|
|
136
|
+
setLogicDirty(dirty) {
|
|
137
|
+
this.setBitFlag(SectionStateDefaultFlags.logicDirty, dirty);
|
|
138
|
+
if (dirty) {
|
|
139
|
+
this.sector.setLogicDirty(true);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
isLogicSliceDirty(y) {
|
|
143
|
+
return getBitArrayIndex(this.logicDirtyMap, y) == 1;
|
|
144
|
+
}
|
|
145
|
+
setLogicSliceDirty(y, dirty) {
|
|
146
|
+
setBitArrayIndex(this.logicDirtyMap, y, dirty ? 1 : 0);
|
|
147
|
+
}
|
|
148
|
+
getVoxelLogicDirty(index) {
|
|
149
|
+
return getBitArrayIndex(this.logicDirty, index) == 1;
|
|
150
|
+
}
|
|
151
|
+
setVoxelLogicDirty(index, value) {
|
|
152
|
+
return setBitArrayIndex(this.logicDirty, index, value ? 1 : 0);
|
|
117
153
|
}
|
|
118
154
|
isInProgress() {
|
|
119
155
|
return this.getBitFlag(SectionStateDefaultFlags.inProgress);
|
|
@@ -121,6 +157,12 @@ export class Section {
|
|
|
121
157
|
setInProgress(inProgress) {
|
|
122
158
|
this.setBitFlag(SectionStateDefaultFlags.inProgress, inProgress);
|
|
123
159
|
}
|
|
160
|
+
isLogicUpdateInProgress() {
|
|
161
|
+
return this.getBitFlag(SectionStateDefaultFlags.logicUpdateInProgress);
|
|
162
|
+
}
|
|
163
|
+
setLogicUpdateInProgress(inProgress) {
|
|
164
|
+
this.setBitFlag(SectionStateDefaultFlags.logicUpdateInProgress, inProgress);
|
|
165
|
+
}
|
|
124
166
|
getBuried(index) {
|
|
125
167
|
return getBitArrayIndex(this.buried, index) == 1;
|
|
126
168
|
}
|
|
@@ -151,7 +193,25 @@ export class Section {
|
|
|
151
193
|
max = i;
|
|
152
194
|
}
|
|
153
195
|
}
|
|
154
|
-
|
|
196
|
+
temp[0] = min;
|
|
197
|
+
temp[1] = max;
|
|
198
|
+
return temp;
|
|
199
|
+
}
|
|
200
|
+
getLogicMinMax() {
|
|
201
|
+
let min = Infinity;
|
|
202
|
+
let max = -Infinity;
|
|
203
|
+
let i = WorldSpaces.section.bounds.y;
|
|
204
|
+
while (i--) {
|
|
205
|
+
if (this.isLogicSliceDirty(i)) {
|
|
206
|
+
if (i < min)
|
|
207
|
+
min = i;
|
|
208
|
+
if (i > max)
|
|
209
|
+
max = i;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
temp[0] = min;
|
|
213
|
+
temp[1] = max;
|
|
214
|
+
return temp;
|
|
155
215
|
}
|
|
156
216
|
storeFlags() {
|
|
157
217
|
const stored = {};
|
|
@@ -173,6 +233,8 @@ export class Section {
|
|
|
173
233
|
toJSON() {
|
|
174
234
|
return {
|
|
175
235
|
flagArray: this.flagArray,
|
|
236
|
+
logicDirtyMap: this.logicDirtyMap,
|
|
237
|
+
logicDirty: this.logicDirty,
|
|
176
238
|
voxelMap: this.voxelMap,
|
|
177
239
|
dirtyMap: this.dirtyMap,
|
|
178
240
|
buried: this.buried,
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
export var SectionStateDefaultFlags;
|
|
2
2
|
(function (SectionStateDefaultFlags) {
|
|
3
|
-
SectionStateDefaultFlags[SectionStateDefaultFlags["
|
|
4
|
-
SectionStateDefaultFlags[SectionStateDefaultFlags["
|
|
3
|
+
SectionStateDefaultFlags[SectionStateDefaultFlags["displayDirty"] = 0] = "displayDirty";
|
|
4
|
+
SectionStateDefaultFlags[SectionStateDefaultFlags["logicDirty"] = 1] = "logicDirty";
|
|
5
|
+
SectionStateDefaultFlags[SectionStateDefaultFlags["inProgress"] = 2] = "inProgress";
|
|
6
|
+
SectionStateDefaultFlags[SectionStateDefaultFlags["logicUpdateInProgress"] = 3] = "logicUpdateInProgress";
|
|
5
7
|
})(SectionStateDefaultFlags || (SectionStateDefaultFlags = {}));
|
|
6
8
|
export class SectionState {
|
|
7
9
|
/**The default bit flags for sections */
|
package/World/Sector/Sector.d.ts
CHANGED
|
@@ -24,12 +24,18 @@ export declare class Sector {
|
|
|
24
24
|
getSection(x: number, y: number, z: number): Section;
|
|
25
25
|
setBitFlag(index: number, value: boolean): void;
|
|
26
26
|
getBitFlag(index: number): boolean;
|
|
27
|
+
isDisplayDirty(): boolean;
|
|
28
|
+
setDisplayDirty(stored: boolean): void;
|
|
29
|
+
isLogicDirty(): boolean;
|
|
30
|
+
setLogicDirty(stored: boolean): void;
|
|
27
31
|
setStored(stored: boolean): void;
|
|
28
32
|
isStored(): boolean;
|
|
29
33
|
setTimeStamp(index: number, value: number): void;
|
|
30
34
|
getTimeStamp(index: number): number;
|
|
31
35
|
getRenerableSections(): Generator<Section>;
|
|
32
|
-
|
|
36
|
+
getLogicDirtySections(): Generator<Section>;
|
|
37
|
+
anySectionDisplayDirty(): boolean;
|
|
38
|
+
anySectionLogicDirty(): boolean;
|
|
33
39
|
storeFlags(): Record<string, boolean>;
|
|
34
40
|
loadFlags(flags: Record<string, boolean>): void;
|
|
35
41
|
storeTimestamps(): Record<string, number>;
|
package/World/Sector/Sector.js
CHANGED
|
@@ -55,11 +55,23 @@ export class Sector {
|
|
|
55
55
|
getBitFlag(index) {
|
|
56
56
|
return getBitArrayIndex(this.flagArray, index) == 1;
|
|
57
57
|
}
|
|
58
|
+
isDisplayDirty() {
|
|
59
|
+
return this.getBitFlag(SectorStateDefaultBitFlags.displayDirty);
|
|
60
|
+
}
|
|
61
|
+
setDisplayDirty(stored) {
|
|
62
|
+
this.setBitFlag(SectorStateDefaultBitFlags.displayDirty, stored);
|
|
63
|
+
}
|
|
64
|
+
isLogicDirty() {
|
|
65
|
+
return this.getBitFlag(SectorStateDefaultBitFlags.logicDirty);
|
|
66
|
+
}
|
|
67
|
+
setLogicDirty(stored) {
|
|
68
|
+
this.setBitFlag(SectorStateDefaultBitFlags.logicDirty, stored);
|
|
69
|
+
}
|
|
58
70
|
setStored(stored) {
|
|
59
|
-
this.setBitFlag(SectorStateDefaultBitFlags.
|
|
71
|
+
this.setBitFlag(SectorStateDefaultBitFlags.stored, stored);
|
|
60
72
|
}
|
|
61
73
|
isStored() {
|
|
62
|
-
return this.getBitFlag(SectorStateDefaultBitFlags.
|
|
74
|
+
return this.getBitFlag(SectorStateDefaultBitFlags.stored);
|
|
63
75
|
}
|
|
64
76
|
setTimeStamp(index, value) {
|
|
65
77
|
this.timeStampArray[index] = value;
|
|
@@ -75,11 +87,32 @@ export class Sector {
|
|
|
75
87
|
yield section;
|
|
76
88
|
}
|
|
77
89
|
}
|
|
78
|
-
|
|
90
|
+
*getLogicDirtySections() {
|
|
91
|
+
for (const section of this.sections) {
|
|
92
|
+
const [min, max] = section.getLogicMinMax();
|
|
93
|
+
if (min == Infinity || max == -Infinity)
|
|
94
|
+
continue;
|
|
95
|
+
yield section;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
anySectionDisplayDirty() {
|
|
99
|
+
if (!this.isDisplayDirty())
|
|
100
|
+
return false;
|
|
101
|
+
for (let i = 0; i < this.sections.length; i++) {
|
|
102
|
+
if (this.sections[i].isDisplayDirty() && !this.sections[i].isInProgress())
|
|
103
|
+
return true;
|
|
104
|
+
}
|
|
105
|
+
this.setDisplayDirty(false);
|
|
106
|
+
return false;
|
|
107
|
+
}
|
|
108
|
+
anySectionLogicDirty() {
|
|
109
|
+
if (!this.isLogicDirty())
|
|
110
|
+
return false;
|
|
79
111
|
for (let i = 0; i < this.sections.length; i++) {
|
|
80
|
-
if (this.sections[i].
|
|
112
|
+
if (this.sections[i].isLogicDirty() && !this.sections[i].isLogicUpdateInProgress())
|
|
81
113
|
return true;
|
|
82
114
|
}
|
|
115
|
+
this.setLogicDirty(false);
|
|
83
116
|
return false;
|
|
84
117
|
}
|
|
85
118
|
storeFlags() {
|
|
@@ -3,8 +3,9 @@ export declare enum SectorStateDefaultBitFlags {
|
|
|
3
3
|
isWorldDecorDone = 1,
|
|
4
4
|
isWorldPropagationDone = 2,
|
|
5
5
|
isWorldSunDone = 3,
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
displayDirty = 4,
|
|
7
|
+
logicDirty = 5,
|
|
8
|
+
stored = 6
|
|
8
9
|
}
|
|
9
10
|
export declare enum SectorStateDefaultTimeStamps {
|
|
10
11
|
lastSaveTimestamp = 0
|
|
@@ -4,8 +4,9 @@ export var SectorStateDefaultBitFlags;
|
|
|
4
4
|
SectorStateDefaultBitFlags[SectorStateDefaultBitFlags["isWorldDecorDone"] = 1] = "isWorldDecorDone";
|
|
5
5
|
SectorStateDefaultBitFlags[SectorStateDefaultBitFlags["isWorldPropagationDone"] = 2] = "isWorldPropagationDone";
|
|
6
6
|
SectorStateDefaultBitFlags[SectorStateDefaultBitFlags["isWorldSunDone"] = 3] = "isWorldSunDone";
|
|
7
|
-
SectorStateDefaultBitFlags[SectorStateDefaultBitFlags["
|
|
8
|
-
SectorStateDefaultBitFlags[SectorStateDefaultBitFlags["
|
|
7
|
+
SectorStateDefaultBitFlags[SectorStateDefaultBitFlags["displayDirty"] = 4] = "displayDirty";
|
|
8
|
+
SectorStateDefaultBitFlags[SectorStateDefaultBitFlags["logicDirty"] = 5] = "logicDirty";
|
|
9
|
+
SectorStateDefaultBitFlags[SectorStateDefaultBitFlags["stored"] = 6] = "stored";
|
|
9
10
|
})(SectorStateDefaultBitFlags || (SectorStateDefaultBitFlags = {}));
|
|
10
11
|
export var SectorStateDefaultTimeStamps;
|
|
11
12
|
(function (SectorStateDefaultTimeStamps) {
|
|
@@ -1,11 +1,6 @@
|
|
|
1
|
-
export type
|
|
2
|
-
liquidFlowSpeed: number;
|
|
3
|
-
magmaFlowSpeed: number;
|
|
4
|
-
sunLight: boolean;
|
|
5
|
-
};
|
|
6
|
-
export type DimensionData = {
|
|
1
|
+
export type DimensionSyncData = {
|
|
7
2
|
id: string;
|
|
8
|
-
|
|
3
|
+
index: number;
|
|
9
4
|
};
|
|
10
5
|
export type RichDataSchema = Record<string, Record<string, any>>;
|
|
11
6
|
export type RichSector = {
|
package/World/WorldRegister.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Dimension } from "./Dimension/Dimension";
|
|
2
2
|
import { Sector, SectorData } from "./Sector/Sector.js";
|
|
3
3
|
import type { LocationData } from "../Math/index.js";
|
|
4
|
-
import {
|
|
4
|
+
import { DimensionSyncData } from "./Types/WorldData.types.js";
|
|
5
5
|
declare class WorldDataHooks {
|
|
6
6
|
static dimension: {
|
|
7
|
-
onNew: (dimension:
|
|
7
|
+
onNew: (dimension: DimensionSyncData) => void;
|
|
8
8
|
onRemove: (location: LocationData) => void;
|
|
9
9
|
};
|
|
10
10
|
static sectors: {
|
|
@@ -13,22 +13,22 @@ declare class WorldDataHooks {
|
|
|
13
13
|
};
|
|
14
14
|
}
|
|
15
15
|
declare class WorldRegisterDimensions {
|
|
16
|
-
static add(
|
|
17
|
-
static get(
|
|
16
|
+
static add(index: number, id?: string): Dimension;
|
|
17
|
+
static get(index: number): Dimension | undefined;
|
|
18
18
|
}
|
|
19
19
|
declare class WorldRegisterSectors {
|
|
20
20
|
static setSecotrPool(enabled: boolean): void;
|
|
21
|
-
static add(dimensionId:
|
|
21
|
+
static add(dimensionId: number, x: number, y: number, z: number, sector: SectorData): Sector;
|
|
22
22
|
static addAt(location: LocationData, sector: SectorData): Sector;
|
|
23
|
-
static new(dimensionId:
|
|
23
|
+
static new(dimensionId: number, x: number, y: number, z: number): boolean;
|
|
24
24
|
static newAt(location: LocationData): boolean;
|
|
25
|
-
static get(dimensionId:
|
|
25
|
+
static get(dimensionId: number, x: number, y: number, z: number): false | Sector;
|
|
26
26
|
static getAt(location: LocationData): false | Sector;
|
|
27
|
-
static remove(dimensionId:
|
|
27
|
+
static remove(dimensionId: number, x: number, y: number, z: number): boolean;
|
|
28
28
|
static removeAt(location: LocationData): boolean;
|
|
29
29
|
}
|
|
30
30
|
export declare class WorldRegister {
|
|
31
|
-
static _dimensions: Map<
|
|
31
|
+
static _dimensions: Map<number, Dimension>;
|
|
32
32
|
static _hooks: typeof WorldDataHooks;
|
|
33
33
|
static dimensions: typeof WorldRegisterDimensions;
|
|
34
34
|
static sectors: typeof WorldRegisterSectors;
|
package/World/WorldRegister.js
CHANGED
|
@@ -13,13 +13,14 @@ class WorldDataHooks {
|
|
|
13
13
|
};
|
|
14
14
|
}
|
|
15
15
|
class WorldRegisterDimensions {
|
|
16
|
-
static add(id) {
|
|
17
|
-
const dimesnion = Dimension.CreateNew(id);
|
|
18
|
-
WorldRegister._dimensions.set(
|
|
16
|
+
static add(index, id = "") {
|
|
17
|
+
const dimesnion = Dimension.CreateNew(index, id);
|
|
18
|
+
WorldRegister._dimensions.set(index, dimesnion);
|
|
19
|
+
WorldDataHooks.dimension.onNew(dimesnion.getData());
|
|
19
20
|
return dimesnion;
|
|
20
21
|
}
|
|
21
|
-
static get(
|
|
22
|
-
return WorldRegister._dimensions.get(
|
|
22
|
+
static get(index) {
|
|
23
|
+
return WorldRegister._dimensions.get(index);
|
|
23
24
|
}
|
|
24
25
|
}
|
|
25
26
|
const tempPosition = Vector3Like.Create();
|
|
@@ -97,7 +98,9 @@ class WorldRegisterSectors {
|
|
|
97
98
|
}
|
|
98
99
|
}
|
|
99
100
|
export class WorldRegister {
|
|
100
|
-
static _dimensions = new Map(
|
|
101
|
+
static _dimensions = new Map([
|
|
102
|
+
[0, new Dimension(Dimension.CreateNew(0, "main"))],
|
|
103
|
+
]);
|
|
101
104
|
static _hooks = WorldDataHooks;
|
|
102
105
|
static dimensions = WorldRegisterDimensions;
|
|
103
106
|
static sectors = WorldRegisterSectors;
|