Last active
September 1, 2021 15:03
-
-
Save BoltsJ/3165f5ded9dd49103c1752e82e458431 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*************************************************************** | |
* This has been deprecated and does not support lancer 1.0.0+ * | |
***************************************************************/ | |
// Bar Brawl Default Config | |
Hooks.on("preCreateToken", function(_scene, data) { | |
const actor = game.actors.get(data.actorId); | |
data.flags.barbrawl = data.flags.barbrawl ?? {}; | |
const token_bars = data.flags.barbrawl?.resourceBars ?? {}; | |
let def_bars = {}; | |
switch (actor.data.type) { | |
case "deployable": | |
def_bars = { | |
"bar1": { | |
id: "bar1", | |
mincolor: "#FF0000", | |
maxcolor: "#80FF00", | |
position: "bottom-inner", | |
attribute: "hp", | |
visibility: CONST.TOKEN_DISPLAY_MODES.HOVER | |
} | |
} | |
break; | |
case "pilot": | |
case "npc": | |
def_bars = { | |
"bar1": { | |
id: "bar1", | |
ignoreMax: false, | |
ignoreMin: true, | |
mincolor: "#FF0000", | |
maxcolor: "#80FF00", | |
position: "bottom-inner", | |
attribute: "mech.hp", | |
visibility: CONST.TOKEN_DISPLAY_MODES.HOVER | |
}, | |
"bar2": { | |
id: "bar2", | |
ignoreMax: true, | |
ignoreMin: false, | |
mincolor: "#700000", | |
maxcolor: "#ff0000", | |
position: "bottom-inner", | |
attribute: "mech.heat", | |
visibility: CONST.TOKEN_DISPLAY_MODES.HOVER | |
} | |
}; | |
break; | |
default: | |
} | |
data.flags.barbrawl.resourceBars = mergeObject(def_bars, token_bars); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Save this script in the directory for your game world and add the path (relative to the json file) to the
esmodules
array in your world.json, then edit the defaults to your preferences. Once the changes have been made, restart foundry.Example:
More information: https://foundryvtt.wiki/en/basics/world-scripts