Skip to content

Commit cec76b2

Browse files
committed
add ability to manually reset logs, remove dead code from create character scene
1 parent 9cb0d28 commit cec76b2

File tree

10 files changed

+45
-151
lines changed

10 files changed

+45
-151
lines changed

src/credits/FakeCreditsScene.vue

-74
This file was deleted.

src/engine/console/Console.store.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ const store = useEntityStore("Console", {
1313
characterIndex: -1,
1414
});
1515

16+
export const resetLogs = () => store.patch({ entities: [] });
17+
1618
export function useConsoleStore() {
1719
const {
1820
active: activeScene,
@@ -34,7 +36,7 @@ export function useConsoleStore() {
3436

3537
if (activeScene.value) {
3638
activeScene.value.emit("init");
37-
store.patch({ entities: [] });
39+
resetLogs();
3840
onNextLog();
3941
}
4042
}
@@ -55,6 +57,7 @@ export function useConsoleStore() {
5557
}
5658

5759
function setNextLog(log: SceneLog) {
60+
log.component.emit?.("init");
5861
store.add({ ...log, textItems: log.type === "log" ? [] : undefined });
5962
store.setActive(log.id);
6063

src/engine/scenes/scene/input-label/SceneInputLabel.vue

+4
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,9 @@ import { useLog } from '../log/use-log';
66
77
defineProps(logProps);
88
9+
defineEmits<{
10+
(e: "init"): void,
11+
}>();
12+
913
useLog({ color: "info" });
1014
</script>

src/engine/scenes/scene/input/SceneInput.vue

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ const props = withDefaults(defineProps<{
1111
}>(), { condition: undefined });
1212
1313
const emit = defineEmits<{
14+
(e: "init"): void;
1415
(e: "submit", v: string): void;
1516
}>();
1617

src/engine/scenes/scene/log/SceneLog.vue

+4
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,9 @@ import { useLog } from '../log/use-log';
66
77
defineProps(logProps);
88
9+
defineEmits<{
10+
(e: "init"): void,
11+
}>();
12+
913
useLog();
1014
</script>

src/engine/scenes/scene/select/SceneSelect.vue

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ const props = withDefaults(defineProps<{
1212
}>(), { condition: undefined });
1313
1414
const emit = defineEmits<{
15+
(e: "init"): void;
1516
(e: "submit", v: string): void;
1617
}>();
1718

src/engine/scenes/state/scene.model.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@ export interface SceneLog {
1515
type: SceneLogType;
1616
component: {
1717
slot?: Slot,
18-
emit?: (e: "submit", v: string) => void,
18+
emit?: {
19+
(e: "init"): void;
20+
(e: "submit", v: string): void;
21+
}
1922
props: any,
2023
},
2124
textItems?: SceneText[];

src/game/Game.vue

-3
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
<Office />
66

77
<CreditsScene />
8-
9-
<FakeCreditsScene />
108
</Engine>
119
</template>
1210

@@ -15,7 +13,6 @@ import Engine from "../engine/Engine.vue";
1513
import Prologue from "../prologue/Prologue.vue";
1614
import Office from "../office/Office.vue";
1715
import CreditsScene from "../credits/CreditsScene.vue";
18-
import FakeCreditsScene from "../credits/FakeCreditsScene.vue";
1916
</script>
2017

2118
<style>
Original file line numberDiff line numberDiff line change
@@ -1,69 +1,5 @@
11
<template>
22
<Scene name="createCharacter" @finish="setActive('intro')">
3-
<template v-if="incorrectAccusation">
4-
<SceneLog>
5-
Well, well, if it isn't our hero detective!
6-
</SceneLog>
7-
8-
<SceneLog>
9-
What's wrong? Feeling a bit <SceneText :bounce="true" color="danger">awful</SceneText> about what happened to {{ incorrectAccusation}}?
10-
</SceneLog>
11-
12-
<SceneLog>
13-
Why? Surely, with your unrivaled powers of deduction, you would have solved the case the first time.
14-
</SceneLog>
15-
16-
<SceneInputLabel>
17-
You're not having second thoughts, are you?
18-
</SceneInputLabel>
19-
20-
<SceneSelect @submit="secondThoughtsValue = $event">
21-
<SceneSelectOption value="yes">
22-
Maybe...
23-
</SceneSelectOption>
24-
25-
<SceneSelectOption value="no">
26-
What? No, of course not! {{ incorrectAccusation }} was a menace who needed to be stopped!
27-
</SceneSelectOption>
28-
</SceneSelect>
29-
30-
<SceneLog :condition="secondThoughtsValue === 'no'">
31-
Ok good! Back to the credits with you!
32-
</SceneLog>
33-
34-
<SceneInputLabel>
35-
Press 'Enter' to Continue...
36-
</SceneInputLabel>
37-
38-
<SceneInput hide @submit="setActive('fakeCredits')" />
39-
40-
<SceneLog>
41-
Oh dear. How dreadful. Poor {{ incorrectAccusation }}, fired for no good reason.
42-
</SceneLog>
43-
44-
<SceneLog>
45-
This is <SceneText color="danger">your</SceneText> fault.
46-
</SceneLog>
47-
48-
<SceneLog>
49-
Oh well. Hope you're prepared to stomach this miscarriage of justice for the rest of your life!
50-
</SceneLog>
51-
52-
<SceneLog>
53-
Unless... there were a way to reset time? To go back to before your recklessly accussed {{ incorrectAccusation }} and got them fired.
54-
</SceneLog>
55-
56-
<SceneLog>
57-
Fortunately for you, <SceneText size="large">I</SceneText> possess this power.
58-
</SceneLog>
59-
60-
<SceneInputLabel>
61-
Press 'Enter' to... reset time?
62-
</SceneInputLabel>
63-
64-
<SceneInput hide @submit="onResetTime" />
65-
</template>
66-
673
<SceneInputLabel id="nameLabel">
684
What is your name?
695
</SceneInputLabel>
@@ -127,7 +63,7 @@ import indefinite from "indefinite";
12763
12864
const { setActive } = useScenesStore();
12965
130-
const { playerName, incorrectAccusation } = useGameStore();
66+
const { playerName } = useGameStore();
13167
13268
const jobs = [
13369
engineer,
@@ -144,14 +80,8 @@ const skills: { name: string, key: keyof Job }[] = [
14480
];
14581
14682
const selectedJob = ref<Job | undefined>(undefined);
147-
const secondThoughtsValue = ref("");
14883
14984
const onJobSelect = (name: string) => {
15085
selectedJob.value = jobs.find(j => j.name === name);
15186
}
152-
153-
const onResetTime = () => {
154-
incorrectAccusation.value = undefined;
155-
setActive('arrival');
156-
}
15787
</script>

src/prologue/incorrect-accusation/IncorrectAccusatonScene.vue

+26-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,31 @@
3434
Press 'Enter' to Continue...
3535
</SceneInputLabel>
3636

37-
<SceneInput :condition="secondThoughtsValue === 'no'" hide @submit="setActive('fakeCredits')" />
37+
<SceneInput :condition="secondThoughtsValue === 'no'" hide />
38+
39+
<SceneLog @init="resetLogs" :condition="secondThoughtsValue === 'no'" size="large" :margin="{ bottom: 'large' }">
40+
Night of a THOUSA...
41+
</SceneLog>
42+
43+
<SceneSelect :condition="secondThoughtsValue === 'no'">
44+
<SceneSelectOption value="wait">
45+
Wait!
46+
</SceneSelectOption>
47+
</SceneSelect>
48+
49+
<SceneLog :condition="secondThoughtsValue === 'no'">
50+
What?!
51+
</SceneLog>
52+
53+
<SceneSelect :condition="secondThoughtsValue === 'no'">
54+
<SceneSelectOption value="wait">
55+
OK fine, maybe I'm not sure it was {{ incorrectAccusation }}
56+
</SceneSelectOption>
57+
</SceneSelect>
58+
59+
<SceneLog :condition="secondThoughtsValue === 'no'" color="danger" size="large" :bounce="true">
60+
REALLY?!
61+
</SceneLog>
3862

3963
<SceneLog>
4064
Oh dear. How dreadful. Poor {{ incorrectAccusation }}, fired for no good reason.
@@ -75,6 +99,7 @@ import SceneSelect from '../../engine/scenes/scene/select/SceneSelect.vue';
7599
import SceneSelectOption from '../../engine/scenes/scene/select/option/SceneSelectOption.vue';
76100
import SceneInput from '../../engine/scenes/scene/input/SceneInput.vue';
77101
import SceneText from '../../engine/scenes/scene/text/SceneText.vue';
102+
import { resetLogs } from '../../engine/console/Console.store';
78103
79104
const { setActive } = useScenesStore();
80105

0 commit comments

Comments
 (0)