@istarry/spoon-companion 0.9.3 → 0.9.4
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.
- package/lib/state.js +5 -3
- package/package.json +1 -1
package/lib/state.js
CHANGED
|
@@ -301,7 +301,9 @@ function tickDrives(state, now) {
|
|
|
301
301
|
const { missed, hour } = mealState(now)
|
|
302
302
|
const base = circadian(new Date(now))
|
|
303
303
|
const awake = !(hour >= SLEEP.from && hour < SLEEP.to)
|
|
304
|
-
|
|
304
|
+
// 从没记过"上次说话"时,不能当成"刚刚才说过" —— 那会让独处加成永远不触发。
|
|
305
|
+
const lastSocialAt = Number(drives.lastSocialAt) || 0
|
|
306
|
+
const idle = lastSocialAt > 0 ? (now - lastSocialAt) / HOUR : 24
|
|
305
307
|
|
|
306
308
|
if (awake) {
|
|
307
309
|
// 馋:只在下午茶和夜宵两个口子上来一点,其他时候几乎不动
|
|
@@ -310,9 +312,9 @@ function tickDrives(state, now) {
|
|
|
310
312
|
// 饿只是嘴馋的子项:涨得慢、封顶 0.85,不会再顶满一整天
|
|
311
313
|
drives.hunger = clamp01(Math.min(0.85, (drives.hunger ?? 0.1) + dt * (0.02 + missed * 0.015)))
|
|
312
314
|
}
|
|
313
|
-
//
|
|
315
|
+
// 困:醒着按作息涨,睡着了是真的在恢复(不是继续涨)
|
|
314
316
|
if (awake) drives.fatigue = clamp01(drives.fatigue + dt * (0.05 + base.sleepy * 0.12))
|
|
315
|
-
else drives.fatigue = clamp01(drives.fatigue
|
|
317
|
+
else drives.fatigue = clamp01(drives.fatigue - dt * 0.14)
|
|
316
318
|
|
|
317
319
|
// 黏:清醒时慢慢涨,六个小时没消息就涨得更快
|
|
318
320
|
if (awake) {
|
package/package.json
CHANGED