Skip to content

Commit

Permalink
fix: Starting a new encounter from an Encounter block now correctly c…
Browse files Browse the repository at this point in the history
…reates a new log file
  • Loading branch information
valentine195 committed Jun 2, 2024
1 parent 82a8faf commit c6756ce
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/builder/view/encounter/Encounter.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@
round: 1,
state: false,
logFile: null,
newLog: true,
roll: true,
rollHP
});
Expand Down
3 changes: 2 additions & 1 deletion src/encounter/ui/Encounter.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@
state: false,
logFile: null,
roll: true,
rollHP
rollHP,
newLog: true
});
plugin.app.workspace.revealLeaf(view.leaf);
};
Expand Down
3 changes: 2 additions & 1 deletion src/encounter/ui/EncounterLine.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@
state: false,
round: 1,
logFile: null,
roll: true
newLog: true,
roll: true,
});
plugin.app.workspace.revealLeaf(view.leaf);
};
Expand Down
1 change: 1 addition & 0 deletions src/encounter/ui/EncounterRow.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
round: 1,
state: false,
logFile: null,
newLog: true,
roll: true,
rollHP
});
Expand Down
2 changes: 1 addition & 1 deletion src/tracker/stores/tracker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -791,7 +791,7 @@ function createTracker() {
$logFile.set(_logger.getFile());
});
}
if (!state && _logger) {
if (!state && _logger || state?.newLog) {
_logger.logging = false;
$logFile.set(null);
}
Expand Down
1 change: 1 addition & 0 deletions src/tracker/view.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export interface InitiativeViewState {
name: string;
round: number;
logFile: string;
newLog?: boolean;
roll?: boolean;
rollHP?: boolean;
timestamp?: number;
Expand Down

0 comments on commit c6756ce

Please sign in to comment.