[Automate] provide public API for mod integrations
Pathoschild opened this issue ยท 4 comments
Based on how commonly it's requested, having a public API for mod integrations is more valuable than transport pipes, so I'll focus on the API first with the understanding that it may break in a future Automate version which adds pipes.
The API would probably work something like this:
AutomateAPI
.GetInstanceFor(this.ModManifest)
.AddObjectMachine(this.GetObjectMachine);
private IMachine GetObjectMachine(StardewValley.Object obj, GameLocation location, Vector2 tile)
{
if (obj.ParentSheetIndex == 999999)
return new NineGeneratorMachine(location, tile);
return null;
}
Done in develop
for the upcoming Automate 1.11 (see readme).
Automate could allow mods to register methods containing signatures similar to MachineFactory.TryGetMachine
, then Automate could loop through all the registered methods to see if that tile has a machine that a mod has registered. This would also require Automate to expose IMachine
and all the types it uses. These types could be separated into their own assembly for mod authors to import if they want to add optional support for Automate.