Date: 2023/04/13 06:35:06 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
## Expressive Sleep needs to check for nearby beds and place the player's head in the correct location.
ExpressiveSleepCommand:
debug: true
type: command
name: sleep
description: Causes the player to go to sleep.
usage: /sleep
script:
- if !<player.has_flag[ExpressiveSleeping]>:
- narrate "No Flag"
- narrate <player.name>
- define PlayerYaw <player.location.yaw>
- define CalculatedYaw <element[270].sub[<[PlayerYaw]>]>
- define RotatedLocation <player.location.with_yaw[<[CalculatedYaw]>]>
- create player <player.name> <[RotatedLocation]> save:SleepBodyDouble
- define SleepBodyDouble <entry[SleepBodyDouble].created_npc>
- narrate <[SleepBodyDouble]>
- animate <[SleepBodyDouble]> animation:arm_swing
- sleep npc:<[SleepBodyDouble]>
- fakeequip <player> head:air chest:air legs:air boots:air for:<server.online_players>
- invisible <player> state:true
- flag <player> ExpressiveSleepOriginalLocation:<player.location>
- teleport <player> <player.location.sub[<player.location.with_pitch[0].direction.vector.mul[1.6]>].with_y[<player.location.y.sub[0.8]>]>
- animate <player> animation:sit
- flag <player> ExpressiveSleeping
- flag <player> SleepBodyDouble:<[SleepBodyDouble]>
- wait 5t
- teleport <[SleepBodyDouble]> <[SleepBodyDouble].location.rotate_yaw[50]>
- wait 6t
- teleport <[SleepBodyDouble]> <[SleepBodyDouble].location.rotate_yaw[-100]>
- wait 5t
- teleport <[SleepBodyDouble]> <[SleepBodyDouble].location.rotate_yaw[50]>
- run ExpressiveSleepTask def:<[SleepBodyDouble]>|<[CalculatedYaw]>|<[PlayerYaw]>
- clickable save:sleep_broadcast_request_clickable:
- if !<player.has_flag[ExpressiveTimerB]>:
- narrate "<&6><player.name><&f> is requesting that players go to sleep!" targets:<server.online_players>
- flag <player> ExpressiveTimerB expire:60s
- narrate "<&f>Click <&6><element[<&lb>Here<&rb>].on_click[<entry[sleep_broadcast_request_clickable].command>]><&f> to ask others to sleep!"
- stop
- if <player.has_flag[ExpressiveSleeping]>:
- teleport <player> <player.flag[ExpressiveSleepOriginalLocation].with_yaw[<player.location.yaw>].with_pitch[<player.location.pitch>]>
- animate <player> animation:stop_sitting
- invisible <player> state:false
- remove <player.flag[SleepBodyDouble]>
- flag <player> SleepBodyDouble:!
- flag <player> ExpressiveSleeping:!
- flag <player> ExpressiveSleepOriginalLocation:!
# - fakeequip <player> head:air chest:air legs:air boots:air duration:0.1s for:<server.online_players>
# Compatability - Uncomment any commented lines and remove this block to remove compatibility for external mods.
- if !<player.has_flag[hidden_armor_toggle]>:
- fakeequip <player> head:air chest:air legs:air boots:air duration:0.1s for:<server.online_players>
ExpressiveCrawlCommand:
debug: true
type: command
name: crawl
description: Crawl on your stomach.
usage: /crawl
script:
- if !<player.has_flag[ExpressiveCrawl]>:
- narrate "No Flag"
- stop
- if <player.has_flag[ExpressiveCrawl]>:
- narrate "Flag Found"
- stop
ExpressiveSitCommand:
debug: true
type: command
name: sit
description: Sit down somewhere.
usage: /sit
script:
- if !<player.has_flag[ExpressiveSitting]>:
- narrate "No Flag"
- stop
- if <player.has_flag[ExpressiveSitting]>:
- narrate "Flag Found"
- stop
# ExpressiveResetCommand:
# debug: true
# type: command
# name: er
# description: Reset.
# usage: /er
# script:
# - if <player.has_flag[ExpressiveSleeping]>:
# - remove <player.flag[SleepBodyDouble]>
# - flag <player> SleepBodyDouble:!
# - flag <player> ExpressiveSleeping:!
# - flag <player> ExpressiveSleepOriginalLocation:!
# - if <player.has_flag[ExpressiveSitting]>:
# - flag <player> ExpressiveSitting:!
# - if <player.has_flag[ExpressiveCrawling]>:
# - flag <player> ExpressiveCrawling:!
ExpressiveWorld:
type: world
events:
on player starts sneaking:
- if <player.has_flag[ExpressiveTimerA]> && <player.location.pitch.is_less_than_or_equal_to[-89]>:
- execute as_player "sleep"
- flag <player> ExpressiveTimerA:!
- stop
- if <player.has_flag[ExpressiveTimerA]> && <player.location.pitch.is_more_than_or_equal_to[89]>:
- execute as_player "crawl"
- flag <player> ExpressiveTimerA:!
- stop
- flag <player> ExpressiveTimerA expire:8t
on player breaks block flagged:ExpressiveSleeping:
- determine cancelled
on player starts sneaking flagged:ExpressiveSleeping:
- execute as_player "sleep"
- determine cancelled
on player right clicks *_stairs:
- execute as_player "sit"
- determine cancelled
ExpressiveSleepTask:
type: task
script:
- define BodyDouble <[1]>
- define SafeYaw <[2]>
- define StartYaw <[3].add[360].mod[360]>
- while <player.has_flag[ExpressiveSleeping]>:
- wait 2t
- define difference <[StartYaw].sub[<player.location.yaw.add[360].mod[360]>]>
- if <[difference]> > 180:
- define difference <[difference].sub[360]>
- if <[difference]> < -180:
- define difference <[difference].add[360]>
- if <[SafeYaw].sub[<[difference]>]> >= <[SafeYaw].sub[50]> && <[SafeYaw].sub[<[difference]>]> <= <[SafeYaw].add[50]> && <[BodyDouble].location.exists>:
- teleport <[BodyDouble]> <[BodyDouble].location.with_pitch[<player.location.pitch.add[30]>].with_yaw[<[SafeYaw].sub[<[difference]>]>]>
# - else:
# - teleport <[BodyDouble]> <[BodyDouble].location.with_pitch[<player.location.pitch.add[0]>]>
ExpressiveCrawlTask:
type: task
script:
- while <player.has_flag[ExpressiveCrawling]>:
- ratelimit <player> 2t
- if <player.location.add[0,1,0].find_blocks.within[0.01].contains[air]>:
- narrate X
# NPC Tests:
# Yaw 0 = Body Facing East (Positive X)
# Yaw 90 = Body Facing North (Negative Z)
# Yaw 180 = Body Facing West (Negative X)
# Yaw -90 = Body Facing South (Positive Z)
# Yaw 0 = Body Facing East (Positive X)
# Yaw -90 = Body Facing South (Positive Z)
# Yaw -180 = Body Facing West (Negative X)
# Body Points to Yaw -45 if Player yaw is 135 ( Correct )
# Body Points to yaw -60 if player yaw is 150 ( Incorrect, Rotated Counter Clockwise by 15 degrees instead of Clockwise)