text: const Attachment = api.require('Attachment');
  const Tag = api.require('Tag');
  const Transform = api.require('Transform');
  const ParticleEmitter = api.require('ParticleEmitter');
  const Vector3 = api.require('Vector3');
  const OrbitingBehavior = api.require('OrbitingBehavior');
  const BehaviorComponent = api.require('BehaviorComponent');
  const Trail2D = api.require('Trail2D');
  const Mesh = api.require('Mesh');
  const Vector4 = api.require('Vector4');
  
  api.onStopped(() => api.shutdownGracefully());
  
  const socket = this.socket || 'chest';
  const parent = this.parent;
  
  const orbiters = this.orbiters || 1;
  
  const trailWidth = this.trailWidth || 0.1;
  
  const meshScale = this.meshScale || 0.14;
  
  const phaseOffset = api.getParameter('phaseOffset', Math.PI / 4);
  const phaseRange = api.getParameter('phaseRange', Math.PI);
  
  const ringOffset = api.getParameter('ringOffset', Math.PI / 4);
  const ringRange = api.getParameter('ringRange', Math.PI);
  
  const radius = api.getParameter('radius', 0.8);
  
  const rate = api.getParameter('rate', 1);
  
  const orientationX = api.getParameter('orientationX', 0);
  const orientationY = api.getParameter('orientationY', 0);
  const orientationZ = api.getParameter('orientationZ', 1);
  
  const mesh = this.mesh || "data/models/Toon_RTS/Western Kingdoms/gltf/Shield_C_emissive.gltf";
  
  //first we create an anchor
  const attachment = Attachment.fromJSON({
      parent: this.parent,
      socket: socket,
      immediate: true
  });
  
  const anchor = api.createEntity();
  
  anchor
      .add(Tag.fromJSON('Orbiter Anchor'))
      .add(Transform.fromJSON({
          position: new Vector3(10, 1, 10)
      }))
      .add(attachment);
  
  const v = new Vector3();
  
  const angleOffset = Math.random() * Math.PI * 2;
  
  for (let i = 0; i < orbiters; i++) {
  
      const f = (i + 1) / orbiters;
  
      const phase = f * phaseRange + phaseOffset;
  
      const ringAngle = f * ringRange + ringOffset;
  
      const orbitingBehavior = new OrbitingBehavior();
      orbitingBehavior.radius = radius;
      orbitingBehavior.rate = rate;
      orbitingBehavior.parent = anchor.entity;
  
  
      orbitingBehavior.lookRotation._lookRotation(orientationX, orientationY, orientationZ, 0, 1, 0);
  
      v.set(Math.cos(ringAngle), Math.sin(ringAngle), 0);
  
      orbitingBehavior.orientation.lookRotation(Vector3.forward, v);
  
      orbitingBehavior.phase = phase * 2 + angleOffset;
  
      //create actual orbiter
      api.createEntity()
          .add(Mesh.fromJSON({ url: mesh }))
          .add(BehaviorComponent.fromOne(orbitingBehavior))
          .add(Transform.fromJSON({
              scale: new Vector3(meshScale, meshScale, meshScale)
          }))
          .add(Trail2D.fromJSON({
              textureURL: "data/textures/trail/transparent_gradient.png",
              color: new Vector4(0.3803921568627451, 0.8509803921568627, 0.9568627450980393, 0.6),
              maxAge: 1.2,
              width: trailWidth
          }));
  
  }
  