|
@@ -1,411 +0,0 @@
|
|
|
-sign.started(gamesignloc);
|
|
|
-event.load("function_key");
|
|
|
-event.load("living_pre_hurt");
|
|
|
-event.load("player_move");
|
|
|
-event.load("player_logout");
|
|
|
-event.load("player_giveup");
|
|
|
-event.load("player_join");
|
|
|
-event.load("block_break");
|
|
|
-
|
|
|
-games = world.getGames();
|
|
|
-
|
|
|
-gamename = "§a4D-Jump'n'Run";
|
|
|
-
|
|
|
-maxplayers = 1;
|
|
|
-
|
|
|
-x1 = loc.getX(Edge_1);
|
|
|
-x2 = loc.getX(Edge_2);
|
|
|
-x3 = loc.getX(Edge_3);
|
|
|
-
|
|
|
-y1 = loc.getY(Edge_1);
|
|
|
-y2 = loc.getY(Edge_2);
|
|
|
-y3 = loc.getY(Edge_3);
|
|
|
-
|
|
|
-z1 = loc.getZ(Edge_1);
|
|
|
-z2 = loc.getZ(Edge_2);
|
|
|
-z3 = loc.getZ(Edge_3);
|
|
|
-
|
|
|
-//XYZ -> WYZ -> XYW -> XYZ
|
|
|
-Dimension_Blocks = list.new();
|
|
|
-
|
|
|
-event.addMoveData(loc1, loc2, -1, -1);
|
|
|
-
|
|
|
-current_w = 0;
|
|
|
-current_x = 0;
|
|
|
-current_z = 0;
|
|
|
-currently_active_dimensions = 0; //0 = XYZ, 1 = WYZ, 2 = WYX, 3 = ZYX, 4 = ZYW, 5 = XYW
|
|
|
-current_layer = array.new(6);
|
|
|
-current_layer[0] = current_w;//0 = W, 1 = X, 2 = Z
|
|
|
-current_layer[1] = current_x;//current_layer[a] 0 = W, 1 = X, 2 = Z
|
|
|
-current_layer[2] = current_z;
|
|
|
-current_layer[3] = current_w;
|
|
|
-current_layer[4] = current_x;
|
|
|
-current_layer[5] = current_z;
|
|
|
-x_difference = x2-x1;
|
|
|
-z_difference = z2-z2;
|
|
|
-w_difference = Layer_amount;
|
|
|
-difference_array = array.new(6);
|
|
|
-difference_array[0] = w_difference;
|
|
|
-difference_array[1] = x_difference;
|
|
|
-difference_array[2] = z_difference;
|
|
|
-difference_array[3] = w_difference;
|
|
|
-difference_array[4] = x_difference;
|
|
|
-difference_array[5] = z_difference;
|
|
|
-
|
|
|
-@wait
|
|
|
-wait();
|
|
|
-if(event == "living_pre_hurt") {
|
|
|
- if(!isPlayer(living_entity)) {
|
|
|
- goto("wait");
|
|
|
- }
|
|
|
- player = living_entity;
|
|
|
-}
|
|
|
-if(!player.hasMinigameId(player, script_id)) {
|
|
|
- goto("wait");
|
|
|
-}
|
|
|
-if(event == "player_join"){
|
|
|
- entity.teleport(player, Start_Pos);
|
|
|
- player.clearInventory(player);
|
|
|
- stacks.set(player, 5, "km:arrow_left");
|
|
|
- stacks.set(player, 6, "km:arrow_right");
|
|
|
- stacks.set(player, 7, "km:arrow_down");
|
|
|
- stacks.set(player, 8, "km:arrow_up");
|
|
|
- stacks.setActive(player, true);
|
|
|
- for(layer_var = 0; layer_var < Layer_amount; layer_var++){
|
|
|
- temp_list = list.new();
|
|
|
- x_d = layer_var * Layer_difference_X;
|
|
|
- y_d = layer_var * Layer_difference_Y;
|
|
|
- z_d = layer_var * Layer_difference_Z;
|
|
|
- for(x = x1 - x_d; x <= x2 - x_d; x++){
|
|
|
- for(y = y1 - y_d; y <= y2 - y_d; y++){
|
|
|
- for(z = z1 - z_d; z <= z2 - z_d; z++){
|
|
|
- temp_loc = loc.new(games, x, y, z);
|
|
|
- if(!block.isAir(temp_loc)){
|
|
|
- D_Array = array.new(4);
|
|
|
- D_Array[0] = x - x1 + x_d;//X
|
|
|
- D_Array[1] = y - y1 + y_d;//Y
|
|
|
- D_Array[2] = z - z1 + z_d;//Z
|
|
|
- D_Array[3] = layer_var;//W
|
|
|
- temp_array = array.new(2);
|
|
|
- temp_array[0] = D_Array;
|
|
|
- temp_array[1] = block.getType(temp_loc);
|
|
|
- list.add(Dimension_Blocks, temp_array);//Dimensional_Blocks -> Koords4D,Block
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- goto("wait");
|
|
|
-}
|
|
|
-if(event == "block_break"){
|
|
|
- cancel = true;
|
|
|
- goto("wait");
|
|
|
-}
|
|
|
-if(event == "living_pre_hurt") {
|
|
|
- cancel = true;
|
|
|
- goto("wait");
|
|
|
-}
|
|
|
-if(event == "function_key"){
|
|
|
- if(key == 6){
|
|
|
- goto("dimensional_turn_down");
|
|
|
- }
|
|
|
- if(key == 7){
|
|
|
- goto("dimensional_turn_up");
|
|
|
- }
|
|
|
- if(key == 8){
|
|
|
- goto("remove_layer");
|
|
|
- }
|
|
|
- if(key == 9){
|
|
|
- goto("add_layer");
|
|
|
- }
|
|
|
- goto("wait");
|
|
|
-}
|
|
|
-if(event == "player_move"){
|
|
|
- //if(current_layer[1] == finish_layer){
|
|
|
- game_stop("You did it!");
|
|
|
- //}
|
|
|
- goto("wait");
|
|
|
-}
|
|
|
-if(event == "player_logout"){
|
|
|
- game_stop(null);
|
|
|
-}
|
|
|
-if(event == "player_giveup"){
|
|
|
- game_stop("You left :(");
|
|
|
-}
|
|
|
-goto("wait");
|
|
|
-
|
|
|
-@remove_layer
|
|
|
-if(current_layer[currently_active_dimensions] <= 0 || current_layer[currently_active_dimensions] > difference_array[currently_active_dimensions] - 1){
|
|
|
- if(current_layer[currently_active_dimensions] == 0){
|
|
|
- current_layer[currently_active_dimensions] = -1;
|
|
|
- remove_blocks();
|
|
|
- }
|
|
|
- if(current_layer[currently_active_dimensions] > difference_array[currently_active_dimensions] - 1){
|
|
|
- current_layer[currently_active_dimensions]--;
|
|
|
- }
|
|
|
-}else{
|
|
|
- remove_blocks();
|
|
|
- current_layer[currently_active_dimensions]--;
|
|
|
- place_blocks(current_layer);
|
|
|
-}
|
|
|
-if(currently_active_dimensions < 3){
|
|
|
- current_layer[currently_active_dimensions+3] = current_layer[currently_active_dimensions];
|
|
|
-}else{
|
|
|
- current_layer[currently_active_dimensions-3] = current_layer[currently_active_dimensions];
|
|
|
-}
|
|
|
-goto("wait");
|
|
|
-
|
|
|
-@add_layer
|
|
|
-if(current_layer[currently_active_dimensions] >= difference_array[currently_active_dimensions] - 1 || current_layer[currently_active_dimensions] < -1){
|
|
|
- if(current_layer[currently_active_dimensions] == difference_array[currently_active_dimensions] - 1){
|
|
|
- remove_blocks();
|
|
|
- }
|
|
|
- if(current_layer[currently_active_dimensions] < -1){
|
|
|
- current_layer[currently_active_dimensions]++;
|
|
|
- }
|
|
|
-}else{
|
|
|
- remove_blocks();
|
|
|
- current_layer[currently_active_dimensions]++;
|
|
|
- place_blocks(current_layer);
|
|
|
-}
|
|
|
-if(currently_active_dimensions < 3){
|
|
|
- current_layer[currently_active_dimensions+3] = current_layer[currently_active_dimensions];
|
|
|
-}else{
|
|
|
- current_layer[currently_active_dimensions-3] = current_layer[currently_active_dimensions];
|
|
|
-}
|
|
|
-goto("wait");
|
|
|
-
|
|
|
-@dimensional_turn_up
|
|
|
-remove_blocks();//0 = XYZ, 1 = WYZ, 2 = WYX, 3 = ZYX, 4 = ZYW, 5 = XYW
|
|
|
-temp_layer = current_layer[currently_active_dimensions];
|
|
|
-temp_player_loc = entity.getLocation(player);
|
|
|
-
|
|
|
-if(currently_active_dimensions == 0){//XYZ to WYZ
|
|
|
- currently_active_dimensions++;
|
|
|
- current_layer[1] = math.roundDown(loc.getX(temp_player_loc)+0.5)-x3;
|
|
|
- current_layer[4] = current_layer[1];
|
|
|
- entity.teleport(player, loc.mod(Edge_3, temp_layer+0.5, loc.getY(temp_player_loc)-y3, loc.getZ(temp_player_loc)-z3));
|
|
|
-}else{
|
|
|
-if(currently_active_dimensions == 1){//WYZ to WYX
|
|
|
- currently_active_dimensions++;
|
|
|
- current_layer[2] = math.roundDown(loc.getZ(entity.getLocation(player))+0.5)-z3;
|
|
|
- current_layer[5] = current_layer[2];
|
|
|
- entity.teleport(player, loc.mod(Edge_3, loc.getX(temp_player_loc)-x3, loc.getY(temp_player_loc)-y3, temp_layer+0.5));
|
|
|
-}else{
|
|
|
-if(currently_active_dimensions == 2){//WYX to ZYX
|
|
|
- currently_active_dimensions++;
|
|
|
- current_layer[0] = math.roundDown(loc.getX(entity.getLocation(player))+0.5)-x3;
|
|
|
- current_layer[3] = current_layer[0];
|
|
|
- entity.teleport(player, loc.mod(Edge_3, temp_layer+0.5, loc.getY(temp_player_loc)-y3, loc.getZ(temp_player_loc)-z3));
|
|
|
-}else{
|
|
|
-if(currently_active_dimensions == 3){//ZYX to ZYW
|
|
|
- currently_active_dimensions++;
|
|
|
- current_layer[1] = math.roundDown(loc.getZ(entity.getLocation(player))+0.5)-z3;
|
|
|
- current_layer[4] = current_layer[1];
|
|
|
- entity.teleport(player, loc.mod(Edge_3, loc.getX(temp_player_loc)-x3, loc.getY(temp_player_loc)-y3, temp_layer+0.5));
|
|
|
-}else{
|
|
|
-if(currently_active_dimensions == 4){//ZYW to XYW
|
|
|
- currently_active_dimensions++;
|
|
|
- current_layer[2] = math.roundDown(loc.getX(entity.getLocation(player))+0.5)-x3;
|
|
|
- current_layer[5] = current_layer[2];
|
|
|
- entity.teleport(player, loc.mod(Edge_3, temp_layer+0.5, loc.getY(temp_player_loc)-y3, loc.getZ(temp_player_loc)-z3));
|
|
|
-}else{
|
|
|
-if(currently_active_dimensions == 5){//XYW to XYZ
|
|
|
- currently_active_dimensions = 0;
|
|
|
- current_layer[0] = math.roundDown(loc.getZ(entity.getLocation(player))+0.5)-z3;
|
|
|
- current_layer[3] = current_layer[0];
|
|
|
- entity.teleport(player, loc.mod(Edge_3, loc.getX(temp_player_loc)-x3, loc.getY(temp_player_loc)-y3, temp_layer+0.5));
|
|
|
-}}}}}}
|
|
|
-place_blocks(current_layer);
|
|
|
-goto("wait");
|
|
|
-
|
|
|
-@dimensional_turn_down
|
|
|
-remove_blocks();//0 = XYZ, 1 = WYZ, 2 = WYX, 3 = ZYX, 4 = ZYW, 5 = XYW
|
|
|
-temp_layer = current_layer[currently_active_dimensions];
|
|
|
-temp_player_loc = entity.getLocation(player);
|
|
|
-
|
|
|
-if(currently_active_dimensions == 0){//XYZ to XYW
|
|
|
- currently_active_dimensions = 5;
|
|
|
- current_layer[2] = math.roundDown(loc.getZ(entity.getLocation(player))+0.5)-z3;
|
|
|
- current_layer[5] = current_layer[2];
|
|
|
- entity.teleport(player, loc.mod(Edge_3, loc.getX(temp_player_loc)-x3, loc.getY(temp_player_loc)-y3, temp_layer+0.5));
|
|
|
-}else{
|
|
|
-if(currently_active_dimensions == 1){//XYW to ZYW
|
|
|
- currently_active_dimensions--;
|
|
|
- current_layer[1] = math.roundDown(loc.getX(entity.getLocation(player))+0.5)-x3;
|
|
|
- current_layer[4] = current_layer[1];
|
|
|
- entity.teleport(player, loc.mod(Edge_3, temp_layer+0.5, loc.getY(temp_player_loc)-y3, loc.getZ(temp_player_loc)-z3));
|
|
|
-}else{
|
|
|
-if(currently_active_dimensions == 2){//ZYW to ZYX
|
|
|
- currently_active_dimensions--;
|
|
|
- current_layer[0] = math.roundDown(loc.getZ(entity.getLocation(player))+0.5)-z3;
|
|
|
- current_layer[3] = current_layer[0];
|
|
|
- entity.teleport(player, loc.mod(Edge_3, loc.getX(temp_player_loc)-x3, loc.getY(temp_player_loc)-y3, temp_layer+0.5));
|
|
|
-}else{
|
|
|
-if(currently_active_dimensions == 3){//ZYX to WYX
|
|
|
- currently_active_dimensions--;
|
|
|
- current_layer[2] = math.roundDown(loc.getX(entity.getLocation(player))+0.5)-x3;
|
|
|
- current_layer[5] = current_layer[2];
|
|
|
- entity.teleport(player, loc.mod(Edge_3, temp_layer+0.5, loc.getY(temp_player_loc)-y3, loc.getZ(temp_player_loc)-z3));
|
|
|
-}else{
|
|
|
-if(currently_active_dimensions == 4){//WYX to WYZ
|
|
|
- currently_active_dimensions--;
|
|
|
- current_layer[1] = math.roundDown(loc.getZ(entity.getLocation(player))+0.5)-z3;
|
|
|
- current_layer[4] = current_layer[1];
|
|
|
- entity.teleport(player, loc.mod(Edge_3, loc.getX(temp_player_loc)-x3, loc.getY(temp_player_loc)-y3, temp_layer+0.5));
|
|
|
-}else{
|
|
|
-if(currently_active_dimensions == 5){//WYZ to XYZ
|
|
|
- currently_active_dimensions--;
|
|
|
- current_layer[0] = math.roundDown(loc.getX(entity.getLocation(player))+0.5)-x3;
|
|
|
- current_layer[3] = current_layer[0];
|
|
|
- entity.teleport(player, loc.mod(Edge_3, temp_layer+0.5, loc.getY(temp_player_loc)-y3, loc.getZ(temp_player_loc)-z3));
|
|
|
-}}}}}}
|
|
|
-place_blocks(current_layer);
|
|
|
-goto("wait");
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-function remove_blocks(){
|
|
|
- for(x = $x3; x < $x3 + $x2 - $x1 + 1; x++){
|
|
|
- for(y = $y3; y < $y3 + $y2 - $y1 + 1; y++){
|
|
|
- for(z = $z3; z < $z3 + $z2 - $z1 + 1; z++){
|
|
|
- temp_loc = loc.new($games, x, y, z);
|
|
|
- block.set(temp_loc, "minecraft:air");
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- /*for(a = 0; a < list.getSize($Dimension_Blocks); a++){
|
|
|
- temp_array = list.getIndex($Dimension_Blocks, a);//Dimensional_Blocks -> Array[Koords4D,Block]
|
|
|
- D_Array = temp_array[0];//temp_array[1] ist der Block, bei remove egal.
|
|
|
- //D_Array[0] = x, D_Array[1] = y, D_Array[2] = z, D_Array[3] = w
|
|
|
- //0 = XYZ, 1 = WYZ, 2 = WYX, 3 = ZYX, 4 = ZYW, 5 = XYW
|
|
|
- //x3+x-x1+x_d, y3+y-y1+y_d, z3+z-z1+z_d
|
|
|
- X_place = 0;
|
|
|
- Y_place = -1;
|
|
|
- Z_place = 0;
|
|
|
- if($currently_active_dimensions == 0){//0 = XYZ
|
|
|
- if(D_Array[3] == current_layer[$currently_active_dimensions]){
|
|
|
- X_place = D_Array[0];
|
|
|
- Y_place = D_Array[1];
|
|
|
- Z_place = D_Array[2];
|
|
|
- }
|
|
|
- }else{
|
|
|
- if($currently_active_dimensions == 1){//1 = WYZ
|
|
|
- if(D_Array[0] == current_layer[$currently_active_dimensions]){
|
|
|
- X_place = D_Array[3];
|
|
|
- Y_place = D_Array[1];
|
|
|
- Z_place = D_Array[2];
|
|
|
-
|
|
|
- }
|
|
|
- }else{
|
|
|
- if($currently_active_dimensions == 2){//2 = WYX
|
|
|
- if(D_Array[2] == current_layer[$currently_active_dimensions]){
|
|
|
- X_place = D_Array[3];
|
|
|
- Y_place = D_Array[1];
|
|
|
- Z_place = D_Array[0];
|
|
|
- }
|
|
|
- }else{
|
|
|
- if($currently_active_dimensions == 3){//3 = ZYX
|
|
|
- if(D_Array[3] == current_layer[$currently_active_dimensions]){
|
|
|
- X_place = D_Array[2];
|
|
|
- Y_place = D_Array[1];
|
|
|
- Z_place = D_Array[0];
|
|
|
- }
|
|
|
- }else{
|
|
|
- if($currently_active_dimensions == 4){//4 = ZYW
|
|
|
- if(D_Array[0] == current_layer[$currently_active_dimensions]){
|
|
|
- X_place = D_Array[2];
|
|
|
- Y_place = D_Array[1];
|
|
|
- Z_place = D_Array[3];
|
|
|
- }
|
|
|
- }else{
|
|
|
- if($currently_active_dimensions == 5){//5 = XYW
|
|
|
- if(D_Array[2] == current_layer[$currently_active_dimensions]){
|
|
|
- X_place = D_Array[0];
|
|
|
- Y_place = D_Array[1];
|
|
|
- Z_place = D_Array[3];
|
|
|
- }
|
|
|
- }}}}}}
|
|
|
- if(Y_place > -1){
|
|
|
- X_place = X_place + $x3;
|
|
|
- Y_place = Y_place + $y3;
|
|
|
- Z_place = Z_place + $z3;
|
|
|
- temp_loc = loc.new($games, X_place, Y_place, Z_place);
|
|
|
- block.set(temp_loc, "minecraft:air");
|
|
|
- }
|
|
|
- }*/
|
|
|
-}
|
|
|
-function place_blocks(current_layer){
|
|
|
- for(a = 0; a < list.getSize($Dimension_Blocks); a++){
|
|
|
- temp_array = list.getIndex($Dimension_Blocks, a);
|
|
|
- D_Array = temp_array[0];//temp_array[1] ist der Block, bei remove egal. D_Array[0] = x, D_Array[1] = y, D_Array[2] = z, D_Array[3] = w
|
|
|
- //0 = XYZ, 1 = WYZ, 2 = XYW
|
|
|
- //x3+x-x1+x_d, y3+y-y1+y_d, z3+z-z1+z_d
|
|
|
- X_place = 0;
|
|
|
- Y_place = -1;
|
|
|
- Z_place = 0;
|
|
|
- if($currently_active_dimensions == 0){//0 = XYZ
|
|
|
- if(D_Array[3] == current_layer[$currently_active_dimensions]){
|
|
|
- X_place = D_Array[0];
|
|
|
- Y_place = D_Array[1];
|
|
|
- Z_place = D_Array[2];
|
|
|
- }
|
|
|
- }else{
|
|
|
- if($currently_active_dimensions == 1){//1 = WYZ
|
|
|
- if(D_Array[0] == current_layer[$currently_active_dimensions]){
|
|
|
- X_place = D_Array[3];
|
|
|
- Y_place = D_Array[1];
|
|
|
- Z_place = D_Array[2];
|
|
|
- }
|
|
|
- }else{
|
|
|
- if($currently_active_dimensions == 2){//2 = WYX
|
|
|
- if(D_Array[2] == current_layer[$currently_active_dimensions]){
|
|
|
- X_place = D_Array[3];
|
|
|
- Y_place = D_Array[1];
|
|
|
- Z_place = D_Array[0];
|
|
|
- }
|
|
|
- }else{
|
|
|
- if($currently_active_dimensions == 3){//3 = ZYX
|
|
|
- if(D_Array[3] == current_layer[$currently_active_dimensions]){
|
|
|
- X_place = D_Array[2];
|
|
|
- Y_place = D_Array[1];
|
|
|
- Z_place = D_Array[0];
|
|
|
- }
|
|
|
- }else{
|
|
|
- if($currently_active_dimensions == 4){//4 = ZYW
|
|
|
- if(D_Array[0] == current_layer[$currently_active_dimensions]){
|
|
|
- X_place = D_Array[2];
|
|
|
- Y_place = D_Array[1];
|
|
|
- Z_place = D_Array[3];
|
|
|
- }
|
|
|
- }else{
|
|
|
- if($currently_active_dimensions == 5){//5 = XYW
|
|
|
- if(D_Array[2] == current_layer[$currently_active_dimensions]){
|
|
|
- X_place = D_Array[0];
|
|
|
- Y_place = D_Array[1];
|
|
|
- Z_place = D_Array[3];
|
|
|
- }
|
|
|
- }}}}}}
|
|
|
- if(Y_place > -1){
|
|
|
- X_place = X_place + $x3;
|
|
|
- Y_place = Y_place + $y3;
|
|
|
- Z_place = Z_place + $z3;
|
|
|
- temp_loc = loc.new($games,X_place,Y_place,Z_place);
|
|
|
- block.set(temp_loc, temp_array[1]);
|
|
|
- }
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-function game_stop(message){
|
|
|
- remove_blocks();
|
|
|
- $currently_active_dimensions = 0;
|
|
|
- $current_layer[$currently_active_dimensions] = 0;
|
|
|
- place_blocks($current_layer);
|
|
|
- if(message != null){
|
|
|
- msg.prefix($player, $gamename, message);
|
|
|
- }
|
|
|
- script = script.getFromId($script_id);
|
|
|
- minigame.kickPlayer(script, $player);
|
|
|
- minigame.term(script, $gamesignloc);
|
|
|
- term();
|
|
|
-}
|