Skip to content

Commit

Permalink
Make character optional for moves
Browse files Browse the repository at this point in the history
  • Loading branch information
cwegrzyn committed May 15, 2024
1 parent a7b06d1 commit e29f447
Show file tree
Hide file tree
Showing 9 changed files with 319 additions and 185 deletions.
2 changes: 1 addition & 1 deletion src/characters/meter-commands.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { updatePreviousMoveOrCreateBlock } from "mechanics/editor";
import { Editor } from "obsidian";
import { ConditionMeterDefinition } from "rules/ruleset";
import { MoveBlockFormat } from "settings/ui";
import { MoveBlockFormat } from "settings";
import { node } from "utils/kdl";
import { updating } from "utils/lens";
import { vaultProcess } from "utils/obsidian";
Expand Down
37 changes: 9 additions & 28 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,27 +1,24 @@
import { addAssetToCharacter } from "characters/commands";
import { generateEntityCommand } from "entity/command";
import { IndexManager } from "indexer/manager";
import { runMoveCommand } from "moves/action";
import {
Plugin,
type Editor,
type MarkdownFileInfo,
type MarkdownView,
} from "obsidian";
import { DEFAULT_SETTINGS, ForgedPluginSettings } from "settings";
import { ProgressContext } from "tracks/context";
import { ForgedAPI } from "./api";
import { CharacterIndexer, CharacterTracker } from "./character-tracker";
import * as meterCommands from "./characters/meter-commands";
import { Datastore } from "./datastore";
import registerMechanicsBlock from "./mechanics/mechanics-blocks";
import { runMoveCommand } from "./moves/action";
import { registerMoveBlock } from "./moves/block";
import { runOracleCommand } from "./oracles/command";
import { registerOracleBlock } from "./oracles/render";
import {
DEFAULT_SETTINGS,
ForgedPluginSettings,
ForgedSettingTab,
} from "./settings/ui";
import { ForgedSettingTab } from "./settings/ui";
import { ClockIndex, ClockIndexer } from "./tracks/clock-file";
import {
advanceClock,
Expand Down Expand Up @@ -95,38 +92,22 @@ export default class ForgedPlugin extends Plugin {
id: "make-a-move",
name: "Make a Move",
icon: "zap",
editorCallback: async (
editor: Editor,
view: MarkdownView | MarkdownFileInfo,
) => {
// TODO: what if it is just a fileinfo?
await runMoveCommand(
this.app,
this.datastore,
new ProgressContext(this),
this.characters,
editor,
view as MarkdownView,
this.settings,
);
},
editorCallback: (editor: Editor, view: MarkdownView | MarkdownFileInfo) =>
// TODO: what if view is just a fileinfo?
runMoveCommand(this, editor, view as MarkdownView),
});

this.addCommand({
id: "ask-the-oracle",
name: "Ask the Oracle",
icon: "help-circle",
editorCallback: async (
editor: Editor,
view: MarkdownView | MarkdownFileInfo,
) => {
await runOracleCommand(
editorCallback: (editor: Editor, view: MarkdownView | MarkdownFileInfo) =>
runOracleCommand(
this.app,
this.datastore,
editor,
view as MarkdownView,
);
},
),
});

this.addCommand({
Expand Down
2 changes: 1 addition & 1 deletion src/moves/action/format.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Document, Node } from "kdljs";
import { Editor, stringifyYaml } from "obsidian";
import { MoveBlockFormat } from "settings";
import { createOrAppendMechanics } from "../../mechanics/editor";
import { MoveBlockFormat } from "../../settings/ui";
import { node } from "../../utils/kdl";
import { MoveDescription, moveIsAction, moveIsProgress } from "../desc";
import { generateMoveLine } from "../move-line-parser";
Expand Down
Loading

0 comments on commit e29f447

Please sign in to comment.