Skip to content

Commit

Permalink
doc: Add 'versionstr' field to modpack info format.
Browse files Browse the repository at this point in the history
Helps distinguishing between openage modpack versions and the versions of converted/external mods.
  • Loading branch information
heinezen committed Aug 2, 2023
1 parent 1e0a93e commit 96850a6
Show file tree
Hide file tree
Showing 9 changed files with 69 additions and 57 deletions.
101 changes: 51 additions & 50 deletions doc/media/openage/modpack_definition_file.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Modpack Definition File

**Format Version:** 1
**Format Version:** 2

The modpack definition file is the header file for [modpacks](modpacks.md).

Expand All @@ -22,54 +22,55 @@ find this specification document.

The following parameters have to be specified.

Parameter | Data Type | Optional | Description
---------------------|-----------|----------|------------
`file_version` | String | No | Version of the modpack definition file format.
| Parameter | Data Type | Optional | Description |
| -------------- | --------- | -------- | ---------------------------------------------- |
| `file_version` | String | No | Version of the modpack definition file format. |


## [info] Section

`[info]` contains general information about the modpack.

Parameter | Data Type | Optional | Description
-------------------|---------------|----------|------------
`packagename` | String | No | Name of the modpack.
`version` | String | No | Version number.
`repo` | String | Yes | Name of the repo where the package is hosted.
`alias` | String | Yes | Alias of the modpack. Aliases can be used for replacing other modpacks.
`title` | String | Yes | Title used in UI.
`description` | String | Yes | Path to a file with a short description (max 500 chars).
`long_description` | String | Yes | Path to a file with a detailed description.
`url` | String | Yes | Link to the modpack's website.
`license` | Array[String] | Yes | License(s) of the modpack.
| Parameter | Data Type | Optional | Description |
| ------------------ | ------------- | -------- | ------------------------------------------------------------------------ |
| `packagename` | String | No | Name of the modpack. |
| `version` | String | No | Internal version number. Must have [semver](https://semver.org/) format. |
| `versionstr` | String | Yes | Human-readable version string. |
| `repo` | String | Yes | Name of the repo where the package is hosted. |
| `alias` | String | Yes | Alias of the modpack. Aliases can be used for replacing other modpacks. |
| `title` | String | Yes | Title used in UI. |
| `description` | String | Yes | Path to a file with a short description (max 500 chars). |
| `long_description` | String | Yes | Path to a file with a detailed description. |
| `url` | String | Yes | Link to the modpack's website. |
| `license` | Array[String] | Yes | License(s) of the modpack. |


## [assets] Section

`[assets]` contains paths to assets in the modpack.

Parameter | Data Type | Optional | Description
---------------|----------------|----------|------------
`include` | Array[String] | No | List of paths to assets that should be mounted on load time. Paths are allowed to contain wildcards.
`exclude` | Array[String] | Yes | List of paths to assets that should be excluded from mounting. Paths are allowed to contain wildcards.
| Parameter | Data Type | Optional | Description |
| --------- | ------------- | -------- | ------------------------------------------------------------------------------------------------------ |
| `include` | Array[String] | No | List of paths to assets that should be mounted on load time. Paths are allowed to contain wildcards. |
| `exclude` | Array[String] | Yes | List of paths to assets that should be excluded from mounting. Paths are allowed to contain wildcards. |


## [dependency] Section

`[dependency]` contains a list of other modpacks that the modpack depends on.

Parameter | Data Type | Optional | Description
---------------|----------------|----------|------------
`modpacks` | Array[String] | Yes | List of modpack aliases or identifiers.
| Parameter | Data Type | Optional | Description |
| ---------- | ------------- | -------- | --------------------------------------- |
| `modpacks` | Array[String] | Yes | List of modpack aliases or identifiers. |


## [conflict] Section

`[conflict]` contains a list of other modpacks that the modpack conflicts with.

Parameter | Data Type | Optional | Description
---------------|----------------|----------|------------
`modpacks` | Array[String] | Yes | List of modpack aliases or identifiers.
| Parameter | Data Type | Optional | Description |
| ---------- | ------------- | -------- | --------------------------------------- |
| `modpacks` | Array[String] | Yes | List of modpack aliases or identifiers. |


## [authors] Section
Expand All @@ -78,29 +79,29 @@ Parameter | Data Type | Optional | Description
Every author must have their own subtable `[authors.{authorname}]`. The
subtable can set the following parameters.

Parameter | Data Type | Optional | Description
-----------|---------------|----------|------------
`name` | String | No | Nickname of the author. Must be unique for the modpack.
`fullname` | String | Yes | Full name of the author.
`since` | String | Yes | Version number of the release where the author started to contribute.
`until` | String | Yes | Version number of the release where the author stopped to contribute.
`roles` | Array[String] | Yes | List of roles of the author during the creation of the modpack.
`contact` | Table | Yes | Contact information (see below).
| Parameter | Data Type | Optional | Description |
| ---------- | ------------- | -------- | --------------------------------------------------------------------- |
| `name` | String | No | Nickname of the author. Must be unique for the modpack. |
| `fullname` | String | Yes | Full name of the author. |
| `since` | String | Yes | Version number of the release where the author started to contribute. |
| `until` | String | Yes | Version number of the release where the author stopped to contribute. |
| `roles` | Array[String] | Yes | List of roles of the author during the creation of the modpack. |
| `contact` | Table | Yes | Contact information (see below). |

The contact table can use the following parameters.

Parameter | Data Type | Optional | Description
-----------|---------------|----------|------------
`discord` | String | Yes | Discord username.
`email` | String | Yes | Email address.
`github` | String | Yes | GitHub username.
`gitlab` | String | Yes | Gitlab username.
`irc` | String | Yes | IRC username.
`mastodon` | String | Yes | Mastodon username.
`matrix` | String | Yes | Matrix username.
`reddit` | String | Yes | Reddit username.
`twitter` | String | Yes | Twitter username.
`youtube` | String | Yes | YouTube username.
| Parameter | Data Type | Optional | Description |
| ---------- | --------- | -------- | ------------------ |
| `discord` | String | Yes | Discord username. |
| `email` | String | Yes | Email address. |
| `github` | String | Yes | GitHub username. |
| `gitlab` | String | Yes | Gitlab username. |
| `irc` | String | Yes | IRC username. |
| `mastodon` | String | Yes | Mastodon username. |
| `matrix` | String | Yes | Matrix username. |
| `reddit` | String | Yes | Reddit username. |
| `twitter` | String | Yes | Twitter username. |
| `youtube` | String | Yes | YouTube username. |


## [authorgroups] Section
Expand All @@ -110,8 +111,8 @@ It can be used in addition to `[authors]` to signify that the modpack is
a team effort.


Parameter | Data Type | Optional | Description
--------------|---------------|----------|------------
`name` | String | No | Group or team name.
`authors` | Array[String] | No | List of author identifiers. These must match up with subtable keys in the `[authors]` section, e.g. `"xxbunny123"` references `[authors.xxbunny123]`.
`description` | String | Yes | Path to a file with a description of the team.
| Parameter | Data Type | Optional | Description |
| ------------- | ------------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
| `name` | String | No | Group or team name. |
| `authors` | Array[String] | No | List of author identifiers. These must match up with subtable keys in the `[authors]` section, e.g. `"xxbunny123"` references `[authors.xxbunny123]`. |
| `description` | String | Yes | Path to a file with a description of the team. |
3 changes: 3 additions & 0 deletions libopenage/assets/modpack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ ModpackInfo parse_modepack_def(const util::Path &info_file) {
}

// optionals
if (info.contains("versionstr")) {
def.versionstr = info.at("versionstr").as_string();
}
if (info.contains("repo")) {
def.repo = info.at("repo").as_string();
}
Expand Down
1 change: 1 addition & 0 deletions libopenage/assets/modpack.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ struct ModpackInfo {
// see /doc/media/openage/modpack_definition_file.md
std::string id;
std::string version;
std::string versionstr;
std::string repo;
std::string alias;
std::string title;
Expand Down
11 changes: 9 additions & 2 deletions openage/convert/entity_object/export/formats/modpack_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from ..data_definition import DataDefinition


FILE_VERSION = "1"
FILE_VERSION = "2"


class ModpackInfo(DataDefinition):
Expand All @@ -25,6 +25,7 @@ def __init__(self, targetdir: str, filename: str):
# Info
self.packagename: str = None
self.version: str = None
self.versionstr: str = None
self.extra_info: dict[str, str] = {}

# Assets
Expand Down Expand Up @@ -153,6 +154,7 @@ def set_info(
self,
packagename: str,
version: str,
versionstr: str = None,
repo: str = None,
alias: str = None,
title: str = None,
Expand All @@ -166,8 +168,10 @@ def set_info(
:param packagename: Name of the modpack.
:type packagename: str
:param version: Version number.
:param version: Internal version number. Must have semver format.
:type version: str
:param versionstr: Human-readable version number.
:type versionstr: str
:param repo: Name of the repo where the package is hosted.
:type repo: str
:param alias: Alias of the modpack.
Expand All @@ -186,6 +190,9 @@ def set_info(
self.packagename = packagename
self.version = version

if versionstr:
self.extra_info["versionstr"] = versionstr

if repo:
self.extra_info["repo"] = repo

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def _get_aoe2_base(cls, full_data_set: GenieObjectContainer) -> Modpack:

mod_def = modpack.get_info()

mod_def.set_info("aoe2_base", "1.0c", repo="openage")
mod_def.set_info("aoe2_base", "0.5", versionstr="1.0c", repo="openage")

mod_def.add_include("data/**")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def _get_aoe2_base(cls, full_data_set: GenieObjectContainer) -> Modpack:

mod_def = modpack.get_info()

mod_def.set_info("de2_base", "1.0c", repo="openage")
mod_def.set_info("de2_base", "0.5", versionstr="1.0c", repo="openage")

mod_def.add_include("data/**")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def _get_aoe2_base(cls, full_data_set: GenieObjectContainer) -> Modpack:

mod_def = modpack.get_info()

mod_def.set_info("hd_base", "5.8", repo="openage")
mod_def.set_info("hd_base", "0.5", versionstr="5.8", repo="openage")

mod_def.add_include("data/**")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def _get_aoe1_base(cls, full_data_set: GenieObjectContainer) -> Modpack:

mod_def = modpack.get_info()

mod_def.set_info("aoe1_base", "1.0a", repo="openage")
mod_def.set_info("aoe1_base", "0.5", versionstr="1.0a", repo="openage")

mod_def.add_include("data/**")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def _get_swgb_base(cls, full_data_set: GenieObjectContainer) -> Modpack:

mod_def = modpack.get_info()

mod_def.set_info("swgb_base", "1.1-gog4", repo="openage")
mod_def.set_info("swgb_base", "0.5", versionstr="1.1-gog4", repo="openage")

mod_def.add_include("data/**")

Expand Down

0 comments on commit 96850a6

Please sign in to comment.