Пример #1
0
        /// <summary>Calculates current UV intensity and adds that value to the damage counter.</summary>
        public void CheckForBurnDamage(SDVTime time)
        {
            //TODO? maybe check for sunscreen here
            int newDamage = UVIndex.UVIntensityAt(time);

            SunDamageCounter += newDamage;
            if (Config.DebugMode)
            {
                Monitor.Log($"New burn damage level is {NewBurnDamageLevel} | SunDamageCounter is at {SunDamageCounter}", LogLevel.Debug);
            }
        }
Пример #2
0
        /// <summary>
        /// Update suncreen status and check for damage from sun exposure. Raised when the game time changes (10-minute intervals).
        /// </summary>
        /// <param name="sender">The event sender.</param>
        /// <param name="e">The event arguments.</param>
        private void onTimeChanged(object sender, TimeChangedEventArgs e)
        {
            SDVTime time    = SDVTime.CurrentTime;
            int     UV      = UVIndex.UVIntensityAt(time);
            int     uvIndex = Convert.ToInt32((double)UV / 25);

            TotalUVExposure += UV;
            if (Config.DebugMode)
            {
                Monitor.Log($"Time is {time.Get12HourTime()} - current UV strength is {UV} or index {uvIndex}. Total exposure is {TotalUVExposure}", LogLevel.Debug);
            }

            //Possibly redundant? (Also in this.onHalfSecondUpdateTicked)
            Sunscreen.UpdateStatus(); //Checks and updates if sunscreen has worn off or washed off

            if (Config.EnableSunburn &&
                Config.SunburnPossible(SDate.Now()) && //Check config settings
                e.NewTime != e.OldTime && e.NewTime % 10 == 0 &&
                Game1.currentLocation.IsOutdoors &&
                !Sunscreen.IsProtected()) // Outdoors and not protected by sunscreen
            {
                Burn.CheckForBurnDamage(time);
            }
        }