Guest User

Untitled

a guest
Nov 20th, 2018
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.55 KB | None | 0 0
  1. import com.nolimitscoaster.*;
  2.  
  3. public class RideController extends Script {
  4.    
  5.     private SceneObject parent;
  6.     private BlockPoint[] blockPoints;
  7.     private RideSection[] rideSections;
  8.    
  9.     private String nameBase = "tl-";
  10.     private String nameBaseBlockPoint = "bp-";
  11.    
  12.     public bool onInit() {
  13.         parent = sim.getSceneObjectForEntityId(getParentEntityId());
  14.         parent.getElementAt(0).setVisible(false);
  15.        
  16.         int bpCount = 0;
  17.         while (sim.getSceneObject(nameBase + nameBaseBlockPoint + (bpCount + 1)) != null) {
  18.             bpCount++;
  19.         }
  20.        
  21.         blockPoints = new BlockPoint[bpCount];
  22.         rideSections = new RideSection[bpCount];
  23.        
  24.         for (int i = 0; i < bpCount; i++) {
  25.             SceneObject sco = sim.getSceneObject(nameBase + nameBaseBlockPoint + ((i + 1)));
  26.             if (sco != null) {
  27.                 blockPoints[i] = new BlockPoint(sco.getTranslation());
  28.             }
  29.         }
  30.        
  31.         int rsPosition = 0;
  32.         bool cont = true;
  33.         BlockPoint lastBlock = null;
  34.        
  35.         while(cont) {
  36.             BlockPoint begin = null;
  37.             BlockPoint end = null;
  38.            
  39.             if (lastBlock == null) {
  40.                 begin = blockPoints[rsPosition];
  41.             } else {
  42.                 begin = lastBlock;
  43.             }
  44.            
  45.             if ((rsPosition + 1) < bpCount) {
  46.                 int pos = rsPosition + 1;
  47.                 end = blockPoints[pos];
  48.                 lastBlock = end;
  49.                 rsPosition++;
  50.             } else {
  51.                 end = blockPoints[0];
  52.                 cont = false;
  53.             }
  54.            
  55.             rideSections[rsPosition] = new RideSection(begin, end);
  56.         }
  57.        
  58.         for (int i = 0; i < bpCount; i++) {
  59.             System.out.println(rideSections[i].getBegin().getX());
  60.         }
  61.        
  62.         return true;
  63.     }
  64.    
  65.     public void onNextFrame(float tick) {
  66.        
  67.     }
  68. }
Advertisement
Add Comment
Please, Sign In to add comment