diff --git a/TechbloxModdingAPI/App/AppEngine.cs b/TechbloxModdingAPI/App/AppEngine.cs index 74c0d22..741c576 100644 --- a/TechbloxModdingAPI/App/AppEngine.cs +++ b/TechbloxModdingAPI/App/AppEngine.cs @@ -1,7 +1,6 @@ using System; using RobocraftX.GUI.MyGamesScreen; -using RobocraftX.GUI; using Svelto.ECS; using TechbloxModdingAPI.Engines; using TechbloxModdingAPI.Utility; diff --git a/TechbloxModdingAPI/App/Game.cs b/TechbloxModdingAPI/App/Game.cs index 1d37945..e543270 100644 --- a/TechbloxModdingAPI/App/Game.cs +++ b/TechbloxModdingAPI/App/Game.cs @@ -473,6 +473,15 @@ namespace TechbloxModdingAPI.App return blocks; } + /// + /// Enable the screenshot taker for updating the game's screenshot. Breaks the pause menu in a new save. + /// + public void EnableScreenshotTaker() + { + if (!VerifyMode()) return; + gameEngine.EnableScreenshotTaker(); + } + ~Game() { foreach (string id in debugIds) diff --git a/TechbloxModdingAPI/App/GameGameEngine.cs b/TechbloxModdingAPI/App/GameGameEngine.cs index eceee8b..51c53c8 100644 --- a/TechbloxModdingAPI/App/GameGameEngine.cs +++ b/TechbloxModdingAPI/App/GameGameEngine.cs @@ -10,6 +10,7 @@ using Svelto.ECS; using Svelto.Tasks; using Svelto.Tasks.Lean; using RobocraftX.Blocks; +using RobocraftX.ScreenshotTaker; using TechbloxModdingAPI.Blocks; using TechbloxModdingAPI.Engines; using TechbloxModdingAPI.Utility; @@ -129,5 +130,14 @@ namespace TechbloxModdingAPI.App return blockEGIDs.ToArray(); } } + + public void EnableScreenshotTaker() + { + ref var local = ref entitiesDB.QueryEntity(ScreenshotTakerEgids.ScreenshotTaker); + if (local.enabled) + return; + local.enabled = true; + entitiesDB.PublishEntityChange(ScreenshotTakerEgids.ScreenshotTaker); + } } } diff --git a/TechbloxModdingAPI/Tests/TechbloxModdingAPIPluginTest.cs b/TechbloxModdingAPI/Tests/TechbloxModdingAPIPluginTest.cs index 5bd3a7f..222331f 100644 --- a/TechbloxModdingAPI/Tests/TechbloxModdingAPIPluginTest.cs +++ b/TechbloxModdingAPI/Tests/TechbloxModdingAPIPluginTest.cs @@ -282,6 +282,12 @@ namespace TechbloxModdingAPI.Tests .Select(kv => $"{kv.Key}: {((MaterialPropertiesData) kv.Value).Name}") .Aggregate((a, b) => a + "\n" + b)); };*/ + + CommandBuilder.Builder("takeScreenshot", "Enables the screenshot taker") + .Action(() => + { + Game.CurrentGame().EnableScreenshotTaker(); + }).Build(); #if TEST TestRoot.RunTests(); #endif