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