Skip to content

Commit

Permalink
[#4930] Set equipment created on vehicles as "Vehicle Equipment"
Browse files Browse the repository at this point in the history
Closes #4930
  • Loading branch information
arbron committed Jan 1, 2025
1 parent 03f2d22 commit 314fbdc
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions module/data/item/equipment.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,11 @@ export default class EquipmentData extends ItemDataModel.mixin(
async _preCreate(data, options, user) {
if ( (await super._preCreate(data, options, user)) === false ) return false;
await this.preCreateEquipped(data, options, user);

// Set type as "Vehicle Equipment" if created directly on a vehicle
if ( (this.parent.actor?.type === "vehicle") && !foundry.utils.hasProperty(data, "system.type.value") ) {
this.updateSource({ "type.value": "vehicle" });
}
}

/* -------------------------------------------- */
Expand Down

0 comments on commit 314fbdc

Please sign in to comment.