Advertisement
AdditionalPylons

mlogjs

Oct 27th, 2024
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // function debugPos(x, y) {
  2. //     explosion({ team: Teams.sharded, x: x, y: y, radius: 5, damage: 0, air: false, ground: false, pierce: false });
  3. // }
  4. function moveTo(x,y,tox,toy) {
  5.     setBlock.block({ x: x, y: y, to: Blocks.air, team: Teams.sharded, rotation: 0 });
  6.     setBlock.block({ x: tox, y: toy, to: sandBlock, team: Teams.sharded, rotation: 0 });
  7. }
  8. const sandBlock: BuildingSymbol = Blocks.surgeWall; // блок который воспринимается как песок
  9. const particles = fetch.buildCount(Teams.sharded, sandBlock);
  10. setRate(particles*3);
  11. print(particles);
  12. printFlush(getBuilding("message1"));
  13.  
  14. const sand = fetch.build(Teams.sharded, Math.rand(particles), sandBlock);
  15. const blockBelow = getBlock.building(sand.x, sand.y - 1);
  16. if (blockBelow === undefined) {
  17.     moveTo(sand.x, sand.y, sand.x, sand.y - 1);
  18.     endScript();
  19. }
  20. const blockOnLeft = getBlock.building(sand.x - 1, sand.y - 1);
  21. const blockOnRight = getBlock.building(sand.x + 1, sand.y - 1);
  22. const wallLeft = getBlock.building(sand.x - 1, sand.y);
  23. const wallRight = getBlock.building(sand.x + 1, sand.y);
  24. if (blockOnLeft === undefined && wallLeft === undefined) {
  25.     if (blockOnRight === undefined && wallRight === undefined && Math.rand(1)>0.5) {
  26.         moveTo(sand.x, sand.y, sand.x + 1, sand.y - 1);
  27.         endScript();
  28.     }
  29.     moveTo(sand.x, sand.y, sand.x - 1, sand.y - 1);
  30.     endScript();
  31. }
  32. if (blockOnRight === undefined && wallRight === undefined) {
  33.     moveTo(sand.x, sand.y, sand.x + 1, sand.y - 1);
  34.     endScript();
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement