public static void CalculateLightOutage(BaseLight baseLight, EffectsObject eo) { if (!Data.UseRandomLightOutage || IsDefraggable(baseLight) || !IsControllable(baseLight, eo) || !eo.EffectsMap.UseRandomLightOutage || (baseLight is TSBaseLight && !((TSBaseLight)baseLight).UseRandomLightOutage)) { return; } int lowNumber = Support.GetRandom(0, (100 - eo.EffectsMap.LightOutageChancePerTick)); int highNumber = lowNumber + eo.EffectsMap.LightOutageChancePerTick; int randomChance = Support.GetRandom(0, 100); if (randomChance >= lowNumber && randomChance <= highNumber) { if (baseLight.Burning) { baseLight.Douse(); } else { baseLight.Ignite(); } } }
public static void UpdateManagedLight(BaseLight baseLight, int currentLevel) { if (currentLevel >= Data.LightsOnLevel && !baseLight.Burning) { baseLight.Ignite(); } else if (currentLevel < Data.LightsOnLevel && baseLight.Burning) { baseLight.Douse(); } }