Paste #67187: SimplerSitScript

Date: 2020/04/08 17:08:47 UTC-07:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


sitting_handler:
    type: world
    debug: false
    events:
      on player right clicks *stairs with air:
      - if <context.location.material.half> == BOTTOM:
        - if !<player.has_flag[sitting]> && !<context.location.add[0,1,0].material.is_solid>:
          - spawn <context.location.add[0.5,-1.2,0.5]> armor_stand[visible=false;collidable=false;gravity=false] save:mount
          - look <entry[mount].saved_entity> <entry[mount].saved_entity.location.sub[<context.location.block_facing.replace_text[l@].replace_text[,world]>].add[0,1.8,0]>
          - flag player sitting
          - mount <player>|<entry[mount].spawned_entity>
          - flag player mount:<player.vehicle>
      on player steers armor_stand:
      - if <context.dismount>:
        - remove <player.flag[mount]>
        - if <player.location.material.is_solid>:
          - teleport <player.location.add[0,2,0]>
        - flag player sitting:!
      on player quits:
      - remove <player.flag[mount]>
      - flag player sitting:!
      on player enters vehicle:
      - remove <player.flag[mount]>
      - flag player sitting:!
      on player teleports:
      - remove <player.flag[mount]>
      - flag player sitting:!
      on player dies:
      - remove <player.flag[mount]>
      - flag player sitting:!
sit_command:
    type: command
    name: sit
    description: Sit down and relax.
    usage: /sit
    tab complete:
    -
    debug: false
    script:
    - if !<player.has_flag[sitting]> && <player.is_on_ground>:
      - spawn <player.location.add[0,-1.7,0]> armor_stand[visible=false;collidable=false;gravity=false] save:mount
      - look <entry[mount].saved_entity> <entry[mount].saved_entity.location.sub[<context.location.block_facing.replace_text[l@].replace_text[,world]>].add[0,1.8,0]>
      - flag player sitting
      - mount <player>|<entry[mount].spawned_entity>
      - flag player mount:<player.vehicle>