Paste #38656: Doublejump

Date: 2017/01/01 18:02:13 UTC-08:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


DoubleJump:
  type: world
  debug: true
  speed: 0
  events:
    on player joins:
    - wait 1t
    - adjust <player> can_fly:true

    on player changes gamemode to creative:
    - wait 1t
    - flag player creative

    on player changes gamemode to survival:
    - wait 1t
    - flag player creative:!

    on player walks:
    - if <player.has_flag[creative]||false> {
      - queue clear
      }
    - if <c.new_location.y.is[LESS].than[<c.old_location.y>]||false> {
      - if <player.has_flag[hasjumped]> {
        - queue clear
        }
    - if <player.location.sub[0,0.1,0].material.is_solid||false> && <player.has_flag[hasjumped]||false> {
      - adjust <player> can_fly:true
      - flag player hasjumped:!
      - queue clear
      }
    - if <c.new_location.y.sub[<c.old_location.y>].is[OR_MORE].than[0.2]> && <c.new_location.y.sub[<c.old_location.y>].is[OR_LESS].than[1.0]> && !<c.new_location.y.sub[<c.old_location.y>].is[==].to[0.5]> {
      - flag player canfly
      - queue clear
      }
    on player starts flying:
    - if <player.has_flag[canfly]||false> {
      - adjust <player> velocity:<player.location.direction.vector.mul[2.0].add[0,1,0]>
      - adjust <player> can_fly:false
      - flag player hasjumped
      - flag player canfly:!
      }
    on player quit:
    - adjust <player> can_fly:true
    - flag player hasjumped:!
    - flag player creative:!
    - flag player canfly:!