Lot of changes (Update to MDK2)

This commit is contained in:
Greg Burri 2024-11-03 23:45:58 +01:00
parent 6b3ee666d6
commit 93b3689567
48 changed files with 706 additions and 1005 deletions

View file

@ -10,5 +10,6 @@
</PropertyGroup>
<ItemGroup>
<Compile Include="$(MSBuildThisFileDirectory)Output.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Utils.cs" />
</ItemGroup>
</Project>

24
SECommon/Utils.cs Normal file
View file

@ -0,0 +1,24 @@
using Sandbox.ModAPI.Ingame;
using System.Collections.Generic;
using System.Linq;
using VRage.Game.ModAPI.Ingame;
namespace IngameScript
{
static class Utils
{
public static T GetBlock<T>(this IMyGridTerminalSystem gridTerminal, string name, IMyCubeGrid grid)
where T: class, IMyTerminalBlock
{
var l = new List<T>();
gridTerminal.GetBlocksOfType<T>(l, (T block) => block.CustomName == name && block.CubeGrid == grid);
if (l.Count > 0)
return l.First();
else
return null;
}
}
}