Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- options:
- p: &7[&9SetWalls&7]&r
- # dynamic time span scaling, don't change if you don't know how it works
- scaleMax: 0.045
- scaleMin: 0.005
- scalePlayers: 30
- # how long to wait between progress notifications
- notify-delay: 3 seconds
- # name of spawn world
- spawn-world: spawn
- command /setwalls <world> <int> [<int=0>] [<int=0>] [<item=bedrock>] [<number>]:
- permission: skript.setwalls
- usage: /setwalls <world> <radius> [<center x>] [<center z>] [<block>]
- trigger:
- if "%arg 1%" is "{@spawn-world}":
- message "{@p} &7http://i.imgur.com/pTcKZvJ.jpg"
- stop
- # time for catch-up/notify checking
- set {_time.tick} to now
- set {_time.notify} to now
- set {_time.start} to now
- # corner bottom blocks
- set {_r} to arg 2+0.5
- set {_++} to (block at location at {_r}+(arg 3), 0.5, {_r}+(arg 4) of the world arg-1)
- set {_+-} to (block at location at {_r}+(arg 3), 0.5, 0-{_r}+(arg 4) of the world arg-1)
- set {_--} to (block at location at 0-{_r}+(arg 3), 0.5, 0-{_r}+(arg 4) of the world arg-1)
- set {_-+} to (block at location at 0-{_r}+(arg 3), 0.5, {_r}+(arg 4) of the world arg-1)
- # counters for progress
- set {_processed} to 0
- set {_total} to ((arg 2)*2-1)*4
- if arg 6 is not set:
- # dynamic tick time calculation
- set {_playerCount} to size of all players
- if {_playerCount} > {@scalePlayers}:
- set {_playerCount} to {@scalePlayers}
- # MATHZ
- set {_seconds} to {@scaleMax}-({@scaleMax}-{@scaleMin})*({_playerCount}/{@scalePlayers})
- set {_usage} to 100*{_seconds}/0.05
- set {_maxTime} to "%{_seconds}% seconds" parsed as timespan
- else:
- # forced time
- set {_usage} to arg 6
- set {_maxTime} to "%{_usage}*0.0005% seconds" parsed as timespan
- message "{@p} &cGeneration started by &e%command sender%&7!" to all ops
- 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
- 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
- loop blocks from {_++} to {_+-}:
- loop blocks from loop-block to block 255 above loop-block:
- set loop-block-2 to arg 5
- set {_processed} to {_processed}+1
- if {_time.tick} was more than {_maxTime} ago:
- wait 1 tick
- set {_time.tick} to now
- if {_time.notify} was more than {@notify-delay} ago:
- message "{@p} &7Progress in &9%arg 1%&7: &5%100*{_processed}/{_total}%%%&7!" to all ops
- set {_time.notify} to now
- loop blocks from {_+-} to {_--}:
- loop blocks from loop-block to block 255 above loop-block:
- set loop-block-2 to arg 5
- set {_processed} to {_processed}+1
- if {_time.tick} was more than {_maxTime} ago:
- wait 1 tick
- set {_time.tick} to now
- if {_time.notify} was more than {@notify-delay} ago:
- message "{@p} &7Progress in &9%arg 1%&7: &5%100*{_processed}/{_total}%%%&7!" to all ops
- set {_time.notify} to now
- loop blocks from {_--} to {_-+}:
- loop blocks from loop-block to block 255 above loop-block:
- set loop-block-2 to arg 5
- set {_processed} to {_processed}+1
- if {_time.tick} was more than {_maxTime} ago:
- wait 1 tick
- set {_time.tick} to now
- if {_time.notify} was more than {@notify-delay} ago:
- message "{@p} &7Progress in &9%arg 1%&7: &5%100*{_processed}/{_total}%%%&7!" to all ops
- set {_time.notify} to now
- loop blocks from {_-+} to {_++}:
- loop blocks from loop-block to block 255 above loop-block:
- set loop-block-2 to arg 5
- set {_processed} to {_processed}+1
- if {_time.tick} was more than {_maxTime} ago:
- wait 1 tick
- set {_time.tick} to now
- if {_time.notify} was more than {@notify-delay} ago:
- message "{@p} &7Progress in &9%arg 1%&7: &5%100*{_processed}/{_total}%%%&7!" to all ops
- set {_time.notify} to now
- 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