aboutsummaryrefslogtreecommitdiffstats
path: root/desktop/companion
diff options
context:
space:
mode:
Diffstat (limited to 'desktop/companion')
-rw-r--r--desktop/companion/Companion.qml2
-rw-r--r--desktop/companion/Mood.js11
-rw-r--r--desktop/companion/test_mood.js18
3 files changed, 19 insertions, 12 deletions
diff --git a/desktop/companion/Companion.qml b/desktop/companion/Companion.qml
index b9ae9fb..3102c59 100644
--- a/desktop/companion/Companion.qml
+++ b/desktop/companion/Companion.qml
@@ -244,7 +244,7 @@ PanelWindow {
clicks: root.clicks, admireAt: root.admireAt, mockAt: root.mockAt, typingAt: root.typingAt, wakeAt: root.wakeAt,
monologue: root.monologue, idle: root.idle,
})
- readonly property string outfit: Mood.outfit(root.destructAt, root.now)
+ readonly property string outfit: Mood.outfit(root.destructAt, root.now, Prefs.companionSkirtless * 1000)
// Anything above the monologue cuts it short.
onMoodChanged: if (root.monologue && root.mood.state !== "muse") root.stopMonologue()
diff --git a/desktop/companion/Mood.js b/desktop/companion/Mood.js
index c4df50b..409a958 100644
--- a/desktop/companion/Mood.js
+++ b/desktop/companion/Mood.js
@@ -31,7 +31,6 @@ var T = {
admireLook: 1500, // turned to the wallpaper, before the blush
admireBlush: 3000,
admireCooldown: 180000,
- skirtless: 60000,
};
function st(state, frame) { return { state: state, frame: frame }; }
@@ -79,12 +78,14 @@ function pick(s) {
}
// The self-destruct takes the skirt off once the flash is over, for the
-// scorched moment and the skirtless minute after it. Showing her again
-// sets destructAt back to 0, which restores it early.
-function outfit(destructAt, now) {
+// scorched moment and skirtless ms after it (Prefs.companionSkirtless),
+// or with 0 until she is shown again, which sets destructAt back to 0 and
+// also restores it early.
+function outfit(destructAt, now, skirtless) {
if (!destructAt) return "dress";
const since = now - destructAt;
- return since >= T.destruct && since < T.destruct + T.scorched + T.skirtless ? "leotard" : "dress";
+ if (since < T.destruct) return "dress";
+ return skirtless === 0 || since < T.destruct + T.scorched + skirtless ? "leotard" : "dress";
}
function mockAllowed(lastMockAt, now) { return now - lastMockAt >= T.mockCooldown; }
diff --git a/desktop/companion/test_mood.js b/desktop/companion/test_mood.js
index f24340c..37af2ea 100644
--- a/desktop/companion/test_mood.js
+++ b/desktop/companion/test_mood.js
@@ -99,12 +99,18 @@ assert.deepStrictEqual([1, 2, 3, 4, 5, 6].map(M.clickFrame),
// Outfit: the dress until the flash is over, then the leotard for
// scorched + skirtless, then the dress again.
-assert.strictEqual(M.outfit(0, NOW), "dress");
-assert.strictEqual(M.outfit(NOW - 10, NOW), "dress");
-assert.strictEqual(M.outfit(NOW - M.T.destruct, NOW), "leotard");
-const bare = M.T.destruct + M.T.scorched + M.T.skirtless;
-assert.strictEqual(M.outfit(NOW - bare + 10, NOW), "leotard");
-assert.strictEqual(M.outfit(NOW - bare, NOW), "dress");
+const SK = 60000;
+assert.strictEqual(M.outfit(0, NOW, SK), "dress");
+assert.strictEqual(M.outfit(NOW - 10, NOW, SK), "dress");
+assert.strictEqual(M.outfit(NOW - M.T.destruct, NOW, SK), "leotard");
+const bare = M.T.destruct + M.T.scorched + SK;
+assert.strictEqual(M.outfit(NOW - bare + 10, NOW, SK), "leotard");
+assert.strictEqual(M.outfit(NOW - bare, NOW, SK), "dress");
+// A skirtless time of 0 keeps the leotard until she is shown again, which
+// resets destructAt.
+assert.strictEqual(M.outfit(NOW - 10, NOW, 0), "dress");
+assert.strictEqual(M.outfit(NOW - 3600000, NOW, 0), "leotard");
+assert.strictEqual(M.outfit(0, NOW, 0), "dress");
// Cooldowns.
assert.strictEqual(M.mockAllowed(0, NOW), true);