diff --git a/docs/changelog.txt b/docs/changelog.txt index 92f023062f..545b0b63a0 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -65,6 +65,7 @@ Template for new versions: - `EventManager`: add safety check to potentially avoid a DFHack crash when DF's ``reports`` table is out of order ## Documentation +- ``dfhack.translation.generateName``: added a table containing explanations and data types for each of the parameters ## API - ``DFSDL``: added ``obtain_library_handle`` and ``obtain_image_library_handle`` so that a plugin can obtain DFHack's already-open handle to these libs instead of having to do it itself. diff --git a/docs/dev/Lua API.rst b/docs/dev/Lua API.rst index f729be2743..4aaa5a6307 100644 --- a/docs/dev/Lua API.rst +++ b/docs/dev/Lua API.rst @@ -1060,7 +1060,64 @@ Translation module * ``dfhack.translation.generateName(name,language,type,major_selector,minor_selector)`` - Dynamically generate a name using the same logic the game itself uses. + Dynamically generate a random name using the same logic the game itself uses. + + **Parameters:** + + .. list-table:: + :class: dfhack-param-table + :header-rows: 1 + :widths: 21 60 19 + + * - Name + - Explanation + - Data Type + * - ``name`` + - | ``name`` property of the object that will have its name generated. This is an output parameter. + | + | Example values: + | ``df.global.world.entities.all[0].name`` + | ``df.unit.find(79).name`` + | ``dfhack.gui.getSelectedUnit().name`` + | ``df.language_name::new()`` + - ``df.language_name`` + * - ``language`` + - | Integer index of the language used for generating the name within ``df.language_translation``. + | + | Example values: + | ``df.global.world.entities.all[0].name.language`` + | ``df.unit.find(79).name.language`` + | ``dfhack.gui.getSelectedUnit().name.language`` + | ``0`` + - ``int`` + * - ``type`` + - | Integer value of the name type. This ensures that the generated name will be appropriate for the given category of object. For allowed values see ``df.language_name_type`` enum. + | + | Example values: + | ``df.global.world.entities.all[100].name.type`` + | ``df.unit.find(79).name.type`` + | ``dfhack.gui.getSelectedUnit().name.type`` + | ``df.language_name_type.Figure`` + | ``13`` + - ``df.language_name_type`` + * - ``major_selector`` + - | Section of the loaded game raws containing words used for generating the name. + | + | Example value for sites belonging to civ with id 100: + | ``df.historical_entity.find(100).entity_raw.symbols.symbols_major[df.entity_name_type.SITE]`` + | + | Example value for units: + | ``df.global.world.raws.language.word_table[0][df.language_name_category.Unit]`` + - ``df.language_word_table`` + * - ``minor_selector`` + - | Section of the loaded game raws containing words used for generating the name. + | + | Example value for sites belonging to civ with id 100: + | ``df.historical_entity.find(100).entity_raw.symbols.symbols_minor[df.entity_name_type.SITE]`` + | + | Example value for units: + | ``df.global.world.raws.language.word_table[1][df.language_name_category.Unit]`` + - ``df.language_word_table`` Gui module ---------- diff --git a/docs/styles/dfhack.css b/docs/styles/dfhack.css index c1a00ed908..a8a1e3237c 100644 --- a/docs/styles/dfhack.css +++ b/docs/styles/dfhack.css @@ -79,3 +79,12 @@ div.dfhack-tool-summary p:last-child, aside.dfhack-tool-summary p:last-child { margin-bottom: 0; } + +table.dfhack-param-table { + table-layout: fixed; + width: 110%; +} + +table.dfhack-param-table span.pre { + white-space: wrap; +}