Open
Description
// plugin.ts
import * as ts from "typescript";
import * as tstl from "typescript-to-lua";
console.log("Plugin is being loaded!");
const plugin: tstl.Plugin = {
visitors: {
[ts.SyntaxKind.Decorator]: (node, context) : tstl.Node[] => {
console.log("Found decorator:", node.getText()); // Didn't see it in the console
return context.superTransformNode(node);
}
},
};
export default plugin;
//tsconfig.json
"tstl":{
"luaTarget": "JIT",
"sourceMapTraceback":true,
"luaPlugins": [
{ "name": "./plugin.ts" }
]
},
"compilerOptions": {
"experimentalDecorators": true,
}
const declareModifier = (
type: LuaModifierType | LuaModifierMotionType,
name?: string,
) => (modifier: new () => Partial<CDOTA_Modifier_Lua>) => {};
@declareModifier(LuaModifierType.LUA_MODIFIER_MOTION_NONE)
class modifier_npc_recycle implements Partial<CDOTA_Modifier_Lua> {
static OnCreated(params: object): void {
print(111)
}
static CheckState(): Partial<Record<modifierstate, boolean>> {
return {
// [modifierstate.MODIFIER_STATE_INVISIBLE]: true,
// [modifierstate.MODIFIER_STATE_NO_HEALTH_BAR]: true,
// [modifierstate.MODIFIER_STATE_NO_UNIT_COLLISION]: true,
// [modifierstate.MODIFIER_STATE_INVULNERABLE]: true,
};
}
}
Metadata
Metadata
Assignees
Labels
No labels