@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,1130 +1,1091 @@
1
- /**
2
- * @file VisualScripting2.ts
3
- * @description Visual Scripting 2.0 — Node-based Scripting System with Debugger
4
- * PRO-1.4: Professional Editor Features
5
- *
6
- * Features:
7
- * - Node-based visual programming (like Unreal Blueprints)
8
- * - Real-time debugger with breakpoints
9
- * - Step-by-step execution
10
- * - Watch expressions
11
- * - Variable inspection
12
- * - Call stack visualization
13
- * - Live preview in editor
14
- */
15
- /** Type color mapping for visual identification */
16
1
  const VS_TYPE_COLORS = {
17
- flow: '#ffffff',
18
- bool: '#dc2626', // Red
19
- int: '#22d3ee', // Cyan
20
- float: '#10b981', // Green
21
- string: '#f472b6', // Pink
22
- vec2: '#fbbf24', // Yellow
23
- vec3: '#fbbf24', // Yellow
24
- color: '#c084fc', // Purple
25
- entity: '#3b82f6', // Blue
26
- component: '#8b5cf6', // Violet
27
- asset: '#f97316', // Orange
28
- array: '#6b7280', // Gray
29
- map: '#6b7280', // Gray
30
- struct: '#14b8a6', // Teal
31
- object: '#6b7280', // Gray
32
- enum: '#84cc16', // Lime
33
- delegate: '#ef4444', // Red
34
- wildcard: '#a3a3a3', // Neutral
2
+ flow: "#ffffff",
3
+ bool: "#dc2626",
4
+ // Red
5
+ int: "#22d3ee",
6
+ // Cyan
7
+ float: "#10b981",
8
+ // Green
9
+ string: "#f472b6",
10
+ // Pink
11
+ vec2: "#fbbf24",
12
+ // Yellow
13
+ vec3: "#fbbf24",
14
+ // Yellow
15
+ color: "#c084fc",
16
+ // Purple
17
+ entity: "#3b82f6",
18
+ // Blue
19
+ component: "#8b5cf6",
20
+ // Violet
21
+ asset: "#f97316",
22
+ // Orange
23
+ array: "#6b7280",
24
+ // Gray
25
+ map: "#6b7280",
26
+ // Gray
27
+ struct: "#14b8a6",
28
+ // Teal
29
+ object: "#6b7280",
30
+ // Gray
31
+ enum: "#84cc16",
32
+ // Lime
33
+ delegate: "#ef4444",
34
+ // Red
35
+ wildcard: "#a3a3a3"
36
+ // Neutral
35
37
  };
36
- // ============================================================
37
- // Visual Scripting Debugger
38
- // ============================================================
39
38
  class VSDebugger {
40
- constructor() {
41
- this.eventListeners = new Map();
42
- this.session = this.createSession();
43
- }
44
- createSession() {
45
- return {
46
- state: 'stopped',
47
- currentNode: null,
48
- currentGraph: null,
49
- callStack: [],
50
- breakpoints: new Map(),
51
- watches: [],
52
- history: [],
53
- historyIndex: -1,
54
- profiling: {
55
- enabled: false,
56
- nodeExecutionTimes: new Map(),
57
- totalFrameTime: 0,
58
- frameCount: 0,
59
- },
60
- };
61
- }
62
- // ─── Session Control ─────────────────────────────
63
- start() {
64
- this.session.state = 'running';
65
- this.emit('graph-started', {});
66
- }
67
- pause() {
68
- this.session.state = 'paused';
69
- }
70
- resume() {
71
- if (this.session.state === 'paused') {
72
- this.session.state = 'running';
73
- }
74
- }
75
- stop() {
76
- this.session = this.createSession();
77
- this.emit('graph-completed', {});
78
- }
79
- getState() {
80
- return this.session.state;
81
- }
82
- // ─── Stepping ────────────────────────────────────
83
- stepOver() {
84
- this.session.state = 'stepping';
85
- // Implementation would execute current node and stop at next
86
- }
87
- stepInto() {
88
- this.session.state = 'stepping';
89
- // Implementation would step into function/macro
90
- }
91
- stepOut() {
92
- this.session.state = 'stepping';
93
- // Implementation would step out of current function
94
- }
95
- stepBack() {
96
- if (this.session.historyIndex > 0) {
97
- this.session.historyIndex--;
98
- const snapshot = this.session.history[this.session.historyIndex];
99
- this.session.currentNode = snapshot.nodeId;
100
- // Restore state from snapshot
101
- }
102
- }
103
- // ─── Breakpoints ─────────────────────────────────
104
- addBreakpoint(nodeId, options) {
105
- const bp = {
106
- id: `bp_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`,
107
- nodeId,
108
- enabled: true,
109
- ...options,
110
- };
111
- this.session.breakpoints.set(bp.id, bp);
112
- return bp;
113
- }
114
- removeBreakpoint(breakpointId) {
115
- this.session.breakpoints.delete(breakpointId);
116
- }
117
- toggleBreakpoint(nodeId) {
118
- // Find existing breakpoint on this node
119
- for (const bp of this.session.breakpoints.values()) {
120
- if (bp.nodeId === nodeId) {
121
- this.removeBreakpoint(bp.id);
122
- return null;
123
- }
124
- }
125
- return this.addBreakpoint(nodeId);
126
- }
127
- setBreakpointCondition(breakpointId, condition) {
128
- const bp = this.session.breakpoints.get(breakpointId);
129
- if (bp) {
130
- bp.condition = condition;
131
- }
39
+ constructor() {
40
+ this.eventListeners = /* @__PURE__ */ new Map();
41
+ this.session = this.createSession();
42
+ }
43
+ createSession() {
44
+ return {
45
+ state: "stopped",
46
+ currentNode: null,
47
+ currentGraph: null,
48
+ callStack: [],
49
+ breakpoints: /* @__PURE__ */ new Map(),
50
+ watches: [],
51
+ history: [],
52
+ historyIndex: -1,
53
+ profiling: {
54
+ enabled: false,
55
+ nodeExecutionTimes: /* @__PURE__ */ new Map(),
56
+ totalFrameTime: 0,
57
+ frameCount: 0
58
+ }
59
+ };
60
+ }
61
+ // ─── Session Control ─────────────────────────────
62
+ start() {
63
+ this.session.state = "running";
64
+ this.emit("graph-started", {});
65
+ }
66
+ pause() {
67
+ this.session.state = "paused";
68
+ }
69
+ resume() {
70
+ if (this.session.state === "paused") {
71
+ this.session.state = "running";
132
72
  }
133
- enableBreakpoint(breakpointId, enabled) {
134
- const bp = this.session.breakpoints.get(breakpointId);
135
- if (bp) {
136
- bp.enabled = enabled;
137
- }
73
+ }
74
+ stop() {
75
+ this.session = this.createSession();
76
+ this.emit("graph-completed", {});
77
+ }
78
+ getState() {
79
+ return this.session.state;
80
+ }
81
+ // ─── Stepping ────────────────────────────────────
82
+ stepOver() {
83
+ this.session.state = "stepping";
84
+ }
85
+ stepInto() {
86
+ this.session.state = "stepping";
87
+ }
88
+ stepOut() {
89
+ this.session.state = "stepping";
90
+ }
91
+ stepBack() {
92
+ if (this.session.historyIndex > 0) {
93
+ this.session.historyIndex--;
94
+ const snapshot = this.session.history[this.session.historyIndex];
95
+ this.session.currentNode = snapshot.nodeId;
138
96
  }
139
- getBreakpoints() {
140
- return Array.from(this.session.breakpoints.values());
97
+ }
98
+ // ─── Breakpoints ─────────────────────────────────
99
+ addBreakpoint(nodeId, options) {
100
+ const bp = {
101
+ id: `bp_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`,
102
+ nodeId,
103
+ enabled: true,
104
+ ...options
105
+ };
106
+ this.session.breakpoints.set(bp.id, bp);
107
+ return bp;
108
+ }
109
+ removeBreakpoint(breakpointId) {
110
+ this.session.breakpoints.delete(breakpointId);
111
+ }
112
+ toggleBreakpoint(nodeId) {
113
+ for (const bp of this.session.breakpoints.values()) {
114
+ if (bp.nodeId === nodeId) {
115
+ this.removeBreakpoint(bp.id);
116
+ return null;
117
+ }
141
118
  }
142
- // ─── Watch Expressions ───────────────────────────
143
- addWatch(expression) {
144
- const watch = {
145
- id: `watch_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`,
146
- expression,
147
- value: undefined,
148
- type: 'wildcard',
149
- };
150
- this.session.watches.push(watch);
151
- return watch;
119
+ return this.addBreakpoint(nodeId);
120
+ }
121
+ setBreakpointCondition(breakpointId, condition) {
122
+ const bp = this.session.breakpoints.get(breakpointId);
123
+ if (bp) {
124
+ bp.condition = condition;
152
125
  }
153
- removeWatch(watchId) {
154
- const idx = this.session.watches.findIndex((w) => w.id === watchId);
155
- if (idx >= 0) {
156
- this.session.watches.splice(idx, 1);
157
- }
126
+ }
127
+ enableBreakpoint(breakpointId, enabled) {
128
+ const bp = this.session.breakpoints.get(breakpointId);
129
+ if (bp) {
130
+ bp.enabled = enabled;
158
131
  }
159
- updateWatches(context) {
160
- for (const watch of this.session.watches) {
161
- try {
162
- watch.value = this.evaluateExpression(watch.expression, context);
163
- watch.error = undefined;
164
- }
165
- catch (err) {
166
- watch.error = String(err);
167
- }
168
- }
169
- }
170
- getWatches() {
171
- return [...this.session.watches];
132
+ }
133
+ getBreakpoints() {
134
+ return Array.from(this.session.breakpoints.values());
135
+ }
136
+ // ─── Watch Expressions ───────────────────────────
137
+ addWatch(expression) {
138
+ const watch = {
139
+ id: `watch_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`,
140
+ expression,
141
+ value: void 0,
142
+ type: "wildcard"
143
+ };
144
+ this.session.watches.push(watch);
145
+ return watch;
146
+ }
147
+ removeWatch(watchId) {
148
+ const idx = this.session.watches.findIndex((w) => w.id === watchId);
149
+ if (idx >= 0) {
150
+ this.session.watches.splice(idx, 1);
172
151
  }
173
- // ─── Call Stack ──────────────────────────────────
174
- pushStack(frame) {
175
- this.session.callStack.push(frame);
152
+ }
153
+ updateWatches(context) {
154
+ for (const watch of this.session.watches) {
155
+ try {
156
+ watch.value = this.evaluateExpression(watch.expression, context);
157
+ watch.error = void 0;
158
+ } catch (err) {
159
+ watch.error = String(err);
160
+ }
176
161
  }
177
- popStack() {
178
- return this.session.callStack.pop();
162
+ }
163
+ getWatches() {
164
+ return [...this.session.watches];
165
+ }
166
+ // ─── Call Stack ──────────────────────────────────
167
+ pushStack(frame) {
168
+ this.session.callStack.push(frame);
169
+ }
170
+ popStack() {
171
+ return this.session.callStack.pop();
172
+ }
173
+ getCallStack() {
174
+ return [...this.session.callStack];
175
+ }
176
+ getCurrentFrame() {
177
+ return this.session.callStack[this.session.callStack.length - 1] || null;
178
+ }
179
+ // ─── History/Snapshots ───────────────────────────
180
+ recordSnapshot(snapshot) {
181
+ const MAX_HISTORY = 1e3;
182
+ if (this.session.history.length >= MAX_HISTORY) {
183
+ this.session.history.shift();
179
184
  }
180
- getCallStack() {
181
- return [...this.session.callStack];
185
+ this.session.history.push(snapshot);
186
+ this.session.historyIndex = this.session.history.length - 1;
187
+ }
188
+ getHistory() {
189
+ return [...this.session.history];
190
+ }
191
+ // ─── Profiling ───────────────────────────────────
192
+ enableProfiling(enabled) {
193
+ this.session.profiling.enabled = enabled;
194
+ if (!enabled) {
195
+ this.session.profiling.nodeExecutionTimes.clear();
196
+ this.session.profiling.totalFrameTime = 0;
197
+ this.session.profiling.frameCount = 0;
182
198
  }
183
- getCurrentFrame() {
184
- return this.session.callStack[this.session.callStack.length - 1] || null;
199
+ }
200
+ recordNodeTime(nodeId, timeMs) {
201
+ if (!this.session.profiling.enabled) {
202
+ return;
185
203
  }
186
- // ─── History/Snapshots ───────────────────────────
187
- recordSnapshot(snapshot) {
188
- // Limit history size
189
- const MAX_HISTORY = 1000;
190
- if (this.session.history.length >= MAX_HISTORY) {
191
- this.session.history.shift();
192
- }
193
- this.session.history.push(snapshot);
194
- this.session.historyIndex = this.session.history.length - 1;
204
+ let times = this.session.profiling.nodeExecutionTimes.get(nodeId);
205
+ if (!times) {
206
+ times = [];
207
+ this.session.profiling.nodeExecutionTimes.set(nodeId, times);
195
208
  }
196
- getHistory() {
197
- return [...this.session.history];
209
+ times.push(timeMs);
210
+ if (times.length > 100) {
211
+ times.shift();
198
212
  }
199
- // ─── Profiling ───────────────────────────────────
200
- enableProfiling(enabled) {
201
- this.session.profiling.enabled = enabled;
202
- if (!enabled) {
203
- this.session.profiling.nodeExecutionTimes.clear();
204
- this.session.profiling.totalFrameTime = 0;
205
- this.session.profiling.frameCount = 0;
206
- }
213
+ }
214
+ getNodeAverageTime(nodeId) {
215
+ const times = this.session.profiling.nodeExecutionTimes.get(nodeId);
216
+ if (!times || times.length === 0) {
217
+ return 0;
207
218
  }
208
- recordNodeTime(nodeId, timeMs) {
209
- if (!this.session.profiling.enabled) {
210
- return;
211
- }
212
- let times = this.session.profiling.nodeExecutionTimes.get(nodeId);
213
- if (!times) {
214
- times = [];
215
- this.session.profiling.nodeExecutionTimes.set(nodeId, times);
216
- }
217
- times.push(timeMs);
218
- // Keep last 100 samples
219
- if (times.length > 100) {
220
- times.shift();
219
+ return times.reduce((a, b) => a + b, 0) / times.length;
220
+ }
221
+ getProfilingData() {
222
+ return { ...this.session.profiling };
223
+ }
224
+ // ─── Expression Evaluation ───────────────────────
225
+ evaluateExpression(expr, context) {
226
+ const parts = expr.split(".");
227
+ let value = void 0;
228
+ if (parts[0] === "entity" && context.entityId) {
229
+ if (parts[1]) {
230
+ const component = context.getComponent(context.entityId, parts[1]);
231
+ if (component && parts[2]) {
232
+ value = this.getNestedValue(component, parts.slice(2));
233
+ } else {
234
+ value = component;
221
235
  }
236
+ }
237
+ } else if (parts[0] === "variables") {
238
+ if (parts[1]) {
239
+ value = context.variables.get(parts[1]);
240
+ }
241
+ } else if (parts[0] === "globals") {
242
+ if (parts[1]) {
243
+ value = context.globals.get(parts[1]);
244
+ }
245
+ } else if (parts[0] === "dt") {
246
+ value = context.dt;
247
+ } else if (parts[0] === "time") {
248
+ value = context.time;
222
249
  }
223
- getNodeAverageTime(nodeId) {
224
- const times = this.session.profiling.nodeExecutionTimes.get(nodeId);
225
- if (!times || times.length === 0) {
226
- return 0;
227
- }
228
- return times.reduce((a, b) => a + b, 0) / times.length;
250
+ return value;
251
+ }
252
+ getNestedValue(obj, path) {
253
+ let current = obj;
254
+ for (const key of path) {
255
+ if (current && typeof current === "object" && key in current) {
256
+ current = current[key];
257
+ } else {
258
+ return void 0;
259
+ }
229
260
  }
230
- getProfilingData() {
231
- return { ...this.session.profiling };
261
+ return current;
262
+ }
263
+ // ─── Event System ────────────────────────────────
264
+ on(event, listener) {
265
+ let listeners = this.eventListeners.get(event);
266
+ if (!listeners) {
267
+ listeners = [];
268
+ this.eventListeners.set(event, listeners);
232
269
  }
233
- // ─── Expression Evaluation ───────────────────────
234
- evaluateExpression(expr, context) {
235
- // Safe expression evaluator (no eval!)
236
- // Parse simple expressions like: entity.transform.position.x
237
- // Or: variables.health > 50
238
- const parts = expr.split('.');
239
- let value = undefined;
240
- if (parts[0] === 'entity' && context.entityId) {
241
- // Entity property access
242
- if (parts[1]) {
243
- const component = context.getComponent(context.entityId, parts[1]);
244
- if (component && parts[2]) {
245
- value = this.getNestedValue(component, parts.slice(2));
246
- }
247
- else {
248
- value = component;
249
- }
250
- }
251
- }
252
- else if (parts[0] === 'variables') {
253
- // Variable access
254
- if (parts[1]) {
255
- value = context.variables.get(parts[1]);
256
- }
257
- }
258
- else if (parts[0] === 'globals') {
259
- if (parts[1]) {
260
- value = context.globals.get(parts[1]);
261
- }
262
- }
263
- else if (parts[0] === 'dt') {
264
- value = context.dt;
265
- }
266
- else if (parts[0] === 'time') {
267
- value = context.time;
268
- }
269
- return value;
270
+ listeners.push(listener);
271
+ }
272
+ off(event, listener) {
273
+ const listeners = this.eventListeners.get(event);
274
+ if (listeners) {
275
+ const idx = listeners.indexOf(listener);
276
+ if (idx >= 0) {
277
+ listeners.splice(idx, 1);
278
+ }
270
279
  }
271
- getNestedValue(obj, path) {
272
- let current = obj;
273
- for (const key of path) {
274
- if (current && typeof current === 'object' && key in current) {
275
- current = current[key];
276
- }
277
- else {
278
- return undefined;
279
- }
280
- }
281
- return current;
280
+ }
281
+ emit(type, data) {
282
+ const event = {
283
+ type,
284
+ timestamp: Date.now(),
285
+ data
286
+ };
287
+ const listeners = this.eventListeners.get(type);
288
+ if (listeners) {
289
+ for (const listener of listeners) {
290
+ listener(event);
291
+ }
282
292
  }
283
- // ─── Event System ────────────────────────────────
284
- on(event, listener) {
285
- let listeners = this.eventListeners.get(event);
286
- if (!listeners) {
287
- listeners = [];
288
- this.eventListeners.set(event, listeners);
293
+ }
294
+ // ─── Node Execution Hook ─────────────────────────
295
+ onNodeStartExecution(nodeId, inputs) {
296
+ for (const bp of this.session.breakpoints.values()) {
297
+ if (bp.nodeId === nodeId && bp.enabled) {
298
+ if (bp.condition) ;
299
+ if (bp.hitCount !== void 0) {
300
+ bp.hitCount--;
301
+ if (bp.hitCount > 0) {
302
+ continue;
303
+ }
289
304
  }
290
- listeners.push(listener);
291
- }
292
- off(event, listener) {
293
- const listeners = this.eventListeners.get(event);
294
- if (listeners) {
295
- const idx = listeners.indexOf(listener);
296
- if (idx >= 0) {
297
- listeners.splice(idx, 1);
298
- }
305
+ if (bp.logMessage) {
306
+ console.log(`[VS Breakpoint] ${bp.logMessage}`);
307
+ continue;
299
308
  }
300
- }
301
- emit(type, data) {
302
- const event = {
303
- type,
304
- timestamp: Date.now(),
305
- data,
306
- };
307
- const listeners = this.eventListeners.get(type);
308
- if (listeners) {
309
- for (const listener of listeners) {
310
- listener(event);
311
- }
309
+ this.session.state = "paused";
310
+ this.session.currentNode = nodeId;
311
+ this.emit("breakpoint-hit", { nodeId, breakpoint: bp });
312
+ if (bp.temporary) {
313
+ this.removeBreakpoint(bp.id);
312
314
  }
315
+ return false;
316
+ }
313
317
  }
314
- // ─── Node Execution Hook ─────────────────────────
315
- onNodeStartExecution(nodeId, inputs) {
316
- // Check breakpoints
317
- for (const bp of this.session.breakpoints.values()) {
318
- if (bp.nodeId === nodeId && bp.enabled) {
319
- // Check condition if set
320
- if (bp.condition) ;
321
- // Check hit count
322
- if (bp.hitCount !== undefined) {
323
- bp.hitCount--;
324
- if (bp.hitCount > 0) {
325
- continue;
326
- }
327
- }
328
- // Log message instead of breaking?
329
- if (bp.logMessage) {
330
- console.log(`[VS Breakpoint] ${bp.logMessage}`);
331
- continue;
332
- }
333
- // Hit breakpoint!
334
- this.session.state = 'paused';
335
- this.session.currentNode = nodeId;
336
- this.emit('breakpoint-hit', { nodeId, breakpoint: bp });
337
- // Remove temporary breakpoint
338
- if (bp.temporary) {
339
- this.removeBreakpoint(bp.id);
340
- }
341
- return false; // Pause execution
342
- }
343
- }
344
- // Record for history
345
- this.recordSnapshot({
346
- timestamp: Date.now(),
347
- nodeId,
348
- inputs,
349
- outputs: {},
350
- variables: new Map(),
351
- });
352
- return true; // Continue execution
318
+ this.recordSnapshot({
319
+ timestamp: Date.now(),
320
+ nodeId,
321
+ inputs,
322
+ outputs: {},
323
+ variables: /* @__PURE__ */ new Map()
324
+ });
325
+ return true;
326
+ }
327
+ onNodeCompleteExecution(nodeId, outputs, timeMs) {
328
+ if (this.session.history.length > 0) {
329
+ const lastSnapshot = this.session.history[this.session.history.length - 1];
330
+ if (lastSnapshot.nodeId === nodeId) {
331
+ lastSnapshot.outputs = outputs;
332
+ }
353
333
  }
354
- onNodeCompleteExecution(nodeId, outputs, timeMs) {
355
- // Update last snapshot with outputs
356
- if (this.session.history.length > 0) {
357
- const lastSnapshot = this.session.history[this.session.history.length - 1];
358
- if (lastSnapshot.nodeId === nodeId) {
359
- lastSnapshot.outputs = outputs;
360
- }
361
- }
362
- // Record profiling
363
- this.recordNodeTime(nodeId, timeMs);
364
- // Emit event
365
- this.emit('node-executed', { nodeId, outputs, timeMs });
366
- // Step mode handling
367
- if (this.session.state === 'stepping') {
368
- this.session.state = 'paused';
369
- this.emit('step-completed', { nodeId });
370
- }
334
+ this.recordNodeTime(nodeId, timeMs);
335
+ this.emit("node-executed", { nodeId, outputs, timeMs });
336
+ if (this.session.state === "stepping") {
337
+ this.session.state = "paused";
338
+ this.emit("step-completed", { nodeId });
371
339
  }
340
+ }
372
341
  }
373
- // ============================================================
374
- // Enhanced Graph Executor with Debugging
375
- // ============================================================
376
342
  class VSGraphExecutor {
377
- constructor(debuggerInstance) {
378
- this.nodeLibrary = new Map();
379
- this.executionQueue = [];
380
- this.debugger = debuggerInstance || new VSDebugger();
343
+ constructor(debuggerInstance) {
344
+ this.nodeLibrary = /* @__PURE__ */ new Map();
345
+ this.executionQueue = [];
346
+ this.debugger = debuggerInstance || new VSDebugger();
347
+ }
348
+ // ─── Node Registration ───────────────────────────
349
+ registerNode(definition) {
350
+ this.nodeLibrary.set(definition.type, definition);
351
+ }
352
+ registerNodes(definitions) {
353
+ for (const def of definitions) {
354
+ this.registerNode(def);
381
355
  }
382
- // ─── Node Registration ───────────────────────────
383
- registerNode(definition) {
384
- this.nodeLibrary.set(definition.type, definition);
356
+ }
357
+ getNodeDefinition(type) {
358
+ return this.nodeLibrary.get(type);
359
+ }
360
+ getAllNodeDefinitions() {
361
+ return Array.from(this.nodeLibrary.values());
362
+ }
363
+ searchNodes(query) {
364
+ const q = query.toLowerCase();
365
+ return this.getAllNodeDefinitions().filter(
366
+ (def) => def.name.toLowerCase().includes(q) || def.type.toLowerCase().includes(q) || def.description.toLowerCase().includes(q) || def.keywords?.some((k) => k.toLowerCase().includes(q))
367
+ );
368
+ }
369
+ // ─── Execution ───────────────────────────────────
370
+ execute(graph, entryType, context) {
371
+ this.debugger.start();
372
+ const entryNodes = graph.nodes.filter((n) => n.type === entryType && !n.disabled);
373
+ for (const entryNode of entryNodes) {
374
+ this.executeNode(graph, entryNode, context);
385
375
  }
386
- registerNodes(definitions) {
387
- for (const def of definitions) {
388
- this.registerNode(def);
389
- }
390
- }
391
- getNodeDefinition(type) {
392
- return this.nodeLibrary.get(type);
376
+ }
377
+ executeNode(graph, node, context) {
378
+ if (node.disabled) {
379
+ return;
393
380
  }
394
- getAllNodeDefinitions() {
395
- return Array.from(this.nodeLibrary.values());
381
+ const definition = this.nodeLibrary.get(node.type);
382
+ if (!definition) {
383
+ context.log("error", `Unknown node type: ${node.type}`);
384
+ return;
396
385
  }
397
- searchNodes(query) {
398
- const q = query.toLowerCase();
399
- return this.getAllNodeDefinitions().filter((def) => def.name.toLowerCase().includes(q) ||
400
- def.type.toLowerCase().includes(q) ||
401
- def.description.toLowerCase().includes(q) ||
402
- def.keywords?.some((k) => k.toLowerCase().includes(q)));
403
- }
404
- // ─── Execution ───────────────────────────────────
405
- execute(graph, entryType, context) {
406
- this.debugger.start();
407
- // Find entry nodes
408
- const entryNodes = graph.nodes.filter((n) => n.type === entryType && !n.disabled);
409
- for (const entryNode of entryNodes) {
410
- this.executeNode(graph, entryNode, context);
386
+ const inputs = { ...node.inputs };
387
+ for (const conn of graph.connections) {
388
+ if (conn.toNode === node.id) {
389
+ const sourceNode = graph.nodes.find((n) => n.id === conn.fromNode);
390
+ if (sourceNode) {
391
+ inputs[conn.toPort] = sourceNode.outputs[conn.fromPort];
411
392
  }
393
+ }
412
394
  }
413
- executeNode(graph, node, context) {
414
- if (node.disabled) {
415
- return;
416
- }
417
- const definition = this.nodeLibrary.get(node.type);
418
- if (!definition) {
419
- context.log('error', `Unknown node type: ${node.type}`);
420
- return;
421
- }
422
- // Gather inputs from connections
423
- const inputs = { ...node.inputs };
424
- for (const conn of graph.connections) {
425
- if (conn.toNode === node.id) {
426
- const sourceNode = graph.nodes.find((n) => n.id === conn.fromNode);
427
- if (sourceNode) {
428
- inputs[conn.toPort] = sourceNode.outputs[conn.fromPort];
429
- }
430
- }
431
- }
432
- // Apply default values for unconnected inputs
433
- for (const port of definition.ports) {
434
- if (port.direction === 'input' && inputs[port.id] === undefined) {
435
- inputs[port.id] = port.defaultValue;
436
- }
437
- }
438
- // Debug hook - before execution
439
- if (!this.debugger.onNodeStartExecution(node.id, inputs)) {
440
- // Debugger paused execution
441
- this.executionQueue.push({ graph, nodeId: node.id, context });
442
- return;
443
- }
444
- // Track flow outputs
445
- const triggeredFlows = [];
446
- const originalTrigger = context.triggerFlow;
447
- context.triggerFlow = (portId) => {
448
- triggeredFlows.push(portId);
449
- };
450
- // Execute node
451
- const startTime = performance.now();
452
- let outputs = {};
453
- try {
454
- const result = definition.execute(inputs, context);
455
- if (result && !(result instanceof Promise)) {
456
- outputs = result;
457
- }
458
- else if (result instanceof Promise) {
459
- // Handle async nodes
460
- result
461
- .then((asyncOutputs) => {
462
- node.outputs = asyncOutputs;
463
- this.followFlowConnections(graph, node, triggeredFlows, context);
464
- })
465
- .catch((err) => {
466
- context.log('error', `Node ${node.id} error: ${err}`);
467
- });
468
- return;
469
- }
470
- }
471
- catch (err) {
472
- context.log('error', `Node ${node.id} error: ${err}`);
473
- }
474
- const executionTime = performance.now() - startTime;
475
- // Store outputs
476
- node.outputs = outputs;
477
- // Restore trigger function
478
- context.triggerFlow = originalTrigger;
479
- // Debug hook - after execution
480
- this.debugger.onNodeCompleteExecution(node.id, outputs, executionTime);
481
- // Follow flow connections
482
- this.followFlowConnections(graph, node, triggeredFlows, context);
395
+ for (const port of definition.ports) {
396
+ if (port.direction === "input" && inputs[port.id] === void 0) {
397
+ inputs[port.id] = port.defaultValue;
398
+ }
483
399
  }
484
- followFlowConnections(graph, node, triggeredFlows, context) {
485
- for (const flowPort of triggeredFlows) {
486
- const flowConnections = graph.connections.filter((c) => c.fromNode === node.id && c.fromPort === flowPort);
487
- for (const conn of flowConnections) {
488
- const nextNode = graph.nodes.find((n) => n.id === conn.toNode);
489
- if (nextNode) {
490
- this.executeNode(graph, nextNode, context);
491
- }
492
- }
493
- }
400
+ if (!this.debugger.onNodeStartExecution(node.id, inputs)) {
401
+ this.executionQueue.push({ graph, nodeId: node.id, context });
402
+ return;
494
403
  }
495
- // ─── Debugging ───────────────────────────────────
496
- getDebugger() {
497
- return this.debugger;
404
+ const triggeredFlows = [];
405
+ const originalTrigger = context.triggerFlow;
406
+ context.triggerFlow = (portId) => {
407
+ triggeredFlows.push(portId);
408
+ };
409
+ const startTime = performance.now();
410
+ let outputs = {};
411
+ try {
412
+ const result = definition.execute(inputs, context);
413
+ if (result && !(result instanceof Promise)) {
414
+ outputs = result;
415
+ } else if (result instanceof Promise) {
416
+ result.then((asyncOutputs) => {
417
+ node.outputs = asyncOutputs;
418
+ this.followFlowConnections(graph, node, triggeredFlows, context);
419
+ }).catch((err) => {
420
+ context.log("error", `Node ${node.id} error: ${err}`);
421
+ });
422
+ return;
423
+ }
424
+ } catch (err) {
425
+ context.log("error", `Node ${node.id} error: ${err}`);
498
426
  }
499
- resumeExecution() {
500
- this.debugger.resume();
501
- // Process queued executions
502
- while (this.executionQueue.length > 0 && this.debugger.getState() === 'running') {
503
- const queued = this.executionQueue.shift();
504
- const node = queued.graph.nodes.find((n) => n.id === queued.nodeId);
505
- if (node) {
506
- this.executeNode(queued.graph, node, queued.context);
507
- }
427
+ const executionTime = performance.now() - startTime;
428
+ node.outputs = outputs;
429
+ context.triggerFlow = originalTrigger;
430
+ this.debugger.onNodeCompleteExecution(node.id, outputs, executionTime);
431
+ this.followFlowConnections(graph, node, triggeredFlows, context);
432
+ }
433
+ followFlowConnections(graph, node, triggeredFlows, context) {
434
+ for (const flowPort of triggeredFlows) {
435
+ const flowConnections = graph.connections.filter(
436
+ (c) => c.fromNode === node.id && c.fromPort === flowPort
437
+ );
438
+ for (const conn of flowConnections) {
439
+ const nextNode = graph.nodes.find((n) => n.id === conn.toNode);
440
+ if (nextNode) {
441
+ this.executeNode(graph, nextNode, context);
508
442
  }
443
+ }
509
444
  }
445
+ }
446
+ // ─── Debugging ───────────────────────────────────
447
+ getDebugger() {
448
+ return this.debugger;
449
+ }
450
+ resumeExecution() {
451
+ this.debugger.resume();
452
+ while (this.executionQueue.length > 0 && this.debugger.getState() === "running") {
453
+ const queued = this.executionQueue.shift();
454
+ const node = queued.graph.nodes.find((n) => n.id === queued.nodeId);
455
+ if (node) {
456
+ this.executeNode(queued.graph, node, queued.context);
457
+ }
458
+ }
459
+ }
510
460
  }
511
- // ============================================================
512
- // Built-in Node Definitions
513
- // ============================================================
514
461
  function createBuiltInNodes() {
515
- return [
516
- // ─── Events ────────────────────────────────────
517
- {
518
- type: 'event_start',
519
- name: 'On Start',
520
- category: 'event',
521
- description: 'Fires once when the scene starts',
522
- icon: 'play',
523
- color: '#dc2626',
524
- ports: [{ id: 'exec', name: '', direction: 'output', type: 'flow' }],
525
- execute: (_inputs, ctx) => {
526
- ctx.triggerFlow('exec');
527
- },
528
- },
529
- {
530
- type: 'event_update',
531
- name: 'On Update',
532
- category: 'event',
533
- description: 'Fires every frame',
534
- icon: 'refresh',
535
- color: '#dc2626',
536
- ports: [
537
- { id: 'exec', name: '', direction: 'output', type: 'flow' },
538
- { id: 'delta', name: 'Delta Time', direction: 'output', type: 'float' },
539
- ],
540
- execute: (_inputs, ctx) => {
541
- ctx.triggerFlow('exec');
542
- return { delta: ctx.dt };
543
- },
544
- },
545
- {
546
- type: 'event_input',
547
- name: 'On Input',
548
- category: 'event',
549
- description: 'Fires when input action is triggered',
550
- icon: 'keyboard',
551
- color: '#dc2626',
552
- ports: [
553
- { id: 'action', name: 'Action', direction: 'input', type: 'string' },
554
- { id: 'pressed', name: 'Pressed', direction: 'output', type: 'flow' },
555
- { id: 'released', name: 'Released', direction: 'output', type: 'flow' },
556
- { id: 'held', name: 'Held', direction: 'output', type: 'flow' },
557
- ],
558
- execute: () => { },
559
- },
560
- // ─── Flow Control ──────────────────────────────
561
- {
562
- type: 'branch',
563
- name: 'Branch',
564
- category: 'flow',
565
- description: 'Branch execution based on condition',
566
- icon: 'git-branch',
567
- color: '#f97316',
568
- ports: [
569
- { id: 'exec', name: '', direction: 'input', type: 'flow' },
570
- {
571
- id: 'condition',
572
- name: 'Condition',
573
- direction: 'input',
574
- type: 'bool',
575
- defaultValue: false,
576
- },
577
- { id: 'true', name: 'True', direction: 'output', type: 'flow' },
578
- { id: 'false', name: 'False', direction: 'output', type: 'flow' },
579
- ],
580
- execute: (inputs, ctx) => {
581
- ctx.triggerFlow(inputs.condition ? 'true' : 'false');
582
- },
583
- },
584
- {
585
- type: 'sequence',
586
- name: 'Sequence',
587
- category: 'flow',
588
- description: 'Execute outputs in sequence',
589
- icon: 'list',
590
- color: '#f97316',
591
- ports: [
592
- { id: 'exec', name: '', direction: 'input', type: 'flow' },
593
- { id: 'then_0', name: 'Then 0', direction: 'output', type: 'flow' },
594
- { id: 'then_1', name: 'Then 1', direction: 'output', type: 'flow' },
595
- { id: 'then_2', name: 'Then 2', direction: 'output', type: 'flow' },
596
- ],
597
- execute: (_inputs, ctx) => {
598
- ctx.triggerFlow('then_0');
599
- ctx.triggerFlow('then_1');
600
- ctx.triggerFlow('then_2');
601
- },
602
- },
603
- {
604
- type: 'for_loop',
605
- name: 'For Loop',
606
- category: 'flow',
607
- description: 'Loop from start to end',
608
- icon: 'repeat',
609
- color: '#f97316',
610
- latent: true,
611
- ports: [
612
- { id: 'exec', name: '', direction: 'input', type: 'flow' },
613
- { id: 'start', name: 'Start', direction: 'input', type: 'int', defaultValue: 0 },
614
- { id: 'end', name: 'End', direction: 'input', type: 'int', defaultValue: 10 },
615
- { id: 'body', name: 'Loop Body', direction: 'output', type: 'flow' },
616
- { id: 'index', name: 'Index', direction: 'output', type: 'int' },
617
- { id: 'completed', name: 'Completed', direction: 'output', type: 'flow' },
618
- ],
619
- execute: (inputs, ctx) => {
620
- const start = inputs.start;
621
- const end = inputs.end;
622
- for (let i = start; i < end; i++) {
623
- ctx.triggerFlow('body');
624
- }
625
- ctx.triggerFlow('completed');
626
- return { index: end - 1 };
627
- },
628
- },
629
- {
630
- type: 'while_loop',
631
- name: 'While Loop',
632
- category: 'flow',
633
- description: 'Loop while condition is true',
634
- icon: 'repeat',
635
- color: '#f97316',
636
- latent: true,
637
- ports: [
638
- { id: 'exec', name: '', direction: 'input', type: 'flow' },
639
- { id: 'condition', name: 'Condition', direction: 'input', type: 'bool' },
640
- { id: 'body', name: 'Loop Body', direction: 'output', type: 'flow' },
641
- { id: 'completed', name: 'Completed', direction: 'output', type: 'flow' },
642
- ],
643
- execute: (inputs, ctx) => {
644
- let iterations = 0;
645
- const MAX_ITERATIONS = 10000;
646
- while (inputs.condition && iterations < MAX_ITERATIONS) {
647
- ctx.triggerFlow('body');
648
- iterations++;
649
- }
650
- ctx.triggerFlow('completed');
651
- },
652
- },
653
- // ─── Math Operations ───────────────────────────
654
- {
655
- type: 'math_add',
656
- name: 'Add',
657
- category: 'math',
658
- description: 'Add two numbers',
659
- icon: 'plus',
660
- color: '#22c55e',
661
- pure: true,
662
- compact: true,
663
- ports: [
664
- { id: 'a', name: 'A', direction: 'input', type: 'float', defaultValue: 0 },
665
- { id: 'b', name: 'B', direction: 'input', type: 'float', defaultValue: 0 },
666
- { id: 'result', name: 'Result', direction: 'output', type: 'float' },
667
- ],
668
- execute: (inputs) => ({ result: inputs.a + inputs.b }),
669
- },
670
- {
671
- type: 'math_subtract',
672
- name: 'Subtract',
673
- category: 'math',
674
- description: 'Subtract two numbers',
675
- icon: 'minus',
676
- color: '#22c55e',
677
- pure: true,
678
- compact: true,
679
- ports: [
680
- { id: 'a', name: 'A', direction: 'input', type: 'float', defaultValue: 0 },
681
- { id: 'b', name: 'B', direction: 'input', type: 'float', defaultValue: 0 },
682
- { id: 'result', name: 'Result', direction: 'output', type: 'float' },
683
- ],
684
- execute: (inputs) => ({ result: inputs.a - inputs.b }),
685
- },
686
- {
687
- type: 'math_multiply',
688
- name: 'Multiply',
689
- category: 'math',
690
- description: 'Multiply two numbers',
691
- icon: 'x',
692
- color: '#22c55e',
693
- pure: true,
694
- compact: true,
695
- ports: [
696
- { id: 'a', name: 'A', direction: 'input', type: 'float', defaultValue: 1 },
697
- { id: 'b', name: 'B', direction: 'input', type: 'float', defaultValue: 1 },
698
- { id: 'result', name: 'Result', direction: 'output', type: 'float' },
699
- ],
700
- execute: (inputs) => ({ result: inputs.a * inputs.b }),
701
- },
702
- {
703
- type: 'math_divide',
704
- name: 'Divide',
705
- category: 'math',
706
- description: 'Divide two numbers',
707
- icon: 'divide',
708
- color: '#22c55e',
709
- pure: true,
710
- compact: true,
711
- ports: [
712
- { id: 'a', name: 'A', direction: 'input', type: 'float', defaultValue: 1 },
713
- { id: 'b', name: 'B', direction: 'input', type: 'float', defaultValue: 1 },
714
- { id: 'result', name: 'Result', direction: 'output', type: 'float' },
715
- ],
716
- execute: (inputs) => ({
717
- result: inputs.b !== 0 ? inputs.a / inputs.b : 0,
718
- }),
719
- },
720
- {
721
- type: 'math_clamp',
722
- name: 'Clamp',
723
- category: 'math',
724
- description: 'Clamp value between min and max',
725
- icon: 'sliders',
726
- color: '#22c55e',
727
- pure: true,
728
- ports: [
729
- { id: 'value', name: 'Value', direction: 'input', type: 'float', defaultValue: 0 },
730
- { id: 'min', name: 'Min', direction: 'input', type: 'float', defaultValue: 0 },
731
- { id: 'max', name: 'Max', direction: 'input', type: 'float', defaultValue: 1 },
732
- { id: 'result', name: 'Result', direction: 'output', type: 'float' },
733
- ],
734
- execute: (inputs) => ({
735
- result: Math.min(Math.max(inputs.value, inputs.min), inputs.max),
736
- }),
737
- },
738
- {
739
- type: 'math_lerp',
740
- name: 'Lerp',
741
- category: 'math',
742
- description: 'Linear interpolation between two values',
743
- icon: 'trending-up',
744
- color: '#22c55e',
745
- pure: true,
746
- ports: [
747
- { id: 'a', name: 'A', direction: 'input', type: 'float', defaultValue: 0 },
748
- { id: 'b', name: 'B', direction: 'input', type: 'float', defaultValue: 1 },
749
- { id: 't', name: 'Alpha', direction: 'input', type: 'float', defaultValue: 0.5 },
750
- { id: 'result', name: 'Result', direction: 'output', type: 'float' },
751
- ],
752
- execute: (inputs) => ({
753
- result: inputs.a +
754
- (inputs.b - inputs.a) * inputs.t,
755
- }),
756
- },
462
+ return [
463
+ // ─── Events ────────────────────────────────────
464
+ {
465
+ type: "event_start",
466
+ name: "On Start",
467
+ category: "event",
468
+ description: "Fires once when the scene starts",
469
+ icon: "play",
470
+ color: "#dc2626",
471
+ ports: [{ id: "exec", name: "", direction: "output", type: "flow" }],
472
+ execute: (_inputs, ctx) => {
473
+ ctx.triggerFlow("exec");
474
+ }
475
+ },
476
+ {
477
+ type: "event_update",
478
+ name: "On Update",
479
+ category: "event",
480
+ description: "Fires every frame",
481
+ icon: "refresh",
482
+ color: "#dc2626",
483
+ ports: [
484
+ { id: "exec", name: "", direction: "output", type: "flow" },
485
+ { id: "delta", name: "Delta Time", direction: "output", type: "float" }
486
+ ],
487
+ execute: (_inputs, ctx) => {
488
+ ctx.triggerFlow("exec");
489
+ return { delta: ctx.dt };
490
+ }
491
+ },
492
+ {
493
+ type: "event_input",
494
+ name: "On Input",
495
+ category: "event",
496
+ description: "Fires when input action is triggered",
497
+ icon: "keyboard",
498
+ color: "#dc2626",
499
+ ports: [
500
+ { id: "action", name: "Action", direction: "input", type: "string" },
501
+ { id: "pressed", name: "Pressed", direction: "output", type: "flow" },
502
+ { id: "released", name: "Released", direction: "output", type: "flow" },
503
+ { id: "held", name: "Held", direction: "output", type: "flow" }
504
+ ],
505
+ execute: () => {
506
+ }
507
+ },
508
+ // ─── Flow Control ──────────────────────────────
509
+ {
510
+ type: "branch",
511
+ name: "Branch",
512
+ category: "flow",
513
+ description: "Branch execution based on condition",
514
+ icon: "git-branch",
515
+ color: "#f97316",
516
+ ports: [
517
+ { id: "exec", name: "", direction: "input", type: "flow" },
757
518
  {
758
- type: 'math_random',
759
- name: 'Random',
760
- category: 'math',
761
- description: 'Generate random number',
762
- icon: 'shuffle',
763
- color: '#22c55e',
764
- pure: true,
765
- ports: [
766
- { id: 'min', name: 'Min', direction: 'input', type: 'float', defaultValue: 0 },
767
- { id: 'max', name: 'Max', direction: 'input', type: 'float', defaultValue: 1 },
768
- { id: 'result', name: 'Result', direction: 'output', type: 'float' },
769
- ],
770
- execute: (inputs) => ({
771
- result: inputs.min +
772
- Math.random() * (inputs.max - inputs.min),
773
- }),
774
- },
775
- // ─── Logic Operations ──────────────────────────
776
- {
777
- type: 'logic_and',
778
- name: 'AND',
779
- category: 'logic',
780
- description: 'Logical AND',
781
- icon: 'check-square',
782
- color: '#ef4444',
783
- pure: true,
784
- compact: true,
785
- ports: [
786
- { id: 'a', name: 'A', direction: 'input', type: 'bool', defaultValue: false },
787
- { id: 'b', name: 'B', direction: 'input', type: 'bool', defaultValue: false },
788
- { id: 'result', name: 'Result', direction: 'output', type: 'bool' },
789
- ],
790
- execute: (inputs) => ({ result: inputs.a && inputs.b }),
791
- },
792
- {
793
- type: 'logic_or',
794
- name: 'OR',
795
- category: 'logic',
796
- description: 'Logical OR',
797
- icon: 'box',
798
- color: '#ef4444',
799
- pure: true,
800
- compact: true,
801
- ports: [
802
- { id: 'a', name: 'A', direction: 'input', type: 'bool', defaultValue: false },
803
- { id: 'b', name: 'B', direction: 'input', type: 'bool', defaultValue: false },
804
- { id: 'result', name: 'Result', direction: 'output', type: 'bool' },
805
- ],
806
- execute: (inputs) => ({ result: inputs.a || inputs.b }),
807
- },
808
- {
809
- type: 'logic_not',
810
- name: 'NOT',
811
- category: 'logic',
812
- description: 'Logical NOT',
813
- icon: 'x-circle',
814
- color: '#ef4444',
815
- pure: true,
816
- compact: true,
817
- ports: [
818
- { id: 'value', name: 'Value', direction: 'input', type: 'bool', defaultValue: false },
819
- { id: 'result', name: 'Result', direction: 'output', type: 'bool' },
820
- ],
821
- execute: (inputs) => ({ result: !inputs.value }),
822
- },
823
- {
824
- type: 'compare_equal',
825
- name: 'Equal',
826
- category: 'logic',
827
- description: 'Check if two values are equal',
828
- icon: 'equal',
829
- color: '#ef4444',
830
- pure: true,
831
- compact: true,
832
- ports: [
833
- { id: 'a', name: 'A', direction: 'input', type: 'wildcard' },
834
- { id: 'b', name: 'B', direction: 'input', type: 'wildcard' },
835
- { id: 'result', name: 'Result', direction: 'output', type: 'bool' },
836
- ],
837
- execute: (inputs) => ({ result: inputs.a === inputs.b }),
838
- },
839
- {
840
- type: 'compare_greater',
841
- name: 'Greater Than',
842
- category: 'logic',
843
- description: 'Check if A > B',
844
- icon: 'chevron-right',
845
- color: '#ef4444',
846
- pure: true,
847
- compact: true,
848
- ports: [
849
- { id: 'a', name: 'A', direction: 'input', type: 'float', defaultValue: 0 },
850
- { id: 'b', name: 'B', direction: 'input', type: 'float', defaultValue: 0 },
851
- { id: 'result', name: 'Result', direction: 'output', type: 'bool' },
852
- ],
853
- execute: (inputs) => ({ result: inputs.a > inputs.b }),
854
- },
855
- {
856
- type: 'compare_less',
857
- name: 'Less Than',
858
- category: 'logic',
859
- description: 'Check if A < B',
860
- icon: 'chevron-left',
861
- color: '#ef4444',
862
- pure: true,
863
- compact: true,
864
- ports: [
865
- { id: 'a', name: 'A', direction: 'input', type: 'float', defaultValue: 0 },
866
- { id: 'b', name: 'B', direction: 'input', type: 'float', defaultValue: 0 },
867
- { id: 'result', name: 'Result', direction: 'output', type: 'bool' },
868
- ],
869
- execute: (inputs) => ({ result: inputs.a < inputs.b }),
870
- },
871
- // ─── Entity Operations ─────────────────────────
872
- {
873
- type: 'get_self',
874
- name: 'Get Self',
875
- category: 'entity',
876
- description: 'Get reference to the owning entity',
877
- icon: 'user',
878
- color: '#3b82f6',
879
- pure: true,
880
- ports: [{ id: 'entity', name: 'Entity', direction: 'output', type: 'entity' }],
881
- execute: (_inputs, ctx) => ({ entity: ctx.entityId }),
882
- },
883
- {
884
- type: 'spawn_entity',
885
- name: 'Spawn Entity',
886
- category: 'entity',
887
- description: 'Spawn a new entity from prefab',
888
- icon: 'plus-circle',
889
- color: '#3b82f6',
890
- ports: [
891
- { id: 'exec', name: '', direction: 'input', type: 'flow' },
892
- { id: 'prefab', name: 'Prefab', direction: 'input', type: 'asset' },
893
- {
894
- id: 'position',
895
- name: 'Position',
896
- direction: 'input',
897
- type: 'vec2',
898
- defaultValue: { x: 0, y: 0 },
899
- },
900
- { id: 'then', name: '', direction: 'output', type: 'flow' },
901
- { id: 'spawned', name: 'Spawned', direction: 'output', type: 'entity' },
902
- ],
903
- execute: (inputs, ctx) => {
904
- const entity = ctx.spawnEntity(inputs.prefab, inputs.position);
905
- ctx.triggerFlow('then');
906
- return { spawned: entity };
907
- },
908
- },
909
- {
910
- type: 'destroy_entity',
911
- name: 'Destroy Entity',
912
- category: 'entity',
913
- description: 'Destroy an entity',
914
- icon: 'trash',
915
- color: '#3b82f6',
916
- ports: [
917
- { id: 'exec', name: '', direction: 'input', type: 'flow' },
918
- { id: 'entity', name: 'Entity', direction: 'input', type: 'entity' },
919
- { id: 'then', name: '', direction: 'output', type: 'flow' },
920
- ],
921
- execute: (inputs, ctx) => {
922
- ctx.destroyEntity(inputs.entity);
923
- ctx.triggerFlow('then');
924
- },
925
- },
926
- // ─── Transform Operations ──────────────────────
927
- {
928
- type: 'get_position',
929
- name: 'Get Position',
930
- category: 'transform',
931
- description: 'Get entity position',
932
- icon: 'map-pin',
933
- color: '#fbbf24',
934
- pure: true,
935
- ports: [
936
- { id: 'entity', name: 'Entity', direction: 'input', type: 'entity' },
937
- { id: 'position', name: 'Position', direction: 'output', type: 'vec2' },
938
- ],
939
- execute: (inputs, ctx) => {
940
- const transform = ctx.getComponent(inputs.entity, 'Transform');
941
- return { position: transform?.position || { x: 0, y: 0 } };
942
- },
943
- },
944
- {
945
- type: 'set_position',
946
- name: 'Set Position',
947
- category: 'transform',
948
- description: 'Set entity position',
949
- icon: 'move',
950
- color: '#fbbf24',
951
- ports: [
952
- { id: 'exec', name: '', direction: 'input', type: 'flow' },
953
- { id: 'entity', name: 'Entity', direction: 'input', type: 'entity' },
954
- {
955
- id: 'position',
956
- name: 'Position',
957
- direction: 'input',
958
- type: 'vec2',
959
- defaultValue: { x: 0, y: 0 },
960
- },
961
- { id: 'then', name: '', direction: 'output', type: 'flow' },
962
- ],
963
- execute: (inputs, ctx) => {
964
- ctx.setComponent(inputs.entity, 'Transform', { position: inputs.position });
965
- ctx.triggerFlow('then');
966
- },
519
+ id: "condition",
520
+ name: "Condition",
521
+ direction: "input",
522
+ type: "bool",
523
+ defaultValue: false
967
524
  },
525
+ { id: "true", name: "True", direction: "output", type: "flow" },
526
+ { id: "false", name: "False", direction: "output", type: "flow" }
527
+ ],
528
+ execute: (inputs, ctx) => {
529
+ ctx.triggerFlow(inputs.condition ? "true" : "false");
530
+ }
531
+ },
532
+ {
533
+ type: "sequence",
534
+ name: "Sequence",
535
+ category: "flow",
536
+ description: "Execute outputs in sequence",
537
+ icon: "list",
538
+ color: "#f97316",
539
+ ports: [
540
+ { id: "exec", name: "", direction: "input", type: "flow" },
541
+ { id: "then_0", name: "Then 0", direction: "output", type: "flow" },
542
+ { id: "then_1", name: "Then 1", direction: "output", type: "flow" },
543
+ { id: "then_2", name: "Then 2", direction: "output", type: "flow" }
544
+ ],
545
+ execute: (_inputs, ctx) => {
546
+ ctx.triggerFlow("then_0");
547
+ ctx.triggerFlow("then_1");
548
+ ctx.triggerFlow("then_2");
549
+ }
550
+ },
551
+ {
552
+ type: "for_loop",
553
+ name: "For Loop",
554
+ category: "flow",
555
+ description: "Loop from start to end",
556
+ icon: "repeat",
557
+ color: "#f97316",
558
+ latent: true,
559
+ ports: [
560
+ { id: "exec", name: "", direction: "input", type: "flow" },
561
+ { id: "start", name: "Start", direction: "input", type: "int", defaultValue: 0 },
562
+ { id: "end", name: "End", direction: "input", type: "int", defaultValue: 10 },
563
+ { id: "body", name: "Loop Body", direction: "output", type: "flow" },
564
+ { id: "index", name: "Index", direction: "output", type: "int" },
565
+ { id: "completed", name: "Completed", direction: "output", type: "flow" }
566
+ ],
567
+ execute: (inputs, ctx) => {
568
+ const start = inputs.start;
569
+ const end = inputs.end;
570
+ for (let i = start; i < end; i++) {
571
+ ctx.triggerFlow("body");
572
+ }
573
+ ctx.triggerFlow("completed");
574
+ return { index: end - 1 };
575
+ }
576
+ },
577
+ {
578
+ type: "while_loop",
579
+ name: "While Loop",
580
+ category: "flow",
581
+ description: "Loop while condition is true",
582
+ icon: "repeat",
583
+ color: "#f97316",
584
+ latent: true,
585
+ ports: [
586
+ { id: "exec", name: "", direction: "input", type: "flow" },
587
+ { id: "condition", name: "Condition", direction: "input", type: "bool" },
588
+ { id: "body", name: "Loop Body", direction: "output", type: "flow" },
589
+ { id: "completed", name: "Completed", direction: "output", type: "flow" }
590
+ ],
591
+ execute: (inputs, ctx) => {
592
+ let iterations = 0;
593
+ const MAX_ITERATIONS = 1e4;
594
+ while (inputs.condition && iterations < MAX_ITERATIONS) {
595
+ ctx.triggerFlow("body");
596
+ iterations++;
597
+ }
598
+ ctx.triggerFlow("completed");
599
+ }
600
+ },
601
+ // ─── Math Operations ───────────────────────────
602
+ {
603
+ type: "math_add",
604
+ name: "Add",
605
+ category: "math",
606
+ description: "Add two numbers",
607
+ icon: "plus",
608
+ color: "#22c55e",
609
+ pure: true,
610
+ compact: true,
611
+ ports: [
612
+ { id: "a", name: "A", direction: "input", type: "float", defaultValue: 0 },
613
+ { id: "b", name: "B", direction: "input", type: "float", defaultValue: 0 },
614
+ { id: "result", name: "Result", direction: "output", type: "float" }
615
+ ],
616
+ execute: (inputs) => ({ result: inputs.a + inputs.b })
617
+ },
618
+ {
619
+ type: "math_subtract",
620
+ name: "Subtract",
621
+ category: "math",
622
+ description: "Subtract two numbers",
623
+ icon: "minus",
624
+ color: "#22c55e",
625
+ pure: true,
626
+ compact: true,
627
+ ports: [
628
+ { id: "a", name: "A", direction: "input", type: "float", defaultValue: 0 },
629
+ { id: "b", name: "B", direction: "input", type: "float", defaultValue: 0 },
630
+ { id: "result", name: "Result", direction: "output", type: "float" }
631
+ ],
632
+ execute: (inputs) => ({ result: inputs.a - inputs.b })
633
+ },
634
+ {
635
+ type: "math_multiply",
636
+ name: "Multiply",
637
+ category: "math",
638
+ description: "Multiply two numbers",
639
+ icon: "x",
640
+ color: "#22c55e",
641
+ pure: true,
642
+ compact: true,
643
+ ports: [
644
+ { id: "a", name: "A", direction: "input", type: "float", defaultValue: 1 },
645
+ { id: "b", name: "B", direction: "input", type: "float", defaultValue: 1 },
646
+ { id: "result", name: "Result", direction: "output", type: "float" }
647
+ ],
648
+ execute: (inputs) => ({ result: inputs.a * inputs.b })
649
+ },
650
+ {
651
+ type: "math_divide",
652
+ name: "Divide",
653
+ category: "math",
654
+ description: "Divide two numbers",
655
+ icon: "divide",
656
+ color: "#22c55e",
657
+ pure: true,
658
+ compact: true,
659
+ ports: [
660
+ { id: "a", name: "A", direction: "input", type: "float", defaultValue: 1 },
661
+ { id: "b", name: "B", direction: "input", type: "float", defaultValue: 1 },
662
+ { id: "result", name: "Result", direction: "output", type: "float" }
663
+ ],
664
+ execute: (inputs) => ({
665
+ result: inputs.b !== 0 ? inputs.a / inputs.b : 0
666
+ })
667
+ },
668
+ {
669
+ type: "math_clamp",
670
+ name: "Clamp",
671
+ category: "math",
672
+ description: "Clamp value between min and max",
673
+ icon: "sliders",
674
+ color: "#22c55e",
675
+ pure: true,
676
+ ports: [
677
+ { id: "value", name: "Value", direction: "input", type: "float", defaultValue: 0 },
678
+ { id: "min", name: "Min", direction: "input", type: "float", defaultValue: 0 },
679
+ { id: "max", name: "Max", direction: "input", type: "float", defaultValue: 1 },
680
+ { id: "result", name: "Result", direction: "output", type: "float" }
681
+ ],
682
+ execute: (inputs) => ({
683
+ result: Math.min(
684
+ Math.max(inputs.value, inputs.min),
685
+ inputs.max
686
+ )
687
+ })
688
+ },
689
+ {
690
+ type: "math_lerp",
691
+ name: "Lerp",
692
+ category: "math",
693
+ description: "Linear interpolation between two values",
694
+ icon: "trending-up",
695
+ color: "#22c55e",
696
+ pure: true,
697
+ ports: [
698
+ { id: "a", name: "A", direction: "input", type: "float", defaultValue: 0 },
699
+ { id: "b", name: "B", direction: "input", type: "float", defaultValue: 1 },
700
+ { id: "t", name: "Alpha", direction: "input", type: "float", defaultValue: 0.5 },
701
+ { id: "result", name: "Result", direction: "output", type: "float" }
702
+ ],
703
+ execute: (inputs) => ({
704
+ result: inputs.a + (inputs.b - inputs.a) * inputs.t
705
+ })
706
+ },
707
+ {
708
+ type: "math_random",
709
+ name: "Random",
710
+ category: "math",
711
+ description: "Generate random number",
712
+ icon: "shuffle",
713
+ color: "#22c55e",
714
+ pure: true,
715
+ ports: [
716
+ { id: "min", name: "Min", direction: "input", type: "float", defaultValue: 0 },
717
+ { id: "max", name: "Max", direction: "input", type: "float", defaultValue: 1 },
718
+ { id: "result", name: "Result", direction: "output", type: "float" }
719
+ ],
720
+ execute: (inputs) => ({
721
+ result: inputs.min + Math.random() * (inputs.max - inputs.min)
722
+ })
723
+ },
724
+ // ─── Logic Operations ──────────────────────────
725
+ {
726
+ type: "logic_and",
727
+ name: "AND",
728
+ category: "logic",
729
+ description: "Logical AND",
730
+ icon: "check-square",
731
+ color: "#ef4444",
732
+ pure: true,
733
+ compact: true,
734
+ ports: [
735
+ { id: "a", name: "A", direction: "input", type: "bool", defaultValue: false },
736
+ { id: "b", name: "B", direction: "input", type: "bool", defaultValue: false },
737
+ { id: "result", name: "Result", direction: "output", type: "bool" }
738
+ ],
739
+ execute: (inputs) => ({ result: inputs.a && inputs.b })
740
+ },
741
+ {
742
+ type: "logic_or",
743
+ name: "OR",
744
+ category: "logic",
745
+ description: "Logical OR",
746
+ icon: "box",
747
+ color: "#ef4444",
748
+ pure: true,
749
+ compact: true,
750
+ ports: [
751
+ { id: "a", name: "A", direction: "input", type: "bool", defaultValue: false },
752
+ { id: "b", name: "B", direction: "input", type: "bool", defaultValue: false },
753
+ { id: "result", name: "Result", direction: "output", type: "bool" }
754
+ ],
755
+ execute: (inputs) => ({ result: inputs.a || inputs.b })
756
+ },
757
+ {
758
+ type: "logic_not",
759
+ name: "NOT",
760
+ category: "logic",
761
+ description: "Logical NOT",
762
+ icon: "x-circle",
763
+ color: "#ef4444",
764
+ pure: true,
765
+ compact: true,
766
+ ports: [
767
+ { id: "value", name: "Value", direction: "input", type: "bool", defaultValue: false },
768
+ { id: "result", name: "Result", direction: "output", type: "bool" }
769
+ ],
770
+ execute: (inputs) => ({ result: !inputs.value })
771
+ },
772
+ {
773
+ type: "compare_equal",
774
+ name: "Equal",
775
+ category: "logic",
776
+ description: "Check if two values are equal",
777
+ icon: "equal",
778
+ color: "#ef4444",
779
+ pure: true,
780
+ compact: true,
781
+ ports: [
782
+ { id: "a", name: "A", direction: "input", type: "wildcard" },
783
+ { id: "b", name: "B", direction: "input", type: "wildcard" },
784
+ { id: "result", name: "Result", direction: "output", type: "bool" }
785
+ ],
786
+ execute: (inputs) => ({ result: inputs.a === inputs.b })
787
+ },
788
+ {
789
+ type: "compare_greater",
790
+ name: "Greater Than",
791
+ category: "logic",
792
+ description: "Check if A > B",
793
+ icon: "chevron-right",
794
+ color: "#ef4444",
795
+ pure: true,
796
+ compact: true,
797
+ ports: [
798
+ { id: "a", name: "A", direction: "input", type: "float", defaultValue: 0 },
799
+ { id: "b", name: "B", direction: "input", type: "float", defaultValue: 0 },
800
+ { id: "result", name: "Result", direction: "output", type: "bool" }
801
+ ],
802
+ execute: (inputs) => ({ result: inputs.a > inputs.b })
803
+ },
804
+ {
805
+ type: "compare_less",
806
+ name: "Less Than",
807
+ category: "logic",
808
+ description: "Check if A < B",
809
+ icon: "chevron-left",
810
+ color: "#ef4444",
811
+ pure: true,
812
+ compact: true,
813
+ ports: [
814
+ { id: "a", name: "A", direction: "input", type: "float", defaultValue: 0 },
815
+ { id: "b", name: "B", direction: "input", type: "float", defaultValue: 0 },
816
+ { id: "result", name: "Result", direction: "output", type: "bool" }
817
+ ],
818
+ execute: (inputs) => ({ result: inputs.a < inputs.b })
819
+ },
820
+ // ─── Entity Operations ─────────────────────────
821
+ {
822
+ type: "get_self",
823
+ name: "Get Self",
824
+ category: "entity",
825
+ description: "Get reference to the owning entity",
826
+ icon: "user",
827
+ color: "#3b82f6",
828
+ pure: true,
829
+ ports: [{ id: "entity", name: "Entity", direction: "output", type: "entity" }],
830
+ execute: (_inputs, ctx) => ({ entity: ctx.entityId })
831
+ },
832
+ {
833
+ type: "spawn_entity",
834
+ name: "Spawn Entity",
835
+ category: "entity",
836
+ description: "Spawn a new entity from prefab",
837
+ icon: "plus-circle",
838
+ color: "#3b82f6",
839
+ ports: [
840
+ { id: "exec", name: "", direction: "input", type: "flow" },
841
+ { id: "prefab", name: "Prefab", direction: "input", type: "asset" },
968
842
  {
969
- type: 'translate',
970
- name: 'Translate',
971
- category: 'transform',
972
- description: 'Move entity by offset',
973
- icon: 'arrows-move',
974
- color: '#fbbf24',
975
- ports: [
976
- { id: 'exec', name: '', direction: 'input', type: 'flow' },
977
- { id: 'entity', name: 'Entity', direction: 'input', type: 'entity' },
978
- {
979
- id: 'offset',
980
- name: 'Offset',
981
- direction: 'input',
982
- type: 'vec2',
983
- defaultValue: { x: 0, y: 0 },
984
- },
985
- { id: 'then', name: '', direction: 'output', type: 'flow' },
986
- ],
987
- execute: (inputs, ctx) => {
988
- const transform = ctx.getComponent(inputs.entity, 'Transform');
989
- if (transform) {
990
- const offset = inputs.offset;
991
- ctx.setComponent(inputs.entity, 'Transform', {
992
- position: {
993
- x: transform.position.x + offset.x,
994
- y: transform.position.y + offset.y,
995
- },
996
- });
997
- }
998
- ctx.triggerFlow('then');
999
- },
843
+ id: "position",
844
+ name: "Position",
845
+ direction: "input",
846
+ type: "vec2",
847
+ defaultValue: { x: 0, y: 0 }
1000
848
  },
1001
- // ─── Debug Operations ──────────────────────────
849
+ { id: "then", name: "", direction: "output", type: "flow" },
850
+ { id: "spawned", name: "Spawned", direction: "output", type: "entity" }
851
+ ],
852
+ execute: (inputs, ctx) => {
853
+ const entity = ctx.spawnEntity(inputs.prefab, inputs.position);
854
+ ctx.triggerFlow("then");
855
+ return { spawned: entity };
856
+ }
857
+ },
858
+ {
859
+ type: "destroy_entity",
860
+ name: "Destroy Entity",
861
+ category: "entity",
862
+ description: "Destroy an entity",
863
+ icon: "trash",
864
+ color: "#3b82f6",
865
+ ports: [
866
+ { id: "exec", name: "", direction: "input", type: "flow" },
867
+ { id: "entity", name: "Entity", direction: "input", type: "entity" },
868
+ { id: "then", name: "", direction: "output", type: "flow" }
869
+ ],
870
+ execute: (inputs, ctx) => {
871
+ ctx.destroyEntity(inputs.entity);
872
+ ctx.triggerFlow("then");
873
+ }
874
+ },
875
+ // ─── Transform Operations ──────────────────────
876
+ {
877
+ type: "get_position",
878
+ name: "Get Position",
879
+ category: "transform",
880
+ description: "Get entity position",
881
+ icon: "map-pin",
882
+ color: "#fbbf24",
883
+ pure: true,
884
+ ports: [
885
+ { id: "entity", name: "Entity", direction: "input", type: "entity" },
886
+ { id: "position", name: "Position", direction: "output", type: "vec2" }
887
+ ],
888
+ execute: (inputs, ctx) => {
889
+ const transform = ctx.getComponent(
890
+ inputs.entity,
891
+ "Transform"
892
+ );
893
+ return { position: transform?.position || { x: 0, y: 0 } };
894
+ }
895
+ },
896
+ {
897
+ type: "set_position",
898
+ name: "Set Position",
899
+ category: "transform",
900
+ description: "Set entity position",
901
+ icon: "move",
902
+ color: "#fbbf24",
903
+ ports: [
904
+ { id: "exec", name: "", direction: "input", type: "flow" },
905
+ { id: "entity", name: "Entity", direction: "input", type: "entity" },
1002
906
  {
1003
- type: 'print',
1004
- name: 'Print',
1005
- category: 'debug',
1006
- description: 'Print message to screen',
1007
- icon: 'message-square',
1008
- color: '#6b7280',
1009
- ports: [
1010
- { id: 'exec', name: '', direction: 'input', type: 'flow' },
1011
- {
1012
- id: 'message',
1013
- name: 'Message',
1014
- direction: 'input',
1015
- type: 'string',
1016
- defaultValue: 'Hello!',
1017
- },
1018
- { id: 'duration', name: 'Duration', direction: 'input', type: 'float', defaultValue: 2 },
1019
- { id: 'color', name: 'Color', direction: 'input', type: 'color', defaultValue: '#ffffff' },
1020
- { id: 'then', name: '', direction: 'output', type: 'flow' },
1021
- ],
1022
- execute: (inputs, ctx) => {
1023
- ctx.print(inputs.message, inputs.duration, inputs.color);
1024
- ctx.triggerFlow('then');
1025
- },
907
+ id: "position",
908
+ name: "Position",
909
+ direction: "input",
910
+ type: "vec2",
911
+ defaultValue: { x: 0, y: 0 }
1026
912
  },
913
+ { id: "then", name: "", direction: "output", type: "flow" }
914
+ ],
915
+ execute: (inputs, ctx) => {
916
+ ctx.setComponent(inputs.entity, "Transform", { position: inputs.position });
917
+ ctx.triggerFlow("then");
918
+ }
919
+ },
920
+ {
921
+ type: "translate",
922
+ name: "Translate",
923
+ category: "transform",
924
+ description: "Move entity by offset",
925
+ icon: "arrows-move",
926
+ color: "#fbbf24",
927
+ ports: [
928
+ { id: "exec", name: "", direction: "input", type: "flow" },
929
+ { id: "entity", name: "Entity", direction: "input", type: "entity" },
1027
930
  {
1028
- type: 'log',
1029
- name: 'Log',
1030
- category: 'debug',
1031
- description: 'Log message to console',
1032
- icon: 'terminal',
1033
- color: '#6b7280',
1034
- ports: [
1035
- { id: 'exec', name: '', direction: 'input', type: 'flow' },
1036
- { id: 'message', name: 'Message', direction: 'input', type: 'string' },
1037
- {
1038
- id: 'level',
1039
- name: 'Level',
1040
- direction: 'input',
1041
- type: 'enum',
1042
- enumDef: 'LogLevel',
1043
- defaultValue: 'info',
1044
- },
1045
- { id: 'then', name: '', direction: 'output', type: 'flow' },
1046
- ],
1047
- execute: (inputs, ctx) => {
1048
- ctx.log(inputs.level, inputs.message);
1049
- ctx.triggerFlow('then');
1050
- },
931
+ id: "offset",
932
+ name: "Offset",
933
+ direction: "input",
934
+ type: "vec2",
935
+ defaultValue: { x: 0, y: 0 }
1051
936
  },
1052
- // ─── Variable Operations ───────────────────────
937
+ { id: "then", name: "", direction: "output", type: "flow" }
938
+ ],
939
+ execute: (inputs, ctx) => {
940
+ const transform = ctx.getComponent(
941
+ inputs.entity,
942
+ "Transform"
943
+ );
944
+ if (transform) {
945
+ const offset = inputs.offset;
946
+ ctx.setComponent(inputs.entity, "Transform", {
947
+ position: {
948
+ x: transform.position.x + offset.x,
949
+ y: transform.position.y + offset.y
950
+ }
951
+ });
952
+ }
953
+ ctx.triggerFlow("then");
954
+ }
955
+ },
956
+ // ─── Debug Operations ──────────────────────────
957
+ {
958
+ type: "print",
959
+ name: "Print",
960
+ category: "debug",
961
+ description: "Print message to screen",
962
+ icon: "message-square",
963
+ color: "#6b7280",
964
+ ports: [
965
+ { id: "exec", name: "", direction: "input", type: "flow" },
1053
966
  {
1054
- type: 'get_variable',
1055
- name: 'Get Variable',
1056
- category: 'variable',
1057
- description: 'Get variable value',
1058
- icon: 'download',
1059
- color: '#8b5cf6',
1060
- pure: true,
1061
- ports: [
1062
- { id: 'name', name: 'Name', direction: 'input', type: 'string' },
1063
- { id: 'value', name: 'Value', direction: 'output', type: 'wildcard' },
1064
- ],
1065
- execute: (inputs, ctx) => ({ value: ctx.variables.get(inputs.name) }),
967
+ id: "message",
968
+ name: "Message",
969
+ direction: "input",
970
+ type: "string",
971
+ defaultValue: "Hello!"
1066
972
  },
973
+ { id: "duration", name: "Duration", direction: "input", type: "float", defaultValue: 2 },
974
+ { id: "color", name: "Color", direction: "input", type: "color", defaultValue: "#ffffff" },
975
+ { id: "then", name: "", direction: "output", type: "flow" }
976
+ ],
977
+ execute: (inputs, ctx) => {
978
+ ctx.print(inputs.message, inputs.duration, inputs.color);
979
+ ctx.triggerFlow("then");
980
+ }
981
+ },
982
+ {
983
+ type: "log",
984
+ name: "Log",
985
+ category: "debug",
986
+ description: "Log message to console",
987
+ icon: "terminal",
988
+ color: "#6b7280",
989
+ ports: [
990
+ { id: "exec", name: "", direction: "input", type: "flow" },
991
+ { id: "message", name: "Message", direction: "input", type: "string" },
1067
992
  {
1068
- type: 'set_variable',
1069
- name: 'Set Variable',
1070
- category: 'variable',
1071
- description: 'Set variable value',
1072
- icon: 'upload',
1073
- color: '#8b5cf6',
1074
- ports: [
1075
- { id: 'exec', name: '', direction: 'input', type: 'flow' },
1076
- { id: 'name', name: 'Name', direction: 'input', type: 'string' },
1077
- { id: 'value', name: 'Value', direction: 'input', type: 'wildcard' },
1078
- { id: 'then', name: '', direction: 'output', type: 'flow' },
1079
- ],
1080
- execute: (inputs, ctx) => {
1081
- ctx.variables.set(inputs.name, inputs.value);
1082
- ctx.triggerFlow('then');
1083
- },
993
+ id: "level",
994
+ name: "Level",
995
+ direction: "input",
996
+ type: "enum",
997
+ enumDef: "LogLevel",
998
+ defaultValue: "info"
1084
999
  },
1085
- ];
1000
+ { id: "then", name: "", direction: "output", type: "flow" }
1001
+ ],
1002
+ execute: (inputs, ctx) => {
1003
+ ctx.log(inputs.level, inputs.message);
1004
+ ctx.triggerFlow("then");
1005
+ }
1006
+ },
1007
+ // ─── Variable Operations ───────────────────────
1008
+ {
1009
+ type: "get_variable",
1010
+ name: "Get Variable",
1011
+ category: "variable",
1012
+ description: "Get variable value",
1013
+ icon: "download",
1014
+ color: "#8b5cf6",
1015
+ pure: true,
1016
+ ports: [
1017
+ { id: "name", name: "Name", direction: "input", type: "string" },
1018
+ { id: "value", name: "Value", direction: "output", type: "wildcard" }
1019
+ ],
1020
+ execute: (inputs, ctx) => ({ value: ctx.variables.get(inputs.name) })
1021
+ },
1022
+ {
1023
+ type: "set_variable",
1024
+ name: "Set Variable",
1025
+ category: "variable",
1026
+ description: "Set variable value",
1027
+ icon: "upload",
1028
+ color: "#8b5cf6",
1029
+ ports: [
1030
+ { id: "exec", name: "", direction: "input", type: "flow" },
1031
+ { id: "name", name: "Name", direction: "input", type: "string" },
1032
+ { id: "value", name: "Value", direction: "input", type: "wildcard" },
1033
+ { id: "then", name: "", direction: "output", type: "flow" }
1034
+ ],
1035
+ execute: (inputs, ctx) => {
1036
+ ctx.variables.set(inputs.name, inputs.value);
1037
+ ctx.triggerFlow("then");
1038
+ }
1039
+ }
1040
+ ];
1086
1041
  }
1087
- // ============================================================
1088
- // Factory Functions
1089
- // ============================================================
1090
1042
  function createVSGraph(name) {
1091
- return {
1092
- id: `graph_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`,
1093
- name,
1094
- nodes: [],
1095
- connections: [],
1096
- variables: [],
1097
- functions: [],
1098
- macros: [],
1099
- parameters: [],
1100
- graphType: 'blueprint',
1101
- };
1043
+ return {
1044
+ id: `graph_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`,
1045
+ name,
1046
+ nodes: [],
1047
+ connections: [],
1048
+ variables: [],
1049
+ functions: [],
1050
+ macros: [],
1051
+ parameters: [],
1052
+ graphType: "blueprint"
1053
+ };
1102
1054
  }
1103
1055
  function createVSNode(type, position) {
1104
- return {
1105
- id: `node_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`,
1106
- type,
1107
- position,
1108
- inputs: {},
1109
- outputs: {},
1110
- };
1056
+ return {
1057
+ id: `node_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`,
1058
+ type,
1059
+ position,
1060
+ inputs: {},
1061
+ outputs: {}
1062
+ };
1111
1063
  }
1112
1064
  function createVSConnection(fromNode, fromPort, toNode, toPort) {
1113
- return {
1114
- id: `conn_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`,
1115
- fromNode,
1116
- fromPort,
1117
- toNode,
1118
- toPort,
1119
- };
1065
+ return {
1066
+ id: `conn_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`,
1067
+ fromNode,
1068
+ fromPort,
1069
+ toNode,
1070
+ toPort
1071
+ };
1120
1072
  }
1121
1073
  function createVSDebugger() {
1122
- return new VSDebugger();
1074
+ return new VSDebugger();
1123
1075
  }
1124
1076
  function createVSExecutor(debuggerInstance) {
1125
- const executor = new VSGraphExecutor(debuggerInstance);
1126
- executor.registerNodes(createBuiltInNodes());
1127
- return executor;
1077
+ const executor = new VSGraphExecutor(debuggerInstance);
1078
+ executor.registerNodes(createBuiltInNodes());
1079
+ return executor;
1128
1080
  }
1129
-
1130
- export { VSDebugger, VSGraphExecutor, VS_TYPE_COLORS, createBuiltInNodes, createVSConnection, createVSDebugger, createVSExecutor, createVSGraph, createVSNode };
1081
+ export {
1082
+ VSDebugger,
1083
+ VSGraphExecutor,
1084
+ VS_TYPE_COLORS,
1085
+ createBuiltInNodes,
1086
+ createVSConnection,
1087
+ createVSDebugger,
1088
+ createVSExecutor,
1089
+ createVSGraph,
1090
+ createVSNode
1091
+ };