Files
crystall-punk-14/Content.Shared/_CP14/Random/Rules/CP14IsNight.cs
Red 0a3bd9baba Adjust day/night cycle logic and lighting parameters (#1705)
Increased minimum light level and updated sun shadow directions for smoother transitions. Changed light curve calculation to use cosine, adjusted day detection threshold, and added a console command to check current light level. Renamed and fixed logic in CP14IsNight rule. Updated map and prototype files to use new ambient light colors and ensure consistency.
2025-08-25 02:03:24 +03:00

26 lines
744 B
C#

using Content.Shared._CP14.DayCycle;
using Content.Shared.Random.Rules;
namespace Content.Shared._CP14.Random.Rules;
/// <summary>
/// Checks whether there is a time of day on the current map, and whether the current time of day corresponds to the specified periods.
/// </summary>
public sealed partial class CP14IsNight : RulesRule
{
public override bool Check(EntityManager entManager, EntityUid uid)
{
var transform = entManager.System<SharedTransformSystem>();
var dayCycle = entManager.System<CP14DayCycleSystem>();
var map = transform.GetMap(uid);
if (map is null)
return false;
var isDay = dayCycle.IsDayNow(map.Value);
return Inverted ? isDay : !isDay;
}
}