Advertisement
taoshi

Harvest 1.03 (OpenComputers)

Nov 4th, 2022 (edited)
33
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.97 KB | Gaming | 0 0
  1. --Harvest_v1.03 Автор Taoshi. pastebin dl: vdbQgd8M
  2. --can be run from eeprom
  3.  
  4. r=component.proxy(component.list('robot')())
  5.  
  6. --field side length
  7. sz=9
  8. --its charging time!
  9. wt=192
  10.  
  11. tn,ris=r.turn,r.inventorySize
  12.  
  13. fw=function()--forward
  14.   while r.move(3)~=true do
  15.   r.inventorySize()
  16.   end
  17.   return
  18. end
  19.  
  20. drop=function()
  21.   local inv=ris()
  22.   for f=1, inv do r.select(f) r.drop(3) end
  23.   return
  24. end
  25.  
  26. doit=function(s)
  27.   s=s-1
  28.   local z,x=s-1,s-1
  29.   local t,t2=true,false
  30.   fw() fw() r.use(0)
  31.  
  32.   for f=1,x do
  33.     for g=1,z do
  34.       fw() r.use(0)
  35.     end
  36.     tn(t) fw() tn(t) r.use(0)
  37.     t,t2=t2,t
  38.   end
  39.  
  40.   tn(t)
  41.   t,t2=true,false
  42.  
  43.   for f=1,s do
  44.     fw() r.use(0) tn(t)
  45.     fw() r.use(0) tn(t)
  46.     t,t2=t2,t  
  47.   end
  48.  
  49.   fw() r.use(0) tn(t) tn(t)
  50.  
  51.   for f=1,s do
  52.     forward() r.use(0)
  53.   end
  54.  
  55.   tn(false) fw() drop()
  56.   tn(true) tn(true)
  57.   return
  58. end
  59.  
  60. main=function()
  61.   doit(sz)
  62.   for f=1,wt do ris() end
  63.   return main()
  64. end
  65.  
  66. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement