Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make some token settings configurable #53

Open
saif-ellafi opened this issue Apr 21, 2021 · 0 comments
Open

Make some token settings configurable #53

saif-ellafi opened this issue Apr 21, 2021 · 0 comments
Labels
enhancement New feature or request

Comments

@saif-ellafi
Copy link
Collaborator

Along making the token take an appropriate name, rather than the templates. It would also be great to configure the display visibility.

Hopefully this example helps

    game.settings.register("dark-heresy", "defaultTokenDisplay", {
        name: "Default token name display mode",
        hint: "Choose default behavior on hovering on token names.",
        scope: "world",
        config: true,
        type: String,
        default: CONST.TOKEN_DISPLAY_MODES.OWNER_HOVER,
        choices: {
          [CONST.TOKEN_DISPLAY_MODES.NONE]: "Never Displayed",
          [CONST.TOKEN_DISPLAY_MODES.CONTROL]: "When Controlled",
          [CONST.TOKEN_DISPLAY_MODES.OWNER_HOVER]: "Hovered by Owner",
          [CONST.TOKEN_DISPLAY_MODES.HOVER]: "Hovered by Anyone",
          [CONST.TOKEN_DISPLAY_MODES.OWNER]: "Always for Owner",
          [CONST.TOKEN_DISPLAY_MODES.ALWAYS]: "Always for Everyone"
        }
    });
Hooks.on("preCreateActor", (createData) => {
    mergeObject(createData, {
        "token.bar1" :{ "attribute" : "wounds" },
        "token.bar2" :{ "attribute" : "fatigue" },
        "token.displayName" : game.settings.get('dark-heresy', 'defaultTokenDisplay'),
        "token.displayBars" : CONST.TOKEN_DISPLAY_MODES.ALWAYS,
        "token.disposition" : CONST.TOKEN_DISPOSITIONS.NEUTRAL,
        "token.name" : createData.name
    });
    if (createData.type === "acolyte") {
        createData.token.vision = true;
        createData.token.actorLink = true;
    }
});
@PatrickBauer PatrickBauer added the enhancement New feature or request label Apr 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants