Skip to content
biqqles edited this page Jun 26, 2020 · 1 revision

Welcome to the documentation for flint.

The API is unstable until v1.0, so minor details may change.

Interactive shell

flint incorporates an interactive mode that can be used for testing or exploration. It provides a Python interpreter where flint is imported as fl and ready to use. To use it, run python -m flint <path_to_freelancer>. This mode will be used in the following examples.

Initialisation

Before doing anything you will want to set the path to the Freelancer directory to be inspected. This is accomplished with flint.set_install_path() or automatically with the interactive shell as shown above.

Core functions

flint defines several "core functions":

Name Type Notes
flint.get_bases() EntitySet[Base] All bases defined in the game files
flint.get_systems() EntitySet[System] All systems defined in the game files
flint.get_ships() EntitySet[Ship] All ships defined in the game files
flint.get_factions() EntitySet[Faction] All factions defined in the game files
flint.get_equipment() EntitySet[Equipment] All equipment defined in the game files
flint.get_commodities() EntitySet[Commodity] All commodities defined in the game files
flint.get_goods() EntitySet[Good] All goods defined in the game files

(If you are on Python 3.7 or above, these have handy shorthands of the form flint.bases, flint.systems, flint.commodities etc.)

These functions all return instances of the EntitySet type. This is a container which, as the name suggests, represents a set of entities, represented by the Entity type.

An Entity represents a unique entity in Freelancer, distinguished by a unique nickname. Entities are constructed from the game's INI files and contain methods to calculate derived attributes. For example:

(flint as fl) >>> fl.get_systems()
{'li01': System(nickname='li01', ids_name=196609, ids_info=66106, file='systems\\li01\\li01.ini', navmapscale=1.0),
 'li02': System(nickname='li02', ids_name=196610, ids_info=66084, file='systems\\li02\\li02.ini', navmapscale=1.0),
 'li03': System(nickname='li03', ids_name=196611, ids_info=66087, file='systems\\li03\\li03.ini', navmapscale=1.0),
 ...
}
(flint as fl) >>> [s.name() for s in fl.get_systems()]
['New York', 'California', 'Colorado', 'Texas', 'Alaska', 'New London', ...]

Entity types are described in detail in the next section.

Clone this wiki locally