Date: 2018/09/16 07:41:04 UTC-07: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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
# MirrorBuild:
# type: world
# events:
# on player places block:
# - if <player.has_flag[MirrorBuild.Location.X]> {
# - define loc1 <context.location>
# - define mirror <player.flag[MirrorBuild.Location.X].as_location>
# - define opposite <def[loc1].sub[<def[mirror]>]>
# - define loc2 <def[mirror].add[<def[opposite].x>,<def[opposite].y>,<def[opposite].z.mul[-1]>]>
# # - narrate "l@<def[loc2].X>,<def[loc2].Y>,<def[loc2].Z>,<def[loc2].world.name>"
# - modifyblock <def[loc2].X>,<def[loc2].Y>,<def[loc2].Z>,<def[loc2].world.name> <context.material>
# }
# on player breaks block:
# - if <player.has_flag[MirrorBuild.Location.X]> {
# - define loc1 <context.location>
# - define mirror <player.flag[MirrorBuild.Location.X].as_location>
# - define opposite <def[loc1].sub[<def[mirror]>]>
# - define loc2 <def[mirror].add[<def[opposite].x>,<def[opposite].y>,<def[opposite].z.mul[-1]>]>
# # - narrate "l@<def[loc2].X>,<def[loc2].Y>,<def[loc2].Z>,<def[loc2].world.name>"
# # - modifyblock <def[loc2].X>,<def[loc2].Y>,<def[loc2].Z>,<def[loc2].world.name> air
# - define loc "l@<def[loc2].X>,<def[loc2].Y>,<def[loc2].Z>,<def[loc2].world.name>"
# - define loc <def[loc].as_location.block>
# - if <def[loc].material.name> == air {
# - queue clear
# }
# - define mat_id <def[loc].material.id>
# - modifyblock <def[loc]> air
# - playeffect <def[loc].add[0.5,-0.5,0.5]> effect:TILE_BREAK data:<def[mat_id]> quantity:30 offset:3.0
# # - playsound <def[loc]> sound:DIG_STONE
# }
# - if <player.has_flag[MirrorBuild.Location.Z]> {
# - define loc1 <context.location>
# - define mirror <player.flag[MirrorBuild.Location.Z].as_location>
# - define opposite <def[loc1].sub[<def[mirror]>]>
# - define loc2 <def[mirror].add[<def[opposite].x.mul[-1]>,<def[opposite].y>,<def[opposite].z>]>
# # - narrate "l@<def[loc2].X>,<def[loc2].Y>,<def[loc2].Z>,<def[loc2].world.name>"
# # - modifyblock <def[loc2].X>,<def[loc2].Y>,<def[loc2].Z>,<def[loc2].world.name> air
# - define loc "l@<def[loc2].X>,<def[loc2].Y>,<def[loc2].Z>,<def[loc2].world.name>"
# - define loc <def[loc].as_location.block>
# - if <def[loc].material.name> == air {
# - queue clear
# }
# - define mat_id <def[loc].material.id>
# - modifyblock <def[loc]> air
# - playeffect <def[loc].add[0.5,-0.5,0.5]> effect:TILE_BREAK data:<def[mat_id]> quantity:30 offset:3.0
# # - playsound <def[loc]> sound:DIG_STONE
# }
# MirrorBuild_Place_Task:
# type: task
# script:
# - if <player.has_flag[MirrorBuild.Location.X]> {
# - define loc1 <context.location>
# - define mirror <player.flag[MirrorBuild.Location.X].as_location>
# - define opposite <def[loc1].sub[<def[mirror]>]>
# - define loc2 <def[mirror].add[<def[opposite].x>,<def[opposite].y>,<def[opposite].z.mul[-1]>]>
# # - narrate "l@<def[loc2].X>,<def[loc2].Y>,<def[loc2].Z>,<def[loc2].world.name>"
# - modifyblock <def[loc2].X>,<def[loc2].Y>,<def[loc2].Z>,<def[loc2].world.name> <context.material>
# }
# MirrorBuild_Task:
# type: task
# definitions: axis
# script:
# - if <player.has_flag[MirrorBuild.Location.<def[axis]>]> {
# - flag player MirrorBuild.Location.<def[axis]>:!
# - narrate format:util_ff "<&c>Mirror slået fra"
# }
# else {
# - flag player MirrorBuild.Location.<def[axis]>:<pl.location>
# - narrate format:util_ff "<&a>Mirror slået til"
# }
MirrorBuild_Task:
type: task
definitions: amount
script:
- if <player.has_flag[MirrorBuild.Center]> {
- flag player MirrorBuild.Center:!
- narrate format:util_ff "<&c>Mirror slået fra"
}
else {
- flag player MirrorBuild.Center:<pl.location.block.add[0.5,0.5,0.5]>
- flag player MirrorBuild.Amount:<def[amount]>
- narrate format:util_ff "<&a>Mirror slået til"
}
MirrorBuild_Events_v2:
type: world
events:
on player places block:
- if <player.has_flag[MirrorBuild.Center]> {
- if <context.location.distance[<player.flag[MirrorBuild.Center]>]||100> > 50.0 {
- narrate format:util_ff "<&7>Du er for langt væk fra din mirror! Du kan slå det fra med /mirror"
- queue clear
}
- define mat <context.material.name>
- inject MirrorBuild_Place_Task3
}
on player breaks block:
- if <player.has_flag[MirrorBuild.Center]> {
- if <context.location.distance[<player.flag[MirrorBuild.Center]>]||100> > 50.0 {
- narrate format:util_ff "<&7>Du er for langt væk fra din mirror! Du kan slå det fra med /mirror"
- queue clear
}
- define mat air
- inject MirrorBuild_Place_Task3
}
MirrorBuild:
type: command
name: mirror
script:
- run MirrorBuild_Task instantly context:<context.args.get[1]||4>
# Symmetric for 2 wide blocks (endless amount) (works!)
MirrorBuild_Place_Task2:
type: task
script:
- define world_name <player.world.name>
# - define teams <server.flag[UHC.Teams].as_list>
- define center "<player.flag[MirrorBuild.Center].as_location>"
- define center "l@<def[center].x>,<context.location.y>,<def[center].z>,<def[center].world.name>"
- define center <def[center].as_location>
- define n <player.flag[MirrorBuild.Amount]>
- define cx <def[center].x.round>
- define cy <def[center].z.round>
- define r <def[center].distance[<context.location>]>
- define increment <el@360.div[<def[n]>]>
- define startAngle <def[center].direction[<context.location>].yaw>
# - narrate <def[startAngle]>
- define pies <util.pi.div[180]>
- repeat <def[n]> {
- define angle <def[startAngle].add[<def[increment].mul[<def[value].sub[1]>]>]>
- define tx <def[cx].add[<def[r].mul[<def[angle].mul[<def[pies]>].cos>]>]>
- define ty <def[cy].add[<def[r].mul[<def[angle].mul[<def[pies]>].sin>]>]>
- define loc "l@<def[tx]>,<context.location.y>,<def[ty]>,<def[world_name]>"
- define loc <def[loc].as_location>
# - narrate "<&a><def[loc]>"
# - repeat 40 {
# - define loc <def[loc].add[0,-1,0]>
# - if <def[loc].material.name> != air {
# - define loc <def[loc].add[0,1,0]>
# - repeat stop
# }
# }
- modifyblock <def[loc]> <def[mat]>
}
# - narrate "Finished"
MirrorBuild_Place_Task3:
type: task
script:
- define world_name <player.world.name>
- define center "<player.flag[MirrorBuild.Center].as_location.block>"
# 4 blocks
- define left <def[center].sub[<context.location>]>
# - announce "<def[left]>"
- define y <def[center].y.sub[<context.location.y>].mul_int[-1]>
# - announce "<&a><def[y]>"
- run MirrorBuilder_Plot_Task instantly context:<def[center].add[<def[left].x>,<def[y]>,<def[left].z>]>|<def[mat]>
- run MirrorBuilder_Plot_Task instantly context:<def[center].add[<def[left].x.mul[-1]>,<def[y]>,<def[left].z>]>|<def[mat]>
- run MirrorBuilder_Plot_Task instantly context:<def[center].add[<def[left].x>,<def[y]>,<def[left].z.mul[-1]>]>|<def[mat]>
- run MirrorBuilder_Plot_Task instantly context:<def[center].add[<def[left].x.mul[-1]>,<def[y]>,<def[left].z.mul[-1]>]>|<def[mat]>
- run MirrorBuilder_Plot_Task instantly context:<def[center].add[<def[left].z>,<def[y]>,<def[left].x>]>|<def[mat]>
- run MirrorBuilder_Plot_Task instantly context:<def[center].add[<def[left].z.mul[-1]>,<def[y]>,<def[left].x>]>|<def[mat]>
- run MirrorBuilder_Plot_Task instantly context:<def[center].add[<def[left].z>,<def[y]>,<def[left].x.mul[-1]>]>|<def[mat]>
- run MirrorBuilder_Plot_Task instantly context:<def[center].add[<def[left].z.mul[-1]>,<def[y]>,<def[left].x.mul[-1]>]>|<def[mat]>
# - modifyblock <def[loc]> <def[mat]>
MirrorBuilder_Plot_Task:
type: task
definitions: loc|mat
script:
- modifyblock <def[loc]> <def[mat]>