From 44d85022e8062439e791abcb95d9980006600649 Mon Sep 17 00:00:00 2001 From: Erik Date: Mon, 11 May 2026 14:25:22 +0200 Subject: [PATCH] feat(vfx #C.1.5a): wire EntityScriptActivator into GpuWorldState lifecycle MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit GpuWorldState grows a fourth optional ctor parameter for the activator, paralleling how EntitySpawnAdapter is plumbed. AppendLiveEntity calls OnCreate after the existing _wbEntitySpawnAdapter?.OnCreate; RemoveEntityByServerGuid calls OnRemove after the existing OnRemove. Symmetric, same order, null-safe. GameWindow still passes the old 3-arg ctor — activator construction + wire-through lands in the next commit. Co-Authored-By: Claude Opus 4.7 (1M context) --- src/AcDream.App/Streaming/GpuWorldState.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/AcDream.App/Streaming/GpuWorldState.cs b/src/AcDream.App/Streaming/GpuWorldState.cs index 2965b24..b0524ed 100644 --- a/src/AcDream.App/Streaming/GpuWorldState.cs +++ b/src/AcDream.App/Streaming/GpuWorldState.cs @@ -1,6 +1,7 @@ using System.Collections.Generic; using System.Linq; using System.Numerics; +using AcDream.App.Rendering.Vfx; using AcDream.App.Rendering.Wb; using AcDream.Core.World; @@ -41,6 +42,7 @@ public sealed class GpuWorldState { private readonly LandblockSpawnAdapter? _wbSpawnAdapter; private readonly EntitySpawnAdapter? _wbEntitySpawnAdapter; + private readonly EntityScriptActivator? _entityScriptActivator; /// /// Phase Post-A.5 #53 (Task 12): optional callback fired before @@ -57,11 +59,13 @@ public sealed class GpuWorldState public GpuWorldState( LandblockSpawnAdapter? wbSpawnAdapter = null, EntitySpawnAdapter? wbEntitySpawnAdapter = null, - System.Action? onLandblockUnloaded = null) + System.Action? onLandblockUnloaded = null, + EntityScriptActivator? entityScriptActivator = null) { _wbSpawnAdapter = wbSpawnAdapter; _wbEntitySpawnAdapter = wbEntitySpawnAdapter; _onLandblockUnloaded = onLandblockUnloaded; + _entityScriptActivator = entityScriptActivator; } private readonly Dictionary _loaded = new(); @@ -283,6 +287,7 @@ public sealed class GpuWorldState // Phase N.4 Task 17: release per-instance state for server-spawned // entities. No-op for atlas-tier entities (never registered). _wbEntitySpawnAdapter?.OnRemove(serverGuid); + _entityScriptActivator?.OnRemove(serverGuid); bool rebuiltLoaded = false; @@ -343,6 +348,7 @@ public sealed class GpuWorldState // per-instance adapter. Atlas-tier entities (ServerGuid == 0) are // skipped by OnCreate — it returns null immediately for those. _wbEntitySpawnAdapter?.OnCreate(entity); + _entityScriptActivator?.OnCreate(entity); uint canonicalLandblockId = (landblockId & 0xFFFF0000u) | 0xFFFFu;