Tomm0017 / rsmod

New repository: https://github.com/rsmod/rsmod
https://github.com/rsmod/rsmod
Apache License 2.0
123 stars 100 forks source link

Add ability to retrieve map of definitions without requiring a specif… #64

Closed tristonplummer closed 5 years ago

tristonplummer commented 5 years ago

What has been done?

Added function to allow developers to grab definition maps rather than map elements

Usage:

val defs = world.definitions.get(ItemDef::class.java)
defs.filter { it.name == "Abyssal whip" }.forEach { println(it.id) }
tristonplummer commented 5 years ago

Probably actually wiser to just have this return an immutable set, as the definitions should contain the id anyway.

Tomm0017 commented 5 years ago

I thought about this yesterday when asked in the Discord. I believe it'd have the same cons as the concept of binding plugins to object names. It gives a lot of room for error and unwanted clashing with what RS Mod is going for. If we do have a bunch of different plugins made by different authors giving too much power to where it can affect others is something we have to think thoroughly about.

tristonplummer commented 5 years ago

I feel that should be the responsibility of the plugin authors, rather than something enforced by the system itself. I'm of the opinion that the plugin system should offer as much power and flexibility as possible, and it's up to the plugin developers to put that to good use.

Tomm0017 commented 5 years ago

It's hard for me to come up with a real-world example of this feature's usage. The original suggestion on adding this was flawed in the first place as the attempt was to bind fishing spots via their options, however there's instances where fishing spots can have the same option but contain different fishes

tristonplummer commented 5 years ago

That's fair, at the time of writing this I felt like it was a necessity, though most things can actually be done without requiring this. If it becomes a necessity, I'll open an issue and explain my use case.