New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Game.getMonsterTypes() #2798
Game.getMonsterTypes() #2798
Conversation
This will add the function Game.getMonsterTypes() It will return as the key the monster name and as the value the metatable.
forgot to remove an unused variable
It should either return all monster types or change the function name so it's clear that it will only return rev monster types. |
Well it basicly returns all monster types (from lua and xml), the problem is the following: |
the unused part is okay IMO, since there are creatures that we only spawn during raids/events |
LGTM |
@@ -241,6 +241,7 @@ class Monsters | |||
bool deserializeSpell(MonsterSpell* spell, spellBlock_t& sb, const std::string& description = ""); | |||
|
|||
std::unique_ptr<LuaScriptInterface> scriptInterface; | |||
std::map<std::string, MonsterType> monsters; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
instead of moving that from being private, maybe we should add public method to acquire that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't really feel the necessity to do so, as we just use this one time.
If we had several cases where we would need the public class, then yes it should be done but other than adding one more line it wont really gives us any kind of benefit (atleast that's what I think)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Znote |
yep, got the ultimate development & git reviewing environment set up now, where I use the best of both Windows and Linux. I have also made a script that lets me checkout, compile and run other forks with a simple shell command. :) |
This will add the function
Game.getMonsterTypes()
It will return as the key the monster name and as the value the metatable.
This helps a lot if you want to register a certain event to all of your existing MonsterTypes.
Beware!
This does not trigger unloaded MonsterTypes which are created through xml and not once spawned on map load, it'll only fetch MonsterTypes which are created through revscriptsys (monster/lua) or xml monsters which are load and spawned on startup.