|
@@ -1,36 +1,21 @@
|
|
|
-event.load("player_is_attacked");
|
|
|
+event.load("living_is_attacked");
|
|
|
event.load("player_move");
|
|
|
event.load("player_logout");
|
|
|
event.load("block_click");
|
|
|
event.load("player_giveup");
|
|
|
+event.load("player_join");
|
|
|
|
|
|
rankingtable = "jumpranks";
|
|
|
|
|
|
-player = script.getLeader();
|
|
|
-player_name = player.getName(player);
|
|
|
-player_id = player.getId(player);
|
|
|
-
|
|
|
-if(player.isSurvival(player)) {
|
|
|
- if(player.isAdventure(player)) {
|
|
|
- player.setGamemode(player, "survival");
|
|
|
- }
|
|
|
-} else {
|
|
|
- player.setGamemode(player, "survival");
|
|
|
-}
|
|
|
-if(player.hasFly(player)) {
|
|
|
- player.setFly(player, false);
|
|
|
-}
|
|
|
-
|
|
|
points = 0;
|
|
|
-gamesworldloc = read.location(ggv("SERVER", "gamesspawn"));
|
|
|
-gamesworld = world.get("games");
|
|
|
-air_item_type = "minecraft:air";
|
|
|
+maxplayers = 1;
|
|
|
+gamesignsmap = getScriptVar("gamesigns");
|
|
|
+gamesignloc = map.get(gamesignsmap, "jrmap");
|
|
|
gamename = "§aJump'n'Run";
|
|
|
jump_sound = sound.get("entity.item.pickup");
|
|
|
sound_category_ambient = sound.getCategory("ambient");
|
|
|
-set.new(jumpblocksset);
|
|
|
|
|
|
-list.new(blocks);
|
|
|
+blocks = list.new();
|
|
|
list.add(blocks, "2:0:0");
|
|
|
list.add(blocks, "3:0:0");
|
|
|
list.add(blocks, "4:0:0");
|
|
@@ -140,7 +125,7 @@ list.add(blocks, "-1:1:-2");
|
|
|
list.add(blocks, "-1:1:-3");
|
|
|
list.add(blocks, "-2:1:-3");
|
|
|
|
|
|
-list.new(color_list); //Liste der Farben
|
|
|
+color_list = list.new(); //Liste der Farben
|
|
|
list.add(color_list, "blue");
|
|
|
list.add(color_list, "red");
|
|
|
list.add(color_list, "yellow");
|
|
@@ -158,40 +143,12 @@ list.add(color_list, "cyan");
|
|
|
list.add(color_list, "light_blue");
|
|
|
list.add(color_list, "pink");
|
|
|
|
|
|
-last_record = getPoints(rankingtable, player_id);
|
|
|
-overall_record = getPointsFromRank(rankingtable, 1, "DESC");
|
|
|
-
|
|
|
-@newgame
|
|
|
-points = 0;
|
|
|
-display.add(player, 0, "§6Jump'n'Run");
|
|
|
-display.add(player, 1, "Deine Punkte: §e", text.number(points));
|
|
|
-display.add(player, 2, "Dein Rekord: §e", text.number(last_record));
|
|
|
-display.add(player, 3, "Rekord überhaupt: §e", text.number(overall_record));
|
|
|
-
|
|
|
-title.clear(player);
|
|
|
-title.setTime(player, 20, 20, 20);
|
|
|
-title.setSub(player, "§rRanked");
|
|
|
-title.send(player, gamename);
|
|
|
-player.clearInventory(player);
|
|
|
-entity.setHealth(player, 20);
|
|
|
-player.setHunger(player, 20);
|
|
|
-player.setSaturation(player, 5);
|
|
|
-color_string = list.getIndex(color_list, math.random(0, 15));
|
|
|
-concrete_block = concat("minecraft:", color_string, "_concrete");
|
|
|
-wool_block = concat("minecraft:", color_string, "_wool");
|
|
|
-
|
|
|
-@startblock
|
|
|
-x = math.random(5000, 5100);
|
|
|
-y = math.random(10, 20);
|
|
|
-z = math.random(5000, 5100);
|
|
|
-startblock = loc.new(gamesworld, x, y, z);
|
|
|
-if(set.contains(jumpblocksset, startblock)) {
|
|
|
- goto("startblock");
|
|
|
+@wait
|
|
|
+wait();
|
|
|
+if(player.hasMinigameId(player, script_id)) {
|
|
|
+ ignoreGoto(event);
|
|
|
}
|
|
|
-block.set(startblock, concrete_block);
|
|
|
-set.add(jumpblocksset, startblock);
|
|
|
-entity.teleport(player, loc.mod(startblock, 0.5, 1, 0.5));
|
|
|
-previousblock = startblock;
|
|
|
+goto("wait");
|
|
|
|
|
|
@newblock
|
|
|
split(coords, ":", list.getIndex(blocks, math.random(0, list.getSize(blocks) - 1)));
|
|
@@ -199,14 +156,13 @@ x = list.getIndex(coords, 0);
|
|
|
y = list.getIndex(coords, 1);
|
|
|
z = list.getIndex(coords, 2);
|
|
|
newblock = loc.mod(previousblock, x, y, z);
|
|
|
-if(set.contains(jumpblocksset, newblock)) {
|
|
|
+if(block.getType(newblock) != "minecraft:air") {
|
|
|
goto("newblock");
|
|
|
}
|
|
|
if(loc.getCoord(newblock, "y") > 256) {
|
|
|
goto("newblock");
|
|
|
}
|
|
|
block.set(newblock, wool_block);
|
|
|
-set.add(jumpblocksset, text.location(startblock));
|
|
|
sound.spawn(newblock, jump_sound, sound_category_ambient);
|
|
|
moveloc1 = loc.mod(newblock, 0, 1, 0);
|
|
|
moveloc2 = loc.mod(newblock, 1, 2, 1);
|
|
@@ -217,16 +173,49 @@ if(fallid != null) {
|
|
|
fallloc1 = loc.mod(moveloc1, -10, -10, -10);
|
|
|
fallloc2 = loc.mod(moveloc1, 10, -2, 10);
|
|
|
fallid = event.addMoveData(fallloc1, fallloc2, -1, -1);
|
|
|
-
|
|
|
-@wait
|
|
|
-wait();
|
|
|
-ignoreGoto(event);
|
|
|
goto("wait");
|
|
|
|
|
|
-@player_is_attacked
|
|
|
+@player_join
|
|
|
+@newgame
|
|
|
+points = 0;
|
|
|
+color_string = list.getIndex(color_list, math.random(0, 15));
|
|
|
+concrete_block = concat("minecraft:", color_string, "_concrete");
|
|
|
+wool_block = concat("minecraft:", color_string, "_wool");
|
|
|
+player_id = player.getId(player);
|
|
|
+last_record = getPoints(rankingtable, player_id);
|
|
|
+overall_record = getPointsFromRank(rankingtable, 1, "DESC");
|
|
|
+
|
|
|
+display.add(player, 0, "§6Jump'n'Run");
|
|
|
+display.add(player, 1, "Your Points: §e", text.number(points));
|
|
|
+display.add(player, 2, "Your Record: §e", text.number(last_record));
|
|
|
+display.add(player, 3, "Server Record: §e", text.number(overall_record));
|
|
|
+player.setGamemode(player, "survival");
|
|
|
+player.setFly(player, false);
|
|
|
+title.clear(player);
|
|
|
+title.setTime(player, 20, 20, 20);
|
|
|
+title.send(player, gamename);
|
|
|
+player.clearInventory(player);
|
|
|
+entity.setHealth(player, 20);
|
|
|
+player.setHunger(player, 20);
|
|
|
+player.setSaturation(player, 5);
|
|
|
+
|
|
|
+x = math.random(5000, 5100);
|
|
|
+y = math.random(10, 20);
|
|
|
+z = math.random(5000, 5100);
|
|
|
+startblock = loc.new(world.get("games"), x, y, z);
|
|
|
+block.set(startblock, concrete_block);
|
|
|
+entity.teleport(player, loc.mod(startblock, 0.5, 1, 0.5));
|
|
|
+previousblock = startblock;
|
|
|
+goto("newblock");
|
|
|
+
|
|
|
+@living_is_attacked
|
|
|
+if(!isPlayer(living_entity)) {
|
|
|
+ goto("wait");
|
|
|
+}
|
|
|
+player = living_entity;
|
|
|
cancel = true;
|
|
|
-player_damage_cause_string = damage.getType(player_damage_cause);
|
|
|
-if(player_damage_cause_string == "outOfWorld") {
|
|
|
+damage_source_type = damage.getType(damage_source);
|
|
|
+if(damage_source_type == "outOfWorld") {
|
|
|
//sollte der spieler durch das auffangnetz MoveData:fallid durchfallen und im Void landen, wird er zurückgesetzt
|
|
|
gosub("resetcore");
|
|
|
goto("newgame");
|
|
@@ -242,8 +231,7 @@ if(id == fallid) {
|
|
|
gosub("resetcore");
|
|
|
goto("newgame");
|
|
|
}
|
|
|
-block.set(previousblock, air_item_type);
|
|
|
-set.remove(jumpblocksset, previousblock);
|
|
|
+block.set(previousblock, "minecraft:air");
|
|
|
previousblock = newblock;
|
|
|
block.set(newblock, concrete_block);
|
|
|
points++;
|
|
@@ -253,43 +241,40 @@ player.setSaturation(player, 5);
|
|
|
goto("newblock");
|
|
|
|
|
|
@resetcore
|
|
|
-block.set(newblock, air_item_type);
|
|
|
-block.set(previousblock, air_item_type);
|
|
|
-set.remove(jumpblocksset, newblock);
|
|
|
-set.remove(jumpblocksset, previousblock);
|
|
|
+block.set(newblock, "minecraft:air");
|
|
|
+block.set(previousblock, "minecraft:air");
|
|
|
//Statistik
|
|
|
playedgames = getPlayedGames(rankingtable, player_id) + 1;
|
|
|
display.reset(player);
|
|
|
-player.speak(player, gamename, "§r---= §eStatistik §r=---");
|
|
|
-player.speak(player, gamename, concat("§rPunkte: §e", text.number(points)));
|
|
|
|
|
|
if(last_record < points) {
|
|
|
record = points;
|
|
|
diff = points - last_record;
|
|
|
- player.speak(player, gamename, concat("§rEigenen Rekord um §e", text.number(diff), "§r übertroffen"));
|
|
|
} else {
|
|
|
record = last_record;
|
|
|
}
|
|
|
-last_record = record;
|
|
|
-setRanking(rankingtable, player_id, record, playedgames);
|
|
|
-
|
|
|
-player.speak(player, gamename, concat("§rRekord: §e", text.number(record)));
|
|
|
if(record > overall_record) {
|
|
|
overall_record = record;
|
|
|
}
|
|
|
-player.speak(player, gamename, concat("§rRekord überhaupt: §e", text.number(overall_record)));
|
|
|
+
|
|
|
+minigame.statsHeader(player, gamename, "§e");
|
|
|
+minigame.statsLine(player, "§e", "Points", text.number(points));
|
|
|
+if(diff != null) {
|
|
|
+ msg(player, " §e- §rBeat own record by §e", text.number(diff));
|
|
|
+}
|
|
|
+
|
|
|
+last_record = record;
|
|
|
+setRanking(rankingtable, player_id, record, playedgames);
|
|
|
+
|
|
|
+minigame.statsLine(player, "§e", "Your Record", text.number(record));
|
|
|
+minigame.statsLine(player, "§e", "Server Record", text.number(overall_record));
|
|
|
return;
|
|
|
|
|
|
@player_giveup
|
|
|
@player_logout
|
|
|
-entity.teleport(player, gamesworldloc);
|
|
|
gosub("resetcore");
|
|
|
|
|
|
-n = 0;
|
|
|
-while(worker.hasWork()) {
|
|
|
- waitfor(5);
|
|
|
- if(++n == 8) {
|
|
|
- break;
|
|
|
- }
|
|
|
-}
|
|
|
-term();
|
|
|
+script = script.getFromId(script_id);
|
|
|
+minigame.kickPlayer(script, player);
|
|
|
+minigame.term(script, gamesignloc);
|
|
|
+term();
|