SMAPI - Stardew Modding API

SMAPI - Stardew Modding API

971k Downloads

Consider using Harmony in SMAPI

Pathoschild opened this issue ยท 3 comments

commented

Consider using Harmony in SMAPI to patch game methods directly. For example, this can be used to patch Game1.updateSeasonalTileSheets to support seasonal mod tilesheets, or to add more events.

commented

If SMAPI loads Harmony, then all mods would rely on the version SMAPI uses. It would remove the version conflict issue. However, that's what the mod tools are supposed to do. As for seasonal textures and whatnot, I don't think SMAPI should be used for that. Instead, I'm in favor of keeping SMAPI as a core framework that touches the game only where needed, and leaves the rest up to modders. For seasonal textures and other similar content changes, I think Content Patcher should apply the necessary patches, not SMAPI. If Harmony is required for more events, consider creating a mod that modders can use instead?

commented

I agree that SMAPI should only patch the game where needed for providing a core mod framework. I think that includes patching the seasonal tilesheet logic though. The current logic breaks any mod that uses the content API to load a map with seasonal tilesheets, not only Content Patcher. I think this is one of the few cases it makes sense for SMAPI to patch, at least until they can make the change in Stardew Valley directly.

Providing events is one of SMAPI's main purposes. If something will provide crucial events for all mods to use (like crop events), it's best to have it in SMAPI itself so we don't have version conflicts, project continuity issues, etc. Note that SMAPI's use of Harmony will be transparent to mods. They'll just see regular events like any others, and won't have access to any patching themselves (unless they reference Harmony directly).

commented

Done in develop with SMAPI 2.6-beta.16. It will be used further as part of separate tickets.