Lot of changes (Update to MDK2)
This commit is contained in:
parent
6b3ee666d6
commit
93b3689567
48 changed files with 706 additions and 1005 deletions
|
|
@ -10,5 +10,6 @@
|
|||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Output.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Utils.cs" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
24
SECommon/Utils.cs
Normal file
24
SECommon/Utils.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue