-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18 from Saibot393/DEVELOPMENT-v2.3.0
Development v2.3.0
- Loading branch information
Showing
12 changed files
with
258 additions
and
36 deletions.
There are no files selected for viewing
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 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 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 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 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 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 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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,52 @@ | ||
import { RideableUtils, cModuleName } from "../utils/RideableUtils.js"; | ||
import { RideableFlags } from "./RideableFlags.js"; | ||
|
||
const cMountedPf2eEffectID = "Compendium.pf2e.other-effects.Item.9c93NfZpENofiGUp"; //Mounted effects of Pf2e system | ||
|
||
var vSystemRidingEffect = null; //saves the systems mounting effects (if any) | ||
|
||
class EffectManager { | ||
|
||
//DECLARATIONS | ||
static async preloadEffects() {} //preloads effects to make things smoother | ||
|
||
static getSystemMountingEffect() {} //returns an appropiate Mounting effect if the game system has one | ||
//Hooks | ||
static onRiderMount(pRider, pRidden, pRidingOptions) {} //handle creation of mounting effects | ||
|
||
static onRiderUnMount(pRider, pRidden, pRidingOptions) {} //handle deletion of mounting effects | ||
|
||
//IMPLEMENTATION | ||
static async preloadEffects() { | ||
if (RideableUtils.isPf2e()) { | ||
vSystemRidingEffect = (await fromUuid(cMountedPf2eEffectID)).toObject(); | ||
} | ||
} | ||
static getSystemMountingEffect() { | ||
|
||
if (vSystemRidingEffect) { | ||
return vSystemRidingEffect; | ||
|
||
//Hooks | ||
static onRiderMount(pRider, pRidden, pRidingOptions) { | ||
console.log("here"); | ||
if (game.settings.get(cModuleName, "RidingSystemEffects") && !(RideableFlags.isFamiliarRider(pRider) || RideableFlags.isGrappled(pRider))) { | ||
if (vSystemRidingEffect) { | ||
pRider.actor.createEmbeddedDocuments("Item", [vSystemRidingEffect]); | ||
} | ||
} | ||
} | ||
|
||
static onRiderUnMount(pRider, pRidden, pRidingOptions) { | ||
if (game.settings.get(cModuleName, "RidingSystemEffects")) { | ||
if (vSystemRidingEffect) { | ||
pRider.actor.deleteEmbeddedDocuments("Item", pRider.actor.itemTypes.effect.filter(vElement => vElement.sourceId == vSystemRidingEffect.flags.core.sourceId).map(vElement => vElement.id)); | ||
} | ||
} | ||
|
||
return; | ||
} | ||
} | ||
|
||
export { EffectManager } | ||
export { EffectManager } | ||
|
||
//Hooks | ||
|
||
Hooks.on("ready", function() { EffectManager.preloadEffects(); }); | ||
|
||
Hooks.on(cModuleName + "." + "Mount", (...args) => EffectManager.onRiderMount(...args)); | ||
|
||
Hooks.on(cModuleName + "." + "UnMount", (...args) => EffectManager.onRiderUnMount(...args)); |
Oops, something went wrong.