mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-11 19:25:21 +01:00
[PR][Feature] Actor Sizes (#1433)
* Added support for adversary actor sizes * . * . * Finished token implementation * Fixed token-config * Updated SRD adversaries * . * Added size to Beastform tokenData * Fixed sizing for evolved beastforms * Beastform compendium update * .
This commit is contained in:
parent
7926c614e3
commit
8178fa5738
176 changed files with 1198 additions and 203 deletions
|
|
@ -44,6 +44,7 @@ export default class DhHomebrewSettings extends HandlebarsApplicationMixin(Appli
|
|||
deleteAdversaryType: this.deleteAdversaryType,
|
||||
selectAdversaryType: this.selectAdversaryType,
|
||||
save: this.save,
|
||||
resetTokenSizes: this.resetTokenSizes,
|
||||
reset: this.reset
|
||||
},
|
||||
form: { handler: this.updateData, submitOnChange: true }
|
||||
|
|
@ -424,6 +425,14 @@ export default class DhHomebrewSettings extends HandlebarsApplicationMixin(Appli
|
|||
this.close();
|
||||
}
|
||||
|
||||
static async resetTokenSizes() {
|
||||
await this.settings.updateSource({
|
||||
tokenSizes: this.settings.schema.fields.tokenSizes.initial
|
||||
});
|
||||
|
||||
this.render();
|
||||
}
|
||||
|
||||
static async reset() {
|
||||
const confirmed = await foundry.applications.api.DialogV2.confirm({
|
||||
window: {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,18 @@
|
|||
export default class DhPrototypeTokenConfig extends foundry.applications.sheets.PrototypeTokenConfig {
|
||||
/** @override */
|
||||
static PARTS = {
|
||||
tabs: super.PARTS.tabs,
|
||||
identity: super.PARTS.identity,
|
||||
appearance: {
|
||||
template: 'systems/daggerheart/templates/sheets-settings/token-config/appearance.hbs',
|
||||
scrollable: ['']
|
||||
},
|
||||
vision: super.PARTS.vision,
|
||||
light: super.PARTS.light,
|
||||
resources: super.PARTS.resources,
|
||||
footer: super.PARTS.footer
|
||||
};
|
||||
|
||||
/** @inheritDoc */
|
||||
async _prepareResourcesTab() {
|
||||
const token = this.token;
|
||||
|
|
@ -17,4 +31,11 @@ export default class DhPrototypeTokenConfig extends foundry.applications.sheets.
|
|||
turnMarkerAnimations: CONFIG.Combat.settings.turnMarkerAnimations
|
||||
};
|
||||
}
|
||||
|
||||
async _prepareAppearanceTab() {
|
||||
const context = await super._prepareAppearanceTab();
|
||||
context.actorSizeUsed = this.token.actor ? Boolean(this.token.actor.system.size) : false;
|
||||
|
||||
return context;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,18 @@
|
|||
export default class DhTokenConfig extends foundry.applications.sheets.TokenConfig {
|
||||
/** @override */
|
||||
static PARTS = {
|
||||
tabs: super.PARTS.tabs,
|
||||
identity: super.PARTS.identity,
|
||||
appearance: {
|
||||
template: 'systems/daggerheart/templates/sheets-settings/token-config/appearance.hbs',
|
||||
scrollable: ['']
|
||||
},
|
||||
vision: super.PARTS.vision,
|
||||
light: super.PARTS.light,
|
||||
resources: super.PARTS.resources,
|
||||
footer: super.PARTS.footer
|
||||
};
|
||||
|
||||
/** @inheritDoc */
|
||||
async _prepareResourcesTab() {
|
||||
const token = this.token;
|
||||
|
|
@ -17,4 +31,11 @@ export default class DhTokenConfig extends foundry.applications.sheets.TokenConf
|
|||
turnMarkerAnimations: CONFIG.Combat.settings.turnMarkerAnimations
|
||||
};
|
||||
}
|
||||
|
||||
async _prepareAppearanceTab() {
|
||||
const context = await super._prepareAppearanceTab();
|
||||
context.actorSizeUsed = this.token.actor ? Boolean(this.token.actor.system.size) : false;
|
||||
|
||||
return context;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -77,6 +77,7 @@ export default class BeastformSheet extends DHBaseItemSheet {
|
|||
name: context.document.system.advantageOn[key].value
|
||||
}))
|
||||
);
|
||||
context.dimensionsDisabled = context.document.system.tokenSize.size !== 'custom';
|
||||
break;
|
||||
case 'effects':
|
||||
context.effects.actives = context.effects.actives.map(effect => {
|
||||
|
|
|
|||
|
|
@ -17,4 +17,30 @@ export default class DhActorDirectory extends foundry.applications.sidebar.tabs.
|
|||
: null;
|
||||
};
|
||||
}
|
||||
|
||||
/** @inheritDoc */
|
||||
_onDragStart(event) {
|
||||
let actor;
|
||||
const { entryId } = event.currentTarget.dataset;
|
||||
if (entryId) {
|
||||
actor = this.collection.get(entryId);
|
||||
if (!actor?.visible) return false;
|
||||
}
|
||||
super._onDragStart(event);
|
||||
|
||||
// Create the drag preview.
|
||||
if (actor && canvas.ready) {
|
||||
const img = event.currentTarget.querySelector('img');
|
||||
const pt = actor.prototypeToken;
|
||||
const usesSize = actor.system.metadata.usesSize;
|
||||
const tokenSizes = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Homebrew).tokenSizes;
|
||||
const width = usesSize ? tokenSizes[actor.system.size] : pt.width;
|
||||
const height = usesSize ? tokenSizes[actor.system.size] : pt.height;
|
||||
|
||||
const w = width * canvas.dimensions.size * Math.abs(pt.texture.scaleX) * canvas.stage.scale.x;
|
||||
const h = height * canvas.dimensions.size * Math.abs(pt.texture.scaleY) * canvas.stage.scale.y;
|
||||
const preview = foundry.applications.ux.DragDrop.implementation.createDragImage(img, w, h);
|
||||
event.dataTransfer.setDragImage(preview, w / 2, h / 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue