Line 52: |
Line 52: |
| | Get information about loaded mods, and integrate with mods using mod-provided APIs. | | | Get information about loaded mods, and integrate with mods using mod-provided APIs. |
| |} | | |} |
− |
| |
− | ==Manifest==
| |
− | Every SMAPI mod or content pack has a <tt>manifest.json</tt> file with info about it. That info is available in that mod's code (using <tt>this.ModManifest</tt>) and to other mods (using the [[#Mod registry|mod registry]]).
| |
− |
| |
− | Here's the basic format (see below for details on each field):
| |
− | {| class="wikitable"
| |
− | |-
| |
− | ! For a SMAPI mod
| |
− | ! For a content pack
| |
− | |-
| |
− | | <source lang="javascript">
| |
− | {
| |
− | "Name": "YourProjectName",
| |
− | "Author": "your name",
| |
− | "Version": "1.0.0",
| |
− | "Description": "One or two sentences about the mod.",
| |
− | "UniqueID": "YourName.YourProjectName",
| |
− | "EntryDll": "YourDllFileName.dll",
| |
− | "MinimumApiVersion": "2.0",
| |
− | "UpdateKeys": []
| |
− | }
| |
− | </source>
| |
− | | <source lang="javascript">
| |
− | {
| |
− | "Name": "YourProjectName",
| |
− | "Author": "your name",
| |
− | "Version": "1.0.0",
| |
− | "Description": "One or two sentences about the mod.",
| |
− | "UniqueID": "YourName.YourProjectName",
| |
− | "MinimumApiVersion": "2.0",
| |
− | "UpdateKeys": [],
| |
− | "ContentPackFor": {
| |
− | "UniqueID": "Pathoschild.ContentPatcher", // the ID of required mod
| |
− | "MinimumVersion": "1.3.0" // optional
| |
− | }
| |
− | }
| |
− | </source>
| |
− | |}
| |
− |
| |
− | ===Basic fields===
| |
− | All mods should specify the following fields.
| |
− |
| |
− | {| class="wikitable"
| |
− | |-
| |
− | ! field
| |
− | ! description
| |
− | |-
| |
− | | <tt>Name</tt>
| |
− | | The mod name. SMAPI uses this in player messages, logs, and errors. Example: <source lang="javascript">"Name": "Lookup Anything"</source>
| |
− | |-
| |
− | | <tt>Author</tt>
| |
− | | The name of the person who created the mod. Ideally this should include the username used to publish mods. Example: <source lang="javascript">"Author": "Pathoschild"</source>
| |
− | |-
| |
− | | <tt>Version</tt>
| |
− | | The mod's [http://semver.org/ semantic version]. Make sure you update this for each release! SMAPI uses this for update checks, mod dependencies, and compatibility blacklists (if the mod breaks in a future version of the game). Examples:
| |
− | <source lang="javascript">
| |
− | "Version": "1.0"
| |
− | </source>
| |
− | <source lang="javascript">
| |
− | "Version": "1.0.1-beta.2"
| |
− | </source>
| |
− | |-
| |
− | | <tt>Description</tt>
| |
− | | A short explanation of what your mod does (one or two sentences), shown in the SMAPI log. Example: <source lang="javascript">"Description": "View metadata about anything by pressing a button."</source>
| |
− | |-
| |
− | | <tt>UniqueID</tt>
| |
− | | A unique identifier for your mod. The recommended format is <tt><your name>.<mod name></tt>, with no spaces or special characters. SMAPI uses this for update checks, mod dependencies, and compatibility blacklists (if the mod breaks in a future version of the game). When another mod needs to reference this mod, it uses the unique ID. Example: <source lang="javascript">"UniqueID": "Pathoschild.LookupAnything"</source>
| |
− | |-
| |
− | | <tt>EntryDll</tt> '''or''' <tt>ContentPackFor</tt>
| |
− | | <p>All mods must specify either <tt>EntryDll</tt> (for a SMAPI mod) or <tt>ContentPackFor</tt> (for a [[Modding:Content packs|content pack]]). These are mutually exclusive — you can't specify both.</p>
| |
− |
| |
− | For a SMAPI mod, <tt>EntryDll</tt> is the mod's compiled DLL filename in its mod folder. Example: <source lang="javascript">"EntryDll": "LookupAnything.dll"</source>
| |
− |
| |
− | For a content pack, <tt>ContentPackFor</tt> specifies which mod can read it. The <tt>MinimumVersion</tt> is optional. Example:
| |
− | <source lang="javascript">
| |
− | "ContentPackFor": {
| |
− | "UniqueID": "Pathoschild.ContentPatcher",
| |
− | "MinimumVersion": "1.0.0"
| |
− | }
| |
− | </source>
| |
− | |}
| |
− |
| |
− | ===Minimum SMAPI version===
| |
− | The <tt>MinimumApiVersion</tt> fields sets the minimum SMAPI version needed to use this mod. If a player tries to use the mod with an older SMAPI version, they'll see a friendly message saying they need to update SMAPI. This also serves as a proxy for the minimum game version, since SMAPI itself enforces a minimum game version. Example: <source lang="javascript">"MinimumApiVersion": "1.10"</source>
| |
− |
| |
− | ===Dependencies===
| |
− | The <tt>Dependencies</tt> field specifies other mods required to use this mod. If a player tries to use the mod and the listed mods aren't installed, they'll see a friendly message saying they need to install those. Example:
| |
− | <source lang="javascript">
| |
− | "Dependencies": [
| |
− | {
| |
− | "UniqueID": "Entoarox.Framework",
| |
− | "MinimumVersion": "1.7.9" // optional. If specified, older versions won't meet the requirement.
| |
− | }
| |
− | ]
| |
− | </source>
| |
− |
| |
− | You can mark a dependency as optional. It will be loaded first if it's installed, otherwise it'll be ignored.
| |
− | <source lang="javascript">
| |
− | "Dependencies": [
| |
− | {
| |
− | "UniqueID": "Entoarox.Framework",
| |
− | "IsRequired": false
| |
− | }
| |
− | ]
| |
− | </source>
| |
− |
| |
− | ===Update checks===
| |
− | SMAPI can detect new versions of your mod and alert the user with a link to your mod page. You can enable this by setting the <tt>UpdateKeys</tt> field with one of the following values, which tells SMAPI where to check.
| |
− |
| |
− | ; Chucklefish mod site
| |
− | : Make sure you have a mod release page (with a URL containing <tt>/resources/</tt> instead of <tt>/thread/</tt>) and it has a [http://semver.org/ semantic version], then specify the mod ID (it's in the mod page URL): <source lang="javascript">"UpdateKeys": [ "Chucklefish:4250" ]</source>
| |
− |
| |
− | ; Nexus Mods
| |
− | : Make sure the Nexus mod has a [http://semver.org/ semantic version], then specify the mod ID (it's in the mod page URL): <source lang="javascript">"UpdateKeys": [ "Nexus:541" ]</source>
| |
− |
| |
− | ; GitHub project
| |
− | : Make sure your [https://help.github.com/articles/creating-releases/ GitHub project has at least one release] and the latest release's tag is a [http://semver.org/ semantic version], then specify your GitHub username and project name: <source lang="javascript">"UpdateKeys": [ "GitHub:Pathoschild/LookupAnything" ]</source>
| |
− |
| |
− | You can specify multiple values, in which case SMAPI will check them all and list the latest version it finds:
| |
− | <source lang="javascript">"UpdateKeys": [ "Chucklefish:4250", "Nexus:541", "GitHub:Pathoschild/LookupAnything" ]</source>
| |
− |
| |
− | ===Anything else===
| |
− | Any other fields will be stored in the <tt>IManifest.ExtraFields</tt> dictionary, which is available through the [[#Mod registry|mod registry]]. Extra fields are ignored by SMAPI, but may be useful for extended metadata intended for other mods.
| |
| | | |
| ==Events== | | ==Events== |