Advertisement
melzneni

Quarry

Sep 4th, 2023 (edited)
37
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. #import: iT4NKZfx;
  2. #import: AAMw1hB3;
  3.  
  4. getClosestPosInCuboid(pos, start, end): {
  5.  
  6. return([numInRange(pos[0], start[0], end[0]),
  7. numInRange(pos[1], start[1], end[1]),
  8. numInRange(pos[2], start[2], end[2])]);
  9.  
  10. };
  11.  
  12. numInRange(num, _min, _max):{
  13. return(max(_min, min(num, _max)));
  14. };
  15.  
  16. main: {
  17. print("links: Fuel");
  18. print("rechts: Zeugs");
  19.  
  20. x1,y1,z1=splitText(input("start<x,y,z>"),",");
  21. x2,y2,z2=splitText(input("end<x,y,z>"),",");
  22. x1,x2 = minMax(tonumber(x1),tonumber(x2));
  23. y1,y2 = minMax(tonumber(y1),tonumber(y2));
  24. z1,z2 = minMax(tonumber(z1),tonumber(z2));
  25.  
  26. start = [x1,y1,z1];
  27. end = [x2,y2,z2];
  28. print("start: "+start);
  29. print("end: "+end);
  30.  
  31. pos = locate();
  32. closestPos = getClosestPosInCuboid(pos, start, end);
  33.  
  34.  
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement