Advertisement
Guest User

SetWalls v6

a guest
Jun 4th, 2015
5,164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.81 KB | None | 0 0
  1. options:
  2. p: &7[&9SetWalls&7]&r
  3.  
  4. # dynamic time span scaling, don't change if you don't know how it works
  5. scaleMax: 0.045
  6. scaleMin: 0.005
  7. scalePlayers: 30
  8.  
  9. # how long to wait between progress notifications
  10. notify-delay: 3 seconds
  11.  
  12. # name of spawn world
  13. spawn-world: spawn
  14.  
  15. command /setwalls <world> <int> [<int=0>] [<int=0>] [<item=bedrock>] [<number>]:
  16. permission: skript.setwalls
  17. usage: /setwalls <world> <radius> [<center x>] [<center z>] [<block>]
  18. trigger:
  19. if "%arg 1%" is "{@spawn-world}":
  20. message "{@p} &7http://i.imgur.com/pTcKZvJ.jpg"
  21. stop
  22.  
  23. # time for catch-up/notify checking
  24. set {_time.tick} to now
  25. set {_time.notify} to now
  26. set {_time.start} to now
  27.  
  28. # corner bottom blocks
  29. set {_r} to arg 2+0.5
  30. set {_++} to (block at location at {_r}+(arg 3), 0.5, {_r}+(arg 4) of the world arg-1)
  31. set {_+-} to (block at location at {_r}+(arg 3), 0.5, 0-{_r}+(arg 4) of the world arg-1)
  32. set {_--} to (block at location at 0-{_r}+(arg 3), 0.5, 0-{_r}+(arg 4) of the world arg-1)
  33. set {_-+} to (block at location at 0-{_r}+(arg 3), 0.5, {_r}+(arg 4) of the world arg-1)
  34.  
  35. # counters for progress
  36. set {_processed} to 0
  37. set {_total} to ((arg 2)*2-1)*4
  38.  
  39. if arg 6 is not set:
  40. # dynamic tick time calculation
  41. set {_playerCount} to size of all players
  42. if {_playerCount} > {@scalePlayers}:
  43. set {_playerCount} to {@scalePlayers}
  44. # MATHZ
  45. set {_seconds} to {@scaleMax}-({@scaleMax}-{@scaleMin})*({_playerCount}/{@scalePlayers})
  46. set {_usage} to 100*{_seconds}/0.05
  47. set {_maxTime} to "%{_seconds}% seconds" parsed as timespan
  48. else:
  49. # forced time
  50. set {_usage} to arg 6
  51. set {_maxTime} to "%{_usage}*0.0005% seconds" parsed as timespan
  52.  
  53. message "{@p} &cGeneration started by &e%command sender%&7!" to all ops
  54. message "{@p} &7World: &9%arg 1% &r &r &r &r &r &r &7Block: &9%arg 5% &r &r &r &r &r &r &7Usage:" to all ops
  55. message "{@p} &7Radius/Center: &9%arg 2%&7@&9%arg 3%&7,&9%arg 4% &7(&9%arg 2*2%²&7) &r &r &r &r &9%{_usage}%%%" to all ops
  56.  
  57. loop blocks from {_++} to {_+-}:
  58. loop blocks from loop-block to block 255 above loop-block:
  59. set loop-block-2 to arg 5
  60.  
  61. set {_processed} to {_processed}+1
  62.  
  63. if {_time.tick} was more than {_maxTime} ago:
  64. wait 1 tick
  65. set {_time.tick} to now
  66. if {_time.notify} was more than {@notify-delay} ago:
  67. message "{@p} &7Progress in &9%arg 1%&7: &5%100*{_processed}/{_total}%%%&7!" to all ops
  68. set {_time.notify} to now
  69.  
  70. loop blocks from {_+-} to {_--}:
  71. loop blocks from loop-block to block 255 above loop-block:
  72. set loop-block-2 to arg 5
  73.  
  74. set {_processed} to {_processed}+1
  75.  
  76. if {_time.tick} was more than {_maxTime} ago:
  77. wait 1 tick
  78. set {_time.tick} to now
  79. if {_time.notify} was more than {@notify-delay} ago:
  80. message "{@p} &7Progress in &9%arg 1%&7: &5%100*{_processed}/{_total}%%%&7!" to all ops
  81. set {_time.notify} to now
  82.  
  83. loop blocks from {_--} to {_-+}:
  84. loop blocks from loop-block to block 255 above loop-block:
  85. set loop-block-2 to arg 5
  86.  
  87. set {_processed} to {_processed}+1
  88.  
  89. if {_time.tick} was more than {_maxTime} ago:
  90. wait 1 tick
  91. set {_time.tick} to now
  92. if {_time.notify} was more than {@notify-delay} ago:
  93. message "{@p} &7Progress in &9%arg 1%&7: &5%100*{_processed}/{_total}%%%&7!" to all ops
  94. set {_time.notify} to now
  95.  
  96. loop blocks from {_-+} to {_++}:
  97. loop blocks from loop-block to block 255 above loop-block:
  98. set loop-block-2 to arg 5
  99.  
  100. set {_processed} to {_processed}+1
  101.  
  102. if {_time.tick} was more than {_maxTime} ago:
  103. wait 1 tick
  104. set {_time.tick} to now
  105. if {_time.notify} was more than {@notify-delay} ago:
  106. message "{@p} &7Progress in &9%arg 1%&7: &5%100*{_processed}/{_total}%%%&7!" to all ops
  107. set {_time.notify} to now
  108.  
  109. message "{@p} &aFinished in &9%arg 1%&a! &7(%difference between {_time.start} and now%)" to all ops
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement