Date: 2025/07/29 15:03:27 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
door_handler:
type: world
debug: false
events:
on player enters cuboid:
- if !<context.area.note_name.starts_with[door_trigger_area]||false>:
- stop
- announce "note name: <context.area.note_name>"
- define door_ent <entity[<context.area.note_name.after[door_trigger_area_]>]||null>
- announce "door_ent: <[door_ent]>"
# If the door is not already open, open it:
- if <[door_ent].flag[door.opened]||false> || <[door_ent]> == null:
- stop
- flag <[door_ent]> door.opened:true
- adjust <[door_ent]> interpolation_duration:<[door_ent].flag[door.speed]>
- adjust <[door_ent]> interpolation_start:3t
- wait 0.1s
- announce "side: <[door_ent].flag[door.side]> width: <[door_ent].flag[door.width]>"
# - adjust <[door_ent]> translation:<location[0,0,0].with_yaw[<[door_ent].flag[door.yaw]>].left[<[door_ent].flag[door.width]>]> if:<[door_ent].flag[door.side].equals[left]>
# - adjust <[door_ent]> translation:<location[0,0,0].with_yaw[<[door_ent].flag[door.yaw]>].right[<[door_ent].flag[door.width]>]> if:<[door_ent].flag[door.side].equals[right]>
# - adjust <[door_ent]> translation:<location[0,0,0].with_yaw[<[door_ent].flag[door.yaw]>].up[<[door_ent].flag[door.height]>]> if:<[door_ent].flag[door.side].equals[up]>
# - adjust <[door_ent]> translation:<location[0,0,0].with_yaw[<[door_ent].flag[door.yaw]>].down[<[door_ent].flag[door.height]>]> if:<[door_ent].flag[door.side].equals[down]>
- adjust <[door_ent]> translation:<location[0,0,0].with_yaw[<[door_ent].location.yaw>].left[<[door_ent].flag[door.width].mul[1.01]>]> if:<[door_ent].flag[door.side].equals[left]>
- adjust <[door_ent]> translation:<location[0,0,0].with_yaw[<[door_ent].location.yaw>].right[<[door_ent].flag[door.width].mul[1.01]>]> if:<[door_ent].flag[door.side].equals[right]>
- adjust <[door_ent]> translation:<location[0,0,0].with_yaw[<[door_ent].location.yaw>].up[<[door_ent].flag[door.height].mul[1.01]>]> if:<[door_ent].flag[door.side].equals[up]>
- adjust <[door_ent]> translation:<location[0,0,0].with_yaw[<[door_ent].location.yaw>].down[<[door_ent].flag[door.height].mul[1.01]>]> if:<[door_ent].flag[door.side].equals[down]>
- wait <[door_ent].flag[door.speed].sub[0.1]>
#- teleport <[door_ent]> <[door_ent].add[<[door_ent].translation>]>
#- adjust <[door_ent]> translation:<location[0,0,0]>
- ~modifyblock <[door_ent].flag[door.barrier_area].blocks[barrier]> air
- announce "finished"
on player exits cuboid:
- if !<context.area.note_name.starts_with[door_trigger_area]||false>:
- stop
- define door_ent <entity[<context.area.note_name.after[door_trigger_area_]>]||null>
- announce "exit door area"
# If the door is not already open, open it:
- if !<[door_ent].flag[door.opened]||true> || <[door_ent]> == null:
- stop
- wait 2t
- if !<context.area.players.is_empty>:
- stop
- flag <[door_ent]> door.opened:false
- adjust <[door_ent]> interpolation_duration:<[door_ent].flag[door.speed]>
- adjust <[door_ent]> interpolation_start:3t
- wait 0.1s
- adjust <[door_ent]> translation:<location[0,0,0]>
- wait <[door_ent].flag[door.speed].sub[0.1]>
- ~modifyblock <[door_ent].flag[door.barrier_area].blocks[air]> barrier
- announce "finished"