SHARE
TWEET

digdug.lua

a guest Nov 9th, 2019 69 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. dig="dig";
  2. dug="dug";
  3. nodes={};
  4. nodes.x0y0z0=dug;
  5. nodes.x1y0z0=dig;
  6. nodes.x1y1z0=dig;
  7. nodes.x1y1z1=dig;
  8. godig={};
  9. index={};
  10. xyz={};
  11. for key, value in pairs(nodes) do
  12. if ( value == dig ) then
  13. index.z = string.find(key, "z");
  14. index.y = string.find(key, "y");
  15. index.x = string.find(key, "x");
  16. xyz.z = tonumber(string.sub(key, (index.z +1)));
  17. xyz.y = tonumber(string.sub(key, (index.y +1), (index.z -1)));
  18. xyz.x = tonumber(string.sub(key, (index.x +1), (index.y -1)));
  19.  
  20. local str = tostring("x" .. (xyz.x +1) .. "y" .. (xyz.y +0).. "z" .. (xyz.z +0));
  21. print(str);
  22. if (nodes.[str] = dug) then godig.[str] = "x+"; end
  23.  
  24. local str = tostring("x" .. (xyz.x +0) .. "y" .. (xyz.y +1).. "z" .. (xyz.z +0));
  25. if (nodes.[str] == dug) then godig.[str] = "y+"; end
  26.  
  27. local str = tostring("x" .. (xyz.x +0) .. "y" .. (xyz.y +0).. "z" .. (xyz.z +1));
  28. if (nodes.[str] == dug) then godig.[str] = "z+"; end
  29.  
  30. local str = tostring("x" .. (xyz.x -1) .. "y" .. (xyz.y +0).. "z" .. (xyz.z +0));
  31. if (nodes.[str] == dug) then godig.[str] = "x-"; end
  32.  
  33. local str = tostring("x" .. (xyz.x +0) .. "y" .. (xyz.y -1).. "z" .. (xyz.z +0));
  34. if (nodes.[str] == dug) then godig.[str] = "y-"; end
  35.  
  36. local str = tostring("x" .. (xyz.x +0) .. "y" .. (xyz.y +0).. "z" .. (xyz.z -1));
  37. if (nodes.[str] == dug) then godig.[str] = "z-"; end
  38. print("digdug");
  39. end
  40. print("test");
  41. end
  42. print(tostring(godig));
  43. for key, value in pairs(godig) do
  44. print(tostring(key));
  45. print(tostring(value));
  46. print("test2");
  47. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top