feat(core): add IGameState, IEvents, WorldEvents with replay-on-subscribe

Adds WorldEntitySnapshot, IGameState, IEvents abstractions; WorldEvents
implements replay-on-subscribe with per-handler exception swallowing;
WorldGameState tracks entities; AppPluginHost exposes all three; stubs
wired in Program.cs to keep build green ahead of Task 9 live wiring.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Erik 2026-04-10 20:29:29 +02:00
parent 22f684e8c6
commit 0c0c042dca
10 changed files with 212 additions and 3 deletions

View file

@ -4,6 +4,14 @@ namespace AcDream.App.Plugins;
public sealed class AppPluginHost : IPluginHost
{
public AppPluginHost(IPluginLogger log) => Log = log;
public AppPluginHost(IPluginLogger log, IGameState state, IEvents events)
{
Log = log;
State = state;
Events = events;
}
public IPluginLogger Log { get; }
public IGameState State { get; }
public IEvents Events { get; }
}

View file

@ -15,7 +15,9 @@ if (string.IsNullOrWhiteSpace(datDir))
return 2;
}
var host = new AppPluginHost(new SerilogAdapter(Log.Logger));
var worldGameState = new AcDream.Core.Plugins.WorldGameState();
var worldEvents = new AcDream.Core.Plugins.WorldEvents();
var host = new AppPluginHost(new SerilogAdapter(Log.Logger), worldGameState, worldEvents);
var pluginsDir = Path.Combine(AppContext.BaseDirectory, "plugins");
Log.Information("scanning plugins in {PluginsDir}", pluginsDir);