Paste #39157: Rotating Hologram

Date: 2017/01/19 13:12:40 UTC-08:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


on holo command:
  - determine passively fulfilled

  # LOADS AND INITIAL DEFS
  - define schem <context.args.get[1]>
  - schematic load name:<def[schem]>
  - define width <schematic[<def[schem]>].width>
  - define height <schematic[<def[schem]>].height>
  - define length <schematic[<def[schem]>].length>
  - define origin <player.eye_location.add[<player.location.direction.vector.mul[<def[width].max[<def[height]>].max[<def[length]>]>]>]>

  # SPAWNS
  - define entities li@
  - repeat <def[width]> {
    - define x <def[value].sub[1]>
    - repeat <def[height]> {
      - define y <def[value].sub[1]>
      - repeat <def[length]> {
        - define z <def[value].sub[1]>
        - define mat <schematic[<def[schem]>].block[<def[x]>,<def[y]>,<def[z]>]>
        - define around li@<schematic[<def[schem]>].block[<def[x].add[1]>,<def[y]>,<def[z]>]||m@air>|<schematic[<def[schem]>].block[<def[x].sub[1]>,<def[y]>,<def[z]>]||m@air>|<schematic[<def[schem]>].block[<def[x]>,<def[y].add[1]>,<def[z]>]||m@air>|<schematic[<def[schem]>].block[<def[x]>,<def[y].sub[1]>,<def[z]>]||m@air>|<schematic[<def[schem]>].block[<def[x]>,<def[y]>,<def[z].add[1]>]||m@air>|<schematic[<def[schem]>].block[<def[x]>,<def[y]>,<def[z].sub[1]>]||m@air>
        - if <def[mat].is[!=].to[m@air].and[<def[around].contains_any[m@air]>]> {
          - spawn armor_stand[visible=false;gravity=false;equipment=air|air|air|<def[mat].after[m@]>] <def[origin].add[<def[x].sub[<def[width].sub[1].mul[0.5]>].mul[0.625]>,<def[y].mul[0.625].sub[2]>,<def[z].sub[<def[length].sub[1].mul[0.5]>].mul[0.625]>].with_pose[0,0]> save:holo
          - define entities <def[entities].include[<entry[holo].spawned_entities>]>
        }
      }
    }
  }
  - narrate "<def[entities].size> entities spawned"

  # ROTATES 360 - Probably not needed, and very heavy resource-wise.
  - wait 2s
  - repeat 36 {
    - foreach <def[entities]> {
      - define vector <def[value].location.sub[<def[origin]>]>
      - teleport <def[value]> <def[origin].add[<def[vector].rotate_around_y[<el@-10.to_radians>]>].with_pose[0,<def[value].location.yaw.add[10]>]>
    }
    - wait 1t
  }

  # DESPAWNS AND UNLOADS
  - wait 5s
  - schematic unload name:<def[schem]>
  - remove <def[entities]>