@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,584 +1,565 @@
1
- import { EventBus } from '../core/EventBus.js';
2
-
3
- /* ────────────────────────────────────────────────────────────────
4
- Visual Scripting — Node Graph Framework
5
-
6
- A no-code programming system using node-based visual graphs.
7
- Nodes have typed ports, connections transport data between them.
8
- ──────────────────────────────────────────────────────────────── */
9
- /* ── Node Library ─────────────────────────────────────────────── */
1
+ import { EventBus } from "../core/EventBus.js";
10
2
  class NodeLibrary {
11
- constructor() {
12
- this.defs = new Map();
13
- }
14
- register(def) {
15
- this.defs.set(def.type, def);
3
+ constructor() {
4
+ this.defs = /* @__PURE__ */ new Map();
5
+ }
6
+ register(def) {
7
+ this.defs.set(def.type, def);
8
+ }
9
+ get(type) {
10
+ return this.defs.get(type);
11
+ }
12
+ getAll() {
13
+ return Array.from(this.defs.values());
14
+ }
15
+ getByCategory(category) {
16
+ return this.getAll().filter((d) => d.category === category);
17
+ }
18
+ search(query) {
19
+ const q = query.toLowerCase();
20
+ return this.getAll().filter(
21
+ (d) => d.name.toLowerCase().includes(q) || d.type.toLowerCase().includes(q) || d.description.toLowerCase().includes(q)
22
+ );
23
+ }
24
+ }
25
+ class GraphExecutor {
26
+ constructor(library) {
27
+ this.events = new EventBus();
28
+ this.library = library;
29
+ }
30
+ /** Execute a graph starting from an entry node (e.g. "on_start", "on_update"). */
31
+ execute(graph, entryType, context) {
32
+ const entries = graph.nodes.filter((n) => n.type === entryType);
33
+ for (const entry of entries) {
34
+ this.executeNode(graph, entry, context);
16
35
  }
17
- get(type) {
18
- return this.defs.get(type);
36
+ }
37
+ executeNode(graph, node, context) {
38
+ const def = this.library.get(node.type);
39
+ if (!def) {
40
+ return;
19
41
  }
20
- getAll() {
21
- return Array.from(this.defs.values());
42
+ const inputs = { ...node.inputValues };
43
+ for (const conn of graph.connections) {
44
+ if (conn.toNode === node.id) {
45
+ const fromNode = graph.nodes.find((n) => n.id === conn.fromNode);
46
+ if (fromNode) {
47
+ inputs[conn.toPort] = fromNode.outputValues[conn.fromPort];
48
+ }
49
+ }
22
50
  }
23
- getByCategory(category) {
24
- return this.getAll().filter((d) => d.category === category);
51
+ const flowTargets = [];
52
+ const origTrigger = context.triggerFlow;
53
+ context.triggerFlow = (portId) => {
54
+ flowTargets.push(portId);
55
+ };
56
+ const outputs = def.execute(inputs, context);
57
+ if (outputs) {
58
+ node.outputValues = outputs;
25
59
  }
26
- search(query) {
27
- const q = query.toLowerCase();
28
- return this.getAll().filter((d) => d.name.toLowerCase().includes(q) ||
29
- d.type.toLowerCase().includes(q) ||
30
- d.description.toLowerCase().includes(q));
60
+ for (const flowPort of flowTargets) {
61
+ const outConns = graph.connections.filter(
62
+ (c) => c.fromNode === node.id && c.fromPort === flowPort
63
+ );
64
+ for (const conn of outConns) {
65
+ const nextNode = graph.nodes.find((n) => n.id === conn.toNode);
66
+ if (nextNode) {
67
+ this.executeNode(graph, nextNode, context);
68
+ }
69
+ }
31
70
  }
71
+ context.triggerFlow = origTrigger;
72
+ }
32
73
  }
33
- /* ── Graph Executor ───────────────────────────────────────────── */
34
- class GraphExecutor {
35
- constructor(library) {
36
- this.events = new EventBus();
37
- this.library = library;
74
+ function registerBuiltInNodes(library) {
75
+ library.register({
76
+ type: "event_start",
77
+ name: "On Start",
78
+ category: "flow",
79
+ description: "Fires once when the scene starts.",
80
+ color: "#e64553",
81
+ ports: [{ id: "out", name: "", direction: "output", dataType: "flow" }],
82
+ execute: (_inputs, ctx) => {
83
+ ctx.triggerFlow("out");
38
84
  }
39
- /** Execute a graph starting from an entry node (e.g. "on_start", "on_update"). */
40
- execute(graph, entryType, context) {
41
- // Find entry nodes
42
- const entries = graph.nodes.filter((n) => n.type === entryType);
43
- for (const entry of entries) {
44
- this.executeNode(graph, entry, context);
45
- }
85
+ });
86
+ library.register({
87
+ type: "event_update",
88
+ name: "On Update",
89
+ category: "flow",
90
+ description: "Fires every frame.",
91
+ color: "#e64553",
92
+ ports: [
93
+ { id: "out", name: "", direction: "output", dataType: "flow" },
94
+ { id: "dt", name: "Delta Time", direction: "output", dataType: "number" }
95
+ ],
96
+ execute: (_inputs, ctx) => {
97
+ ctx.triggerFlow("out");
98
+ return { dt: ctx.dt };
46
99
  }
47
- executeNode(graph, node, context) {
48
- const def = this.library.get(node.type);
49
- if (!def) {
50
- return;
51
- }
52
- // Gather inputs
53
- const inputs = { ...node.inputValues };
54
- for (const conn of graph.connections) {
55
- if (conn.toNode === node.id) {
56
- const fromNode = graph.nodes.find((n) => n.id === conn.fromNode);
57
- if (fromNode) {
58
- inputs[conn.toPort] = fromNode.outputValues[conn.fromPort];
59
- }
60
- }
61
- }
62
- // Setup flow trigger
63
- const flowTargets = [];
64
- const origTrigger = context.triggerFlow;
65
- context.triggerFlow = (portId) => {
66
- flowTargets.push(portId);
67
- };
68
- // Execute
69
- const outputs = def.execute(inputs, context);
70
- if (outputs) {
71
- node.outputValues = outputs;
100
+ });
101
+ library.register({
102
+ type: "if_else",
103
+ name: "If / Else",
104
+ category: "flow",
105
+ description: "Branch based on condition.",
106
+ color: "#fab387",
107
+ ports: [
108
+ { id: "in", name: "", direction: "input", dataType: "flow" },
109
+ { id: "cond", name: "Condition", direction: "input", dataType: "boolean" },
110
+ { id: "true", name: "True", direction: "output", dataType: "flow" },
111
+ { id: "false", name: "False", direction: "output", dataType: "flow" }
112
+ ],
113
+ execute: (inputs, ctx) => {
114
+ ctx.triggerFlow(inputs.cond ? "true" : "false");
115
+ }
116
+ });
117
+ library.register({
118
+ type: "delay",
119
+ name: "Delay",
120
+ category: "flow",
121
+ description: "Wait for a duration then continue.",
122
+ color: "#fab387",
123
+ ports: [
124
+ { id: "in", name: "", direction: "input", dataType: "flow" },
125
+ { id: "seconds", name: "Seconds", direction: "input", dataType: "number", defaultValue: 1 },
126
+ { id: "out", name: "", direction: "output", dataType: "flow" }
127
+ ],
128
+ execute: (inputs, ctx) => {
129
+ ctx.triggerFlow("out");
130
+ }
131
+ });
132
+ library.register({
133
+ type: "sequence",
134
+ name: "Sequence",
135
+ category: "flow",
136
+ description: "Execute outputs in order.",
137
+ color: "#fab387",
138
+ ports: [
139
+ { id: "in", name: "", direction: "input", dataType: "flow" },
140
+ { id: "out1", name: "1", direction: "output", dataType: "flow" },
141
+ { id: "out2", name: "2", direction: "output", dataType: "flow" },
142
+ { id: "out3", name: "3", direction: "output", dataType: "flow" }
143
+ ],
144
+ execute: (_inputs, ctx) => {
145
+ ctx.triggerFlow("out1");
146
+ ctx.triggerFlow("out2");
147
+ ctx.triggerFlow("out3");
148
+ }
149
+ });
150
+ library.register({
151
+ type: "math_add",
152
+ name: "Add",
153
+ category: "math",
154
+ description: "A + B",
155
+ color: "#89b4fa",
156
+ ports: [
157
+ { id: "a", name: "A", direction: "input", dataType: "number", defaultValue: 0 },
158
+ { id: "b", name: "B", direction: "input", dataType: "number", defaultValue: 0 },
159
+ { id: "result", name: "Result", direction: "output", dataType: "number" }
160
+ ],
161
+ execute: (inputs) => ({ result: inputs.a + inputs.b })
162
+ });
163
+ library.register({
164
+ type: "math_sub",
165
+ name: "Subtract",
166
+ category: "math",
167
+ description: "A - B",
168
+ color: "#89b4fa",
169
+ ports: [
170
+ { id: "a", name: "A", direction: "input", dataType: "number", defaultValue: 0 },
171
+ { id: "b", name: "B", direction: "input", dataType: "number", defaultValue: 0 },
172
+ { id: "result", name: "Result", direction: "output", dataType: "number" }
173
+ ],
174
+ execute: (inputs) => ({ result: inputs.a - inputs.b })
175
+ });
176
+ library.register({
177
+ type: "math_mul",
178
+ name: "Multiply",
179
+ category: "math",
180
+ description: "A × B",
181
+ color: "#89b4fa",
182
+ ports: [
183
+ { id: "a", name: "A", direction: "input", dataType: "number", defaultValue: 0 },
184
+ { id: "b", name: "B", direction: "input", dataType: "number", defaultValue: 1 },
185
+ { id: "result", name: "Result", direction: "output", dataType: "number" }
186
+ ],
187
+ execute: (inputs) => ({ result: inputs.a * inputs.b })
188
+ });
189
+ library.register({
190
+ type: "math_div",
191
+ name: "Divide",
192
+ category: "math",
193
+ description: "A ÷ B",
194
+ color: "#89b4fa",
195
+ ports: [
196
+ { id: "a", name: "A", direction: "input", dataType: "number", defaultValue: 0 },
197
+ { id: "b", name: "B", direction: "input", dataType: "number", defaultValue: 1 },
198
+ { id: "result", name: "Result", direction: "output", dataType: "number" }
199
+ ],
200
+ execute: (inputs) => {
201
+ const b = inputs.b;
202
+ return { result: b !== 0 ? inputs.a / b : 0 };
203
+ }
204
+ });
205
+ library.register({
206
+ type: "math_random",
207
+ name: "Random",
208
+ category: "math",
209
+ description: "Random number between min and max.",
210
+ color: "#89b4fa",
211
+ ports: [
212
+ { id: "min", name: "Min", direction: "input", dataType: "number", defaultValue: 0 },
213
+ { id: "max", name: "Max", direction: "input", dataType: "number", defaultValue: 1 },
214
+ { id: "result", name: "Result", direction: "output", dataType: "number" }
215
+ ],
216
+ execute: (inputs) => {
217
+ const min = inputs.min;
218
+ const max = inputs.max;
219
+ return { result: min + Math.random() * (max - min) };
220
+ }
221
+ });
222
+ library.register({
223
+ type: "compare_eq",
224
+ name: "Equals",
225
+ category: "logic",
226
+ description: "A == B",
227
+ color: "#a6e3a1",
228
+ ports: [
229
+ { id: "a", name: "A", direction: "input", dataType: "any" },
230
+ { id: "b", name: "B", direction: "input", dataType: "any" },
231
+ { id: "result", name: "Result", direction: "output", dataType: "boolean" }
232
+ ],
233
+ execute: (inputs) => ({ result: inputs.a === inputs.b })
234
+ });
235
+ library.register({
236
+ type: "compare_gt",
237
+ name: "Greater Than",
238
+ category: "logic",
239
+ description: "A > B",
240
+ color: "#a6e3a1",
241
+ ports: [
242
+ { id: "a", name: "A", direction: "input", dataType: "number", defaultValue: 0 },
243
+ { id: "b", name: "B", direction: "input", dataType: "number", defaultValue: 0 },
244
+ { id: "result", name: "Result", direction: "output", dataType: "boolean" }
245
+ ],
246
+ execute: (inputs) => ({ result: inputs.a > inputs.b })
247
+ });
248
+ library.register({
249
+ type: "compare_lt",
250
+ name: "Less Than",
251
+ category: "logic",
252
+ description: "A < B",
253
+ color: "#a6e3a1",
254
+ ports: [
255
+ { id: "a", name: "A", direction: "input", dataType: "number", defaultValue: 0 },
256
+ { id: "b", name: "B", direction: "input", dataType: "number", defaultValue: 0 },
257
+ { id: "result", name: "Result", direction: "output", dataType: "boolean" }
258
+ ],
259
+ execute: (inputs) => ({ result: inputs.a < inputs.b })
260
+ });
261
+ library.register({
262
+ type: "logic_and",
263
+ name: "And",
264
+ category: "logic",
265
+ description: "A AND B",
266
+ color: "#a6e3a1",
267
+ ports: [
268
+ { id: "a", name: "A", direction: "input", dataType: "boolean" },
269
+ { id: "b", name: "B", direction: "input", dataType: "boolean" },
270
+ { id: "result", name: "Result", direction: "output", dataType: "boolean" }
271
+ ],
272
+ execute: (inputs) => ({ result: !!(inputs.a && inputs.b) })
273
+ });
274
+ library.register({
275
+ type: "logic_or",
276
+ name: "Or",
277
+ category: "logic",
278
+ description: "A OR B",
279
+ color: "#a6e3a1",
280
+ ports: [
281
+ { id: "a", name: "A", direction: "input", dataType: "boolean" },
282
+ { id: "b", name: "B", direction: "input", dataType: "boolean" },
283
+ { id: "result", name: "Result", direction: "output", dataType: "boolean" }
284
+ ],
285
+ execute: (inputs) => ({ result: !!(inputs.a || inputs.b) })
286
+ });
287
+ library.register({
288
+ type: "logic_not",
289
+ name: "Not",
290
+ category: "logic",
291
+ description: "NOT A",
292
+ color: "#a6e3a1",
293
+ ports: [
294
+ { id: "a", name: "A", direction: "input", dataType: "boolean" },
295
+ { id: "result", name: "Result", direction: "output", dataType: "boolean" }
296
+ ],
297
+ execute: (inputs) => ({ result: !inputs.a })
298
+ });
299
+ library.register({
300
+ type: "input_action",
301
+ name: "Input Action",
302
+ category: "input",
303
+ description: "Read an input action value.",
304
+ color: "#f9e2af",
305
+ ports: [
306
+ {
307
+ id: "action",
308
+ name: "Action",
309
+ direction: "input",
310
+ dataType: "string",
311
+ defaultValue: "moveX"
312
+ },
313
+ { id: "pressed", name: "Pressed", direction: "output", dataType: "boolean" },
314
+ { id: "value", name: "Value", direction: "output", dataType: "number" }
315
+ ],
316
+ execute: (_inputs, ctx) => {
317
+ const actionName = _inputs.action ?? "moveX";
318
+ const input = ctx.services["input"];
319
+ if (input?.getAction) {
320
+ const state = input.getAction(actionName);
321
+ return { pressed: state.pressed, value: state.value };
322
+ }
323
+ return { pressed: false, value: 0 };
324
+ }
325
+ });
326
+ library.register({
327
+ type: "play_sound",
328
+ name: "Play Sound",
329
+ category: "audio",
330
+ description: "Play a sound effect.",
331
+ color: "#cba6f7",
332
+ ports: [
333
+ { id: "in", name: "", direction: "input", dataType: "flow" },
334
+ { id: "soundId", name: "Sound", direction: "input", dataType: "string" },
335
+ { id: "volume", name: "Volume", direction: "input", dataType: "number", defaultValue: 1 },
336
+ { id: "out", name: "", direction: "output", dataType: "flow" }
337
+ ],
338
+ execute: (_inputs, ctx) => {
339
+ const audio = ctx.services["audio"];
340
+ if (audio?.play) {
341
+ audio.play(_inputs.soundId, { volume: _inputs.volume ?? 1 });
342
+ }
343
+ ctx.triggerFlow("out");
344
+ }
345
+ });
346
+ library.register({
347
+ type: "get_position",
348
+ name: "Get Position",
349
+ category: "entity",
350
+ description: "Get entity position.",
351
+ color: "#74c7ec",
352
+ ports: [
353
+ { id: "entity", name: "Entity", direction: "input", dataType: "entity" },
354
+ { id: "x", name: "X", direction: "output", dataType: "number" },
355
+ { id: "y", name: "Y", direction: "output", dataType: "number" }
356
+ ],
357
+ execute: (_inputs, ctx) => {
358
+ const world = ctx.world;
359
+ const eid = _inputs.entity ?? ctx.entityId;
360
+ if (world?.getComponent && eid != null) {
361
+ const t = world.getComponent(eid, "Transform");
362
+ if (t?.position) {
363
+ return { x: t.position.x, y: t.position.y };
72
364
  }
73
- // Follow flow connections
74
- for (const flowPort of flowTargets) {
75
- const outConns = graph.connections.filter((c) => c.fromNode === node.id && c.fromPort === flowPort);
76
- for (const conn of outConns) {
77
- const nextNode = graph.nodes.find((n) => n.id === conn.toNode);
78
- if (nextNode) {
79
- this.executeNode(graph, nextNode, context);
80
- }
81
- }
365
+ }
366
+ return { x: 0, y: 0 };
367
+ }
368
+ });
369
+ library.register({
370
+ type: "set_position",
371
+ name: "Set Position",
372
+ category: "entity",
373
+ description: "Set entity position.",
374
+ color: "#74c7ec",
375
+ ports: [
376
+ { id: "in", name: "", direction: "input", dataType: "flow" },
377
+ { id: "entity", name: "Entity", direction: "input", dataType: "entity" },
378
+ { id: "x", name: "X", direction: "input", dataType: "number", defaultValue: 0 },
379
+ { id: "y", name: "Y", direction: "input", dataType: "number", defaultValue: 0 },
380
+ { id: "out", name: "", direction: "output", dataType: "flow" }
381
+ ],
382
+ execute: (_inputs, ctx) => {
383
+ const world = ctx.world;
384
+ const eid = _inputs.entity ?? ctx.entityId;
385
+ if (world?.getComponent && eid != null) {
386
+ const t = world.getComponent(eid, "Transform");
387
+ if (t?.position) {
388
+ t.position.x = _inputs.x ?? 0;
389
+ t.position.y = _inputs.y ?? 0;
82
390
  }
83
- context.triggerFlow = origTrigger;
391
+ }
392
+ ctx.triggerFlow("out");
84
393
  }
394
+ });
395
+ library.register({
396
+ type: "spawn_entity",
397
+ name: "Spawn Entity",
398
+ category: "entity",
399
+ description: "Create a new entity from a prefab.",
400
+ color: "#74c7ec",
401
+ ports: [
402
+ { id: "in", name: "", direction: "input", dataType: "flow" },
403
+ { id: "prefab", name: "Prefab", direction: "input", dataType: "string" },
404
+ { id: "x", name: "X", direction: "input", dataType: "number", defaultValue: 0 },
405
+ { id: "y", name: "Y", direction: "input", dataType: "number", defaultValue: 0 },
406
+ { id: "out", name: "", direction: "output", dataType: "flow" },
407
+ { id: "entity", name: "Entity", direction: "output", dataType: "entity" }
408
+ ],
409
+ execute: (_inputs, ctx) => {
410
+ ctx.triggerFlow("out");
411
+ return { entity: null };
412
+ }
413
+ });
414
+ library.register({
415
+ type: "destroy_entity",
416
+ name: "Destroy Entity",
417
+ category: "entity",
418
+ description: "Remove an entity from the world.",
419
+ color: "#74c7ec",
420
+ ports: [
421
+ { id: "in", name: "", direction: "input", dataType: "flow" },
422
+ { id: "entity", name: "Entity", direction: "input", dataType: "entity" },
423
+ { id: "out", name: "", direction: "output", dataType: "flow" }
424
+ ],
425
+ execute: (_inputs, ctx) => {
426
+ ctx.triggerFlow("out");
427
+ }
428
+ });
429
+ library.register({
430
+ type: "get_variable",
431
+ name: "Get Variable",
432
+ category: "variable",
433
+ description: "Read a variable value.",
434
+ color: "#94e2d5",
435
+ ports: [
436
+ { id: "name", name: "Name", direction: "input", dataType: "string", defaultValue: "" },
437
+ { id: "value", name: "Value", direction: "output", dataType: "any" }
438
+ ],
439
+ execute: (inputs, ctx) => ({ value: ctx.variables[inputs.name ?? ""] })
440
+ });
441
+ library.register({
442
+ type: "set_variable",
443
+ name: "Set Variable",
444
+ category: "variable",
445
+ description: "Write a variable value.",
446
+ color: "#94e2d5",
447
+ ports: [
448
+ { id: "in", name: "", direction: "input", dataType: "flow" },
449
+ { id: "name", name: "Name", direction: "input", dataType: "string", defaultValue: "" },
450
+ { id: "value", name: "Value", direction: "input", dataType: "any" },
451
+ { id: "out", name: "", direction: "output", dataType: "flow" }
452
+ ],
453
+ execute: (inputs, ctx) => {
454
+ const name = inputs.name;
455
+ if (name) {
456
+ ctx.variables[name] = inputs.value;
457
+ }
458
+ ctx.triggerFlow("out");
459
+ }
460
+ });
461
+ library.register({
462
+ type: "apply_force",
463
+ name: "Apply Force",
464
+ category: "physics",
465
+ description: "Apply a force to an entity.",
466
+ color: "#f38ba8",
467
+ ports: [
468
+ { id: "in", name: "", direction: "input", dataType: "flow" },
469
+ { id: "entity", name: "Entity", direction: "input", dataType: "entity" },
470
+ { id: "x", name: "X", direction: "input", dataType: "number", defaultValue: 0 },
471
+ { id: "y", name: "Y", direction: "input", dataType: "number", defaultValue: 0 },
472
+ { id: "out", name: "", direction: "output", dataType: "flow" }
473
+ ],
474
+ execute: (_inputs, ctx) => {
475
+ ctx.triggerFlow("out");
476
+ }
477
+ });
478
+ library.register({
479
+ type: "on_collision",
480
+ name: "On Collision",
481
+ category: "physics",
482
+ description: "Fires when entity collides with another.",
483
+ color: "#f38ba8",
484
+ ports: [
485
+ { id: "out", name: "", direction: "output", dataType: "flow" },
486
+ { id: "other", name: "Other", direction: "output", dataType: "entity" },
487
+ { id: "normal_x", name: "Normal X", direction: "output", dataType: "number" },
488
+ { id: "normal_y", name: "Normal Y", direction: "output", dataType: "number" }
489
+ ],
490
+ execute: (_inputs, ctx) => {
491
+ ctx.triggerFlow("out");
492
+ return { other: null, normal_x: 0, normal_y: 0 };
493
+ }
494
+ });
495
+ library.register({
496
+ type: "load_scene",
497
+ name: "Load Scene",
498
+ category: "game",
499
+ description: "Load a scene by ID.",
500
+ color: "#eba0ac",
501
+ ports: [
502
+ { id: "in", name: "", direction: "input", dataType: "flow" },
503
+ { id: "sceneId", name: "Scene ID", direction: "input", dataType: "string" },
504
+ { id: "out", name: "", direction: "output", dataType: "flow" }
505
+ ],
506
+ execute: (_inputs, ctx) => {
507
+ ctx.triggerFlow("out");
508
+ }
509
+ });
510
+ library.register({
511
+ type: "camera_shake",
512
+ name: "Camera Shake",
513
+ category: "game",
514
+ description: "Shake the camera.",
515
+ color: "#eba0ac",
516
+ ports: [
517
+ { id: "in", name: "", direction: "input", dataType: "flow" },
518
+ {
519
+ id: "intensity",
520
+ name: "Intensity",
521
+ direction: "input",
522
+ dataType: "number",
523
+ defaultValue: 5
524
+ },
525
+ {
526
+ id: "duration",
527
+ name: "Duration",
528
+ direction: "input",
529
+ dataType: "number",
530
+ defaultValue: 0.3
531
+ },
532
+ { id: "out", name: "", direction: "output", dataType: "flow" }
533
+ ],
534
+ execute: (_inputs, ctx) => {
535
+ ctx.triggerFlow("out");
536
+ }
537
+ });
538
+ library.register({
539
+ type: "print",
540
+ name: "Print",
541
+ category: "flow",
542
+ description: "Log a value to the console.",
543
+ color: "#fab387",
544
+ ports: [
545
+ { id: "in", name: "", direction: "input", dataType: "flow" },
546
+ { id: "message", name: "Message", direction: "input", dataType: "any" },
547
+ { id: "out", name: "", direction: "output", dataType: "flow" }
548
+ ],
549
+ execute: (inputs, ctx) => {
550
+ ctx.events.emit("script:log", inputs.message);
551
+ ctx.triggerFlow("out");
552
+ }
553
+ });
85
554
  }
86
- /* ── Built-in Nodes ───────────────────────────────────────────── */
87
- function registerBuiltInNodes(library) {
88
- // ── Flow Control ───────────────────────────────
89
- library.register({
90
- type: 'event_start',
91
- name: 'On Start',
92
- category: 'flow',
93
- description: 'Fires once when the scene starts.',
94
- color: '#e64553',
95
- ports: [{ id: 'out', name: '', direction: 'output', dataType: 'flow' }],
96
- execute: (_inputs, ctx) => {
97
- ctx.triggerFlow('out');
98
- },
99
- });
100
- library.register({
101
- type: 'event_update',
102
- name: 'On Update',
103
- category: 'flow',
104
- description: 'Fires every frame.',
105
- color: '#e64553',
106
- ports: [
107
- { id: 'out', name: '', direction: 'output', dataType: 'flow' },
108
- { id: 'dt', name: 'Delta Time', direction: 'output', dataType: 'number' },
109
- ],
110
- execute: (_inputs, ctx) => {
111
- ctx.triggerFlow('out');
112
- return { dt: ctx.dt };
113
- },
114
- });
115
- library.register({
116
- type: 'if_else',
117
- name: 'If / Else',
118
- category: 'flow',
119
- description: 'Branch based on condition.',
120
- color: '#fab387',
121
- ports: [
122
- { id: 'in', name: '', direction: 'input', dataType: 'flow' },
123
- { id: 'cond', name: 'Condition', direction: 'input', dataType: 'boolean' },
124
- { id: 'true', name: 'True', direction: 'output', dataType: 'flow' },
125
- { id: 'false', name: 'False', direction: 'output', dataType: 'flow' },
126
- ],
127
- execute: (inputs, ctx) => {
128
- ctx.triggerFlow(inputs.cond ? 'true' : 'false');
129
- },
130
- });
131
- library.register({
132
- type: 'delay',
133
- name: 'Delay',
134
- category: 'flow',
135
- description: 'Wait for a duration then continue.',
136
- color: '#fab387',
137
- ports: [
138
- { id: 'in', name: '', direction: 'input', dataType: 'flow' },
139
- { id: 'seconds', name: 'Seconds', direction: 'input', dataType: 'number', defaultValue: 1 },
140
- { id: 'out', name: '', direction: 'output', dataType: 'flow' },
141
- ],
142
- execute: (inputs, ctx) => {
143
- // In a real implementation this would be async/coroutine-based
144
- ctx.triggerFlow('out');
145
- },
146
- });
147
- library.register({
148
- type: 'sequence',
149
- name: 'Sequence',
150
- category: 'flow',
151
- description: 'Execute outputs in order.',
152
- color: '#fab387',
153
- ports: [
154
- { id: 'in', name: '', direction: 'input', dataType: 'flow' },
155
- { id: 'out1', name: '1', direction: 'output', dataType: 'flow' },
156
- { id: 'out2', name: '2', direction: 'output', dataType: 'flow' },
157
- { id: 'out3', name: '3', direction: 'output', dataType: 'flow' },
158
- ],
159
- execute: (_inputs, ctx) => {
160
- ctx.triggerFlow('out1');
161
- ctx.triggerFlow('out2');
162
- ctx.triggerFlow('out3');
163
- },
164
- });
165
- // ── Math ───────────────────────────────────────
166
- library.register({
167
- type: 'math_add',
168
- name: 'Add',
169
- category: 'math',
170
- description: 'A + B',
171
- color: '#89b4fa',
172
- ports: [
173
- { id: 'a', name: 'A', direction: 'input', dataType: 'number', defaultValue: 0 },
174
- { id: 'b', name: 'B', direction: 'input', dataType: 'number', defaultValue: 0 },
175
- { id: 'result', name: 'Result', direction: 'output', dataType: 'number' },
176
- ],
177
- execute: (inputs) => ({ result: inputs.a + inputs.b }),
178
- });
179
- library.register({
180
- type: 'math_sub',
181
- name: 'Subtract',
182
- category: 'math',
183
- description: 'A - B',
184
- color: '#89b4fa',
185
- ports: [
186
- { id: 'a', name: 'A', direction: 'input', dataType: 'number', defaultValue: 0 },
187
- { id: 'b', name: 'B', direction: 'input', dataType: 'number', defaultValue: 0 },
188
- { id: 'result', name: 'Result', direction: 'output', dataType: 'number' },
189
- ],
190
- execute: (inputs) => ({ result: inputs.a - inputs.b }),
191
- });
192
- library.register({
193
- type: 'math_mul',
194
- name: 'Multiply',
195
- category: 'math',
196
- description: 'A × B',
197
- color: '#89b4fa',
198
- ports: [
199
- { id: 'a', name: 'A', direction: 'input', dataType: 'number', defaultValue: 0 },
200
- { id: 'b', name: 'B', direction: 'input', dataType: 'number', defaultValue: 1 },
201
- { id: 'result', name: 'Result', direction: 'output', dataType: 'number' },
202
- ],
203
- execute: (inputs) => ({ result: inputs.a * inputs.b }),
204
- });
205
- library.register({
206
- type: 'math_div',
207
- name: 'Divide',
208
- category: 'math',
209
- description: 'A ÷ B',
210
- color: '#89b4fa',
211
- ports: [
212
- { id: 'a', name: 'A', direction: 'input', dataType: 'number', defaultValue: 0 },
213
- { id: 'b', name: 'B', direction: 'input', dataType: 'number', defaultValue: 1 },
214
- { id: 'result', name: 'Result', direction: 'output', dataType: 'number' },
215
- ],
216
- execute: (inputs) => {
217
- const b = inputs.b;
218
- return { result: b !== 0 ? inputs.a / b : 0 };
219
- },
220
- });
221
- library.register({
222
- type: 'math_random',
223
- name: 'Random',
224
- category: 'math',
225
- description: 'Random number between min and max.',
226
- color: '#89b4fa',
227
- ports: [
228
- { id: 'min', name: 'Min', direction: 'input', dataType: 'number', defaultValue: 0 },
229
- { id: 'max', name: 'Max', direction: 'input', dataType: 'number', defaultValue: 1 },
230
- { id: 'result', name: 'Result', direction: 'output', dataType: 'number' },
231
- ],
232
- execute: (inputs) => {
233
- const min = inputs.min;
234
- const max = inputs.max;
235
- return { result: min + Math.random() * (max - min) };
236
- },
237
- });
238
- // ── Comparison ─────────────────────────────────
239
- library.register({
240
- type: 'compare_eq',
241
- name: 'Equals',
242
- category: 'logic',
243
- description: 'A == B',
244
- color: '#a6e3a1',
245
- ports: [
246
- { id: 'a', name: 'A', direction: 'input', dataType: 'any' },
247
- { id: 'b', name: 'B', direction: 'input', dataType: 'any' },
248
- { id: 'result', name: 'Result', direction: 'output', dataType: 'boolean' },
249
- ],
250
- execute: (inputs) => ({ result: inputs.a === inputs.b }),
251
- });
252
- library.register({
253
- type: 'compare_gt',
254
- name: 'Greater Than',
255
- category: 'logic',
256
- description: 'A > B',
257
- color: '#a6e3a1',
258
- ports: [
259
- { id: 'a', name: 'A', direction: 'input', dataType: 'number', defaultValue: 0 },
260
- { id: 'b', name: 'B', direction: 'input', dataType: 'number', defaultValue: 0 },
261
- { id: 'result', name: 'Result', direction: 'output', dataType: 'boolean' },
262
- ],
263
- execute: (inputs) => ({ result: inputs.a > inputs.b }),
264
- });
265
- library.register({
266
- type: 'compare_lt',
267
- name: 'Less Than',
268
- category: 'logic',
269
- description: 'A < B',
270
- color: '#a6e3a1',
271
- ports: [
272
- { id: 'a', name: 'A', direction: 'input', dataType: 'number', defaultValue: 0 },
273
- { id: 'b', name: 'B', direction: 'input', dataType: 'number', defaultValue: 0 },
274
- { id: 'result', name: 'Result', direction: 'output', dataType: 'boolean' },
275
- ],
276
- execute: (inputs) => ({ result: inputs.a < inputs.b }),
277
- });
278
- library.register({
279
- type: 'logic_and',
280
- name: 'And',
281
- category: 'logic',
282
- description: 'A AND B',
283
- color: '#a6e3a1',
284
- ports: [
285
- { id: 'a', name: 'A', direction: 'input', dataType: 'boolean' },
286
- { id: 'b', name: 'B', direction: 'input', dataType: 'boolean' },
287
- { id: 'result', name: 'Result', direction: 'output', dataType: 'boolean' },
288
- ],
289
- execute: (inputs) => ({ result: !!(inputs.a && inputs.b) }),
290
- });
291
- library.register({
292
- type: 'logic_or',
293
- name: 'Or',
294
- category: 'logic',
295
- description: 'A OR B',
296
- color: '#a6e3a1',
297
- ports: [
298
- { id: 'a', name: 'A', direction: 'input', dataType: 'boolean' },
299
- { id: 'b', name: 'B', direction: 'input', dataType: 'boolean' },
300
- { id: 'result', name: 'Result', direction: 'output', dataType: 'boolean' },
301
- ],
302
- execute: (inputs) => ({ result: !!(inputs.a || inputs.b) }),
303
- });
304
- library.register({
305
- type: 'logic_not',
306
- name: 'Not',
307
- category: 'logic',
308
- description: 'NOT A',
309
- color: '#a6e3a1',
310
- ports: [
311
- { id: 'a', name: 'A', direction: 'input', dataType: 'boolean' },
312
- { id: 'result', name: 'Result', direction: 'output', dataType: 'boolean' },
313
- ],
314
- execute: (inputs) => ({ result: !inputs.a }),
315
- });
316
- // ── Game / Input ───────────────────────────────
317
- library.register({
318
- type: 'input_action',
319
- name: 'Input Action',
320
- category: 'input',
321
- description: 'Read an input action value.',
322
- color: '#f9e2af',
323
- ports: [
324
- {
325
- id: 'action',
326
- name: 'Action',
327
- direction: 'input',
328
- dataType: 'string',
329
- defaultValue: 'moveX',
330
- },
331
- { id: 'pressed', name: 'Pressed', direction: 'output', dataType: 'boolean' },
332
- { id: 'value', name: 'Value', direction: 'output', dataType: 'number' },
333
- ],
334
- execute: (_inputs, ctx) => {
335
- const actionName = _inputs.action ?? 'moveX';
336
- const input = ctx.services['input'];
337
- if (input?.getAction) {
338
- const state = input.getAction(actionName);
339
- return { pressed: state.pressed, value: state.value };
340
- }
341
- return { pressed: false, value: 0 };
342
- },
343
- });
344
- library.register({
345
- type: 'play_sound',
346
- name: 'Play Sound',
347
- category: 'audio',
348
- description: 'Play a sound effect.',
349
- color: '#cba6f7',
350
- ports: [
351
- { id: 'in', name: '', direction: 'input', dataType: 'flow' },
352
- { id: 'soundId', name: 'Sound', direction: 'input', dataType: 'string' },
353
- { id: 'volume', name: 'Volume', direction: 'input', dataType: 'number', defaultValue: 1 },
354
- { id: 'out', name: '', direction: 'output', dataType: 'flow' },
355
- ],
356
- execute: (_inputs, ctx) => {
357
- const audio = ctx.services['audio'];
358
- if (audio?.play) {
359
- audio.play(_inputs.soundId, { volume: _inputs.volume ?? 1 });
360
- }
361
- ctx.triggerFlow('out');
362
- },
363
- });
364
- // ── Entity ─────────────────────────────────────
365
- library.register({
366
- type: 'get_position',
367
- name: 'Get Position',
368
- category: 'entity',
369
- description: 'Get entity position.',
370
- color: '#74c7ec',
371
- ports: [
372
- { id: 'entity', name: 'Entity', direction: 'input', dataType: 'entity' },
373
- { id: 'x', name: 'X', direction: 'output', dataType: 'number' },
374
- { id: 'y', name: 'Y', direction: 'output', dataType: 'number' },
375
- ],
376
- execute: (_inputs, ctx) => {
377
- const world = ctx.world;
378
- const eid = (_inputs.entity ?? ctx.entityId);
379
- if (world?.getComponent && eid != null) {
380
- const t = world.getComponent(eid, 'Transform');
381
- if (t?.position) {
382
- return { x: t.position.x, y: t.position.y };
383
- }
384
- }
385
- return { x: 0, y: 0 };
386
- },
387
- });
388
- library.register({
389
- type: 'set_position',
390
- name: 'Set Position',
391
- category: 'entity',
392
- description: 'Set entity position.',
393
- color: '#74c7ec',
394
- ports: [
395
- { id: 'in', name: '', direction: 'input', dataType: 'flow' },
396
- { id: 'entity', name: 'Entity', direction: 'input', dataType: 'entity' },
397
- { id: 'x', name: 'X', direction: 'input', dataType: 'number', defaultValue: 0 },
398
- { id: 'y', name: 'Y', direction: 'input', dataType: 'number', defaultValue: 0 },
399
- { id: 'out', name: '', direction: 'output', dataType: 'flow' },
400
- ],
401
- execute: (_inputs, ctx) => {
402
- const world = ctx.world;
403
- const eid = (_inputs.entity ?? ctx.entityId);
404
- if (world?.getComponent && eid != null) {
405
- const t = world.getComponent(eid, 'Transform');
406
- if (t?.position) {
407
- t.position.x = _inputs.x ?? 0;
408
- t.position.y = _inputs.y ?? 0;
409
- }
410
- }
411
- ctx.triggerFlow('out');
412
- },
413
- });
414
- library.register({
415
- type: 'spawn_entity',
416
- name: 'Spawn Entity',
417
- category: 'entity',
418
- description: 'Create a new entity from a prefab.',
419
- color: '#74c7ec',
420
- ports: [
421
- { id: 'in', name: '', direction: 'input', dataType: 'flow' },
422
- { id: 'prefab', name: 'Prefab', direction: 'input', dataType: 'string' },
423
- { id: 'x', name: 'X', direction: 'input', dataType: 'number', defaultValue: 0 },
424
- { id: 'y', name: 'Y', direction: 'input', dataType: 'number', defaultValue: 0 },
425
- { id: 'out', name: '', direction: 'output', dataType: 'flow' },
426
- { id: 'entity', name: 'Entity', direction: 'output', dataType: 'entity' },
427
- ],
428
- execute: (_inputs, ctx) => {
429
- ctx.triggerFlow('out');
430
- return { entity: null };
431
- },
432
- });
433
- library.register({
434
- type: 'destroy_entity',
435
- name: 'Destroy Entity',
436
- category: 'entity',
437
- description: 'Remove an entity from the world.',
438
- color: '#74c7ec',
439
- ports: [
440
- { id: 'in', name: '', direction: 'input', dataType: 'flow' },
441
- { id: 'entity', name: 'Entity', direction: 'input', dataType: 'entity' },
442
- { id: 'out', name: '', direction: 'output', dataType: 'flow' },
443
- ],
444
- execute: (_inputs, ctx) => {
445
- ctx.triggerFlow('out');
446
- },
447
- });
448
- // ── Variables ──────────────────────────────────
449
- library.register({
450
- type: 'get_variable',
451
- name: 'Get Variable',
452
- category: 'variable',
453
- description: 'Read a variable value.',
454
- color: '#94e2d5',
455
- ports: [
456
- { id: 'name', name: 'Name', direction: 'input', dataType: 'string', defaultValue: '' },
457
- { id: 'value', name: 'Value', direction: 'output', dataType: 'any' },
458
- ],
459
- execute: (inputs, ctx) => ({ value: ctx.variables[inputs.name ?? ''] }),
460
- });
461
- library.register({
462
- type: 'set_variable',
463
- name: 'Set Variable',
464
- category: 'variable',
465
- description: 'Write a variable value.',
466
- color: '#94e2d5',
467
- ports: [
468
- { id: 'in', name: '', direction: 'input', dataType: 'flow' },
469
- { id: 'name', name: 'Name', direction: 'input', dataType: 'string', defaultValue: '' },
470
- { id: 'value', name: 'Value', direction: 'input', dataType: 'any' },
471
- { id: 'out', name: '', direction: 'output', dataType: 'flow' },
472
- ],
473
- execute: (inputs, ctx) => {
474
- const name = inputs.name;
475
- if (name) {
476
- ctx.variables[name] = inputs.value;
477
- }
478
- ctx.triggerFlow('out');
479
- },
480
- });
481
- // ── Physics ────────────────────────────────────
482
- library.register({
483
- type: 'apply_force',
484
- name: 'Apply Force',
485
- category: 'physics',
486
- description: 'Apply a force to an entity.',
487
- color: '#f38ba8',
488
- ports: [
489
- { id: 'in', name: '', direction: 'input', dataType: 'flow' },
490
- { id: 'entity', name: 'Entity', direction: 'input', dataType: 'entity' },
491
- { id: 'x', name: 'X', direction: 'input', dataType: 'number', defaultValue: 0 },
492
- { id: 'y', name: 'Y', direction: 'input', dataType: 'number', defaultValue: 0 },
493
- { id: 'out', name: '', direction: 'output', dataType: 'flow' },
494
- ],
495
- execute: (_inputs, ctx) => {
496
- ctx.triggerFlow('out');
497
- },
498
- });
499
- library.register({
500
- type: 'on_collision',
501
- name: 'On Collision',
502
- category: 'physics',
503
- description: 'Fires when entity collides with another.',
504
- color: '#f38ba8',
505
- ports: [
506
- { id: 'out', name: '', direction: 'output', dataType: 'flow' },
507
- { id: 'other', name: 'Other', direction: 'output', dataType: 'entity' },
508
- { id: 'normal_x', name: 'Normal X', direction: 'output', dataType: 'number' },
509
- { id: 'normal_y', name: 'Normal Y', direction: 'output', dataType: 'number' },
510
- ],
511
- execute: (_inputs, ctx) => {
512
- ctx.triggerFlow('out');
513
- return { other: null, normal_x: 0, normal_y: 0 };
514
- },
515
- });
516
- // ── Game Control ───────────────────────────────
517
- library.register({
518
- type: 'load_scene',
519
- name: 'Load Scene',
520
- category: 'game',
521
- description: 'Load a scene by ID.',
522
- color: '#eba0ac',
523
- ports: [
524
- { id: 'in', name: '', direction: 'input', dataType: 'flow' },
525
- { id: 'sceneId', name: 'Scene ID', direction: 'input', dataType: 'string' },
526
- { id: 'out', name: '', direction: 'output', dataType: 'flow' },
527
- ],
528
- execute: (_inputs, ctx) => {
529
- ctx.triggerFlow('out');
530
- },
531
- });
532
- library.register({
533
- type: 'camera_shake',
534
- name: 'Camera Shake',
535
- category: 'game',
536
- description: 'Shake the camera.',
537
- color: '#eba0ac',
538
- ports: [
539
- { id: 'in', name: '', direction: 'input', dataType: 'flow' },
540
- {
541
- id: 'intensity',
542
- name: 'Intensity',
543
- direction: 'input',
544
- dataType: 'number',
545
- defaultValue: 5,
546
- },
547
- {
548
- id: 'duration',
549
- name: 'Duration',
550
- direction: 'input',
551
- dataType: 'number',
552
- defaultValue: 0.3,
553
- },
554
- { id: 'out', name: '', direction: 'output', dataType: 'flow' },
555
- ],
556
- execute: (_inputs, ctx) => {
557
- ctx.triggerFlow('out');
558
- },
559
- });
560
- library.register({
561
- type: 'print',
562
- name: 'Print',
563
- category: 'flow',
564
- description: 'Log a value to the console.',
565
- color: '#fab387',
566
- ports: [
567
- { id: 'in', name: '', direction: 'input', dataType: 'flow' },
568
- { id: 'message', name: 'Message', direction: 'input', dataType: 'any' },
569
- { id: 'out', name: '', direction: 'output', dataType: 'flow' },
570
- ],
571
- execute: (inputs, ctx) => {
572
- ctx.events.emit('script:log', inputs.message);
573
- ctx.triggerFlow('out');
574
- },
575
- });
576
- }
577
- /* ── Helper: Create a default library with all built-in nodes ── */
578
555
  function createDefaultNodeLibrary() {
579
- const lib = new NodeLibrary();
580
- registerBuiltInNodes(lib);
581
- return lib;
556
+ const lib = new NodeLibrary();
557
+ registerBuiltInNodes(lib);
558
+ return lib;
582
559
  }
583
-
584
- export { GraphExecutor, NodeLibrary, createDefaultNodeLibrary, registerBuiltInNodes };
560
+ export {
561
+ GraphExecutor,
562
+ NodeLibrary,
563
+ createDefaultNodeLibrary,
564
+ registerBuiltInNodes
565
+ };