@nice2dev/game-engine 1.3.15 → 1.3.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (434) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/dist/cjs/accessibility/Accessibility.js +152 -165
  3. package/dist/cjs/ai/AI.js +292 -294
  4. package/dist/cjs/ai/BehaviorTree.js +1029 -1113
  5. package/dist/cjs/ai/StateMachine.js +694 -756
  6. package/dist/cjs/animation/Animation.js +232 -241
  7. package/dist/cjs/audio/AudioAdvanced.js +221 -236
  8. package/dist/cjs/audio/AudioBridge.js +441 -435
  9. package/dist/cjs/audio/AudioManager.js +242 -259
  10. package/dist/cjs/build-cloud/BuildOrchestration.js +1059 -1098
  11. package/dist/cjs/build-cloud/GodotBuildCloud.js +641 -670
  12. package/dist/cjs/build-cloud/UnityBuildCloud.js +563 -610
  13. package/dist/cjs/build-cloud/UnrealBuildCloud.js +610 -635
  14. package/dist/cjs/core/EventBus.js +51 -56
  15. package/dist/cjs/core/GameClock.js +62 -66
  16. package/dist/cjs/core/GameConfig.js +72 -79
  17. package/dist/cjs/core/GameLoop.js +80 -89
  18. package/dist/cjs/core/ServiceLocator.js +61 -65
  19. package/dist/cjs/core/Validation.js +72 -82
  20. package/dist/cjs/core/math.js +108 -112
  21. package/dist/cjs/devtools/DevTools.js +542 -563
  22. package/dist/cjs/devtools/DeveloperExperience.js +521 -559
  23. package/dist/cjs/devtools/GameplayAnalytics.js +636 -646
  24. package/dist/cjs/dialogue/DialogueSystem.js +984 -986
  25. package/dist/cjs/docs/DocGenerator.js +339 -364
  26. package/dist/cjs/ecs/World.js +355 -371
  27. package/dist/cjs/editor/AchievementEditor.js +580 -636
  28. package/dist/cjs/editor/AdvancedEditor.js +184 -191
  29. package/dist/cjs/editor/AnimationRetargeting.js +696 -741
  30. package/dist/cjs/editor/AssetBrowser.js +1072 -1160
  31. package/dist/cjs/editor/AssetManager.js +187 -192
  32. package/dist/cjs/editor/ConsolePro.js +971 -1061
  33. package/dist/cjs/editor/CraftingEditor.js +680 -730
  34. package/dist/cjs/editor/DebugTools.js +187 -185
  35. package/dist/cjs/editor/DialogueSystem.js +844 -901
  36. package/dist/cjs/editor/LeaderboardSystem.js +429 -483
  37. package/dist/cjs/editor/NiceGameEditor.js +1903 -1201
  38. package/dist/cjs/editor/PrefabSystem.js +772 -838
  39. package/dist/cjs/editor/ProfilerPanel.js +649 -700
  40. package/dist/cjs/editor/QuestEditor.js +792 -839
  41. package/dist/cjs/editor/ReplaySystem.js +585 -634
  42. package/dist/cjs/editor/SceneEditor.js +176 -200
  43. package/dist/cjs/editor/ScreenshotMode.js +621 -688
  44. package/dist/cjs/editor/ShaderGraph.js +1556 -1582
  45. package/dist/cjs/editor/TimelineEditor.js +715 -778
  46. package/dist/cjs/editor/UndoRedoPro.js +830 -904
  47. package/dist/cjs/editor/VRARMode.js +582 -645
  48. package/dist/cjs/engine/NiceGameEngine.js +141 -164
  49. package/dist/cjs/engine/SaveSystem.js +441 -495
  50. package/dist/cjs/enterprise/Enterprise.js +254 -261
  51. package/dist/cjs/export/BevyExporter.js +927 -967
  52. package/dist/cjs/export/CocosExporter.js +644 -673
  53. package/dist/cjs/export/Construct3Exporter.js +783 -794
  54. package/dist/cjs/export/DefoldExporter.js +1028 -1069
  55. package/dist/cjs/export/GDevelopExporter.js +674 -708
  56. package/dist/cjs/export/GameMakerExporter.js +791 -805
  57. package/dist/cjs/export/GodotExporter.js +1003 -1045
  58. package/dist/cjs/export/MinecraftBedrockExporter.js +573 -578
  59. package/dist/cjs/export/MonoGameExporter.js +1265 -1293
  60. package/dist/cjs/export/Pico8Exporter.js +766 -812
  61. package/dist/cjs/export/PlatformExporter.js +188 -206
  62. package/dist/cjs/export/RPGMakerExporter.js +860 -879
  63. package/dist/cjs/export/RobloxExporter.js +883 -919
  64. package/dist/cjs/export/Solar2DExporter.js +1218 -1256
  65. package/dist/cjs/export/ThreeJSExporter.js +1006 -1073
  66. package/dist/cjs/export/Tic80Exporter.js +1210 -1267
  67. package/dist/cjs/export/UnityExporter.js +1116 -1131
  68. package/dist/cjs/export/UnrealExporter.js +889 -919
  69. package/dist/cjs/export/WebExporter.js +931 -970
  70. package/dist/cjs/export/index.js +42 -65
  71. package/dist/cjs/godot-integration/GodotAssetLibrary.js +659 -692
  72. package/dist/cjs/godot-integration/GodotImport.js +929 -1027
  73. package/dist/cjs/godot-integration/GodotLiveLink.js +915 -945
  74. package/dist/cjs/godot-integration/components/GodotProjectBrowser.js +911 -611
  75. package/dist/cjs/i18n/I18n.js +860 -900
  76. package/dist/cjs/i18n/useTranslation.js +84 -89
  77. package/dist/cjs/import/AsepriteImporter.js +658 -716
  78. package/dist/cjs/import/DragonBonesImporter.js +437 -461
  79. package/dist/cjs/import/GameMakerImporter.js +511 -521
  80. package/dist/cjs/import/GodotSceneImporter.js +788 -822
  81. package/dist/cjs/import/LDtkImporter.js +436 -454
  82. package/dist/cjs/import/Live2DImporter.js +497 -518
  83. package/dist/cjs/import/NdgFormat.js +424 -457
  84. package/dist/cjs/import/OgmoImporter.js +466 -493
  85. package/dist/cjs/import/RPGMakerImporter.js +451 -477
  86. package/dist/cjs/import/SceneImporter.js +378 -423
  87. package/dist/cjs/import/SpineImporter.js +511 -546
  88. package/dist/cjs/import/SpriterImporter.js +590 -613
  89. package/dist/cjs/import/TiledMapImporter.js +811 -846
  90. package/dist/cjs/import/UnitySceneImporter.js +687 -703
  91. package/dist/cjs/import/index.js +206 -251
  92. package/dist/cjs/index.js +275 -278
  93. package/dist/cjs/input/GamepadNavigation.js +185 -205
  94. package/dist/cjs/input/InputManager.js +397 -421
  95. package/dist/cjs/input/useGamepads.js +70 -81
  96. package/dist/cjs/integration/IconSprite.js +129 -256
  97. package/dist/cjs/inventory/InventorySystem.js +920 -995
  98. package/dist/cjs/kids/KidMode.js +997 -1022
  99. package/dist/cjs/kids/KidTools.js +570 -594
  100. package/dist/cjs/monetization/Monetization.js +170 -177
  101. package/dist/cjs/multiplayer/LocalMultiplayer.js +287 -287
  102. package/dist/cjs/multiplayer/MiniGameTypes.js +49 -59
  103. package/dist/cjs/native-engine/AnimationSystem.js +731 -806
  104. package/dist/cjs/native-engine/AssetPipeline.js +454 -515
  105. package/dist/cjs/native-engine/AudioEngine.js +763 -804
  106. package/dist/cjs/native-engine/InputSystem.js +1075 -1145
  107. package/dist/cjs/native-engine/NetworkingSystem.js +733 -793
  108. package/dist/cjs/native-engine/PhysicsEngine.js +583 -607
  109. package/dist/cjs/native-engine/RenderingEngine.js +302 -350
  110. package/dist/cjs/native-engine/SceneGraph.js +769 -808
  111. package/dist/cjs/network/MultiplayerTransport.js +97 -132
  112. package/dist/cjs/network/Networking.js +549 -564
  113. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/AbortController.js +21 -29
  114. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/AccessTokenHttpClient.js +40 -48
  115. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/DefaultHttpClient.js +35 -43
  116. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/DefaultReconnectPolicy.js +10 -15
  117. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/Errors.js +103 -135
  118. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/FetchHttpClient.js +131 -158
  119. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/HandshakeProtocol.js +39 -53
  120. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/HeaderNames.js +5 -8
  121. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/HttpClient.js +40 -48
  122. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/HttpConnection.js +494 -572
  123. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/HubConnection.js +826 -953
  124. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/HubConnectionBuilder.js +125 -146
  125. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/IHubProtocol.js +13 -23
  126. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/ILogger.js +11 -25
  127. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/ITransport.js +13 -24
  128. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/JsonHubProtocol.js +108 -121
  129. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/Loggers.js +10 -14
  130. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/LongPollingTransport.js +150 -185
  131. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/MessageBuffer.js +158 -196
  132. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/ServerSentEventsTransport.js +90 -105
  133. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/Subject.js +30 -35
  134. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/TextMessageFormat.js +16 -21
  135. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/Utils.js +215 -248
  136. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/WebSocketTransport.js +135 -157
  137. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/XhrHttpClient.js +76 -85
  138. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/index.js +24 -27
  139. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/pkg-version.js +3 -4
  140. package/dist/cjs/pathfinding/Pathfinding.js +245 -263
  141. package/dist/cjs/performance/AssetStreaming.js +561 -635
  142. package/dist/cjs/performance/BenchmarkSuite.js +283 -311
  143. package/dist/cjs/performance/DeltaCompression.js +467 -526
  144. package/dist/cjs/performance/DeterministicPhysics.js +450 -498
  145. package/dist/cjs/performance/ECSOptimization.js +644 -695
  146. package/dist/cjs/performance/GameSaveSystem.js +509 -556
  147. package/dist/cjs/performance/HotReload.js +447 -500
  148. package/dist/cjs/performance/InputRecording.js +511 -561
  149. package/dist/cjs/performance/InterestManagement.js +453 -500
  150. package/dist/cjs/performance/LocalizationRuntime.js +376 -423
  151. package/dist/cjs/performance/MemoryManagement.js +410 -470
  152. package/dist/cjs/performance/ModSupport.js +445 -496
  153. package/dist/cjs/performance/MultiThreadedPhysics.js +400 -443
  154. package/dist/cjs/performance/NetworkPrediction.js +424 -482
  155. package/dist/cjs/performance/ObjectPooling.js +569 -617
  156. package/dist/cjs/performance/Performance.js +174 -190
  157. package/dist/cjs/performance/PerformanceAdvanced.js +614 -637
  158. package/dist/cjs/performance/WebGPURenderer.js +656 -683
  159. package/dist/cjs/physics/PhysicsAdvanced.js +345 -379
  160. package/dist/cjs/physics/PhysicsEngine2D.js +391 -427
  161. package/dist/cjs/plugins/PluginSDK.js +432 -466
  162. package/dist/cjs/plugins/PluginTestKit.js +307 -330
  163. package/dist/cjs/procedural/Procedural.js +243 -254
  164. package/dist/cjs/procedural/WorldBuilding.js +297 -314
  165. package/dist/cjs/quest/QuestSystem.js +975 -932
  166. package/dist/cjs/release/MobileExport.js +157 -163
  167. package/dist/cjs/release/Release.js +225 -238
  168. package/dist/cjs/rendering/Camera2D.js +121 -124
  169. package/dist/cjs/rendering/Renderer2D.js +321 -335
  170. package/dist/cjs/rendering/WebGPURenderPipeline.js +632 -651
  171. package/dist/cjs/runtime3d/Runtime3D.js +359 -378
  172. package/dist/cjs/runtime3d/SceneEditor3D.js +252 -263
  173. package/dist/cjs/scene/SceneManager.js +177 -193
  174. package/dist/cjs/scripting/GraphToAST.js +574 -547
  175. package/dist/cjs/scripting/LanguageExporter.js +254 -279
  176. package/dist/cjs/scripting/NodeGraph.js +546 -570
  177. package/dist/cjs/scripting/ScriptAST.js +31 -39
  178. package/dist/cjs/scripting/VisualScripting2.js +1016 -1065
  179. package/dist/cjs/scripting/exporters/CSharpExporter.js +464 -496
  180. package/dist/cjs/scripting/exporters/GDScriptExporter.js +390 -442
  181. package/dist/cjs/scripting/exporters/LuaExporter.js +406 -447
  182. package/dist/cjs/scripting/exporters/PythonExporter.js +484 -549
  183. package/dist/cjs/scripting/exporters/RustExporter.js +459 -512
  184. package/dist/cjs/scripting/exporters/TypeScriptExporter.js +505 -556
  185. package/dist/cjs/social/Social.js +72 -80
  186. package/dist/cjs/systems/LightingSystem.js +844 -931
  187. package/dist/cjs/systems/ParticleSystem2.js +1447 -1451
  188. package/dist/cjs/systems/PhysicsDebugSystem.js +1070 -1141
  189. package/dist/cjs/systems/TerrainSystem.js +985 -1098
  190. package/dist/cjs/templates/ActionTemplates.js +296 -309
  191. package/dist/cjs/templates/FightingTemplate.js +417 -463
  192. package/dist/cjs/templates/MetroidvaniaTemplate.js +353 -405
  193. package/dist/cjs/templates/PartyTemplates.js +190 -202
  194. package/dist/cjs/templates/PuzzleTemplates.js +245 -261
  195. package/dist/cjs/templates/RPGTemplates.js +160 -178
  196. package/dist/cjs/templates/SportsTemplates.js +237 -250
  197. package/dist/cjs/templates/StrategyTemplates.js +143 -153
  198. package/dist/cjs/templates/SurvivalTemplate.js +336 -380
  199. package/dist/cjs/templates/WaveDefense.js +499 -526
  200. package/dist/cjs/tilemap/Tilemap.js +207 -214
  201. package/dist/cjs/tutorials/TutorialBranching.js +396 -417
  202. package/dist/cjs/tutorials/TutorialEngine.js +888 -931
  203. package/dist/cjs/tutorials/TutorialOverlay.js +602 -640
  204. package/dist/cjs/tutorials/content/Tutorials_T05_T08.js +787 -809
  205. package/dist/cjs/tutorials/content/Tutorials_T09_T11.js +736 -756
  206. package/dist/cjs/tutorials/content/Tutorials_T12_T15.js +754 -778
  207. package/dist/cjs/ui/GameUI.js +295 -312
  208. package/dist/cjs/unity-integration/UnityAssetStore.js +700 -741
  209. package/dist/cjs/unity-integration/UnityImport.js +1066 -1176
  210. package/dist/cjs/unity-integration/UnityLiveLink.js +934 -981
  211. package/dist/cjs/unity-integration/components/UnityAssetStoreBrowser.js +1233 -757
  212. package/dist/cjs/unity-integration/components/UnityProjectBrowser.js +1240 -768
  213. package/dist/cjs/unreal-integration/UnrealImport.js +391 -412
  214. package/dist/cjs/unreal-integration/UnrealLiveLink.js +1102 -1137
  215. package/dist/cjs/unreal-integration/UnrealMarketplace.js +436 -473
  216. package/dist/cjs/unreal-integration/components/UnrealProjectBrowser.js +1150 -767
  217. package/dist/cjs/xr/ARVR.js +167 -175
  218. package/dist/esm/accessibility/Accessibility.js +160 -164
  219. package/dist/esm/ai/AI.js +310 -293
  220. package/dist/esm/ai/BehaviorTree.js +1057 -1112
  221. package/dist/esm/ai/StateMachine.js +709 -755
  222. package/dist/esm/animation/Animation.js +237 -240
  223. package/dist/esm/audio/AudioAdvanced.js +239 -235
  224. package/dist/esm/audio/AudioBridge.js +448 -434
  225. package/dist/esm/audio/AudioManager.js +243 -258
  226. package/dist/esm/build-cloud/BuildOrchestration.js +1071 -1097
  227. package/dist/esm/build-cloud/GodotBuildCloud.js +647 -669
  228. package/dist/esm/build-cloud/UnityBuildCloud.js +571 -609
  229. package/dist/esm/build-cloud/UnrealBuildCloud.js +615 -634
  230. package/dist/esm/core/EventBus.js +52 -55
  231. package/dist/esm/core/GameClock.js +63 -65
  232. package/dist/esm/core/GameConfig.js +77 -78
  233. package/dist/esm/core/GameLoop.js +81 -88
  234. package/dist/esm/core/ServiceLocator.js +63 -64
  235. package/dist/esm/core/Validation.js +82 -81
  236. package/dist/esm/core/math.js +109 -111
  237. package/dist/esm/devtools/DevTools.js +546 -562
  238. package/dist/esm/devtools/DeveloperExperience.js +535 -558
  239. package/dist/esm/devtools/GameplayAnalytics.js +647 -645
  240. package/dist/esm/dialogue/DialogueSystem.js +998 -985
  241. package/dist/esm/docs/DocGenerator.js +342 -363
  242. package/dist/esm/ecs/World.js +358 -370
  243. package/dist/esm/editor/AchievementEditor.js +584 -635
  244. package/dist/esm/editor/AdvancedEditor.js +191 -190
  245. package/dist/esm/editor/AnimationRetargeting.js +700 -740
  246. package/dist/esm/editor/AssetBrowser.js +1078 -1159
  247. package/dist/esm/editor/AssetManager.js +188 -191
  248. package/dist/esm/editor/ConsolePro.js +977 -1060
  249. package/dist/esm/editor/CraftingEditor.js +684 -729
  250. package/dist/esm/editor/DebugTools.js +194 -184
  251. package/dist/esm/editor/DialogueSystem.js +849 -900
  252. package/dist/esm/editor/LeaderboardSystem.js +433 -482
  253. package/dist/esm/editor/NiceGameEditor.js +1908 -1200
  254. package/dist/esm/editor/PrefabSystem.js +777 -837
  255. package/dist/esm/editor/ProfilerPanel.js +654 -699
  256. package/dist/esm/editor/QuestEditor.js +795 -838
  257. package/dist/esm/editor/ReplaySystem.js +591 -633
  258. package/dist/esm/editor/SceneEditor.js +189 -199
  259. package/dist/esm/editor/ScreenshotMode.js +628 -687
  260. package/dist/esm/editor/ShaderGraph.js +1565 -1581
  261. package/dist/esm/editor/TimelineEditor.js +733 -777
  262. package/dist/esm/editor/UndoRedoPro.js +835 -903
  263. package/dist/esm/editor/VRARMode.js +586 -644
  264. package/dist/esm/engine/NiceGameEngine.js +142 -163
  265. package/dist/esm/engine/SaveSystem.js +447 -494
  266. package/dist/esm/enterprise/Enterprise.js +265 -260
  267. package/dist/esm/export/BevyExporter.js +929 -966
  268. package/dist/esm/export/CocosExporter.js +646 -672
  269. package/dist/esm/export/Construct3Exporter.js +785 -793
  270. package/dist/esm/export/DefoldExporter.js +1030 -1068
  271. package/dist/esm/export/GDevelopExporter.js +676 -707
  272. package/dist/esm/export/GameMakerExporter.js +793 -804
  273. package/dist/esm/export/GodotExporter.js +1004 -1044
  274. package/dist/esm/export/MinecraftBedrockExporter.js +575 -577
  275. package/dist/esm/export/MonoGameExporter.js +1267 -1292
  276. package/dist/esm/export/Pico8Exporter.js +768 -811
  277. package/dist/esm/export/PlatformExporter.js +193 -205
  278. package/dist/esm/export/RPGMakerExporter.js +862 -878
  279. package/dist/esm/export/RobloxExporter.js +885 -918
  280. package/dist/esm/export/Solar2DExporter.js +1220 -1255
  281. package/dist/esm/export/ThreeJSExporter.js +1007 -1072
  282. package/dist/esm/export/Tic80Exporter.js +1212 -1266
  283. package/dist/esm/export/UnityExporter.js +1117 -1130
  284. package/dist/esm/export/UnrealExporter.js +891 -918
  285. package/dist/esm/export/WebExporter.js +933 -969
  286. package/dist/esm/export/index.js +86 -71
  287. package/dist/esm/godot-integration/GodotAssetLibrary.js +663 -691
  288. package/dist/esm/godot-integration/GodotImport.js +935 -1026
  289. package/dist/esm/godot-integration/GodotLiveLink.js +918 -944
  290. package/dist/esm/godot-integration/components/GodotProjectBrowser.js +912 -610
  291. package/dist/esm/i18n/I18n.js +871 -899
  292. package/dist/esm/i18n/useTranslation.js +88 -88
  293. package/dist/esm/import/AsepriteImporter.js +637 -715
  294. package/dist/esm/import/DragonBonesImporter.js +417 -460
  295. package/dist/esm/import/GameMakerImporter.js +491 -520
  296. package/dist/esm/import/GodotSceneImporter.js +767 -821
  297. package/dist/esm/import/LDtkImporter.js +415 -453
  298. package/dist/esm/import/Live2DImporter.js +477 -517
  299. package/dist/esm/import/NdgFormat.js +410 -456
  300. package/dist/esm/import/OgmoImporter.js +446 -492
  301. package/dist/esm/import/RPGMakerImporter.js +431 -476
  302. package/dist/esm/import/SceneImporter.js +385 -422
  303. package/dist/esm/import/SpineImporter.js +491 -545
  304. package/dist/esm/import/SpriterImporter.js +570 -612
  305. package/dist/esm/import/TiledMapImporter.js +790 -845
  306. package/dist/esm/import/UnitySceneImporter.js +666 -702
  307. package/dist/esm/import/index.js +247 -258
  308. package/dist/esm/index.js +1332 -188
  309. package/dist/esm/input/GamepadNavigation.js +187 -204
  310. package/dist/esm/input/InputManager.js +401 -420
  311. package/dist/esm/input/useGamepads.js +72 -80
  312. package/dist/esm/integration/IconSprite.js +143 -255
  313. package/dist/esm/inventory/InventorySystem.js +925 -994
  314. package/dist/esm/kids/KidMode.js +1003 -1021
  315. package/dist/esm/kids/KidTools.js +573 -593
  316. package/dist/esm/monetization/Monetization.js +180 -176
  317. package/dist/esm/multiplayer/LocalMultiplayer.js +290 -286
  318. package/dist/esm/multiplayer/MiniGameTypes.js +58 -58
  319. package/dist/esm/native-engine/AnimationSystem.js +735 -805
  320. package/dist/esm/native-engine/AssetPipeline.js +456 -514
  321. package/dist/esm/native-engine/AudioEngine.js +765 -803
  322. package/dist/esm/native-engine/InputSystem.js +1079 -1144
  323. package/dist/esm/native-engine/NetworkingSystem.js +740 -792
  324. package/dist/esm/native-engine/PhysicsEngine.js +585 -606
  325. package/dist/esm/native-engine/RenderingEngine.js +304 -349
  326. package/dist/esm/native-engine/SceneGraph.js +773 -807
  327. package/dist/esm/network/MultiplayerTransport.js +99 -131
  328. package/dist/esm/network/Networking.js +556 -563
  329. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/AbortController.js +22 -28
  330. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/AccessTokenHttpClient.js +41 -47
  331. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/DefaultHttpClient.js +36 -42
  332. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/DefaultReconnectPolicy.js +11 -14
  333. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/Errors.js +111 -134
  334. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/FetchHttpClient.js +132 -157
  335. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/HandshakeProtocol.js +40 -52
  336. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/HeaderNames.js +6 -7
  337. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/HttpClient.js +42 -47
  338. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/HttpConnection.js +496 -571
  339. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/HubConnection.js +828 -952
  340. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/HubConnectionBuilder.js +126 -145
  341. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/IHubProtocol.js +14 -23
  342. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/ILogger.js +12 -25
  343. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/ITransport.js +15 -24
  344. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/JsonHubProtocol.js +109 -120
  345. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/Loggers.js +11 -13
  346. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/LongPollingTransport.js +151 -184
  347. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/MessageBuffer.js +159 -195
  348. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/ServerSentEventsTransport.js +91 -104
  349. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/Subject.js +31 -34
  350. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/TextMessageFormat.js +17 -20
  351. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/Utils.js +230 -248
  352. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/WebSocketTransport.js +136 -156
  353. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/XhrHttpClient.js +77 -84
  354. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/index.js +31 -12
  355. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/pkg-version.js +4 -3
  356. package/dist/esm/pathfinding/Pathfinding.js +249 -262
  357. package/dist/esm/performance/AssetStreaming.js +567 -634
  358. package/dist/esm/performance/BenchmarkSuite.js +285 -310
  359. package/dist/esm/performance/DeltaCompression.js +478 -525
  360. package/dist/esm/performance/DeterministicPhysics.js +479 -497
  361. package/dist/esm/performance/ECSOptimization.js +653 -694
  362. package/dist/esm/performance/GameSaveSystem.js +515 -555
  363. package/dist/esm/performance/HotReload.js +454 -499
  364. package/dist/esm/performance/InputRecording.js +520 -560
  365. package/dist/esm/performance/InterestManagement.js +460 -499
  366. package/dist/esm/performance/LocalizationRuntime.js +382 -422
  367. package/dist/esm/performance/MemoryManagement.js +415 -469
  368. package/dist/esm/performance/ModSupport.js +455 -495
  369. package/dist/esm/performance/MultiThreadedPhysics.js +408 -442
  370. package/dist/esm/performance/NetworkPrediction.js +436 -481
  371. package/dist/esm/performance/ObjectPooling.js +582 -616
  372. package/dist/esm/performance/Performance.js +182 -189
  373. package/dist/esm/performance/PerformanceAdvanced.js +621 -636
  374. package/dist/esm/performance/WebGPURenderer.js +660 -682
  375. package/dist/esm/physics/PhysicsAdvanced.js +359 -378
  376. package/dist/esm/physics/PhysicsEngine2D.js +393 -426
  377. package/dist/esm/plugins/PluginSDK.js +435 -465
  378. package/dist/esm/plugins/PluginTestKit.js +315 -329
  379. package/dist/esm/procedural/Procedural.js +248 -253
  380. package/dist/esm/procedural/WorldBuilding.js +316 -313
  381. package/dist/esm/quest/QuestSystem.js +982 -931
  382. package/dist/esm/release/MobileExport.js +163 -162
  383. package/dist/esm/release/Release.js +234 -237
  384. package/dist/esm/rendering/Camera2D.js +122 -123
  385. package/dist/esm/rendering/Renderer2D.js +323 -334
  386. package/dist/esm/rendering/WebGPURenderPipeline.js +647 -650
  387. package/dist/esm/runtime3d/Runtime3D.js +368 -377
  388. package/dist/esm/runtime3d/SceneEditor3D.js +268 -262
  389. package/dist/esm/scene/SceneManager.js +178 -192
  390. package/dist/esm/scripting/GraphToAST.js +576 -546
  391. package/dist/esm/scripting/LanguageExporter.js +263 -278
  392. package/dist/esm/scripting/NodeGraph.js +550 -569
  393. package/dist/esm/scripting/ScriptAST.js +45 -38
  394. package/dist/esm/scripting/VisualScripting2.js +1025 -1064
  395. package/dist/esm/scripting/exporters/CSharpExporter.js +465 -495
  396. package/dist/esm/scripting/exporters/GDScriptExporter.js +391 -441
  397. package/dist/esm/scripting/exporters/LuaExporter.js +407 -446
  398. package/dist/esm/scripting/exporters/PythonExporter.js +485 -548
  399. package/dist/esm/scripting/exporters/RustExporter.js +460 -511
  400. package/dist/esm/scripting/exporters/TypeScriptExporter.js +506 -555
  401. package/dist/esm/social/Social.js +77 -79
  402. package/dist/esm/systems/LightingSystem.js +855 -930
  403. package/dist/esm/systems/ParticleSystem2.js +1453 -1450
  404. package/dist/esm/systems/PhysicsDebugSystem.js +1078 -1140
  405. package/dist/esm/systems/TerrainSystem.js +996 -1097
  406. package/dist/esm/templates/ActionTemplates.js +307 -308
  407. package/dist/esm/templates/FightingTemplate.js +439 -462
  408. package/dist/esm/templates/MetroidvaniaTemplate.js +391 -404
  409. package/dist/esm/templates/PartyTemplates.js +206 -201
  410. package/dist/esm/templates/PuzzleTemplates.js +260 -260
  411. package/dist/esm/templates/RPGTemplates.js +172 -177
  412. package/dist/esm/templates/SportsTemplates.js +251 -249
  413. package/dist/esm/templates/StrategyTemplates.js +158 -152
  414. package/dist/esm/templates/SurvivalTemplate.js +367 -379
  415. package/dist/esm/templates/WaveDefense.js +501 -525
  416. package/dist/esm/tilemap/Tilemap.js +209 -213
  417. package/dist/esm/tutorials/TutorialBranching.js +399 -416
  418. package/dist/esm/tutorials/TutorialEngine.js +893 -930
  419. package/dist/esm/tutorials/TutorialOverlay.js +603 -639
  420. package/dist/esm/tutorials/content/Tutorials_T05_T08.js +792 -808
  421. package/dist/esm/tutorials/content/Tutorials_T09_T11.js +740 -755
  422. package/dist/esm/tutorials/content/Tutorials_T12_T15.js +759 -777
  423. package/dist/esm/ui/GameUI.js +296 -311
  424. package/dist/esm/unity-integration/UnityAssetStore.js +704 -740
  425. package/dist/esm/unity-integration/UnityImport.js +1071 -1175
  426. package/dist/esm/unity-integration/UnityLiveLink.js +938 -980
  427. package/dist/esm/unity-integration/components/UnityAssetStoreBrowser.js +1234 -756
  428. package/dist/esm/unity-integration/components/UnityProjectBrowser.js +1241 -767
  429. package/dist/esm/unreal-integration/UnrealImport.js +395 -411
  430. package/dist/esm/unreal-integration/UnrealLiveLink.js +1105 -1136
  431. package/dist/esm/unreal-integration/UnrealMarketplace.js +442 -472
  432. package/dist/esm/unreal-integration/components/UnrealProjectBrowser.js +1151 -766
  433. package/dist/esm/xr/ARVR.js +181 -174
  434. package/package.json +7 -12
@@ -1,962 +1,932 @@
1
- 'use strict';
2
-
3
- /**
4
- * @file GodotLiveLink.ts
5
- * @description Godot Engine Live Link for Nice2Dev Game Engine
6
- * PRO-1.9.2: Godot Live Link
7
- *
8
- * Features:
9
- * - Godot Editor Plugin (GDScript)
10
- * - Scene tree synchronization
11
- * - Debug protocol integration
12
- * - Remote scene editing
13
- * - Live game viewport
14
- */
15
- // ============================================================
16
- // Godot Live Link Client
17
- // ============================================================
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
18
3
  class GodotLiveLinkClient {
19
- constructor(config) {
20
- this.callbacks = {};
21
- this.ws = null;
22
- this.heartbeatTimer = null;
23
- this.reconnectTimer = null;
24
- this.config = {
25
- url: 'ws://localhost:6006',
26
- autoReconnect: true,
27
- reconnectInterval: 3000,
28
- maxReconnectAttempts: 10,
29
- heartbeatInterval: 10000,
30
- clientId: `nice2dev-${Date.now()}`,
31
- enableDebug: true,
32
- ...config,
33
- };
34
- this.state = {
35
- isConnected: false,
36
- isReconnecting: false,
37
- reconnectAttempts: 0,
38
- selectedNodes: [],
39
- playState: {
40
- isPlaying: false,
41
- isPaused: false,
42
- isDebugging: false,
43
- },
44
- breakpoints: new Map(),
45
- };
46
- }
47
- // ─── Connection ────────────────────────────────────────
48
- connect() {
49
- if (this.ws?.readyState === WebSocket.OPEN) {
50
- return;
51
- }
52
- try {
53
- this.ws = new WebSocket(this.config.url);
54
- this.ws.onopen = () => {
55
- this.state.isConnected = true;
56
- this.state.isReconnecting = false;
57
- this.state.reconnectAttempts = 0;
58
- this.startHeartbeat();
59
- this.sendHandshake();
60
- };
61
- this.ws.onclose = (event) => {
62
- this.state.isConnected = false;
63
- this.stopHeartbeat();
64
- this.callbacks.onDisconnected?.(event.reason);
65
- if (this.config.autoReconnect &&
66
- this.state.reconnectAttempts < this.config.maxReconnectAttempts) {
67
- this.scheduleReconnect();
68
- }
69
- };
70
- this.ws.onerror = (_event) => {
71
- this.callbacks.onError?.(new Error('WebSocket error'));
72
- };
73
- this.ws.onmessage = (event) => {
74
- this.handleMessage(event.data);
75
- };
76
- }
77
- catch (error) {
78
- this.callbacks.onError?.(error);
79
- }
80
- }
81
- disconnect() {
82
- this.config.autoReconnect = false;
83
- this.stopHeartbeat();
84
- this.clearReconnect();
85
- if (this.ws) {
86
- this.ws.close(1000, 'Client disconnect');
87
- this.ws = null;
88
- }
89
- this.state.isConnected = false;
90
- }
91
- scheduleReconnect() {
92
- this.state.isReconnecting = true;
93
- this.state.reconnectAttempts++;
94
- this.reconnectTimer = setTimeout(() => {
95
- this.connect();
96
- }, this.config.reconnectInterval);
97
- }
98
- clearReconnect() {
99
- if (this.reconnectTimer) {
100
- clearTimeout(this.reconnectTimer);
101
- this.reconnectTimer = null;
102
- }
4
+ constructor(config) {
5
+ this.callbacks = {};
6
+ this.ws = null;
7
+ this.heartbeatTimer = null;
8
+ this.reconnectTimer = null;
9
+ this.config = {
10
+ url: "ws://localhost:6006",
11
+ autoReconnect: true,
12
+ reconnectInterval: 3e3,
13
+ maxReconnectAttempts: 10,
14
+ heartbeatInterval: 1e4,
15
+ clientId: `nice2dev-${Date.now()}`,
16
+ enableDebug: true,
17
+ ...config
18
+ };
19
+ this.state = {
20
+ isConnected: false,
21
+ isReconnecting: false,
22
+ reconnectAttempts: 0,
23
+ selectedNodes: [],
24
+ playState: {
25
+ isPlaying: false,
26
+ isPaused: false,
27
+ isDebugging: false
28
+ },
29
+ breakpoints: /* @__PURE__ */ new Map()
30
+ };
31
+ }
32
+ // ─── Connection ────────────────────────────────────────
33
+ connect() {
34
+ if (this.ws?.readyState === WebSocket.OPEN) {
35
+ return;
36
+ }
37
+ try {
38
+ this.ws = new WebSocket(this.config.url);
39
+ this.ws.onopen = () => {
40
+ this.state.isConnected = true;
103
41
  this.state.isReconnecting = false;
104
- }
105
- startHeartbeat() {
106
- this.heartbeatTimer = setInterval(() => {
107
- this.send({ type: 'ping', timestamp: Date.now(), payload: null });
108
- }, this.config.heartbeatInterval);
109
- }
110
- stopHeartbeat() {
111
- if (this.heartbeatTimer) {
112
- clearInterval(this.heartbeatTimer);
113
- this.heartbeatTimer = null;
114
- }
115
- }
116
- // ─── Message Handling ──────────────────────────────────
117
- sendHandshake() {
118
- this.send({
119
- type: 'handshake',
120
- timestamp: Date.now(),
121
- payload: {
122
- version: '1.0.0',
123
- clientId: this.config.clientId,
124
- clientType: 'nice2dev',
125
- capabilities: {
126
- liveEdit: true,
127
- remoteDebug: this.config.enableDebug,
128
- profiler: true,
129
- },
130
- },
131
- });
132
- }
133
- send(message) {
134
- if (this.ws?.readyState === WebSocket.OPEN) {
135
- this.ws.send(JSON.stringify(message));
136
- }
137
- }
138
- handleMessage(data) {
139
- try {
140
- const message = JSON.parse(data);
141
- switch (message.type) {
142
- case 'handshake_ack':
143
- this.state.editorInfo = message.payload;
144
- this.callbacks.onConnected?.(this.state.editorInfo);
145
- this.requestSceneTree();
146
- break;
147
- case 'scene_tree':
148
- this.state.currentSceneTree = message.payload;
149
- this.callbacks.onSceneTree?.(this.state.currentSceneTree);
150
- break;
151
- case 'node_selected': {
152
- const selection = message.payload;
153
- this.state.selectedNodes = selection.paths;
154
- this.callbacks.onNodeSelected?.(selection);
155
- break;
156
- }
157
- case 'node_property_changed':
158
- this.callbacks.onNodePropertyChanged?.(message.payload);
159
- break;
160
- case 'node_added':
161
- this.callbacks.onNodeAdded?.(message.payload);
162
- break;
163
- case 'node_removed':
164
- this.callbacks.onNodeRemoved?.(message.payload);
165
- break;
166
- case 'play_state_changed':
167
- this.state.playState = message.payload;
168
- this.callbacks.onPlayStateChanged?.(this.state.playState);
169
- break;
170
- case 'breakpoint_hit':
171
- this.callbacks.onBreakpointHit?.(message.payload);
172
- break;
173
- case 'console_output':
174
- this.callbacks.onConsoleOutput?.(message.payload);
175
- break;
176
- case 'pong':
177
- // Heartbeat response received
178
- break;
179
- case 'error':
180
- this.callbacks.onError?.(new Error(message.payload.message));
181
- break;
182
- }
183
- }
184
- catch (error) {
185
- this.callbacks.onError?.(error);
186
- }
187
- }
188
- // ─── Scene Tree Operations ─────────────────────────────
189
- requestSceneTree() {
190
- this.send({
191
- type: 'scene_tree',
192
- timestamp: Date.now(),
193
- payload: { request: true },
194
- });
195
- }
196
- selectNode(nodePath) {
197
- this.send({
198
- type: 'node_selected',
199
- timestamp: Date.now(),
200
- payload: { paths: [nodePath] },
201
- });
202
- }
203
- selectNodes(nodePaths) {
204
- this.send({
205
- type: 'node_selected',
206
- timestamp: Date.now(),
207
- payload: { paths: nodePaths },
208
- });
209
- }
210
- setNodeProperty(nodePath, property, value) {
211
- this.send({
212
- type: 'node_property_changed',
213
- timestamp: Date.now(),
214
- payload: {
215
- nodePath,
216
- property,
217
- value,
218
- },
219
- });
220
- }
221
- addNode(parentPath, nodeType, name) {
222
- this.send({
223
- type: 'node_added',
224
- timestamp: Date.now(),
225
- payload: {
226
- parentPath,
227
- nodeType,
228
- name,
229
- },
230
- });
231
- }
232
- removeNode(nodePath) {
233
- this.send({
234
- type: 'node_removed',
235
- timestamp: Date.now(),
236
- payload: { nodePath },
237
- });
238
- }
239
- reparentNode(nodePath, newParentPath, index) {
240
- this.send({
241
- type: 'node_reparented',
242
- timestamp: Date.now(),
243
- payload: {
244
- nodePath,
245
- newParentPath,
246
- index,
247
- },
248
- });
249
- }
250
- duplicateNode(nodePath) {
251
- this.send({
252
- type: 'node_added',
253
- timestamp: Date.now(),
254
- payload: {
255
- duplicate: nodePath,
256
- },
257
- });
258
- }
259
- // ─── Play Mode Control ─────────────────────────────────
260
- play() {
261
- this.send({
262
- type: 'play_state_changed',
263
- timestamp: Date.now(),
264
- payload: { action: 'play' },
265
- });
266
- }
267
- pause() {
268
- this.send({
269
- type: 'play_state_changed',
270
- timestamp: Date.now(),
271
- payload: { action: 'pause' },
272
- });
273
- }
274
- stop() {
275
- this.send({
276
- type: 'play_state_changed',
277
- timestamp: Date.now(),
278
- payload: { action: 'stop' },
279
- });
280
- }
281
- stepFrame() {
282
- this.send({
283
- type: 'play_state_changed',
284
- timestamp: Date.now(),
285
- payload: { action: 'step' },
286
- });
287
- }
288
- // ─── Debug Operations ──────────────────────────────────
289
- setBreakpoint(scriptPath, line) {
290
- const breakpoints = this.state.breakpoints.get(scriptPath) ?? [];
291
- if (!breakpoints.includes(line)) {
292
- breakpoints.push(line);
293
- this.state.breakpoints.set(scriptPath, breakpoints);
294
- }
295
- this.send({
296
- type: 'breakpoint_hit',
297
- timestamp: Date.now(),
298
- payload: {
299
- action: 'set',
300
- scriptPath,
301
- line,
302
- },
303
- });
304
- }
305
- removeBreakpoint(scriptPath, line) {
306
- const breakpoints = this.state.breakpoints.get(scriptPath) ?? [];
307
- const index = breakpoints.indexOf(line);
308
- if (index !== -1) {
309
- breakpoints.splice(index, 1);
310
- this.state.breakpoints.set(scriptPath, breakpoints);
42
+ this.state.reconnectAttempts = 0;
43
+ this.startHeartbeat();
44
+ this.sendHandshake();
45
+ };
46
+ this.ws.onclose = (event) => {
47
+ this.state.isConnected = false;
48
+ this.stopHeartbeat();
49
+ this.callbacks.onDisconnected?.(event.reason);
50
+ if (this.config.autoReconnect && this.state.reconnectAttempts < this.config.maxReconnectAttempts) {
51
+ this.scheduleReconnect();
311
52
  }
312
- this.send({
313
- type: 'breakpoint_hit',
314
- timestamp: Date.now(),
315
- payload: {
316
- action: 'remove',
317
- scriptPath,
318
- line,
319
- },
320
- });
321
- }
322
- clearBreakpoints(scriptPath) {
323
- if (scriptPath) {
324
- this.state.breakpoints.delete(scriptPath);
53
+ };
54
+ this.ws.onerror = (_event) => {
55
+ this.callbacks.onError?.(new Error("WebSocket error"));
56
+ };
57
+ this.ws.onmessage = (event) => {
58
+ this.handleMessage(event.data);
59
+ };
60
+ } catch (error) {
61
+ this.callbacks.onError?.(error);
62
+ }
63
+ }
64
+ disconnect() {
65
+ this.config.autoReconnect = false;
66
+ this.stopHeartbeat();
67
+ this.clearReconnect();
68
+ if (this.ws) {
69
+ this.ws.close(1e3, "Client disconnect");
70
+ this.ws = null;
71
+ }
72
+ this.state.isConnected = false;
73
+ }
74
+ scheduleReconnect() {
75
+ this.state.isReconnecting = true;
76
+ this.state.reconnectAttempts++;
77
+ this.reconnectTimer = setTimeout(() => {
78
+ this.connect();
79
+ }, this.config.reconnectInterval);
80
+ }
81
+ clearReconnect() {
82
+ if (this.reconnectTimer) {
83
+ clearTimeout(this.reconnectTimer);
84
+ this.reconnectTimer = null;
85
+ }
86
+ this.state.isReconnecting = false;
87
+ }
88
+ startHeartbeat() {
89
+ this.heartbeatTimer = setInterval(() => {
90
+ this.send({ type: "ping", timestamp: Date.now(), payload: null });
91
+ }, this.config.heartbeatInterval);
92
+ }
93
+ stopHeartbeat() {
94
+ if (this.heartbeatTimer) {
95
+ clearInterval(this.heartbeatTimer);
96
+ this.heartbeatTimer = null;
97
+ }
98
+ }
99
+ // ─── Message Handling ──────────────────────────────────
100
+ sendHandshake() {
101
+ this.send({
102
+ type: "handshake",
103
+ timestamp: Date.now(),
104
+ payload: {
105
+ version: "1.0.0",
106
+ clientId: this.config.clientId,
107
+ clientType: "nice2dev",
108
+ capabilities: {
109
+ liveEdit: true,
110
+ remoteDebug: this.config.enableDebug,
111
+ profiler: true
325
112
  }
326
- else {
327
- this.state.breakpoints.clear();
113
+ }
114
+ });
115
+ }
116
+ send(message) {
117
+ if (this.ws?.readyState === WebSocket.OPEN) {
118
+ this.ws.send(JSON.stringify(message));
119
+ }
120
+ }
121
+ handleMessage(data) {
122
+ try {
123
+ const message = JSON.parse(data);
124
+ switch (message.type) {
125
+ case "handshake_ack":
126
+ this.state.editorInfo = message.payload;
127
+ this.callbacks.onConnected?.(this.state.editorInfo);
128
+ this.requestSceneTree();
129
+ break;
130
+ case "scene_tree":
131
+ this.state.currentSceneTree = message.payload;
132
+ this.callbacks.onSceneTree?.(this.state.currentSceneTree);
133
+ break;
134
+ case "node_selected": {
135
+ const selection = message.payload;
136
+ this.state.selectedNodes = selection.paths;
137
+ this.callbacks.onNodeSelected?.(selection);
138
+ break;
328
139
  }
329
- this.send({
330
- type: 'breakpoint_hit',
331
- timestamp: Date.now(),
332
- payload: {
333
- action: 'clear',
334
- scriptPath,
335
- },
336
- });
337
- }
338
- continueExecution() {
339
- this.send({
340
- type: 'breakpoint_hit',
341
- timestamp: Date.now(),
342
- payload: { action: 'continue' },
343
- });
344
- }
345
- stepInto() {
346
- this.send({
347
- type: 'breakpoint_hit',
348
- timestamp: Date.now(),
349
- payload: { action: 'step_into' },
350
- });
351
- }
352
- stepOver() {
353
- this.send({
354
- type: 'breakpoint_hit',
355
- timestamp: Date.now(),
356
- payload: { action: 'step_over' },
357
- });
358
- }
359
- stepOut() {
360
- this.send({
361
- type: 'breakpoint_hit',
362
- timestamp: Date.now(),
363
- payload: { action: 'step_out' },
364
- });
365
- }
366
- getVariableValue(frameId, variable) {
367
- this.send({
368
- type: 'variable_value',
369
- timestamp: Date.now(),
370
- payload: {
371
- frameId,
372
- variable,
373
- },
374
- });
375
- }
376
- evaluateExpression(expression, frameId) {
377
- this.send({
378
- type: 'variable_value',
379
- timestamp: Date.now(),
380
- payload: {
381
- evaluate: expression,
382
- frameId,
383
- },
384
- });
385
- }
386
- // ─── State Access ──────────────────────────────────────
387
- getState() {
388
- return { ...this.state };
389
- }
390
- isConnected() {
391
- return this.state.isConnected;
392
- }
393
- getCurrentSceneTree() {
394
- return this.state.currentSceneTree;
395
- }
396
- getSelectedNodes() {
397
- return [...this.state.selectedNodes];
398
- }
399
- getPlayState() {
400
- return { ...this.state.playState };
401
- }
402
- // ─── Callbacks ─────────────────────────────────────────
403
- setCallbacks(callbacks) {
404
- this.callbacks = { ...this.callbacks, ...callbacks };
405
- }
140
+ case "node_property_changed":
141
+ this.callbacks.onNodePropertyChanged?.(message.payload);
142
+ break;
143
+ case "node_added":
144
+ this.callbacks.onNodeAdded?.(message.payload);
145
+ break;
146
+ case "node_removed":
147
+ this.callbacks.onNodeRemoved?.(message.payload);
148
+ break;
149
+ case "play_state_changed":
150
+ this.state.playState = message.payload;
151
+ this.callbacks.onPlayStateChanged?.(this.state.playState);
152
+ break;
153
+ case "breakpoint_hit":
154
+ this.callbacks.onBreakpointHit?.(message.payload);
155
+ break;
156
+ case "console_output":
157
+ this.callbacks.onConsoleOutput?.(message.payload);
158
+ break;
159
+ case "pong":
160
+ break;
161
+ case "error":
162
+ this.callbacks.onError?.(new Error(message.payload.message));
163
+ break;
164
+ }
165
+ } catch (error) {
166
+ this.callbacks.onError?.(error);
167
+ }
168
+ }
169
+ // ─── Scene Tree Operations ─────────────────────────────
170
+ requestSceneTree() {
171
+ this.send({
172
+ type: "scene_tree",
173
+ timestamp: Date.now(),
174
+ payload: { request: true }
175
+ });
176
+ }
177
+ selectNode(nodePath) {
178
+ this.send({
179
+ type: "node_selected",
180
+ timestamp: Date.now(),
181
+ payload: { paths: [nodePath] }
182
+ });
183
+ }
184
+ selectNodes(nodePaths) {
185
+ this.send({
186
+ type: "node_selected",
187
+ timestamp: Date.now(),
188
+ payload: { paths: nodePaths }
189
+ });
190
+ }
191
+ setNodeProperty(nodePath, property, value) {
192
+ this.send({
193
+ type: "node_property_changed",
194
+ timestamp: Date.now(),
195
+ payload: {
196
+ nodePath,
197
+ property,
198
+ value
199
+ }
200
+ });
201
+ }
202
+ addNode(parentPath, nodeType, name) {
203
+ this.send({
204
+ type: "node_added",
205
+ timestamp: Date.now(),
206
+ payload: {
207
+ parentPath,
208
+ nodeType,
209
+ name
210
+ }
211
+ });
212
+ }
213
+ removeNode(nodePath) {
214
+ this.send({
215
+ type: "node_removed",
216
+ timestamp: Date.now(),
217
+ payload: { nodePath }
218
+ });
219
+ }
220
+ reparentNode(nodePath, newParentPath, index) {
221
+ this.send({
222
+ type: "node_reparented",
223
+ timestamp: Date.now(),
224
+ payload: {
225
+ nodePath,
226
+ newParentPath,
227
+ index
228
+ }
229
+ });
230
+ }
231
+ duplicateNode(nodePath) {
232
+ this.send({
233
+ type: "node_added",
234
+ timestamp: Date.now(),
235
+ payload: {
236
+ duplicate: nodePath
237
+ }
238
+ });
239
+ }
240
+ // ─── Play Mode Control ─────────────────────────────────
241
+ play() {
242
+ this.send({
243
+ type: "play_state_changed",
244
+ timestamp: Date.now(),
245
+ payload: { action: "play" }
246
+ });
247
+ }
248
+ pause() {
249
+ this.send({
250
+ type: "play_state_changed",
251
+ timestamp: Date.now(),
252
+ payload: { action: "pause" }
253
+ });
254
+ }
255
+ stop() {
256
+ this.send({
257
+ type: "play_state_changed",
258
+ timestamp: Date.now(),
259
+ payload: { action: "stop" }
260
+ });
261
+ }
262
+ stepFrame() {
263
+ this.send({
264
+ type: "play_state_changed",
265
+ timestamp: Date.now(),
266
+ payload: { action: "step" }
267
+ });
268
+ }
269
+ // ─── Debug Operations ──────────────────────────────────
270
+ setBreakpoint(scriptPath, line) {
271
+ const breakpoints = this.state.breakpoints.get(scriptPath) ?? [];
272
+ if (!breakpoints.includes(line)) {
273
+ breakpoints.push(line);
274
+ this.state.breakpoints.set(scriptPath, breakpoints);
275
+ }
276
+ this.send({
277
+ type: "breakpoint_hit",
278
+ timestamp: Date.now(),
279
+ payload: {
280
+ action: "set",
281
+ scriptPath,
282
+ line
283
+ }
284
+ });
285
+ }
286
+ removeBreakpoint(scriptPath, line) {
287
+ const breakpoints = this.state.breakpoints.get(scriptPath) ?? [];
288
+ const index = breakpoints.indexOf(line);
289
+ if (index !== -1) {
290
+ breakpoints.splice(index, 1);
291
+ this.state.breakpoints.set(scriptPath, breakpoints);
292
+ }
293
+ this.send({
294
+ type: "breakpoint_hit",
295
+ timestamp: Date.now(),
296
+ payload: {
297
+ action: "remove",
298
+ scriptPath,
299
+ line
300
+ }
301
+ });
302
+ }
303
+ clearBreakpoints(scriptPath) {
304
+ if (scriptPath) {
305
+ this.state.breakpoints.delete(scriptPath);
306
+ } else {
307
+ this.state.breakpoints.clear();
308
+ }
309
+ this.send({
310
+ type: "breakpoint_hit",
311
+ timestamp: Date.now(),
312
+ payload: {
313
+ action: "clear",
314
+ scriptPath
315
+ }
316
+ });
317
+ }
318
+ continueExecution() {
319
+ this.send({
320
+ type: "breakpoint_hit",
321
+ timestamp: Date.now(),
322
+ payload: { action: "continue" }
323
+ });
324
+ }
325
+ stepInto() {
326
+ this.send({
327
+ type: "breakpoint_hit",
328
+ timestamp: Date.now(),
329
+ payload: { action: "step_into" }
330
+ });
331
+ }
332
+ stepOver() {
333
+ this.send({
334
+ type: "breakpoint_hit",
335
+ timestamp: Date.now(),
336
+ payload: { action: "step_over" }
337
+ });
338
+ }
339
+ stepOut() {
340
+ this.send({
341
+ type: "breakpoint_hit",
342
+ timestamp: Date.now(),
343
+ payload: { action: "step_out" }
344
+ });
345
+ }
346
+ getVariableValue(frameId, variable) {
347
+ this.send({
348
+ type: "variable_value",
349
+ timestamp: Date.now(),
350
+ payload: {
351
+ frameId,
352
+ variable
353
+ }
354
+ });
355
+ }
356
+ evaluateExpression(expression, frameId) {
357
+ this.send({
358
+ type: "variable_value",
359
+ timestamp: Date.now(),
360
+ payload: {
361
+ evaluate: expression,
362
+ frameId
363
+ }
364
+ });
365
+ }
366
+ // ─── State Access ──────────────────────────────────────
367
+ getState() {
368
+ return { ...this.state };
369
+ }
370
+ isConnected() {
371
+ return this.state.isConnected;
372
+ }
373
+ getCurrentSceneTree() {
374
+ return this.state.currentSceneTree;
375
+ }
376
+ getSelectedNodes() {
377
+ return [...this.state.selectedNodes];
378
+ }
379
+ getPlayState() {
380
+ return { ...this.state.playState };
381
+ }
382
+ // ─── Callbacks ─────────────────────────────────────────
383
+ setCallbacks(callbacks) {
384
+ this.callbacks = { ...this.callbacks, ...callbacks };
385
+ }
406
386
  }
407
- // ============================================================
408
- // Godot Editor Plugin Generator
409
- // ============================================================
410
- /**
411
- * Generates GDScript code for the Nice2Dev Live Link Godot editor plugin
412
- */
413
387
  function generateGodotLiveLinkPlugin() {
414
- const mainPlugin = `@tool
415
- extends EditorPlugin
416
-
417
- const Nice2DevDock = preload("res://addons/nice2dev_live_link/dock.gd")
418
- const Nice2DevServer = preload("res://addons/nice2dev_live_link/server.gd")
419
-
420
- var dock_instance: Control
421
- var server_instance: Nice2DevServer
422
-
423
-
424
- func _enter_tree() -> void:
425
- # Create the dock
426
- dock_instance = Nice2DevDock.new()
427
- add_control_to_dock(DOCK_SLOT_RIGHT_UL, dock_instance)
428
-
429
- # Create the WebSocket server
430
- server_instance = Nice2DevServer.new()
431
- add_child(server_instance)
432
-
433
- # Connect signals
434
- dock_instance.connect_requested.connect(_on_connect_requested)
435
- dock_instance.disconnect_requested.connect(_on_disconnect_requested)
436
-
437
- # Connect to editor signals
438
- var selection := get_editor_interface().get_selection()
439
- selection.selection_changed.connect(_on_selection_changed)
440
-
441
- # Scene changes
442
- get_editor_interface().get_resource_filesystem().filesystem_changed.connect(_on_filesystem_changed)
443
-
444
-
445
- func _exit_tree() -> void:
446
- if dock_instance:
447
- remove_control_from_docks(dock_instance)
448
- dock_instance.queue_free()
449
-
450
- if server_instance:
451
- server_instance.stop()
452
- server_instance.queue_free()
453
-
454
-
455
- func _on_connect_requested(port: int) -> void:
456
- server_instance.start(port)
457
- dock_instance.set_connected(true)
458
-
459
-
460
- func _on_disconnect_requested() -> void:
461
- server_instance.stop()
462
- dock_instance.set_connected(false)
463
-
464
-
465
- func _on_selection_changed() -> void:
466
- var selection := get_editor_interface().get_selection()
467
- var selected_nodes := selection.get_selected_nodes()
468
- var paths: Array[String] = []
469
- var ids: Array[int] = []
470
-
471
- for node in selected_nodes:
472
- paths.append(str(node.get_path()))
473
- ids.append(node.get_instance_id())
474
-
475
- server_instance.send_selection(paths, ids)
476
-
477
-
478
- func _on_filesystem_changed() -> void:
479
- # Notify Nice2Dev of file changes
480
- server_instance.send_filesystem_changed()
481
-
482
-
483
- func get_scene_tree_data() -> Dictionary:
484
- var root := get_editor_interface().get_edited_scene_root()
485
- if not root:
486
- return {}
487
-
488
- return {
489
- "rootPath": str(root.get_path()),
490
- "nodes": _serialize_node(root),
491
- "editedScenePath": root.scene_file_path
492
- }
493
-
494
-
495
- func _serialize_node(node: Node) -> Dictionary:
496
- var data := {
497
- "id": node.get_instance_id(),
498
- "name": node.name,
499
- "type": node.get_class(),
500
- "path": str(node.get_path()),
501
- "groups": node.get_groups(),
502
- "children": [],
503
- "isEditable": node.owner == get_editor_interface().get_edited_scene_root() or node == get_editor_interface().get_edited_scene_root()
504
- }
505
-
506
- if node.get_parent():
507
- data["parentId"] = node.get_parent().get_instance_id()
508
-
509
- if not node.scene_file_path.is_empty() and node != get_editor_interface().get_edited_scene_root():
510
- data["instancePath"] = node.scene_file_path
511
-
512
- var script := node.get_script()
513
- if script:
514
- data["script"] = script.resource_path
515
-
516
- for child in node.get_children():
517
- data["children"].append(_serialize_node(child))
518
-
519
- return data
388
+ const mainPlugin = `@tool
389
+ extends EditorPlugin
390
+
391
+ const Nice2DevDock = preload("res://addons/nice2dev_live_link/dock.gd")
392
+ const Nice2DevServer = preload("res://addons/nice2dev_live_link/server.gd")
393
+
394
+ var dock_instance: Control
395
+ var server_instance: Nice2DevServer
396
+
397
+
398
+ func _enter_tree() -> void:
399
+ # Create the dock
400
+ dock_instance = Nice2DevDock.new()
401
+ add_control_to_dock(DOCK_SLOT_RIGHT_UL, dock_instance)
402
+
403
+ # Create the WebSocket server
404
+ server_instance = Nice2DevServer.new()
405
+ add_child(server_instance)
406
+
407
+ # Connect signals
408
+ dock_instance.connect_requested.connect(_on_connect_requested)
409
+ dock_instance.disconnect_requested.connect(_on_disconnect_requested)
410
+
411
+ # Connect to editor signals
412
+ var selection := get_editor_interface().get_selection()
413
+ selection.selection_changed.connect(_on_selection_changed)
414
+
415
+ # Scene changes
416
+ get_editor_interface().get_resource_filesystem().filesystem_changed.connect(_on_filesystem_changed)
417
+
418
+
419
+ func _exit_tree() -> void:
420
+ if dock_instance:
421
+ remove_control_from_docks(dock_instance)
422
+ dock_instance.queue_free()
423
+
424
+ if server_instance:
425
+ server_instance.stop()
426
+ server_instance.queue_free()
427
+
428
+
429
+ func _on_connect_requested(port: int) -> void:
430
+ server_instance.start(port)
431
+ dock_instance.set_connected(true)
432
+
433
+
434
+ func _on_disconnect_requested() -> void:
435
+ server_instance.stop()
436
+ dock_instance.set_connected(false)
437
+
438
+
439
+ func _on_selection_changed() -> void:
440
+ var selection := get_editor_interface().get_selection()
441
+ var selected_nodes := selection.get_selected_nodes()
442
+ var paths: Array[String] = []
443
+ var ids: Array[int] = []
444
+
445
+ for node in selected_nodes:
446
+ paths.append(str(node.get_path()))
447
+ ids.append(node.get_instance_id())
448
+
449
+ server_instance.send_selection(paths, ids)
450
+
451
+
452
+ func _on_filesystem_changed() -> void:
453
+ # Notify Nice2Dev of file changes
454
+ server_instance.send_filesystem_changed()
455
+
456
+
457
+ func get_scene_tree_data() -> Dictionary:
458
+ var root := get_editor_interface().get_edited_scene_root()
459
+ if not root:
460
+ return {}
461
+
462
+ return {
463
+ "rootPath": str(root.get_path()),
464
+ "nodes": _serialize_node(root),
465
+ "editedScenePath": root.scene_file_path
466
+ }
467
+
468
+
469
+ func _serialize_node(node: Node) -> Dictionary:
470
+ var data := {
471
+ "id": node.get_instance_id(),
472
+ "name": node.name,
473
+ "type": node.get_class(),
474
+ "path": str(node.get_path()),
475
+ "groups": node.get_groups(),
476
+ "children": [],
477
+ "isEditable": node.owner == get_editor_interface().get_edited_scene_root() or node == get_editor_interface().get_edited_scene_root()
478
+ }
479
+
480
+ if node.get_parent():
481
+ data["parentId"] = node.get_parent().get_instance_id()
482
+
483
+ if not node.scene_file_path.is_empty() and node != get_editor_interface().get_edited_scene_root():
484
+ data["instancePath"] = node.scene_file_path
485
+
486
+ var script := node.get_script()
487
+ if script:
488
+ data["script"] = script.resource_path
489
+
490
+ for child in node.get_children():
491
+ data["children"].append(_serialize_node(child))
492
+
493
+ return data
520
494
  `;
521
- const dockScript = `@tool
522
- extends Control
523
-
524
- signal connect_requested(port: int)
525
- signal disconnect_requested
526
-
527
- var is_connected := false
528
-
529
-
530
- func _ready() -> void:
531
- # Build UI
532
- var vbox := VBoxContainer.new()
533
- add_child(vbox)
534
- vbox.set_anchors_preset(Control.PRESET_FULL_RECT)
535
-
536
- # Title
537
- var title := Label.new()
538
- title.text = "Nice2Dev Live Link"
539
- title.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
540
- vbox.add_child(title)
541
-
542
- # Separator
543
- vbox.add_child(HSeparator.new())
544
-
545
- # Port input
546
- var port_hbox := HBoxContainer.new()
547
- vbox.add_child(port_hbox)
548
-
549
- var port_label := Label.new()
550
- port_label.text = "Port:"
551
- port_hbox.add_child(port_label)
552
-
553
- var port_input := SpinBox.new()
554
- port_input.name = "PortInput"
555
- port_input.min_value = 1024
556
- port_input.max_value = 65535
557
- port_input.value = 6006
558
- port_input.size_flags_horizontal = Control.SIZE_EXPAND_FILL
559
- port_hbox.add_child(port_input)
560
-
561
- # Connect button
562
- var connect_btn := Button.new()
563
- connect_btn.name = "ConnectButton"
564
- connect_btn.text = "Start Server"
565
- connect_btn.pressed.connect(_on_connect_pressed)
566
- vbox.add_child(connect_btn)
567
-
568
- # Status
569
- var status := Label.new()
570
- status.name = "StatusLabel"
571
- status.text = "Status: Disconnected"
572
- status.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
573
- vbox.add_child(status)
574
-
575
- # Separator
576
- vbox.add_child(HSeparator.new())
577
-
578
- # Info label
579
- var info := Label.new()
580
- info.text = "Nice2Dev will connect to\\nthis Godot editor instance."
581
- info.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
582
- info.autowrap_mode = TextServer.AUTOWRAP_WORD
583
- vbox.add_child(info)
584
-
585
-
586
- func _on_connect_pressed() -> void:
587
- var port_input := get_node("VBoxContainer/HBoxContainer/PortInput") as SpinBox
588
- var connect_btn := get_node("VBoxContainer/ConnectButton") as Button
589
-
590
- if is_connected:
591
- disconnect_requested.emit()
592
- else:
593
- connect_requested.emit(int(port_input.value))
594
-
595
-
596
- func set_connected(connected: bool) -> void:
597
- is_connected = connected
598
-
599
- var connect_btn := get_node("VBoxContainer/ConnectButton") as Button
600
- var status := get_node("VBoxContainer/StatusLabel") as Label
601
-
602
- if connected:
603
- connect_btn.text = "Stop Server"
604
- status.text = "Status: Listening..."
605
- else:
606
- connect_btn.text = "Start Server"
607
- status.text = "Status: Disconnected"
608
-
609
-
610
- func set_client_connected(connected: bool, client_id: String = "") -> void:
611
- var status := get_node("VBoxContainer/StatusLabel") as Label
612
-
613
- if connected:
614
- status.text = "Status: Connected (%s)" % client_id
615
- elif is_connected:
616
- status.text = "Status: Listening..."
495
+ const dockScript = `@tool
496
+ extends Control
497
+
498
+ signal connect_requested(port: int)
499
+ signal disconnect_requested
500
+
501
+ var is_connected := false
502
+
503
+
504
+ func _ready() -> void:
505
+ # Build UI
506
+ var vbox := VBoxContainer.new()
507
+ add_child(vbox)
508
+ vbox.set_anchors_preset(Control.PRESET_FULL_RECT)
509
+
510
+ # Title
511
+ var title := Label.new()
512
+ title.text = "Nice2Dev Live Link"
513
+ title.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
514
+ vbox.add_child(title)
515
+
516
+ # Separator
517
+ vbox.add_child(HSeparator.new())
518
+
519
+ # Port input
520
+ var port_hbox := HBoxContainer.new()
521
+ vbox.add_child(port_hbox)
522
+
523
+ var port_label := Label.new()
524
+ port_label.text = "Port:"
525
+ port_hbox.add_child(port_label)
526
+
527
+ var port_input := SpinBox.new()
528
+ port_input.name = "PortInput"
529
+ port_input.min_value = 1024
530
+ port_input.max_value = 65535
531
+ port_input.value = 6006
532
+ port_input.size_flags_horizontal = Control.SIZE_EXPAND_FILL
533
+ port_hbox.add_child(port_input)
534
+
535
+ # Connect button
536
+ var connect_btn := Button.new()
537
+ connect_btn.name = "ConnectButton"
538
+ connect_btn.text = "Start Server"
539
+ connect_btn.pressed.connect(_on_connect_pressed)
540
+ vbox.add_child(connect_btn)
541
+
542
+ # Status
543
+ var status := Label.new()
544
+ status.name = "StatusLabel"
545
+ status.text = "Status: Disconnected"
546
+ status.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
547
+ vbox.add_child(status)
548
+
549
+ # Separator
550
+ vbox.add_child(HSeparator.new())
551
+
552
+ # Info label
553
+ var info := Label.new()
554
+ info.text = "Nice2Dev will connect to\\nthis Godot editor instance."
555
+ info.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
556
+ info.autowrap_mode = TextServer.AUTOWRAP_WORD
557
+ vbox.add_child(info)
558
+
559
+
560
+ func _on_connect_pressed() -> void:
561
+ var port_input := get_node("VBoxContainer/HBoxContainer/PortInput") as SpinBox
562
+ var connect_btn := get_node("VBoxContainer/ConnectButton") as Button
563
+
564
+ if is_connected:
565
+ disconnect_requested.emit()
566
+ else:
567
+ connect_requested.emit(int(port_input.value))
568
+
569
+
570
+ func set_connected(connected: bool) -> void:
571
+ is_connected = connected
572
+
573
+ var connect_btn := get_node("VBoxContainer/ConnectButton") as Button
574
+ var status := get_node("VBoxContainer/StatusLabel") as Label
575
+
576
+ if connected:
577
+ connect_btn.text = "Stop Server"
578
+ status.text = "Status: Listening..."
579
+ else:
580
+ connect_btn.text = "Start Server"
581
+ status.text = "Status: Disconnected"
582
+
583
+
584
+ func set_client_connected(connected: bool, client_id: String = "") -> void:
585
+ var status := get_node("VBoxContainer/StatusLabel") as Label
586
+
587
+ if connected:
588
+ status.text = "Status: Connected (%s)" % client_id
589
+ elif is_connected:
590
+ status.text = "Status: Listening..."
617
591
  `;
618
- const serverScript = `@tool
619
- extends Node
620
-
621
- signal client_connected(client_id: String)
622
- signal client_disconnected(client_id: String)
623
- signal message_received(type: String, payload: Dictionary)
624
-
625
- var tcp_server: TCPServer
626
- var ws_peers: Dictionary = {} # peer_id -> WebSocketPeer
627
- var port: int = 6006
628
-
629
-
630
- func start(p: int) -> void:
631
- port = p
632
- tcp_server = TCPServer.new()
633
- var err := tcp_server.listen(port)
634
- if err != OK:
635
- push_error("Nice2Dev Live Link: Failed to start server on port %d" % port)
636
- return
637
-
638
- print("Nice2Dev Live Link: Server started on port %d" % port)
639
-
640
-
641
- func stop() -> void:
642
- for peer_id in ws_peers.keys():
643
- var peer: WebSocketPeer = ws_peers[peer_id]
644
- peer.close()
645
- ws_peers.clear()
646
-
647
- if tcp_server:
648
- tcp_server.stop()
649
- tcp_server = null
650
-
651
- print("Nice2Dev Live Link: Server stopped")
652
-
653
-
654
- func _process(_delta: float) -> void:
655
- if not tcp_server:
656
- return
657
-
658
- # Accept new connections
659
- if tcp_server.is_connection_available():
660
- var stream := tcp_server.take_connection()
661
- var ws := WebSocketPeer.new()
662
- ws.accept_stream(stream)
663
- var peer_id := stream.get_instance_id()
664
- ws_peers[peer_id] = ws
665
- print("Nice2Dev Live Link: New connection pending")
666
-
667
- # Process existing connections
668
- for peer_id in ws_peers.keys():
669
- var ws: WebSocketPeer = ws_peers[peer_id]
670
- ws.poll()
671
-
672
- var state := ws.get_ready_state()
673
- match state:
674
- WebSocketPeer.STATE_OPEN:
675
- while ws.get_available_packet_count() > 0:
676
- var packet := ws.get_packet()
677
- _handle_packet(peer_id, packet)
678
-
679
- WebSocketPeer.STATE_CLOSED:
680
- var code := ws.get_close_code()
681
- print("Nice2Dev Live Link: Connection closed (%d)" % code)
682
- ws_peers.erase(peer_id)
683
- client_disconnected.emit(str(peer_id))
684
-
685
-
686
- func _handle_packet(peer_id: int, packet: PackedByteArray) -> void:
687
- var text := packet.get_string_from_utf8()
688
- var json := JSON.new()
689
- var err := json.parse(text)
690
-
691
- if err != OK:
692
- push_warning("Nice2Dev Live Link: Failed to parse message")
693
- return
694
-
695
- var message: Dictionary = json.data
696
- var msg_type: String = message.get("type", "")
697
- var payload: Dictionary = message.get("payload", {})
698
-
699
- match msg_type:
700
- "handshake":
701
- _handle_handshake(peer_id, payload)
702
-
703
- "scene_tree":
704
- _send_scene_tree(peer_id)
705
-
706
- "node_selected":
707
- _handle_node_selection(payload)
708
-
709
- "node_property_changed":
710
- _handle_property_change(payload)
711
-
712
- "node_added":
713
- _handle_node_add(payload)
714
-
715
- "node_removed":
716
- _handle_node_remove(payload)
717
-
718
- "play_state_changed":
719
- _handle_play_state(payload)
720
-
721
- "ping":
722
- _send_pong(peer_id)
723
-
724
- _:
725
- message_received.emit(msg_type, payload)
726
-
727
-
728
- func _handle_handshake(peer_id: int, payload: Dictionary) -> void:
729
- var client_id := payload.get("clientId", "unknown")
730
- print("Nice2Dev Live Link: Client connected - %s" % client_id)
731
- client_connected.emit(client_id)
732
-
733
- # Send acknowledgment
734
- var plugin := _get_plugin()
735
- var ack := {
736
- "type": "handshake_ack",
737
- "timestamp": Time.get_unix_time_from_system() * 1000,
738
- "payload": {
739
- "version": "1.0.0",
740
- "projectName": ProjectSettings.get_setting("application/config/name"),
741
- "godotVersion": Engine.get_version_info().string,
742
- "editorId": str(get_instance_id()),
743
- "capabilities": {
744
- "remoteDebug": true,
745
- "liveEdit": true,
746
- "profiler": true,
747
- "visualProfiler": true,
748
- "networkProfiler": false
749
- }
750
- }
751
- }
752
- _send(peer_id, ack)
753
-
754
-
755
- func _send_scene_tree(peer_id: int) -> void:
756
- var plugin := _get_plugin()
757
- if not plugin:
758
- return
759
-
760
- var tree_data := plugin.get_scene_tree_data()
761
- var msg := {
762
- "type": "scene_tree",
763
- "timestamp": Time.get_unix_time_from_system() * 1000,
764
- "payload": tree_data
765
- }
766
- _send(peer_id, msg)
767
-
768
-
769
- func _handle_node_selection(payload: Dictionary) -> void:
770
- var paths: Array = payload.get("paths", [])
771
- if paths.is_empty():
772
- return
773
-
774
- var plugin := _get_plugin()
775
- if not plugin:
776
- return
777
-
778
- var selection := plugin.get_editor_interface().get_selection()
779
- selection.clear()
780
-
781
- var root := plugin.get_editor_interface().get_edited_scene_root()
782
- if not root:
783
- return
784
-
785
- for path in paths:
786
- var node := root.get_node_or_null(NodePath(path))
787
- if node:
788
- selection.add_node(node)
789
-
790
-
791
- func _handle_property_change(payload: Dictionary) -> void:
792
- var node_path: String = payload.get("nodePath", "")
793
- var property: String = payload.get("property", "")
794
- var value = payload.get("value")
795
-
796
- var plugin := _get_plugin()
797
- if not plugin:
798
- return
799
-
800
- var root := plugin.get_editor_interface().get_edited_scene_root()
801
- if not root:
802
- return
803
-
804
- var node := root.get_node_or_null(NodePath(node_path))
805
- if node and property:
806
- node.set(property, value)
807
-
808
-
809
- func _handle_node_add(payload: Dictionary) -> void:
810
- var parent_path: String = payload.get("parentPath", "")
811
- var node_type: String = payload.get("nodeType", "Node")
812
- var node_name: String = payload.get("name", "NewNode")
813
-
814
- var plugin := _get_plugin()
815
- if not plugin:
816
- return
817
-
818
- var root := plugin.get_editor_interface().get_edited_scene_root()
819
- if not root:
820
- return
821
-
822
- var parent := root.get_node_or_null(NodePath(parent_path))
823
- if not parent:
824
- parent = root
825
-
826
- var new_node := ClassDB.instantiate(node_type)
827
- if new_node:
828
- new_node.name = node_name
829
- parent.add_child(new_node, true)
830
- new_node.owner = root
831
-
832
-
833
- func _handle_node_remove(payload: Dictionary) -> void:
834
- var node_path: String = payload.get("nodePath", "")
835
-
836
- var plugin := _get_plugin()
837
- if not plugin:
838
- return
839
-
840
- var root := plugin.get_editor_interface().get_edited_scene_root()
841
- if not root:
842
- return
843
-
844
- var node := root.get_node_or_null(NodePath(node_path))
845
- if node and node != root:
846
- node.queue_free()
847
-
848
-
849
- func _handle_play_state(payload: Dictionary) -> void:
850
- var action: String = payload.get("action", "")
851
- var plugin := _get_plugin()
852
- if not plugin:
853
- return
854
-
855
- match action:
856
- "play":
857
- plugin.get_editor_interface().play_main_scene()
858
- "stop":
859
- plugin.get_editor_interface().stop_playing_scene()
860
- "pause":
861
- # Toggle pause - requires debugger
862
- pass
863
-
864
-
865
- func _send_pong(peer_id: int) -> void:
866
- _send(peer_id, {
867
- "type": "pong",
868
- "timestamp": Time.get_unix_time_from_system() * 1000,
869
- "payload": null
870
- })
871
-
872
-
873
- func send_selection(paths: Array[String], ids: Array[int]) -> void:
874
- _broadcast({
875
- "type": "node_selected",
876
- "timestamp": Time.get_unix_time_from_system() * 1000,
877
- "payload": {
878
- "paths": paths,
879
- "nodeIds": ids
880
- }
881
- })
882
-
883
-
884
- func send_filesystem_changed() -> void:
885
- _broadcast({
886
- "type": "resource_changed",
887
- "timestamp": Time.get_unix_time_from_system() * 1000,
888
- "payload": {}
889
- })
890
-
891
-
892
- func _send(peer_id: int, data: Dictionary) -> void:
893
- if ws_peers.has(peer_id):
894
- var ws: WebSocketPeer = ws_peers[peer_id]
895
- ws.send_text(JSON.stringify(data))
896
-
897
-
898
- func _broadcast(data: Dictionary) -> void:
899
- var text := JSON.stringify(data)
900
- for peer_id in ws_peers.keys():
901
- var ws: WebSocketPeer = ws_peers[peer_id]
902
- if ws.get_ready_state() == WebSocketPeer.STATE_OPEN:
903
- ws.send_text(text)
904
-
905
-
906
- func _get_plugin() -> EditorPlugin:
907
- return get_parent() as EditorPlugin
592
+ const serverScript = `@tool
593
+ extends Node
594
+
595
+ signal client_connected(client_id: String)
596
+ signal client_disconnected(client_id: String)
597
+ signal message_received(type: String, payload: Dictionary)
598
+
599
+ var tcp_server: TCPServer
600
+ var ws_peers: Dictionary = {} # peer_id -> WebSocketPeer
601
+ var port: int = 6006
602
+
603
+
604
+ func start(p: int) -> void:
605
+ port = p
606
+ tcp_server = TCPServer.new()
607
+ var err := tcp_server.listen(port)
608
+ if err != OK:
609
+ push_error("Nice2Dev Live Link: Failed to start server on port %d" % port)
610
+ return
611
+
612
+ print("Nice2Dev Live Link: Server started on port %d" % port)
613
+
614
+
615
+ func stop() -> void:
616
+ for peer_id in ws_peers.keys():
617
+ var peer: WebSocketPeer = ws_peers[peer_id]
618
+ peer.close()
619
+ ws_peers.clear()
620
+
621
+ if tcp_server:
622
+ tcp_server.stop()
623
+ tcp_server = null
624
+
625
+ print("Nice2Dev Live Link: Server stopped")
626
+
627
+
628
+ func _process(_delta: float) -> void:
629
+ if not tcp_server:
630
+ return
631
+
632
+ # Accept new connections
633
+ if tcp_server.is_connection_available():
634
+ var stream := tcp_server.take_connection()
635
+ var ws := WebSocketPeer.new()
636
+ ws.accept_stream(stream)
637
+ var peer_id := stream.get_instance_id()
638
+ ws_peers[peer_id] = ws
639
+ print("Nice2Dev Live Link: New connection pending")
640
+
641
+ # Process existing connections
642
+ for peer_id in ws_peers.keys():
643
+ var ws: WebSocketPeer = ws_peers[peer_id]
644
+ ws.poll()
645
+
646
+ var state := ws.get_ready_state()
647
+ match state:
648
+ WebSocketPeer.STATE_OPEN:
649
+ while ws.get_available_packet_count() > 0:
650
+ var packet := ws.get_packet()
651
+ _handle_packet(peer_id, packet)
652
+
653
+ WebSocketPeer.STATE_CLOSED:
654
+ var code := ws.get_close_code()
655
+ print("Nice2Dev Live Link: Connection closed (%d)" % code)
656
+ ws_peers.erase(peer_id)
657
+ client_disconnected.emit(str(peer_id))
658
+
659
+
660
+ func _handle_packet(peer_id: int, packet: PackedByteArray) -> void:
661
+ var text := packet.get_string_from_utf8()
662
+ var json := JSON.new()
663
+ var err := json.parse(text)
664
+
665
+ if err != OK:
666
+ push_warning("Nice2Dev Live Link: Failed to parse message")
667
+ return
668
+
669
+ var message: Dictionary = json.data
670
+ var msg_type: String = message.get("type", "")
671
+ var payload: Dictionary = message.get("payload", {})
672
+
673
+ match msg_type:
674
+ "handshake":
675
+ _handle_handshake(peer_id, payload)
676
+
677
+ "scene_tree":
678
+ _send_scene_tree(peer_id)
679
+
680
+ "node_selected":
681
+ _handle_node_selection(payload)
682
+
683
+ "node_property_changed":
684
+ _handle_property_change(payload)
685
+
686
+ "node_added":
687
+ _handle_node_add(payload)
688
+
689
+ "node_removed":
690
+ _handle_node_remove(payload)
691
+
692
+ "play_state_changed":
693
+ _handle_play_state(payload)
694
+
695
+ "ping":
696
+ _send_pong(peer_id)
697
+
698
+ _:
699
+ message_received.emit(msg_type, payload)
700
+
701
+
702
+ func _handle_handshake(peer_id: int, payload: Dictionary) -> void:
703
+ var client_id := payload.get("clientId", "unknown")
704
+ print("Nice2Dev Live Link: Client connected - %s" % client_id)
705
+ client_connected.emit(client_id)
706
+
707
+ # Send acknowledgment
708
+ var plugin := _get_plugin()
709
+ var ack := {
710
+ "type": "handshake_ack",
711
+ "timestamp": Time.get_unix_time_from_system() * 1000,
712
+ "payload": {
713
+ "version": "1.0.0",
714
+ "projectName": ProjectSettings.get_setting("application/config/name"),
715
+ "godotVersion": Engine.get_version_info().string,
716
+ "editorId": str(get_instance_id()),
717
+ "capabilities": {
718
+ "remoteDebug": true,
719
+ "liveEdit": true,
720
+ "profiler": true,
721
+ "visualProfiler": true,
722
+ "networkProfiler": false
723
+ }
724
+ }
725
+ }
726
+ _send(peer_id, ack)
727
+
728
+
729
+ func _send_scene_tree(peer_id: int) -> void:
730
+ var plugin := _get_plugin()
731
+ if not plugin:
732
+ return
733
+
734
+ var tree_data := plugin.get_scene_tree_data()
735
+ var msg := {
736
+ "type": "scene_tree",
737
+ "timestamp": Time.get_unix_time_from_system() * 1000,
738
+ "payload": tree_data
739
+ }
740
+ _send(peer_id, msg)
741
+
742
+
743
+ func _handle_node_selection(payload: Dictionary) -> void:
744
+ var paths: Array = payload.get("paths", [])
745
+ if paths.is_empty():
746
+ return
747
+
748
+ var plugin := _get_plugin()
749
+ if not plugin:
750
+ return
751
+
752
+ var selection := plugin.get_editor_interface().get_selection()
753
+ selection.clear()
754
+
755
+ var root := plugin.get_editor_interface().get_edited_scene_root()
756
+ if not root:
757
+ return
758
+
759
+ for path in paths:
760
+ var node := root.get_node_or_null(NodePath(path))
761
+ if node:
762
+ selection.add_node(node)
763
+
764
+
765
+ func _handle_property_change(payload: Dictionary) -> void:
766
+ var node_path: String = payload.get("nodePath", "")
767
+ var property: String = payload.get("property", "")
768
+ var value = payload.get("value")
769
+
770
+ var plugin := _get_plugin()
771
+ if not plugin:
772
+ return
773
+
774
+ var root := plugin.get_editor_interface().get_edited_scene_root()
775
+ if not root:
776
+ return
777
+
778
+ var node := root.get_node_or_null(NodePath(node_path))
779
+ if node and property:
780
+ node.set(property, value)
781
+
782
+
783
+ func _handle_node_add(payload: Dictionary) -> void:
784
+ var parent_path: String = payload.get("parentPath", "")
785
+ var node_type: String = payload.get("nodeType", "Node")
786
+ var node_name: String = payload.get("name", "NewNode")
787
+
788
+ var plugin := _get_plugin()
789
+ if not plugin:
790
+ return
791
+
792
+ var root := plugin.get_editor_interface().get_edited_scene_root()
793
+ if not root:
794
+ return
795
+
796
+ var parent := root.get_node_or_null(NodePath(parent_path))
797
+ if not parent:
798
+ parent = root
799
+
800
+ var new_node := ClassDB.instantiate(node_type)
801
+ if new_node:
802
+ new_node.name = node_name
803
+ parent.add_child(new_node, true)
804
+ new_node.owner = root
805
+
806
+
807
+ func _handle_node_remove(payload: Dictionary) -> void:
808
+ var node_path: String = payload.get("nodePath", "")
809
+
810
+ var plugin := _get_plugin()
811
+ if not plugin:
812
+ return
813
+
814
+ var root := plugin.get_editor_interface().get_edited_scene_root()
815
+ if not root:
816
+ return
817
+
818
+ var node := root.get_node_or_null(NodePath(node_path))
819
+ if node and node != root:
820
+ node.queue_free()
821
+
822
+
823
+ func _handle_play_state(payload: Dictionary) -> void:
824
+ var action: String = payload.get("action", "")
825
+ var plugin := _get_plugin()
826
+ if not plugin:
827
+ return
828
+
829
+ match action:
830
+ "play":
831
+ plugin.get_editor_interface().play_main_scene()
832
+ "stop":
833
+ plugin.get_editor_interface().stop_playing_scene()
834
+ "pause":
835
+ # Toggle pause - requires debugger
836
+ pass
837
+
838
+
839
+ func _send_pong(peer_id: int) -> void:
840
+ _send(peer_id, {
841
+ "type": "pong",
842
+ "timestamp": Time.get_unix_time_from_system() * 1000,
843
+ "payload": null
844
+ })
845
+
846
+
847
+ func send_selection(paths: Array[String], ids: Array[int]) -> void:
848
+ _broadcast({
849
+ "type": "node_selected",
850
+ "timestamp": Time.get_unix_time_from_system() * 1000,
851
+ "payload": {
852
+ "paths": paths,
853
+ "nodeIds": ids
854
+ }
855
+ })
856
+
857
+
858
+ func send_filesystem_changed() -> void:
859
+ _broadcast({
860
+ "type": "resource_changed",
861
+ "timestamp": Time.get_unix_time_from_system() * 1000,
862
+ "payload": {}
863
+ })
864
+
865
+
866
+ func _send(peer_id: int, data: Dictionary) -> void:
867
+ if ws_peers.has(peer_id):
868
+ var ws: WebSocketPeer = ws_peers[peer_id]
869
+ ws.send_text(JSON.stringify(data))
870
+
871
+
872
+ func _broadcast(data: Dictionary) -> void:
873
+ var text := JSON.stringify(data)
874
+ for peer_id in ws_peers.keys():
875
+ var ws: WebSocketPeer = ws_peers[peer_id]
876
+ if ws.get_ready_state() == WebSocketPeer.STATE_OPEN:
877
+ ws.send_text(text)
878
+
879
+
880
+ func _get_plugin() -> EditorPlugin:
881
+ return get_parent() as EditorPlugin
908
882
  `;
909
- const pluginCfg = `[plugin]
910
-
911
- name="Nice2Dev Live Link"
912
- description="Real-time synchronization between Godot Editor and Nice2Dev"
913
- author="Nice2Dev"
914
- version="1.0.0"
915
- script="plugin.gd"
883
+ const pluginCfg = `[plugin]
884
+
885
+ name="Nice2Dev Live Link"
886
+ description="Real-time synchronization between Godot Editor and Nice2Dev"
887
+ author="Nice2Dev"
888
+ version="1.0.0"
889
+ script="plugin.gd"
916
890
  `;
917
- return {
918
- files: {
919
- 'addons/nice2dev_live_link/plugin.gd': mainPlugin,
920
- 'addons/nice2dev_live_link/dock.gd': dockScript,
921
- 'addons/nice2dev_live_link/server.gd': serverScript,
922
- 'addons/nice2dev_live_link/plugin.cfg': pluginCfg,
923
- },
924
- readme: `# Nice2Dev Live Link for Godot
925
-
926
- ## Installation
927
-
928
- 1. Copy the \`addons/nice2dev_live_link\` folder to your Godot project's \`addons\` folder.
929
- 2. In Godot, go to Project → Project Settings → Plugins
930
- 3. Enable the "Nice2Dev Live Link" plugin
931
-
932
- ## Usage
933
-
934
- 1. The "Nice2Dev Live Link" dock will appear in the editor
935
- 2. Click "Start Server" to begin listening for connections
936
- 3. In Nice2Dev, connect to the Godot editor using the configured port
937
-
938
- ## Features
939
-
940
- - Real-time scene tree synchronization
941
- - Selection mirroring between editors
942
- - Remote property editing
943
- - Play mode control (play/stop)
944
- - Node creation and deletion
945
-
946
- ## Protocol
947
-
948
- The plugin uses WebSocket for communication with JSON messages.
949
- Default port: 6006
950
- `,
951
- };
891
+ return {
892
+ files: {
893
+ "addons/nice2dev_live_link/plugin.gd": mainPlugin,
894
+ "addons/nice2dev_live_link/dock.gd": dockScript,
895
+ "addons/nice2dev_live_link/server.gd": serverScript,
896
+ "addons/nice2dev_live_link/plugin.cfg": pluginCfg
897
+ },
898
+ readme: `# Nice2Dev Live Link for Godot
899
+
900
+ ## Installation
901
+
902
+ 1. Copy the \`addons/nice2dev_live_link\` folder to your Godot project's \`addons\` folder.
903
+ 2. In Godot, go to Project → Project Settings → Plugins
904
+ 3. Enable the "Nice2Dev Live Link" plugin
905
+
906
+ ## Usage
907
+
908
+ 1. The "Nice2Dev Live Link" dock will appear in the editor
909
+ 2. Click "Start Server" to begin listening for connections
910
+ 3. In Nice2Dev, connect to the Godot editor using the configured port
911
+
912
+ ## Features
913
+
914
+ - Real-time scene tree synchronization
915
+ - Selection mirroring between editors
916
+ - Remote property editing
917
+ - Play mode control (play/stop)
918
+ - Node creation and deletion
919
+
920
+ ## Protocol
921
+
922
+ The plugin uses WebSocket for communication with JSON messages.
923
+ Default port: 6006
924
+ `
925
+ };
952
926
  }
953
- // ============================================================
954
- // Factory Functions
955
- // ============================================================
956
927
  function createGodotLiveLinkClient(config) {
957
- return new GodotLiveLinkClient(config);
928
+ return new GodotLiveLinkClient(config);
958
929
  }
959
-
960
930
  exports.GodotLiveLinkClient = GodotLiveLinkClient;
961
931
  exports.createGodotLiveLinkClient = createGodotLiveLinkClient;
962
932
  exports.generateGodotLiveLinkPlugin = generateGodotLiveLinkPlugin;