Samarium
Unfortunately, it still does not work.
I tried this in the player.ts
:
onJoinMap(player: RpgPlayer) {
setTimeout(() => {
console.log('before emit equip');
player.server.module.emit('player.server.onEquip', [player, 'sword-1']);
}, 3000)
},
onEquip(player: RpgPlayer, itemId: string) {
console.log('equipped item by player', itemId);
}
and server/index.ts
import { RpgServer, RpgModule } from '@rpgjs/server'
import player from './player';
/** @ts-ignore */
@RpgModule<RpgServer>({
hooks: {
player: ['onEquip', 'onUnequip'],
},
player
})
export default class RpgServerModule { }
and the console shows only:
before emit equip