import { MeshGameObject, hasAction } from '@gedit/runtime-render'; import { PluginPureHook } from '@gedit/runtime-compiler'; import { local } from '../common'; export function events(ctx: PluginPureHook, mesh: T): void { if (hasAction(mesh)) { mesh.events.forEach(event => { if (!event.route) { return; } ctx.println(`${local.COMPONENT}.setInteractive();`); ctx.println(`${local.COMPONENT}.on('${event.type}', () => event.events.emitEvent('${event.route}'));`); }); } }