Date: 2018/07/03 09:29:40 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
"Heavens Handler":
type: world
events:
on player right clicks quartz_block with flint_and_steel in prosperus:
- if <context.location.add[0,1,0].material> != m@air
{
- queue clear
}
- if <context.location.add[1,0,0].material> == m@quartz_block && <context.location.add[-1,0,0].material> == m@quartz_block
{
- define axis-pos l@1,0,0
- define axis-neg l@-1,0,0
- define axis-data 1
}
else if <context.location.add[0,0,1].material> == m@quartz_block && <context.location.add[0,0,-1].material> == m@quartz_block
{
- define axis-pos l@0,0,1
- define axis-neg l@0,0,-1
- define axis-data 2
}
else
{
- queue clear
}
- define origin <context.location.add[0,1,0]>
- define node <def[origin]>
- define air-list li@
- define y-list li@
- define y-max <def[origin].y>
- define y-min <def[origin].y>
- define x-max <def[origin].x>
- define x-min <def[origin].x>
- define z-max <def[origin].z>
- define z-min <def[origin].z>
- while <def[node].material.is[==].to[m@air]>
{
- define air-list <def[air-list].include[<def[node]>]>
- define y-list <def[y-list].include[<def[node]>]>
- define y-max <def[y-max].max[<def[node].y>]>
- define y-min <def[y-min].min[<def[node].y>]>
- define node <def[node].add[0,1,0]>
}
- if <def[node].material> != m@quartz_block
{
- queue clear
}
else
{
- foreach <def[y-list]>
{
- define node <def[value]>
- while <def[node].material.is[==].to[m@air]>
{
- define air-list <def[air-list].include[<def[node]>]>
- if <def[axis-data]> == 1
{
- define x-max <def[x-max].max[<def[node].x>]>
- define x-min <def[x-min].min[<def[node].x>]>
}
- if <def[axis-data]> == 2
{
- define z-max <def[z-max].max[<def[node].z>]>
- define z-min <def[z-min].min[<def[node].z>]>
}
- define node <def[node].add[<def[axis-pos]>]>
}
- if <def[node].material> != m@quartz_block
{
- queue clear
}
- define node <def[value]>
- while <def[node].material.is[==].to[m@air]>
{
- define air-list <def[air-list].include[<def[node]>]>
- if <def[axis-data]> == 1
{
- define x-max <def[x-max].max[<def[node].x>]>
- define x-min <def[x-min].min[<def[node].x>]>
}
- if <def[axis-data]> == 2
{
- define z-max <def[z-max].max[<def[node].z>]>
- define z-min <def[z-min].min[<def[node].z>]>
}
- define node <def[node].add[<def[axis-neg]>]>
}
- if <def[node].material> != m@quartz_block
{
- queue clear
}
}
}
- modifyblock <def[air-list]> m@end_gateway,<def[axis-data]> no_physics
- announce to_console "cu@<def[x-min].add[<def[axis-neg].x>]>,<def[y-min].add[-1]>,<def[z-min].add[<def[axis-neg].z>]>,prosperus|<def[x-max].add[<def[axis-pos].x>]>,<def[y-max].add[1]>,<def[z-max].add[<def[axis-pos].z>]>,prosperus as:heavens-portal-<util.random.duuid>"
- note cu@<def[x-min].add[<def[axis-neg].x>]>,<def[y-min].add[-1]>,<def[z-min].add[<def[axis-neg].z>]>,prosperus|<def[x-max].add[<def[axis-pos].x>]>,<def[y-max].add[1]>,<def[z-max].add[<def[axis-pos].z>]>,prosperus as:heavens-portal-<util.random.duuid>
on player breaks end_gateway:
- if <context.location.cuboids.contains_text[heavens-portal]>
{
- define notable <context.location.cuboids.filter[notable_name.starts_with[heavens-portal]].get[1]>
- modifyblock <def[notable].blocks[end_gateway]> m@air
- note remove as:<def[notable].notable_name>
}
on player breaks quartz_block:
- if <context.location.cuboids.contains_text[heavens-portal]>
{
- define notable <context.location.cuboids.filter[notable_name.starts_with[heavens-portal]].get[1]>
- modifyblock <def[notable].blocks[end_gateway]> m@air
- note remove as:<def[notable].notable_name>
}
on player enters notable cuboid:
- if <context.cuboids.contains_text[heavens-portal]>
{
# - define final-location <context.from.replace[prosperus].with[heavens]>
# - define final-location <def[final-location].x.div[2]>
# - define final-location <def[final-location].z.div[2]>
# - determine <def[final-location]>
# - determine l@<context.from.x.div[2]>,<context.from.y>,<context.from.z.div[2]>,heavens
- define target-location l@<context.from.x.div[2]>,<context.from.y>,<context.from.z.div[2]>,heavens
- if <def[target-location].material> == m@air && <def[target-location].add[0,-1,0].material> != m@air && <def[target-location].add[0,1,0].material> == m@air
{
- teleport <player> l@<context.from.x.div[2]>,<context.from.y>,<context.from.z.div[2]>,heavens
- queue clear
}
- define size 10
- while <def[target-location].find.surface_blocks.within[<def[size]>].size> == 0
{
- define size <def[size].add[10]>
}
- teleport <player> <def[target-location].find.surface_blocks.within[<def[size]>].random>
- determine cancelled
}