Skip to content

Commit

Permalink
[#893] Add Allow Summoning system setting
Browse files Browse the repository at this point in the history
  • Loading branch information
arbron committed Mar 18, 2024
1 parent a65f9d8 commit 5d52fff
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
8 changes: 6 additions & 2 deletions lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1434,9 +1434,9 @@
"Hint": "Disable the summoning prompt when item is used. Players will still be able to summon from the chat card."
},
"Warning": {
"CreateActor": "You must have 'Create New Actors' permission in order to summon directly a compendium.",
"CreateActor": "You must have 'Create New Actors' permission in order to summon directly from a compendium.",
"NoActor": "Actor cannot be found with UUID '{uuid}' to summon.",
"NoOwnership": "You do not have ownership of '{actor}' which you must have to summon it.",
"NoOwnership": "You must have ownership of '{actor}' in order to summon it.",
"NoProfile": "Cannot find summoning profile {profileId} on '{item}'.",
"Wildcard": "You must have 'Use File Browser' permissions to summon creatures with wildcard artwork."
}
Expand Down Expand Up @@ -1773,6 +1773,10 @@
"Hint": "Disabling the token ring animations can improve performance."
},
"SETTINGS.DND5E": {
"ALLOWSUMMONING": {
"Name": "Allow Summoning",
"Hint": "Allow players to use summoning abilities to summon actors. Players must also have the Create Token core permission for this to work."
},
"THEME": {
"Name": "Theme",
"Hint": "Theme that will apply to the UI and all sheets by default. Automatic will be determined by your browser or operating system settings. Can be overridden on a sheet-by-sheet basis."
Expand Down
2 changes: 1 addition & 1 deletion module/data/item/fields/summons-field.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export class SummonsData extends foundry.abstract.DataModel {
* @type {boolean}
*/
static get canSummon() {
return game.user.can("TOKEN_CREATE");
return game.user.can("TOKEN_CREATE") && (game.user.isGM || game.settings.get("dnd5e", "allowSummoning"));
}

get canSummon() {
Expand Down
10 changes: 10 additions & 0 deletions module/settings.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,16 @@ export function registerSystemSettings() {
}
});

// Allow Summoning
game.settings.register("dnd5e", "allowSummoning", {
name: "SETTINGS.DND5E.ALLOWSUMMONING.Name",
hint: "SETTINGS.DND5E.ALLOWSUMMONING.Hint",
scope: "world",
config: true,
default: false,
type: Boolean
});

// Metric Unit Weights
game.settings.register("dnd5e", "metricWeightUnits", {
name: "SETTINGS.5eMetricN",
Expand Down

0 comments on commit 5d52fff

Please sign in to comment.