@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.
Files changed (307) hide show
  1. package/Contexts/Base/Remote/InitDataSync.js +4 -0
  2. package/Contexts/Base/Remote/InitWorldDataSync.js +1 -1
  3. package/Contexts/Render/DivineVoxelEngineRender.d.ts +2 -1
  4. package/Contexts/World/DivineVoxelEngineWorld.d.ts +2 -1
  5. package/Init/StartConstructor.js +8 -4
  6. package/Init/StartWorld.d.ts +1 -1
  7. package/Math/index.d.ts +5 -1
  8. package/Mesher/Functions/CompactVoxelMesh.d.ts +2 -2
  9. package/Mesher/Functions/CompactVoxelMesh.js +1 -1
  10. package/Mesher/Functions/CompactVoxelSectionMesh.d.ts +4 -0
  11. package/Mesher/Functions/CompactVoxelSectionMesh.js +112 -0
  12. package/Mesher/Functions/MeshSection.d.ts +1 -1
  13. package/Mesher/Functions/MeshSection.js +27 -22
  14. package/Mesher/Functions/MeshTexture.d.ts +1 -1
  15. package/Mesher/Functions/MeshTexture.js +3 -4
  16. package/Mesher/Geomtry/CompactedSectionVoxelMesh.d.ts +23 -0
  17. package/Mesher/Geomtry/CompactedSectionVoxelMesh.js +144 -0
  18. package/Mesher/Geomtry/Primitives/QuadVertexData.d.ts +12 -10
  19. package/Mesher/Geomtry/Primitives/QuadVertexData.js +49 -56
  20. package/Mesher/Geomtry/VoxelGeometryBuilder.d.ts +2 -2
  21. package/Mesher/Geomtry/VoxelGeometryBuilder.js +120 -199
  22. package/Mesher/Geomtry/VoxelMesh.d.ts +1 -1
  23. package/Mesher/Geomtry/VoxelMesh.js +4 -4
  24. package/Mesher/Geomtry/VoxelMeshBVHBuilder.d.ts +16 -0
  25. package/Mesher/Geomtry/VoxelMeshBVHBuilder.js +51 -0
  26. package/Mesher/Geomtry/VoxelMeshBVHStructCursor.d.ts +22 -0
  27. package/Mesher/Geomtry/VoxelMeshBVHStructCursor.js +78 -0
  28. package/Mesher/Geomtry/{Buffers.js → VoxelMeshBuffers.js} +2 -2
  29. package/Mesher/Geomtry/index.d.ts +0 -1
  30. package/Mesher/Geomtry/index.js +0 -1
  31. package/Mesher/InitMesher.js +1 -1
  32. package/Mesher/InitTask.js +9 -23
  33. package/Mesher/Models/Common/BoxGeometryNode.js +7 -7
  34. package/Mesher/Models/Common/Calc/CalcConstants.d.ts +1 -1
  35. package/Mesher/Models/Common/Calc/CalcConstants.js +1 -1
  36. package/Mesher/Models/Common/Calc/FaceDataCalc.d.ts +2 -2
  37. package/Mesher/Models/Common/Calc/FaceDataCalc.js +37 -30
  38. package/Mesher/Models/Common/QuadGeometryNode.js +2 -2
  39. package/Mesher/Models/Nodes/Custom/Liquid/FlowGradient.d.ts +2 -2
  40. package/Mesher/Models/Nodes/Custom/Liquid/FlowGradient.js +1 -1
  41. package/Mesher/Models/Nodes/Custom/Liquid/LiquidGeomtryNode.js +18 -24
  42. package/Mesher/Models/Nodes/GeometryNode.d.ts +2 -2
  43. package/Mesher/Models/Nodes/Ruled/BoxVoxelGeometryNode.d.ts +1 -0
  44. package/Mesher/Models/Nodes/Ruled/BoxVoxelGeometryNode.js +40 -31
  45. package/Mesher/Models/Nodes/Ruled/QuadVoxelGeometryNode.js +2 -2
  46. package/Mesher/Models/Nodes/Ruleless/RulelessBoxVoxelGeometryNode.js +2 -2
  47. package/Mesher/Models/Nodes/Ruleless/RulelessQuadVoxelGeometryNode.js +2 -2
  48. package/Mesher/{Tools → Models/Protocols}/OutlinedVoxelTool.d.ts +1 -1
  49. package/Mesher/{Tools → Models/Protocols}/OutlinedVoxelTool.js +1 -1
  50. package/Mesher/Models/RenderedMaterials.d.ts +6 -0
  51. package/Mesher/{RenderedMaterials.js → Models/RenderedMaterials.js} +2 -2
  52. package/Mesher/Models/VoxelConstructor.d.ts +6 -6
  53. package/Mesher/Models/VoxelConstructor.js +8 -8
  54. package/Mesher/Models/VoxelGeometryBuilderCacheSpace.d.ts +3 -5
  55. package/Mesher/Models/VoxelGeometryBuilderCacheSpace.js +8 -32
  56. package/Mesher/{Tools/VoxelMesherDataTool.d.ts → Models/VoxelModelBuilder.d.ts} +4 -5
  57. package/Mesher/{Tools/VoxelMesherDataTool.js → Models/VoxelModelBuilder.js} +5 -8
  58. package/Mesher/Types/Mesher.types.d.ts +1 -0
  59. package/Models/Defaults/CubeVoxelGeometry.js +4 -0
  60. package/Models/Defaults/CubeVoxelModels.js +360 -383
  61. package/Models/Defaults/LiquidVoxelModel.js +5 -5
  62. package/Models/Defaults/PanelVoxelModels.js +442 -468
  63. package/Models/Defaults/StairVoxelModel.js +582 -597
  64. package/Models/Examples.js +490 -498
  65. package/Models/Rules/Classes/VoxelRulesModel.d.ts +1 -1
  66. package/Models/Rules/Classes/VoxelRulesModel.js +3 -3
  67. package/Models/Rules/Functions/BuildFinalInputs.d.ts +1 -1
  68. package/Models/Rules/Functions/BuildFinalInputs.js +21 -19
  69. package/Models/Rules/Functions/BuildGeomtryInputs.js +8 -5
  70. package/Models/Rules/Functions/BuildRules.js +2 -2
  71. package/Models/Rules/{VoxelModelManager.d.ts → VoxelModelRuleBuilderRegister.d.ts} +1 -1
  72. package/Models/Rules/VoxelModelRuleBuilderRegister.js +178 -0
  73. package/Models/VoxelModel.types.d.ts +17 -8
  74. package/Renderer/Classes/DVESectionMeshes.d.ts +2 -3
  75. package/Renderer/Classes/SectorMesh.d.ts +3 -4
  76. package/Renderer/Classes/SectorMesh.js +6 -11
  77. package/Renderer/InitTasks.js +1 -10
  78. package/Renderer/MeshManager.d.ts +1 -1
  79. package/Renderer/MeshManager.js +26 -25
  80. package/Renderer/MeshRegister.d.ts +5 -5
  81. package/Renderer/MeshRegister.js +4 -3
  82. package/Settings/EngineSettings.d.ts +2 -1
  83. package/Settings/EngineSettings.js +6 -5
  84. package/Settings/EngineSettings.types.d.ts +24 -39
  85. package/Settings/EngineSettings.types.js +22 -29
  86. package/Tasks/Logic/InitTasks.d.ts +1 -0
  87. package/Tasks/Logic/InitTasks.js +10 -0
  88. package/Tasks/Logic/VoxelLogicUpdate.d.ts +3 -0
  89. package/Tasks/Logic/VoxelLogicUpdate.js +71 -0
  90. package/Tasks/Propagation/Explosion/ExplosionManager.d.ts +2 -2
  91. package/Tasks/Propagation/Explosion/ExplosionManager.js +1 -2
  92. package/Tasks/Propagation/Flow/FlowManager.d.ts +4 -4
  93. package/Tasks/Propagation/Flow/FlowRemove.d.ts +2 -2
  94. package/Tasks/Propagation/Flow/FlowUpdate.d.ts +2 -2
  95. package/Tasks/Propagation/Flow/WorldFlow.d.ts +2 -2
  96. package/Tasks/Propagation/Illumanation/RGBUpdate.d.ts +3 -3
  97. package/Tasks/Propagation/Illumanation/SunUpdate.d.ts +3 -3
  98. package/Tasks/Propagation/Illumanation/WorldRGB.d.ts +2 -2
  99. package/Tasks/Propagation/Illumanation/WorldSun.d.ts +2 -2
  100. package/Tasks/Propagation/Illumanation/WorldSun.js +8 -15
  101. package/Tasks/Propagation/InitTasks.js +4 -4
  102. package/Tasks/Propagation/Power/PowerUpdate.d.ts +3 -0
  103. package/Tasks/Propagation/Power/PowerUpdate.js +80 -0
  104. package/Tasks/Tasks.types.d.ts +2 -2
  105. package/Tasks/TasksIds.d.ts +2 -1
  106. package/Tasks/TasksIds.js +1 -0
  107. package/Tasks/Update/Common.d.ts +3 -0
  108. package/Tasks/Update/Common.js +41 -0
  109. package/Tasks/Update/EreaseUpdate.d.ts +3 -0
  110. package/Tasks/Update/EreaseUpdate.js +66 -0
  111. package/Tasks/Update/InitTasks.d.ts +2 -2
  112. package/Tasks/Update/InitTasks.js +3 -1
  113. package/Tasks/Update/PaintUpdate.d.ts +3 -0
  114. package/Tasks/Update/PaintUpdate.js +89 -0
  115. package/Tasks/Update/VoxelUpdate.d.ts +2 -5
  116. package/Tasks/Update/VoxelUpdate.js +7 -143
  117. package/Tasks/{Update/UpdateTask.d.ts → VoxelUpdateTask.d.ts} +16 -6
  118. package/Tasks/{Update/UpdateTask.js → VoxelUpdateTask.js} +44 -5
  119. package/Tasks/WorldGeneration/WorldGenBrush.d.ts +3 -3
  120. package/Tasks/WorldGeneration/WorldGenBrush.js +3 -3
  121. package/Tasks/WorldGeneration/WorldGenRegister.d.ts +1 -1
  122. package/Templates/Cursor/TemplateCursor.d.ts +2 -2
  123. package/Templates/Cursor/TemplateCursor.js +1 -2
  124. package/Templates/Functions/CreateTemplate.d.ts +1 -1
  125. package/Templates/VoxelTemplates.types.d.ts +1 -1
  126. package/Textures/Classes/CompiledTexture.d.ts +18 -0
  127. package/Textures/Classes/CompiledTexture.js +50 -0
  128. package/Textures/Classes/CompiledTextureAnimation.d.ts +12 -0
  129. package/Textures/Classes/CompiledTextureAnimation.js +27 -0
  130. package/Textures/Classes/TextureAnimationTexture.d.ts +10 -0
  131. package/Textures/Classes/TextureAnimationTexture.js +32 -0
  132. package/Textures/Functions/BuildTextureData.d.ts +10 -0
  133. package/Textures/Functions/BuildTextureData.js +205 -0
  134. package/Textures/Texture.types.d.ts +50 -64
  135. package/Textures/TextureManager.d.ts +8 -19
  136. package/Textures/TextureManager.js +28 -166
  137. package/Tools/Brush/AdvancedBrushTool.js +1 -1
  138. package/Tools/Brush/Brush.d.ts +3 -3
  139. package/Tools/Brush/Brush.js +40 -8
  140. package/Tools/Tasks/TasksTool.d.ts +1 -0
  141. package/Tools/Tasks/TasksTool.js +2 -0
  142. package/Util/Binary/BinaryArrays.d.ts +6 -0
  143. package/Util/Binary/BinaryArrays.js +25 -0
  144. package/Util/Binary/BinaryBuffer.d.ts +35 -0
  145. package/Util/Binary/BinaryBuffer.js +136 -0
  146. package/Util/Binary/{BitArray.d.ts → BinaryFunctions.d.ts} +1 -2
  147. package/Util/Binary/BinaryFunctions.js +11 -0
  148. package/{Mesher/Tools/VoxelMeshBVHBuilder.d.ts → Util/Binary/BinaryTree.d.ts} +1 -33
  149. package/Util/Binary/BinaryTree.js +104 -0
  150. package/Voxels/Cursor/DataCursor.interface.d.ts +5 -0
  151. package/Voxels/Cursor/VoxelCursor.interface.d.ts +8 -3
  152. package/Voxels/Cursor/VoxelCursor.interface.js +54 -13
  153. package/Voxels/Cursor/VoxelLightData.js +1 -1
  154. package/Voxels/Data/VoxelPalettesRegister.d.ts +0 -5
  155. package/Voxels/Data/VoxelPalettesRegister.js +0 -9
  156. package/Voxels/Data/VoxelTag.types.d.ts +17 -2
  157. package/Voxels/Data/VoxelTag.types.js +6 -1
  158. package/Voxels/Data/VoxelTagsRegister.js +12 -7
  159. package/Voxels/Functions/BuildStateData.d.ts +6 -6
  160. package/Voxels/Functions/BuildStateData.js +37 -37
  161. package/Voxels/Functions/BuildTagAndPaletteData.js +6 -3
  162. package/Voxels/Indexes/VoxelIndex.d.ts +2 -2
  163. package/Voxels/Indexes/VoxelIndex.js +16 -18
  164. package/Voxels/InitVoxelData.js +24 -21
  165. package/Voxels/Logic/Classes/Default/Types/VoxelPoweredLogicType.d.ts +5 -0
  166. package/Voxels/Logic/Classes/Default/Types/VoxelPoweredLogicType.js +6 -0
  167. package/Voxels/Logic/Classes/VoxelLogic.d.ts +11 -0
  168. package/Voxels/Logic/Classes/VoxelLogic.js +49 -0
  169. package/Voxels/Logic/Classes/VoxelLogicType.d.ts +4 -0
  170. package/Voxels/Logic/Classes/VoxelLogicType.js +2 -0
  171. package/Voxels/Logic/VoxelLogic.types.d.ts +23 -0
  172. package/Voxels/Logic/VoxelLogic.types.js +1 -0
  173. package/Voxels/Logic/VoxelLogicRegister.d.ts +9 -0
  174. package/Voxels/Logic/VoxelLogicRegister.js +15 -0
  175. package/Voxels/State/Schema/StateSchema.d.ts +1 -1
  176. package/Voxels/State/SchemaRegister.js +10 -5
  177. package/Voxels/State/State.types.d.ts +1 -1
  178. package/Voxels/State/StateTreeReader.d.ts +1 -1
  179. package/Voxels/State/StateTreeReader.js +2 -3
  180. package/Voxels/Types/Voxel.types.d.ts +21 -0
  181. package/Voxels/Types/Voxel.types.js +6 -2
  182. package/Voxels/Types/VoxelModelCompiledData.types.d.ts +6 -4
  183. package/World/Archive/Archive.types.d.ts +65 -42
  184. package/World/Archive/Classes/ArchiveClasses.d.ts +66 -0
  185. package/World/Archive/Classes/ArchiveClasses.js +78 -0
  186. package/World/Archive/Classes/ImportedSection.d.ts +40 -0
  187. package/World/Archive/Classes/ImportedSection.js +307 -0
  188. package/World/Archive/Classes/ImportedSector.d.ts +23 -0
  189. package/World/Archive/Classes/ImportedSector.js +97 -0
  190. package/World/Archive/Functions/ArchiveArea.d.ts +1 -1
  191. package/World/Archive/Functions/ArchiveArea.js +49 -54
  192. package/World/Archive/Functions/ArchiveSector.js +373 -282
  193. package/World/Archive/Functions/CreateArchivedSection.d.ts +3 -0
  194. package/World/Archive/Functions/CreateArchivedSection.js +207 -0
  195. package/World/Archive/Functions/ImportSector.d.ts +2 -4
  196. package/World/Archive/Functions/ImportSector.js +50 -220
  197. package/World/Archive/Functions/RemoveDuplicates.d.ts +3 -0
  198. package/World/Archive/Functions/RemoveDuplicates.js +92 -0
  199. package/World/Archive/Functions/Shared.d.ts +6 -0
  200. package/World/Archive/Functions/Shared.js +50 -0
  201. package/World/Archive/InitTasks.js +37 -23
  202. package/World/Cursor/SectionCursor.d.ts +3 -3
  203. package/World/Cursor/SectionCursor.js +2 -3
  204. package/World/Cursor/SectorCursor.d.ts +3 -3
  205. package/World/Cursor/SectorCursor.js +1 -2
  206. package/World/Cursor/WorldCursor.d.ts +6 -5
  207. package/World/Cursor/WorldCursor.js +17 -15
  208. package/World/Cursor/WorldVoxelCursor.d.ts +0 -4
  209. package/World/Cursor/WorldVoxelCursor.js +24 -14
  210. package/World/Dimension/Dimension.d.ts +4 -1
  211. package/World/Dimension/Dimension.js +8 -1
  212. package/World/InitTasks.d.ts +1 -1
  213. package/World/Lock/WorldLock.d.ts +1 -1
  214. package/World/Section/Section.d.ts +27 -18
  215. package/World/Section/Section.js +125 -21
  216. package/World/Section/SectionState.d.ts +12 -0
  217. package/World/Section/SectionState.js +13 -0
  218. package/World/Sector/Sector.d.ts +20 -6
  219. package/World/Sector/Sector.js +100 -17
  220. package/World/Sector/SectorHeightMap.js +2 -2
  221. package/World/Sector/SectorState.d.ts +16 -7
  222. package/World/Sector/SectorState.js +29 -15
  223. package/World/Types/WorldData.types.d.ts +2 -7
  224. package/World/Types/WorldStorage.interface.js +1 -0
  225. package/World/WorldRegister.d.ts +13 -9
  226. package/World/WorldRegister.js +24 -9
  227. package/World/WorldSpaces.d.ts +4 -0
  228. package/World/WorldSpaces.js +25 -12
  229. package/{Tasks/IWG → WorldSimulation}/Internal/Classes/DimensionSegment.d.ts +2 -2
  230. package/{Tasks/IWG → WorldSimulation}/Internal/Classes/Generator.d.ts +10 -3
  231. package/{Tasks/IWG → WorldSimulation}/Internal/Classes/Generator.js +19 -3
  232. package/WorldSimulation/Internal/Classes/Queues/BuildQueue.d.ts +5 -0
  233. package/WorldSimulation/Internal/Classes/Queues/BuildQueue.js +6 -0
  234. package/WorldSimulation/Internal/Classes/Queues/LogiccQueue.d.ts +5 -0
  235. package/WorldSimulation/Internal/Classes/Queues/LogiccQueue.js +6 -0
  236. package/{Tasks/IWG → WorldSimulation}/Internal/Classes/SectorVisistedMap.js +1 -1
  237. package/WorldSimulation/Internal/Classes/TickQueue.d.ts +12 -0
  238. package/WorldSimulation/Internal/Classes/TickQueue.js +58 -0
  239. package/WorldSimulation/Internal/Classes/WorldSimulationTaskBase.d.ts +15 -0
  240. package/{Tasks/IWG/Internal/Classes/IWGTaskBase.js → WorldSimulation/Internal/Classes/WorldSimulationTaskBase.js} +8 -8
  241. package/{Tasks/IWG → WorldSimulation}/Internal/Functions/cullSectors.js +9 -9
  242. package/{Tasks/IWG → WorldSimulation}/Internal/Functions/getSectorState.d.ts +1 -1
  243. package/{Tasks/IWG → WorldSimulation}/Internal/Functions/getSectorState.js +4 -4
  244. package/WorldSimulation/Internal/Functions/runTickUpdate.d.ts +2 -0
  245. package/{Tasks/IWG/Internal/Functions/runBuildUpdate.js → WorldSimulation/Internal/Functions/runTickUpdate.js} +38 -9
  246. package/{Tasks/IWG → WorldSimulation}/Internal/Functions/runWorldUpdate.js +13 -13
  247. package/{Tasks/IWG → WorldSimulation}/Internal/TaskRegister.d.ts +2 -2
  248. package/{Tasks/IWG → WorldSimulation}/Internal/TaskRegister.js +1 -1
  249. package/WorldSimulation/Internal/WorldSimulationDimensions.d.ts +6 -0
  250. package/{Tasks/IWG/Internal/IWGDimensions.js → WorldSimulation/Internal/WorldSimulationDimensions.js} +1 -1
  251. package/WorldSimulation/Internal/WorldSimulationTasks.d.ts +30 -0
  252. package/{Tasks/IWG/Internal/IWGTasks.js → WorldSimulation/Internal/WorldSimulationTasks.js} +14 -24
  253. package/WorldSimulation/Internal/WorldSimulationTools.d.ts +8 -0
  254. package/{Tasks/IWG/Internal/IWGTools.js → WorldSimulation/Internal/WorldSimulationTools.js} +1 -1
  255. package/{Tasks/IWG → WorldSimulation}/Procedures/InitalLoad.d.ts +1 -1
  256. package/{Tasks/IWG → WorldSimulation}/Procedures/InitalLoad.js +11 -11
  257. package/{Tasks/IWG → WorldSimulation}/Procedures/SaveAllSectors.js +7 -5
  258. package/{Tasks/IWG/IWG.d.ts → WorldSimulation/WorldSimulation.d.ts} +6 -5
  259. package/{Tasks/IWG/IWG.js → WorldSimulation/WorldSimulation.js} +29 -23
  260. package/{Tasks/IWG → WorldSimulation}/index.d.ts +1 -1
  261. package/{Tasks/IWG → WorldSimulation}/index.js +1 -1
  262. package/package.json +1 -1
  263. package/Mesher/Functions/CompactMesh.d.ts +0 -2
  264. package/Mesher/Functions/CompactMesh.js +0 -42
  265. package/Mesher/Geomtry/GeometryNormals.d.ts +0 -10
  266. package/Mesher/Geomtry/GeometryNormals.js +0 -52
  267. package/Mesher/Geomtry/MeshData.types.d.ts +0 -13
  268. package/Mesher/Geomtry/MeshData.types.js +0 -6
  269. package/Mesher/Geomtry/Tools/MesherDataTools.d.ts +0 -7
  270. package/Mesher/Geomtry/Tools/MesherDataTools.js +0 -12
  271. package/Mesher/Geomtry/Tools/index.d.ts +0 -1
  272. package/Mesher/Geomtry/Tools/index.js +0 -1
  273. package/Mesher/RenderedMaterials.d.ts +0 -6
  274. package/Mesher/Tools/VoxelMeshBVHBuilder.js +0 -216
  275. package/Models/Rules/VoxelModelManager.js +0 -82
  276. package/Tasks/IWG/Internal/Classes/IWGTaskBase.d.ts +0 -15
  277. package/Tasks/IWG/Internal/Functions/runBuildUpdate.d.ts +0 -2
  278. package/Tasks/IWG/Internal/IWGDimensions.d.ts +0 -6
  279. package/Tasks/IWG/Internal/IWGTasks.d.ts +0 -34
  280. package/Tasks/IWG/Internal/IWGTools.d.ts +0 -8
  281. package/Textures/TextureAnimations.d.ts +0 -4
  282. package/Textures/TextureAnimations.js +0 -35
  283. package/Textures/TextureArray.d.ts +0 -47
  284. package/Textures/TextureArray.js +0 -202
  285. package/Textures/TextureBuilder.d.ts +0 -13
  286. package/Textures/TextureBuilder.js +0 -120
  287. package/Textures/TextureRegister.d.ts +0 -9
  288. package/Textures/TextureRegister.js +0 -28
  289. package/Tools/DataCursor.interface.d.ts +0 -5
  290. package/Tools/DataCursor.interface.js +0 -2
  291. package/Util/Binary/BitArray.js +0 -16
  292. package/World/Structs/WorldDataStructProperties.d.ts +0 -8
  293. package/World/Structs/WorldDataStructProperties.js +0 -9
  294. /package/Mesher/Geomtry/{Buffers.d.ts → VoxelMeshBuffers.d.ts} +0 -0
  295. /package/Mesher/{Tools → Geomtry}/VoxelMeshVertexStructCursor.d.ts +0 -0
  296. /package/Mesher/{Tools → Geomtry}/VoxelMeshVertexStructCursor.js +0 -0
  297. /package/Mesher/{VoxelShaderData.d.ts → Geomtry/VoxelShaderData.d.ts} +0 -0
  298. /package/Mesher/{VoxelShaderData.js → Geomtry/VoxelShaderData.js} +0 -0
  299. /package/{World/Storage/WorldStorage.interface.js → Voxels/Cursor/DataCursor.interface.js} +0 -0
  300. /package/World/{Storage → Types}/WorldStorage.interface.d.ts +0 -0
  301. /package/{Tasks/IWG → WorldSimulation}/Internal/Classes/DimensionSegment.js +0 -0
  302. /package/{Tasks/IWG → WorldSimulation}/Internal/Classes/SectorState.d.ts +0 -0
  303. /package/{Tasks/IWG → WorldSimulation}/Internal/Classes/SectorState.js +0 -0
  304. /package/{Tasks/IWG → WorldSimulation}/Internal/Classes/SectorVisistedMap.d.ts +0 -0
  305. /package/{Tasks/IWG → WorldSimulation}/Internal/Functions/cullSectors.d.ts +0 -0
  306. /package/{Tasks/IWG → WorldSimulation}/Internal/Functions/runWorldUpdate.d.ts +0 -0
  307. /package/{Tasks/IWG → WorldSimulation}/Procedures/SaveAllSectors.d.ts +0 -0
@@ -1,44 +1,58 @@
1
1
  import { Vec3Array } from "@amodx/math";
2
- import { LocationData } from "../../Math";
2
+ import { BinaryBufferData } from "../../Util/Binary/BinaryBuffer";
3
+ export type ArchivedLightSegments = "sun" | "red" | "green" | "blue";
3
4
  /**
4
5
  * Interface for an archived sector.
5
6
  */
6
7
  export interface ArchivedSectorData {
7
- /** The version of vlox the data was stored in. */
8
+ /** A user provided version of the data. */
8
9
  version: string;
10
+ /** The version of vlox the data was stored in. */
11
+ vloxVersion: string;
12
+ dimension: string;
9
13
  /** The location of the sector in the world. */
10
- location: LocationData;
11
- /** Record of the sector's state, storing dynamic or user-defined data. */
12
- sectorState: Record<string, any>;
14
+ location: Vec3Array;
15
+ /** Record of the sector's bit flags. */
16
+ flags: Record<string, boolean>;
17
+ /** Record of the sector's timestamps. */
18
+ timestamps: Record<string, number>;
13
19
  /** The palette data used within the sector. */
14
20
  palettes: ArchivedSectorPaletteData;
15
21
  /** Placeholder for future buffer data. */
16
22
  buffers: ArchivedSectorBuffersData;
17
- /** Keys associated with section states and other objects. */
18
- keys: ArchivedSectorKeysData;
23
+ /**Contains duplicate data like duplicate sections. */
24
+ duplicates: ArchivedSectorDuplicteData;
19
25
  /** Array of archived section data within the sector. */
20
- sections: ArchivedSectionData[];
26
+ sections: (ArchivedSectionData | string)[];
27
+ }
28
+ export interface ArchivedSectorDuplicteData {
29
+ sections?: Record<string, ArchivedSectionData>;
21
30
  }
22
31
  /**
23
32
  * Interface for the palettes of an archived sector.
24
33
  */
25
34
  export interface ArchivedSectorPaletteData {
26
35
  id: string[];
27
- secondaryId?: string[];
36
+ secondaryId: string[];
37
+ /**A map of sector voxel ids to a palette of store state objects.
38
+ *1. First depth -> voxels
39
+ *2. Second depth -> voxel states
40
+ *3. Third depth -> state object
41
+ */
42
+ stateMap: any[][][];
43
+ /**Same as state map but for secondary voxels */
44
+ secondaryStateMap: any[][][];
45
+ /**A map of sector voxel ids to a palette of store mod state objects.
46
+ *1. First depth -> voxels
47
+ *2. Second depth -> voxel mode states
48
+ *3. Third depth -> mode state object
49
+ */
50
+ modMap: any[][][];
51
+ /**Same as mod map but for secondary voxels */
52
+ secondaryModMap: any[][][];
28
53
  level?: Uint8Array;
29
- stateMap: Record<number, any[]>;
30
- modMap: Record<number, any[]>;
31
- state: Uint16Array;
32
- mod: Uint16Array;
33
- light?: Uint16Array;
34
- secondaryState?: Uint16Array;
35
- }
36
- /**
37
- * Interface for the keys of an archived sector.
38
- */
39
- export interface ArchivedSectorKeysData {
40
- /** Array of strings that are the keys for the section state struct. */
41
- sectionState: string[];
54
+ light: Partial<Record<ArchivedLightSegments, Uint8Array>>;
55
+ secondaryValue?: Uint16Array;
42
56
  }
43
57
  /**
44
58
  * Placeholder interface for future buffer data in a sector.
@@ -49,10 +63,10 @@ export interface ArchivedSectorBuffersData {
49
63
  * Interface for an archived section.
50
64
  */
51
65
  export interface ArchivedSectionData {
52
- /** Array representing the section's state, holding dynamic or user-defined data. */
53
- state: any[];
66
+ /** Record of the sections's bit flags. */
67
+ flags?: Record<string, boolean>;
54
68
  /** Palette data used within the section. */
55
- palettes: ArchivedSectionPaletteData;
69
+ palettes?: ArchivedSectionPaletteData;
56
70
  /** Buffer data for the section, holding voxel type identifiers, light data, state, and secondary state. */
57
71
  buffers: ArchivedSectionBuffers;
58
72
  }
@@ -61,23 +75,32 @@ export interface ArchivedSectionData {
61
75
  */
62
76
  export interface ArchivedSectionPaletteData {
63
77
  id?: Uint16Array;
64
- light?: Uint16Array;
78
+ light?: Partial<Record<ArchivedLightSegments, Uint8Array>>;
65
79
  level?: Uint8Array;
66
80
  secondaryId?: Uint16Array;
67
- state?: Uint16Array;
68
- mod?: Uint16Array;
69
- secondaryState?: Uint16Array;
81
+ /** Palette of sector voxel ids to a palette of state ids for the voxel*/
82
+ state?: Record<number, Uint16Array>;
83
+ /** Palette of sector secondary voxel ids to a palette of state ids for the voxel*/
84
+ secondaryState?: Record<number, Uint16Array>;
85
+ /** Palette of sector voxel ids to a palette of mod ids for the voxel*/
86
+ mod?: Record<number, Uint16Array>;
87
+ /** Palette of sector secondary voxel ids to a palette of mod ids for the voxel*/
88
+ secondaryMod?: Record<number, Uint16Array>;
89
+ secondaryValue?: Uint16Array;
70
90
  }
71
91
  /**
72
92
  * Interface representing the buffer data for a section.
73
93
  */
74
94
  export interface ArchivedSectionBuffers {
75
- id: Uint16Array | Uint8Array | number;
76
- light: Uint16Array | Uint8Array | number;
77
- level: Uint8Array | number;
78
- state: Uint16Array | Uint8Array | number;
79
- mod: Uint16Array | Uint8Array | number;
80
- secondary: Uint16Array | Uint8Array | number;
95
+ buried?: Uint8Array | number;
96
+ voxelMap?: Uint8Array | number;
97
+ dirtyMap?: Uint8Array | number;
98
+ id?: BinaryBufferData | number;
99
+ light?: Partial<Record<ArchivedLightSegments, BinaryBufferData | number>>;
100
+ level?: BinaryBufferData | number;
101
+ state?: BinaryBufferData | number;
102
+ mod?: BinaryBufferData | number;
103
+ secondary?: BinaryBufferData | number;
81
104
  }
82
105
  /**
83
106
  * Interface for an archived area.
@@ -113,7 +136,7 @@ export interface ArchivedAreaMapData {
113
136
  /** Record mapping string IDs to arrays of secondary voxel identifiers. */
114
137
  secondaryIdPalette: Record<string, string[]>;
115
138
  /** Record mapping string IDs to Uint16Arrays of secondary voxel states. */
116
- secondaryStatePalette: Record<string, Uint16Array>;
139
+ secondaryValuePalette: Record<string, Uint16Array>;
117
140
  /** Record mapping section identifiers to `ArchivedSectionData`. */
118
141
  section: Record<string, ArchivedSectionData>;
119
142
  /** Record mapping sector state identifiers to arrays of state data. */
@@ -133,14 +156,14 @@ export interface ArchivedAreaKeysData {
133
156
  */
134
157
  export interface ArchivedAreaSectorPaletteData {
135
158
  id: string[];
136
- light?: Uint16Array;
137
- level?: Uint8Array;
138
- state?: Uint16Array;
139
- mod?: Uint16Array;
159
+ light: Uint16Array;
160
+ level: Uint8Array;
161
+ state: Uint16Array;
162
+ mod: Uint16Array;
140
163
  stateMap: Record<number, any[]>;
141
164
  modMap: Record<number, any[]>;
142
- secondaryId?: string[];
143
- secondaryState?: Uint16Array;
165
+ secondaryId: string[];
166
+ secondaryValueState: Uint16Array;
144
167
  }
145
168
  /**
146
169
  * Interface representing the archived data for a sector within an area.
@@ -0,0 +1,66 @@
1
+ import { StringPalette } from "../../../Util/StringPalette";
2
+ import { NumberPalette } from "../../../Util/NumberPalette";
3
+ import { Section } from "../../../World/Section";
4
+ import { ArchivedLightSegments } from "../Archive.types";
5
+ declare class ProcessedData<Buffer = any> {
6
+ buffer: Buffer;
7
+ constructor(buffer: Buffer);
8
+ allTheSame: boolean;
9
+ isPaletted: boolean;
10
+ remapped: boolean;
11
+ value: number;
12
+ }
13
+ declare class SectionPalette {
14
+ ids: NumberPalette;
15
+ level: NumberPalette;
16
+ light: LightPalette;
17
+ maxStatePaletteSize: number;
18
+ state: Record<number, NumberPalette>;
19
+ secondaryState: Record<number, NumberPalette>;
20
+ maxModPaletteSize: number;
21
+ mod: Record<number, NumberPalette>;
22
+ secondaryMod: Record<number, NumberPalette>;
23
+ secondaryId: NumberPalette;
24
+ secondaryValue: NumberPalette;
25
+ }
26
+ export declare class ProcessedSection {
27
+ original: Section;
28
+ palettes: SectionPalette;
29
+ isBuriedAllTheSame: boolean;
30
+ buriedValue: number;
31
+ isVoxelMapAllTheSame: boolean;
32
+ voxelMapValue: number;
33
+ isDirtyMapAllTheSame: boolean;
34
+ dirtyMapValue: number;
35
+ ids: ProcessedData<Uint16Array>;
36
+ light: Record<ArchivedLightSegments, ProcessedData<Uint8Array>>;
37
+ level: ProcessedData<Uint8Array>;
38
+ state: ProcessedData<Uint16Array>;
39
+ mod: ProcessedData<Uint16Array>;
40
+ secondary: ProcessedData<Uint16Array>;
41
+ constructor(original: Section);
42
+ }
43
+ declare class LightPalette {
44
+ sun: NumberPalette;
45
+ red: NumberPalette;
46
+ green: NumberPalette;
47
+ blue: NumberPalette;
48
+ }
49
+ export declare class VoxelStateObjectMap {
50
+ palette: NumberPalette;
51
+ states: any[];
52
+ }
53
+ export declare class SectorPalette {
54
+ ids: StringPalette;
55
+ level: NumberPalette;
56
+ light: LightPalette;
57
+ stateMap: VoxelStateObjectMap[];
58
+ secondaryStateMap: VoxelStateObjectMap[];
59
+ maxStatePaletteSize: number;
60
+ modMap: VoxelStateObjectMap[];
61
+ secondaryModMap: VoxelStateObjectMap[];
62
+ maxModPaletteSize: number;
63
+ secondaryId: StringPalette;
64
+ secondaryValue: NumberPalette;
65
+ }
66
+ export {};
@@ -0,0 +1,78 @@
1
+ import { StringPalette } from "../../../Util/StringPalette";
2
+ import { NumberPalette } from "../../../Util/NumberPalette";
3
+ class ProcessedData {
4
+ buffer;
5
+ constructor(buffer) {
6
+ this.buffer = buffer;
7
+ }
8
+ allTheSame = true;
9
+ isPaletted = false;
10
+ remapped = false;
11
+ value = 0;
12
+ }
13
+ class SectionPalette {
14
+ ids = new NumberPalette();
15
+ level = new NumberPalette();
16
+ light = new LightPalette();
17
+ maxStatePaletteSize = 0;
18
+ state = {};
19
+ secondaryState = {};
20
+ maxModPaletteSize = 0;
21
+ mod = {};
22
+ secondaryMod = {};
23
+ secondaryId = new NumberPalette();
24
+ secondaryValue = new NumberPalette();
25
+ }
26
+ export class ProcessedSection {
27
+ original;
28
+ palettes = new SectionPalette();
29
+ isBuriedAllTheSame = false;
30
+ buriedValue = 0;
31
+ isVoxelMapAllTheSame = false;
32
+ voxelMapValue = 0;
33
+ isDirtyMapAllTheSame = false;
34
+ dirtyMapValue = 0;
35
+ ids;
36
+ light;
37
+ level;
38
+ state;
39
+ mod;
40
+ secondary;
41
+ constructor(original) {
42
+ this.original = original;
43
+ this.ids = new ProcessedData(new Uint16Array(original.ids.length));
44
+ this.level = new ProcessedData(new Uint8Array(original.level.length));
45
+ this.light = {
46
+ sun: new ProcessedData(new Uint8Array(original.light.length)),
47
+ red: new ProcessedData(new Uint8Array(original.light.length)),
48
+ green: new ProcessedData(new Uint8Array(original.light.length)),
49
+ blue: new ProcessedData(new Uint8Array(original.light.length)),
50
+ };
51
+ this.state = new ProcessedData(new Uint16Array(original.state.length));
52
+ this.mod = new ProcessedData(new Uint16Array(original.mod.length));
53
+ this.secondary = new ProcessedData(new Uint16Array(original.mod.length));
54
+ }
55
+ }
56
+ class LightPalette {
57
+ sun = new NumberPalette();
58
+ red = new NumberPalette();
59
+ green = new NumberPalette();
60
+ blue = new NumberPalette();
61
+ }
62
+ export class VoxelStateObjectMap {
63
+ palette = new NumberPalette();
64
+ states = [];
65
+ }
66
+ export class SectorPalette {
67
+ ids = new StringPalette();
68
+ level = new NumberPalette();
69
+ light = new LightPalette();
70
+ stateMap = [];
71
+ secondaryStateMap = [];
72
+ maxStatePaletteSize = 0;
73
+ modMap = [];
74
+ secondaryModMap = [];
75
+ maxModPaletteSize = 0;
76
+ secondaryId = new StringPalette();
77
+ secondaryValue = new NumberPalette();
78
+ }
@@ -0,0 +1,40 @@
1
+ import { NumberPalette } from "../../../Util/NumberPalette";
2
+ import { ArchivedLightSegments, ArchivedSectionData } from "../Archive.types";
3
+ import { BinaryBuffer } from "../../../Util/Binary/BinaryBuffer";
4
+ import { ImportedSector } from "./ImportedSector";
5
+ declare class ImportedSectionBuffers {
6
+ ids: BinaryBuffer;
7
+ level: BinaryBuffer;
8
+ light: Record<ArchivedLightSegments, BinaryBuffer>;
9
+ state: BinaryBuffer;
10
+ mod: BinaryBuffer;
11
+ secondary: BinaryBuffer;
12
+ constructor(section: ArchivedSectionData);
13
+ }
14
+ declare class ImportedSectionPalettes {
15
+ id?: NumberPalette;
16
+ level?: NumberPalette;
17
+ light: Record<ArchivedLightSegments, NumberPalette | null>;
18
+ state?: NumberPalette[];
19
+ secondaryState?: NumberPalette[];
20
+ mod?: NumberPalette[];
21
+ secondaryMod?: NumberPalette[];
22
+ secondaryId?: NumberPalette;
23
+ secondaryValue?: NumberPalette;
24
+ constructor(section: ArchivedSectionData);
25
+ }
26
+ export declare class ImportedSection {
27
+ sectionIndex: number;
28
+ sector: ImportedSector;
29
+ section: ArchivedSectionData;
30
+ buffers: ImportedSectionBuffers;
31
+ palettes: ImportedSectionPalettes;
32
+ constructor(sectionIndex: number, sector: ImportedSector, section: ArchivedSectionData);
33
+ getId(index: number): number;
34
+ getLight(index: number): number;
35
+ getLevel(index: number): number;
36
+ getSecondary(index: number): number;
37
+ getState(index: number): number;
38
+ getMod(index: number): number;
39
+ }
40
+ export {};
@@ -0,0 +1,307 @@
1
+ import { NumberPalette } from "../../../Util/NumberPalette";
2
+ import { BinaryBuffer, BinaryBufferTypes, } from "../../../Util/Binary/BinaryBuffer";
3
+ import { VoxelPalettesRegister } from "../../../Voxels/Data/VoxelPalettesRegister";
4
+ import { lightSegments, lightSemgnetSet } from "../Functions/Shared";
5
+ import { VoxelTagsRegister } from "../../../Voxels/Data/VoxelTagsRegister";
6
+ class ImportedSectionBuffers {
7
+ ids;
8
+ level;
9
+ light;
10
+ state;
11
+ mod;
12
+ secondary;
13
+ constructor(section) {
14
+ this.ids = !section.buffers.id
15
+ ? new BinaryBuffer({ buffer: 0, type: BinaryBufferTypes.Value })
16
+ : typeof section.buffers.id == "number"
17
+ ? new BinaryBuffer({
18
+ buffer: section.buffers.id,
19
+ type: BinaryBufferTypes.Value,
20
+ })
21
+ : new BinaryBuffer(section.buffers.id);
22
+ this.level = !section.buffers.level
23
+ ? new BinaryBuffer({ buffer: 0, type: BinaryBufferTypes.Value })
24
+ : typeof section.buffers.level == "number"
25
+ ? new BinaryBuffer({
26
+ buffer: section.buffers.level,
27
+ type: BinaryBufferTypes.Value,
28
+ })
29
+ : new BinaryBuffer(section.buffers.level);
30
+ this.light = {
31
+ sun: !section.buffers.light?.sun
32
+ ? new BinaryBuffer({ buffer: 0, type: BinaryBufferTypes.Value })
33
+ : typeof section.buffers.light.sun == "number"
34
+ ? new BinaryBuffer({
35
+ buffer: section.buffers.light.sun,
36
+ type: BinaryBufferTypes.Value,
37
+ })
38
+ : new BinaryBuffer(section.buffers.light.sun),
39
+ red: !section.buffers.light?.red
40
+ ? new BinaryBuffer({ buffer: 0, type: BinaryBufferTypes.Value })
41
+ : typeof section.buffers.light.red == "number"
42
+ ? new BinaryBuffer({
43
+ buffer: section.buffers.light.red,
44
+ type: BinaryBufferTypes.Value,
45
+ })
46
+ : new BinaryBuffer(section.buffers.light.red),
47
+ green: !section.buffers.light?.green
48
+ ? new BinaryBuffer({ buffer: 0, type: BinaryBufferTypes.Value })
49
+ : typeof section.buffers.light.green == "number"
50
+ ? new BinaryBuffer({
51
+ buffer: section.buffers.light.green,
52
+ type: BinaryBufferTypes.Value,
53
+ })
54
+ : new BinaryBuffer(section.buffers.light.green),
55
+ blue: !section.buffers.light?.blue
56
+ ? new BinaryBuffer({ buffer: 0, type: BinaryBufferTypes.Value })
57
+ : typeof section.buffers.light.blue == "number"
58
+ ? new BinaryBuffer({
59
+ buffer: section.buffers.light.blue,
60
+ type: BinaryBufferTypes.Value,
61
+ })
62
+ : new BinaryBuffer(section.buffers.light.blue),
63
+ };
64
+ this.state = !section.buffers.state
65
+ ? new BinaryBuffer({ buffer: 0, type: BinaryBufferTypes.Value })
66
+ : typeof section.buffers.state == "number"
67
+ ? new BinaryBuffer({
68
+ buffer: section.buffers.state,
69
+ type: BinaryBufferTypes.Value,
70
+ })
71
+ : new BinaryBuffer(section.buffers.state);
72
+ this.mod = !section.buffers.mod
73
+ ? new BinaryBuffer({ buffer: 0, type: BinaryBufferTypes.Value })
74
+ : typeof section.buffers.mod == "number"
75
+ ? new BinaryBuffer({
76
+ buffer: section.buffers.mod,
77
+ type: BinaryBufferTypes.Value,
78
+ })
79
+ : new BinaryBuffer(section.buffers.mod);
80
+ this.secondary = !section.buffers.secondary
81
+ ? new BinaryBuffer({ buffer: 0, type: BinaryBufferTypes.Value })
82
+ : typeof section.buffers.secondary == "number"
83
+ ? new BinaryBuffer({
84
+ buffer: section.buffers.secondary,
85
+ type: BinaryBufferTypes.Value,
86
+ })
87
+ : new BinaryBuffer(section.buffers.secondary);
88
+ }
89
+ }
90
+ class ImportedSectionPalettes {
91
+ id;
92
+ level;
93
+ light;
94
+ state;
95
+ secondaryState;
96
+ mod;
97
+ secondaryMod;
98
+ secondaryId;
99
+ secondaryValue;
100
+ constructor(section) {
101
+ this.id = section.palettes?.id
102
+ ? new NumberPalette(section.palettes?.id)
103
+ : undefined;
104
+ this.light = {
105
+ sun: section.palettes?.light?.sun
106
+ ? new NumberPalette(section.palettes?.light?.sun)
107
+ : null,
108
+ red: section.palettes?.light?.red
109
+ ? new NumberPalette(section.palettes?.light?.red)
110
+ : null,
111
+ green: section.palettes?.light?.green
112
+ ? new NumberPalette(section.palettes?.light?.green)
113
+ : null,
114
+ blue: section.palettes?.light?.blue
115
+ ? new NumberPalette(section.palettes?.light?.blue)
116
+ : null,
117
+ };
118
+ this.level = section.palettes?.level
119
+ ? new NumberPalette(section.palettes?.level)
120
+ : undefined;
121
+ if (section.palettes?.state) {
122
+ for (const stateKey in section.palettes.state) {
123
+ this.state ??= [];
124
+ this.state[stateKey] = new NumberPalette(section.palettes.state[stateKey]);
125
+ }
126
+ }
127
+ if (section.palettes?.mod) {
128
+ for (const modKey in section.palettes.mod) {
129
+ this.mod ??= [];
130
+ this.mod[modKey] = new NumberPalette(section.palettes.mod[modKey]);
131
+ }
132
+ }
133
+ this.secondaryValue = section.palettes?.secondaryValue
134
+ ? new NumberPalette(section.palettes?.secondaryValue)
135
+ : undefined;
136
+ this.secondaryId = section.palettes?.secondaryId
137
+ ? new NumberPalette(section.palettes?.secondaryId)
138
+ : undefined;
139
+ }
140
+ }
141
+ export class ImportedSection {
142
+ sectionIndex;
143
+ sector;
144
+ section;
145
+ buffers;
146
+ palettes;
147
+ constructor(sectionIndex, sector, section) {
148
+ this.sectionIndex = sectionIndex;
149
+ this.sector = sector;
150
+ this.section = section;
151
+ this.buffers = new ImportedSectionBuffers(section);
152
+ this.palettes = new ImportedSectionPalettes(section);
153
+ }
154
+ getId(index) {
155
+ const value = this.buffers.ids.getValue(index);
156
+ if (this.buffers.ids.type == BinaryBufferTypes.Value) {
157
+ return VoxelPalettesRegister.voxels.getNumberId(this.sector.palettes.id.getStringId(value));
158
+ }
159
+ if (this.palettes.id) {
160
+ return VoxelPalettesRegister.voxels.getNumberId(this.sector.palettes.id.getStringId(this.palettes.id.getValue(value)));
161
+ }
162
+ return VoxelPalettesRegister.voxels.getNumberId(this.sector.palettes.id.getStringId(value));
163
+ }
164
+ getLight(index) {
165
+ let finalLight = 0;
166
+ for (let l = 0; l < lightSegments.length; l++) {
167
+ const segment = lightSegments[l];
168
+ let value = 0;
169
+ if (this.buffers.light[segment].type == BinaryBufferTypes.Value) {
170
+ value = this.buffers.light[segment].getValue(index);
171
+ }
172
+ else {
173
+ if (this.buffers.light[segment].type == BinaryBufferTypes.NibbleArray) {
174
+ value = this.buffers.light[segment].getValue(index);
175
+ }
176
+ else {
177
+ if (this.palettes.light[segment]) {
178
+ value = this.palettes.light[segment].getValue(this.buffers.light[segment].getValue(index));
179
+ }
180
+ else if (this.sector.palettes.light[segment]) {
181
+ value = this.sector.palettes.light[segment].getValue(this.buffers.light[segment].getValue(index));
182
+ }
183
+ }
184
+ }
185
+ finalLight = lightSemgnetSet[segment](value, finalLight);
186
+ }
187
+ return finalLight;
188
+ }
189
+ getLevel(index) {
190
+ const value = this.buffers.level.getValue(index);
191
+ if (this.palettes.level) {
192
+ return this.palettes.level.getValue(value);
193
+ }
194
+ if (this.sector.palettes.level) {
195
+ return this.sector.palettes.level.getValue(value);
196
+ }
197
+ return value;
198
+ }
199
+ getSecondary(index) {
200
+ const voxelId = this.getId(index);
201
+ const value = this.buffers.secondary.getValue(index);
202
+ if (VoxelTagsRegister.VoxelTags[voxelId]["dve_can_have_secondary"]) {
203
+ if (this.palettes.secondaryId) {
204
+ return VoxelPalettesRegister.voxels.getNumberId(this.sector.palettes.secondaryId.getStringId(this.palettes.secondaryId.getValue(value)));
205
+ }
206
+ return VoxelPalettesRegister.voxels.getNumberId(this.sector.sector.palettes.secondaryId[value]);
207
+ }
208
+ if (typeof this.section.buffers.secondary == "number") {
209
+ return value;
210
+ }
211
+ if (this.palettes.secondaryValue && this.sector.palettes.secondaryValue) {
212
+ return this.sector.palettes.secondaryValue.getValue(this.palettes.secondaryValue.getValue(value));
213
+ }
214
+ if (this.sector.palettes.secondaryValue) {
215
+ return this.sector.palettes.secondaryValue.getId(value);
216
+ }
217
+ return value;
218
+ }
219
+ getState(index) {
220
+ const stateIndex = this.buffers.state.getValue(index);
221
+ let returnValue = stateIndex;
222
+ let voxelId = VoxelPalettesRegister.voxels.getStringId(this.getId(index));
223
+ const secondary = VoxelTagsRegister.VoxelTags[this.getId(index)]["dve_can_have_secondary"] && this.getSecondary(index) > 0;
224
+ if (secondary) {
225
+ voxelId = VoxelPalettesRegister.voxels.getStringId(this.getSecondary(index));
226
+ let voxelIndex = this.sector.palettes.secondaryId.getNumberId(voxelId);
227
+ const statePalette = this.sector.palettes.secondaryState[voxelIndex];
228
+ if (!statePalette)
229
+ return 0;
230
+ if (this.buffers.state.type == BinaryBufferTypes.Value) {
231
+ returnValue = statePalette[stateIndex];
232
+ }
233
+ else {
234
+ if (this.section.palettes?.secondaryState) {
235
+ returnValue =
236
+ statePalette[this.section.palettes?.secondaryState[voxelIndex][stateIndex]];
237
+ }
238
+ else {
239
+ returnValue = statePalette[stateIndex];
240
+ }
241
+ }
242
+ }
243
+ else {
244
+ let voxelIndex = this.sector.palettes.id.getNumberId(voxelId);
245
+ const statePalette = this.sector.palettes.state[voxelIndex];
246
+ if (!statePalette)
247
+ return 0;
248
+ if (this.buffers.state.type == BinaryBufferTypes.Value) {
249
+ returnValue = statePalette[stateIndex];
250
+ }
251
+ else {
252
+ if (this.section.palettes?.state) {
253
+ returnValue =
254
+ statePalette[this.section.palettes?.state[voxelIndex][stateIndex]];
255
+ }
256
+ else {
257
+ returnValue = statePalette[stateIndex];
258
+ }
259
+ }
260
+ }
261
+ return returnValue;
262
+ }
263
+ getMod(index) {
264
+ const modIndex = this.buffers.mod.getValue(index);
265
+ let returnValue = modIndex;
266
+ let voxelId = VoxelPalettesRegister.voxels.getStringId(this.getId(index));
267
+ const secondary = VoxelTagsRegister.VoxelTags[this.getId(index)]["dve_can_have_secondary"] && this.getSecondary(index) > 0;
268
+ if (secondary) {
269
+ voxelId = VoxelPalettesRegister.voxels.getStringId(this.getSecondary(index));
270
+ let voxelIndex = this.sector.palettes.secondaryId.getNumberId(voxelId);
271
+ const modPalette = this.sector.palettes.secondaryMod[voxelIndex];
272
+ if (!modPalette)
273
+ return 0;
274
+ if (this.buffers.mod.type == BinaryBufferTypes.Value) {
275
+ returnValue = modPalette[modIndex];
276
+ }
277
+ else {
278
+ if (this.section.palettes?.secondaryMod) {
279
+ returnValue =
280
+ modPalette[this.section.palettes?.secondaryMod[voxelIndex][modIndex]];
281
+ }
282
+ else {
283
+ returnValue = modPalette[modIndex];
284
+ }
285
+ }
286
+ }
287
+ else {
288
+ let voxelIndex = this.sector.palettes.id.getNumberId(voxelId);
289
+ const modPalette = this.sector.palettes.mod[voxelIndex];
290
+ if (!modPalette)
291
+ return 0;
292
+ if (this.buffers.mod.type == BinaryBufferTypes.Value) {
293
+ returnValue = modPalette[modIndex];
294
+ }
295
+ else {
296
+ if (this.section.palettes?.mod) {
297
+ returnValue =
298
+ modPalette[this.section.palettes?.mod[voxelIndex][modIndex]];
299
+ }
300
+ else {
301
+ returnValue = modPalette[modIndex];
302
+ }
303
+ }
304
+ }
305
+ return returnValue;
306
+ }
307
+ }
@@ -0,0 +1,23 @@
1
+ import { StringPalette } from "../../../Util/StringPalette";
2
+ import { NumberPalette } from "../../../Util/NumberPalette";
3
+ import { ArchivedLightSegments, ArchivedSectorData } from "../Archive.types";
4
+ import { ImportedSection } from "./ImportedSection";
5
+ declare class ImportedSectorPalettes {
6
+ id: StringPalette;
7
+ secondaryId: StringPalette;
8
+ secondaryValue: NumberPalette;
9
+ level?: NumberPalette;
10
+ light: Record<ArchivedLightSegments, NumberPalette | null>;
11
+ state: number[][];
12
+ secondaryState: number[][];
13
+ mod: number[][];
14
+ secondaryMod: number[][];
15
+ constructor(sector: ArchivedSectorData);
16
+ }
17
+ export declare class ImportedSector {
18
+ sector: ArchivedSectorData;
19
+ sections: ImportedSection[];
20
+ palettes: ImportedSectorPalettes;
21
+ constructor(sector: ArchivedSectorData);
22
+ }
23
+ export {};