From Space Engineers Wiki
|
|
Line 5: |
Line 5: |
| | | |
| == Examples == | | == Examples == |
− | ===Search For Single Block With Name===
| |
| <syntaxhighlight lang="csharp"> | | <syntaxhighlight lang="csharp"> |
− | void Main()
| + | //Examples here |
− | {
| |
− | IMyBeacon beacon = GridTerminalSystem.GetBlockWithName("Beacon"); //beacon is initialized to the first block that is named "Beacon"
| |
− | }
| |
− | </syntaxhighlight>
| |
− | ===Search For All Blocks Of Type===
| |
− | <syntaxhighlight lang="csharp">
| |
− | 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.
| |
− | }
| |
− | </syntaxhighlight>
| |
− | ===Search For All Blocks With Part of a Name===
| |
− | <syntaxhighlight lang="csharp">
| |
− | 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.
| |
− | }
| |
| </syntaxhighlight> | | </syntaxhighlight> |
| | | |
Latest revision as of 08:32, 10 January 2015
Template:API
Usage
Examples
Notes