Cuberite Forum

Full Version: Weather control
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
It'd be nice to have a plugin providing a more thorough weather control. Currently, the core can change weather, and that's it. However, some people might want their weather never to change, or change on command. Thus, I'm proposing a new set of weather commands, either in a separate plugin, or as part of the Core:

- /weather <weather> - sets current weather to the one specified, regular weather-cycling is enabled
- /weather keep <weather> - sets current weather to the one specified, weather-cycling disabled (the weather stays forever)
- /weather change - changes the current weather to a different one, doesn't affect weather-cycling
- /weather interval <weather> <interval> - sets the interval used for regular weather-cycling for the specified weather.
- /weather intervals <sunny-int> <rainy-int> <thunder-int> - sets the intervals used for regular weather-cycling.
I could work on this, but maybe we need a cWorld::SetWeatherInterval(number) function for this? I can add it if you want. Also do you want the /weather keep etc for every world or only for the world the player is in?
Just the player's world, it wouldn't make much sense to be global.
If the interval-setting functions aren't there already, do make and export them. You should probably add the getters, too, in such a case, just so that the API is orthogonal.
Just noticed that there they already exist. They just have a different name: GetTicksUntilWeatherChange and SetTicksUntilWeatherChange
That's not exactly what this plugin needs - those set the current delay, which, once the weather changes, gets reset to a default value, based on the new weather. We need access to those default values. Alternatively, the plugin may change the interval after each change in the OnWeatherChanged hook.
I started working on this as part of my new WorldUtilities plugin. (Even though I finished it already. It has all the features I want it to have for the weather command.)