@kepoly
Hello,
In my game, I did it this way:
import { MapData, RpgMap, RpgPlayer } from "@rpgjs/server";
const eventSchema = {
graphic: String
}
@MapData({
id: 'grass-land1',
file: require('../worlds/maps/grass-land1.tmx'),
syncSchema: {
events: [
{
...RpgPlayer.schemas,
...eventSchema,
events: {
...RpgPlayer.schemas.events,
...eventSchema
}
}
]
},
})
export default class GrassLand1 extends RpgMap {
}
I had to update the syncSchema of the Map
https://docs.rpgjs.dev/classes/map.html#syncschema
The downside of this solution is that you need to put this on every map in your game.
Also, I didn't take this from the docs, so I don't know if there is a better solution