Date: 2019/05/26 13:59:57 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
Sleeper:
type: assignment
actions:
on assignment:
- define location_name "Home"
- chat "I have saved this location as <def[location_name]>."
- anchor add <npc.location> "id:<def[location_name]>"
on spawn:
- run Sleeper_Task
on sleep check:
- run Sleeper_Task
Sleeper_Task:
type: task
script:
- define time <w@world.time>
- if <def[time]> > 16000 {
- if !<npc.flag[resting]> {
- if !<npc.location.cuboids.is_empty> {
- define inCuboid <npc.location.cuboids.get[1]>
- define bedLoc <def[inCuboid].blocks[white_bed].get[1].center>
# - define bedLoc2 <def[bedLoc1].find.blocks[white_bed].within[1]>
# - define bedLoc <def[bedLoc1].add[<def[bedLoc1].sub[<def[bedLoc2]>].mul[1]>]>
- walk <def[bedLoc]>
- announce <def[bedLoc]>
- while <npc.navigator.is_navigating> {
- wait 5s
}
# - teleport <npc> <def[bedLoc]>
# - wait 1s
# - animate <npc> animation:SLEEP
- lookclose <npc> false
- sit <def[bedLoc].add[0,-0.70,0]>
- look <npc> <def[bedLoc].sub[<def[bedLoc].block_facing>].add[0,1,0]>
- flag <npc> resting:true
}
}
}
else {
- stand
- flag <npc> resting:false
- lookclose <npc> true
# - animate <npc> animation:STOP_SLEEPING
- walk <npc.anchor[<npc.anchor.list.get[1]>]>
}