Paste #53465: Untitled Paste

Date: 2019/03/27 11:52:26 UTC-07:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


mountsHandler:
    type: world
    debug: false
    events:
        on player right clicks custom_mount_1:
            - if !<context.entity.flag[Mount.isRidden]||false>
                - flag <context.entity> Mount.isRidden
                - flag <context.entity> Mount.Owner:<player>
                - adjust <context.entity> owner:<player>
                - adjust <context.entity> has_ai:false
                - mount <player>|<context.entity> <context.entity.location>

            - if <context.entity.flag[Mount.Owner]> == <player>
                - mount <player>|<context.entity> <context.entity.location>
            - else
                - narrate "<&c><&l>(!) <&7>Sorry but this mount is not yours."

        on player steers custom_mount_1:
            - flag player Mount.TickCooldown:0
            - flag player Mount.wantsJump:false

            - if <context.jump>
                - flag player Mount.wantsJump:true

            - if <player.flag[Mount.TickCooldown]> == 0
                - flag player Mount.Forward:+:<context.forward>
                - narrate "<context.forward>"
                - flag player Mount.Sideways:+:<context.sideways>
                - narrate "<context.sideways>"

            - flag player Mount.TickCooldown:3

            - define dividing <tern[<context.entity.is_on_ground>]:8||64>

            - if <context.dismount>
                - define dividing <def[dividing].div[10]>
                - mount cancel
                - queue clear

            - define sideways <context.sideways.add[<player.flag[Mount.Sideways]>].div[<def[dividing]>]>
            - define forward <context.forward.add[<player.flag[Mount.Forward]>].div[<def[dividing]>]>
            - define looks <player.location.direction.vector.sub[0,<player.location.direction.vector.y>,0]>
            - define velocity <def[looks].mul[<def[forward]>].add[<def[looks].rotate_around_y[<el@90.to_radians>].mul[<def[sideways]>]>]>

            - flag player Mount.Sideways:0
            - flag player Mount.Forward:0

            - if <player.flag[Mount.wantsJump]||false>
                - if <context.entity.is_on_ground>
                    - narrate "Jump"
                    - define velocity <def[velocity].add[0,0.5,0]>



            - define length <def[velocity].vector_length>
            - if <def[length]> > 0.01
                - look <context.entity> <context.entity.location.add[<def[velocity]>]>
                - adjust <context.entity> velocity:<context.entity.velocity.add[<def[length]>]>

custom_mount_1:
    type: entity
    entity_type: POLAR_BEAR
    has_ai: true
    age: adult
    can_pickup_items: false
    speed: 1.1
    invulnerable: false
    custom_name: <&5><&l>Test Mount

mountSpawn:
    type: command
    name: spawn_mount
    usage: /spawn_mount
    script:
    - spawn custom_mount_1 <player.location>