modules/sheets/ageSystemSpaceshipSheet.js
// Modification on standard _onDropItem() to prevent user from dropping Items other than Spaceship Features on Spaceships
Modification on standard _onDropItem() to prevent user from dropping Items other than Spaceship Features on Spaceships
Modification on standard _onDropItem () to prevent user from dropping Items other than Spaceship Features on Spaceships
async _onDropItem(event, data) {
        if ( !this.actor.owner ) return false;
        const item = await Item.fromDropData(data);
        if (item.data.type !== "shipfeatures") {
            let warning = game.i18n.localize("age-system.WARNING.nonShipPartsOnShip");
            ui.notifications.warn(warning);
            return false;
        }
        const itemData = duplicate(item.data);
        const actor = this.actor;
        let sameActor = (data.actorId === actor._id) || (actor.isToken && (data.tokenId === actor.token.id));
        if (sameActor) return this._onSortItem(event, itemData);
        return this._onDropItemCreate(itemData);
    }
async _onDropItem ( event , data ) { if ( ! this . actor . owner ) return false ; const item = await Item . fromDropData ( data ) ; if ( item . data . type !== "shipfeatures" ) { let warning = game . i18n . localize ( "age-system.WARNING.nonShipPartsOnShip" ) ; ui . notifications . warn ( warning ) ; return false ; } const itemData = duplicate ( item . data ) ; const actor = this . actor ; let sameActor = ( data . actorId === actor . _id ) || ( actor . isToken && ( data . tokenId === actor . token . id ) ) ; if ( sameActor ) return this . _onSortItem ( event , itemData ) ; return this . _onDropItemCreate ( itemData ) ; }
Modification on standard _onDropItem() to prevent user from dropping Items other than Spaceship Features on Spaceships
Modification on standard _onDropItem () to prevent user from dropping Items other than Spaceship Features on Spaceships
/*-----------Beginning of added code--------------*/ /*-------------End of added code------------------*/ // Handle item sorting within the same Actor // Create the owned item