Mighty Lasers

Mighty Lasers

Mighty lasers is the package that brings lasers and laser signal logic to Crayta.

The Demo: v6yp4kah

Right now its mainly going to be useful for puzzle games or obstacle courses, but at the same time it provides a solid foundation for laser-related packages with more exciting use cases like:

  • Automated laser turrets.
  • Gun laser sight
  • Laser guns
  • Lightsabers

Laser Emitter

This entity emits the laser signal in the forward direction.

Properties:
  • isActive: Activates the laser on init
  • maxReflections: Maximum number of times the laser beam could be reflected
  • color: The color of the laser beam and the signal it emits
  • damagePerTick: The amount of damage that laser applies to the players and other entities per tick
  • ignoredEntities: The list of entities that should be ignored by the laser beam
Public Interface:
  • Start(): Start laser signal
  • Stop(): Stop laser signal
  • Toggle(): Switch laser signal on/off
  • SetColor(color): Change the color of the laser and the signal
  • SetOwner(user): Set the owner of the laser for damage inflictor assignment (In case you need to keep track of kills)

Notes:

  • Make sure that list of ignored entities includes all the parent and laser surrounding entities to avoid laser beam hitting them.

Laser Mirror:

This entity reflects the laser signal in appropriate direction.

Notes:

  • It doesn’t really work with the voxelMesh entities. Refer to LaserMirrorExample template to learn how to combine voxelMesh and Mesh to achieve decent results.

Laser Receiver

This entity is capable of receiving laser signals and fire the events accordingly.

Properties:
  • filterSignal: When set to false the receiver will accept any incoming laser signal
  • colorFilter: The only color that will be accepted by the receiver
  • onLaserEnter: Called every time new laser beam hits the receiver
  • onLaserLeave: Called every time laser beam leaves the receiver
  • onLaserSignal: Called only when valid signal hits the receiver
  • onLaserSignalLost: Called only when there is no more valid signals hitting the receiver

Laser Combinator

This entity is capable of receiving, combining/mixing laser signals together and emitting the result laser signal.

Properties:
  • emitter: The emitter entity (laser output) attached to the combinator

Notes:

  • Make sure that list of ignored entities on the emitter includes the combinator to avoid the result laser hitting it