Date: 2017/02/21 19:41:17 UTC-08:00
Type: Denizen Script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# - run AreaMover_Task_Move world:<context.location.world>|name:<def[name]>
AreaMover_Task_Move:
type: task
debug: minimal
script:
- yaml 'areamover_queues' set running.<def[name]> '<queue.id>'
- define direction <yaml[areamover_<def[world]>].read[areas.<def[name]>.direction]>
- define cuboid <server.cuboid_wrapping[<yaml[areamover_<def[world]>].read[areas.<def[name]>.min]>|<yaml[areamover_<def[world]>].read[areas.<def[name]>.max]>]>
# - define speed <number[21].subtract[<yaml[areamover_<def[world]>].read[areas.<def[name]>.speed]>].multiply[0.05]>]>
- if <def[direction]> == north:
- define dlen <integer[<def[cuboid].max.z.sub[<def[cuboid].min.z>].add[1]>]>
- define offset 0,0,-1
- define idir south
- else if <def[direction]> == south:
- define dlen <integer[<def[cuboid].max.z.sub[<def[cuboid].min.z>].add[1]>]>
- define offset 0,0,1
- define idir north
- else if <def[direction]> == east:
- define dlen <integer[<def[cuboid].max.x.sub[<def[cuboid].min.x>].add[1]>]>
- define offset 1,0,0
- define idir west
- else if <def[direction]> == west:
- define dlen <integer[<def[cuboid].max.x.sub[<def[cuboid].min.x>].add[1]>]>
- define offset -1,0,0
- define idir east
- else if <def[direction]> == up:
- define dlen <integer[<def[cuboid].max.y.sub[<def[cuboid].min.y>].add[1]>]>
- define offset 0,1,0
- define idir down
- else if <def[direction]> == down:
- define dlen <integer[<def[cuboid].max.y.sub[<def[cuboid].min.y>].add[1]>]>
- define offset 0,-1,0
- define idir up
- else:
- define path trigger.failed
- define source player
- inject AreaMover_Task_Messages
- yaml 'areamover_queues' remove running.<def[name]>
- stop
# Build list of materials
- define mats <list[]>
- define data <list[]>
- foreach start <def[cuboid].block_locations> --save block:
- addto mats list <def[block].block_type>
- addto data list <def[block].data>
# - setblock <def[block]> minecraft:air
# Move area in a direction
- repeat <def[dlen]>:
- foreach start <def[cuboid].block_locations> --save block:
- setblock <def[block]> minecraft:air false
- define cuboid <server.cuboid_wrapping[<def[cuboid].min.add[<def[offset]>]>|<def[cuboid].max.add[<def[offset]>]>]>
- foreach start <def[cuboid].block_locations> --save block:
- setblock <def[block]> <def[mats].get[<def[foreach_index]>]> false
- editblock <def[block]> <def[data].get[<def[foreach_index]>]>
- wait 0.5s
- yaml areamover_<[world]> set 'areas.<[name]>.direction' '<[idir]>'
- yaml areamover_<[world]> set 'areas.<[name]>.min' '<[cuboid].min>'
- yaml areamover_<[world]> set 'areas.<[name]>.max' '<[cuboid].max>'
- yaml areamover_<[world]> save '../../AreaMover/<[world]>'
- yaml 'areamover_queues' remove running.<def[name]>