Advertisement
Lion4ever

jump_around.1.1

Aug 18th, 2015
332
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.14 KB | None | 0 0
  1. --Floating Blocks by negamartin
  2. --Modified to "Jump Around" by Lion4ever
  3. --You can use it for whatever you want, copy, modify, distribute it or use it as a base for your own structures
  4.  
  5. --Get what the main program is telling us to do
  6. local args={...};
  7.  
  8. --If it wants to know how much probability we have to be chosen when selecting the next structure
  9. if args[1]=="weight" then
  10.     return 1;   --We have a normal structure's probability to be chosen
  11.    
  12. --If it wants us to build the structure,
  13. elseif args[1]=="build" then
  14.     --Get the angle the last structure had
  15.     local lastAngle=args[2];
  16.    
  17.     --Get a random height difference for the block we are going to place in relation to the last block, from -2 to 1
  18.     local r=math.random();
  19.     if  r<0.22222 then  hdif=-1;
  20.     elseif  r<0.33333 then  hdif=-2;
  21.     else                    hdif=0;
  22.     end
  23.    
  24.     --Get the distance between the last block and the one we are gonna place, depending on the height difference (if the block is lower you can jump farther)
  25.     local dist = 3.6
  26.    
  27.    
  28.     --Get the new angle, which is (+-)0.3PI from the previous angle (lastAngle)
  29.     local ang=lastAngle-math.pi*0.3+math.random()*math.pi*0.6;
  30.    
  31.     --Get the radius of our areaCheck sphere depending on the height difference
  32.     local sphere;
  33.     if hdif==-2 then sphere=7;
  34.     elseif hdif==-1 then sphere=6;
  35.     else sphere=5; end
  36.    
  37.     --Create our setblock parameters and place them in a table
  38.     local b={
  39.         math.floor(0.5+math.cos(ang)*dist),
  40.         hdif,
  41.         math.floor(0.5+math.sin(ang)*dist),
  42.         "minecraft:stone",
  43.     };
  44.     local b2={
  45.         math.floor(0.5+math.cos(ang)*(dist-1.5)),
  46.         2,
  47.         math.floor(0.5+math.sin(ang)*(dist-1.5)),
  48.         b[4]
  49.     }
  50.     --Return the StructureTable, with everything it needs to have
  51.     return {
  52.         blocks={b,b2},                              --The blocks table contains 1 element: the floating block
  53.         areaCheck={{b[1],b[2],b[3],sphere}},    --The areaCheck table also only contains 1 element, our floating block area check.
  54.         exit={b[1],b[2],b[3]},                  --The exit of this structure is this same block
  55.         next=ang,                               --Tell the next structure our angle was this
  56.         length=15,                              --This structure is 15% a total checkpoint-to-checkpoint parkour section in normal difficulty
  57.     };
  58. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement