core.df module

Code relating to a specific Dwarf Fortress installation.

class core.df.DFInstall(path)[source]

Bases: object

Contains properties and paths for a given Dwarf Fortress installation.

detect_variations()[source]

Detect known variations to allow the launcher to adjust accordingly. Currently supports DFHack, TWBT, and legacy builds.

detect_version()[source]

Attempt to detect Dwarf Fortress version from data/index, release notes or init file contents.

get_archive_name()[source]

Return the filename of the download for this version. Always windows, for comparison of raws in baselines. Prefer small and SDL releases when available.

class core.df.Version(version)[source]

Bases: object

Container for a version number for easy comparisons.

core.df.cycle_option(field)[source]

Cycles an option field between its possible values.

Parameters:

field – the field to cycle.

core.df.do_rawlint(path)[source]

Runs the raw linter on the specified directory.

Returns:

bool – True if all files in the directory passed the linter.

core.df.find_df_folder()[source]

Tries to select a Dwarf Fortress folder. The set of valid folders is first detected. If a folder name is passed as the first argument to the script, that folder will be used. Otherwise, if only one valid folder was detected, that one will be selected.

core.df.find_df_folders()[source]

Locates all suitable Dwarf Fortress installations (folders starting with “Dwarf Fortress” or “df”)

core.df.install_extras()[source]

Installs extra utilities to the Dwarf Fortress folder, if this has not yet been done.

core.df.load_params()[source]

Loads settings from the selected Dwarf Fortress instance.

core.df.perform_checks()[source]

Performs various automated tasks and quits the program. Return code is 0 if all went well.

core.df.restore_defaults()[source]

Copy default settings into the selected Dwarf Fortress instance.

core.df.save_params()[source]

Saves settings to the selected Dwarf Fortress instance.

core.df.set_df_folder(path)[source]

Selects the Dwarf Fortress instance to operate on.

Parameters:

path – The path of the Dwarf Fortress instance to use.

core.df.set_option(field, value)[source]

Sets a field to a specific value.

Parameters:
  • field – the field to set.

  • value – the new value for the field.