pygmalion 0.1.5 → 0.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -39,6 +39,12 @@ function live(text) {
39
39
  appendFileSync(LOG_FILE, line + '\n', 'utf8');
40
40
  }
41
41
 
42
+ // 内存级状态:所有需要跨重启保留的可变状态必须写在 pyg.state 上(如计数/进度/心情/已发生的事件),
43
+ // 插件会自动 checkpoint 到 life/.state-<脚本名>.json 并在重启后重新拉起时恢复 ——
44
+ // 重启前 pyg.state.ticks 是几,重启后还是几。不要用脚本顶层变量存重要状态(重启会丢)。
45
+ const ticks = (pyg.state.ticks ?? 0) + 1;
46
+ pyg.state.ticks = ticks;
47
+
42
48
  // 角色的一天:按当前时刻推进生活(这是演示骨架,dsh 应改成具体角色的真实生活)。
43
49
  function tick() {
44
50
  const h = new Date().getHours();