mirror of
https://github.com/unanmed/HumanBreak.git
synced 2025-04-24 16:13:24 +08:00
24 lines
711 B
TypeScript
24 lines
711 B
TypeScript
import { Patch, PatchClass } from '@/common/patch';
|
|
import { WeatherController } from '../weather';
|
|
import { isNil } from 'lodash-es';
|
|
|
|
// todo: 添加弃用警告 logger.warn(56)
|
|
|
|
export function patchWeather() {
|
|
const patch = new Patch(PatchClass.Control);
|
|
let nowWeather: string = '';
|
|
let nowLevel: number = 0;
|
|
|
|
patch.add('setWeather', (type, level) => {
|
|
const weather = WeatherController.get('main');
|
|
if (!weather) return;
|
|
if (type === nowWeather && level === nowLevel) return;
|
|
weather.clearWeather();
|
|
if (!isNil(type)) {
|
|
weather.activate(type, level);
|
|
nowWeather = type;
|
|
nowLevel = level ?? 5;
|
|
}
|
|
});
|
|
}
|