using Engine.Kernel.Plugins; using Engine.Kernel.Scheduling; using Engine.Kernel.World; using Sandbox.Echo.Contracts; namespace Sandbox.Echo; /// /// M0's test fixture. Exists to exercise the full loop end to end โ€” plugin /// load, a real cross-ALC system registered and invoked by Schedule, and /// hot reload โ€” before any real subsystem exists to test any of it /// against. See M0 in docs/kernel-contract.md ยง8. /// public sealed class EchoPlugin : IPlugin { public void Configure(IPluginContext ctx) { ctx.Schedule.Add(Stage.Update, Tick) .Writes(); // There's no scene format yet (that's M2) โ€” nothing else will ever // put a GameObject in front of `engine run --headless`, so this // deliberately-a-test-fixture plugin seeds its own. A real plugin // wouldn't do this; scene content isn't a subsystem's job. ctx.World.CreateGameObject("sandbox.echo:ping").AddComponent(); ctx.Log.Info("sandbox.echo configured"); } public void Shutdown(IPluginContext ctx) { ctx.Schedule.RemoveAllFrom("sandbox.echo"); } static void Tick(IWorld world) { foreach (var go in world.Query()) go.GetComponent()!.Count++; } }