Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #import: iT4NKZfx;
- #import: mWBVHmn0;
- digForward(num):{
- for(i=0;i<num;i++){
- dig();
- mvFwd();
- digDown();
- digUp();
- }
- };
- checkFuel():{
- if (getFuelLevel() < 500){
- pos = locate();
- direction = getDirection();
- faceToward($posFuel$);
- for(i=0;i<5;i++) {
- suck(15, 64);
- };
- while (getFuelLevel()<700) {
- input("Bitte Treibstoff-Kiste auffüllen ("+getFuelLevel()+")");
- for(i=0;i<5;i++) {
- suck(15, 64);
- };
- refuel();
- };
- moveTo(pos, direction);
- };
- };
- checkInventory():{
- if (getItemCount(10) != 0){
- pos = locate();
- direction = getDirection();
- driveToResourcesAndDropAll();
- moveTo(pos, direction);
- }
- };
- driveToResourcesAndDropAll():{
- faceToward($posResources$);
- for(i=0;i<16;i++) {
- drop(i,64);
- };
- };
- main:{
- configureItemSwitch(15, "left");
- print("Kiste links wird zum Tanken verwendet");
- print("Kiste rechts wird zum Abladen verwendet");
- x, y, z, d = splitText(input("Start-Position und Ausrichtung (x,y,z,d)"),",");
- posStart = [tonumber(x), tonumber(y), tonumber(z)];
- directionStart = tonumber(d);
- numCorridors = tonumber(input("Gänge"));
- corridorDepth = tonumber(input("Gang tiefe"));
- $posOrigin$ = locate();
- $directionOrigin$ = getDirection();
- $posFuel$ = getPosInDirection($posOrigin$, ($directionOrigin$ + 3) % 4);
- $posResources$ = getPosInDirection($posOrigin$, ($directionOrigin$ + 1) % 4);
- moveTo(posStart, directionStart);
- for (corridor=0;corridor<numCorridors;corridor++){
- print("gang "+(corridor+1)+"/"+numCorridors);
- digForward(3);
- left();
- digForward(corridorDepth);
- left(2);
- mvFwd(corridorDepth);
- checkFuel();
- digForward(corridorDepth);
- left(2);
- mvFwd(corridorDepth);
- right();
- checkFuel();
- checkInventory();
- };
- driveToResourcesAndDropAll();
- moveTo($posOrigin$, $directionOrigin$);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement