Advertisement
melzneni

Turti strip mining

Aug 16th, 2023 (edited)
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.14 KB | None | 0 0
  1. #import: iT4NKZfx;
  2. #import: mWBVHmn0;
  3.  
  4. digForward(num):{
  5. for(i=0;i<num;i++){
  6. dig();
  7. mvFwd();
  8. digDown();
  9. digUp();
  10. }
  11. };
  12.  
  13. checkFuel():{
  14. if (getFuelLevel() < 500){
  15. pos = locate();
  16. direction = getDirection();
  17. faceToward($posFuel$);
  18. for(i=0;i<5;i++) {
  19. suck(15, 64);
  20. };
  21. while (getFuelLevel()<700) {
  22. input("Bitte Treibstoff-Kiste auffüllen ("+getFuelLevel()+")");
  23. for(i=0;i<5;i++) {
  24. suck(15, 64);
  25. };
  26. refuel();
  27. };
  28. moveTo(pos, direction);
  29. };
  30. };
  31.  
  32. checkInventory():{
  33. if (getItemCount(10) != 0){
  34. pos = locate();
  35. direction = getDirection();
  36. driveToResourcesAndDropAll();
  37. moveTo(pos, direction);
  38. }
  39. };
  40.  
  41. driveToResourcesAndDropAll():{
  42. faceToward($posResources$);
  43. for(i=0;i<16;i++) {
  44. drop(i,64);
  45. };
  46. };
  47.  
  48. main:{
  49. configureItemSwitch(15, "left");
  50. print("Kiste links wird zum Tanken verwendet");
  51. print("Kiste rechts wird zum Abladen verwendet");
  52. x, y, z, d = splitText(input("Start-Position und Ausrichtung (x,y,z,d)"),",");
  53. posStart = [tonumber(x), tonumber(y), tonumber(z)];
  54. directionStart = tonumber(d);
  55.  
  56. numCorridors = tonumber(input("Gänge"));
  57. corridorDepth = tonumber(input("Gang tiefe"));
  58.  
  59. $posOrigin$ = locate();
  60. $directionOrigin$ = getDirection();
  61. $posFuel$ = getPosInDirection($posOrigin$, ($directionOrigin$ + 3) % 4);
  62. $posResources$ = getPosInDirection($posOrigin$, ($directionOrigin$ + 1) % 4);
  63.  
  64. moveTo(posStart, directionStart);
  65. for (corridor=0;corridor<numCorridors;corridor++){
  66. print("gang "+(corridor+1)+"/"+numCorridors);
  67. digForward(3);
  68.  
  69. left();
  70. digForward(corridorDepth);
  71. left(2);
  72. mvFwd(corridorDepth);
  73. checkFuel();
  74.  
  75. digForward(corridorDepth);
  76. left(2);
  77. mvFwd(corridorDepth);
  78. right();
  79. checkFuel();
  80.  
  81. checkInventory();
  82. };
  83. driveToResourcesAndDropAll();
  84. moveTo($posOrigin$, $directionOrigin$);
  85. }
  86.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement