Mindustry
Mindustry copied to clipboard
[Refactor] Server cleanup and more
I did a small refactoring, but didn't break the formatting. Also i added the ability for mods to change the default GameOverEvent listener so you can add a custom map loader or custom GameOver message Also i made two fields public. Why? Because using getters and setters in this class is pointless
- [x] I have read the contribution guidelines.
- [x] I have ensured that my code compiles, if applicable. It compiles
- [x] I have ensured that any new features in this PR function correctly in-game, if applicable. It works
Also i made two fields public. Why? Because using getters and setters in this class is pointless
No, it isn't. It's not clear that setting these undocumented fields happens to do anything in the moment and you are essentially exposing implementation details that could change at any time. The setters should be things like "setNextMap", not nextMapOverride. Additionally, even I don't remember what lastMode is for (can it be null? what does it actually refer to?)
I'll try to replace "lastServerMode" with "Vars.state.rules.mode()" and test how will it work
And yes, it works correctly for any gamemode. Also, it will choose the next map based on the gamemode of the current one, which is better.
@Anuken now nextMapOverride is documented, lastServerMode is replaced and removed. What about all the other changes?