TABLE OF CONTENTS


Ships/Ships [ Packages ]

[ Top ] [ Packages ]

FUNCTION

 Provides code for manipulate ships

SOURCE

package Ships is

Ships/Ships.Crew_Container [ Types ]

[ Top ] [ Ships ] [ Types ]

FUNCTION

 Used to store crew data in ships

SOURCE

   package Crew_Container is new Indefinite_Vectors
     (Index_Type => Positive, Element_Type => Member_Data);

Ships/Ships.Data_Array [ Types ]

[ Top ] [ Ships ] [ Types ]

FUNCTION

 Used to store ship modules data

SOURCE

   type Data_Array is array(1 .. 3) of Integer with
      Default_Component_Value => 0;

Ships/Ships.Module_Type_2 [ Types ]

[ Top ] [ Ships ] [ Types ]

FUNCTION

 Types of ships modules

SOURCE

   type Module_Type_2 is
     (WORKSHOP, ANY, MEDICAL_ROOM, TRAINING_ROOM, ENGINE, CABIN, COCKPIT,
      TURRET, GUN, CARGO_ROOM, HULL, ARMOR, BATTERING_RAM, HARPOON_GUN) with
      Default_Value => ANY;

Ships/Ships.Modules_Container [ Types ]

[ Top ] [ Ships ] [ Types ]

FUNCTION

 Used to store modules data in ships

SOURCE

   package Modules_Container is new Vectors
     (Index_Type => Positive, Element_Type => Module_Data);

Ships/Ships.Proto_Crew_Container [ Types ]

[ Top ] [ Ships ] [ Types ]

FUNCTION

 Used to store crew info in ships prototypes

SOURCE

   package Proto_Crew_Container is new Vectors
     (Index_Type => Positive, Element_Type => Proto_Member_Data);

Ships/Ships.Ship_Combat_Ai [ Types ]

[ Top ] [ Ships ] [ Types ]

FUNCTION

 NPC ships combat AI types

SOURCE

   type Ship_Combat_Ai is (NONE, BERSERKER, ATTACKER, COWARD, DISARMER) with
      Default_Value => NONE;

Ships/Ships.Ship_Speed [ Types ]

[ Top ] [ Ships ] [ Types ]

FUNCTION

 Ship speed states

SOURCE

   type Ship_Speed is
     (DOCKED, FULL_STOP, QUARTER_SPEED, HALF_SPEED, FULL_SPEED) with
      Default_Value => FULL_SPEED;

Ships/Ships.Ship_Upgrade [ Types ]

[ Top ] [ Ships ] [ Types ]

FUNCTION

 Player ship types of module upgrades

SOURCE

   type Ship_Upgrade is (NONE, DURABILITY, MAX_VALUE, VALUE) with
      Default_Value => NONE;

Ships/Ships.Module_Data [ Records ]

[ Top ] [ Ships ] [ Records ]

FUNCTION

 Data structure for ship modules, medical room, cockpit, armor and cargo
 bays don't have any special fields

SOURCE

   type Module_Data(M_Type: Module_Type_2 := Default_Module_Type) is record
      Name: Tiny_String.Bounded_String;
      Proto_Index: Positive;
      Weight: Natural := 0;
      Durability: Integer := 0;
      Max_Durability: Natural := 0;
      Owner: Natural_Container.Vector;
      Upgrade_Progress: Integer := 0;
      Upgrade_Action: Ship_Upgrade;
      case M_Type is
         when ENGINE =>
            Fuel_Usage: Positive := 1;
            Power: Positive := 1;
            Disabled: Boolean;
         when CABIN =>
            Cleanliness: Natural := 0;
            Quality: Natural := 0;
         when TURRET =>
            Gun_Index: Natural := 0;
         when GUN =>
            Damage: Positive := 1;
            Ammo_Index: Inventory_Container.Extended_Index;
         when HULL =>
            Installed_Modules: Natural := 0;
            Max_Modules: Positive := 1;
         when WORKSHOP =>
            Crafting_Index: Tiny_String.Bounded_String;
            Crafting_Time: Natural := 0;
            Crafting_Amount: Natural := 0;
         when MEDICAL_ROOM | COCKPIT | ARMOR | CARGO_ROOM =>
            null;
         when TRAINING_ROOM =>
            Trained_Skill: SkillsData_Container.Extended_Index;
         when BATTERING_RAM =>
            Damage2: Positive := 1;
            Cooling_Down: Boolean;
         when HARPOON_GUN =>
            Duration: Positive := 1;
            Harpoon_Index: Inventory_Container.Extended_Index;
         when ANY =>
            Data: Data_Array;
      end case;
   end record;

PARAMETERS

 M_Type            - The type of the module
 Name              - Name of module
 Proto_Index       - Index of module prototype
 Weight            - Weight of module
 Durability        - 0 = destroyed
 Max_Durability    - Base durability
 Owner             - Crew member indexes for owners of module
 Upgrade_Progress  - Progress of module upgrade
 Upgrade_Action    - Type of module upgrade
 Fuel_Usage        - Amount of fuel used for each move on map
 Power             - Power of engine used for counting ship speed
 Disabled          - Did engine is disabled or not
 Cleanliness       - Cleanliness of selected cabin
 Quality           - Quality of selected cabin
 Gun_Index         - Index of installed gun
 Damage            - Damage bonus for selected gun
 Ammo_Index        - Cargo index of ammunition used by selected gun
 Installed_Modules - Amount of installed modules on ship
 Max_Modules       - Amount of maximum installed modules for this hull
 Crafting_Index    - Index of crafting recipe or item which is
                     deconstructed or studies
 Crafting_Time     - Time needed to finish crating order
 Crafting_Amount   - How many times repeat crafting order
 Trained_Skill     - Index of skill set to training
 Damage2           - Damage done by battering ram
 Cooling_Down      - If true, battering ram can't attack
 Duration          - Duration bonus for selected harpoon gun
 Harpoon_Index     - Cargo index of ammunition used by selected harpoon
                     gun
 Data              - Various data for module (depends on module)

Ships/Ships.Proto_Member_Data [ Records ]

[ Top ] [ Ships ] [ Records ]

FUNCTION

 Data structure for proto crew info

SOURCE

   type Proto_Member_Data is record
      Proto_Index: Proto_Mobs_Amount_Range;
      Min_Amount: Positive := 1;
      Max_Amount: Natural := 0;
   end record;

PARAMETERS

 Proto_Index - Index of proto mob which will be used as crew member
 Min_Amount  - Mininum amount of that mob in crew
 Max_Amount  - Maximum amount of that mob in crew. If 0 then MinAmount
               will be amount

Ships/Ships.Proto_Ship_Data [ Records ]

[ Top ] [ Ships ] [ Records ]

FUNCTION

 Data structure for ship prototypes

SOURCE

   type Proto_Ship_Data is record
      Name: Tiny_String.Bounded_String;
      Modules: Positive_Container.Vector;
      Accuracy: Ship_Bonus_Data;
      Combat_Ai: Ship_Combat_Ai;
      Evasion: Ship_Bonus_Data;
      Loot: Ship_Bonus_Data;
      Perception: Ship_Bonus_Data;
      Cargo: MobInventory_Container.Vector (Capacity => 32);
      Combat_Value: Positive := 1;
      Crew: Proto_Crew_Container.Vector;
      Description: Short_String.Bounded_String;
      Owner: Tiny_String.Bounded_String;
      Known_Recipes: TinyString_Formal_Container.Vector (Capacity => 16);
   end record;

PARAMETERS

 Name          - Prototype name
 Modules       - List of ship modules
 Accuracy      - Bonus to hit for ship
 Combat_Ai     - Behaviour of ship in combat
 Evasion       - Bonus to evade attacks
 Loot          - Amount of loot(moneys) gained for destroying ship
 Perception    - Bonus to spot player ship first
 Cargo         - List of ship cargo
 Combat_Value  - Combat value of ship (used to generate enemies)
 Crew          - List of mobs used as ship crew
 Description   - Description of ship
 Owner         - Index of faction to which ship belong
 Known_Recipes - List of known recipes

Ships/Ships.Ship_Bonus_Data [ Records ]

[ Top ] [ Ships ] [ Records ]

FUNCTION

 Data structure for proto ships bonuses, like accuracy, evasion, etc

SOURCE

   type Ship_Bonus_Data is record
      Min_Value: Natural := 0;
      Max_Value: Natural := 0;
   end record;

PARAMETERS

 Min_Value - Minimum value of bonus
 Max_Value - Maxiumum value of bonus

HISTORY

 7.4 - Added

Ships/Ships.Ship_Record [ Records ]

[ Top ] [ Ships ] [ Records ]

FUNCTION

 Data structure for ships

SOURCE

   type Ship_Record is record
      Name: Tiny_String.Bounded_String;
      Sky_X: Map_X_Range;
      Sky_Y: Map_Y_Range;
      Speed: Ship_Speed;
      Modules: Modules_Container.Vector;
      Cargo: Inventory_Container.Vector (Capacity => 128);
      Crew: Crew_Container.Vector;
      Upgrade_Module: Modules_Container.Extended_Index;
      Destination_X: Natural range 0 .. Map_X_Range'Last;
      Destination_Y: Natural range 0 .. Map_Y_Range'Last;
      Repair_Module: Modules_Container.Extended_Index;
      Description: Short_String.Bounded_String;
      Home_Base: Extended_Base_Range;
   end record;

PARAMETERS

 Name           - Ship name
 Sky_X          - X coordinate on sky map
 SKy_Y          - Y coordinate on sky map
 Speed          - Speed of ship
 Modules        - List of ship modules
 Cargo          - List of ship cargo
 Crew           - List of ship crew
 Upgrade_Module - Number of module to upgrade
 Destination_X  - Destination X coordinate
 Destination_Y  - Destination Y coordinate
 Repair_Module  - Number of module to repair as first
 Description    - Description of ship
 Home_Base      - Index of home base of ship

Ships/Ships.Default_Combat_Ai [ Constants ]

[ Top ] [ Ships ] [ Constants ]

FUNCTION

 Default value for NPC's ships combat behavior

SOURCE

   Default_Combat_Ai: constant Ship_Combat_Ai := NONE;

Ships/Ships.Default_Module [ Constants ]

[ Top ] [ Ships ] [ Constants ]

FUNCTION

 Default empty module without type

SOURCE

   Default_Module: constant Module_Data := (others => <>);

Ships/Ships.Default_Module_Type [ Constants ]

[ Top ] [ Ships ] [ Constants ]

FUNCTION

 Default type of ships modules

SOURCE

   Default_Module_Type: constant Module_Type_2 := ANY;

Ships/Ships.Default_Ship_Speed [ Constants ]

[ Top ] [ Ships ] [ Constants ]

FUNCTION

 Default speed setting for ships

SOURCE

   Default_Ship_Speed: constant Ship_Speed := FULL_SPEED;

Ships/Ships.Default_Ship_Upgrade [ Constants ]

[ Top ] [ Ships ] [ Constants ]

FUNCTION

 Default ship upgrade (no upgrade)

SOURCE

   Default_Ship_Upgrade: constant Ship_Upgrade := NONE;

Ships/Ships.Empty_Data_Array [ Constants ]

[ Top ] [ Ships ] [ Constants ]

FUNCTION

 Empty modules data

SOURCE

   Empty_Data_Array: constant Data_Array := (others => 0);

Ships/Ships.Empty_Proto_Member [ Constants ]

[ Top ] [ Ships ] [ Constants ]

FUNCTION

 Empty record for proto crew info

SOURCE

   Empty_Proto_Member: constant Proto_Member_Data := (others => <>);

Ships/Ships.Empty_Proto_Ship [ Constants ]

[ Top ] [ Ships ] [ Constants ]

FUNCTION

 Empty record for ships prototypes

SOURCE

   Empty_Proto_Ship: constant Proto_Ship_Data := (others => <>);

Ships/Ships.Empty_Ship [ Constants ]

[ Top ] [ Ships ] [ Constants ]

FUNCTION

 Empty record for ship data

SOURCE

   Empty_Ship: constant Ship_Record := (others => <>);

Ships/Ships.No_Ship_Bonus [ Constants ]

[ Top ] [ Ships ] [ Constants ]

FUNCTION

 Default value for ship bonus data without any bonus

SOURCE

   No_Ship_Bonus: constant Ship_Bonus_Data := (others => <>);

Ships/Ships.Player_Ship [ Variables ]

[ Top ] [ Ships ] [ Variables ]

FUNCTION

 The player ship

SOURCE

   Player_Ship: Ship_Record;

Ships/Ships.Generate_Ship_Name [ Subprograms ]

[ Top ] [ Ships ] [ Subprograms ]

FUNCTION

 Generate random name for ship

SOURCE

   function Generate_Ship_Name
     (Owner: Tiny_String.Bounded_String) return Tiny_String.Bounded_String with
      Pre => Tiny_String.Length(Source => Owner) > 0;

PARAMETERS

 Owner - Index of faction to which ship belongs

RESULT

 Random name for a ship

Ships/Ships.Get_Cabin_Quality [ Subprograms ]

[ Top ] [ Ships ] [ Subprograms ]

FUNCTION

 Get description of quality of selected cabin in player ship

SOURCE

   function Get_Cabin_Quality(Quality: Natural) return String with
      Post => Get_Cabin_Quality'Result'Length > 0;

PARAMETERS

 Quality - Numeric value of cabin quality

RESULT

 Description of cabin quality