All user data for FoundryVTT. Includes worlds, systems, modules, and any asset in the "foundryuserdata" directory. Does NOT include the FoundryVTT installation itself.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

43 lines
1.1 KiB

1 year ago
  1. export const SYSTEM_ID = 'z-scatter';
  2. const settings = {
  3. snapTokens: {
  4. name: 'Snap Tokens',
  5. scope: 'world',
  6. config: false,
  7. type: Boolean,
  8. default: true,
  9. onChange: (value) => canvas.tokens.placeables.forEach((t) => t.refresh()),
  10. },
  11. scatter: {
  12. name: 'Scattering',
  13. hint: 'How much the tokens will scatter around?',
  14. scope: 'world',
  15. config: true,
  16. type: Number,
  17. default: 0.4,
  18. range: {
  19. min: 0.01,
  20. max: 1,
  21. step: 0.01,
  22. },
  23. },
  24. ignoreDead: {
  25. name: 'Ignore Special Cases',
  26. hint: 'Dead or incapacitated tokens will not be snapped.',
  27. scope: 'world',
  28. config: true,
  29. type: Boolean,
  30. default: true,
  31. },
  32. };
  33. export function getSetting(name) {
  34. return game.settings.get(SYSTEM_ID, name);
  35. }
  36. export function setSetting(name, value) {
  37. return game.settings.set(SYSTEM_ID, name, value);
  38. }
  39. Hooks.once('setup', () => {
  40. for (const [key, setting] of Object.entries(settings)) {
  41. game.settings.register(SYSTEM_ID, key, setting);
  42. }
  43. });