|
|
@@ -7,6 +7,8 @@ using RobocraftX.GUI.MyGamesScreen; |
|
|
|
using RobocraftX.StateSync; |
|
|
|
using Svelto.ECS; |
|
|
|
|
|
|
|
using GamecraftModdingAPI; |
|
|
|
using GamecraftModdingAPI.Blocks; |
|
|
|
using GamecraftModdingAPI.Tasks; |
|
|
|
using GamecraftModdingAPI.Utility; |
|
|
|
|
|
|
@@ -414,6 +416,28 @@ namespace GamecraftModdingAPI.App |
|
|
|
return debugIds.Remove(id); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary> |
|
|
|
/// Gets the blocks in the game. |
|
|
|
/// This returns null when in a loading state, and throws AppStateException when in menu. |
|
|
|
/// </summary> |
|
|
|
/// <returns>The blocks in game.</returns> |
|
|
|
/// <param name="filter">The block to search for. BlockIDs.Invalid will return all blocks.</param> |
|
|
|
public Block[] GetBlocksInGame(BlockIDs filter = BlockIDs.Invalid) |
|
|
|
{ |
|
|
|
if (!VerifyMode()) return null; |
|
|
|
if (menuMode) |
|
|
|
{ |
|
|
|
throw new AppStateException("Game object references a menu item but GetBlocksInGame only works on the currently-loaded game"); |
|
|
|
} |
|
|
|
EGID[] blockEGIDs = gameEngine.GetAllBlocksInGame(filter); |
|
|
|
Block[] blocks = new Block[blockEGIDs.Length]; |
|
|
|
for (int b = 0; b < blockEGIDs.Length; b++) |
|
|
|
{ |
|
|
|
blocks[b] = new Block(blockEGIDs[b]); |
|
|
|
} |
|
|
|
return blocks; |
|
|
|
} |
|
|
|
|
|
|
|
~Game() |
|
|
|
{ |
|
|
|
foreach (string id in debugIds) |
|
|
|