Paste #11852: Double Jumper

Date: 2014/12/05 14:38:28 UTC-08:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


# ---------------------------------------------------------------------------- #
#                                                                              |
#                                                                              |
#                           D o u b l e   J u m p e r                          |
#                                                                              |
#                       Let your players do double jumps                       |
#                                                                              |
#                                                                              |
#   Author: |Anthony|                                                          |
#   Version: 0.1                                                               |
#   dScript Version: 0.9.6-b1545                                               |
#                                                                              |
# ---------------------------------------------------------------------------- #
#                                                                              |
#                                                                              |
# ABOUT:                                                                       |
#                                                                              |
#       Players will be able to do double jumps. You can set a flag to let     |
#     some folks actually fly.                                                 |
#     - flag <player> fly_enabled                                              |
#                                                                              |
#                                                                              |
# ---------------------------------------------------------------------------- #

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

    on player walks:
    - if <c.location.material.name.is[==].to[air]> {
      - narrate "On Air"
      }

    on player jumps:
    - while <player.location.standing_on.material.name.is[==].to[air]||false> {
      - if <player.is_online.not> {
        - while stop
        }
      - wait 1t
      }
    - adjust <player> can_fly:false
    - wait 1t
    - adjust <player> 'fall_distance:<c.location.distance[<player.location>].vertical.as_int>'
    - narrate "fall distance <c.location.distance[<player.location>].vertical>"
    - adjust <player> can_fly:true
#    - adjust <player> can_fly:true
#    - if <player.is_flying.not> {
#      - narrate "no fly"
#      - adjust <player> can_fly:false
#      }
#      else {
#      - narrate "yes fly"
#      }

    on player changes gamemode:
    - wait 1t
    - adjust <player> can_fly:true

    on player starts flying:
    - if <player.has_flag[fly_enabled]||false>
      || <player.gamemode.id.is[==].to[1]> {
      - queue clear
      }
    - wait 5t
    - adjust <player> can_fly:false
    - wait 5t
    - adjust <player> fall_distance:0
    - while <player.location.standing_on.material.name.is[==].to[air]||false> {
      - if <player.is_online.not> {
        - while stop
        }
      - wait 1t
      }
    - adjust <player> can_fly:true