Files
CookieMonster/src/Main/CheckStates/Garden.js
2021-03-16 13:27:21 +01:00

21 lines
697 B
JavaScript

import { CMOptions } from '../../Config/VariablesAndData';
import Flash from '../../Disp/Notifications/Flash';
import PlaySound from '../../Disp/Notifications/Sound';
import { LastGardenNextStep } from '../VariablesAndData';
/**
* This function checks if a garden tick has happened
*/
export default function CheckGardenTick() {
if (
Game.Objects.Farm.minigameLoaded &&
LastGardenNextStep !== Game.Objects.Farm.minigame.nextStep
) {
if (LastGardenNextStep !== 0 && LastGardenNextStep < Date.now()) {
Flash(3, 'GardFlash');
PlaySound(CMOptions.GardSoundURL, 'GardSound', 'GardVolume', false);
}
LastGardenNextStep = Game.Objects.Farm.minigame.nextStep;
}
}