Skip to content
This repository has been archived by the owner on Nov 13, 2024. It is now read-only.

Commit

Permalink
version 0.5.14
Browse files Browse the repository at this point in the history
  • Loading branch information
p4535992 committed Mar 26, 2022
1 parent 00ca882 commit cf47a9d
Show file tree
Hide file tree
Showing 9 changed files with 49 additions and 10 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
### 0.5.13
### 0.5.13-14

- Little bug fix
- Integration with mid-qol optional rule, when a token make a attack it will visible for the duration of the attack.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"name": "conditional-visibility",
"title": "Conditional Visibility",
"description": "Hide tokens from some players, but not others, based on the senses the players have. Uses unknown, newspaper, and foggy icons made by <a href=\"https://www.flaticon.com/authors/freepik\" title=\"Freepik\">Freepik</a>, from <a href=\"https://www.flaticon.com/\" title=\"Flaticon\"> www.flaticon.com</a>. Moon icon made by <a href=\"https://www.flaticon.com/authors/iconixar\" title=\"iconixar\">iconixar</a> from <a href=\"https://www.flaticon.com/\" title=\"Flaticon\"> www.flaticon.com</a>",
"version": "0.5.13",
"version": "0.5.14",
"scripts": {
"package": "gulp package",
"build": "gulp build && gulp link",
Expand Down
8 changes: 4 additions & 4 deletions src/module.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "conditional-visibility",
"title": "Conditional Visibility",
"description": "Hide tokens from some players, but not others, based on the senses the players have. Uses unknown, newspaper, and foggy icons made by <a href=\"https://www.flaticon.com/authors/freepik\" title=\"Freepik\">Freepik</a>, from <a href=\"https://www.flaticon.com/\" title=\"Flaticon\"> www.flaticon.com</a>. Moon icon made by <a href=\"https://www.flaticon.com/authors/iconixar\" title=\"iconixar\">iconixar</a> from <a href=\"https://www.flaticon.com/\" title=\"Flaticon\"> www.flaticon.com</a>",
"version": "0.5.13",
"version": "0.5.14",
"author": "Greg Ludington, p4535992, Szefo09, Teshynil",
"type": "module",
"socket": true,
Expand Down Expand Up @@ -61,9 +61,9 @@
"manifestPlusVersion": "1.2.0",
"url": "https://github.com/p4535992/conditional-visibility",
"manifest": "https://github.com/p4535992/conditional-visibility/releases/latest/download/module.json",
"download": "https://github.com/p4535992/conditional-visibility/releases/download/v0.5.13/module.zip",
"readme": "https://github.com/p4535992/conditional-visibility/blob/v0.5.13/README.md",
"changelog": "https://github.com/p4535992/conditional-visibility/blob/v0.5.13/changelog.md",
"download": "https://github.com/p4535992/conditional-visibility/releases/download/v0.5.14/module.zip",
"readme": "https://github.com/p4535992/conditional-visibility/blob/v0.5.14/README.md",
"changelog": "https://github.com/p4535992/conditional-visibility/blob/v0.5.14/changelog.md",
"bugs": "https://github.com/p4535992/conditional-visibility/issues",
"allowBugReporter": true,
"dependencies": [
Expand Down
11 changes: 10 additions & 1 deletion src/module/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,21 @@ const API = {
/**
* The attributes used to track dynamic attributes in this system
*
* @returns {array}
* @returns {string}
*/
get STEALTH_ID_LANG_SKILL(): string {
return <string>game.settings.get(CONSTANTS.MODULE_NAME, 'idLangStealthSkill') ?? 'Stealth';
},

/**
* The attributes used to track dynamic attributes in this system
*
* @returns {array}
*/
get PATH_ATTRIBUTES_SENSES(): string {
return <string>game.settings.get(CONSTANTS.MODULE_NAME, 'pathAttributesSenses') ?? `data.attributes.senses`;
},

/**
* Sets the inAttribute used to track the passive perceptions in this system
*
Expand Down
25 changes: 22 additions & 3 deletions src/module/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,23 @@ export const readyHooks = (): void => {
});

Hooks.on('updateActor', (actor: Actor, change, options, userId) => {
if (actor.token && getProperty(change, `data.attributes.senses`)) {
module.updateActor(<TokenDocument>actor.token, change, options, userId);
// TODO for now only dnd5e
let p = getProperty(change, API.PATH_ATTRIBUTES_SENSES);
// TODO to remove
if(!p){
p = getProperty(change, `data.attributes.senses`);
}
if(p){
if (actor.token) {
module.updateActor(<TokenDocument>actor.token, change, options, userId);
}else{
const token = canvas.tokens?.placeables.find((t:Token) =>{
return t.actor?.id === actor.id;
});
if(token){
module.updateActor(<TokenDocument>token.document, change, options, userId);
}
}
}
});

Expand Down Expand Up @@ -195,7 +210,11 @@ const module = {
}
// const sourceVisionCapabilities: VisionCapabilities = new VisionCapabilities(<Token>document.object);
// TODO for now only dnd5e
const p = getProperty(change, `data.attributes.senses`);
let p = getProperty(change, API.PATH_ATTRIBUTES_SENSES);
// TODO to remove
if(!p){
p = getProperty(change, `data.attributes.senses`);
}
for (const key in p) {
const senseOrConditionIdKey = key;
const senseOrConditionValue = <number>p[key];
Expand Down
8 changes: 8 additions & 0 deletions src/module/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,14 @@ function defaultSettings(apply = false) {
default: apply && SYSTEMS.DATA ? SYSTEMS.DATA.STEALTH_ID_LANG_SKILL : '',
type: String,
},
pathAttributesSenses: {
name: `${CONSTANTS.MODULE_NAME}.setting.pathAttributesSenses.name`,
hint: `${CONSTANTS.MODULE_NAME}.setting.pathAttributesSenses.hint`,
scope: 'world',
config: true,
default: apply && SYSTEMS.DATA ? SYSTEMS.DATA.PATH_ATTRIBUTES_SENSES : '',
type: String,
},
};
}

Expand Down
1 change: 1 addition & 0 deletions src/module/systems/dnd5e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export default {
STEALTH_ACTIVE_SKILL: `data.skills.ste.total`,
// STEALTH_ID_SKILL: `ste`,
STEALTH_ID_LANG_SKILL: `DND5E.SkillSte`,
PATH_ATTRIBUTES_SENSES: `data.attributes.senses`,
NPC_TYPE: `npc`,
/**
* The set of possible sensory perception types which an Actor may have.
Expand Down
1 change: 1 addition & 0 deletions src/module/systems/generic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export default {
STEALTH_ACTIVE_SKILL: ``,
// STEALTH_ID_SKILL: ``,
STEALTH_ID_LANG_SKILL: ``,
PATH_ATTRIBUTES_SENSES: ``,
NPC_TYPE: ``,
SENSES: <SenseData[]>[],
CONDITIONS: <SenseData[]>[
Expand Down
1 change: 1 addition & 0 deletions src/module/systems/pf2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export default {
STEALTH_ACTIVE_SKILL: `data.skills.ste.value`,
// STEALTH_ID_SKILL: `data.skills.ste`,
STEALTH_ID_LANG_SKILL: `PF2E.SkillSte`, // SkillStealth
PATH_ATTRIBUTES_SENSES: `data.attributes.senses`,
NPC_TYPE: `npc`,
SENSES: <SenseData[]>[
{
Expand Down

0 comments on commit cf47a9d

Please sign in to comment.