Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import com.nolimitscoaster.*;
- public class RideController extends Script {
- private SceneObject parent;
- private BlockPoint[] blockPoints;
- private RideSection[] rideSections;
- private String nameBase = "tl-";
- private String nameBaseBlockPoint = "bp-";
- public bool onInit() {
- parent = sim.getSceneObjectForEntityId(getParentEntityId());
- parent.getElementAt(0).setVisible(false);
- int bpCount = 0;
- while (sim.getSceneObject(nameBase + nameBaseBlockPoint + (bpCount + 1)) != null) {
- bpCount++;
- }
- blockPoints = new BlockPoint[bpCount];
- rideSections = new RideSection[bpCount];
- for (int i = 0; i < bpCount; i++) {
- SceneObject sco = sim.getSceneObject(nameBase + nameBaseBlockPoint + ((i + 1)));
- if (sco != null) {
- blockPoints[i] = new BlockPoint(sco.getTranslation());
- }
- }
- int rsPosition = 0;
- bool cont = true;
- BlockPoint lastBlock = null;
- while(cont) {
- BlockPoint begin = null;
- BlockPoint end = null;
- if (lastBlock == null) {
- begin = blockPoints[rsPosition];
- } else {
- begin = lastBlock;
- }
- if ((rsPosition + 1) < bpCount) {
- int pos = rsPosition + 1;
- end = blockPoints[pos];
- lastBlock = end;
- rsPosition++;
- } else {
- end = blockPoints[0];
- cont = false;
- }
- rideSections[rsPosition] = new RideSection(begin, end);
- }
- for (int i = 0; i < bpCount; i++) {
- System.out.println(rideSections[i].getBegin().getX());
- }
- return true;
- }
- public void onNextFrame(float tick) {
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment