@nice2dev/game-engine 1.3.15 → 1.3.16

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 (434) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/dist/cjs/accessibility/Accessibility.js +152 -165
  3. package/dist/cjs/ai/AI.js +292 -294
  4. package/dist/cjs/ai/BehaviorTree.js +1029 -1113
  5. package/dist/cjs/ai/StateMachine.js +694 -756
  6. package/dist/cjs/animation/Animation.js +232 -241
  7. package/dist/cjs/audio/AudioAdvanced.js +221 -236
  8. package/dist/cjs/audio/AudioBridge.js +441 -435
  9. package/dist/cjs/audio/AudioManager.js +242 -259
  10. package/dist/cjs/build-cloud/BuildOrchestration.js +1059 -1098
  11. package/dist/cjs/build-cloud/GodotBuildCloud.js +641 -670
  12. package/dist/cjs/build-cloud/UnityBuildCloud.js +563 -610
  13. package/dist/cjs/build-cloud/UnrealBuildCloud.js +610 -635
  14. package/dist/cjs/core/EventBus.js +51 -56
  15. package/dist/cjs/core/GameClock.js +62 -66
  16. package/dist/cjs/core/GameConfig.js +72 -79
  17. package/dist/cjs/core/GameLoop.js +80 -89
  18. package/dist/cjs/core/ServiceLocator.js +61 -65
  19. package/dist/cjs/core/Validation.js +72 -82
  20. package/dist/cjs/core/math.js +108 -112
  21. package/dist/cjs/devtools/DevTools.js +542 -563
  22. package/dist/cjs/devtools/DeveloperExperience.js +521 -559
  23. package/dist/cjs/devtools/GameplayAnalytics.js +636 -646
  24. package/dist/cjs/dialogue/DialogueSystem.js +984 -986
  25. package/dist/cjs/docs/DocGenerator.js +339 -364
  26. package/dist/cjs/ecs/World.js +355 -371
  27. package/dist/cjs/editor/AchievementEditor.js +580 -636
  28. package/dist/cjs/editor/AdvancedEditor.js +184 -191
  29. package/dist/cjs/editor/AnimationRetargeting.js +696 -741
  30. package/dist/cjs/editor/AssetBrowser.js +1072 -1160
  31. package/dist/cjs/editor/AssetManager.js +187 -192
  32. package/dist/cjs/editor/ConsolePro.js +971 -1061
  33. package/dist/cjs/editor/CraftingEditor.js +680 -730
  34. package/dist/cjs/editor/DebugTools.js +187 -185
  35. package/dist/cjs/editor/DialogueSystem.js +844 -901
  36. package/dist/cjs/editor/LeaderboardSystem.js +429 -483
  37. package/dist/cjs/editor/NiceGameEditor.js +1903 -1201
  38. package/dist/cjs/editor/PrefabSystem.js +772 -838
  39. package/dist/cjs/editor/ProfilerPanel.js +649 -700
  40. package/dist/cjs/editor/QuestEditor.js +792 -839
  41. package/dist/cjs/editor/ReplaySystem.js +585 -634
  42. package/dist/cjs/editor/SceneEditor.js +176 -200
  43. package/dist/cjs/editor/ScreenshotMode.js +621 -688
  44. package/dist/cjs/editor/ShaderGraph.js +1556 -1582
  45. package/dist/cjs/editor/TimelineEditor.js +715 -778
  46. package/dist/cjs/editor/UndoRedoPro.js +830 -904
  47. package/dist/cjs/editor/VRARMode.js +582 -645
  48. package/dist/cjs/engine/NiceGameEngine.js +141 -164
  49. package/dist/cjs/engine/SaveSystem.js +441 -495
  50. package/dist/cjs/enterprise/Enterprise.js +254 -261
  51. package/dist/cjs/export/BevyExporter.js +927 -967
  52. package/dist/cjs/export/CocosExporter.js +644 -673
  53. package/dist/cjs/export/Construct3Exporter.js +783 -794
  54. package/dist/cjs/export/DefoldExporter.js +1028 -1069
  55. package/dist/cjs/export/GDevelopExporter.js +674 -708
  56. package/dist/cjs/export/GameMakerExporter.js +791 -805
  57. package/dist/cjs/export/GodotExporter.js +1003 -1045
  58. package/dist/cjs/export/MinecraftBedrockExporter.js +573 -578
  59. package/dist/cjs/export/MonoGameExporter.js +1265 -1293
  60. package/dist/cjs/export/Pico8Exporter.js +766 -812
  61. package/dist/cjs/export/PlatformExporter.js +188 -206
  62. package/dist/cjs/export/RPGMakerExporter.js +860 -879
  63. package/dist/cjs/export/RobloxExporter.js +883 -919
  64. package/dist/cjs/export/Solar2DExporter.js +1218 -1256
  65. package/dist/cjs/export/ThreeJSExporter.js +1006 -1073
  66. package/dist/cjs/export/Tic80Exporter.js +1210 -1267
  67. package/dist/cjs/export/UnityExporter.js +1116 -1131
  68. package/dist/cjs/export/UnrealExporter.js +889 -919
  69. package/dist/cjs/export/WebExporter.js +931 -970
  70. package/dist/cjs/export/index.js +42 -65
  71. package/dist/cjs/godot-integration/GodotAssetLibrary.js +659 -692
  72. package/dist/cjs/godot-integration/GodotImport.js +929 -1027
  73. package/dist/cjs/godot-integration/GodotLiveLink.js +915 -945
  74. package/dist/cjs/godot-integration/components/GodotProjectBrowser.js +911 -611
  75. package/dist/cjs/i18n/I18n.js +860 -900
  76. package/dist/cjs/i18n/useTranslation.js +84 -89
  77. package/dist/cjs/import/AsepriteImporter.js +658 -716
  78. package/dist/cjs/import/DragonBonesImporter.js +437 -461
  79. package/dist/cjs/import/GameMakerImporter.js +511 -521
  80. package/dist/cjs/import/GodotSceneImporter.js +788 -822
  81. package/dist/cjs/import/LDtkImporter.js +436 -454
  82. package/dist/cjs/import/Live2DImporter.js +497 -518
  83. package/dist/cjs/import/NdgFormat.js +424 -457
  84. package/dist/cjs/import/OgmoImporter.js +466 -493
  85. package/dist/cjs/import/RPGMakerImporter.js +451 -477
  86. package/dist/cjs/import/SceneImporter.js +378 -423
  87. package/dist/cjs/import/SpineImporter.js +511 -546
  88. package/dist/cjs/import/SpriterImporter.js +590 -613
  89. package/dist/cjs/import/TiledMapImporter.js +811 -846
  90. package/dist/cjs/import/UnitySceneImporter.js +687 -703
  91. package/dist/cjs/import/index.js +206 -251
  92. package/dist/cjs/index.js +275 -278
  93. package/dist/cjs/input/GamepadNavigation.js +185 -205
  94. package/dist/cjs/input/InputManager.js +397 -421
  95. package/dist/cjs/input/useGamepads.js +70 -81
  96. package/dist/cjs/integration/IconSprite.js +129 -256
  97. package/dist/cjs/inventory/InventorySystem.js +920 -995
  98. package/dist/cjs/kids/KidMode.js +997 -1022
  99. package/dist/cjs/kids/KidTools.js +570 -594
  100. package/dist/cjs/monetization/Monetization.js +170 -177
  101. package/dist/cjs/multiplayer/LocalMultiplayer.js +287 -287
  102. package/dist/cjs/multiplayer/MiniGameTypes.js +49 -59
  103. package/dist/cjs/native-engine/AnimationSystem.js +731 -806
  104. package/dist/cjs/native-engine/AssetPipeline.js +454 -515
  105. package/dist/cjs/native-engine/AudioEngine.js +763 -804
  106. package/dist/cjs/native-engine/InputSystem.js +1075 -1145
  107. package/dist/cjs/native-engine/NetworkingSystem.js +733 -793
  108. package/dist/cjs/native-engine/PhysicsEngine.js +583 -607
  109. package/dist/cjs/native-engine/RenderingEngine.js +302 -350
  110. package/dist/cjs/native-engine/SceneGraph.js +769 -808
  111. package/dist/cjs/network/MultiplayerTransport.js +97 -132
  112. package/dist/cjs/network/Networking.js +549 -564
  113. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/AbortController.js +21 -29
  114. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/AccessTokenHttpClient.js +40 -48
  115. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/DefaultHttpClient.js +35 -43
  116. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/DefaultReconnectPolicy.js +10 -15
  117. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/Errors.js +103 -135
  118. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/FetchHttpClient.js +131 -158
  119. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/HandshakeProtocol.js +39 -53
  120. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/HeaderNames.js +5 -8
  121. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/HttpClient.js +40 -48
  122. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/HttpConnection.js +494 -572
  123. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/HubConnection.js +826 -953
  124. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/HubConnectionBuilder.js +125 -146
  125. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/IHubProtocol.js +13 -23
  126. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/ILogger.js +11 -25
  127. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/ITransport.js +13 -24
  128. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/JsonHubProtocol.js +108 -121
  129. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/Loggers.js +10 -14
  130. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/LongPollingTransport.js +150 -185
  131. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/MessageBuffer.js +158 -196
  132. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/ServerSentEventsTransport.js +90 -105
  133. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/Subject.js +30 -35
  134. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/TextMessageFormat.js +16 -21
  135. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/Utils.js +215 -248
  136. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/WebSocketTransport.js +135 -157
  137. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/XhrHttpClient.js +76 -85
  138. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/index.js +24 -27
  139. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/pkg-version.js +3 -4
  140. package/dist/cjs/pathfinding/Pathfinding.js +245 -263
  141. package/dist/cjs/performance/AssetStreaming.js +561 -635
  142. package/dist/cjs/performance/BenchmarkSuite.js +283 -311
  143. package/dist/cjs/performance/DeltaCompression.js +467 -526
  144. package/dist/cjs/performance/DeterministicPhysics.js +450 -498
  145. package/dist/cjs/performance/ECSOptimization.js +644 -695
  146. package/dist/cjs/performance/GameSaveSystem.js +509 -556
  147. package/dist/cjs/performance/HotReload.js +447 -500
  148. package/dist/cjs/performance/InputRecording.js +511 -561
  149. package/dist/cjs/performance/InterestManagement.js +453 -500
  150. package/dist/cjs/performance/LocalizationRuntime.js +376 -423
  151. package/dist/cjs/performance/MemoryManagement.js +410 -470
  152. package/dist/cjs/performance/ModSupport.js +445 -496
  153. package/dist/cjs/performance/MultiThreadedPhysics.js +400 -443
  154. package/dist/cjs/performance/NetworkPrediction.js +424 -482
  155. package/dist/cjs/performance/ObjectPooling.js +569 -617
  156. package/dist/cjs/performance/Performance.js +174 -190
  157. package/dist/cjs/performance/PerformanceAdvanced.js +614 -637
  158. package/dist/cjs/performance/WebGPURenderer.js +656 -683
  159. package/dist/cjs/physics/PhysicsAdvanced.js +345 -379
  160. package/dist/cjs/physics/PhysicsEngine2D.js +391 -427
  161. package/dist/cjs/plugins/PluginSDK.js +432 -466
  162. package/dist/cjs/plugins/PluginTestKit.js +307 -330
  163. package/dist/cjs/procedural/Procedural.js +243 -254
  164. package/dist/cjs/procedural/WorldBuilding.js +297 -314
  165. package/dist/cjs/quest/QuestSystem.js +975 -932
  166. package/dist/cjs/release/MobileExport.js +157 -163
  167. package/dist/cjs/release/Release.js +225 -238
  168. package/dist/cjs/rendering/Camera2D.js +121 -124
  169. package/dist/cjs/rendering/Renderer2D.js +321 -335
  170. package/dist/cjs/rendering/WebGPURenderPipeline.js +632 -651
  171. package/dist/cjs/runtime3d/Runtime3D.js +359 -378
  172. package/dist/cjs/runtime3d/SceneEditor3D.js +252 -263
  173. package/dist/cjs/scene/SceneManager.js +177 -193
  174. package/dist/cjs/scripting/GraphToAST.js +574 -547
  175. package/dist/cjs/scripting/LanguageExporter.js +254 -279
  176. package/dist/cjs/scripting/NodeGraph.js +546 -570
  177. package/dist/cjs/scripting/ScriptAST.js +31 -39
  178. package/dist/cjs/scripting/VisualScripting2.js +1016 -1065
  179. package/dist/cjs/scripting/exporters/CSharpExporter.js +464 -496
  180. package/dist/cjs/scripting/exporters/GDScriptExporter.js +390 -442
  181. package/dist/cjs/scripting/exporters/LuaExporter.js +406 -447
  182. package/dist/cjs/scripting/exporters/PythonExporter.js +484 -549
  183. package/dist/cjs/scripting/exporters/RustExporter.js +459 -512
  184. package/dist/cjs/scripting/exporters/TypeScriptExporter.js +505 -556
  185. package/dist/cjs/social/Social.js +72 -80
  186. package/dist/cjs/systems/LightingSystem.js +844 -931
  187. package/dist/cjs/systems/ParticleSystem2.js +1447 -1451
  188. package/dist/cjs/systems/PhysicsDebugSystem.js +1070 -1141
  189. package/dist/cjs/systems/TerrainSystem.js +985 -1098
  190. package/dist/cjs/templates/ActionTemplates.js +296 -309
  191. package/dist/cjs/templates/FightingTemplate.js +417 -463
  192. package/dist/cjs/templates/MetroidvaniaTemplate.js +353 -405
  193. package/dist/cjs/templates/PartyTemplates.js +190 -202
  194. package/dist/cjs/templates/PuzzleTemplates.js +245 -261
  195. package/dist/cjs/templates/RPGTemplates.js +160 -178
  196. package/dist/cjs/templates/SportsTemplates.js +237 -250
  197. package/dist/cjs/templates/StrategyTemplates.js +143 -153
  198. package/dist/cjs/templates/SurvivalTemplate.js +336 -380
  199. package/dist/cjs/templates/WaveDefense.js +499 -526
  200. package/dist/cjs/tilemap/Tilemap.js +207 -214
  201. package/dist/cjs/tutorials/TutorialBranching.js +396 -417
  202. package/dist/cjs/tutorials/TutorialEngine.js +888 -931
  203. package/dist/cjs/tutorials/TutorialOverlay.js +602 -640
  204. package/dist/cjs/tutorials/content/Tutorials_T05_T08.js +787 -809
  205. package/dist/cjs/tutorials/content/Tutorials_T09_T11.js +736 -756
  206. package/dist/cjs/tutorials/content/Tutorials_T12_T15.js +754 -778
  207. package/dist/cjs/ui/GameUI.js +295 -312
  208. package/dist/cjs/unity-integration/UnityAssetStore.js +700 -741
  209. package/dist/cjs/unity-integration/UnityImport.js +1066 -1176
  210. package/dist/cjs/unity-integration/UnityLiveLink.js +934 -981
  211. package/dist/cjs/unity-integration/components/UnityAssetStoreBrowser.js +1233 -757
  212. package/dist/cjs/unity-integration/components/UnityProjectBrowser.js +1240 -768
  213. package/dist/cjs/unreal-integration/UnrealImport.js +391 -412
  214. package/dist/cjs/unreal-integration/UnrealLiveLink.js +1102 -1137
  215. package/dist/cjs/unreal-integration/UnrealMarketplace.js +436 -473
  216. package/dist/cjs/unreal-integration/components/UnrealProjectBrowser.js +1150 -767
  217. package/dist/cjs/xr/ARVR.js +167 -175
  218. package/dist/esm/accessibility/Accessibility.js +160 -164
  219. package/dist/esm/ai/AI.js +310 -293
  220. package/dist/esm/ai/BehaviorTree.js +1057 -1112
  221. package/dist/esm/ai/StateMachine.js +709 -755
  222. package/dist/esm/animation/Animation.js +237 -240
  223. package/dist/esm/audio/AudioAdvanced.js +239 -235
  224. package/dist/esm/audio/AudioBridge.js +448 -434
  225. package/dist/esm/audio/AudioManager.js +243 -258
  226. package/dist/esm/build-cloud/BuildOrchestration.js +1071 -1097
  227. package/dist/esm/build-cloud/GodotBuildCloud.js +647 -669
  228. package/dist/esm/build-cloud/UnityBuildCloud.js +571 -609
  229. package/dist/esm/build-cloud/UnrealBuildCloud.js +615 -634
  230. package/dist/esm/core/EventBus.js +52 -55
  231. package/dist/esm/core/GameClock.js +63 -65
  232. package/dist/esm/core/GameConfig.js +77 -78
  233. package/dist/esm/core/GameLoop.js +81 -88
  234. package/dist/esm/core/ServiceLocator.js +63 -64
  235. package/dist/esm/core/Validation.js +82 -81
  236. package/dist/esm/core/math.js +109 -111
  237. package/dist/esm/devtools/DevTools.js +546 -562
  238. package/dist/esm/devtools/DeveloperExperience.js +535 -558
  239. package/dist/esm/devtools/GameplayAnalytics.js +647 -645
  240. package/dist/esm/dialogue/DialogueSystem.js +998 -985
  241. package/dist/esm/docs/DocGenerator.js +342 -363
  242. package/dist/esm/ecs/World.js +358 -370
  243. package/dist/esm/editor/AchievementEditor.js +584 -635
  244. package/dist/esm/editor/AdvancedEditor.js +191 -190
  245. package/dist/esm/editor/AnimationRetargeting.js +700 -740
  246. package/dist/esm/editor/AssetBrowser.js +1078 -1159
  247. package/dist/esm/editor/AssetManager.js +188 -191
  248. package/dist/esm/editor/ConsolePro.js +977 -1060
  249. package/dist/esm/editor/CraftingEditor.js +684 -729
  250. package/dist/esm/editor/DebugTools.js +194 -184
  251. package/dist/esm/editor/DialogueSystem.js +849 -900
  252. package/dist/esm/editor/LeaderboardSystem.js +433 -482
  253. package/dist/esm/editor/NiceGameEditor.js +1908 -1200
  254. package/dist/esm/editor/PrefabSystem.js +777 -837
  255. package/dist/esm/editor/ProfilerPanel.js +654 -699
  256. package/dist/esm/editor/QuestEditor.js +795 -838
  257. package/dist/esm/editor/ReplaySystem.js +591 -633
  258. package/dist/esm/editor/SceneEditor.js +189 -199
  259. package/dist/esm/editor/ScreenshotMode.js +628 -687
  260. package/dist/esm/editor/ShaderGraph.js +1565 -1581
  261. package/dist/esm/editor/TimelineEditor.js +733 -777
  262. package/dist/esm/editor/UndoRedoPro.js +835 -903
  263. package/dist/esm/editor/VRARMode.js +586 -644
  264. package/dist/esm/engine/NiceGameEngine.js +142 -163
  265. package/dist/esm/engine/SaveSystem.js +447 -494
  266. package/dist/esm/enterprise/Enterprise.js +265 -260
  267. package/dist/esm/export/BevyExporter.js +929 -966
  268. package/dist/esm/export/CocosExporter.js +646 -672
  269. package/dist/esm/export/Construct3Exporter.js +785 -793
  270. package/dist/esm/export/DefoldExporter.js +1030 -1068
  271. package/dist/esm/export/GDevelopExporter.js +676 -707
  272. package/dist/esm/export/GameMakerExporter.js +793 -804
  273. package/dist/esm/export/GodotExporter.js +1004 -1044
  274. package/dist/esm/export/MinecraftBedrockExporter.js +575 -577
  275. package/dist/esm/export/MonoGameExporter.js +1267 -1292
  276. package/dist/esm/export/Pico8Exporter.js +768 -811
  277. package/dist/esm/export/PlatformExporter.js +193 -205
  278. package/dist/esm/export/RPGMakerExporter.js +862 -878
  279. package/dist/esm/export/RobloxExporter.js +885 -918
  280. package/dist/esm/export/Solar2DExporter.js +1220 -1255
  281. package/dist/esm/export/ThreeJSExporter.js +1007 -1072
  282. package/dist/esm/export/Tic80Exporter.js +1212 -1266
  283. package/dist/esm/export/UnityExporter.js +1117 -1130
  284. package/dist/esm/export/UnrealExporter.js +891 -918
  285. package/dist/esm/export/WebExporter.js +933 -969
  286. package/dist/esm/export/index.js +86 -71
  287. package/dist/esm/godot-integration/GodotAssetLibrary.js +663 -691
  288. package/dist/esm/godot-integration/GodotImport.js +935 -1026
  289. package/dist/esm/godot-integration/GodotLiveLink.js +918 -944
  290. package/dist/esm/godot-integration/components/GodotProjectBrowser.js +912 -610
  291. package/dist/esm/i18n/I18n.js +871 -899
  292. package/dist/esm/i18n/useTranslation.js +88 -88
  293. package/dist/esm/import/AsepriteImporter.js +637 -715
  294. package/dist/esm/import/DragonBonesImporter.js +417 -460
  295. package/dist/esm/import/GameMakerImporter.js +491 -520
  296. package/dist/esm/import/GodotSceneImporter.js +767 -821
  297. package/dist/esm/import/LDtkImporter.js +415 -453
  298. package/dist/esm/import/Live2DImporter.js +477 -517
  299. package/dist/esm/import/NdgFormat.js +410 -456
  300. package/dist/esm/import/OgmoImporter.js +446 -492
  301. package/dist/esm/import/RPGMakerImporter.js +431 -476
  302. package/dist/esm/import/SceneImporter.js +385 -422
  303. package/dist/esm/import/SpineImporter.js +491 -545
  304. package/dist/esm/import/SpriterImporter.js +570 -612
  305. package/dist/esm/import/TiledMapImporter.js +790 -845
  306. package/dist/esm/import/UnitySceneImporter.js +666 -702
  307. package/dist/esm/import/index.js +247 -258
  308. package/dist/esm/index.js +1332 -188
  309. package/dist/esm/input/GamepadNavigation.js +187 -204
  310. package/dist/esm/input/InputManager.js +401 -420
  311. package/dist/esm/input/useGamepads.js +72 -80
  312. package/dist/esm/integration/IconSprite.js +143 -255
  313. package/dist/esm/inventory/InventorySystem.js +925 -994
  314. package/dist/esm/kids/KidMode.js +1003 -1021
  315. package/dist/esm/kids/KidTools.js +573 -593
  316. package/dist/esm/monetization/Monetization.js +180 -176
  317. package/dist/esm/multiplayer/LocalMultiplayer.js +290 -286
  318. package/dist/esm/multiplayer/MiniGameTypes.js +58 -58
  319. package/dist/esm/native-engine/AnimationSystem.js +735 -805
  320. package/dist/esm/native-engine/AssetPipeline.js +456 -514
  321. package/dist/esm/native-engine/AudioEngine.js +765 -803
  322. package/dist/esm/native-engine/InputSystem.js +1079 -1144
  323. package/dist/esm/native-engine/NetworkingSystem.js +740 -792
  324. package/dist/esm/native-engine/PhysicsEngine.js +585 -606
  325. package/dist/esm/native-engine/RenderingEngine.js +304 -349
  326. package/dist/esm/native-engine/SceneGraph.js +773 -807
  327. package/dist/esm/network/MultiplayerTransport.js +99 -131
  328. package/dist/esm/network/Networking.js +556 -563
  329. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/AbortController.js +22 -28
  330. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/AccessTokenHttpClient.js +41 -47
  331. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/DefaultHttpClient.js +36 -42
  332. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/DefaultReconnectPolicy.js +11 -14
  333. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/Errors.js +111 -134
  334. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/FetchHttpClient.js +132 -157
  335. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/HandshakeProtocol.js +40 -52
  336. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/HeaderNames.js +6 -7
  337. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/HttpClient.js +42 -47
  338. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/HttpConnection.js +496 -571
  339. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/HubConnection.js +828 -952
  340. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/HubConnectionBuilder.js +126 -145
  341. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/IHubProtocol.js +14 -23
  342. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/ILogger.js +12 -25
  343. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/ITransport.js +15 -24
  344. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/JsonHubProtocol.js +109 -120
  345. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/Loggers.js +11 -13
  346. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/LongPollingTransport.js +151 -184
  347. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/MessageBuffer.js +159 -195
  348. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/ServerSentEventsTransport.js +91 -104
  349. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/Subject.js +31 -34
  350. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/TextMessageFormat.js +17 -20
  351. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/Utils.js +230 -248
  352. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/WebSocketTransport.js +136 -156
  353. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/XhrHttpClient.js +77 -84
  354. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/index.js +31 -12
  355. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/pkg-version.js +4 -3
  356. package/dist/esm/pathfinding/Pathfinding.js +249 -262
  357. package/dist/esm/performance/AssetStreaming.js +567 -634
  358. package/dist/esm/performance/BenchmarkSuite.js +285 -310
  359. package/dist/esm/performance/DeltaCompression.js +478 -525
  360. package/dist/esm/performance/DeterministicPhysics.js +479 -497
  361. package/dist/esm/performance/ECSOptimization.js +653 -694
  362. package/dist/esm/performance/GameSaveSystem.js +515 -555
  363. package/dist/esm/performance/HotReload.js +454 -499
  364. package/dist/esm/performance/InputRecording.js +520 -560
  365. package/dist/esm/performance/InterestManagement.js +460 -499
  366. package/dist/esm/performance/LocalizationRuntime.js +382 -422
  367. package/dist/esm/performance/MemoryManagement.js +415 -469
  368. package/dist/esm/performance/ModSupport.js +455 -495
  369. package/dist/esm/performance/MultiThreadedPhysics.js +408 -442
  370. package/dist/esm/performance/NetworkPrediction.js +436 -481
  371. package/dist/esm/performance/ObjectPooling.js +582 -616
  372. package/dist/esm/performance/Performance.js +182 -189
  373. package/dist/esm/performance/PerformanceAdvanced.js +621 -636
  374. package/dist/esm/performance/WebGPURenderer.js +660 -682
  375. package/dist/esm/physics/PhysicsAdvanced.js +359 -378
  376. package/dist/esm/physics/PhysicsEngine2D.js +393 -426
  377. package/dist/esm/plugins/PluginSDK.js +435 -465
  378. package/dist/esm/plugins/PluginTestKit.js +315 -329
  379. package/dist/esm/procedural/Procedural.js +248 -253
  380. package/dist/esm/procedural/WorldBuilding.js +316 -313
  381. package/dist/esm/quest/QuestSystem.js +982 -931
  382. package/dist/esm/release/MobileExport.js +163 -162
  383. package/dist/esm/release/Release.js +234 -237
  384. package/dist/esm/rendering/Camera2D.js +122 -123
  385. package/dist/esm/rendering/Renderer2D.js +323 -334
  386. package/dist/esm/rendering/WebGPURenderPipeline.js +647 -650
  387. package/dist/esm/runtime3d/Runtime3D.js +368 -377
  388. package/dist/esm/runtime3d/SceneEditor3D.js +268 -262
  389. package/dist/esm/scene/SceneManager.js +178 -192
  390. package/dist/esm/scripting/GraphToAST.js +576 -546
  391. package/dist/esm/scripting/LanguageExporter.js +263 -278
  392. package/dist/esm/scripting/NodeGraph.js +550 -569
  393. package/dist/esm/scripting/ScriptAST.js +45 -38
  394. package/dist/esm/scripting/VisualScripting2.js +1025 -1064
  395. package/dist/esm/scripting/exporters/CSharpExporter.js +465 -495
  396. package/dist/esm/scripting/exporters/GDScriptExporter.js +391 -441
  397. package/dist/esm/scripting/exporters/LuaExporter.js +407 -446
  398. package/dist/esm/scripting/exporters/PythonExporter.js +485 -548
  399. package/dist/esm/scripting/exporters/RustExporter.js +460 -511
  400. package/dist/esm/scripting/exporters/TypeScriptExporter.js +506 -555
  401. package/dist/esm/social/Social.js +77 -79
  402. package/dist/esm/systems/LightingSystem.js +855 -930
  403. package/dist/esm/systems/ParticleSystem2.js +1453 -1450
  404. package/dist/esm/systems/PhysicsDebugSystem.js +1078 -1140
  405. package/dist/esm/systems/TerrainSystem.js +996 -1097
  406. package/dist/esm/templates/ActionTemplates.js +307 -308
  407. package/dist/esm/templates/FightingTemplate.js +439 -462
  408. package/dist/esm/templates/MetroidvaniaTemplate.js +391 -404
  409. package/dist/esm/templates/PartyTemplates.js +206 -201
  410. package/dist/esm/templates/PuzzleTemplates.js +260 -260
  411. package/dist/esm/templates/RPGTemplates.js +172 -177
  412. package/dist/esm/templates/SportsTemplates.js +251 -249
  413. package/dist/esm/templates/StrategyTemplates.js +158 -152
  414. package/dist/esm/templates/SurvivalTemplate.js +367 -379
  415. package/dist/esm/templates/WaveDefense.js +501 -525
  416. package/dist/esm/tilemap/Tilemap.js +209 -213
  417. package/dist/esm/tutorials/TutorialBranching.js +399 -416
  418. package/dist/esm/tutorials/TutorialEngine.js +893 -930
  419. package/dist/esm/tutorials/TutorialOverlay.js +603 -639
  420. package/dist/esm/tutorials/content/Tutorials_T05_T08.js +792 -808
  421. package/dist/esm/tutorials/content/Tutorials_T09_T11.js +740 -755
  422. package/dist/esm/tutorials/content/Tutorials_T12_T15.js +759 -777
  423. package/dist/esm/ui/GameUI.js +296 -311
  424. package/dist/esm/unity-integration/UnityAssetStore.js +704 -740
  425. package/dist/esm/unity-integration/UnityImport.js +1071 -1175
  426. package/dist/esm/unity-integration/UnityLiveLink.js +938 -980
  427. package/dist/esm/unity-integration/components/UnityAssetStoreBrowser.js +1234 -756
  428. package/dist/esm/unity-integration/components/UnityProjectBrowser.js +1241 -767
  429. package/dist/esm/unreal-integration/UnrealImport.js +395 -411
  430. package/dist/esm/unreal-integration/UnrealLiveLink.js +1105 -1136
  431. package/dist/esm/unreal-integration/UnrealMarketplace.js +442 -472
  432. package/dist/esm/unreal-integration/components/UnrealProjectBrowser.js +1151 -766
  433. package/dist/esm/xr/ARVR.js +181 -174
  434. package/package.json +7 -12
@@ -1,448 +1,436 @@
1
- /* ────────────────────────────────────────────────────────────────
2
- PRO-1.6 — Survival & Crafting Template
3
-
4
- Features:
5
- - Survival needs (hunger, thirst, health, stamina, temperature)
6
- - Crafting system with recipes
7
- - Resource gathering
8
- - Building/placement system
9
- - Day/night cycle
10
- - World persistence
11
- - Environmental hazards
12
- ──────────────────────────────────────────────────────────────── */
13
- // ============================================================
14
- // Default Configuration
15
- // ============================================================
16
1
  const DEFAULT_SURVIVAL_CONFIG = {
17
- hungerDecayRate: 0.1,
18
- thirstDecayRate: 0.15,
19
- staminaRegenRate: 5,
20
- staminaDecayOnRun: 3,
21
- healthRegenRate: 0.5,
22
- healthRegenThreshold: 50,
23
- deathOnZeroHunger: true,
24
- deathOnZeroThirst: true,
25
- temperatureComfortRange: { min: -10, max: 30 },
26
- temperatureDamageRate: 1,
27
- respawnPenalty: { hungerPercent: 50, inventoryDrop: true },
2
+ hungerDecayRate: 0.1,
3
+ thirstDecayRate: 0.15,
4
+ staminaRegenRate: 5,
5
+ staminaDecayOnRun: 3,
6
+ healthRegenRate: 0.5,
7
+ healthRegenThreshold: 50,
8
+ deathOnZeroHunger: true,
9
+ deathOnZeroThirst: true,
10
+ temperatureComfortRange: { min: -10, max: 30 },
11
+ temperatureDamageRate: 1,
12
+ respawnPenalty: { hungerPercent: 50, inventoryDrop: true }
28
13
  };
29
14
  const DEFAULT_DAY_NIGHT = {
30
- currentTime: 8, // start at 8 AM
31
- dayLength: 1200, // 20 minutes real time = 1 day
32
- dawnTime: 6,
33
- duskTime: 18,
34
- nightDangerMultiplier: 2,
15
+ currentTime: 8,
16
+ // start at 8 AM
17
+ dayLength: 1200,
18
+ // 20 minutes real time = 1 day
19
+ dawnTime: 6,
20
+ duskTime: 18,
21
+ nightDangerMultiplier: 2
35
22
  };
36
- // ============================================================
37
- // Preset Weather
38
- // ============================================================
39
23
  const WEATHER_CLEAR = {
40
- id: 'clear',
41
- name: 'Clear',
42
- temperatureModifier: 0,
43
- visibility: 1,
44
- wetness: 0,
45
- windSpeed: 0,
46
- effects: [],
24
+ id: "clear",
25
+ name: "Clear",
26
+ temperatureModifier: 0,
27
+ visibility: 1,
28
+ wetness: 0,
29
+ windSpeed: 0,
30
+ effects: []
47
31
  };
48
32
  const WEATHER_RAIN = {
49
- id: 'rain',
50
- name: 'Rain',
51
- temperatureModifier: -5,
52
- visibility: 0.7,
53
- wetness: 0.5,
54
- windSpeed: 2,
55
- effects: [{ type: 'resource_bonus', resourceType: 'water', multiplier: 1.5 }],
33
+ id: "rain",
34
+ name: "Rain",
35
+ temperatureModifier: -5,
36
+ visibility: 0.7,
37
+ wetness: 0.5,
38
+ windSpeed: 2,
39
+ effects: [{ type: "resource_bonus", resourceType: "water", multiplier: 1.5 }]
56
40
  };
57
41
  const WEATHER_STORM = {
58
- id: 'storm',
59
- name: 'Storm',
60
- temperatureModifier: -10,
61
- visibility: 0.4,
62
- wetness: 1,
63
- windSpeed: 8,
64
- effects: [{ type: 'slow', multiplier: 0.8 }],
42
+ id: "storm",
43
+ name: "Storm",
44
+ temperatureModifier: -10,
45
+ visibility: 0.4,
46
+ wetness: 1,
47
+ windSpeed: 8,
48
+ effects: [{ type: "slow", multiplier: 0.8 }]
65
49
  };
66
50
  const WEATHER_SNOW = {
67
- id: 'snow',
68
- name: 'Snow',
69
- temperatureModifier: -30,
70
- visibility: 0.5,
71
- wetness: 0.3,
72
- windSpeed: 3,
73
- effects: [
74
- { type: 'slow', multiplier: 0.7 },
75
- { type: 'damage', damagePerSecond: 0.5 },
76
- ],
51
+ id: "snow",
52
+ name: "Snow",
53
+ temperatureModifier: -30,
54
+ visibility: 0.5,
55
+ wetness: 0.3,
56
+ windSpeed: 3,
57
+ effects: [
58
+ { type: "slow", multiplier: 0.7 },
59
+ { type: "damage", damagePerSecond: 0.5 }
60
+ ]
77
61
  };
78
62
  const WEATHER_HEATWAVE = {
79
- id: 'heatwave',
80
- name: 'Heat Wave',
81
- temperatureModifier: 25,
82
- visibility: 0.9,
83
- wetness: 0,
84
- windSpeed: 0,
85
- effects: [{ type: 'damage', damagePerSecond: 0.3 }],
63
+ id: "heatwave",
64
+ name: "Heat Wave",
65
+ temperatureModifier: 25,
66
+ visibility: 0.9,
67
+ wetness: 0,
68
+ windSpeed: 0,
69
+ effects: [{ type: "damage", damagePerSecond: 0.3 }]
86
70
  };
87
- // ============================================================
88
- // Preset Recipes
89
- // ============================================================
90
71
  const RECIPE_WORKBENCH = {
91
- id: 'workbench',
92
- name: 'Workbench',
93
- category: 'building',
94
- ingredients: [
95
- { resourceType: 'wood', amount: 20 },
96
- { resourceType: 'stone', amount: 5 },
97
- ],
98
- output: { itemId: 'workbench', amount: 1 },
99
- craftingTime: 5,
100
- unlocked: true,
72
+ id: "workbench",
73
+ name: "Workbench",
74
+ category: "building",
75
+ ingredients: [
76
+ { resourceType: "wood", amount: 20 },
77
+ { resourceType: "stone", amount: 5 }
78
+ ],
79
+ output: { itemId: "workbench", amount: 1 },
80
+ craftingTime: 5,
81
+ unlocked: true
101
82
  };
102
83
  const RECIPE_CAMPFIRE = {
103
- id: 'campfire',
104
- name: 'Campfire',
105
- category: 'building',
106
- ingredients: [
107
- { resourceType: 'wood', amount: 10 },
108
- { resourceType: 'stone', amount: 8 },
109
- ],
110
- output: { itemId: 'campfire', amount: 1 },
111
- craftingTime: 3,
112
- unlocked: true,
84
+ id: "campfire",
85
+ name: "Campfire",
86
+ category: "building",
87
+ ingredients: [
88
+ { resourceType: "wood", amount: 10 },
89
+ { resourceType: "stone", amount: 8 }
90
+ ],
91
+ output: { itemId: "campfire", amount: 1 },
92
+ craftingTime: 3,
93
+ unlocked: true
113
94
  };
114
95
  const RECIPE_STONE_AXE = {
115
- id: 'stone_axe',
116
- name: 'Stone Axe',
117
- category: 'tool',
118
- ingredients: [
119
- { resourceType: 'wood', amount: 5 },
120
- { resourceType: 'stone', amount: 10 },
121
- { resourceType: 'fiber', amount: 3 },
122
- ],
123
- output: { itemId: 'stone_axe', amount: 1 },
124
- craftingTime: 2,
125
- unlocked: true,
96
+ id: "stone_axe",
97
+ name: "Stone Axe",
98
+ category: "tool",
99
+ ingredients: [
100
+ { resourceType: "wood", amount: 5 },
101
+ { resourceType: "stone", amount: 10 },
102
+ { resourceType: "fiber", amount: 3 }
103
+ ],
104
+ output: { itemId: "stone_axe", amount: 1 },
105
+ craftingTime: 2,
106
+ unlocked: true
126
107
  };
127
108
  const RECIPE_STONE_PICKAXE = {
128
- id: 'stone_pickaxe',
129
- name: 'Stone Pickaxe',
130
- category: 'tool',
131
- ingredients: [
132
- { resourceType: 'wood', amount: 5 },
133
- { resourceType: 'stone', amount: 15 },
134
- { resourceType: 'fiber', amount: 3 },
135
- ],
136
- output: { itemId: 'stone_pickaxe', amount: 1 },
137
- craftingTime: 2,
138
- unlocked: true,
109
+ id: "stone_pickaxe",
110
+ name: "Stone Pickaxe",
111
+ category: "tool",
112
+ ingredients: [
113
+ { resourceType: "wood", amount: 5 },
114
+ { resourceType: "stone", amount: 15 },
115
+ { resourceType: "fiber", amount: 3 }
116
+ ],
117
+ output: { itemId: "stone_pickaxe", amount: 1 },
118
+ craftingTime: 2,
119
+ unlocked: true
139
120
  };
140
121
  const RECIPE_COOKED_MEAT = {
141
- id: 'cooked_meat',
142
- name: 'Cooked Meat',
143
- category: 'consumable',
144
- ingredients: [{ resourceType: 'meat', amount: 1 }],
145
- output: { itemId: 'cooked_meat', amount: 1 },
146
- craftingTime: 10,
147
- requiredStation: 'campfire',
148
- unlocked: true,
122
+ id: "cooked_meat",
123
+ name: "Cooked Meat",
124
+ category: "consumable",
125
+ ingredients: [{ resourceType: "meat", amount: 1 }],
126
+ output: { itemId: "cooked_meat", amount: 1 },
127
+ craftingTime: 10,
128
+ requiredStation: "campfire",
129
+ unlocked: true
149
130
  };
150
131
  const RECIPE_WOODEN_WALL = {
151
- id: 'wooden_wall',
152
- name: 'Wooden Wall',
153
- category: 'building',
154
- ingredients: [{ resourceType: 'wood', amount: 15 }],
155
- output: { itemId: 'wooden_wall', amount: 1 },
156
- craftingTime: 3,
157
- requiredStation: 'workbench',
158
- unlocked: true,
132
+ id: "wooden_wall",
133
+ name: "Wooden Wall",
134
+ category: "building",
135
+ ingredients: [{ resourceType: "wood", amount: 15 }],
136
+ output: { itemId: "wooden_wall", amount: 1 },
137
+ craftingTime: 3,
138
+ requiredStation: "workbench",
139
+ unlocked: true
159
140
  };
160
141
  const RECIPE_IRON_AXE = {
161
- id: 'iron_axe',
162
- name: 'Iron Axe',
163
- category: 'tool',
164
- ingredients: [
165
- { resourceType: 'wood', amount: 5 },
166
- { resourceType: 'iron', amount: 8 },
167
- { resourceType: 'leather', amount: 2 },
168
- ],
169
- output: { itemId: 'iron_axe', amount: 1 },
170
- craftingTime: 5,
171
- requiredStation: 'forge',
172
- unlocked: false,
142
+ id: "iron_axe",
143
+ name: "Iron Axe",
144
+ category: "tool",
145
+ ingredients: [
146
+ { resourceType: "wood", amount: 5 },
147
+ { resourceType: "iron", amount: 8 },
148
+ { resourceType: "leather", amount: 2 }
149
+ ],
150
+ output: { itemId: "iron_axe", amount: 1 },
151
+ craftingTime: 5,
152
+ requiredStation: "forge",
153
+ unlocked: false
173
154
  };
174
- // ============================================================
175
- // Core Functions
176
- // ============================================================
177
155
  function createSurvivalNeeds(config) {
178
- return {
179
- health: config?.health ?? 100,
180
- maxHealth: config?.maxHealth ?? 100,
181
- hunger: config?.hunger ?? 100,
182
- maxHunger: config?.maxHunger ?? 100,
183
- thirst: config?.thirst ?? 100,
184
- maxThirst: config?.maxThirst ?? 100,
185
- stamina: config?.stamina ?? 100,
186
- maxStamina: config?.maxStamina ?? 100,
187
- temperature: config?.temperature ?? 0,
188
- sanity: config?.sanity ?? 100,
189
- maxSanity: config?.maxSanity ?? 100,
190
- };
156
+ return {
157
+ health: config?.health ?? 100,
158
+ maxHealth: config?.maxHealth ?? 100,
159
+ hunger: config?.hunger ?? 100,
160
+ maxHunger: config?.maxHunger ?? 100,
161
+ thirst: config?.thirst ?? 100,
162
+ maxThirst: config?.maxThirst ?? 100,
163
+ stamina: config?.stamina ?? 100,
164
+ maxStamina: config?.maxStamina ?? 100,
165
+ temperature: config?.temperature ?? 0,
166
+ sanity: config?.sanity ?? 100,
167
+ maxSanity: config?.maxSanity ?? 100
168
+ };
191
169
  }
192
170
  function createSurvivalState(worldSeed) {
193
- return {
194
- needs: createSurvivalNeeds(),
195
- inventory: [],
196
- hotbar: [null, null, null, null, null, null, null, null],
197
- equipment: {},
198
- unlockedRecipes: [
199
- 'workbench',
200
- 'campfire',
201
- 'stone_axe',
202
- 'stone_pickaxe',
203
- 'cooked_meat',
204
- 'wooden_wall',
205
- ],
206
- placedBuildings: [],
207
- discoveredNodes: [],
208
- currentWeather: 'clear',
209
- dayNight: { ...DEFAULT_DAY_NIGHT },
210
- worldSeed: worldSeed ?? Math.floor(Math.random() * 1000000),
211
- playTime: 0,
212
- deaths: 0,
213
- };
171
+ return {
172
+ needs: createSurvivalNeeds(),
173
+ inventory: [],
174
+ hotbar: [null, null, null, null, null, null, null, null],
175
+ equipment: {},
176
+ unlockedRecipes: [
177
+ "workbench",
178
+ "campfire",
179
+ "stone_axe",
180
+ "stone_pickaxe",
181
+ "cooked_meat",
182
+ "wooden_wall"
183
+ ],
184
+ placedBuildings: [],
185
+ discoveredNodes: [],
186
+ currentWeather: "clear",
187
+ dayNight: { ...DEFAULT_DAY_NIGHT },
188
+ worldSeed: worldSeed ?? Math.floor(Math.random() * 1e6),
189
+ playTime: 0,
190
+ deaths: 0
191
+ };
214
192
  }
215
193
  function updateSurvivalNeeds(state, dt, config, isRunning) {
216
- // Decay hunger/thirst
217
- state.needs.hunger = Math.max(0, state.needs.hunger - config.hungerDecayRate * dt);
218
- state.needs.thirst = Math.max(0, state.needs.thirst - config.thirstDecayRate * dt);
219
- // Stamina
220
- if (isRunning && state.needs.stamina > 0) {
221
- state.needs.stamina = Math.max(0, state.needs.stamina - config.staminaDecayOnRun * dt);
222
- }
223
- else if (!isRunning) {
224
- state.needs.stamina = Math.min(state.needs.maxStamina, state.needs.stamina + config.staminaRegenRate * dt);
225
- }
226
- // Health regen
227
- if (state.needs.hunger > config.healthRegenThreshold &&
228
- state.needs.thirst > config.healthRegenThreshold) {
229
- state.needs.health = Math.min(state.needs.maxHealth, state.needs.health + config.healthRegenRate * dt);
230
- }
231
- // Death checks
232
- if (config.deathOnZeroHunger && state.needs.hunger <= 0) {
233
- state.needs.health -= dt;
234
- }
235
- if (config.deathOnZeroThirst && state.needs.thirst <= 0) {
236
- state.needs.health -= dt * 2;
237
- }
238
- // Temperature damage
239
- if (state.needs.temperature < config.temperatureComfortRange.min ||
240
- state.needs.temperature > config.temperatureComfortRange.max) {
241
- state.needs.health -= config.temperatureDamageRate * dt;
242
- }
194
+ state.needs.hunger = Math.max(0, state.needs.hunger - config.hungerDecayRate * dt);
195
+ state.needs.thirst = Math.max(0, state.needs.thirst - config.thirstDecayRate * dt);
196
+ if (isRunning && state.needs.stamina > 0) {
197
+ state.needs.stamina = Math.max(0, state.needs.stamina - config.staminaDecayOnRun * dt);
198
+ } else if (!isRunning) {
199
+ state.needs.stamina = Math.min(
200
+ state.needs.maxStamina,
201
+ state.needs.stamina + config.staminaRegenRate * dt
202
+ );
203
+ }
204
+ if (state.needs.hunger > config.healthRegenThreshold && state.needs.thirst > config.healthRegenThreshold) {
205
+ state.needs.health = Math.min(
206
+ state.needs.maxHealth,
207
+ state.needs.health + config.healthRegenRate * dt
208
+ );
209
+ }
210
+ if (config.deathOnZeroHunger && state.needs.hunger <= 0) {
211
+ state.needs.health -= dt;
212
+ }
213
+ if (config.deathOnZeroThirst && state.needs.thirst <= 0) {
214
+ state.needs.health -= dt * 2;
215
+ }
216
+ if (state.needs.temperature < config.temperatureComfortRange.min || state.needs.temperature > config.temperatureComfortRange.max) {
217
+ state.needs.health -= config.temperatureDamageRate * dt;
218
+ }
243
219
  }
244
220
  function updateDayNight(state, realDeltaSeconds) {
245
- const { dayNight } = state;
246
- const timeProgress = (24 / dayNight.dayLength) * realDeltaSeconds;
247
- dayNight.currentTime = (dayNight.currentTime + timeProgress) % 24;
221
+ const { dayNight } = state;
222
+ const timeProgress = 24 / dayNight.dayLength * realDeltaSeconds;
223
+ dayNight.currentTime = (dayNight.currentTime + timeProgress) % 24;
248
224
  }
249
225
  function isNight(dayNight) {
250
- return dayNight.currentTime < dayNight.dawnTime || dayNight.currentTime >= dayNight.duskTime;
226
+ return dayNight.currentTime < dayNight.dawnTime || dayNight.currentTime >= dayNight.duskTime;
251
227
  }
252
228
  function getDaylightLevel(dayNight) {
253
- const { currentTime, dawnTime, duskTime } = dayNight;
254
- if (currentTime >= dawnTime && currentTime < dawnTime + 1) {
255
- return currentTime - dawnTime; // Dawn transition
256
- }
257
- if (currentTime >= dawnTime + 1 && currentTime < duskTime - 1) {
258
- return 1; // Full day
259
- }
260
- if (currentTime >= duskTime - 1 && currentTime < duskTime) {
261
- return duskTime - currentTime; // Dusk transition
262
- }
263
- return 0; // Night
229
+ const { currentTime, dawnTime, duskTime } = dayNight;
230
+ if (currentTime >= dawnTime && currentTime < dawnTime + 1) {
231
+ return currentTime - dawnTime;
232
+ }
233
+ if (currentTime >= dawnTime + 1 && currentTime < duskTime - 1) {
234
+ return 1;
235
+ }
236
+ if (currentTime >= duskTime - 1 && currentTime < duskTime) {
237
+ return duskTime - currentTime;
238
+ }
239
+ return 0;
264
240
  }
265
- // ============================================================
266
- // Crafting
267
- // ============================================================
268
241
  function canCraft(recipe, inventory, nearbyStations) {
269
- // Check station requirement
270
- if (recipe.requiredStation && !nearbyStations.includes(recipe.requiredStation)) {
271
- return false;
272
- }
273
- // Check ingredients
274
- for (const ingredient of recipe.ingredients) {
275
- const inventoryItem = inventory.find((i) => i.itemId === ingredient.resourceType);
276
- if (!inventoryItem || inventoryItem.amount < ingredient.amount) {
277
- return false;
278
- }
242
+ if (recipe.requiredStation && !nearbyStations.includes(recipe.requiredStation)) {
243
+ return false;
244
+ }
245
+ for (const ingredient of recipe.ingredients) {
246
+ const inventoryItem = inventory.find((i) => i.itemId === ingredient.resourceType);
247
+ if (!inventoryItem || inventoryItem.amount < ingredient.amount) {
248
+ return false;
279
249
  }
280
- return true;
250
+ }
251
+ return true;
281
252
  }
282
253
  function craft(state, recipe) {
283
- // Remove ingredients
284
- for (const ingredient of recipe.ingredients) {
285
- const idx = state.inventory.findIndex((i) => i.itemId === ingredient.resourceType);
286
- if (idx !== -1) {
287
- state.inventory[idx].amount -= ingredient.amount;
288
- if (state.inventory[idx].amount <= 0) {
289
- state.inventory.splice(idx, 1);
290
- }
291
- }
292
- }
293
- // Add output
294
- const existingOutput = state.inventory.find((i) => i.itemId === recipe.output.itemId);
295
- if (existingOutput) {
296
- existingOutput.amount += recipe.output.amount;
297
- }
298
- else {
299
- state.inventory.push({
300
- itemId: recipe.output.itemId,
301
- amount: recipe.output.amount,
302
- });
254
+ for (const ingredient of recipe.ingredients) {
255
+ const idx = state.inventory.findIndex((i) => i.itemId === ingredient.resourceType);
256
+ if (idx !== -1) {
257
+ state.inventory[idx].amount -= ingredient.amount;
258
+ if (state.inventory[idx].amount <= 0) {
259
+ state.inventory.splice(idx, 1);
260
+ }
303
261
  }
304
- return true;
262
+ }
263
+ const existingOutput = state.inventory.find((i) => i.itemId === recipe.output.itemId);
264
+ if (existingOutput) {
265
+ existingOutput.amount += recipe.output.amount;
266
+ } else {
267
+ state.inventory.push({
268
+ itemId: recipe.output.itemId,
269
+ amount: recipe.output.amount
270
+ });
271
+ }
272
+ return true;
305
273
  }
306
- // ============================================================
307
- // Resource Gathering
308
- // ============================================================
309
274
  function harvestResource(node, tool, harvestAmount = 1) {
310
- // Check tool requirement
311
- if (node.tool && tool !== node.tool) {
312
- return null;
313
- }
314
- if (node.amount <= 0) {
315
- return null;
316
- }
317
- const harvested = Math.min(harvestAmount, node.amount);
318
- node.amount -= harvested;
319
- node.lastHarvested = Date.now();
320
- return {
321
- resourceType: node.type,
322
- amount: harvested,
323
- };
275
+ if (node.tool && tool !== node.tool) {
276
+ return null;
277
+ }
278
+ if (node.amount <= 0) {
279
+ return null;
280
+ }
281
+ const harvested = Math.min(harvestAmount, node.amount);
282
+ node.amount -= harvested;
283
+ node.lastHarvested = Date.now();
284
+ return {
285
+ resourceType: node.type,
286
+ amount: harvested
287
+ };
324
288
  }
325
289
  function respawnResources(nodes, currentTime) {
326
- for (const node of nodes) {
327
- if (node.amount < node.maxAmount) {
328
- const timeSinceHarvest = (currentTime - node.lastHarvested) / 1000;
329
- if (timeSinceHarvest >= node.respawnTime) {
330
- node.amount = node.maxAmount;
331
- }
332
- }
290
+ for (const node of nodes) {
291
+ if (node.amount < node.maxAmount) {
292
+ const timeSinceHarvest = (currentTime - node.lastHarvested) / 1e3;
293
+ if (timeSinceHarvest >= node.respawnTime) {
294
+ node.amount = node.maxAmount;
295
+ }
333
296
  }
297
+ }
334
298
  }
335
- // ============================================================
336
- // Building
337
- // ============================================================
338
299
  function canPlaceBuilding(blueprint, position, existingBuildings) {
339
- // Check placement rules
340
- for (const rule of blueprint.placementRules) {
341
- switch (rule.type) {
342
- case 'requires_foundation': {
343
- const hasFoundation = existingBuildings.some((b) => b.blueprintId.includes('foundation') &&
344
- Math.abs(b.position.x - position.x) < 10 &&
345
- Math.abs(b.position.y - position.y) < 10);
346
- if (!hasFoundation) {
347
- return { canPlace: false, reason: 'Requires foundation' };
348
- }
349
- break;
350
- }
351
- case 'minimum_distance': {
352
- const tooClose = existingBuildings.some((b) => Math.hypot(b.position.x - position.x, b.position.y - position.y) < (rule.value ?? 10));
353
- if (tooClose) {
354
- return { canPlace: false, reason: 'Too close to another building' };
355
- }
356
- break;
357
- }
300
+ for (const rule of blueprint.placementRules) {
301
+ switch (rule.type) {
302
+ case "requires_foundation": {
303
+ const hasFoundation = existingBuildings.some(
304
+ (b) => b.blueprintId.includes("foundation") && Math.abs(b.position.x - position.x) < 10 && Math.abs(b.position.y - position.y) < 10
305
+ );
306
+ if (!hasFoundation) {
307
+ return { canPlace: false, reason: "Requires foundation" };
308
+ }
309
+ break;
310
+ }
311
+ case "minimum_distance": {
312
+ const tooClose = existingBuildings.some(
313
+ (b) => Math.hypot(b.position.x - position.x, b.position.y - position.y) < (rule.value ?? 10)
314
+ );
315
+ if (tooClose) {
316
+ return { canPlace: false, reason: "Too close to another building" };
358
317
  }
318
+ break;
319
+ }
359
320
  }
360
- return { canPlace: true };
321
+ }
322
+ return { canPlace: true };
361
323
  }
362
324
  function placeBuilding(state, blueprint, position, rotation, playerId) {
363
- // Check ingredients
364
- for (const ingredient of blueprint.ingredients) {
365
- const inventoryItem = state.inventory.find((i) => i.itemId === ingredient.resourceType);
366
- if (!inventoryItem || inventoryItem.amount < ingredient.amount) {
367
- return null;
368
- }
325
+ for (const ingredient of blueprint.ingredients) {
326
+ const inventoryItem = state.inventory.find((i) => i.itemId === ingredient.resourceType);
327
+ if (!inventoryItem || inventoryItem.amount < ingredient.amount) {
328
+ return null;
369
329
  }
370
- // Remove ingredients
371
- for (const ingredient of blueprint.ingredients) {
372
- const idx = state.inventory.findIndex((i) => i.itemId === ingredient.resourceType);
373
- if (idx !== -1) {
374
- state.inventory[idx].amount -= ingredient.amount;
375
- if (state.inventory[idx].amount <= 0) {
376
- state.inventory.splice(idx, 1);
377
- }
378
- }
330
+ }
331
+ for (const ingredient of blueprint.ingredients) {
332
+ const idx = state.inventory.findIndex((i) => i.itemId === ingredient.resourceType);
333
+ if (idx !== -1) {
334
+ state.inventory[idx].amount -= ingredient.amount;
335
+ if (state.inventory[idx].amount <= 0) {
336
+ state.inventory.splice(idx, 1);
337
+ }
379
338
  }
380
- const building = {
381
- id: `building_${Date.now()}_${Math.random().toString(36).slice(2)}`,
382
- blueprintId: blueprint.id,
383
- position: { ...position },
384
- rotation,
385
- health: blueprint.health,
386
- maxHealth: blueprint.health,
387
- ownerPlayerId: playerId,
388
- };
389
- state.placedBuildings.push(building);
390
- return building;
339
+ }
340
+ const building = {
341
+ id: `building_${Date.now()}_${Math.random().toString(36).slice(2)}`,
342
+ blueprintId: blueprint.id,
343
+ position: { ...position },
344
+ rotation,
345
+ health: blueprint.health,
346
+ maxHealth: blueprint.health,
347
+ ownerPlayerId: playerId
348
+ };
349
+ state.placedBuildings.push(building);
350
+ return building;
391
351
  }
392
352
  function damageBuilding(building, damage) {
393
- building.health -= damage;
394
- return building.health <= 0;
353
+ building.health -= damage;
354
+ return building.health <= 0;
395
355
  }
396
- // ============================================================
397
- // Factory Functions
398
- // ============================================================
399
356
  function createResourceNode(type, position, amount, options) {
400
- return {
401
- id: `node_${Date.now()}_${Math.random().toString(36).slice(2)}`,
402
- type,
403
- position: { ...position },
404
- amount,
405
- maxAmount: options?.maxAmount ?? amount,
406
- respawnTime: options?.respawnTime ?? 300,
407
- lastHarvested: 0,
408
- tool: options?.tool,
409
- harvestTime: options?.harvestTime ?? 1,
410
- };
357
+ return {
358
+ id: `node_${Date.now()}_${Math.random().toString(36).slice(2)}`,
359
+ type,
360
+ position: { ...position },
361
+ amount,
362
+ maxAmount: options?.maxAmount ?? amount,
363
+ respawnTime: options?.respawnTime ?? 300,
364
+ lastHarvested: 0,
365
+ tool: options?.tool,
366
+ harvestTime: options?.harvestTime ?? 1
367
+ };
411
368
  }
412
369
  function createCraftingRecipe(partial) {
413
- return {
414
- id: partial.id ?? 'unnamed',
415
- name: partial.name ?? 'Unnamed Recipe',
416
- category: partial.category ?? 'material',
417
- ingredients: partial.ingredients ?? [],
418
- output: partial.output ?? { itemId: 'unknown', amount: 1 },
419
- craftingTime: partial.craftingTime ?? 1,
420
- requiredStation: partial.requiredStation,
421
- requiredSkillLevel: partial.requiredSkillLevel,
422
- unlocked: partial.unlocked ?? false,
423
- };
370
+ return {
371
+ id: partial.id ?? "unnamed",
372
+ name: partial.name ?? "Unnamed Recipe",
373
+ category: partial.category ?? "material",
374
+ ingredients: partial.ingredients ?? [],
375
+ output: partial.output ?? { itemId: "unknown", amount: 1 },
376
+ craftingTime: partial.craftingTime ?? 1,
377
+ requiredStation: partial.requiredStation,
378
+ requiredSkillLevel: partial.requiredSkillLevel,
379
+ unlocked: partial.unlocked ?? false
380
+ };
424
381
  }
425
382
  function createBuildingBlueprint(partial) {
426
- return {
427
- id: partial.id ?? 'unnamed',
428
- name: partial.name ?? 'Unnamed Building',
429
- category: partial.category ?? 'furniture',
430
- size: partial.size ?? { width: 1, height: 1 },
431
- ingredients: partial.ingredients ?? [],
432
- health: partial.health ?? 100,
433
- snapPoints: partial.snapPoints ?? [],
434
- placementRules: partial.placementRules ?? [],
435
- };
383
+ return {
384
+ id: partial.id ?? "unnamed",
385
+ name: partial.name ?? "Unnamed Building",
386
+ category: partial.category ?? "furniture",
387
+ size: partial.size ?? { width: 1, height: 1 },
388
+ ingredients: partial.ingredients ?? [],
389
+ health: partial.health ?? 100,
390
+ snapPoints: partial.snapPoints ?? [],
391
+ placementRules: partial.placementRules ?? []
392
+ };
436
393
  }
437
394
  function createEnvironmentalHazard(type, position, radius, damagePerSecond) {
438
- return {
439
- id: `hazard_${Date.now()}_${Math.random().toString(36).slice(2)}`,
440
- type,
441
- position: { ...position },
442
- radius,
443
- damagePerSecond,
444
- effectDuration: 5,
445
- };
395
+ return {
396
+ id: `hazard_${Date.now()}_${Math.random().toString(36).slice(2)}`,
397
+ type,
398
+ position: { ...position },
399
+ radius,
400
+ damagePerSecond,
401
+ effectDuration: 5
402
+ };
446
403
  }
447
-
448
- export { DEFAULT_DAY_NIGHT, DEFAULT_SURVIVAL_CONFIG, RECIPE_CAMPFIRE, RECIPE_COOKED_MEAT, RECIPE_IRON_AXE, RECIPE_STONE_AXE, RECIPE_STONE_PICKAXE, RECIPE_WOODEN_WALL, RECIPE_WORKBENCH, WEATHER_CLEAR, WEATHER_HEATWAVE, WEATHER_RAIN, WEATHER_SNOW, WEATHER_STORM, canCraft, canPlaceBuilding, craft, createBuildingBlueprint, createCraftingRecipe, createEnvironmentalHazard, createResourceNode, createSurvivalNeeds, createSurvivalState, damageBuilding, getDaylightLevel, harvestResource, isNight, placeBuilding, respawnResources, updateDayNight, updateSurvivalNeeds };
404
+ export {
405
+ DEFAULT_DAY_NIGHT,
406
+ DEFAULT_SURVIVAL_CONFIG,
407
+ RECIPE_CAMPFIRE,
408
+ RECIPE_COOKED_MEAT,
409
+ RECIPE_IRON_AXE,
410
+ RECIPE_STONE_AXE,
411
+ RECIPE_STONE_PICKAXE,
412
+ RECIPE_WOODEN_WALL,
413
+ RECIPE_WORKBENCH,
414
+ WEATHER_CLEAR,
415
+ WEATHER_HEATWAVE,
416
+ WEATHER_RAIN,
417
+ WEATHER_SNOW,
418
+ WEATHER_STORM,
419
+ canCraft,
420
+ canPlaceBuilding,
421
+ craft,
422
+ createBuildingBlueprint,
423
+ createCraftingRecipe,
424
+ createEnvironmentalHazard,
425
+ createResourceNode,
426
+ createSurvivalNeeds,
427
+ createSurvivalState,
428
+ damageBuilding,
429
+ getDaylightLevel,
430
+ harvestResource,
431
+ isNight,
432
+ placeBuilding,
433
+ respawnResources,
434
+ updateDayNight,
435
+ updateSurvivalNeeds
436
+ };