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