Browse Source

Add support for enabling the screenshot taker, even in sim

tags/v2.0
NorbiPeti 2 years ago
parent
commit
76faa69c74
4 changed files with 25 additions and 1 deletions
  1. +0
    -1
      TechbloxModdingAPI/App/AppEngine.cs
  2. +9
    -0
      TechbloxModdingAPI/App/Game.cs
  3. +10
    -0
      TechbloxModdingAPI/App/GameGameEngine.cs
  4. +6
    -0
      TechbloxModdingAPI/Tests/TechbloxModdingAPIPluginTest.cs

+ 0
- 1
TechbloxModdingAPI/App/AppEngine.cs View File

@@ -1,7 +1,6 @@
using System;

using RobocraftX.GUI.MyGamesScreen;
using RobocraftX.GUI;
using Svelto.ECS;
using TechbloxModdingAPI.Engines;
using TechbloxModdingAPI.Utility;


+ 9
- 0
TechbloxModdingAPI/App/Game.cs View File

@@ -473,6 +473,15 @@ namespace TechbloxModdingAPI.App
return blocks;
}

/// <summary>
/// Enable the screenshot taker for updating the game's screenshot. Breaks the pause menu in a new save.
/// </summary>
public void EnableScreenshotTaker()
{
if (!VerifyMode()) return;
gameEngine.EnableScreenshotTaker();
}

~Game()
{
foreach (string id in debugIds)


+ 10
- 0
TechbloxModdingAPI/App/GameGameEngine.cs View File

@@ -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<ScreenshotModeEntityStruct>(ScreenshotTakerEgids.ScreenshotTaker);
if (local.enabled)
return;
local.enabled = true;
entitiesDB.PublishEntityChange<ScreenshotModeEntityStruct>(ScreenshotTakerEgids.ScreenshotTaker);
}
}
}

+ 6
- 0
TechbloxModdingAPI/Tests/TechbloxModdingAPIPluginTest.cs View File

@@ -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


Loading…
Cancel
Save