Skip to content

Commit

Permalink
More ownership fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
tmrodrig committed Dec 14, 2024
1 parent 97f621d commit 00f8276
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
19 changes: 19 additions & 0 deletions module/sohl-common.js
Original file line number Diff line number Diff line change
Expand Up @@ -2359,6 +2359,13 @@ export class SohlItem extends Item {
}
}

if (!("ownership" in newData)) {
newData.ownership = {
default: CONST.DOCUMENT_OWNERSHIP_LEVELS.OWNER,
[game.user.id]: CONST.DOCUMENT_OWNERSHIP_LEVELS.OWNER,
};
}

if (options.parent && !(options.parent instanceof SohlActor))
throw new Error("parent must always be an instance of SohlActor");

Expand Down Expand Up @@ -11084,6 +11091,12 @@ export class SohlActiveEffect extends ActiveEffect {
newData.img = CONFIG.controlIcons.effects;
}

if (!("ownership" in data)) {
newData.ownership = {
default: CONST.DOCUMENT_OWNERSHIP_LEVELS.OWNER,
};
}

// If nestedIn is specified, use update() on the nestedIn
if (options.parent?.nestedIn) {
const newAry = options.parent.nestedIn.effects.contents;
Expand Down Expand Up @@ -11637,6 +11650,12 @@ export class SohlMacro extends Macro {
if (!(data._id && context.keepId)) {
data._id = foundry.utils.randomID();
}

if (!("ownership" in data)) {
data.ownership = {
default: CONST.DOCUMENT_OWNERSHIP_LEVELS.OWNER,
};
}
const macro = new SohlMacro(data, context);
if (!macro) throw new Error(`Macro creation failed`);

Expand Down
4 changes: 2 additions & 2 deletions system.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"id": "sohl",
"title": "Song of Heroic Lands",
"description": "Song of Heroic Lands",
"version": "0.4.6",
"version": "0.4.7",
"authors": [
{
"name": "Toasty",
Expand Down Expand Up @@ -105,7 +105,7 @@
"background": "systems/sohl/assets/ui/sohl-background.webp",
"socket": true,
"manifest": "https://github.com/toastygm/Song-of-Heroic-Lands-FoundryVTT/releases/latest/download/system.json",
"download": "https://github.com/toastygm/Song-of-Heroic-Lands-FoundryVTT/releases/download/v0.4.6/system.zip",
"download": "https://github.com/toastygm/Song-of-Heroic-Lands-FoundryVTT/releases/download/v0.4.7/system.zip",
"grid": {
"distance": 5,
"units": "ft"
Expand Down

0 comments on commit 00f8276

Please sign in to comment.