Paste #62804: Mirror Block Script

Date: 2019/12/16 13:55:00 UTC-08:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


MirrorCommand:
    type: command
    debug: false
    name: mirror
    description: Mirror Blocks
    usage: /mirror (full|half|cancel)
    permission: icecapade.mirror
    permission message: <&3>You need the permission <&b><permission> <&3>to use that command!
    tab complete:
    - if <context.args.size> < 1:
        - determine <list[half|full|cancel]>
    - if <context.args.size> == 1 && "!<context.raw_args.ends_with[ ]>":
        - determine <list[half|full|cancel].filter[starts_with[<context.args.first>]]>
    script:
    - choose <context.args.first||cancel>:
        - case full:
            - flag player mirrorall
            - flag player mirroring
            - narrate "<&3>[Mirror] Left click a block to select a center"
        - case half:
            - flag player mirror
            - flag player mirroring
            - narrate "<&3>[Mirror] Left click a block to select a center"
        - case cancel:
            - flag player mirror:!
            - flag player mirroring:!
            - flag player mirrorall:!
            - if <server.list_notables[locations].parse[notable_name].contains[<player.uuid>_mirror_point]>:
                - note remove as:<player.uuid>_mirror_point
            - narrate "<&3>[Mirror] Mirror disabled"
MirrorWorld:
    type: world
    debug: false
    events:
        on player breaks block flagged:mirroring:
        - determine cancelled
        on player left clicks block flagged:mirroring:
        - wait 1t
        - note <location[<context.location>]> as:<player.uuid>_mirror_point
        - flag player mirroring:!
        - narrate "<&3>[Mirror] Center has been set! You can place blocks now! :)"
        - narrate "<&3>[Mirror] Cancel mirroring with /mirror or /mirror cancel"
        on player places block flagged:mirror:
        - define loc:<location[<player.uuid>_mirror_point]>
        - define maths:<location[<[loc].x>,<context.location.y>,<[loc].z>,<player.location.world>].add[<[loc].x.sub[<context.location.x>]>,0,<[loc].z.sub[<context.location.z>]>]>
        - modifyblock <[maths]> <context.material>
        on player breaks block flagged:mirror:
        - define loc:<location[<player.uuid>_mirror_point]>
        - define maths:<location[<[loc].x>,<context.location.y>,<[loc].z>,<player.location.world>].add[<[loc].x.sub[<context.location.x>]>,0,<[loc].z.sub[<context.location.z>]>]>
        - modifyblock <[maths]> air
        on player places block flagged:mirrorall:
        - define loc:<location[<player.uuid>_mirror_point]>
        - define maths:<location[<[loc].x>,<context.location.y>,<[loc].z>,<player.location.world>].add[<[loc].x.sub[<context.location.x>]>,0,<[loc].z.sub[<context.location.z>]>]>
        - modifyblock <[maths]> <context.material>
        - define mathsone:<location[<[loc].x>,<context.location.y>,<[loc].z>,<player.location.world>].add[<[loc].z.sub[<context.location.z>]>,0,<context.location.x.sub[<[loc].x>]>]>
        - modifyblock <[mathsone]> <context.material>
        - define mathstwo:<location[<[loc].x>,<context.location.y>,<[loc].z>,<player.location.world>].add[<context.location.z.sub[<[loc].z>]>,0,<[loc].x.sub[<context.location.x>]>]>
        - modifyblock <[mathstwo]> <context.material>
        on player breaks block flagged:mirrorall:
        - define loc:<location[<player.uuid>_mirror_point]>
        - define maths:<location[<[loc].x>,<context.location.y>,<[loc].z>,<player.location.world>].add[<[loc].x.sub[<context.location.x>]>,0,<[loc].z.sub[<context.location.z>]>]>
        - modifyblock <[maths]> air
        - define mathsone:<location[<[loc].x>,<context.location.y>,<[loc].z>,<player.location.world>].add[<[loc].z.sub[<context.location.z>]>,0,<context.location.x.sub[<[loc].x>]>]>
        - modifyblock <[mathsone]> air
        - define mathstwo:<location[<[loc].x>,<context.location.y>,<[loc].z>,<player.location.world>].add[<context.location.z.sub[<[loc].z>]>,0,<[loc].x.sub[<context.location.x>]>]>
        - modifyblock <[mathstwo]> air