Skip to content

Commit

Permalink
fix: save initiative state when resetting ac
Browse files Browse the repository at this point in the history
  • Loading branch information
valentine195 committed May 2, 2023
1 parent b8fb407 commit f362df1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
1 change: 1 addition & 0 deletions src/tracker/stores/tracker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -564,6 +564,7 @@ function createTracker() {
});
},
update: () => update((c) => c),
updateAndSave: () => updateAndSave((c) => c),
roll: (plugin: InitiativeTracker) =>
updateAndSave((creatures) => {
for (let creature of creatures) {
Expand Down
14 changes: 7 additions & 7 deletions src/tracker/ui/creatures/CreatureControls.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
HP,
MAPMARKER,
REMOVE,
TAG,
TAG
} from "src/utils";
import type { Creature } from "src/utils/creature";
import type TrackerView from "src/tracker/view";
Expand Down Expand Up @@ -42,7 +42,7 @@
.setTitle("Reset AC")
.onClick((e: MouseEvent) => {
creature.current_ac = creature.ac;
tracker.update();
tracker.updateAndSave();
});
});
}
Expand All @@ -60,7 +60,7 @@
.onClick(() => {
tracker.updateCreatures({
creature,
change: { hidden: false },
change: { hidden: false }
});
});
});
Expand All @@ -71,7 +71,7 @@
.onClick(() => {
tracker.updateCreatures({
creature,
change: { hidden: true },
change: { hidden: true }
});
});
});
Expand All @@ -83,7 +83,7 @@
.onClick(() => {
tracker.updateCreatures({
creature,
change: { enabled: false },
change: { enabled: false }
});
});
});
Expand All @@ -94,7 +94,7 @@
.onClick(() => {
tracker.updateCreatures({
creature,
change: { enabled: true },
change: { enabled: true }
});
});
});
Expand All @@ -112,7 +112,7 @@
item.onClick(() => {
tracker.updateCreatures({
creature,
change: { marker: marker.type },
change: { marker: marker.type }
});
});
});
Expand Down

0 comments on commit f362df1

Please sign in to comment.