summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <github@jplamondonw.com>2018-08-01 11:07:29 -0400
committerJesse Plamondon-Willard <github@jplamondonw.com>2018-08-01 11:07:29 -0400
commit60b41195778af33fd609eab66d9ae3f1d1165e8f (patch)
tree7128b906d40e94c56c34ed6058f27bc31c31a08b /docs
parentb9bc1a6d17cafa0a97b46ffecda432cfc2f23b51 (diff)
parent52cf953f685c65b2b6814e375ec9a5ffa03c440a (diff)
downloadSMAPI-60b41195778af33fd609eab66d9ae3f1d1165e8f.tar.gz
SMAPI-60b41195778af33fd609eab66d9ae3f1d1165e8f.tar.bz2
SMAPI-60b41195778af33fd609eab66d9ae3f1d1165e8f.zip
Merge branch 'develop' into stable
Diffstat (limited to 'docs')
-rw-r--r--docs/CONTRIBUTING.md17
-rw-r--r--docs/README.md14
-rw-r--r--docs/mod-build-config.md50
-rw-r--r--docs/release-notes.md116
-rw-r--r--docs/screenshots/code-analyzer-example.pngbin4022 -> 3473 bytes
-rw-r--r--docs/technical-docs.md111
6 files changed, 206 insertions, 102 deletions
diff --git a/docs/CONTRIBUTING.md b/docs/CONTRIBUTING.md
deleted file mode 100644
index 52d47a4b..00000000
--- a/docs/CONTRIBUTING.md
+++ /dev/null
@@ -1,17 +0,0 @@
-Do you want to...
-
-* **Ask for help using SMAPI?**
- Please post a message in the [SMAPI support thread](http://community.playstarbound.com/threads/108375),
- don't create a GitHub issue.
-
-* **Report a bug?**
- Please post a message in the [SMAPI support thread](http://community.playstarbound.com/threads/108375)
- instead, unless you're sure it's a bug in SMAPI itself.
-
-* **Submit a pull request?**
- Pull requests are welcome! If you're submitting a new feature, it's best to discuss first to make
- sure it'll be accepted. Feel free to come chat in [#modding on Discord](https://discord.gg/kH55QXP)
- or post in the [SMAPI support thread](http://community.playstarbound.com/threads/108375).
-
- Documenting your code and using the same formatting conventions is appreciated, but don't worry too
- much about it. We'll fix up the code after we accept the pull request if needed.
diff --git a/docs/README.md b/docs/README.md
index bdfc5c9d..e7d6d682 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -1,6 +1,6 @@
**SMAPI** is an open-source modding API for [Stardew Valley](http://stardewvalley.net/) that lets
you play the game with mods. It's safely installed alongside the game's executable, and doesn't
-change any of your game files. It serves six main purposes:
+change any of your game files. It serves eight main purposes:
1. **Load mods into the game.**
_SMAPI loads mods when the game is starting up so they can interact with it. (Code mods aren't
@@ -25,16 +25,24 @@ change any of your game files. It serves six main purposes:
crashing the game, and makes it possible to troubleshoot errors in the game itself that would
otherwise show a generic 'program has stopped working' type of message._
-6. **Provide update checks.**
+6. **Provide update checks.**
_SMAPI automatically checks for new versions of your installed mods, and notifies you when any
are available._
+7. **Provide compatibility checks.**
+ _SMAPI automatically detects outdated or broken code in mods, and safely disables them before
+ they cause problems._
+
+8. **Back up your save files.**
+ _SMAPI automatically creates a daily backup of your saves and keeps ten backups, in case
+ something goes wrong. (Via the bundled SaveBackup mod.)_
+
## Documentation
Have questions? Come [chat on Discord](https://discord.gg/KCJHWhX) with SMAPI developers and other
modders!
### For players
-* [Modding guides](https://stardewvalleywiki.com/Modding:Index#For_players)
+* [Player guide](https://stardewvalleywiki.com/Modding:Player_Guide)
### For modders
* [Modding documentation](https://stardewvalleywiki.com/Modding:Index)
diff --git a/docs/mod-build-config.md b/docs/mod-build-config.md
index 99a567f2..0c1cc10a 100644
--- a/docs/mod-build-config.md
+++ b/docs/mod-build-config.md
@@ -121,18 +121,30 @@ or you have multiple installs, you can specify the path yourself. There's two wa
The configuration will check your custom path first, then fall back to the default paths (so it'll
still compile on a different computer).
-### Unit test projects
+### Ignore files
+If you don't want to include a file in the mod folder or release zip:
+* Make sure it's not copied to the build output. For a DLL, make sure the reference is [not marked 'copy local'](https://msdn.microsoft.com/en-us/library/t1zz5y8c(v=vs.100).aspx).
+* Or add this to your `.csproj` file under the `<Project` line:
+ ```xml
+ <IgnoreModFilePatterns>\.txt$, \.pdf$</IgnoreModFilePatterns>
+ ```
+ This is a comma-delimited list of regular expression patterns. If any pattern matches a file's
+ relative path in your mod folder, that file won't be included.
+
+### Non-mod projects
**(upcoming in 2.1)**
-You can use the package in unit test projects too. Its optional unit test mode...
+You can use the package in non-mod projects too (e.g. unit tests or framework DLLs). You'll need to
+disable deploying the mod and creating a release zip:
-1. disables deploying the project as a mod;
-2. disables creating a release zip;
-2. and copies the referenced DLLs into the build output for unit test frameworks.
+```xml
+<EnableModDeploy>False</EnableModDeploy>
+<EnableModZip>False</EnableModZip>
+```
-To enable it, add this above the first `</PropertyGroup>` in your `.csproj`:
+If this is for unit tests, you may need to copy the referenced DLLs into your build output too:
```xml
-<ModUnitTests>True</ModUnitTests>
+<CopyModReferencesToBuildOutput>True</CopyModReferencesToBuildOutput>
```
## Code warnings
@@ -140,11 +152,11 @@ To enable it, add this above the first `</PropertyGroup>` in your `.csproj`:
The NuGet package adds code warnings in Visual Studio specific to Stardew Valley. For example:
![](screenshots/code-analyzer-example.png)
-You can hide the warnings...
+You can hide the warnings using the warning ID (shown under 'code' in the Error List). See...
* [for specific code](https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/preprocessor-directives/preprocessor-pragma-warning);
* for a method using this attribute:
```cs
- [System.Diagnostics.CodeAnalysis.SuppressMessage("SMAPI.CommonErrors", "SMAPI001")] // implicit net field conversion
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("SMAPI.CommonErrors", "AvoidNetField")]
```
* for an entire project:
1. Expand the _References_ node for the project in Visual Studio.
@@ -153,8 +165,8 @@ You can hide the warnings...
See below for help with each specific warning.
-### SMAPI001
-**Implicit net field conversion:**
+### Avoid implicit net field cast
+Warning text:
> This implicitly converts '{{expression}}' from {{net type}} to {{other type}}, but
> {{net type}} has unintuitive implicit conversion rules. Consider comparing against the actual
> value instead to avoid bugs.
@@ -163,11 +175,11 @@ Stardew Valley uses net types (like `NetBool` and `NetInt`) to handle multiplaye
can implicitly convert to their equivalent normal values (like `bool x = new NetBool()`), but their
conversion rules are unintuitive and error-prone. For example,
`item?.category == null && item?.category != null` can both be true at once, and
-`building.indoors != null` will be true for a null value in some cases.
+`building.indoors != null` can be true for a null value.
Suggested fix:
* Some net fields have an equivalent non-net property like `monster.Health` (`int`) instead of
- `monster.health` (`NetInt`). The package will add a separate [SMAPI002](#smapi002) warning for
+ `monster.health` (`NetInt`). The package will add a separate [AvoidNetField](#avoid-net-field) warning for
these. Use the suggested property instead.
* For a reference type (i.e. one that can contain `null`), you can use the `.Value` property:
```c#
@@ -185,17 +197,17 @@ Suggested fix:
if (item != null && item.category.Value == 0)
```
-### SMAPI002
-**Avoid net fields when possible:**
+### Avoid net field
+Warning text:
> '{{expression}}' is a {{net type}} field; consider using the {{property name}} property instead.
-Your code accesses a net field, which has some unusual behavior (see [SMAPI001](#smapi001)). This
-field has an equivalent non-net property that avoids those issues.
+Your code accesses a net field, which has some unusual behavior (see [AvoidImplicitNetFieldCast](#avoid-implicit-net-field-cast)).
+This field has an equivalent non-net property that avoids those issues.
Suggested fix: access the suggested property name instead.
-### SMAPI003
-**Avoid obsolete fields:**
+### Avoid obsolete field
+Warning text:
> The '{{old field}}' field is obsolete and should be replaced with '{{new field}}'.
Your code accesses a field which is obsolete or no longer works. Use the suggested field instead.
diff --git a/docs/release-notes.md b/docs/release-notes.md
index e68720da..e4f9fd1d 100644
--- a/docs/release-notes.md
+++ b/docs/release-notes.md
@@ -1,21 +1,103 @@
# Release notes
-<!--
-## 2.6 alpha
+## 2.6
* For players:
- * Added support for Stardew Valley 1.3+; no longer compatible with earlier versions.
- * Added `Context.IsMultiplayer` and `Context.IsMainPlayer` flags.
- * Fixed SMAPI update checks not showing newer beta versions when using a beta version.
+ * Updated for Stardew Valley 1.3.
+ * Added automatic save backups.
+ * Improved update checks:
+ * added beta update channel;
+ * added update alerts for incompatible mods with an unofficial update on the wiki;
+ * added update alerts for optional files on Nexus;
+ * added console warning for mods which don't have update checks configured;
+ * added more visible prompt in beta channel for SMAPI updates;
+ * fixed mod update checks failing if a mod only has prerelease versions on GitHub;
+ * fixed Nexus mod update alerts not showing HTTPS links.
+ * Improved mod warnings in the console.
+ * Improved error when game can't start audio.
+ * Improved the Console Commands mod:
+ * Added `player_add name`, which adds items to your inventory by name instead of ID.
+ * Fixed `world_setseason` not running season-change logic.
+ * Fixed `world_setseason` not normalising the season value.
+ * Fixed `world_settime` sometimes breaking NPC schedules (e.g. so they stay in bed).
+ * Removed the `player_setlevel` and `player_setspeed` commands, which weren't implemented in a useful way. Use a mod like CJB Cheats Menu if you need those.
+ * Fixed `SEHException` errors for some players.
+ * Fixed performance issues for some players.
+ * Fixed default color scheme on Mac or in PowerShell (configurable via `StardewModdingAPI.config.json`).
+ * Fixed installer error on Linux/Mac in some cases.
+ * Fixed installer not finding some game paths or showing duplicate paths.
+ * Fixed installer not removing some SMAPI files.
+ * Fixed launch issue for Linux players with some terminals. (Thanks to HanFox and kurumushi!)
+ * Fixed abort-retry loop if a mod crashed when intercepting assets during startup.
+ * Fixed some mods failing if the player name is blank.
+ * Fixed errors when a mod references a missing assembly.
+ * Fixed `AssemblyResolutionException` errors in rare cases.
+ * Renamed `install.exe` to `install on Windows.exe` to avoid confusion.
+ * Updated compatibility list.
+
+* For the web UI:
+ * Added option to download SMAPI from Nexus.
+ * Added log parser redesign that should be more intuitive.
+ * Added log parser option to view raw log.
+ * Changed log parser filters to show `DEBUG` messages by default.
+ * Fixed design on smaller screens.
+ * Fixed log parser issue when content packs have no description.
+ * Fixed log parser mangling crossplatform paths in some cases.
+ * Fixed `smapi.io/install` not linking to a useful page.
* For modders:
- * Added code analysis to mod build config package to flag common issues as warnings.
- * Dropped some deprecated APIs.
- * Fixed assets loaded by temporary content managers not being editable.
- * Fixed issue where assets didn't reload correctly when the player switches language.
+ * Added [input API](https://stardewvalleywiki.com/Modding:Modder_Guide/APIs/Input) for reading and suppressing keyboard, controller, and mouse input.
+ * Added code analysis in the NuGet package to flag common issues as warnings.
+ * Replaced `LocationEvents` to support multiplayer:
+ * now raised for all locations;
+ * now includes added/removed building interiors;
+ * each event now provides a list of added/removed values;
+ * added buildings-changed event.
+ * Added `Context.IsMultiplayer` and `Context.IsMainPlayer` flags.
+ * Added `Constants.TargetPlatform` which says whether the game is running on Linux, Mac, or Windows.
+ * Added `semanticVersion.IsPrerelease()` method.
+ * Added support for launching multiple instances transparently. This removes the former `--log-path` command-line argument.
+ * Added support for custom seasonal tilesheets when loading an unpacked `.tbin` map.
+ * Added Harmony DLL for internal use by SMAPI. (Mods should still include their own copy for backwards compatibility, and in case it's removed later. SMAPI will always load its own version though.)
+ * Added option to suppress update checks for a specific mod in `StardewModdingAPI.config.json`.
+ * Added absolute pixels to `ICursorPosition`.
+ * Added support for reading/writing `ISemanticVersion` to JSON.
+ * Added support for reloading NPC schedules through the content API.
+ * Reimplemented the content API so it works more reliably in many edge cases.
+ * Reimplemented input suppression to work more consistently in many cases.
+ * The order of update keys now affects which URL players see in update alerts.
+ * Fixed assets loaded by temporary content managers not being editable by mods.
+ * Fixed assets not reloaded consistently when the player switches language.
+ * Fixed error if a mod loads a PNG while the game is loading (e.g. custom map tilesheets via `IAssetLoader`).
+ * Fixed error if a mod translation file is empty.
+ * Fixed input suppression not working consistently for clicks.
+ * Fixed console input not saved to the log.
+ * Fixed `Context.IsPlayerFree` being false during festivals.
+ * Fixed `helper.ModRegistry.GetApi` errors not always mentioning which interface caused the issue.
+ * Fixed console commands being invoked asynchronously.
+ * Fixed mods able to intercept other mods' assets via the internal asset keys.
+ * Fixed mods able to indirectly change other mods' data through shared content caches.
+ * Fixed `SemanticVersion` allowing invalid versions in some cases.
+ * **Breaking changes** (see [migration guide](https://stardewvalleywiki.com/Modding:Migrate_to_Stardew_Valley_1.3)):
+ * Dropped some deprecated APIs.
+ * `LocationEvents` have been rewritten.
+ * Mods can't intercept chatbox input.
+ * Mod IDs should only contain letters, numbers, hyphens, dots, and underscores. That allows their use in many contexts like URLs. This restriction is now enforced. (In regex form: `^[a-zA-Z0-9_.-]+$`.)
* For SMAPI developers:
- * Added prerelease versions to the mod update-check API response where available (GitHub only).
- * Added support for beta releases on the home page.
--->
+ * Added more consistent crossplatform handling, including MacOS detection.
+ * Added beta update channel.
+ * Added optional mod metadata to the web API (including Nexus info, wiki metadata, etc).
+ * Added early prototype of SMAPI 3.0 events via `helper.Events`.
+ * Added early prototype of mod handler toolkit.
+ * Added Harmony for SMAPI's internal use.
+ * Added metadata dump option in `StardewModdingAPI.config.json` for troubleshooting some cases.
+ * Added more stylish pufferchick on the home page.
+ * Rewrote update checks:
+ * Moved most logic into the web API.
+ * Changed web API to require mod IDs.
+ * Changed web API to also fetch metadata from SMAPI's internal mod DB and the wiki.
+ * Rewrote world/player state tracking. The new implementation is much more efficient than previous method, uses net field events where available, and lays the groundwork for more advanced events in SMAPI 3.0.
+ * Split mod DB out of `StardewModdingAPI.config.json` into its own file.
+ * Updated to Mono.Cecil 0.10.
## 2.5.5
* For players:
@@ -215,7 +297,7 @@
* **New features for modders**
SMAPI 2.0 adds several features to enable new kinds of mods (see
- [API documentation](https://stardewvalleywiki.com/Modding:SMAPI_APIs)).
+ [API documentation](https://stardewvalleywiki.com/Modding:Modder_Guide/APIs)).
The **content API** lets you edit, inject, and reload XNB data loaded by the game at any time. This lets SMAPI mods do
anything previously only possible with XNB mods, and enables new mod scenarios not possible with XNB mods (e.g.
@@ -338,8 +420,8 @@ For players:
* Updated mod compatibility list.
For modders:
-* Added `SDate` utility for in-game date calculations (see [API reference](http://stardewvalleywiki.com/Modding:SMAPI_APIs#Dates)).
-* Added support for minimum dependency versions in `manifest.json` (see [API reference](http://stardewvalleywiki.com/Modding:SMAPI_APIs#Manifest)).
+* Added `SDate` utility for in-game date calculations (see [API reference](https://stardewvalleywiki.com/Modding:Modder_Guide/APIs/Utilities#Dates)).
+* Added support for minimum dependency versions in `manifest.json` (see [API reference](https://stardewvalleywiki.com/Modding:Modder_Guide/APIs/Manifest)).
* Added more useful logging when loading mods.
* Added a `ModID` property to all mod helpers for extension methods.
* Changed `manifest.MinimumApiVersion` from string to `ISemanticVersion`. This shouldn't affect mods unless they referenced that field in code.
@@ -371,8 +453,8 @@ For players:
* Updated mod compatibility list.
For modders:
-* You can now add dependencies to `manifest.json` (see [API reference](http://stardewvalleywiki.com/Modding:SMAPI_APIs#Manifest)).
-* You can now translate your mod (see [API reference](http://stardewvalleywiki.com/Modding:SMAPI_APIs#Translation)).
+* You can now add dependencies to `manifest.json` (see [API reference](https://stardewvalleywiki.com/Modding:Modder_Guide/APIs/Manifest)).
+* You can now translate your mod (see [API reference](https://stardewvalleywiki.com/Modding:Modder_Guide/APIs/Translation)).
* You can now load unpacked `.tbin` files from your mod folder through the content API.
* SMAPI now automatically fixes tilesheet references for maps loaded from the mod folder.
<small>_When loading a map from the mod folder, SMAPI will automatically use tilesheets relative to the map file if they exists. Otherwise it will default to tilesheets in the game content._</small>
diff --git a/docs/screenshots/code-analyzer-example.png b/docs/screenshots/code-analyzer-example.png
index 3b930dc5..de38f643 100644
--- a/docs/screenshots/code-analyzer-example.png
+++ b/docs/screenshots/code-analyzer-example.png
Binary files differ
diff --git a/docs/technical-docs.md b/docs/technical-docs.md
index 9e1a49e7..d829baf9 100644
--- a/docs/technical-docs.md
+++ b/docs/technical-docs.md
@@ -44,7 +44,7 @@ executed. This doesn't work in MonoDevelop on Linux, unfortunately.
### Preparing a release
To prepare a crossplatform SMAPI release, you'll need to compile it on two platforms. See
-[crossplatforming info](http://stardewvalleywiki.com/Modding:Creating_a_SMAPI_mod#Test_on_all_platforms)
+[crossplatforming info](https://stardewvalleywiki.com/Modding:Creating_a_SMAPI_mod#Test_on_all_platforms)
on the wiki for the first-time setup.
1. Update the version number in `GlobalAssemblyInfo.cs` and `Constants::Version`. Make sure you use a
@@ -78,8 +78,9 @@ on the wiki for the first-time setup.
Mono.Cecil.dll
Newtonsoft.Json.dll
StardewModdingAPI
- StardewModdingAPI.AssemblyRewriters.dll
StardewModdingAPI.config.json
+ StardewModdingAPI.Internal.dll
+ StardewModdingAPI.metadata.json
StardewModdingAPI.exe
StardewModdingAPI.pdb
StardewModdingAPI.xml
@@ -91,8 +92,9 @@ on the wiki for the first-time setup.
Mods/*
Mono.Cecil.dll
Newtonsoft.Json.dll
- StardewModdingAPI.AssemblyRewriters.dll
StardewModdingAPI.config.json
+ StardewModdingAPI.Internal.dll
+ StardewModdingAPI.metadata.json
StardewModdingAPI.exe
StardewModdingAPI.pdb
StardewModdingAPI.xml
@@ -135,7 +137,6 @@ change without warning.
argument | purpose
-------- | -------
-`--log-path "path"` | The relative or absolute path of the log file SMAPI should write.
`--no-terminal` | SMAPI won't write anything to the console window. (Messages will still be written to the log file.)
### Compile flags
@@ -157,48 +158,66 @@ persisted in a compressed form to Pastebin.
The log parser lives at https://log.smapi.io.
-### Mods API
-The mods API provides version info for mods hosted by Chucklefish, GitHub, or Nexus Mods. It's used
-by SMAPI to perform update checks. The `{version}` URL token is the version of SMAPI making the
-request; it doesn't do anything currently, but lets us version breaking changes if needed.
-
-Each mod is identified by a repository key and unique identifier (like `nexus:541`). The following
-repositories are supported:
-
-key | repository
-------------- | ----------
-`chucklefish` | A mod page on the [Chucklefish mod site](https://community.playstarbound.com/resources/categories/22), identified by the mod ID in the page URL.
-`github` | A repository on [GitHub](https://github.com), identified by its owner and repository name (like `Zoryn4163/SMAPI-Mods`). This checks the version of the latest repository release.
-`nexus` | A mod page on [Nexus Mods](https://www.nexusmods.com/stardewvalley), identified by the mod ID in the page URL.
-
-
-The API accepts either `GET` or `POST` for convenience:
-> ```
->GET https://api.smapi.io/v2.0/mods?modKeys=nexus:541,chucklefish:4228
->```
-
->```
->POST https://api.smapi.io/v2.0/mods
->{
-> "ModKeys": [ "nexus:541", "chucklefish:4228" ]
->}
->```
-
-It returns a response like this:
->```
->{
-> "chucklefish:4228": {
-> "name": "Entoarox Framework",
-> "version": "1.8.0",
-> "url": "https://community.playstarbound.com/resources/4228"
-> },
-> "nexus:541": {
-> "name": "Lookup Anything",
-> "version": "1.16",
-> "url": "http://www.nexusmods.com/stardewvalley/mods/541"
-> }
->}
->```
+### Web API
+SMAPI provides a web API at `api.smapi.io` for use by SMAPI and external tools. The URL includes a
+`{version}` token, which is the SMAPI version for backwards compatibility. This API is publicly
+accessible but not officially released; it may change at any time.
+
+The API has one `/mods` endpoint. This provides mod info, including official versions and URLs
+(from Chucklefish, GitHub, or Nexus), unofficial versions from the wiki, and optional mod metadata
+from the wiki and SMAPI's internal data. This is used by SMAPI to perform update checks, and by
+external tools to fetch mod data.
+
+The API accepts a `POST` request with the mods to match, each of which **must** specify an ID and
+may _optionally_ specify [update keys](https://stardewvalleywiki.com/Modding:Modder_Guide/APIs/Manifest#Update_checks).
+The API will automatically try to fetch known update keys from the wiki and internal data based on
+the given ID.
+
+```
+POST https://api.smapi.io/v2.0/mods
+{
+ "mods": [
+ {
+ "id": "Pathoschild.LookupAnything",
+ "updateKeys": [ "nexus:541", "chucklefish:4250" ]
+ }
+ ],
+ "includeExtendedMetadata": true
+}
+```
+
+The API will automatically aggregate versions and errors. Each mod will include...
+* an `id` (matching what you passed in);
+* up to three versions: `main` (e.g. 'latest version' field on Nexus), `optional` if newer (e.g.
+ optional files on Nexus), and `unofficial` if newer (from the wiki);
+* `metadata` with mod info crossreferenced from the wiki and internal data (only if you specified
+ `includeExtendedMetadata: true`);
+* and `errors` containing any error messages that occurred while fetching data.
+
+For example:
+```
+[
+ {
+ "id": "Pathoschild.LookupAnything",
+ "main": {
+ "version": "1.19",
+ "url": "https://www.nexusmods.com/stardewvalley/mods/541"
+ },
+ "metadata": {
+ "id": [
+ "Pathoschild.LookupAnything",
+ "LookupAnything"
+ ],
+ "name": "Lookup Anything",
+ "nexusID": 541,
+ "gitHubRepo": "Pathoschild/StardewMods",
+ "compatibilityStatus": "Ok",
+ "compatibilitySummary": "✓ use latest version."
+ },
+ "errors": []
+ }
+]
+```
## Development
### Local development