Advertisement
Meridius_IX

Grid Name Options

Oct 26th, 2017
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.75 KB | None | 0 0
  1. foreach(var entity in entity_list){
  2.  
  3.     var cubeGrid = entity as IMyCubeGrid;
  4.    
  5.     if(cubeGrid == null){
  6.    
  7.         continue; //Move to next entity in loop if cubeGrid was null
  8.    
  9.     }
  10.    
  11.     if(cubeGrid.CustomName == "Grid Name Example A"){
  12.    
  13.         //Do Stuff for "Grid Name Example A"
  14.    
  15.     }
  16.    
  17.     if(cubeGrid.CustomName == "Grid Name Example B"){
  18.    
  19.         //Do Stuff for "Grid Name Example B"
  20.    
  21.     }
  22.    
  23.     if(cubeGrid.CustomName.Contains("Delete")){
  24.    
  25.         //Do stuff to delete the grid if the word "Delete" is found in its name.
  26.         //Keep this at the bottom of your custom name checks.
  27.         //If anything above renames the grid with "Delete", then this will catch it and delete it.
  28.    
  29.     }
  30.  
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement