Files
crystall-punk-14/Content.Shared/_CP14/Random/Rules/IsDaylight.cs
Ed 1867903c46 Planetarization (#1040)
* tiers to level demiplanes

* Update demiplane_keys.yml

* demiplane on planets

* migrate to wizden dayCycle + planetarize Comoss

* Update comoss_d.yml

* Update audio_music.yml

* Update dev_map.yml

* add shadows to demiplanes

* remove outdated systems

* fix silvas

* silva fix

* Update factoria.yml

* Update island.yml
2025-03-19 12:52:37 +03:00

28 lines
851 B
C#

using Content.Shared.Random.Rules;
using Robust.Shared.Map.Components;
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 CP14TimePeriod : RulesRule
{
[DataField]
public float Threshold = 100f;
public override bool Check(EntityManager entManager, EntityUid uid)
{
var transform = entManager.System<SharedTransformSystem>();
var map = transform.GetMap(uid);
if (!entManager.TryGetComponent<MapLightComponent>(map, out var light))
return false;
var lightColor = light.AmbientLightColor;
var medium = lightColor.R + lightColor.G + lightColor.B / 3f;
return medium > Threshold;
}
}