Template:APIStub

From Space Engineers Wiki
Revision as of 08:31, 10 January 2015 by Textor (talk | contribs) (Examples: Added examples for how to use GridTerminalSystem)
Jump to: navigation, search

Template:API

Usage

Examples

Search For Single Block With Name

void Main()
{
     IMyBeacon beacon = GridTerminalSystem.GetBlockWithName("Beacon"); //beacon is initialized to the first block that is named "Beacon"
}

Search For All Blocks Of Type

void Main()
{
     List<IMyTerminalBlock> blocks = new List<IMyTerminalBlock>();
     GridTerminalSystem.GetBlocksOfType<IMyBeacon>(blocks); //search for all blocks of type "beacon" and put them into the "blocks" list.
}

Search For All Blocks With Part of a Name

void Main()
{
     List<IMyTerminalBlock> blocks = new List<IMyTerminalBlock>();
     GridTerminalSystem.GetBlocksOfName("[Docking]", blocks); //retrieves all blocks with the string [Docking] in the name and puts them into the blocks list.
}

Notes