Skip to content

Commit

Permalink
Add setting to control whether walls are created. (#127)
Browse files Browse the repository at this point in the history
  • Loading branch information
mcglincy authored Apr 8, 2024
1 parent 4e3b6da commit 62e5d13
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 4 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# 2.3.0

- Add setting for toggling Foundry wall creation.

# 2.2.0

- Move sidebar to subcontrols so that DungeonDraw will not conflict with the camera views [ by @tvandort ]

# 2.1.0

- Resolve issue with Sequencer by using PIXI filters lib included with Foundry (by IHaveThePower).
Expand Down
1 change: 1 addition & 0 deletions lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
"DD.ResetToDefaults": "Reset to Defaults",
"DD.RoomCount": "Room Count",
"DD.SettingAllowTrustedPlayers": "Allow Trusted Players",
"DD.SettingMakeFoundryWalls": "Make Foundry Walls",
"DD.SettingSnapToGrid": "Snap to grid",
"DD.SettingSupport3DCanvas": "Enable support for 3D Canvas module",
"DD.SceneBackgroundColor": "Scene Background Color",
Expand Down
2 changes: 1 addition & 1 deletion modules/dungeondraw-bundle.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion modules/dungeondraw-bundle.min.js.map

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions src/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export const FLAG_DUNGEON_STATE = "dungeonState";
export const SETTING_ALLOW_TRUSTED_PLAYER = "allowTrustedPlayer";
export const SETTING_3DCANVAS_ENABLED = "3DCanvasEnabled";
export const SETTING_CUSTOM_THEMES = "customThemes";
export const SETTING_MAKE_FOUNDRY_WALLS = "makeFoundryWalls";
export const SETTING_RELEASE_NOTES_VERSION = "releaseNotesVersion";
export const SETTING_SNAP_TO_GRID = "snapToGrid";
export const SETTING_THEME_PAINTER_THEME = "themePainterTheme";
7 changes: 5 additions & 2 deletions src/dungeonstate.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { FLAG_DUNGEON_STATE, MODULE_NAME } from "./constants.js";
import { Settings } from "./settings.js";
import { makeWalls } from "./wallmaker.js";
import * as geo from "./geo-utils.js";
import { defaultConfig } from "./themes.js";
Expand Down Expand Up @@ -84,8 +85,10 @@ export class DungeonState {

async saveToJournalEntry(journalEntry) {
const serialized = this.toString();
// update walls before we update the journal
await makeWalls(this);
if (Settings.makeFoundryWalls()) {
// update walls before we update the journal
await makeWalls(this);
}
await journalEntry.setFlag(MODULE_NAME, FLAG_DUNGEON_STATE, serialized);
}

Expand Down
18 changes: 18 additions & 0 deletions src/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,17 @@ export class Settings {
config: false,
}
);
game.settings.register(
constants.MODULE_NAME,
constants.SETTING_MAKE_FOUNDRY_WALLS,
{
name: game.i18n.localize("DD.SettingMakeFoundryWalls"),
scope: "world",
default: true,
type: Boolean,
config: true,
}
);
}

static threeDCanvasEnabled() {
Expand All @@ -87,4 +98,11 @@ export class Settings {
constants.SETTING_SNAP_TO_GRID
);
}

static makeFoundryWalls() {
return game.settings.get(
constants.MODULE_NAME,
constants.SETTING_MAKE_FOUNDRY_WALLS
);
}
}

0 comments on commit 62e5d13

Please sign in to comment.