@nice2dev/game-engine 1.3.15 → 1.3.17
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.
- package/CHANGELOG.md +13 -0
- package/dist/cjs/accessibility/Accessibility.js +152 -165
- package/dist/cjs/ai/AI.js +292 -294
- package/dist/cjs/ai/BehaviorTree.js +1029 -1113
- package/dist/cjs/ai/StateMachine.js +694 -756
- package/dist/cjs/animation/Animation.js +232 -241
- package/dist/cjs/audio/AudioAdvanced.js +221 -236
- package/dist/cjs/audio/AudioBridge.js +441 -435
- package/dist/cjs/audio/AudioManager.js +242 -259
- package/dist/cjs/build-cloud/BuildOrchestration.js +1059 -1098
- package/dist/cjs/build-cloud/GodotBuildCloud.js +641 -670
- package/dist/cjs/build-cloud/UnityBuildCloud.js +563 -610
- package/dist/cjs/build-cloud/UnrealBuildCloud.js +610 -635
- package/dist/cjs/core/EventBus.js +51 -56
- package/dist/cjs/core/GameClock.js +62 -66
- package/dist/cjs/core/GameConfig.js +72 -79
- package/dist/cjs/core/GameLoop.js +80 -89
- package/dist/cjs/core/ServiceLocator.js +61 -65
- package/dist/cjs/core/Validation.js +72 -82
- package/dist/cjs/core/math.js +108 -112
- package/dist/cjs/devtools/DevTools.js +542 -563
- package/dist/cjs/devtools/DeveloperExperience.js +521 -559
- package/dist/cjs/devtools/GameplayAnalytics.js +636 -646
- package/dist/cjs/dialogue/DialogueSystem.js +984 -986
- package/dist/cjs/docs/DocGenerator.js +339 -364
- package/dist/cjs/ecs/World.js +355 -371
- package/dist/cjs/editor/AchievementEditor.js +580 -636
- package/dist/cjs/editor/AdvancedEditor.js +184 -191
- package/dist/cjs/editor/AnimationRetargeting.js +696 -741
- package/dist/cjs/editor/AssetBrowser.js +1072 -1160
- package/dist/cjs/editor/AssetManager.js +187 -192
- package/dist/cjs/editor/ConsolePro.js +971 -1061
- package/dist/cjs/editor/CraftingEditor.js +680 -730
- package/dist/cjs/editor/DebugTools.js +187 -185
- package/dist/cjs/editor/DialogueSystem.js +844 -901
- package/dist/cjs/editor/LeaderboardSystem.js +429 -483
- package/dist/cjs/editor/NiceGameEditor.js +1903 -1201
- package/dist/cjs/editor/PrefabSystem.js +772 -838
- package/dist/cjs/editor/ProfilerPanel.js +649 -700
- package/dist/cjs/editor/QuestEditor.js +792 -839
- package/dist/cjs/editor/ReplaySystem.js +585 -634
- package/dist/cjs/editor/SceneEditor.js +176 -200
- package/dist/cjs/editor/ScreenshotMode.js +621 -688
- package/dist/cjs/editor/ShaderGraph.js +1556 -1582
- package/dist/cjs/editor/TimelineEditor.js +715 -778
- package/dist/cjs/editor/UndoRedoPro.js +830 -904
- package/dist/cjs/editor/VRARMode.js +582 -645
- package/dist/cjs/engine/NiceGameEngine.js +141 -164
- package/dist/cjs/engine/SaveSystem.js +441 -495
- package/dist/cjs/enterprise/Enterprise.js +254 -261
- package/dist/cjs/export/BevyExporter.js +927 -967
- package/dist/cjs/export/CocosExporter.js +644 -673
- package/dist/cjs/export/Construct3Exporter.js +783 -794
- package/dist/cjs/export/DefoldExporter.js +1028 -1069
- package/dist/cjs/export/GDevelopExporter.js +674 -708
- package/dist/cjs/export/GameMakerExporter.js +791 -805
- package/dist/cjs/export/GodotExporter.js +1003 -1045
- package/dist/cjs/export/MinecraftBedrockExporter.js +573 -578
- package/dist/cjs/export/MonoGameExporter.js +1265 -1293
- package/dist/cjs/export/Pico8Exporter.js +766 -812
- package/dist/cjs/export/PlatformExporter.js +188 -206
- package/dist/cjs/export/RPGMakerExporter.js +860 -879
- package/dist/cjs/export/RobloxExporter.js +883 -919
- package/dist/cjs/export/Solar2DExporter.js +1218 -1256
- package/dist/cjs/export/ThreeJSExporter.js +1006 -1073
- package/dist/cjs/export/Tic80Exporter.js +1210 -1267
- package/dist/cjs/export/UnityExporter.js +1116 -1131
- package/dist/cjs/export/UnrealExporter.js +889 -919
- package/dist/cjs/export/WebExporter.js +931 -970
- package/dist/cjs/export/index.js +42 -65
- package/dist/cjs/godot-integration/GodotAssetLibrary.js +659 -692
- package/dist/cjs/godot-integration/GodotImport.js +929 -1027
- package/dist/cjs/godot-integration/GodotLiveLink.js +915 -945
- package/dist/cjs/godot-integration/components/GodotProjectBrowser.js +911 -611
- package/dist/cjs/i18n/I18n.js +860 -900
- package/dist/cjs/i18n/useTranslation.js +84 -89
- package/dist/cjs/import/AsepriteImporter.js +658 -716
- package/dist/cjs/import/DragonBonesImporter.js +437 -461
- package/dist/cjs/import/GameMakerImporter.js +511 -521
- package/dist/cjs/import/GodotSceneImporter.js +788 -822
- package/dist/cjs/import/LDtkImporter.js +436 -454
- package/dist/cjs/import/Live2DImporter.js +497 -518
- package/dist/cjs/import/NdgFormat.js +424 -457
- package/dist/cjs/import/OgmoImporter.js +466 -493
- package/dist/cjs/import/RPGMakerImporter.js +451 -477
- package/dist/cjs/import/SceneImporter.js +378 -423
- package/dist/cjs/import/SpineImporter.js +511 -546
- package/dist/cjs/import/SpriterImporter.js +590 -613
- package/dist/cjs/import/TiledMapImporter.js +811 -846
- package/dist/cjs/import/UnitySceneImporter.js +687 -703
- package/dist/cjs/import/index.js +206 -251
- package/dist/cjs/index.js +275 -278
- package/dist/cjs/input/GamepadNavigation.js +185 -205
- package/dist/cjs/input/InputManager.js +397 -421
- package/dist/cjs/input/useGamepads.js +70 -81
- package/dist/cjs/integration/IconSprite.js +129 -256
- package/dist/cjs/inventory/InventorySystem.js +920 -995
- package/dist/cjs/kids/KidMode.js +997 -1022
- package/dist/cjs/kids/KidTools.js +570 -594
- package/dist/cjs/monetization/Monetization.js +170 -177
- package/dist/cjs/multiplayer/LocalMultiplayer.js +287 -287
- package/dist/cjs/multiplayer/MiniGameTypes.js +49 -59
- package/dist/cjs/native-engine/AnimationSystem.js +731 -806
- package/dist/cjs/native-engine/AssetPipeline.js +454 -515
- package/dist/cjs/native-engine/AudioEngine.js +763 -804
- package/dist/cjs/native-engine/InputSystem.js +1075 -1145
- package/dist/cjs/native-engine/NetworkingSystem.js +733 -793
- package/dist/cjs/native-engine/PhysicsEngine.js +583 -607
- package/dist/cjs/native-engine/RenderingEngine.js +302 -350
- package/dist/cjs/native-engine/SceneGraph.js +769 -808
- package/dist/cjs/network/MultiplayerTransport.js +97 -132
- package/dist/cjs/network/Networking.js +549 -564
- package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/AbortController.js +21 -29
- package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/AccessTokenHttpClient.js +40 -48
- package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/DefaultHttpClient.js +35 -43
- package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/DefaultReconnectPolicy.js +10 -15
- package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/Errors.js +103 -135
- package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/FetchHttpClient.js +131 -158
- package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/HandshakeProtocol.js +39 -53
- package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/HeaderNames.js +5 -8
- package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/HttpClient.js +40 -48
- package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/HttpConnection.js +494 -572
- package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/HubConnection.js +826 -953
- package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/HubConnectionBuilder.js +125 -146
- package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/IHubProtocol.js +13 -23
- package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/ILogger.js +11 -25
- package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/ITransport.js +13 -24
- package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/JsonHubProtocol.js +108 -121
- package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/Loggers.js +10 -14
- package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/LongPollingTransport.js +150 -185
- package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/MessageBuffer.js +158 -196
- package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/ServerSentEventsTransport.js +90 -105
- package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/Subject.js +30 -35
- package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/TextMessageFormat.js +16 -21
- package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/Utils.js +215 -248
- package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/WebSocketTransport.js +135 -157
- package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/XhrHttpClient.js +76 -85
- package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/index.js +24 -27
- package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/pkg-version.js +3 -4
- package/dist/cjs/pathfinding/Pathfinding.js +245 -263
- package/dist/cjs/performance/AssetStreaming.js +561 -635
- package/dist/cjs/performance/BenchmarkSuite.js +283 -311
- package/dist/cjs/performance/DeltaCompression.js +467 -526
- package/dist/cjs/performance/DeterministicPhysics.js +450 -498
- package/dist/cjs/performance/ECSOptimization.js +644 -695
- package/dist/cjs/performance/GameSaveSystem.js +509 -556
- package/dist/cjs/performance/HotReload.js +447 -500
- package/dist/cjs/performance/InputRecording.js +511 -561
- package/dist/cjs/performance/InterestManagement.js +453 -500
- package/dist/cjs/performance/LocalizationRuntime.js +376 -423
- package/dist/cjs/performance/MemoryManagement.js +410 -470
- package/dist/cjs/performance/ModSupport.js +445 -496
- package/dist/cjs/performance/MultiThreadedPhysics.js +400 -443
- package/dist/cjs/performance/NetworkPrediction.js +424 -482
- package/dist/cjs/performance/ObjectPooling.js +569 -617
- package/dist/cjs/performance/Performance.js +174 -190
- package/dist/cjs/performance/PerformanceAdvanced.js +614 -637
- package/dist/cjs/performance/WebGPURenderer.js +656 -683
- package/dist/cjs/physics/PhysicsAdvanced.js +345 -379
- package/dist/cjs/physics/PhysicsEngine2D.js +391 -427
- package/dist/cjs/plugins/PluginSDK.js +432 -466
- package/dist/cjs/plugins/PluginTestKit.js +307 -330
- package/dist/cjs/procedural/Procedural.js +243 -254
- package/dist/cjs/procedural/WorldBuilding.js +297 -314
- package/dist/cjs/quest/QuestSystem.js +975 -932
- package/dist/cjs/release/MobileExport.js +157 -163
- package/dist/cjs/release/Release.js +225 -238
- package/dist/cjs/rendering/Camera2D.js +121 -124
- package/dist/cjs/rendering/Renderer2D.js +321 -335
- package/dist/cjs/rendering/WebGPURenderPipeline.js +632 -651
- package/dist/cjs/runtime3d/Runtime3D.js +359 -378
- package/dist/cjs/runtime3d/SceneEditor3D.js +252 -263
- package/dist/cjs/scene/SceneManager.js +177 -193
- package/dist/cjs/scripting/GraphToAST.js +574 -547
- package/dist/cjs/scripting/LanguageExporter.js +254 -279
- package/dist/cjs/scripting/NodeGraph.js +546 -570
- package/dist/cjs/scripting/ScriptAST.js +31 -39
- package/dist/cjs/scripting/VisualScripting2.js +1016 -1065
- package/dist/cjs/scripting/exporters/CSharpExporter.js +464 -496
- package/dist/cjs/scripting/exporters/GDScriptExporter.js +390 -442
- package/dist/cjs/scripting/exporters/LuaExporter.js +406 -447
- package/dist/cjs/scripting/exporters/PythonExporter.js +484 -549
- package/dist/cjs/scripting/exporters/RustExporter.js +459 -512
- package/dist/cjs/scripting/exporters/TypeScriptExporter.js +505 -556
- package/dist/cjs/social/Social.js +72 -80
- package/dist/cjs/systems/LightingSystem.js +844 -931
- package/dist/cjs/systems/ParticleSystem2.js +1447 -1451
- package/dist/cjs/systems/PhysicsDebugSystem.js +1070 -1141
- package/dist/cjs/systems/TerrainSystem.js +985 -1098
- package/dist/cjs/templates/ActionTemplates.js +296 -309
- package/dist/cjs/templates/FightingTemplate.js +417 -463
- package/dist/cjs/templates/MetroidvaniaTemplate.js +353 -405
- package/dist/cjs/templates/PartyTemplates.js +190 -202
- package/dist/cjs/templates/PuzzleTemplates.js +245 -261
- package/dist/cjs/templates/RPGTemplates.js +160 -178
- package/dist/cjs/templates/SportsTemplates.js +237 -250
- package/dist/cjs/templates/StrategyTemplates.js +143 -153
- package/dist/cjs/templates/SurvivalTemplate.js +336 -380
- package/dist/cjs/templates/WaveDefense.js +499 -526
- package/dist/cjs/tilemap/Tilemap.js +207 -214
- package/dist/cjs/tutorials/TutorialBranching.js +396 -417
- package/dist/cjs/tutorials/TutorialEngine.js +888 -931
- package/dist/cjs/tutorials/TutorialOverlay.js +602 -640
- package/dist/cjs/tutorials/content/Tutorials_T05_T08.js +787 -809
- package/dist/cjs/tutorials/content/Tutorials_T09_T11.js +736 -756
- package/dist/cjs/tutorials/content/Tutorials_T12_T15.js +754 -778
- package/dist/cjs/ui/GameUI.js +295 -312
- package/dist/cjs/unity-integration/UnityAssetStore.js +700 -741
- package/dist/cjs/unity-integration/UnityImport.js +1066 -1176
- package/dist/cjs/unity-integration/UnityLiveLink.js +934 -981
- package/dist/cjs/unity-integration/components/UnityAssetStoreBrowser.js +1233 -757
- package/dist/cjs/unity-integration/components/UnityProjectBrowser.js +1240 -768
- package/dist/cjs/unreal-integration/UnrealImport.js +391 -412
- package/dist/cjs/unreal-integration/UnrealLiveLink.js +1102 -1137
- package/dist/cjs/unreal-integration/UnrealMarketplace.js +436 -473
- package/dist/cjs/unreal-integration/components/UnrealProjectBrowser.js +1150 -767
- package/dist/cjs/xr/ARVR.js +167 -175
- package/dist/esm/accessibility/Accessibility.js +160 -164
- package/dist/esm/ai/AI.js +310 -293
- package/dist/esm/ai/BehaviorTree.js +1057 -1112
- package/dist/esm/ai/StateMachine.js +709 -755
- package/dist/esm/animation/Animation.js +237 -240
- package/dist/esm/audio/AudioAdvanced.js +239 -235
- package/dist/esm/audio/AudioBridge.js +448 -434
- package/dist/esm/audio/AudioManager.js +243 -258
- package/dist/esm/build-cloud/BuildOrchestration.js +1071 -1097
- package/dist/esm/build-cloud/GodotBuildCloud.js +647 -669
- package/dist/esm/build-cloud/UnityBuildCloud.js +571 -609
- package/dist/esm/build-cloud/UnrealBuildCloud.js +615 -634
- package/dist/esm/core/EventBus.js +52 -55
- package/dist/esm/core/GameClock.js +63 -65
- package/dist/esm/core/GameConfig.js +77 -78
- package/dist/esm/core/GameLoop.js +81 -88
- package/dist/esm/core/ServiceLocator.js +63 -64
- package/dist/esm/core/Validation.js +82 -81
- package/dist/esm/core/math.js +109 -111
- package/dist/esm/devtools/DevTools.js +546 -562
- package/dist/esm/devtools/DeveloperExperience.js +535 -558
- package/dist/esm/devtools/GameplayAnalytics.js +647 -645
- package/dist/esm/dialogue/DialogueSystem.js +998 -985
- package/dist/esm/docs/DocGenerator.js +342 -363
- package/dist/esm/ecs/World.js +358 -370
- package/dist/esm/editor/AchievementEditor.js +584 -635
- package/dist/esm/editor/AdvancedEditor.js +191 -190
- package/dist/esm/editor/AnimationRetargeting.js +700 -740
- package/dist/esm/editor/AssetBrowser.js +1078 -1159
- package/dist/esm/editor/AssetManager.js +188 -191
- package/dist/esm/editor/ConsolePro.js +977 -1060
- package/dist/esm/editor/CraftingEditor.js +684 -729
- package/dist/esm/editor/DebugTools.js +194 -184
- package/dist/esm/editor/DialogueSystem.js +849 -900
- package/dist/esm/editor/LeaderboardSystem.js +433 -482
- package/dist/esm/editor/NiceGameEditor.js +1908 -1200
- package/dist/esm/editor/PrefabSystem.js +777 -837
- package/dist/esm/editor/ProfilerPanel.js +654 -699
- package/dist/esm/editor/QuestEditor.js +795 -838
- package/dist/esm/editor/ReplaySystem.js +591 -633
- package/dist/esm/editor/SceneEditor.js +189 -199
- package/dist/esm/editor/ScreenshotMode.js +628 -687
- package/dist/esm/editor/ShaderGraph.js +1565 -1581
- package/dist/esm/editor/TimelineEditor.js +733 -777
- package/dist/esm/editor/UndoRedoPro.js +835 -903
- package/dist/esm/editor/VRARMode.js +586 -644
- package/dist/esm/engine/NiceGameEngine.js +142 -163
- package/dist/esm/engine/SaveSystem.js +447 -494
- package/dist/esm/enterprise/Enterprise.js +265 -260
- package/dist/esm/export/BevyExporter.js +929 -966
- package/dist/esm/export/CocosExporter.js +646 -672
- package/dist/esm/export/Construct3Exporter.js +785 -793
- package/dist/esm/export/DefoldExporter.js +1030 -1068
- package/dist/esm/export/GDevelopExporter.js +676 -707
- package/dist/esm/export/GameMakerExporter.js +793 -804
- package/dist/esm/export/GodotExporter.js +1004 -1044
- package/dist/esm/export/MinecraftBedrockExporter.js +575 -577
- package/dist/esm/export/MonoGameExporter.js +1267 -1292
- package/dist/esm/export/Pico8Exporter.js +768 -811
- package/dist/esm/export/PlatformExporter.js +193 -205
- package/dist/esm/export/RPGMakerExporter.js +862 -878
- package/dist/esm/export/RobloxExporter.js +885 -918
- package/dist/esm/export/Solar2DExporter.js +1220 -1255
- package/dist/esm/export/ThreeJSExporter.js +1007 -1072
- package/dist/esm/export/Tic80Exporter.js +1212 -1266
- package/dist/esm/export/UnityExporter.js +1117 -1130
- package/dist/esm/export/UnrealExporter.js +891 -918
- package/dist/esm/export/WebExporter.js +933 -969
- package/dist/esm/export/index.js +86 -71
- package/dist/esm/godot-integration/GodotAssetLibrary.js +663 -691
- package/dist/esm/godot-integration/GodotImport.js +935 -1026
- package/dist/esm/godot-integration/GodotLiveLink.js +918 -944
- package/dist/esm/godot-integration/components/GodotProjectBrowser.js +912 -610
- package/dist/esm/i18n/I18n.js +871 -899
- package/dist/esm/i18n/useTranslation.js +88 -88
- package/dist/esm/import/AsepriteImporter.js +637 -715
- package/dist/esm/import/DragonBonesImporter.js +417 -460
- package/dist/esm/import/GameMakerImporter.js +491 -520
- package/dist/esm/import/GodotSceneImporter.js +767 -821
- package/dist/esm/import/LDtkImporter.js +415 -453
- package/dist/esm/import/Live2DImporter.js +477 -517
- package/dist/esm/import/NdgFormat.js +410 -456
- package/dist/esm/import/OgmoImporter.js +446 -492
- package/dist/esm/import/RPGMakerImporter.js +431 -476
- package/dist/esm/import/SceneImporter.js +385 -422
- package/dist/esm/import/SpineImporter.js +491 -545
- package/dist/esm/import/SpriterImporter.js +570 -612
- package/dist/esm/import/TiledMapImporter.js +790 -845
- package/dist/esm/import/UnitySceneImporter.js +666 -702
- package/dist/esm/import/index.js +247 -258
- package/dist/esm/index.js +1332 -188
- package/dist/esm/input/GamepadNavigation.js +187 -204
- package/dist/esm/input/InputManager.js +401 -420
- package/dist/esm/input/useGamepads.js +72 -80
- package/dist/esm/integration/IconSprite.js +143 -255
- package/dist/esm/inventory/InventorySystem.js +925 -994
- package/dist/esm/kids/KidMode.js +1003 -1021
- package/dist/esm/kids/KidTools.js +573 -593
- package/dist/esm/monetization/Monetization.js +180 -176
- package/dist/esm/multiplayer/LocalMultiplayer.js +290 -286
- package/dist/esm/multiplayer/MiniGameTypes.js +58 -58
- package/dist/esm/native-engine/AnimationSystem.js +735 -805
- package/dist/esm/native-engine/AssetPipeline.js +456 -514
- package/dist/esm/native-engine/AudioEngine.js +765 -803
- package/dist/esm/native-engine/InputSystem.js +1079 -1144
- package/dist/esm/native-engine/NetworkingSystem.js +740 -792
- package/dist/esm/native-engine/PhysicsEngine.js +585 -606
- package/dist/esm/native-engine/RenderingEngine.js +304 -349
- package/dist/esm/native-engine/SceneGraph.js +773 -807
- package/dist/esm/network/MultiplayerTransport.js +99 -131
- package/dist/esm/network/Networking.js +556 -563
- package/dist/esm/node_modules/@microsoft/signalr/dist/esm/AbortController.js +22 -28
- package/dist/esm/node_modules/@microsoft/signalr/dist/esm/AccessTokenHttpClient.js +41 -47
- package/dist/esm/node_modules/@microsoft/signalr/dist/esm/DefaultHttpClient.js +36 -42
- package/dist/esm/node_modules/@microsoft/signalr/dist/esm/DefaultReconnectPolicy.js +11 -14
- package/dist/esm/node_modules/@microsoft/signalr/dist/esm/Errors.js +111 -134
- package/dist/esm/node_modules/@microsoft/signalr/dist/esm/FetchHttpClient.js +132 -157
- package/dist/esm/node_modules/@microsoft/signalr/dist/esm/HandshakeProtocol.js +40 -52
- package/dist/esm/node_modules/@microsoft/signalr/dist/esm/HeaderNames.js +6 -7
- package/dist/esm/node_modules/@microsoft/signalr/dist/esm/HttpClient.js +42 -47
- package/dist/esm/node_modules/@microsoft/signalr/dist/esm/HttpConnection.js +496 -571
- package/dist/esm/node_modules/@microsoft/signalr/dist/esm/HubConnection.js +828 -952
- package/dist/esm/node_modules/@microsoft/signalr/dist/esm/HubConnectionBuilder.js +126 -145
- package/dist/esm/node_modules/@microsoft/signalr/dist/esm/IHubProtocol.js +14 -23
- package/dist/esm/node_modules/@microsoft/signalr/dist/esm/ILogger.js +12 -25
- package/dist/esm/node_modules/@microsoft/signalr/dist/esm/ITransport.js +15 -24
- package/dist/esm/node_modules/@microsoft/signalr/dist/esm/JsonHubProtocol.js +109 -120
- package/dist/esm/node_modules/@microsoft/signalr/dist/esm/Loggers.js +11 -13
- package/dist/esm/node_modules/@microsoft/signalr/dist/esm/LongPollingTransport.js +151 -184
- package/dist/esm/node_modules/@microsoft/signalr/dist/esm/MessageBuffer.js +159 -195
- package/dist/esm/node_modules/@microsoft/signalr/dist/esm/ServerSentEventsTransport.js +91 -104
- package/dist/esm/node_modules/@microsoft/signalr/dist/esm/Subject.js +31 -34
- package/dist/esm/node_modules/@microsoft/signalr/dist/esm/TextMessageFormat.js +17 -20
- package/dist/esm/node_modules/@microsoft/signalr/dist/esm/Utils.js +230 -248
- package/dist/esm/node_modules/@microsoft/signalr/dist/esm/WebSocketTransport.js +136 -156
- package/dist/esm/node_modules/@microsoft/signalr/dist/esm/XhrHttpClient.js +77 -84
- package/dist/esm/node_modules/@microsoft/signalr/dist/esm/index.js +31 -12
- package/dist/esm/node_modules/@microsoft/signalr/dist/esm/pkg-version.js +4 -3
- package/dist/esm/pathfinding/Pathfinding.js +249 -262
- package/dist/esm/performance/AssetStreaming.js +567 -634
- package/dist/esm/performance/BenchmarkSuite.js +285 -310
- package/dist/esm/performance/DeltaCompression.js +478 -525
- package/dist/esm/performance/DeterministicPhysics.js +479 -497
- package/dist/esm/performance/ECSOptimization.js +653 -694
- package/dist/esm/performance/GameSaveSystem.js +515 -555
- package/dist/esm/performance/HotReload.js +454 -499
- package/dist/esm/performance/InputRecording.js +520 -560
- package/dist/esm/performance/InterestManagement.js +460 -499
- package/dist/esm/performance/LocalizationRuntime.js +382 -422
- package/dist/esm/performance/MemoryManagement.js +415 -469
- package/dist/esm/performance/ModSupport.js +455 -495
- package/dist/esm/performance/MultiThreadedPhysics.js +408 -442
- package/dist/esm/performance/NetworkPrediction.js +436 -481
- package/dist/esm/performance/ObjectPooling.js +582 -616
- package/dist/esm/performance/Performance.js +182 -189
- package/dist/esm/performance/PerformanceAdvanced.js +621 -636
- package/dist/esm/performance/WebGPURenderer.js +660 -682
- package/dist/esm/physics/PhysicsAdvanced.js +359 -378
- package/dist/esm/physics/PhysicsEngine2D.js +393 -426
- package/dist/esm/plugins/PluginSDK.js +435 -465
- package/dist/esm/plugins/PluginTestKit.js +315 -329
- package/dist/esm/procedural/Procedural.js +248 -253
- package/dist/esm/procedural/WorldBuilding.js +316 -313
- package/dist/esm/quest/QuestSystem.js +982 -931
- package/dist/esm/release/MobileExport.js +163 -162
- package/dist/esm/release/Release.js +234 -237
- package/dist/esm/rendering/Camera2D.js +122 -123
- package/dist/esm/rendering/Renderer2D.js +323 -334
- package/dist/esm/rendering/WebGPURenderPipeline.js +647 -650
- package/dist/esm/runtime3d/Runtime3D.js +368 -377
- package/dist/esm/runtime3d/SceneEditor3D.js +268 -262
- package/dist/esm/scene/SceneManager.js +178 -192
- package/dist/esm/scripting/GraphToAST.js +576 -546
- package/dist/esm/scripting/LanguageExporter.js +263 -278
- package/dist/esm/scripting/NodeGraph.js +550 -569
- package/dist/esm/scripting/ScriptAST.js +45 -38
- package/dist/esm/scripting/VisualScripting2.js +1025 -1064
- package/dist/esm/scripting/exporters/CSharpExporter.js +465 -495
- package/dist/esm/scripting/exporters/GDScriptExporter.js +391 -441
- package/dist/esm/scripting/exporters/LuaExporter.js +407 -446
- package/dist/esm/scripting/exporters/PythonExporter.js +485 -548
- package/dist/esm/scripting/exporters/RustExporter.js +460 -511
- package/dist/esm/scripting/exporters/TypeScriptExporter.js +506 -555
- package/dist/esm/social/Social.js +77 -79
- package/dist/esm/systems/LightingSystem.js +855 -930
- package/dist/esm/systems/ParticleSystem2.js +1453 -1450
- package/dist/esm/systems/PhysicsDebugSystem.js +1078 -1140
- package/dist/esm/systems/TerrainSystem.js +996 -1097
- package/dist/esm/templates/ActionTemplates.js +307 -308
- package/dist/esm/templates/FightingTemplate.js +439 -462
- package/dist/esm/templates/MetroidvaniaTemplate.js +391 -404
- package/dist/esm/templates/PartyTemplates.js +206 -201
- package/dist/esm/templates/PuzzleTemplates.js +260 -260
- package/dist/esm/templates/RPGTemplates.js +172 -177
- package/dist/esm/templates/SportsTemplates.js +251 -249
- package/dist/esm/templates/StrategyTemplates.js +158 -152
- package/dist/esm/templates/SurvivalTemplate.js +367 -379
- package/dist/esm/templates/WaveDefense.js +501 -525
- package/dist/esm/tilemap/Tilemap.js +209 -213
- package/dist/esm/tutorials/TutorialBranching.js +399 -416
- package/dist/esm/tutorials/TutorialEngine.js +893 -930
- package/dist/esm/tutorials/TutorialOverlay.js +603 -639
- package/dist/esm/tutorials/content/Tutorials_T05_T08.js +792 -808
- package/dist/esm/tutorials/content/Tutorials_T09_T11.js +740 -755
- package/dist/esm/tutorials/content/Tutorials_T12_T15.js +759 -777
- package/dist/esm/ui/GameUI.js +296 -311
- package/dist/esm/unity-integration/UnityAssetStore.js +704 -740
- package/dist/esm/unity-integration/UnityImport.js +1071 -1175
- package/dist/esm/unity-integration/UnityLiveLink.js +938 -980
- package/dist/esm/unity-integration/components/UnityAssetStoreBrowser.js +1234 -756
- package/dist/esm/unity-integration/components/UnityProjectBrowser.js +1241 -767
- package/dist/esm/unreal-integration/UnrealImport.js +395 -411
- package/dist/esm/unreal-integration/UnrealLiveLink.js +1105 -1136
- package/dist/esm/unreal-integration/UnrealMarketplace.js +442 -472
- package/dist/esm/unreal-integration/components/UnrealProjectBrowser.js +1151 -766
- package/dist/esm/xr/ARVR.js +181 -174
- package/package.json +7 -12
|
@@ -1,588 +1,564 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
/* ────────────────────────────────────────────────────────────────
|
|
6
|
-
Visual Scripting — Node Graph Framework
|
|
7
|
-
|
|
8
|
-
A no-code programming system using node-based visual graphs.
|
|
9
|
-
Nodes have typed ports, connections transport data between them.
|
|
10
|
-
──────────────────────────────────────────────────────────────── */
|
|
11
|
-
/* ── Node Library ─────────────────────────────────────────────── */
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const EventBus = require("../core/EventBus.js");
|
|
12
4
|
class NodeLibrary {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
5
|
+
constructor() {
|
|
6
|
+
this.defs = /* @__PURE__ */ new Map();
|
|
7
|
+
}
|
|
8
|
+
register(def) {
|
|
9
|
+
this.defs.set(def.type, def);
|
|
10
|
+
}
|
|
11
|
+
get(type) {
|
|
12
|
+
return this.defs.get(type);
|
|
13
|
+
}
|
|
14
|
+
getAll() {
|
|
15
|
+
return Array.from(this.defs.values());
|
|
16
|
+
}
|
|
17
|
+
getByCategory(category) {
|
|
18
|
+
return this.getAll().filter((d) => d.category === category);
|
|
19
|
+
}
|
|
20
|
+
search(query) {
|
|
21
|
+
const q = query.toLowerCase();
|
|
22
|
+
return this.getAll().filter(
|
|
23
|
+
(d) => d.name.toLowerCase().includes(q) || d.type.toLowerCase().includes(q) || d.description.toLowerCase().includes(q)
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
class GraphExecutor {
|
|
28
|
+
constructor(library) {
|
|
29
|
+
this.events = new EventBus.EventBus();
|
|
30
|
+
this.library = library;
|
|
31
|
+
}
|
|
32
|
+
/** Execute a graph starting from an entry node (e.g. "on_start", "on_update"). */
|
|
33
|
+
execute(graph, entryType, context) {
|
|
34
|
+
const entries = graph.nodes.filter((n) => n.type === entryType);
|
|
35
|
+
for (const entry of entries) {
|
|
36
|
+
this.executeNode(graph, entry, context);
|
|
18
37
|
}
|
|
19
|
-
|
|
20
|
-
|
|
38
|
+
}
|
|
39
|
+
executeNode(graph, node, context) {
|
|
40
|
+
const def = this.library.get(node.type);
|
|
41
|
+
if (!def) {
|
|
42
|
+
return;
|
|
21
43
|
}
|
|
22
|
-
|
|
23
|
-
|
|
44
|
+
const inputs = { ...node.inputValues };
|
|
45
|
+
for (const conn of graph.connections) {
|
|
46
|
+
if (conn.toNode === node.id) {
|
|
47
|
+
const fromNode = graph.nodes.find((n) => n.id === conn.fromNode);
|
|
48
|
+
if (fromNode) {
|
|
49
|
+
inputs[conn.toPort] = fromNode.outputValues[conn.fromPort];
|
|
50
|
+
}
|
|
51
|
+
}
|
|
24
52
|
}
|
|
25
|
-
|
|
26
|
-
|
|
53
|
+
const flowTargets = [];
|
|
54
|
+
const origTrigger = context.triggerFlow;
|
|
55
|
+
context.triggerFlow = (portId) => {
|
|
56
|
+
flowTargets.push(portId);
|
|
57
|
+
};
|
|
58
|
+
const outputs = def.execute(inputs, context);
|
|
59
|
+
if (outputs) {
|
|
60
|
+
node.outputValues = outputs;
|
|
27
61
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
62
|
+
for (const flowPort of flowTargets) {
|
|
63
|
+
const outConns = graph.connections.filter(
|
|
64
|
+
(c) => c.fromNode === node.id && c.fromPort === flowPort
|
|
65
|
+
);
|
|
66
|
+
for (const conn of outConns) {
|
|
67
|
+
const nextNode = graph.nodes.find((n) => n.id === conn.toNode);
|
|
68
|
+
if (nextNode) {
|
|
69
|
+
this.executeNode(graph, nextNode, context);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
33
72
|
}
|
|
73
|
+
context.triggerFlow = origTrigger;
|
|
74
|
+
}
|
|
34
75
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
76
|
+
function registerBuiltInNodes(library) {
|
|
77
|
+
library.register({
|
|
78
|
+
type: "event_start",
|
|
79
|
+
name: "On Start",
|
|
80
|
+
category: "flow",
|
|
81
|
+
description: "Fires once when the scene starts.",
|
|
82
|
+
color: "#e64553",
|
|
83
|
+
ports: [{ id: "out", name: "", direction: "output", dataType: "flow" }],
|
|
84
|
+
execute: (_inputs, ctx) => {
|
|
85
|
+
ctx.triggerFlow("out");
|
|
40
86
|
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
87
|
+
});
|
|
88
|
+
library.register({
|
|
89
|
+
type: "event_update",
|
|
90
|
+
name: "On Update",
|
|
91
|
+
category: "flow",
|
|
92
|
+
description: "Fires every frame.",
|
|
93
|
+
color: "#e64553",
|
|
94
|
+
ports: [
|
|
95
|
+
{ id: "out", name: "", direction: "output", dataType: "flow" },
|
|
96
|
+
{ id: "dt", name: "Delta Time", direction: "output", dataType: "number" }
|
|
97
|
+
],
|
|
98
|
+
execute: (_inputs, ctx) => {
|
|
99
|
+
ctx.triggerFlow("out");
|
|
100
|
+
return { dt: ctx.dt };
|
|
48
101
|
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
102
|
+
});
|
|
103
|
+
library.register({
|
|
104
|
+
type: "if_else",
|
|
105
|
+
name: "If / Else",
|
|
106
|
+
category: "flow",
|
|
107
|
+
description: "Branch based on condition.",
|
|
108
|
+
color: "#fab387",
|
|
109
|
+
ports: [
|
|
110
|
+
{ id: "in", name: "", direction: "input", dataType: "flow" },
|
|
111
|
+
{ id: "cond", name: "Condition", direction: "input", dataType: "boolean" },
|
|
112
|
+
{ id: "true", name: "True", direction: "output", dataType: "flow" },
|
|
113
|
+
{ id: "false", name: "False", direction: "output", dataType: "flow" }
|
|
114
|
+
],
|
|
115
|
+
execute: (inputs, ctx) => {
|
|
116
|
+
ctx.triggerFlow(inputs.cond ? "true" : "false");
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
library.register({
|
|
120
|
+
type: "delay",
|
|
121
|
+
name: "Delay",
|
|
122
|
+
category: "flow",
|
|
123
|
+
description: "Wait for a duration then continue.",
|
|
124
|
+
color: "#fab387",
|
|
125
|
+
ports: [
|
|
126
|
+
{ id: "in", name: "", direction: "input", dataType: "flow" },
|
|
127
|
+
{ id: "seconds", name: "Seconds", direction: "input", dataType: "number", defaultValue: 1 },
|
|
128
|
+
{ id: "out", name: "", direction: "output", dataType: "flow" }
|
|
129
|
+
],
|
|
130
|
+
execute: (inputs, ctx) => {
|
|
131
|
+
ctx.triggerFlow("out");
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
library.register({
|
|
135
|
+
type: "sequence",
|
|
136
|
+
name: "Sequence",
|
|
137
|
+
category: "flow",
|
|
138
|
+
description: "Execute outputs in order.",
|
|
139
|
+
color: "#fab387",
|
|
140
|
+
ports: [
|
|
141
|
+
{ id: "in", name: "", direction: "input", dataType: "flow" },
|
|
142
|
+
{ id: "out1", name: "1", direction: "output", dataType: "flow" },
|
|
143
|
+
{ id: "out2", name: "2", direction: "output", dataType: "flow" },
|
|
144
|
+
{ id: "out3", name: "3", direction: "output", dataType: "flow" }
|
|
145
|
+
],
|
|
146
|
+
execute: (_inputs, ctx) => {
|
|
147
|
+
ctx.triggerFlow("out1");
|
|
148
|
+
ctx.triggerFlow("out2");
|
|
149
|
+
ctx.triggerFlow("out3");
|
|
150
|
+
}
|
|
151
|
+
});
|
|
152
|
+
library.register({
|
|
153
|
+
type: "math_add",
|
|
154
|
+
name: "Add",
|
|
155
|
+
category: "math",
|
|
156
|
+
description: "A + B",
|
|
157
|
+
color: "#89b4fa",
|
|
158
|
+
ports: [
|
|
159
|
+
{ id: "a", name: "A", direction: "input", dataType: "number", defaultValue: 0 },
|
|
160
|
+
{ id: "b", name: "B", direction: "input", dataType: "number", defaultValue: 0 },
|
|
161
|
+
{ id: "result", name: "Result", direction: "output", dataType: "number" }
|
|
162
|
+
],
|
|
163
|
+
execute: (inputs) => ({ result: inputs.a + inputs.b })
|
|
164
|
+
});
|
|
165
|
+
library.register({
|
|
166
|
+
type: "math_sub",
|
|
167
|
+
name: "Subtract",
|
|
168
|
+
category: "math",
|
|
169
|
+
description: "A - B",
|
|
170
|
+
color: "#89b4fa",
|
|
171
|
+
ports: [
|
|
172
|
+
{ id: "a", name: "A", direction: "input", dataType: "number", defaultValue: 0 },
|
|
173
|
+
{ id: "b", name: "B", direction: "input", dataType: "number", defaultValue: 0 },
|
|
174
|
+
{ id: "result", name: "Result", direction: "output", dataType: "number" }
|
|
175
|
+
],
|
|
176
|
+
execute: (inputs) => ({ result: inputs.a - inputs.b })
|
|
177
|
+
});
|
|
178
|
+
library.register({
|
|
179
|
+
type: "math_mul",
|
|
180
|
+
name: "Multiply",
|
|
181
|
+
category: "math",
|
|
182
|
+
description: "A × B",
|
|
183
|
+
color: "#89b4fa",
|
|
184
|
+
ports: [
|
|
185
|
+
{ id: "a", name: "A", direction: "input", dataType: "number", defaultValue: 0 },
|
|
186
|
+
{ id: "b", name: "B", direction: "input", dataType: "number", defaultValue: 1 },
|
|
187
|
+
{ id: "result", name: "Result", direction: "output", dataType: "number" }
|
|
188
|
+
],
|
|
189
|
+
execute: (inputs) => ({ result: inputs.a * inputs.b })
|
|
190
|
+
});
|
|
191
|
+
library.register({
|
|
192
|
+
type: "math_div",
|
|
193
|
+
name: "Divide",
|
|
194
|
+
category: "math",
|
|
195
|
+
description: "A ÷ B",
|
|
196
|
+
color: "#89b4fa",
|
|
197
|
+
ports: [
|
|
198
|
+
{ id: "a", name: "A", direction: "input", dataType: "number", defaultValue: 0 },
|
|
199
|
+
{ id: "b", name: "B", direction: "input", dataType: "number", defaultValue: 1 },
|
|
200
|
+
{ id: "result", name: "Result", direction: "output", dataType: "number" }
|
|
201
|
+
],
|
|
202
|
+
execute: (inputs) => {
|
|
203
|
+
const b = inputs.b;
|
|
204
|
+
return { result: b !== 0 ? inputs.a / b : 0 };
|
|
205
|
+
}
|
|
206
|
+
});
|
|
207
|
+
library.register({
|
|
208
|
+
type: "math_random",
|
|
209
|
+
name: "Random",
|
|
210
|
+
category: "math",
|
|
211
|
+
description: "Random number between min and max.",
|
|
212
|
+
color: "#89b4fa",
|
|
213
|
+
ports: [
|
|
214
|
+
{ id: "min", name: "Min", direction: "input", dataType: "number", defaultValue: 0 },
|
|
215
|
+
{ id: "max", name: "Max", direction: "input", dataType: "number", defaultValue: 1 },
|
|
216
|
+
{ id: "result", name: "Result", direction: "output", dataType: "number" }
|
|
217
|
+
],
|
|
218
|
+
execute: (inputs) => {
|
|
219
|
+
const min = inputs.min;
|
|
220
|
+
const max = inputs.max;
|
|
221
|
+
return { result: min + Math.random() * (max - min) };
|
|
222
|
+
}
|
|
223
|
+
});
|
|
224
|
+
library.register({
|
|
225
|
+
type: "compare_eq",
|
|
226
|
+
name: "Equals",
|
|
227
|
+
category: "logic",
|
|
228
|
+
description: "A == B",
|
|
229
|
+
color: "#a6e3a1",
|
|
230
|
+
ports: [
|
|
231
|
+
{ id: "a", name: "A", direction: "input", dataType: "any" },
|
|
232
|
+
{ id: "b", name: "B", direction: "input", dataType: "any" },
|
|
233
|
+
{ id: "result", name: "Result", direction: "output", dataType: "boolean" }
|
|
234
|
+
],
|
|
235
|
+
execute: (inputs) => ({ result: inputs.a === inputs.b })
|
|
236
|
+
});
|
|
237
|
+
library.register({
|
|
238
|
+
type: "compare_gt",
|
|
239
|
+
name: "Greater Than",
|
|
240
|
+
category: "logic",
|
|
241
|
+
description: "A > B",
|
|
242
|
+
color: "#a6e3a1",
|
|
243
|
+
ports: [
|
|
244
|
+
{ id: "a", name: "A", direction: "input", dataType: "number", defaultValue: 0 },
|
|
245
|
+
{ id: "b", name: "B", direction: "input", dataType: "number", defaultValue: 0 },
|
|
246
|
+
{ id: "result", name: "Result", direction: "output", dataType: "boolean" }
|
|
247
|
+
],
|
|
248
|
+
execute: (inputs) => ({ result: inputs.a > inputs.b })
|
|
249
|
+
});
|
|
250
|
+
library.register({
|
|
251
|
+
type: "compare_lt",
|
|
252
|
+
name: "Less Than",
|
|
253
|
+
category: "logic",
|
|
254
|
+
description: "A < B",
|
|
255
|
+
color: "#a6e3a1",
|
|
256
|
+
ports: [
|
|
257
|
+
{ id: "a", name: "A", direction: "input", dataType: "number", defaultValue: 0 },
|
|
258
|
+
{ id: "b", name: "B", direction: "input", dataType: "number", defaultValue: 0 },
|
|
259
|
+
{ id: "result", name: "Result", direction: "output", dataType: "boolean" }
|
|
260
|
+
],
|
|
261
|
+
execute: (inputs) => ({ result: inputs.a < inputs.b })
|
|
262
|
+
});
|
|
263
|
+
library.register({
|
|
264
|
+
type: "logic_and",
|
|
265
|
+
name: "And",
|
|
266
|
+
category: "logic",
|
|
267
|
+
description: "A AND B",
|
|
268
|
+
color: "#a6e3a1",
|
|
269
|
+
ports: [
|
|
270
|
+
{ id: "a", name: "A", direction: "input", dataType: "boolean" },
|
|
271
|
+
{ id: "b", name: "B", direction: "input", dataType: "boolean" },
|
|
272
|
+
{ id: "result", name: "Result", direction: "output", dataType: "boolean" }
|
|
273
|
+
],
|
|
274
|
+
execute: (inputs) => ({ result: !!(inputs.a && inputs.b) })
|
|
275
|
+
});
|
|
276
|
+
library.register({
|
|
277
|
+
type: "logic_or",
|
|
278
|
+
name: "Or",
|
|
279
|
+
category: "logic",
|
|
280
|
+
description: "A OR B",
|
|
281
|
+
color: "#a6e3a1",
|
|
282
|
+
ports: [
|
|
283
|
+
{ id: "a", name: "A", direction: "input", dataType: "boolean" },
|
|
284
|
+
{ id: "b", name: "B", direction: "input", dataType: "boolean" },
|
|
285
|
+
{ id: "result", name: "Result", direction: "output", dataType: "boolean" }
|
|
286
|
+
],
|
|
287
|
+
execute: (inputs) => ({ result: !!(inputs.a || inputs.b) })
|
|
288
|
+
});
|
|
289
|
+
library.register({
|
|
290
|
+
type: "logic_not",
|
|
291
|
+
name: "Not",
|
|
292
|
+
category: "logic",
|
|
293
|
+
description: "NOT A",
|
|
294
|
+
color: "#a6e3a1",
|
|
295
|
+
ports: [
|
|
296
|
+
{ id: "a", name: "A", direction: "input", dataType: "boolean" },
|
|
297
|
+
{ id: "result", name: "Result", direction: "output", dataType: "boolean" }
|
|
298
|
+
],
|
|
299
|
+
execute: (inputs) => ({ result: !inputs.a })
|
|
300
|
+
});
|
|
301
|
+
library.register({
|
|
302
|
+
type: "input_action",
|
|
303
|
+
name: "Input Action",
|
|
304
|
+
category: "input",
|
|
305
|
+
description: "Read an input action value.",
|
|
306
|
+
color: "#f9e2af",
|
|
307
|
+
ports: [
|
|
308
|
+
{
|
|
309
|
+
id: "action",
|
|
310
|
+
name: "Action",
|
|
311
|
+
direction: "input",
|
|
312
|
+
dataType: "string",
|
|
313
|
+
defaultValue: "moveX"
|
|
314
|
+
},
|
|
315
|
+
{ id: "pressed", name: "Pressed", direction: "output", dataType: "boolean" },
|
|
316
|
+
{ id: "value", name: "Value", direction: "output", dataType: "number" }
|
|
317
|
+
],
|
|
318
|
+
execute: (_inputs, ctx) => {
|
|
319
|
+
const actionName = _inputs.action ?? "moveX";
|
|
320
|
+
const input = ctx.services["input"];
|
|
321
|
+
if (input?.getAction) {
|
|
322
|
+
const state = input.getAction(actionName);
|
|
323
|
+
return { pressed: state.pressed, value: state.value };
|
|
324
|
+
}
|
|
325
|
+
return { pressed: false, value: 0 };
|
|
326
|
+
}
|
|
327
|
+
});
|
|
328
|
+
library.register({
|
|
329
|
+
type: "play_sound",
|
|
330
|
+
name: "Play Sound",
|
|
331
|
+
category: "audio",
|
|
332
|
+
description: "Play a sound effect.",
|
|
333
|
+
color: "#cba6f7",
|
|
334
|
+
ports: [
|
|
335
|
+
{ id: "in", name: "", direction: "input", dataType: "flow" },
|
|
336
|
+
{ id: "soundId", name: "Sound", direction: "input", dataType: "string" },
|
|
337
|
+
{ id: "volume", name: "Volume", direction: "input", dataType: "number", defaultValue: 1 },
|
|
338
|
+
{ id: "out", name: "", direction: "output", dataType: "flow" }
|
|
339
|
+
],
|
|
340
|
+
execute: (_inputs, ctx) => {
|
|
341
|
+
const audio = ctx.services["audio"];
|
|
342
|
+
if (audio?.play) {
|
|
343
|
+
audio.play(_inputs.soundId, { volume: _inputs.volume ?? 1 });
|
|
344
|
+
}
|
|
345
|
+
ctx.triggerFlow("out");
|
|
346
|
+
}
|
|
347
|
+
});
|
|
348
|
+
library.register({
|
|
349
|
+
type: "get_position",
|
|
350
|
+
name: "Get Position",
|
|
351
|
+
category: "entity",
|
|
352
|
+
description: "Get entity position.",
|
|
353
|
+
color: "#74c7ec",
|
|
354
|
+
ports: [
|
|
355
|
+
{ id: "entity", name: "Entity", direction: "input", dataType: "entity" },
|
|
356
|
+
{ id: "x", name: "X", direction: "output", dataType: "number" },
|
|
357
|
+
{ id: "y", name: "Y", direction: "output", dataType: "number" }
|
|
358
|
+
],
|
|
359
|
+
execute: (_inputs, ctx) => {
|
|
360
|
+
const world = ctx.world;
|
|
361
|
+
const eid = _inputs.entity ?? ctx.entityId;
|
|
362
|
+
if (world?.getComponent && eid != null) {
|
|
363
|
+
const t = world.getComponent(eid, "Transform");
|
|
364
|
+
if (t?.position) {
|
|
365
|
+
return { x: t.position.x, y: t.position.y };
|
|
74
366
|
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
367
|
+
}
|
|
368
|
+
return { x: 0, y: 0 };
|
|
369
|
+
}
|
|
370
|
+
});
|
|
371
|
+
library.register({
|
|
372
|
+
type: "set_position",
|
|
373
|
+
name: "Set Position",
|
|
374
|
+
category: "entity",
|
|
375
|
+
description: "Set entity position.",
|
|
376
|
+
color: "#74c7ec",
|
|
377
|
+
ports: [
|
|
378
|
+
{ id: "in", name: "", direction: "input", dataType: "flow" },
|
|
379
|
+
{ id: "entity", name: "Entity", direction: "input", dataType: "entity" },
|
|
380
|
+
{ id: "x", name: "X", direction: "input", dataType: "number", defaultValue: 0 },
|
|
381
|
+
{ id: "y", name: "Y", direction: "input", dataType: "number", defaultValue: 0 },
|
|
382
|
+
{ id: "out", name: "", direction: "output", dataType: "flow" }
|
|
383
|
+
],
|
|
384
|
+
execute: (_inputs, ctx) => {
|
|
385
|
+
const world = ctx.world;
|
|
386
|
+
const eid = _inputs.entity ?? ctx.entityId;
|
|
387
|
+
if (world?.getComponent && eid != null) {
|
|
388
|
+
const t = world.getComponent(eid, "Transform");
|
|
389
|
+
if (t?.position) {
|
|
390
|
+
t.position.x = _inputs.x ?? 0;
|
|
391
|
+
t.position.y = _inputs.y ?? 0;
|
|
84
392
|
}
|
|
85
|
-
|
|
393
|
+
}
|
|
394
|
+
ctx.triggerFlow("out");
|
|
86
395
|
}
|
|
396
|
+
});
|
|
397
|
+
library.register({
|
|
398
|
+
type: "spawn_entity",
|
|
399
|
+
name: "Spawn Entity",
|
|
400
|
+
category: "entity",
|
|
401
|
+
description: "Create a new entity from a prefab.",
|
|
402
|
+
color: "#74c7ec",
|
|
403
|
+
ports: [
|
|
404
|
+
{ id: "in", name: "", direction: "input", dataType: "flow" },
|
|
405
|
+
{ id: "prefab", name: "Prefab", direction: "input", dataType: "string" },
|
|
406
|
+
{ id: "x", name: "X", direction: "input", dataType: "number", defaultValue: 0 },
|
|
407
|
+
{ id: "y", name: "Y", direction: "input", dataType: "number", defaultValue: 0 },
|
|
408
|
+
{ id: "out", name: "", direction: "output", dataType: "flow" },
|
|
409
|
+
{ id: "entity", name: "Entity", direction: "output", dataType: "entity" }
|
|
410
|
+
],
|
|
411
|
+
execute: (_inputs, ctx) => {
|
|
412
|
+
ctx.triggerFlow("out");
|
|
413
|
+
return { entity: null };
|
|
414
|
+
}
|
|
415
|
+
});
|
|
416
|
+
library.register({
|
|
417
|
+
type: "destroy_entity",
|
|
418
|
+
name: "Destroy Entity",
|
|
419
|
+
category: "entity",
|
|
420
|
+
description: "Remove an entity from the world.",
|
|
421
|
+
color: "#74c7ec",
|
|
422
|
+
ports: [
|
|
423
|
+
{ id: "in", name: "", direction: "input", dataType: "flow" },
|
|
424
|
+
{ id: "entity", name: "Entity", direction: "input", dataType: "entity" },
|
|
425
|
+
{ id: "out", name: "", direction: "output", dataType: "flow" }
|
|
426
|
+
],
|
|
427
|
+
execute: (_inputs, ctx) => {
|
|
428
|
+
ctx.triggerFlow("out");
|
|
429
|
+
}
|
|
430
|
+
});
|
|
431
|
+
library.register({
|
|
432
|
+
type: "get_variable",
|
|
433
|
+
name: "Get Variable",
|
|
434
|
+
category: "variable",
|
|
435
|
+
description: "Read a variable value.",
|
|
436
|
+
color: "#94e2d5",
|
|
437
|
+
ports: [
|
|
438
|
+
{ id: "name", name: "Name", direction: "input", dataType: "string", defaultValue: "" },
|
|
439
|
+
{ id: "value", name: "Value", direction: "output", dataType: "any" }
|
|
440
|
+
],
|
|
441
|
+
execute: (inputs, ctx) => ({ value: ctx.variables[inputs.name ?? ""] })
|
|
442
|
+
});
|
|
443
|
+
library.register({
|
|
444
|
+
type: "set_variable",
|
|
445
|
+
name: "Set Variable",
|
|
446
|
+
category: "variable",
|
|
447
|
+
description: "Write a variable value.",
|
|
448
|
+
color: "#94e2d5",
|
|
449
|
+
ports: [
|
|
450
|
+
{ id: "in", name: "", direction: "input", dataType: "flow" },
|
|
451
|
+
{ id: "name", name: "Name", direction: "input", dataType: "string", defaultValue: "" },
|
|
452
|
+
{ id: "value", name: "Value", direction: "input", dataType: "any" },
|
|
453
|
+
{ id: "out", name: "", direction: "output", dataType: "flow" }
|
|
454
|
+
],
|
|
455
|
+
execute: (inputs, ctx) => {
|
|
456
|
+
const name = inputs.name;
|
|
457
|
+
if (name) {
|
|
458
|
+
ctx.variables[name] = inputs.value;
|
|
459
|
+
}
|
|
460
|
+
ctx.triggerFlow("out");
|
|
461
|
+
}
|
|
462
|
+
});
|
|
463
|
+
library.register({
|
|
464
|
+
type: "apply_force",
|
|
465
|
+
name: "Apply Force",
|
|
466
|
+
category: "physics",
|
|
467
|
+
description: "Apply a force to an entity.",
|
|
468
|
+
color: "#f38ba8",
|
|
469
|
+
ports: [
|
|
470
|
+
{ id: "in", name: "", direction: "input", dataType: "flow" },
|
|
471
|
+
{ id: "entity", name: "Entity", direction: "input", dataType: "entity" },
|
|
472
|
+
{ id: "x", name: "X", direction: "input", dataType: "number", defaultValue: 0 },
|
|
473
|
+
{ id: "y", name: "Y", direction: "input", dataType: "number", defaultValue: 0 },
|
|
474
|
+
{ id: "out", name: "", direction: "output", dataType: "flow" }
|
|
475
|
+
],
|
|
476
|
+
execute: (_inputs, ctx) => {
|
|
477
|
+
ctx.triggerFlow("out");
|
|
478
|
+
}
|
|
479
|
+
});
|
|
480
|
+
library.register({
|
|
481
|
+
type: "on_collision",
|
|
482
|
+
name: "On Collision",
|
|
483
|
+
category: "physics",
|
|
484
|
+
description: "Fires when entity collides with another.",
|
|
485
|
+
color: "#f38ba8",
|
|
486
|
+
ports: [
|
|
487
|
+
{ id: "out", name: "", direction: "output", dataType: "flow" },
|
|
488
|
+
{ id: "other", name: "Other", direction: "output", dataType: "entity" },
|
|
489
|
+
{ id: "normal_x", name: "Normal X", direction: "output", dataType: "number" },
|
|
490
|
+
{ id: "normal_y", name: "Normal Y", direction: "output", dataType: "number" }
|
|
491
|
+
],
|
|
492
|
+
execute: (_inputs, ctx) => {
|
|
493
|
+
ctx.triggerFlow("out");
|
|
494
|
+
return { other: null, normal_x: 0, normal_y: 0 };
|
|
495
|
+
}
|
|
496
|
+
});
|
|
497
|
+
library.register({
|
|
498
|
+
type: "load_scene",
|
|
499
|
+
name: "Load Scene",
|
|
500
|
+
category: "game",
|
|
501
|
+
description: "Load a scene by ID.",
|
|
502
|
+
color: "#eba0ac",
|
|
503
|
+
ports: [
|
|
504
|
+
{ id: "in", name: "", direction: "input", dataType: "flow" },
|
|
505
|
+
{ id: "sceneId", name: "Scene ID", direction: "input", dataType: "string" },
|
|
506
|
+
{ id: "out", name: "", direction: "output", dataType: "flow" }
|
|
507
|
+
],
|
|
508
|
+
execute: (_inputs, ctx) => {
|
|
509
|
+
ctx.triggerFlow("out");
|
|
510
|
+
}
|
|
511
|
+
});
|
|
512
|
+
library.register({
|
|
513
|
+
type: "camera_shake",
|
|
514
|
+
name: "Camera Shake",
|
|
515
|
+
category: "game",
|
|
516
|
+
description: "Shake the camera.",
|
|
517
|
+
color: "#eba0ac",
|
|
518
|
+
ports: [
|
|
519
|
+
{ id: "in", name: "", direction: "input", dataType: "flow" },
|
|
520
|
+
{
|
|
521
|
+
id: "intensity",
|
|
522
|
+
name: "Intensity",
|
|
523
|
+
direction: "input",
|
|
524
|
+
dataType: "number",
|
|
525
|
+
defaultValue: 5
|
|
526
|
+
},
|
|
527
|
+
{
|
|
528
|
+
id: "duration",
|
|
529
|
+
name: "Duration",
|
|
530
|
+
direction: "input",
|
|
531
|
+
dataType: "number",
|
|
532
|
+
defaultValue: 0.3
|
|
533
|
+
},
|
|
534
|
+
{ id: "out", name: "", direction: "output", dataType: "flow" }
|
|
535
|
+
],
|
|
536
|
+
execute: (_inputs, ctx) => {
|
|
537
|
+
ctx.triggerFlow("out");
|
|
538
|
+
}
|
|
539
|
+
});
|
|
540
|
+
library.register({
|
|
541
|
+
type: "print",
|
|
542
|
+
name: "Print",
|
|
543
|
+
category: "flow",
|
|
544
|
+
description: "Log a value to the console.",
|
|
545
|
+
color: "#fab387",
|
|
546
|
+
ports: [
|
|
547
|
+
{ id: "in", name: "", direction: "input", dataType: "flow" },
|
|
548
|
+
{ id: "message", name: "Message", direction: "input", dataType: "any" },
|
|
549
|
+
{ id: "out", name: "", direction: "output", dataType: "flow" }
|
|
550
|
+
],
|
|
551
|
+
execute: (inputs, ctx) => {
|
|
552
|
+
ctx.events.emit("script:log", inputs.message);
|
|
553
|
+
ctx.triggerFlow("out");
|
|
554
|
+
}
|
|
555
|
+
});
|
|
87
556
|
}
|
|
88
|
-
/* ── Built-in Nodes ───────────────────────────────────────────── */
|
|
89
|
-
function registerBuiltInNodes(library) {
|
|
90
|
-
// ── Flow Control ───────────────────────────────
|
|
91
|
-
library.register({
|
|
92
|
-
type: 'event_start',
|
|
93
|
-
name: 'On Start',
|
|
94
|
-
category: 'flow',
|
|
95
|
-
description: 'Fires once when the scene starts.',
|
|
96
|
-
color: '#e64553',
|
|
97
|
-
ports: [{ id: 'out', name: '', direction: 'output', dataType: 'flow' }],
|
|
98
|
-
execute: (_inputs, ctx) => {
|
|
99
|
-
ctx.triggerFlow('out');
|
|
100
|
-
},
|
|
101
|
-
});
|
|
102
|
-
library.register({
|
|
103
|
-
type: 'event_update',
|
|
104
|
-
name: 'On Update',
|
|
105
|
-
category: 'flow',
|
|
106
|
-
description: 'Fires every frame.',
|
|
107
|
-
color: '#e64553',
|
|
108
|
-
ports: [
|
|
109
|
-
{ id: 'out', name: '', direction: 'output', dataType: 'flow' },
|
|
110
|
-
{ id: 'dt', name: 'Delta Time', direction: 'output', dataType: 'number' },
|
|
111
|
-
],
|
|
112
|
-
execute: (_inputs, ctx) => {
|
|
113
|
-
ctx.triggerFlow('out');
|
|
114
|
-
return { dt: ctx.dt };
|
|
115
|
-
},
|
|
116
|
-
});
|
|
117
|
-
library.register({
|
|
118
|
-
type: 'if_else',
|
|
119
|
-
name: 'If / Else',
|
|
120
|
-
category: 'flow',
|
|
121
|
-
description: 'Branch based on condition.',
|
|
122
|
-
color: '#fab387',
|
|
123
|
-
ports: [
|
|
124
|
-
{ id: 'in', name: '', direction: 'input', dataType: 'flow' },
|
|
125
|
-
{ id: 'cond', name: 'Condition', direction: 'input', dataType: 'boolean' },
|
|
126
|
-
{ id: 'true', name: 'True', direction: 'output', dataType: 'flow' },
|
|
127
|
-
{ id: 'false', name: 'False', direction: 'output', dataType: 'flow' },
|
|
128
|
-
],
|
|
129
|
-
execute: (inputs, ctx) => {
|
|
130
|
-
ctx.triggerFlow(inputs.cond ? 'true' : 'false');
|
|
131
|
-
},
|
|
132
|
-
});
|
|
133
|
-
library.register({
|
|
134
|
-
type: 'delay',
|
|
135
|
-
name: 'Delay',
|
|
136
|
-
category: 'flow',
|
|
137
|
-
description: 'Wait for a duration then continue.',
|
|
138
|
-
color: '#fab387',
|
|
139
|
-
ports: [
|
|
140
|
-
{ id: 'in', name: '', direction: 'input', dataType: 'flow' },
|
|
141
|
-
{ id: 'seconds', name: 'Seconds', direction: 'input', dataType: 'number', defaultValue: 1 },
|
|
142
|
-
{ id: 'out', name: '', direction: 'output', dataType: 'flow' },
|
|
143
|
-
],
|
|
144
|
-
execute: (inputs, ctx) => {
|
|
145
|
-
// In a real implementation this would be async/coroutine-based
|
|
146
|
-
ctx.triggerFlow('out');
|
|
147
|
-
},
|
|
148
|
-
});
|
|
149
|
-
library.register({
|
|
150
|
-
type: 'sequence',
|
|
151
|
-
name: 'Sequence',
|
|
152
|
-
category: 'flow',
|
|
153
|
-
description: 'Execute outputs in order.',
|
|
154
|
-
color: '#fab387',
|
|
155
|
-
ports: [
|
|
156
|
-
{ id: 'in', name: '', direction: 'input', dataType: 'flow' },
|
|
157
|
-
{ id: 'out1', name: '1', direction: 'output', dataType: 'flow' },
|
|
158
|
-
{ id: 'out2', name: '2', direction: 'output', dataType: 'flow' },
|
|
159
|
-
{ id: 'out3', name: '3', direction: 'output', dataType: 'flow' },
|
|
160
|
-
],
|
|
161
|
-
execute: (_inputs, ctx) => {
|
|
162
|
-
ctx.triggerFlow('out1');
|
|
163
|
-
ctx.triggerFlow('out2');
|
|
164
|
-
ctx.triggerFlow('out3');
|
|
165
|
-
},
|
|
166
|
-
});
|
|
167
|
-
// ── Math ───────────────────────────────────────
|
|
168
|
-
library.register({
|
|
169
|
-
type: 'math_add',
|
|
170
|
-
name: 'Add',
|
|
171
|
-
category: 'math',
|
|
172
|
-
description: 'A + B',
|
|
173
|
-
color: '#89b4fa',
|
|
174
|
-
ports: [
|
|
175
|
-
{ id: 'a', name: 'A', direction: 'input', dataType: 'number', defaultValue: 0 },
|
|
176
|
-
{ id: 'b', name: 'B', direction: 'input', dataType: 'number', defaultValue: 0 },
|
|
177
|
-
{ id: 'result', name: 'Result', direction: 'output', dataType: 'number' },
|
|
178
|
-
],
|
|
179
|
-
execute: (inputs) => ({ result: inputs.a + inputs.b }),
|
|
180
|
-
});
|
|
181
|
-
library.register({
|
|
182
|
-
type: 'math_sub',
|
|
183
|
-
name: 'Subtract',
|
|
184
|
-
category: 'math',
|
|
185
|
-
description: 'A - B',
|
|
186
|
-
color: '#89b4fa',
|
|
187
|
-
ports: [
|
|
188
|
-
{ id: 'a', name: 'A', direction: 'input', dataType: 'number', defaultValue: 0 },
|
|
189
|
-
{ id: 'b', name: 'B', direction: 'input', dataType: 'number', defaultValue: 0 },
|
|
190
|
-
{ id: 'result', name: 'Result', direction: 'output', dataType: 'number' },
|
|
191
|
-
],
|
|
192
|
-
execute: (inputs) => ({ result: inputs.a - inputs.b }),
|
|
193
|
-
});
|
|
194
|
-
library.register({
|
|
195
|
-
type: 'math_mul',
|
|
196
|
-
name: 'Multiply',
|
|
197
|
-
category: 'math',
|
|
198
|
-
description: 'A × B',
|
|
199
|
-
color: '#89b4fa',
|
|
200
|
-
ports: [
|
|
201
|
-
{ id: 'a', name: 'A', direction: 'input', dataType: 'number', defaultValue: 0 },
|
|
202
|
-
{ id: 'b', name: 'B', direction: 'input', dataType: 'number', defaultValue: 1 },
|
|
203
|
-
{ id: 'result', name: 'Result', direction: 'output', dataType: 'number' },
|
|
204
|
-
],
|
|
205
|
-
execute: (inputs) => ({ result: inputs.a * inputs.b }),
|
|
206
|
-
});
|
|
207
|
-
library.register({
|
|
208
|
-
type: 'math_div',
|
|
209
|
-
name: 'Divide',
|
|
210
|
-
category: 'math',
|
|
211
|
-
description: 'A ÷ B',
|
|
212
|
-
color: '#89b4fa',
|
|
213
|
-
ports: [
|
|
214
|
-
{ id: 'a', name: 'A', direction: 'input', dataType: 'number', defaultValue: 0 },
|
|
215
|
-
{ id: 'b', name: 'B', direction: 'input', dataType: 'number', defaultValue: 1 },
|
|
216
|
-
{ id: 'result', name: 'Result', direction: 'output', dataType: 'number' },
|
|
217
|
-
],
|
|
218
|
-
execute: (inputs) => {
|
|
219
|
-
const b = inputs.b;
|
|
220
|
-
return { result: b !== 0 ? inputs.a / b : 0 };
|
|
221
|
-
},
|
|
222
|
-
});
|
|
223
|
-
library.register({
|
|
224
|
-
type: 'math_random',
|
|
225
|
-
name: 'Random',
|
|
226
|
-
category: 'math',
|
|
227
|
-
description: 'Random number between min and max.',
|
|
228
|
-
color: '#89b4fa',
|
|
229
|
-
ports: [
|
|
230
|
-
{ id: 'min', name: 'Min', direction: 'input', dataType: 'number', defaultValue: 0 },
|
|
231
|
-
{ id: 'max', name: 'Max', direction: 'input', dataType: 'number', defaultValue: 1 },
|
|
232
|
-
{ id: 'result', name: 'Result', direction: 'output', dataType: 'number' },
|
|
233
|
-
],
|
|
234
|
-
execute: (inputs) => {
|
|
235
|
-
const min = inputs.min;
|
|
236
|
-
const max = inputs.max;
|
|
237
|
-
return { result: min + Math.random() * (max - min) };
|
|
238
|
-
},
|
|
239
|
-
});
|
|
240
|
-
// ── Comparison ─────────────────────────────────
|
|
241
|
-
library.register({
|
|
242
|
-
type: 'compare_eq',
|
|
243
|
-
name: 'Equals',
|
|
244
|
-
category: 'logic',
|
|
245
|
-
description: 'A == B',
|
|
246
|
-
color: '#a6e3a1',
|
|
247
|
-
ports: [
|
|
248
|
-
{ id: 'a', name: 'A', direction: 'input', dataType: 'any' },
|
|
249
|
-
{ id: 'b', name: 'B', direction: 'input', dataType: 'any' },
|
|
250
|
-
{ id: 'result', name: 'Result', direction: 'output', dataType: 'boolean' },
|
|
251
|
-
],
|
|
252
|
-
execute: (inputs) => ({ result: inputs.a === inputs.b }),
|
|
253
|
-
});
|
|
254
|
-
library.register({
|
|
255
|
-
type: 'compare_gt',
|
|
256
|
-
name: 'Greater Than',
|
|
257
|
-
category: 'logic',
|
|
258
|
-
description: 'A > B',
|
|
259
|
-
color: '#a6e3a1',
|
|
260
|
-
ports: [
|
|
261
|
-
{ id: 'a', name: 'A', direction: 'input', dataType: 'number', defaultValue: 0 },
|
|
262
|
-
{ id: 'b', name: 'B', direction: 'input', dataType: 'number', defaultValue: 0 },
|
|
263
|
-
{ id: 'result', name: 'Result', direction: 'output', dataType: 'boolean' },
|
|
264
|
-
],
|
|
265
|
-
execute: (inputs) => ({ result: inputs.a > inputs.b }),
|
|
266
|
-
});
|
|
267
|
-
library.register({
|
|
268
|
-
type: 'compare_lt',
|
|
269
|
-
name: 'Less Than',
|
|
270
|
-
category: 'logic',
|
|
271
|
-
description: 'A < B',
|
|
272
|
-
color: '#a6e3a1',
|
|
273
|
-
ports: [
|
|
274
|
-
{ id: 'a', name: 'A', direction: 'input', dataType: 'number', defaultValue: 0 },
|
|
275
|
-
{ id: 'b', name: 'B', direction: 'input', dataType: 'number', defaultValue: 0 },
|
|
276
|
-
{ id: 'result', name: 'Result', direction: 'output', dataType: 'boolean' },
|
|
277
|
-
],
|
|
278
|
-
execute: (inputs) => ({ result: inputs.a < inputs.b }),
|
|
279
|
-
});
|
|
280
|
-
library.register({
|
|
281
|
-
type: 'logic_and',
|
|
282
|
-
name: 'And',
|
|
283
|
-
category: 'logic',
|
|
284
|
-
description: 'A AND B',
|
|
285
|
-
color: '#a6e3a1',
|
|
286
|
-
ports: [
|
|
287
|
-
{ id: 'a', name: 'A', direction: 'input', dataType: 'boolean' },
|
|
288
|
-
{ id: 'b', name: 'B', direction: 'input', dataType: 'boolean' },
|
|
289
|
-
{ id: 'result', name: 'Result', direction: 'output', dataType: 'boolean' },
|
|
290
|
-
],
|
|
291
|
-
execute: (inputs) => ({ result: !!(inputs.a && inputs.b) }),
|
|
292
|
-
});
|
|
293
|
-
library.register({
|
|
294
|
-
type: 'logic_or',
|
|
295
|
-
name: 'Or',
|
|
296
|
-
category: 'logic',
|
|
297
|
-
description: 'A OR B',
|
|
298
|
-
color: '#a6e3a1',
|
|
299
|
-
ports: [
|
|
300
|
-
{ id: 'a', name: 'A', direction: 'input', dataType: 'boolean' },
|
|
301
|
-
{ id: 'b', name: 'B', direction: 'input', dataType: 'boolean' },
|
|
302
|
-
{ id: 'result', name: 'Result', direction: 'output', dataType: 'boolean' },
|
|
303
|
-
],
|
|
304
|
-
execute: (inputs) => ({ result: !!(inputs.a || inputs.b) }),
|
|
305
|
-
});
|
|
306
|
-
library.register({
|
|
307
|
-
type: 'logic_not',
|
|
308
|
-
name: 'Not',
|
|
309
|
-
category: 'logic',
|
|
310
|
-
description: 'NOT A',
|
|
311
|
-
color: '#a6e3a1',
|
|
312
|
-
ports: [
|
|
313
|
-
{ id: 'a', name: 'A', direction: 'input', dataType: 'boolean' },
|
|
314
|
-
{ id: 'result', name: 'Result', direction: 'output', dataType: 'boolean' },
|
|
315
|
-
],
|
|
316
|
-
execute: (inputs) => ({ result: !inputs.a }),
|
|
317
|
-
});
|
|
318
|
-
// ── Game / Input ───────────────────────────────
|
|
319
|
-
library.register({
|
|
320
|
-
type: 'input_action',
|
|
321
|
-
name: 'Input Action',
|
|
322
|
-
category: 'input',
|
|
323
|
-
description: 'Read an input action value.',
|
|
324
|
-
color: '#f9e2af',
|
|
325
|
-
ports: [
|
|
326
|
-
{
|
|
327
|
-
id: 'action',
|
|
328
|
-
name: 'Action',
|
|
329
|
-
direction: 'input',
|
|
330
|
-
dataType: 'string',
|
|
331
|
-
defaultValue: 'moveX',
|
|
332
|
-
},
|
|
333
|
-
{ id: 'pressed', name: 'Pressed', direction: 'output', dataType: 'boolean' },
|
|
334
|
-
{ id: 'value', name: 'Value', direction: 'output', dataType: 'number' },
|
|
335
|
-
],
|
|
336
|
-
execute: (_inputs, ctx) => {
|
|
337
|
-
const actionName = _inputs.action ?? 'moveX';
|
|
338
|
-
const input = ctx.services['input'];
|
|
339
|
-
if (input?.getAction) {
|
|
340
|
-
const state = input.getAction(actionName);
|
|
341
|
-
return { pressed: state.pressed, value: state.value };
|
|
342
|
-
}
|
|
343
|
-
return { pressed: false, value: 0 };
|
|
344
|
-
},
|
|
345
|
-
});
|
|
346
|
-
library.register({
|
|
347
|
-
type: 'play_sound',
|
|
348
|
-
name: 'Play Sound',
|
|
349
|
-
category: 'audio',
|
|
350
|
-
description: 'Play a sound effect.',
|
|
351
|
-
color: '#cba6f7',
|
|
352
|
-
ports: [
|
|
353
|
-
{ id: 'in', name: '', direction: 'input', dataType: 'flow' },
|
|
354
|
-
{ id: 'soundId', name: 'Sound', direction: 'input', dataType: 'string' },
|
|
355
|
-
{ id: 'volume', name: 'Volume', direction: 'input', dataType: 'number', defaultValue: 1 },
|
|
356
|
-
{ id: 'out', name: '', direction: 'output', dataType: 'flow' },
|
|
357
|
-
],
|
|
358
|
-
execute: (_inputs, ctx) => {
|
|
359
|
-
const audio = ctx.services['audio'];
|
|
360
|
-
if (audio?.play) {
|
|
361
|
-
audio.play(_inputs.soundId, { volume: _inputs.volume ?? 1 });
|
|
362
|
-
}
|
|
363
|
-
ctx.triggerFlow('out');
|
|
364
|
-
},
|
|
365
|
-
});
|
|
366
|
-
// ── Entity ─────────────────────────────────────
|
|
367
|
-
library.register({
|
|
368
|
-
type: 'get_position',
|
|
369
|
-
name: 'Get Position',
|
|
370
|
-
category: 'entity',
|
|
371
|
-
description: 'Get entity position.',
|
|
372
|
-
color: '#74c7ec',
|
|
373
|
-
ports: [
|
|
374
|
-
{ id: 'entity', name: 'Entity', direction: 'input', dataType: 'entity' },
|
|
375
|
-
{ id: 'x', name: 'X', direction: 'output', dataType: 'number' },
|
|
376
|
-
{ id: 'y', name: 'Y', direction: 'output', dataType: 'number' },
|
|
377
|
-
],
|
|
378
|
-
execute: (_inputs, ctx) => {
|
|
379
|
-
const world = ctx.world;
|
|
380
|
-
const eid = (_inputs.entity ?? ctx.entityId);
|
|
381
|
-
if (world?.getComponent && eid != null) {
|
|
382
|
-
const t = world.getComponent(eid, 'Transform');
|
|
383
|
-
if (t?.position) {
|
|
384
|
-
return { x: t.position.x, y: t.position.y };
|
|
385
|
-
}
|
|
386
|
-
}
|
|
387
|
-
return { x: 0, y: 0 };
|
|
388
|
-
},
|
|
389
|
-
});
|
|
390
|
-
library.register({
|
|
391
|
-
type: 'set_position',
|
|
392
|
-
name: 'Set Position',
|
|
393
|
-
category: 'entity',
|
|
394
|
-
description: 'Set entity position.',
|
|
395
|
-
color: '#74c7ec',
|
|
396
|
-
ports: [
|
|
397
|
-
{ id: 'in', name: '', direction: 'input', dataType: 'flow' },
|
|
398
|
-
{ id: 'entity', name: 'Entity', direction: 'input', dataType: 'entity' },
|
|
399
|
-
{ id: 'x', name: 'X', direction: 'input', dataType: 'number', defaultValue: 0 },
|
|
400
|
-
{ id: 'y', name: 'Y', direction: 'input', dataType: 'number', defaultValue: 0 },
|
|
401
|
-
{ id: 'out', name: '', direction: 'output', dataType: 'flow' },
|
|
402
|
-
],
|
|
403
|
-
execute: (_inputs, ctx) => {
|
|
404
|
-
const world = ctx.world;
|
|
405
|
-
const eid = (_inputs.entity ?? ctx.entityId);
|
|
406
|
-
if (world?.getComponent && eid != null) {
|
|
407
|
-
const t = world.getComponent(eid, 'Transform');
|
|
408
|
-
if (t?.position) {
|
|
409
|
-
t.position.x = _inputs.x ?? 0;
|
|
410
|
-
t.position.y = _inputs.y ?? 0;
|
|
411
|
-
}
|
|
412
|
-
}
|
|
413
|
-
ctx.triggerFlow('out');
|
|
414
|
-
},
|
|
415
|
-
});
|
|
416
|
-
library.register({
|
|
417
|
-
type: 'spawn_entity',
|
|
418
|
-
name: 'Spawn Entity',
|
|
419
|
-
category: 'entity',
|
|
420
|
-
description: 'Create a new entity from a prefab.',
|
|
421
|
-
color: '#74c7ec',
|
|
422
|
-
ports: [
|
|
423
|
-
{ id: 'in', name: '', direction: 'input', dataType: 'flow' },
|
|
424
|
-
{ id: 'prefab', name: 'Prefab', direction: 'input', dataType: 'string' },
|
|
425
|
-
{ id: 'x', name: 'X', direction: 'input', dataType: 'number', defaultValue: 0 },
|
|
426
|
-
{ id: 'y', name: 'Y', direction: 'input', dataType: 'number', defaultValue: 0 },
|
|
427
|
-
{ id: 'out', name: '', direction: 'output', dataType: 'flow' },
|
|
428
|
-
{ id: 'entity', name: 'Entity', direction: 'output', dataType: 'entity' },
|
|
429
|
-
],
|
|
430
|
-
execute: (_inputs, ctx) => {
|
|
431
|
-
ctx.triggerFlow('out');
|
|
432
|
-
return { entity: null };
|
|
433
|
-
},
|
|
434
|
-
});
|
|
435
|
-
library.register({
|
|
436
|
-
type: 'destroy_entity',
|
|
437
|
-
name: 'Destroy Entity',
|
|
438
|
-
category: 'entity',
|
|
439
|
-
description: 'Remove an entity from the world.',
|
|
440
|
-
color: '#74c7ec',
|
|
441
|
-
ports: [
|
|
442
|
-
{ id: 'in', name: '', direction: 'input', dataType: 'flow' },
|
|
443
|
-
{ id: 'entity', name: 'Entity', direction: 'input', dataType: 'entity' },
|
|
444
|
-
{ id: 'out', name: '', direction: 'output', dataType: 'flow' },
|
|
445
|
-
],
|
|
446
|
-
execute: (_inputs, ctx) => {
|
|
447
|
-
ctx.triggerFlow('out');
|
|
448
|
-
},
|
|
449
|
-
});
|
|
450
|
-
// ── Variables ──────────────────────────────────
|
|
451
|
-
library.register({
|
|
452
|
-
type: 'get_variable',
|
|
453
|
-
name: 'Get Variable',
|
|
454
|
-
category: 'variable',
|
|
455
|
-
description: 'Read a variable value.',
|
|
456
|
-
color: '#94e2d5',
|
|
457
|
-
ports: [
|
|
458
|
-
{ id: 'name', name: 'Name', direction: 'input', dataType: 'string', defaultValue: '' },
|
|
459
|
-
{ id: 'value', name: 'Value', direction: 'output', dataType: 'any' },
|
|
460
|
-
],
|
|
461
|
-
execute: (inputs, ctx) => ({ value: ctx.variables[inputs.name ?? ''] }),
|
|
462
|
-
});
|
|
463
|
-
library.register({
|
|
464
|
-
type: 'set_variable',
|
|
465
|
-
name: 'Set Variable',
|
|
466
|
-
category: 'variable',
|
|
467
|
-
description: 'Write a variable value.',
|
|
468
|
-
color: '#94e2d5',
|
|
469
|
-
ports: [
|
|
470
|
-
{ id: 'in', name: '', direction: 'input', dataType: 'flow' },
|
|
471
|
-
{ id: 'name', name: 'Name', direction: 'input', dataType: 'string', defaultValue: '' },
|
|
472
|
-
{ id: 'value', name: 'Value', direction: 'input', dataType: 'any' },
|
|
473
|
-
{ id: 'out', name: '', direction: 'output', dataType: 'flow' },
|
|
474
|
-
],
|
|
475
|
-
execute: (inputs, ctx) => {
|
|
476
|
-
const name = inputs.name;
|
|
477
|
-
if (name) {
|
|
478
|
-
ctx.variables[name] = inputs.value;
|
|
479
|
-
}
|
|
480
|
-
ctx.triggerFlow('out');
|
|
481
|
-
},
|
|
482
|
-
});
|
|
483
|
-
// ── Physics ────────────────────────────────────
|
|
484
|
-
library.register({
|
|
485
|
-
type: 'apply_force',
|
|
486
|
-
name: 'Apply Force',
|
|
487
|
-
category: 'physics',
|
|
488
|
-
description: 'Apply a force to an entity.',
|
|
489
|
-
color: '#f38ba8',
|
|
490
|
-
ports: [
|
|
491
|
-
{ id: 'in', name: '', direction: 'input', dataType: 'flow' },
|
|
492
|
-
{ id: 'entity', name: 'Entity', direction: 'input', dataType: 'entity' },
|
|
493
|
-
{ id: 'x', name: 'X', direction: 'input', dataType: 'number', defaultValue: 0 },
|
|
494
|
-
{ id: 'y', name: 'Y', direction: 'input', dataType: 'number', defaultValue: 0 },
|
|
495
|
-
{ id: 'out', name: '', direction: 'output', dataType: 'flow' },
|
|
496
|
-
],
|
|
497
|
-
execute: (_inputs, ctx) => {
|
|
498
|
-
ctx.triggerFlow('out');
|
|
499
|
-
},
|
|
500
|
-
});
|
|
501
|
-
library.register({
|
|
502
|
-
type: 'on_collision',
|
|
503
|
-
name: 'On Collision',
|
|
504
|
-
category: 'physics',
|
|
505
|
-
description: 'Fires when entity collides with another.',
|
|
506
|
-
color: '#f38ba8',
|
|
507
|
-
ports: [
|
|
508
|
-
{ id: 'out', name: '', direction: 'output', dataType: 'flow' },
|
|
509
|
-
{ id: 'other', name: 'Other', direction: 'output', dataType: 'entity' },
|
|
510
|
-
{ id: 'normal_x', name: 'Normal X', direction: 'output', dataType: 'number' },
|
|
511
|
-
{ id: 'normal_y', name: 'Normal Y', direction: 'output', dataType: 'number' },
|
|
512
|
-
],
|
|
513
|
-
execute: (_inputs, ctx) => {
|
|
514
|
-
ctx.triggerFlow('out');
|
|
515
|
-
return { other: null, normal_x: 0, normal_y: 0 };
|
|
516
|
-
},
|
|
517
|
-
});
|
|
518
|
-
// ── Game Control ───────────────────────────────
|
|
519
|
-
library.register({
|
|
520
|
-
type: 'load_scene',
|
|
521
|
-
name: 'Load Scene',
|
|
522
|
-
category: 'game',
|
|
523
|
-
description: 'Load a scene by ID.',
|
|
524
|
-
color: '#eba0ac',
|
|
525
|
-
ports: [
|
|
526
|
-
{ id: 'in', name: '', direction: 'input', dataType: 'flow' },
|
|
527
|
-
{ id: 'sceneId', name: 'Scene ID', direction: 'input', dataType: 'string' },
|
|
528
|
-
{ id: 'out', name: '', direction: 'output', dataType: 'flow' },
|
|
529
|
-
],
|
|
530
|
-
execute: (_inputs, ctx) => {
|
|
531
|
-
ctx.triggerFlow('out');
|
|
532
|
-
},
|
|
533
|
-
});
|
|
534
|
-
library.register({
|
|
535
|
-
type: 'camera_shake',
|
|
536
|
-
name: 'Camera Shake',
|
|
537
|
-
category: 'game',
|
|
538
|
-
description: 'Shake the camera.',
|
|
539
|
-
color: '#eba0ac',
|
|
540
|
-
ports: [
|
|
541
|
-
{ id: 'in', name: '', direction: 'input', dataType: 'flow' },
|
|
542
|
-
{
|
|
543
|
-
id: 'intensity',
|
|
544
|
-
name: 'Intensity',
|
|
545
|
-
direction: 'input',
|
|
546
|
-
dataType: 'number',
|
|
547
|
-
defaultValue: 5,
|
|
548
|
-
},
|
|
549
|
-
{
|
|
550
|
-
id: 'duration',
|
|
551
|
-
name: 'Duration',
|
|
552
|
-
direction: 'input',
|
|
553
|
-
dataType: 'number',
|
|
554
|
-
defaultValue: 0.3,
|
|
555
|
-
},
|
|
556
|
-
{ id: 'out', name: '', direction: 'output', dataType: 'flow' },
|
|
557
|
-
],
|
|
558
|
-
execute: (_inputs, ctx) => {
|
|
559
|
-
ctx.triggerFlow('out');
|
|
560
|
-
},
|
|
561
|
-
});
|
|
562
|
-
library.register({
|
|
563
|
-
type: 'print',
|
|
564
|
-
name: 'Print',
|
|
565
|
-
category: 'flow',
|
|
566
|
-
description: 'Log a value to the console.',
|
|
567
|
-
color: '#fab387',
|
|
568
|
-
ports: [
|
|
569
|
-
{ id: 'in', name: '', direction: 'input', dataType: 'flow' },
|
|
570
|
-
{ id: 'message', name: 'Message', direction: 'input', dataType: 'any' },
|
|
571
|
-
{ id: 'out', name: '', direction: 'output', dataType: 'flow' },
|
|
572
|
-
],
|
|
573
|
-
execute: (inputs, ctx) => {
|
|
574
|
-
ctx.events.emit('script:log', inputs.message);
|
|
575
|
-
ctx.triggerFlow('out');
|
|
576
|
-
},
|
|
577
|
-
});
|
|
578
|
-
}
|
|
579
|
-
/* ── Helper: Create a default library with all built-in nodes ── */
|
|
580
557
|
function createDefaultNodeLibrary() {
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
558
|
+
const lib = new NodeLibrary();
|
|
559
|
+
registerBuiltInNodes(lib);
|
|
560
|
+
return lib;
|
|
584
561
|
}
|
|
585
|
-
|
|
586
562
|
exports.GraphExecutor = GraphExecutor;
|
|
587
563
|
exports.NodeLibrary = NodeLibrary;
|
|
588
564
|
exports.createDefaultNodeLibrary = createDefaultNodeLibrary;
|