summaryrefslogtreecommitdiff
path: root/src/LivingVillage.Desktop/Game.fs
diff options
context:
space:
mode:
authorSomhairle H. Marisol <[email protected]>2026-09-21 08:37:29 +0800
committerSomhairle H. Marisol <[email protected]>2026-09-21 08:37:29 +0800
commitc932969539b00a42937f0aa5ed1e10b4e94932a3 (patch)
tree1d7903caf8f3aeb5249f05c58fc81acc15413b4f /src/LivingVillage.Desktop/Game.fs
parentf64045ca6245ed853f4d8ac1bcce6f4fe13068ce (diff)
downloadliving-village-c932969539b00a42937f0aa5ed1e10b4e94932a3.tar.gz
feat(desktop): 增加可选昼光自动演示启动
[变更性质] - 本提交新增可选的 Desktop 启动行为,不改变默认启动行为。 [新增功能] - 设置 LV_AUTOPLAY_DAYLIGHT=1 时,初始世界和 StartNewGame 从黎明 tick 开始。 - 未设置该变量时继续从 tick 0 的夜晚状态开始。 [实现方案] - 在 WorldBootstrap 中集中计算昼光起始 tick 和同步时间。 - 在 Game 中复用同一世界工厂,并增加黎明与默认状态回归测试。 [影响范围] - 仅影响 Desktop 运行时代码和测试;Kernel 保持不变。 - 环境变量为显式 opt-in,不影响现有自动演示和普通启动路径。
Diffstat (limited to 'src/LivingVillage.Desktop/Game.fs')
-rw-r--r--src/LivingVillage.Desktop/Game.fs7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/LivingVillage.Desktop/Game.fs b/src/LivingVillage.Desktop/Game.fs
index 27e44a7..62102a7 100644
--- a/src/LivingVillage.Desktop/Game.fs
+++ b/src/LivingVillage.Desktop/Game.fs
@@ -97,6 +97,7 @@ type LivingVillageGame() as this =
let autoplay = Environment.GetEnvironmentVariable("LV_AUTOPLAY") = "1"
let autoplayFlow = Environment.GetEnvironmentVariable("LV_AUTOPLAY_FLOW") = "1"
let sampleMode = Environment.GetEnvironmentVariable("LV_AUTOPLAY_SAMPLE") = "1"
+ let daylightAutoplay = Environment.GetEnvironmentVariable("LV_AUTOPLAY_DAYLIGHT") = "1"
let automated = autoplay || autoplayFlow
let modeName =
if sampleMode then "sample"
@@ -124,7 +125,9 @@ type LivingVillageGame() as this =
let mutable cjkAtlas = Unchecked.defaultof<Texture2D>
let mutable pixel = Unchecked.defaultof<Texture2D>
let renderPlan = VillageArt.sampleRenderPlan ()
- let mutable world = WorldBootstrap.initialWorld 42UL Sim.npcCount
+ let createInitialWorld () =
+ WorldBootstrap.initialWorldForDaylight daylightAutoplay 42UL Sim.npcCount
+ let mutable world = createInitialWorld ()
let mutable camera = Vector2.Zero
let mutable avatarFacing = VillageArt.SouthFacing
let mutable fpsFrames = 0
@@ -168,7 +171,7 @@ type LivingVillageGame() as this =
this.CenterCamera()
member private this.StartNewGame() =
- world <- WorldBootstrap.initialWorld 42UL Sim.npcCount
+ world <- createInitialWorld ()
this.ResetWorldView()
menu <- menu |> MenuState.setCurrentWorld true |> MenuState.enterGame
printfn $"new-game=ok seed=42 npcs={Sim.npcCount}"