Skip to content

Commit

Permalink
fixes #8 ; Fixed trigger only working for plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
skymen committed Jan 20, 2025
1 parent 2f0a5c0 commit 2fb3dca
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
5 changes: 3 additions & 2 deletions src/runtime/instance.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { id } from "../../config.caw.js";
import { id, addonType } from "../../config.caw.js";
import AddonTypeMap from "../../template/addonTypeMap.js";

export default function (parentClass) {
return class extends parentClass {
Expand All @@ -10,7 +11,7 @@ export default function (parentClass) {
}

_trigger(method) {
super._trigger(self.C3.Plugins[id].Cnds[method]);
super._trigger(self.C3[AddonTypeMap[addonType]][id].Cnds[method]);
}

_release() {
Expand Down
6 changes: 6 additions & 0 deletions template/addonTypeMap.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
const AddonTypeMap = {
plugin: "Plugins",
behavior: "Behaviors",
};

export default AddonTypeMap;
6 changes: 1 addition & 5 deletions template/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
exposed as exposedExps,
unexposed as Exps,
} from "../generated/expressions.js";
import AddonTypeMap from "./addonTypeMap.js";

const pluginBaseClasses = {
object: globalThis.ISDKPluginBase,
Expand Down Expand Up @@ -61,11 +62,6 @@ Object.assign(Instance.prototype, exposedExps);
const Type = createType(typeClass[runtimeConfig.addonType]);
Object.assign(Type.prototype, enums);

const AddonTypeMap = {
plugin: "Plugins",
behavior: "Behaviors",
};

globalThis.C3[AddonTypeMap[runtimeConfig.addonType]][runtimeConfig.id] = {
Acts,
Cnds,
Expand Down

0 comments on commit 2fb3dca

Please sign in to comment.