feat(app): wire plugin host, ship smoke plugin, log lifecycle
Phase 1 MVP end-to-end. Program.cs initializes Serilog, builds an AppPluginHost that hands plugins a SerilogAdapter (IPluginLogger), discovers plugins from the App's output plugins/ dir, loads each via PluginLoader, calls Enable on all of them before opening the GameWindow, and calls Disable in a finally block on shutdown. AcDream.Plugins.Smoke is a new first-party plugin that logs through the host during Initialize / Enable / Disable. Its csproj references the abstractions with Private=false + ExcludeAssets=runtime to avoid shipping a second copy of AcDream.Plugin.Abstractions.dll (which would break ALC type identity). An MSBuild Target on the App project copies the plugin DLL into plugins/AcDream.Plugins.Smoke/ and writes the plugin.json manifest next to it. Smoke verified against real dats. Console output observed: [INF] scanning plugins in ...\plugins [INF] smoke plugin initialized [INF] loaded plugin acdream.smoke (Smoke Plugin) [INF] smoke plugin enabled loaded landblock 0xA9B4FFFF <window renders terrain> [INF] smoke plugin disabled (on shutdown) Phase 1 done. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
87c45c70ac
commit
fb83e0bb6f
7 changed files with 130 additions and 6 deletions
17
src/AcDream.Plugins.Smoke/AcDream.Plugins.Smoke.csproj
Normal file
17
src/AcDream.Plugins.Smoke/AcDream.Plugins.Smoke.csproj
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net10.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<LangVersion>latest</LangVersion>
|
||||
<!-- Plugin DLLs are copied to plugins/<id>/ at build of AcDream.App.
|
||||
They must NOT bring AcDream.Plugin.Abstractions.dll with them;
|
||||
the host already owns it. -->
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\AcDream.Plugin.Abstractions\AcDream.Plugin.Abstractions.csproj">
|
||||
<Private>false</Private>
|
||||
<ExcludeAssets>runtime</ExcludeAssets>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
17
src/AcDream.Plugins.Smoke/SmokePlugin.cs
Normal file
17
src/AcDream.Plugins.Smoke/SmokePlugin.cs
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
using AcDream.Plugin.Abstractions;
|
||||
|
||||
namespace AcDream.Plugins.Smoke;
|
||||
|
||||
public sealed class SmokePlugin : IAcDreamPlugin
|
||||
{
|
||||
private IPluginHost? _host;
|
||||
|
||||
public void Initialize(IPluginHost host)
|
||||
{
|
||||
_host = host;
|
||||
_host.Log.Info("smoke plugin initialized");
|
||||
}
|
||||
|
||||
public void Enable() => _host?.Log.Info("smoke plugin enabled");
|
||||
public void Disable() => _host?.Log.Info("smoke plugin disabled");
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue