package dnfbridge import "testing" // TestCompanionServerStartMapActorGateCoversPureServerPath 是「不改客户端」这条 // 路线的直接护栏。 // // 本部署的支援兵走**服务端自建 APC**:把 code 5405 的 AI角色作为一条 START_MAP // 行放进副本,客户端原生就能渲染,因此不需要任何客户端补丁。 // // 与「客户端执行器」路线的互斥关系(两者同时生效会出现重复 actor): // - 打了 90CN 补丁 → actor 由客户端建,服务端只发 0x7F41 投影,必须**不**注入 // - 未打补丁 → 服务端自建,必须注入 // // 这条路的开关**只看环境变量**,不看 ConfigSource:因为一旦在 GM 工具里保存过 // 配置,ConfigSource 就变成 "account_settings",若还要求 environment_fallback // 就等于"配好了反而不生效"。 func TestCompanionServerStartMapActorGateCoversPureServerPath(t *testing.T) { ready := ¤tDungeonCompanionRun{Ready: true, ConfigSource: "account_settings"} notReady := ¤tDungeonCompanionRun{Ready: false, ConfigSource: "account_settings"} // 未设开关:一律不注入(默认行为与移植前一致,绝不能影响正常玩法)。 t.Setenv(currentDungeonCompanionP0StartMapEnv, "") if currentDungeonCompanionServerStartMapActorEnabled(ready) { t.Fatal("env unset must not inject a server-owned START_MAP actor") } t.Setenv(currentDungeonCompanionP0StartMapEnv, "0") if currentDungeonCompanionServerStartMapActorEnabled(ready) { t.Fatal("env=0 must not inject a server-owned START_MAP actor") } // nil run:即使开着开关也不能注入(没有可用投影,注入会发出空 actor)。 t.Setenv(currentDungeonCompanionP0StartMapEnv, "1") if currentDungeonCompanionServerStartMapActorEnabled(nil) { t.Fatal("nil run must not inject a server-owned START_MAP actor") } // run 未就绪:源角色快照无效,不能注入。 if currentDungeonCompanionServerStartMapActorEnabled(notReady) { t.Fatal("non-ready run must not inject a server-owned START_MAP actor") } // 关键:持久化配置(account_settings)**也要**能走自建路径 —— // 这正是"未打补丁客户端"的场景。 if !currentDungeonCompanionServerStartMapActorEnabled(ready) { t.Fatal("ready persisted run with env=1 must inject a server-owned START_MAP actor") } }