FIX: individual init restored
parent
331cb690c6
commit
a684e456c5
Binary file not shown.
|
@ -6,6 +6,7 @@ export const registerSettings = function () {
|
||||||
scope: "world",
|
scope: "world",
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
config: true,
|
config: true,
|
||||||
|
onChange: _ => window.location.reload()
|
||||||
});
|
});
|
||||||
|
|
||||||
game.settings.register("ose", "ascendingAC", {
|
game.settings.register("ose", "ascendingAC", {
|
||||||
|
|
22
src/ose.js
22
src/ose.js
|
@ -81,14 +81,22 @@ Hooks.once("ready", async () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
Hooks.on("preCreateCombatant", (combat, data, options, id) => {
|
Hooks.on("preCreateCombatant", (combat, data, options, id) => {
|
||||||
OseCombat.addCombatant(combat, data, options, id);
|
let init = game.settings.get("ose", "individualInit");
|
||||||
|
if (!init) {
|
||||||
|
OseCombat.addCombatant(combat, data, options, id);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Hooks.on("preUpdateCombatant", (combat, combatant, data, diff, id) => {
|
Hooks.on("preUpdateCombatant", (combat, combatant, data, diff, id) => {
|
||||||
if (data.initiative) {
|
let init = game.settings.get("ose", "individualInit");
|
||||||
|
if (data.initiative && !init) {
|
||||||
let groupInit = data.initiative;
|
let groupInit = data.initiative;
|
||||||
combat.combatants.forEach((ct) => {
|
combat.combatants.forEach((ct) => {
|
||||||
if (ct.initiative && ct._id != data._id && ct.flags.ose.group == combatant.flags.ose.group) {
|
if (
|
||||||
|
ct.initiative &&
|
||||||
|
ct._id != data._id &&
|
||||||
|
ct.flags.ose.group == combatant.flags.ose.group
|
||||||
|
) {
|
||||||
groupInit = ct.initiative;
|
groupInit = ct.initiative;
|
||||||
data.initiative = parseInt(groupInit);
|
data.initiative = parseInt(groupInit);
|
||||||
}
|
}
|
||||||
|
@ -97,11 +105,15 @@ Hooks.on("preUpdateCombatant", (combat, combatant, data, diff, id) => {
|
||||||
});
|
});
|
||||||
|
|
||||||
Hooks.on("renderCombatTracker", (object, html, data) => {
|
Hooks.on("renderCombatTracker", (object, html, data) => {
|
||||||
OseCombat.format(object, html, data);
|
let init = game.settings.get("ose", "individualInit");
|
||||||
|
if (!init) {
|
||||||
|
OseCombat.format(object, html, data);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Hooks.on("preUpdateCombat", async (combat, data, diff, id) => {
|
Hooks.on("preUpdateCombat", async (combat, data, diff, id) => {
|
||||||
if (!data.round) {
|
let init = game.settings.get("ose", "individualInit");
|
||||||
|
if (!data.round || init) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
OseCombat.rollInitiative(combat, data, diff, id);
|
OseCombat.rollInitiative(combat, data, diff, id);
|
||||||
|
|
Loading…
Reference in New Issue