RanvierMUD / core

Core engine code for Ranvier
https://ranviermud.com
MIT License
45 stars 40 forks source link

getDataFilePath(type, id) uses a static switch statement #92

Closed devpitOne closed 5 years ago

devpitOne commented 5 years ago

Hi,

I just picked up RanvierMud two days ago and in testament to its extensiblity am already comfortable using it.

I have prototyped a bundle for RanvierMud which allows me to persist an extension of the Room class. While doing so I noticed that the Data class method getDataFilePath uses a static switch statement to decide the file paths. This would make it impossible to use Data in a bundle without also making a change to Ranvier core.

Do I have an incorrect usage and Data is not meant to be used by bundles? Is this an intentional limitation on persistent data? Are there any plans to make this dynamic, say to work off the EntityLoaders in ranvier.json?

Thanks.

shawncplus commented 5 years ago

It's not really suggested to use the Data class because it's so... dumb for all the reasons you pointed out and it will eventually be totally removed for proper EntityLoader usage. So EntityLoaders are the way to go. They're a bit more complex to use but with that complexity comes so much more flexibility/power. There is a guide in the documentation for creating new entity loaders/data sources https://ranviermud.com/extending/entity_loaders/

devpitOne commented 5 years ago

Thanks, I used Data because it was easy to follow for accounts and persons. I'll see about refactoring away from it.