This commit is contained in:
/
2024-12-29 21:15:58 +01:00
commit 547655c326
77 changed files with 7313 additions and 0 deletions

View File

@@ -0,0 +1,28 @@
using System.Collections.Generic;
using System.Linq;
using Sandbox.ModAPI;
using VRage.Game.ModAPI;
using VRage.ObjectBuilders;
namespace Global.API
{
public class GlobalModApi
{
public static bool IsRunningGlobal()
{
return false;
}
public static void GetAllBlocksOfType(List<IMyCubeBlock> list, IMyCubeGrid grid, MyObjectBuilderType type)
{
list.AddRange(grid.GetFatBlocks<IMyCubeBlock>().Where(block => block.BlockDefinition.TypeId == type));
}
public static void GetAllBlocksOfTypeId(List<IMyCubeBlock> list, long gridId, MyObjectBuilderType type)
{
var grid = MyAPIGateway.Entities.GetEntityById(gridId) as IMyCubeGrid;
if (grid == null) return;
list.AddRange(grid.GetFatBlocks<IMyCubeBlock>().Where(block => block.BlockDefinition.TypeId == type));
}
}
}