1. private with Ada.Strings.Unbounded; 
  2.  
  3. package Tools.Entity_Spawners is 
  4.  
  5.     type Entity_Spawner is new Tool with private; 
  6.     type A_Entity_Spawner is access all Entity_Spawner'Class; 
  7.  
  8.     -- Creates a new entity of class 'id'. If 'snap' is True, the new entity 
  9.     -- will be snapped to the grid based if the gridsnap preference is enabled 
  10.     -- and holding ctrl while using the spawner tool will reverse the gridsnap 
  11.     -- behavior. If 'snap' is False, no grid snapping will ever be performed. 
  12.     function Create_Entity_Spawner( id : String; snap : Boolean := True ) return A_Tool; 
  13.     pragma Precondition( id'Length > 0 ); 
  14.     pragma Postcondition( Create_Entity_Spawner'Result /= null ); 
  15.  
  16.     function Get_ID( this : not null access Entity_Spawner'Class ) return String; 
  17.     pragma Postcondition( Get_ID'Result'Length > 0 ); 
  18.  
  19.     -- Returns True if the class id that this spawner will spawn is within 
  20.     -- the parent class specified by 'pattern' (case insensitive). For example, 
  21.     -- to check if the spawner's class id "Entities.Enemies.Cat" is an enemy, 
  22.     -- use class pattern "Entities.Enemies.*", which will match all registered 
  23.     -- enemy entity classes. A constant for matching enemy classes is specified 
  24.     -- in the Entities.Enemies package. 
  25.     function In_Class( this    : not null access Entity_Spawner'Class; 
  26.                        pattern : String ) return Boolean; 
  27.  
  28. private 
  29.  
  30.     use Ada.Strings.Unbounded; 
  31.  
  32.     type Entity_Spawner is new Tool with 
  33.         record 
  34.             id   : Unbounded_String; 
  35.             snap : Boolean := False;    -- allow grid snapping? 
  36.         end record; 
  37.  
  38.     procedure Apply( this      : access Entity_Spawner; 
  39.                      func      : Function_Type; 
  40.                      modifiers : Modifiers_Array; 
  41.                      first     : Boolean; 
  42.                      world     : not null A_World; 
  43.                      worldX, 
  44.                      worldY, 
  45.                      layer     : Integer ); 
  46.  
  47.     procedure Construct( this : access Entity_Spawner; 
  48.                          id   : String; 
  49.                          snap : Boolean ); 
  50.     pragma Precondition( id'Length > 0 ); 
  51.  
  52. end Tools.Entity_Spawners;