Name: 
  RomfarerHSTWlaser.dll, Laser Plugin for KSP.

Description:
  A deadly solid-state laser. 
  Rotate a turret with <Numpad 8, 4, 5, 6> (Numlock must be ON!) keys, 
  toggle targeting beam with <Numpad 9>, cycle nearest targets with 
  <Numpad 7>, and fire with <0>! 
  Targeting range is 50 Km, firing range is 2 Km. 
  Warning: it overheats. 
  Requires RomfarerHSTWlaser.dll plugin. 

How to use with Lazor System:

When a Lazor System main module is present on the same vessel, All Sunbeam keyboard control will be disabled and the laser will automatically aim according the to the main lazor. Sunbeam will appear in the Modules tab. From here you can activate "Toggle MouseLook" which lets you aim sunbeam with the mouse, and fire it with mouse left click.


Version: 
  2.1

Author: 
  Tony Chernogovsky, SPb, Russia. mailto: tosh@bk.ru?subject=Laser

Maintainer:
  Jim-Kyrre Benjaminsen AKA Romfarer

Special Thanks:
  - Yoric, for an example of working with KSP's paricle effects (see 
    Void Bukerneering Particle cannon plugin).

License: 
  BY-SA, Attribution & Share-alike Creative Common Licence. Feel free 
  to modify as long as a) original author is mentioned, and b) you 
  distribute your code under the same license.

  Software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 
  CONDITIONS OF ANY KIND, either express or implied.


Building: 
  Compile with csc.exe (Microsoft.NET Framework C# compiler), link
  with UnityEngine.dll and Assembly-CSharp.dll libraries located
  in KSP_Data\Managed\ folder. I.e. execute somethuing like

  csc /r:UnityEngine.dll /r:Assembly-CSharp.dll /t:library 
  /out:hstwLaser.dll Laser.cs LaserUtils.cs TextureUtils.cs 
  FireSmoke.cs ProceduralRay.cs NearestVessels.cs SmoothControl.cs 
  PidController.cs 

  at the command prompt, then put resulting HSTWLASER.DLL file into 
  KSP\Plugins\ folder.

Demonstrates:
  - Accessing part's objects hierarchy.
  - Moving and rotating objects at run-time.
  - Handling keyboard input.
  - Creating procedural meshes and textures.
  - Controlling built-in KPS particle effects.
  - Using standard Unity shaders and light sources.
  - Implementing automatic targeting system with PID controllers.
  - Using Unity Physics class to detect target hits.
  - Iterating through vessels and their parts -- and exploding them
    manually.
  - Accessing Part.cfg values.

Issues:
 - Despite the beam is 5 Km long it can hit targets at no more than 2 Km. 
   Targets at greater distances are most likely 'on-rails', i.e. their 
   models are not even loaded into the game.
 - Sometimes laser beam ends not reaching the target. This happens when 
   target's _collider_ (physical model) does not coincide with its 
   visible model.
 - Somitimes ray appears clipped in mid-air when rotating a camera. It 
   looks like there's something weird with Unity transparent shaders and 
   camera clipping planes. When I tested 'solid' (opaque) rays they never 
   were clipped.
 - Laser picks a target by its _name_ when game loads. If there are  
   several vessels in range with _the same_ name then laser picks an 
   arbitrary one.
 - Group control is not implemented. If you have several lasers on your 
   vessel then each of them rotates on its own in response to manual 
   controls. Though in auto-lock mode they will try to lock on _the same_ 
   target.

ChangeLog:
  - Version 2.1:
    * New laser beams with gradient effects. Beam details level may be 
      adjusted in PART.CFG: 0 -- less details, high performance, 1 --
      more details, low performance. See LaserUtils.cs for an 
      implementation.
    * Fixed GUI mark drawing; no longer causes NullRefException in the
      VAB.
    * Added try..catch statement to NearestVessels.List to get rid of 
      NullRefException after part explosion :(.
    * Fixed some weirdness with smoke particles behavior.   
    * Initial turret orientation now depends on _model_ orientation. I.e.
      if you rotate a turret to the right in Blender then game starts 
      with turrets rotated to the right.
    * Explained a difference between emitting particles in atmosphere 
      and in vacuum. See comments in the Laser.cs.

  - Version 2.0:
    * First plugin release: now lasers are _actually_ working. Manual 
      and automatic turret control, toggleable targeting beam, fire and 
      smoke effects and stuff.
 
  - Version 1.0, 1.1:
    * First release. Static models, primitive ray effects, no impact on 
      target.