Add a setting to make it so that range can be condensed on the Weapon sheet

This commit is contained in:
Oliver-Akins 2025-01-26 14:28:55 -07:00
parent 3cff9fda7d
commit 497756e8b1
3 changed files with 40 additions and 3 deletions

View file

@ -76,6 +76,10 @@
"abbrAccess": {
"name": "Abbreviate Access Names",
"hint": "Shortens the Access level names the way the book does. (e.g. \"Common\" becomes \"C\")"
},
"condensedRange": {
"name": "Condense Weapon Range Input",
"hint": "With this enabled, the weapon range will be displayed as \"X / Y\" when editing a weapon. While disabled it will be as displayed as two different rows, one for Short Range and one for Long Range"
}
},
"Apps": {

View file

@ -77,7 +77,27 @@ export class WeaponData extends CommonItemData {
path: `system.traits`,
value: this.traitString,
},
{
];
// Add the range inputs depending on whether the user wants condensed range
// or not.
if (game.settings.get(`ripcrypt`, `condensedRange`)) {
fields.push({
type: `bar`,
label: `RipCrypt.common.range`,
value: {
label: `RipCrypt.Apps.short-range`,
path: `system.range.short`,
value: this.range.short,
},
max: {
label: `RipCrypt.Apps.long-range`,
path: `system.range.long`,
value: this.range.long,
},
});
} else {
fields.push({
id: `short-range`,
type: `integer`,
label: `RipCrypt.Apps.short-range`,
@ -92,7 +112,10 @@ export class WeaponData extends CommonItemData {
path: `system.range.long`,
value: this.range.long ?? ``,
min: 0,
},
});
};
fields.push(
{
id: `damage`,
type: `integer`,
@ -135,7 +158,7 @@ export class WeaponData extends CommonItemData {
})),
],
},
];
);
if (this.parent.isEmbedded) {
fields.push({

View file

@ -10,4 +10,14 @@ export function registerUserSettings() {
default: false,
requiresReload: false,
});
game.settings.register(`ripcrypt`, `condensedRange`, {
name: `RipCrypt.setting.condensedRange.name`,
hint: `RipCrypt.setting.condensedRange.hint`,
scope: userScope,
type: Boolean,
config: true,
default: true,
requiresReload: false,
});
};