Paste #135224: Unnamed Denizen Script Paste

Date: 2025/07/29 15:03:27 UTC-07:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


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"