Date: 2018/06/28 17:06:15 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
"Heavens Portal 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 xaxis-pos 1,0,0
- define xaxis-neg -1,0,0
- define axis 1
}
elseif <context.location.add[1,0,0].material> == m@quartz_block && <context.location.add[-1,0,0].material> == m@quartz_block
{
- define xaxis-pos 0,0,1
- define xaxis-neg 0,0,-1
- define axis 2
}
else
{
- queue clear
}
- define origin <context.location.add[0,1,0]>
- define node <def[origin]>
- define air-list li@
- define y-list li@
- 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 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]>]>
- define node <def[node].add[<def[xaxis-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]>]>
- define node <def[node].add[<def[xaxis-neg]>]>
}
- if <def[node].material> !== m@quartz_block
{
- queue clear
}
}
}
- modifyblock <def[air-list]> m@portal,<def[axis]> no_physics
- note cu@<def[air-list]> as:heavens-portal-<util.random.duuid>
on player breaks portal:
- if <context.location.cuboids.contains_text[heavens-portal]>
{
- define cu-remove <context.location.cuboids.filter[starts_with[heavens-portal]]>
- note remove <def[cu-remove]>
}
on player breaks quartz_block:
- if <context.location.find.blocks[portal].within[2].cuboids.filter[starts_with[heavens-portal]]>
on player uses portal in prosperus:
- if <context.from.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
- teleport <player> l@<context.from.x.div[2]>,<context.from.y>,<context.from.z.div[2]>,heavens
- determine cancelled
}
on portal created:
- announce to_console "Portal created for ON PORTAL CREATED, blocks are <context.blocks>"
on entity creates portal:
- announce to_console "Portal created for ON ENTITY CREATES PORTAL, type is <context.portal_type>"