mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-17 15:39:02 +01:00
remove superfluous comments
This commit is contained in:
parent
76f44b9ca6
commit
76c5dc2404
2 changed files with 0 additions and 16 deletions
|
|
@ -56,7 +56,6 @@ export default class ArmorSheet extends DHBaseItemSheet {
|
||||||
context.features = this.document.system.features.map(x => x.value);
|
context.features = this.document.system.features.map(x => x.value);
|
||||||
break;
|
break;
|
||||||
case 'attachments':
|
case 'attachments':
|
||||||
// Prepare attached items for display
|
|
||||||
const attachedUUIDs = this.document.system.attached || [];
|
const attachedUUIDs = this.document.system.attached || [];
|
||||||
context.attachedItems = await Promise.all(
|
context.attachedItems = await Promise.all(
|
||||||
attachedUUIDs.map(async uuid => {
|
attachedUUIDs.map(async uuid => {
|
||||||
|
|
@ -89,23 +88,18 @@ export default class ArmorSheet extends DHBaseItemSheet {
|
||||||
async _onDrop(event) {
|
async _onDrop(event) {
|
||||||
const data = TextEditor.getDragEventData(event);
|
const data = TextEditor.getDragEventData(event);
|
||||||
|
|
||||||
// Check if dropped on attachments section
|
|
||||||
const attachmentsSection = event.target.closest('.attachments-section');
|
const attachmentsSection = event.target.closest('.attachments-section');
|
||||||
if (!attachmentsSection) return super._onDrop(event);
|
if (!attachmentsSection) return super._onDrop(event);
|
||||||
|
|
||||||
// Prevent event bubbling
|
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
|
|
||||||
// Get the item being dropped
|
|
||||||
const item = await Item.implementation.fromDropData(data);
|
const item = await Item.implementation.fromDropData(data);
|
||||||
if (!item) return;
|
if (!item) return;
|
||||||
|
|
||||||
// Get current attached UUIDs
|
|
||||||
const currentAttached = this.document.system.attached || [];
|
const currentAttached = this.document.system.attached || [];
|
||||||
const newUUID = item.uuid;
|
const newUUID = item.uuid;
|
||||||
|
|
||||||
// Don't attach if already attached
|
|
||||||
if (currentAttached.includes(newUUID)) {
|
if (currentAttached.includes(newUUID)) {
|
||||||
ui.notifications.warn(`${item.name} is already attached to this armor.`);
|
ui.notifications.warn(`${item.name} is already attached to this armor.`);
|
||||||
return;
|
return;
|
||||||
|
|
@ -155,12 +149,10 @@ export default class ArmorSheet extends DHBaseItemSheet {
|
||||||
const uuid = target.dataset.uuid;
|
const uuid = target.dataset.uuid;
|
||||||
const currentAttached = this.document.system.attached || [];
|
const currentAttached = this.document.system.attached || [];
|
||||||
|
|
||||||
// Remove the attachment from the armor
|
|
||||||
await this.document.update({
|
await this.document.update({
|
||||||
'system.attached': currentAttached.filter(attachedUuid => attachedUuid !== uuid)
|
'system.attached': currentAttached.filter(attachedUuid => attachedUuid !== uuid)
|
||||||
});
|
});
|
||||||
|
|
||||||
// Remove any effects on the actor that came from this attached item
|
|
||||||
const actor = this.document.parent;
|
const actor = this.document.parent;
|
||||||
if (actor) {
|
if (actor) {
|
||||||
const effectsToRemove = actor.effects.filter(effect => {
|
const effectsToRemove = actor.effects.filter(effect => {
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,6 @@ export default class WeaponSheet extends DHBaseItemSheet {
|
||||||
context.systemFields.attack.fields = this.document.system.attack.schema.fields;
|
context.systemFields.attack.fields = this.document.system.attack.schema.fields;
|
||||||
break;
|
break;
|
||||||
case 'attachments':
|
case 'attachments':
|
||||||
// Prepare attached items for display
|
|
||||||
const attachedUUIDs = this.document.system.attached || [];
|
const attachedUUIDs = this.document.system.attached || [];
|
||||||
context.attachedItems = await Promise.all(
|
context.attachedItems = await Promise.all(
|
||||||
attachedUUIDs.map(async uuid => {
|
attachedUUIDs.map(async uuid => {
|
||||||
|
|
@ -89,23 +88,18 @@ export default class WeaponSheet extends DHBaseItemSheet {
|
||||||
async _onDrop(event) {
|
async _onDrop(event) {
|
||||||
const data = TextEditor.getDragEventData(event);
|
const data = TextEditor.getDragEventData(event);
|
||||||
|
|
||||||
// Check if dropped on attachments section
|
|
||||||
const attachmentsSection = event.target.closest('.attachments-section');
|
const attachmentsSection = event.target.closest('.attachments-section');
|
||||||
if (!attachmentsSection) return super._onDrop(event);
|
if (!attachmentsSection) return super._onDrop(event);
|
||||||
|
|
||||||
// Prevent event bubbling
|
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
|
|
||||||
// Get the item being dropped
|
|
||||||
const item = await Item.implementation.fromDropData(data);
|
const item = await Item.implementation.fromDropData(data);
|
||||||
if (!item) return;
|
if (!item) return;
|
||||||
|
|
||||||
// Get current attached UUIDs
|
|
||||||
const currentAttached = this.document.system.attached || [];
|
const currentAttached = this.document.system.attached || [];
|
||||||
const newUUID = item.uuid;
|
const newUUID = item.uuid;
|
||||||
|
|
||||||
// Don't attach if already attached
|
|
||||||
if (currentAttached.includes(newUUID)) {
|
if (currentAttached.includes(newUUID)) {
|
||||||
ui.notifications.warn(`${item.name} is already attached to this weapon.`);
|
ui.notifications.warn(`${item.name} is already attached to this weapon.`);
|
||||||
return;
|
return;
|
||||||
|
|
@ -139,12 +133,10 @@ export default class WeaponSheet extends DHBaseItemSheet {
|
||||||
const uuid = target.dataset.uuid;
|
const uuid = target.dataset.uuid;
|
||||||
const currentAttached = this.document.system.attached || [];
|
const currentAttached = this.document.system.attached || [];
|
||||||
|
|
||||||
// Remove the attachment from the weapon
|
|
||||||
await this.document.update({
|
await this.document.update({
|
||||||
'system.attached': currentAttached.filter(attachedUuid => attachedUuid !== uuid)
|
'system.attached': currentAttached.filter(attachedUuid => attachedUuid !== uuid)
|
||||||
});
|
});
|
||||||
|
|
||||||
// Remove any effects on the actor that came from this attached item
|
|
||||||
await removeAttachmentEffectsFromActor({
|
await removeAttachmentEffectsFromActor({
|
||||||
parentItem: this.document,
|
parentItem: this.document,
|
||||||
attachedUuid: uuid,
|
attachedUuid: uuid,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue