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:
parent
22f684e8c6
commit
0c0c042dca
10 changed files with 212 additions and 3 deletions
7
src/AcDream.Plugin.Abstractions/IEvents.cs
Normal file
7
src/AcDream.Plugin.Abstractions/IEvents.cs
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
// src/AcDream.Plugin.Abstractions/IEvents.cs
|
||||
namespace AcDream.Plugin.Abstractions;
|
||||
|
||||
public interface IEvents
|
||||
{
|
||||
event Action<WorldEntitySnapshot> EntitySpawned;
|
||||
}
|
||||
7
src/AcDream.Plugin.Abstractions/IGameState.cs
Normal file
7
src/AcDream.Plugin.Abstractions/IGameState.cs
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
// src/AcDream.Plugin.Abstractions/IGameState.cs
|
||||
namespace AcDream.Plugin.Abstractions;
|
||||
|
||||
public interface IGameState
|
||||
{
|
||||
IReadOnlyList<WorldEntitySnapshot> Entities { get; }
|
||||
}
|
||||
|
|
@ -3,9 +3,11 @@ namespace AcDream.Plugin.Abstractions;
|
|||
|
||||
/// <summary>
|
||||
/// Entry point for a plugin into the acdream runtime. The surface will grow
|
||||
/// across phases as more systems come online. For Phase 1 only IPluginLogger is real.
|
||||
/// across phases as more systems come online.
|
||||
/// </summary>
|
||||
public interface IPluginHost
|
||||
{
|
||||
IPluginLogger Log { get; }
|
||||
IGameState State { get; }
|
||||
IEvents Events { get; }
|
||||
}
|
||||
|
|
|
|||
10
src/AcDream.Plugin.Abstractions/WorldEntitySnapshot.cs
Normal file
10
src/AcDream.Plugin.Abstractions/WorldEntitySnapshot.cs
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
// src/AcDream.Plugin.Abstractions/WorldEntitySnapshot.cs
|
||||
using System.Numerics;
|
||||
|
||||
namespace AcDream.Plugin.Abstractions;
|
||||
|
||||
public readonly record struct WorldEntitySnapshot(
|
||||
uint Id,
|
||||
uint SourceId,
|
||||
Vector3 Position,
|
||||
Quaternion Rotation);
|
||||
Loading…
Add table
Add a link
Reference in a new issue