Paste #51966: Untitled Paste

Date: 2019/01/30 19:51:03 UTC-08:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


SchematicCreatorHandler:
  type: world
  events:
    on player left clicks with SchematicCreatorIt:
    - flag player SchemPos1:cu@<context.location.simple>
    - narrate "Schematic Position 1 set: <context.location.simple>"
    on player right clicks with SchematicCreatorIt:
    - flag player SchemPos2:<context.location.simple>
    - narrate "Schematic Position 2 set: <context.location.simple>"

SchematicCreatorCmd:
  type: command
  name: schem
  usage: /schem
  description: "Use this command after having selected a schematic. /schem Name:(Name) The schematic will be based on your location when pasted. Add the Overwrite argument to Overwrite an existing schematic. Use ClearSchem to clear the current selection."
  permission: denizen.schematic
  script:
    - if <context.args.contains[GetTools]>:
      - if <player.inventory.contains[i@SchematicCreatorIt]>:
        - narrate "You already have the Schematic tool!"
        - queue clear
      - give player SchematicCreatorIt
      - narrate "Schematic Tool Acquired!"
      - queue clear
    - if <context.args.contains[ClearSchem]>:
      - flag player SchemPos1:!
      - flag player SchemPos2:!
      - narrate "Schematic Position selections removed."
      - queue clear
    - if <context.args.contains[Overwrite]>:
      - if <player.has_flag[SchemPos1].not> || <player.has_flag[SchemPos2].not>:
        - narrate "You must make a selection first with the Selection Tool!"
        - queue clear
      - if <schematic[<context.args.map_get[Name].split_by[<&co>]>].exists.not>:
        - narrate "The Schematic: <context.args.map_get[Name].split_by[<&co>]> does not seem to exist! Did you type the name in correctly?"
        - queue clear
      - schematic create name:<context.args.map_get[Name].split_by[<&co>]> <player.flag[SchemPos1]>|<player.flag[SchemPos2]> <player.location>
      - schematic save name:<context.args.map_get[Name].split_by[<&co>]>
      - narrate "Schematic: <context.args.map_get[Name].split_by[<&co>]> has been overwritten. New Location: <player.flag[SchemPos1]> to <player.flag[SchemPos2]>"
      - queue clear
    - if <schematic[<context.args.map_get[Name].split_by[<&co>]>].exists>:
      - if <player.has_flag[SchemPos1].not> || <player.has_flag[SchemPos2].not>:
        - narrate "You must make a selection first with the Selection Tool!"
        - queue clear
      - narrate "The Schematic: <context.args.map_get[Name].split_by[<&co>]> already exists! If you wish to Overwrite it add the Overwrite argument when using the /schem command!"
      - queue clear
    - else:
      - if <player.has_flag[SchemPos1].not> || <player.has_flag[SchemPos2].not>:
        - narrate "You must make a selection first with the Selection Tool!"
        - queue clear
      - schematic create name:<context.args.map_get[Name].split_by[<&co>]> <player.flag[SchemPos1]>|<player.flag[SchemPos2]> <player.location>
      - schematic save name:<context.args.map_get[Name].split_by[<&co>]>
      - narrate "Schematic Created. Name: <context.args.map_get[Name].split_by[<&co>]> Location: <player.flag[SchemPos1]> to <player.flag[SchemPos2]>"

SchematicPasteCmd:
  type: command
  name: pasteschem
  usage: /pasteschem
  description: "Use this to paste an existing schematic. /pasteschem Name:(Name of Schematic) Add NoAir if you wish to not include Air blocks in your paste. To Specify a Location, add the Location<&co>(x,y,z,map) argument"
  script:
    - schematic load name:<context.args.map_get[Name].split_by[<&co>]>
    - if <schematic[<context.args.map_get[Name].split_by[<&co>]>].exists.not>:
      - narrate "The Schematic: <context.args.map_get[Name].split_by[<&co>]> does not seem to exist! Did you type the name in correctly?"
      - queue clear
    - else:
      - if <context.args.contains[Rotate<&co>]>:
        - schematic rotate name:<context.args.map_get[Name].split_by[<&co>]> angle:<context.args.map_get[Rotate].split_by[<&co>]>
      - if <context.args.contains[Flip<&co>]>:
        - schematic flip_<context.args.map_get[Flip].split_by[<&co>]> name:<context.args.map_get[Name].split_by[<&co>]>
      - if <context.args.contains[Delay<&co>]>:
        - if <context.args.contains[Location<&co>]>:
          - if <context.args.contains[NoAir]>: 
            - schematic paste name:<context.args.map_get[Name].split_by[<&co>]> l@<context.args.map_get[Location].split_by[<&co>]> delay:<context.args.map_get[Delay].split_by[<&co>]> noair
            - schematic unload name:<context.args.map_get[Name].split_by[<&co>]>
            - narrate "Schematic: <context.args.map_get[Name].split_by[<&co>]> Pasted at <context.args.map_get[Location].split_by[<&co>]> with no Air blocks."
            - queue clear
          - else:
            - schematic paste name:<context.args.map_get[Name].split_by[<&co>]> l@<context.args.map_get[Location].split_by[<&co>]> delay:<context.args.map_get[Delay].split_by[<&co>]>
            - schematic unload name:<context.args.map_get[Name].split_by[<&co>]>
            - narrate "Schematic: <context.args.map_get[Name].split_by[<&co>]> Pasted at <player.location.simple>."
        - else:
          - if <context.args.contains[NoAir]>:
            - schematic paste name:<context.args.map_get[Name].split_by[<&co>]> <player.location> delay:<context.args.map_get[Delay].split_by[<&co>]> noair
            - schematic unload name:<context.args.map_get[Name].split_by[<&co>]>
            - narrate "Schematic: <context.args.map_get[Name].split_by[<&co>]> Pasted at <context.args.map_get[Location].split_by[<&co>]> with no Air blocks."
            - queue clear
          - else:
            - schematic paste name:<context.args.map_get[Name].split_by[<&co>]> <player.location> delay:<context.args.map_get[Delay].split_by[<&co>]>
            - schematic unload name:<context.args.map_get[Name].split_by[<&co>]>
            - narrate "Schematic: <context.args.map_get[Name].split_by[<&co>]> Pasted at <player.location.simple>."
      - else: 
        - if <context.args.contains[Location<&co>]>:
          - if <context.args.contains[NoAir]>:
            - schematic paste name:<context.args.map_get[Name].split_by[<&co>]> l@<context.args.map_get[Location].split_by[<&co>]> noair
            - schematic unload name:<context.args.map_get[Name].split_by[<&co>]>
            - narrate "Schematic: <context.args.map_get[Name].split_by[<&co>]> Pasted at <context.args.map_get[Location].split_by[<&co>]> with no Air blocks."
            - queue clear
          - else:
            - schematic paste name:<context.args.map_get[Name].split_by[<&co>]> l@<context.args.map_get[Location].split_by[<&co>]>
            - schematic unload name:<context.args.map_get[Name].split_by[<&co>]>
            - narrate "Schematic: <context.args.map_get[Name].split_by[<&co>]> Pasted at <player.location.simple>."
        - else:
          - if <context.args.contains[NoAir]>:
            - schematic paste name:<context.args.map_get[Name].split_by[<&co>]> <player.location> noair
            - schematic unload name:<context.args.map_get[Name].split_by[<&co>]>
            - narrate "Schematic: <context.args.map_get[Name].split_by[<&co>]> Pasted at <context.args.map_get[Location].split_by[<&co>]> with no Air blocks."
            - queue clear
          - else:
            - schematic paste name:<context.args.map_get[Name].split_by[<&co>]> <player.location> 
            - schematic unload name:<context.args.map_get[Name].split_by[<&co>]>
            - narrate "Schematic: <context.args.map_get[Name].split_by[<&co>]> Pasted at <player.location.simple>."
SchematicCreatorTsk:
  type: task
  definitions: name|location|air|flip|rotate|delay
  script:
    - schematic load name:<def[name]>
    - if <def[flip].is[==].to[no].not>:
      - schematic flip_<def[flip]> name:<def[name]>
    - if <def[rotate].is[==].to[no].not>:
      - schematic rotate name:<def[name]> angle:<def[rotate]>
    - if <def[delay].is[==].to[no].not>:
      - if <def[air]> == no:
        - if <def[location]> == player:
          - schematic paste name:<def[name]> <player.location.simple> delay:<def[delay]> noair
        - else:
          - schematic paste name:<def[name]> l@<def[location]> delay:<def[delay]> noair
      - else:
        - if <def[location]> == player:
          - schematic paste name:<def[name]> <player.location.simple>
        - else:
          - schematic paste name:<def[name]> l@<def[location]>
    - else:
      - if <def[air]> == no:
        - if <def[location]> == player:
          - schematic paste name:<def[name]> <player.location.simple> noair
        - else:
          - schematic paste name:<def[name]> l@<def[location]> noair
      - else:
        - if <def[location]> == player:
          - schematic paste name:<def[name]> <player.location.simple>
        - else:
          - schematic paste name:<def[name]> l@<def[location]>
    - schematic unload name:<def[name]>

SchematicCreatorIt:
  type: item
  display name: Schematic Wand
  material: trident
  lore:
  - "Use this item to select a cuboid as a schematic."
  - "Like using a normal World Edit wand, left click"
  - "for your first position and right click for the second."
  - "This will save the positions in the system until you" 
  - "overwrite it or log out."