123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131 |
- creative_world = world.get("creative");
- speed1 = event.addMoveData(loc.new(creative_world, 3043,53, 2897), loc.new(Overworld, 3045,54,2900), 5, -1);
- speed2 = event.addMoveData(loc.new(creative_world, 3060,64, 2897), loc.new(Overworld, 3062,65,2899), 5, -1);
- jump1 = event.addMoveData(loc.new(creative_world, 3043,53, 2900), loc.new(Overworld, 3045,54,2904), 5, -1);
- jump2 = event.addMoveData(loc.new(creative_world, 3055,60, 2893), loc.new(Overworld, 3057,61,2895), 5, -1);
- jump3 = event.addMoveData(loc.new(creative_world, 3057,59, 2910), loc.new(Overworld, 3059,60,2912), 5, -1);
- Portal1 = event.addMoveData(loc.new(creative_world, 3049,59, 2911), loc.new(Overworld, 3050,61,2912), 5, -1);
- Portal2 = event.addMoveData(loc.new(creative_world, 3051,60, 2893), loc.new(Overworld, 3052,61,2894), 5, -1);
- Portal3 = event.addMoveData(loc.new(creative_world, 3061,62, 2905), loc.new(Overworld, 3062,63,2906), 5, -1);
- Portal4 = event.addMoveData(loc.new(creative_world, 3043,65, 2899), loc.new(Overworld, 3044,67,2900), 5, -1);
- Portal5 = event.addMoveData(loc.new(creative_world, 3053,53, 2893), loc.new(Overworld, 3054,55,2894), 5, -1);
- Portal6 = event.addMoveData(loc.new(creative_world, 3061,53, 2901), loc.new(Overworld, 3062,55,2902), 5, -1);
- portals = map.new();
- map.add(portals, Portal1, portal.create(loc.new(creative_world, 3051.5,60,2893.5), loc.new(creative_world, 3049.5,59, 2911.5), "east", "east"));
- map.add(portals, Portal2, portal.create(loc.new(creative_world, 3049.5,59, 2911.5), loc.new(creative_world, 3051.5,60,2893.5), "east", "east"));
- map.add(portals, Portal3, portal.create(loc.new(creative_world, 3043.5,65, 2899.5), loc.new(creative_world, 3061.5,62, 2905.5), "south", "north"));
- map.add(portals, Portal4, portal.create(loc.new(creative_world, 3061.5,62, 2905.5), loc.new(creative_world, 3043.5,65, 2899.5), "south", "north"));
- map.add(portals, Portal5, portal.create(loc.new(creative_world, 3061.5,53, 2901.5), loc.new(creative_world, 3053.5,53, 2893.5), "east", "south"));
- map.add(portals, Portal6, portal.create(loc.new(creative_world, 3053.5,53, 2893.5), loc.new(creative_world, 3061.5,53, 2901.5), "south", "east"));
- id_effects = map.new();
- map.add(id_effects, speed1, "speed_gel");
- map.add(id_effects, speed2, "speed_gel");
- map.add(id_effects, jump1, "jump_gel");
- map.add(id_effects, jump2, "jump_gel");
- map.add(id_effects, jump3, "jump_gel");
- map.add(id_effects, Portal1, "portal");
- map.add(id_effects, Portal2, "portal");
- map.add(id_effects, Portal3, "portal");
- map.add(id_effects, Portal4, "portal");
- map.add(id_effects, Portal5, "portal");
- map.add(id_effects, Portal6, "portal");
- event.load("player_move");
- //----------------------------------------------------
- @wait
- wait();
- if(event == "player_move"){
- move_type = map.getOrDefault(id_effects, id, "none");
- if(move_type == "speed_gel"){
- gel.speed(player);
- }
- elseif(move_type == "jump_gel"){
- gel.jump(player);
- }
- elseif(move_type == "portal"){
- portal.enter(player, id);
- }
- }
- goto("wait");
- //----------------------------------------------------
- function gel.speed(player){
- living.addEffect(player,"SPEED",5,3,true);
- }
- function gel.jump(player){
- if(!player.isSneaking(player)){
- motion = entity.getMotion(player);
- look = entity.getLook(player);
-
- x = motion[0]+look[0]/3;
- y = 1.01;
- z = motion[2]+look[2]/3;
- entity.setMotion(player, x, y, z);
- }
- }
- function portal.create(to_loc, mid_loc, Direction_in, Direction_out){
- array = array.new(4);
- array[0] = Direction_in;//east // south
- array[1] = Direction_out;//east -> +X, west -> -X, south -> +Z, north -> -Z
- array[2] = to_loc;
- array[3] = mid_loc;
- return array;
- }
- function portal.enter(player, id){
- array = map.get($portals, id);
- Direction_in = array[0];
- Direction_out = array[1];
- to_loc = array[2];
- mid_loc = array[3];
-
- player_loc = entity.getLocation(player);
- player_yaw = loc.getYaw(player_loc);
-
- if(Direction_in == "east"){
- player_X = loc.getX(player_loc);
- mid_X = loc.getX(mid_loc);
- dif = mid_X - player_X;
- rel_yaw = player_yaw+90;
- }
- elseif(Direction_in == "south"){
- player_Z = loc.getZ(player_loc);
- mid_Z = loc.getZ(mid_loc);
- dif = mid_Z - player_Z;
- rel_yaw = player_yaw;
- }
- if(Direction_out == "east"){
- tp_loc = loc.mod(to_loc, 2*dif, 0, 0);
- rel_yaw += -90;
- }
- elseif(Direction_out == "south"){
- tp_loc = loc.mod(to_loc, 0, 0, 2*dif);
- }
- elseif(Direction_out == "west"){
- tp_loc = loc.mod(to_loc, -2*dif, 0, 0);
- rel_yaw += 90;
- }
- elseif(Direction_out == "north"){
- tp_loc = loc.mod(to_loc, 0, 0, -2*dif);
- rel_yaw += 180;
- }
- if(rel_yaw > 180){
- rel_yaw -= 360;
- }elseif(rel_yaw <= -180){
- rel_yaw += 360;
- }
- loc.setYaw(tp_loc, rel_yaw);
- loc.setPitch(tp_loc, loc.getPitch(player_loc));
- entity.teleport(player, tp_loc);
- }
|