Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- unset(@obstructed);
- unset(@arrived);
- unset(@dig_recommended);
- #yaw = 0;
- #oldxpos=XPOS;
- #oldzpos=ZPOS;
- #tick = TOTALTICKS;
- #pitch=45;
- #large_m_timeout=1200;
- #short_m_timeout=600;
- log("attempting to move to $$[1],$$[2]");
- calcyawto($$[1],$$[2],#yaw);
- inc(#yaw,180);
- look(%#yaw%,%#pitch%);
- keydown(forward);
- do;
- calcyawto($$[1],$$[2],#yaw);
- if((YAW!=#yaw) || (PITCH!=#pitch))
- inc(#yaw,180);
- look(%#yaw%,%#pitch%);
- endif;
- if((XPOS==$$[1])&&(ZPOS==$$[2]));
- set(@arrived);
- endif;
- //each time we change x or z.
- if((XPOS!=#oldxpos)||(ZPOS!=#oldzpos));
- #tick=TOTALTICKS;
- #oldxpos=XPOS;
- #oldzpos=ZPOS;
- endif;
- #tickdiff=TOTALTICKS-#tick;
- //if we've not moved in a bit signal that we might need to dig out way out.
- if(#tickdiff>#short_m_timeout);
- set(@dig_recommended);
- endif;
- //if we've not moved in a while give up trying.
- if(#tickdiff>#large_m_timeout);
- set(@obstructed);
- log("Obstructed.");
- endif;
- until((@arrived||@obstructed)||HEALTH<0);
- keyup(forward);
- log("done move_to");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement